Skips whitespace using the current readtable’s definition of “whitespace”

; place in own library to abide by the LGPL
; skip-whitespace is copied from
; which has the following licence:
; Copyright ©1995-2006 Matthew Flatt
; Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Library General Public License, Version 2 published by the Free Software Foundation.
; [ ] in source changed to ( ) to avoid conflict with brackets.scm

(scheme:define (skip-whitespace port)
  ;; Skips whitespace characters, sensitive to the current
  ;; readtable's definition of whitespace
  (let ((ch (peek-char port)))
    (unless (eof-object? ch)
      ;; Consult current readtable:
      (let-values (((like-ch/sym proc dispatch-proc)
                    (readtable-mapping (current-readtable) ch)))
        ;; If like-ch/sym is whitespace, then ch is whitespace
        (when (and (char? like-ch/sym)
                   (char-whitespace? like-ch/sym))
          (read-char port)
          (skip-whitespace port))))))


This hack depends on arc3.1, defarc0, defarc-ac0, extend0, and scheme0.