Re: [racket] on the arity of the composition of procedures with different arities

2012-11-11 Thread Robby Findler
Eli: are you saying that you think this is _not_ a bug? (I think Racket has firmly positioned itself in the "primitive operations in the language do the right thing or signal errors" camp, so a performance-based concern like this seems quite out of character.) Robby On Fri, Nov 9, 2012 at 10:40

Re: [racket] on the arity of the composition of procedures with different arities

2012-11-09 Thread Matthias Felleisen
Eli, if compose is 20x slower than writing out the lambda, and respect for arity costs 5%, I think we're fine. A warning in the docs sounds good. Something like "Warning: Using compose, instead of plain lambda, for function composition helps readability and facilitates re-coding the numerous

Re: [racket] on the arity of the composition of procedures with different arities

2012-11-09 Thread Robby Findler
Re 3.: we should fix those, then. :) Robby On Fri, Nov 9, 2012 at 10:40 AM, Eli Barzilay wrote: > I just measured the overhead again, to see if things changed. The > attached file has the exact implementation of the compose functions, > and another copy with the proper reduction and renaming.

Re: [racket] on the arity of the composition of procedures with different arities

2012-11-09 Thread Eli Barzilay
I just measured the overhead again, to see if things changed. The attached file has the exact implementation of the compose functions, and another copy with the proper reduction and renaming. For the correct function I'm getting ~5x slowdown from the current code, which in turn is 20x slower than

Re: [racket] on the arity of the composition of procedures with different arities

2012-11-09 Thread Robby Findler
I think the right approach is to make the function behave correctly first and then find the places to optimize second. In this case, using procedure-reduce-arity (or something else with the same effect) is not merely "nice" but, IMO, necessary. That is, we have procedure-arity in our PL and our pr

Re: [racket] on the arity of the composition of procedures with different arities

2012-11-09 Thread Eli Barzilay
On Tue, Aug 7, 2012 at 10:46 PM, Erik Dominikus wrote: > I had this conversation with DrRacket 5.2: > [...] On August 7th, Robby Findler wrote: > Looks like a bug in compose1 (and compose) to me. The source of both `compose' and `compose1' has the place where this would be fixed -- see the "here

Re: [racket] on the arity of the composition of procedures with different arities

2012-08-11 Thread Robby Findler
Glad to hear you're all set. I've submitted a PR anyways, so hopefully this will be fixed for others. Thanks for letting us know! Robby On Sat, Aug 11, 2012 at 12:59 AM, Erik Dominikus wrote: > After looking at collects/racket/private/list.rkt, I think this issue > might be too hard to deal wit

Re: [racket] on the arity of the composition of procedures with different arities

2012-08-10 Thread Erik Dominikus
After looking at collects/racket/private/list.rkt, I think this issue might be too hard to deal with; I forgot that a procedure could have optional and keyword arguments. Thus, I decided to roll my own stripped-down version of 'compose'; I only need a little of it actually. Thank you. On Tue,

Re: [racket] on the arity of the composition of procedures with different arities

2012-08-07 Thread Robby Findler
Looks like a bug in compose1 (and compose) to me. Robby On Tue, Aug 7, 2012 at 10:46 PM, Erik Dominikus wrote: > I had this conversation with DrRacket 5.2: > >> (procedure-arity (compose1 (lambda (x) 0) (lambda () 0))) > (arity-at-least 0) > >> (procedure-arity (compose1 (lambda (x) 0) (lambda (

[racket] on the arity of the composition of procedures with different arities

2012-08-07 Thread Erik Dominikus
I had this conversation with DrRacket 5.2: > (procedure-arity (compose1 (lambda (x) 0) (lambda () 0))) (arity-at-least 0) > (procedure-arity (compose1 (lambda (x) 0) (lambda (x) 0))) 1 > (procedure-arity (compose1 (lambda (x) x) (lambda (x y) 0))) (arity-at-least 0) I think the arity of the fir