it does look like &&& is pretty much the same as juxt. partial isn't the same as curry, though. (curry uses thunk, which is the same as partial, but can take a function and no args) curry waits for a specific number of args before it evals. so if you keep evaluating a curried fn with 0 args, you'll keep getting a curried fn back. (default is 2 args, but you can specify any number)
On Oct 29, 12:42 pm, Sean Devlin <francoisdev...@gmail.com> wrote: > I'm a huge fan of point free code. Some of you functions already > exist in Clojure under different names, and I have a few questions. > > >>> is the same as (reverse (comp x)) right? > > &&& is called juxt > *** - I believe this (map (juxt f-coll) coll) > > curry is called partial > > Still, good to see the comparison. > > On Oct 29, 10:20 am, harrison clarke <notall...@gmail.com> wrote: > > > > > there are a few on git > > already:http://github.com/hclarke/pointfree-clojure/tree/master/src/ > > > i'll add more soon. > > also, this could be worth looking at:http://www.haskell.org/arrows/ > > there will be some differences, but it's pretty much the same idea. > > > On Oct 28, 9:09 pm, Paul Barry <pauljbar...@gmail.com> wrote: > > > > Would love to see some examples usages of these > > > > On Sun, Oct 25, 2009 at 4:16 PM, harrison clarke > > > <notall...@gmail.com>wrote: > > > > > so i was using haskell, and the pointfree stuff is fun, so naturally i > > > > had to implement some of it in clojure. > > > > > this is what i have so far. library and examples within: > > > >http://github.com/hclarke/pointfree-clojure > > > > > it has >>>, &&&, ***, +++, |||, and others > > > > they take functions as arguments and return functions > > > > > for those that don't know: > > > > >>> composes functions in reverse order. it basically pipes them > > > > >>> together > > > > left to right > > > > &&& maps functions over a single value (haskell's takes two functions, > > > > this takes any number) > > > > *** maps functions over a sequence (as above, this takes any number of > > > > functions) > > > > +++ takes a choice ([bool, x]), and applies f1 if f2 if false ([bool, > > > > (f x)]) > > > > ||| same as above, but just returns the (f x) part. drops the bool > > > > > there's also: > > > > fst applies function to the first element. same as (*** f id id id...) > > > > snd applies function to the second element. same as (*** id f id id > > > > id...) > > > > ttt same as (+++ f id). same as haskell's left > > > > fff same as (+++ id f). same as haskell's right > > > > III takes [i x] and applies the ith function (starting from 0), > > > > returning [i (f x)] > > > > iii same as above, but drops the bool > > > > > curry makes a function keep returning a function until you pass it > > > > enough arguments to evaluate (default is 2 args) > > > > see curry example on github for how it works > > > > > at this point, names, and pretty much everything, are likely to > > > > change. > > > > thoughts, questions, suggestions, etc.? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---