splat

Where is it legal to use ruby splat operator?

Splats are cool. They're not just for exploding arrays, although that is fun. They can also cast to Array and flatten arrays (See http://github.com/mischa/splat/tree/master for an exhaustive list of what they do.) It looks like one cannot perform additional operations on the splat, but in 1.8.6/1.9 the following code throws "unexpected ...

Ruby, Source Code of Splat?

Someone asked about the splat operator yesterday, and I wanted to see the source code... would that be written in C or in Ruby? Where would it be found? ...

What's the splat doing here?

match, text, number = *"foobar 123".match(/([A-z]*) ([0-9]*)/) I know this is doing some kind of regular expression match but what role does the splat play here and is there a way to do this without the splat so it's less confusing? ...

Making a Hash from an array - how does this work?

fruit = ["apple","red","banana","yellow"] => ["apple", "red", "banana", "yellow"] Hash[*fruit] => {"apple"=>"red", "banana"=>"yellow"} Why does the splat cause the array to be so neatly parsed into the Hash? Or, more precisely, how does the Hash "know" that "apple" is the key and "red" is its corresponding value? Is it simply be...

Unroll / splat arguments in common lisp

Say I have a list of arguments: > (setf format-args `(t "it's ~a" 1)) (T "it's ~a" 1) How can I then "splat" or "unroll" this into a series of arguments rather than a single list argument, for supplying to the format function? i.e I would like the following function call to take place: > (format t "it's ~a" 1) For reference, I wo...