I'm thinking of a Hash-like collection where I can add objects using a
index-less append operation, but then have random access to the elements
based on a key provided by the object. (For instance, imagine a
ProcessTable, where I create the collection telling it to index by the .pid
method, add each process to %table in serial without mentioning pid, and
then look up the one referring to the interpreter with %table{$*PID}.)

I really thought this was in Perl 6, but I can't find it in the docs, so
maybe I'm thinking of another language. (I think both Ruby and Python have
adverbial-like options to do things like this with dictionaries, so maybe
that's what I'm thinking of.) Or maybe it's a simple tweak to an existing
collection, or just something I need to implement in my element objects....

(I can use classify-list to do this ad-hoc, or even just do a simple map as
I might in Perl 5, but I'm thinking of each key's relationship to and
extraction from its value as being a feature of the collection, not of the
way I construct it.)


Reply via email to