Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Better mousetrap (getting top N values from list X)

by BrowserUk (Patriarch)
on Feb 03, 2005 at 09:18 UTC ( [id://427562]=note: print w/replies, xml ) Need Help??


in reply to Re: Better mousetrap (getting top N values from list X)
in thread Better mousetrap (getting top N values from list X)

I don't suppose you recall how they were going to determine how many values to produce?

Is that information --ie. the number of values required on the right-hand side of a list assignment--generally available to XS code, or was the intention to make a special case for the construct?


Examine what is said, not who speaks.
Silence betokens consent.
Love the truth but pardon error.

Replies are listed 'Best First'.
Re^3: Better mousetrap (getting top N values from list X)
by demerphq (Chancellor) on Feb 03, 2005 at 09:25 UTC

    IIRC the idea was to apply much the same type of logic as occurs with split. Ie the logic that implicitly sets the third argument of the split to be N+1 where N is the number of scalar slots on the LHS of the assignment. I hazzily recall discussion on whether using an explicit slice would also do the same. I think if you trawl the p5p archives for sort and optimize youll find it. I think the basic idea was that

    my ($x,$y,$z)=sort @foo; my @top=(sort @foo)[1..$n];

    would be special cased somehow.

    As for your question about XS, I really have no idea right now. Sorry.

    ---
    demerphq

      Note that your first construct works for split but your second would give no hints to split.

      As to how this is done, I'd look at Want if I were curious.

      - tye        

        I'd look at Want if I were curious

        Eek!

        Now I feel like Pandora!


        Examine what is said, not who speaks.
        Silence betokens consent.
        Love the truth but pardon error.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-03-29 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found