Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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

by ysth (Canon)
on Aug 20, 2007 at 03:42 UTC ( [id://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)

Replies are listed 'Best First'.
Re^3: what would you like to see in perl5.12? (trees)
by tye (Sage) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://633702]
help
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found