connorjacobsen / iris

The Iris programming language
MIT License
8 stars 1 forks source link

List type #2

Closed connorjacobsen closed 8 years ago

connorjacobsen commented 8 years ago

List

Iris lists are denoted by square brackets.

[] is the empty list. Lists are strongly-typed containers, and all elements of a list must be of the same type.

Examples:

# A List of Ints.
[1 2 3]
# - :: [Int] = [1 2 3]

# A List of Bools.
[True False True True]
# - :: [Bool] = [True False True True]

We can prepend values to lists with the : operator:

1 : [2 3 4]
# - :: [Int] = [1 2 3 4]

Placing values inside of the square brackets is really just syntactic sugar for prepending each of the values to empty list. The above list is equivalent to the following:

1 : 2 : 3 : 4 : []
# - :: [Int] = [1 2 3 4]

The type of this list is [Int].

Lists may be concatenated with the ++ operator:

[1 2] ++ [3 4]
# - :: [Int] = [1 2 3 4]
connorjacobsen commented 8 years ago

The v0.2-alpha List doesn't have to exactly match the spec. The basic functionality should be there, but the pretty syntax isn't required yet.

connorjacobsen commented 8 years ago

I am satisfied that the LLVM representation for this structure is implemented for a v1.