List literals are built with square brackets that are clearly not an indexing operator.
Lists may contain any other langur data structures, and they may be mixed freely.
Lists may be appended with the concatenation operator (tilde) or with the more() function. Like concatenation, the more() function creates a new list and does not modify the original.
[1, 2, 3] ~ [4, 5, 6, 7] == [1, 2, 3, 4, 5, 6, 7] # true
As a semantic convience, string lists may use a shortened syntax, beginning with a letter fw (interpreting escape codes) or FW (not interpreting escape codes). Quote mark pairs allowed are the same as for string and regex literals.
A free word list uses spacing to separate word strings. This is similar to the qw() construct used in Perl.
fw/1 2 3 you know/ == ["1", "2", "3", "you", "know"]
fw/1 2 3 you\x20know/ == ["1", "2", "3", "you know"]
FW/1 2 3 you\x20know/ == ["1", "2", "3", "you\\x20know"]
You can use blockquotes for free word lists (see strings).
Allowed characters are the same as for string literals.
You can use a list of functions and no-ops with the map() function, as in the following example.
val isbn13checkdigit = fn(var s) { s = replace(s, by=RE/[\- ]/) s -> re/^[0-9]{13}$/ and fold(map(s2n(s), by=[_, fn{*3}]), by=fn{+}) div 10 }
One way to generate a list is to use list multiplication.
[1, 2, 3, 4] * 3 == [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
[false] * 100 # generates list with 100 elements all set to false
A negative number on list multiplication acts like 0 and does not throw an exception.
Lists can be generated with the series() function and by appending lists.