#!/usr/local/bin/guile \
-e main -s
!#

;;; $Id: spellcheck.guile,v 1.2 2001/06/29 23:12:37 doug Exp $
;;; http://www.bagley.org/~doug/shootout/

(use-modules (ice-9 format))

(define (main args)
  (let ((n (or (and (= (length args) 2) (string->;number (cadr args))) 1))
    (dict (make-hash-table 10000)))
    (with-input-from-file "Usr.Dict.Words"
      (lambda ()
    (let loop ((line (read-line)))
      (cond ((eof-object? line) #f)
        (else
         (hash-set! dict line #t)
         (loop (read-line)))))))
    (let loop ((word (read-line)))
      (cond ((eof-object? word) #f)
        (else
         (if (not (hash-ref dict word))
         (display (format "~A\n" word)))
         (loop (read-line)))))))