Skip Menu |
 

This queue is for tickets about the lambda CPAN distribution.

Report information
The Basics
Id: 99464
Status: open
Priority: 0/
Queue: lambda

People
Owner: Nobody in particular
Requestors: ambs [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Enhancement request
Download (untitled) / with headers
text/plain 391b
Hello Currently, lambda is (mostly) an ACME module. It would be great to make a little more powerful: my $code = λ $a { print "-- $a --"; }; $code->("foo"); That is, use Devel::Declare to obtain a list of variables, and make them act as a signature for the anonymous sub. I am planning this for so much time, but I can't find the time to learn Devel::Declare :-) Cheers :-)
Download (untitled) / with headers
text/plain 945b
On Mon Oct 13 14:24:15 2014, AMBS wrote: Show quoted text
> Hello > > Currently, lambda is (mostly) an ACME module. > > It would be great to make a little more powerful: > > > my $code = λ $a { print "-- $a --"; }; > > $code->("foo"); > > That is, use Devel::Declare to obtain a list of variables, and make > them act as a signature for the anonymous sub. > > I am planning this for so much time, but I can't find the time to > learn Devel::Declare :-) > > Cheers :-)
You can do something very much like that by wrapping Function::Parameters: package lambda; use strict; use warnings; use utf8; use Function::Parameters (); sub import { utf8->import; Function::Parameters->import({ 'λ' => { defaults => 'function_strict', name => 'prohibited', }, }); } sub unimport { Function::Parameters->unimport('λ'); } 'ok' __END__ This is all untested, but it should give you syntax like my $code = λ ($x) { "-- $x --" };
Subject: Re: [rt.cpan.org #99464] Enhancement request
Date: Thu, 15 Jan 2015 11:38:39 +0000
To: bug-lambda [...] rt.cpan.org, ambs [...] cpan.org
From: Alberto Simoes <ambs [...] perl-hackers.net>
Download (untitled) / with headers
text/plain 1.1k
On 14/01/15 21:57, Lukas Mai via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=99464 > > > On Mon Oct 13 14:24:15 2014, AMBS wrote:
>> Hello >> >> Currently, lambda is (mostly) an ACME module. >> >> It would be great to make a little more powerful: >> >> >> my $code = λ $a { print "-- $a --"; }; >> >> $code->("foo"); >> >> That is, use Devel::Declare to obtain a list of variables, and make >> them act as a signature for the anonymous sub. >> >> I am planning this for so much time, but I can't find the time to >> learn Devel::Declare :-) >> >> Cheers :-)
> > You can do something very much like that by wrapping Function::Parameters: > > package lambda; > use strict; use warnings; > use utf8; > > use Function::Parameters (); > > sub import { > utf8->import; > Function::Parameters->import({ > 'λ' => { > defaults => 'function_strict', > name => 'prohibited', > }, > }); > } > > sub unimport { > Function::Parameters->unimport('λ'); > } > > 'ok' > __END__ > > This is all untested, but it should give you syntax like > > my $code = λ ($x) { "-- $x --" }; >
Need to test \o/ Cheers Alberto


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.