Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^14: Order in which grep/map receive elements

by tobyink (Canon)
on Oct 08, 2012 at 22:18 UTC ( [id://997888]=note: print w/replies, xml ) Need Help??


in reply to Re^13: Order in which grep/map receive elements
in thread Order in which grep/map receive elements

"The module takes no action -- beyond using grep -- in order to enforce the ordering"

In the interests of nitpicking, I imagine most people using List::MoreUtils will be using the XS version of the module. This is implemented using a for loop in C, which does operate in a defined and documented order.

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Replies are listed 'Best First'.
Re^15: Order in which grep/map receive elements
by BrowserUk (Patriarch) on Oct 08, 2012 at 23:03 UTC
    In the interests of nitpicking,

    I'm not sure how interesting nitpicking is ;), but if we're going that route ...

    implemented using a for loop in C, which does operate in a defined and documented order.

    It uses the for loop to pick values off the stack, and return qualifying results to the stack, which then get return to the caller in the stacked order.

    Which is no different to what grep does. Albeit that the iteration is split between pp_grepwhile() in pphot.c and pp_grepstart() in pp_ctrl.c.

    In the end, it is the fact that the list out is derived -- in sequence -- from the list in, that defines the ordering in both cases.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    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.

    RIP Neil Armstrong

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2024-04-19 07:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found