[Shootout-list] chicken spellcheck benchmark

Ruhi Bloodworth ruhib@visionsnorth.ca
Wed, 16 Mar 2005 19:19:18 -0600


--=-IhqLqiikWGfN1OQD2ZkY
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi,
There is an error in the current program.
I have attached a fixed version.

Regards,
Ruhi Bloodworth

--=-IhqLqiikWGfN1OQD2ZkY
Content-Disposition: attachment; filename=spellcheck.scm
Content-Type: text/x-scheme; name=spellcheck.scm; charset=us-ascii
Content-Transfer-Encoding: 7bit

;;; spellcheck benchmark

; read the word dictionary
; read words from standard input and print those words 
;    which do not appear in the dictionary
; both the dictionary and standard input have only one word per line
; no line will exceed 128 characters (including newline)

(declare
 (uses utils)
 (disable-interrupts)
 (block)
 (usual-integrations)
 (fixnum))

(define dict (make-hash-table string=? 10000))

(for-each-line (cute hash-table-set! dict <> #t)
	       (open-input-file "User.Dict.Words"))

(for-each-line (lambda (word)
		 (unless (hash-table-ref dict word)
			 (print word))))


--=-IhqLqiikWGfN1OQD2ZkY--