Hey Thomas - How'd you get the nice syntax highlighting in your post? Alan
On Sat, Jun 8, 2013 at 7:16 PM, Steven D. Arnold <thoth.amon.i...@gmail.com>wrote: > Thanks for the responses! As suggested, wrapping in 'doall' does work. > > > On Jun 8, 2013, at 3:28 AM, Thomas Heller <th.hel...@gmail.com> wrote: > > (defn filter-file [filename] > (with-open [rdr (io/reader filename)] > (reduce (fn [words line] > (->> (str/split line #"\s+") > (filter #(and (<= (count %) 9) > (>= (count %) 4))) > (set) > (set/union words))) > #{} > (line-seq rdr)))) > > > That code is really graceful and clean. I like it a lot. But for some > reason I've never loved 'reduce' before, which probably means I've never > used it where it is called for. Reduce just seems so generic... it's what > you say when you haven't got anything better to say, something like "all > right, do this." > > But, having said that, I'd pick your implementation over mine, because I > think it's conceptually cleaner (as recursive algorithms often are). Nice. > Thanks! > > steven > > -- > -- > 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. > > > -- -- 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.