Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Simulating Perl6 Meta/Hyper operators mit pure Functional Programming

by tobyink (Abbot)
on Oct 01, 2013 at 18:58 UTC ( #1056521=note: print w/ replies, xml ) Need Help??


in reply to Simulating Perl6 Meta/Hyper operators with pure Functional Programming

Nice. Re the syntax, you might be interested in Sub::Infix - it would enable syntax along the lines of:

my $iter = [@list1] |X| [@list2];
use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name


Comment on Re: Simulating Perl6 Meta/Hyper operators mit pure Functional Programming
Download Code
Re^2: Simulating Perl6 Meta/Hyper operators with pure Functional Programming
by LanX (Canon) on Oct 01, 2013 at 22:41 UTC
    Sub::Infix is indeed nice, really clever idea ... thanks! :)

    My problem with overloading so far was that I couldn't use wantarray, i.e. an overloaded '+' always has to return a scalar.

    But you don't have this problem, right?

    Anyway ATM I try to find solutions which work w/o overloading to avoid potential side effects.

    List::Gen for instance globally overloads the typeglob operator... 8-|

    > my $iter = [@list1] |X| [@list2];

    yep but the problem here is that the array are evaluated (i.e. listified) before being passed to the operator.

    I'd like to be able to inspect the code block before evaluating it.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1056521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-12-28 19:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (182 votes), past polls