Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: what would you like to see in perl5.12? (trees)

by ysth (Canon)
on Aug 20, 2007 at 03:42 UTC ( #633702=note: print w/ replies, xml ) Need Help??


in reply to Re: what would you like to see in perl5.12? (trees)
in thread what would you like to see in perl5.12?

The only script-visible changes would be the module you include to say you want sorted hashes
It'd make more sense to me to have a :btree attribute on the hash declaration (does that mean lexical hashes only? maybe). Would the attribute take an optional comparison function?
and the function it exports so you 'seek' the each operator.
I'd put that in Hash::Util. Is that seek to a particular key value, or seek to key N?


Comment on Re^2: what would you like to see in perl5.12? (trees)
Re^3: what would you like to see in perl5.12? (trees)
by tye (Cardinal) on Aug 20, 2007 at 03:46 UTC

    It'd seek to a particular key value. There are certainly trees that would also allow seeking to a particular index. I don't care whether there is a way to override the default comparison function (just cmp).

    Yes, using an attribute for this would be fine.

    Update: s/<=>/cmp/.

    - tye        

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-07-25 05:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls