Hi --

On Sat, 21 May 2005, Luca Pireddu wrote:

> David A. Black wrote:
>
>> Hi --
>>
>> On Sat, 21 May 2005, Eric Mahurin wrote:
>>
>>
>> It's hard, I find, to come up with an exact description of what the
>> unarr?ay (unary unarray) operator does that fits every case.  The
>> closest I've come is: *a = x means: a gets assigned that which, when
>> stripped of one level of array-ness, is x.  Thus:
>>
>>    *a = 1,2   # [1,2] stripped of [] is 1,2 so a is [1,2]
>>    *a = *[1,2] # a stripped of [] is [1,2] stripped of [], so
>>                # a is [1,2]
>>
>>    def x(*args); end
>>    x(1,2,3)   # [1,2,3] stripped of [] is 1,2,3, so args is [1,2,3]
>>    x([1,2,3]) # [[1,2,3]] stripped of [] is [1,2,3], so args
>>               # is [[1,2,3]]
>>
>> Then there's
>>
>>    a = 1,2   # automatic arraying -- the opposite of *
>>    a = *[1,2]  # un-arraying followed by automatic arraying :-)
>>
>> or something like that.
>>
>>
>> David
>>
>
> Maybe a simpler way to look at it is *a = x means a = [x], or simply enclose
> the rhs in an array before assignment.

I'm not sure how that's different from what I was saying above.  Or
did you mean a simpler way to say it? :-)


David

-- 
David A. Black
dblack / wobblini.net