develooper Front page | perl.perl6.language | Postings from September 2005

k, v

Thread Next
From:
Juerd
Date:
September 24, 2005 06:11
Subject:
k, v
Message ID:
20050924131116.GI24163@c4.convolution.nl
Hashes are full of convenience, and Huffman would be proud:

    %hash.keys      %hash>>.key
    %hash.values    %hash>>.value
    %hash.kv        zip(%hash.keys, %hash.values)

One thing occurred to me: if hashes are worth all this, then why not
abbreviate "keys" further to "k" (as in "kv"), and "values" to "v" (as
in "kv"). This would allow us to rename "key" to "k" and "value" to "v"
too, resulting in:

    %hash.k         %hash>>.k
    %hash.v         %hash>>.v
    %hash.kv        zip(%hash.k, %hash.v)

With hashes and pairs, I don't think there could be any confusion over
the meaning of "k" and "v", just like "kv" works without explanation. 

(Not having to type "alue" also makes it easier for a pair to NOT
evaluate to its value, but that's another thread.)
    

Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About