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

From: Erik Dominikus (erik.dominikus71 at gmail.com)
Date: Sat Aug 11 01:59:40 EDT 2012

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, 2012-08-07 at 22:56 -0500, Robby Findler wrote:
> Looks like a bug in compose1 (and compose) to me.
> 
> Robby
> 
> On Tue, Aug 7, 2012 at 10:46 PM, Erik Dominikus
> <erik.dominikus71 at gmail.com> 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 (x) 0)))
> > 1
> >
> >> (procedure-arity (compose1 (lambda (x) x) (lambda (x y) 0)))
> > (arity-at-least 0)
> >
> > I think the arity of the first procedure above should be exactly 0 since
> > (arity-at-least 0) means that the procedure can take 0, 1, 2, 3
> > arguments and so on, and indeed DrRacket says that it can't:
> >
> >> ((compose1 (lambda (x) 0) (lambda () 0)) 0)
> > #<procedure>: expects no arguments, given 1: 0
> >
> > By the same way of thought, I think the arity of the third procedure
> > should be exactly 2.
> >
> > Am I missing something?
> >
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users



Posted on the users mailing list.