Re: -> vs comp

2009-10-18 Thread Robert Fischer
The F# language does partial application through calling the function: if you don't supply enough arguments, they're partially applied. The |> syntax is for "backwards" (object-y) partial application: let f x y = ... let g = f 1 let h = 1 |> f The |> operator is built-in in F#, but in OCaml

Re: -> vs comp

2009-10-18 Thread Sean Devlin
I've been using & and p, respectively. On Oct 18, 2:21 pm, B Smith-Mannschott wrote: > On Sun, Oct 18, 2009 at 20:04, Stuart Halloway > > wrote: > > > I find the suite of ->, ->>, anonymous functions, partial, and comp > > sufficient for my needs, with each having its place. > > > My only grumb

Re: -> vs comp

2009-10-18 Thread B Smith-Mannschott
On Sun, Oct 18, 2009 at 20:04, Stuart Halloway wrote: > > I find the suite of ->, ->>, anonymous functions, partial, and comp > sufficient for my needs, with each having its place. > > My only grumble is that "partial" is a lot of characters. I would love > a one-character alternative, if it coul

Re: -> vs comp

2009-10-18 Thread Stuart Halloway
I find the suite of ->, ->>, anonymous functions, partial, and comp sufficient for my needs, with each having its place. My only grumble is that "partial" is a lot of characters. I would love a one-character alternative, if it could be reasonably intuitive. Stu > On Oct 16, 10:22 pm, Sean D

Re: -> vs comp

2009-10-17 Thread Stuart Sierra
On Oct 16, 10:22 pm, Sean Devlin wrote: > In order to generate closures, every function should take parameters > first, and data at the end, so that they work well with partial. It's really hard to come up with a consistent practice that works well for all scenarios. Even clojure.core is incons

Re: -> vs comp

2009-10-17 Thread Wilson MacGyver
Kinda off topic. I didn't realize ->> has been introduced. Is there a list of new forms that's been introduced since 1.0? Thanks On Sat, Oct 17, 2009 at 9:17 AM, Laurent PETIT wrote: > > > 2009/10/17 James Reeves >> >> On Oct 17, 4:55 am, samppi wrote: >> > Personally, I can go either way—I j

Re: -> vs comp

2009-10-17 Thread Sean Devlin
Okay, comp on its own is not comparable to ->, good point. Once you add partial, I think a more direct comparison is possible. (let [& comp p partial ((& (p filter predicate) (p map function) (p remove other-predicate)) some-seq)) This is a lot closer to the new ->>. Anyw

Re: -> vs comp

2009-10-17 Thread Sean Devlin
Hmmm... good point about java interop. Didn't consider that. On Oct 17, 3:44 am, Timothy Pratley wrote: > On Oct 17, 1:22 pm, Sean Devlin wrote: > > > Given these reasons, I'd like to make a proposal. Contrib should be > > centered around closures, not ->. > > Hi Sean, > > -> seems to work nic

Re: -> vs comp

2009-10-17 Thread Meikel Brandmeyer
Hi. Am 17.10.2009 um 13:25 schrieb James Reeves: > Well, defining the "most important argument" can be tricky. However, > it would be nice if there were map and filter variants that could be > used with ->. There is also ->>. (->> some-seq (filter predicate) (map function) (remove othe

Re: -> vs comp

2009-10-17 Thread Laurent PETIT
2009/10/17 James Reeves > > On Oct 17, 4:55 am, samppi wrote: > > Personally, I can go either way—I just kind of wish that there was a > > consistent practice for the placement of the most important argument, > > whether it's first or last, in both core and contrib. > > Well, defining the "most

Re: -> vs comp

2009-10-17 Thread James Reeves
On Oct 17, 4:55 am, samppi wrote: > Personally, I can go either way—I just kind of wish that there was a > consistent practice for the placement of the most important argument, > whether it's first or last, in both core and contrib. Well, defining the "most important argument" can be tricky. How

Re: -> vs comp

2009-10-17 Thread James Reeves
On Oct 17, 3:22 am, Sean Devlin wrote: > I have an idea in my head, and I can't quite put all the details > together.  The intent with of this posting is to start a healthy > debate of the merits of -> vs. comp.  I know people on this list will > think of something. It seems to me you're compari

Re: -> vs comp

2009-10-17 Thread Timothy Pratley
On Oct 17, 1:22 pm, Sean Devlin wrote: > Given these reasons, I'd like to make a proposal. Contrib should be > centered around closures, not ->. Hi Sean, -> seems to work nicely for java interop in ways that comp does not. I think it has its place. (defn full-screen "Enables full-screen mo

Re: -> vs comp

2009-10-16 Thread John Harrop
On Fri, Oct 16, 2009 at 11:55 PM, samppi wrote: > Don't forget about the third piece of the puzzle, #() (and fn). > Whenever I need to create a function using ->, I just do #(-> % ...). > It's about as much typing as (comp ...). > > Personally, I can go either way—I just kind of wish that there w

Re: -> vs comp

2009-10-16 Thread samppi
Don't forget about the third piece of the puzzle, #() (and fn). Whenever I need to create a function using ->, I just do #(-> % ...). It's about as much typing as (comp ...). Personally, I can go either way—I just kind of wish that there was a consistent practice for the placement of the most imp

Re: -> vs. comp

2009-04-01 Thread kkw
Thanks for the feedback everyone! Kev On Apr 1, 11:38 pm, Rayne wrote: > comp seems more appropriate here. > > On Mar 31, 11:52 pm, kkw wrote: > > > Hi folks, > > >     I have some code where I wanted to: > > - take a list of stuff (which includes another list inside) > > - use 'seq-utils/flat

Re: -> vs. comp

2009-04-01 Thread Rayne
comp seems more appropriate here. On Mar 31, 11:52 pm, kkw wrote: > Hi folks, > >     I have some code where I wanted to: > - take a list of stuff (which includes another list inside) > - use 'seq-utils/flatten' to flatten the list > - use 'interpose' to add comma-delimiting strings between the

Re: -> vs. comp

2009-04-01 Thread Laurent PETIT
While we speak about function composition (or not), you can also use the partial function creator to obtain "point-free" (no need for anonymous function with formal argument declaration or use) code: And with the use of comp, you could define the function without even explicitly naming any formal

Re: -> vs. comp

2009-03-31 Thread David Nolen
comp creates a new function that you can store. -> threads a value through a series of expressions. On Wed, Apr 1, 2009 at 12:52 AM, kkw wrote: > > Hi folks, > >I have some code where I wanted to: > - take a list of stuff (which includes another list inside) > - use 'seq-utils/flatten' to fl