hoodwink.d enhanced
RSS
2.0
XHTML
1.0

RedHanded

Thursday

2006.12.28

The Siphoning Splat #

by why in bits

I’m serious about this. The splat is such a wildly devious little asterisk.

>> instruments = {'trombones' => 1, 'clarinets' => 2}       
>> p instruments.to_a
[["trombones", 1], ["clarinets", 2]]
>> p *instruments
["trombones", 1]
["clarinets", 2]

A 2-in-1 combo move! Look at that splat. It’s not just to_a. It called to_a and it siphoned the arguments.

Continue to full post. (230 words)