(use goo)

;; Word Extractor!

(df flush-whitespace (port|<port>)
  (def c (peek port))
  (if (mem? ascii-whitespaces (char->ascii c))
      (seq
        (get port)
        (flush-whitespace port))
      c))

(df read-next-word (port|<port> => <str>)
  (flush-whitespace port)
 
  )

(df read-delimited-list (endchar|<chr> port|<port>)
  (def retlist nil)  
  (rep loop ((c (flush-whitespace port)))    
    (if (== c endchar)
        (seq (get port) (rev retlist))
        (seq
          (opf retlist (pair (read port) _))
          (loop (flush-whitespace port))))))