<Nesl> [2, 5, 1, 3];
it = [2, 5, 1, 3] : [int]
<Nesl> "this is a vector";
it = "this is a vector" : [char]
<Nesl> [(2, 3.4), (5, 8.9)]; % a vector of tuples %
it = [(2, 3.4), (5, 8.9)] : [(int, float)]
<Nesl> ["this", "is", "a", "nested", "vector"];
it = ["this", "is", "a", "nested", "vector"] : [[char]]
<Nesl> [2, 3.0, 4]; % vectors must have homogeneous elements %
Error at top level.
For function make_sequence in expression
[2, 3.0]
inferred argument types don't match function specification.
Argument types: [int], float
Function types: [a], a :: (a in any)
<Nesl> {a + 1: a in [2, 3, 4]};
it = [3, 4, 5] : [int]
<Nesl> let a = [2, 3, 4] in {a + 1: a};
it = [3, 4, 5] : [int]
<Nesl> {a + b: a in [2, 3, 4]; b in [4, 5, 6]};
it = [6, 8, 10] : [int]
<Nesl> let a = [2, 3, 4]; b = [4, 5, 6] in {a + b: a; b};
it = [6, 8, 10] : [int]
<Nesl> {a == b: a in "this"; b in "that"};
it = [T, T, F, F] : [bool]
<Nesl> {fact(a): a in [1, 2, 3, 4, 5]};
it = [1, 2, 6, 24, 120] : [int]
<Nesl> {div_rem(100, a): a in [5, 6, 7, 8]};
it = [(20, 0), (16, 4), (14, 2), (12, 4)] : [(int, int)]
<Nesl> sum([2, 3, 4]);
it = 9 : int
<Nesl> dist(5, 10);
it = [5, 5, 5, 5, 5, 5, 5, 5, 5, 5] : [int]
<Nesl> [2:50:3];
it = [2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47] : [int]
<Nesl> "big" ++ " boy";
it = "big boy" : [char]
<Nesl> {x in "wombat" | x <= `m};
it = "mba" : [char]
<Nesl> {sum(a): a in [[2, 3, 4], [1], [7, 8, 9]]};
it = [9, 1, 24] : [int]
<Nesl> bottop("testing"); % split sequence into two parts %
it = ["test", "ing"] : [[char]]
<Nesl> partition("break into words", [5, 5, 6]);
it = ["break", " into", " words"] : [[char]]
<Nesl> function my_sum(a) =
> if (#a == 1) then a[0]
> else
> let res = {my_sum(x): x in bottop(a)}
> in res[0] + res[1];
my_sum = fn : [a] -> a :: (a in number)
<Nesl> my_sum([7, 2, 6]);
it = 15 : int