Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: (almost) foldl

by dk (Chaplain)
on Jun 09, 2011 at 09:27 UTC ( [id://908871]=note: print w/replies, xml ) Need Help??


in reply to Re^2: (almost) foldl
in thread (almost) foldl

Great! There was once a YAPC auction selling off a built-in name in a future perl, at the buyer's choice. IIRC it has never actualized, but now I wish it was Y )

Replies are listed 'Best First'.
Re^4: (almost) foldl
by BrowserUk (Patriarch) on Jun 09, 2011 at 10:23 UTC

    Whilst Aristotle's Y() combinator is very clever, the requirement to assign the coderef to a local variable complicates the using code.

    If something along these lines were to be built-in, I'd like to simplify it so that you could write:

    print sub{ ( shift() // return ) + &$^SUB }->( 1 .. 10 );

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      agree, $^SUB is what we are missing ... can we steal it from perl6 ? :)
        Well, if you're gonna borrow a bit of Perl 6, how about borrowing all of it:
        [+] @list
        I'm assuming, of course, that translation to Perl 6 can be considered a form of obfuscation... :)

        Looking at perlvar, I guess it might have to be ${^SUB} to fit with the latest Perl5 naming conventions.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2024-04-18 12:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found