An array destructing specification choice

Axel Rauschmayer axel at rauschma.de
Fri Nov 11 16:23:53 PST 2011


>> A pattern of the form
>> 
>>   [a0, a1, 〰〰, ak, ...r, bn, bn-1, 〰〰, b0]
> 
> We currently haven't specified this syntactic form.  I'm not sure if it adds enough value to justify the added conceptual complexity.



Using this pattern for accessing elements at the end would be useful. For example:

[...r, b0, b1, b2] = arr
     means: assign the three last elements of arr to b0, b1, b2 (and assign everything until these elements to r)

It would be nice if r was optional:
[..., b0, b1, b2] = arr

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com





More information about the es-discuss mailing list