sergiotaborda / lense-lang

The Lense Language Compiler
1 stars 0 forks source link

Add support to tuples #1

Closed sergiotaborda closed 8 years ago

sergiotaborda commented 9 years ago

Add tuple support base on a kind of linked list (see discussion at https://groups.google.com/forum/#!topic/lense-lang/2iaRDxNw65Y)

sergiotaborda commented 8 years ago

Tuples are now supported as Heterogeneous Lists. Tuple types are represented in code like (A , B, C) where A, B, C are types. Tuple values are represented in code like (1 , "Hi" , true)

The languages accepts tuples-0 to N. Tuple-0 : () Tuple-1 : (true) Tuple-2 ( true, "Hi" ) Tuple-3: (true, "Hi", 45) etc...

Accessing is possible with indexed property

(String, Integer) a = ("Hello", 2 )

String name = a[0]; Integer number = a[1];