Sean, On Jun 16, 2009, at 10:59 AM, Sean Devlin wrote: > The last example was okay, but it felt a little forced. Let's create > a function to do the currying for us: > > user=>(defn my-parab [a b c] (fn[x](quad a b c x))) > > Now, it isn't immediately obvious, but my-parab returns a function. > > user=>(ifn? (my-parab 1 0 0)) > true > > Let's use it in a map > > user=>(map (my-parab 1 0 0) my-ints) > (1 4 9 16 25 36 49 64 81 100)
Great stuff! You probably already know this and just didn't want to bring it up, but you can use 'partial' instead too: (map (partial quad 1 0 0) my-ints) — Daniel Lyons http://www.storytotell.org -- Tell It! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---