[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] spellcheck benchmark
From: |
Sunnan |
Subject: |
Re: [Chicken-users] spellcheck benchmark |
Date: |
Tue, 15 Mar 2005 00:27:17 +0100 |
User-agent: |
Mozilla Thunderbird 1.0 (X11/20050111) |
(Forgot to select "reply to all", so I just sent it to R.B. initially,
sorry.)
Ruhi Bloodworth wrote:
Here's my first go at the spellcheck benchmark.
Any improvements ?
Sure... shorter, shorter! For example, there's no need to use a main
when the toplevel will do just fine, and there's no need to set a
variable for things you only use once (in this case input and line), and
chicken has an "unless" form.
; declarations go here
(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))))
This is very slow on my computer, however.