On Fri, Oct 9, 2009 at 10:37 PM, Mark Tomko <mjt0...@gmail.com> wrote:
> ; a returns a new similarity function that applies the provided > transform function > ; before comparing a pair of collections > (defn make-coll-similarity-fn [coll-transform] > (fn [coll1 coll2] coll-similarity [coll1 coll2 coll-transform])) > > ; makes an n-gram similarity function using the provided value for 'n' > (defn make-n-gram-similarity [n] (make-coll-similarity-fn (make-n-gram- > fn n))) > > Then use my new similarity function generator: > > (def bigram-similarity (make-coll-similarity-fn (make-n-gram-fn 2))) > > (bigram-similarity "abcde" "abc") > > I get the following: > > ["abcde" "abc" #<similarity$make_n_gram_fn__114$fn__116 > org.ricercata.similarity$make_n_gram_fn__114$fn__...@219ba640>] > > I must be missing something obvious, but I can't see it. > It looks like you're missing parens in make-coll-similarity-fn. It does nothing with coll-similarity and then returns a vector. Should it be more like this? (defn make-coll-similarity-fn [coll-transform] (fn [coll1 coll2] (coll-similarity coll1 coll2 coll-transform))) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---