A Discussion of Tuple Syntax

Timon Gehr timon.gehr at gmx.ch
Tue Aug 20 12:57:12 PDT 2013


On 08/20/2013 05:18 PM, bearophile wrote:
>>>>> s = "red blue"
>>>>> (a, b) = s.split()
>>>>> a
>> 'red'
>>>>> b
>> 'blue'
>
> It's supported in Haskell too:
>
> Prelude> let s = "red blue"
> Prelude> let [a, b] = words s
> Prelude> a
> "red"
> Prelude> b
> "blue"
>
> Bye,
> bearophile

Any language with algebraic data types supports this.


More information about the Digitalmars-d mailing list