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

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Sat Aug 11 03:06:26 EDT 2012

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
<erik.dominikus71 at gmail.com> wrote:
> 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.