currying in perl6

3 views
Skip to first unread message

Matthew D Swank

unread,
Apr 14, 2005, 1:51:08 PM4/14/05
to perl6-c...@perl.org
I apologize if this has already been addressed, but given the following
definition:

sub make-adder ($a){
sub ($b) {
$a + b$;
}
}

make-adder 5

returns a closure, however pugs won't parse:

make-adder 5 6

or:

(make-adder 5) 6

I have to resort to:

(make-adder 5)(6)

Is this correct behavior?

Thanks,
Matt

--
"You do not really understand something unless you can explain it to your grandmother." — Albert Einstein.

Autrijus Tang

unread,
Apr 14, 2005, 2:01:09 PM4/14/05
to Matthew D Swank, perl6-c...@perl.org
On Thu, Apr 14, 2005 at 12:51:08PM -0500, Matthew D Swank wrote:
> returns a closure, however pugs won't parse:
>
> make-adder 5 6
>
> or:
>
> (make-adder 5) 6
>
> I have to resort to:
>
> (make-adder 5)(6)
>
> Is this correct behavior?

I think it's the correct behaviour, yes. We are not currying
by default, unlike a certain Other Language... :-)

Thanks,
/Autrijus/

Reply all
Reply to author
Forward
0 new messages