I found this code snippet [1] written by Rich but presumably using a
very old version of Clojure. The thing that stand out the most is this
at the bottom (the 'correct' fn):
(or (known [word] *nwords*) (known (edits1 word) *nwords*)
(known-edits2 word *nwords*) [word])
It seems to me that Rich was using 'or' to test whether a seq is empty
or not, wanting to keep the first non-empty one! Obviously this wouldn't
work with current Clojure as an empty seq is still truthy. Consequently
if I don't mess about with Rich's code I always get the empty set back
as (known [word] *nwords*) returns something truthy (the empty set)...
so it seems that at the time Rich wrote this empty seqs evaluated to
false...Is this true?
[1]
http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Norvig_Spelling_Corrector
Jim
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.