Skip to content

[], vectors

Uri edited this page Dec 9, 2021 · 1 revision

Vectors

Ol provides simple syntax for vectors (formerly owl-lisp tuples). This syntactic sugar makes vector declarations look like traditional notation (without redundant commas, sure).

Following record is fully valid in Ol.

[1 2 3 "hello" 77 3/5]

Of course, quotating apostrophe and backquote are fully applicable:

> (define x 123)
;; Defined x
> [ x 1 ]
#(123 1)
> '[ x 1 ]
#(x 1)
> `[ x 1 ]
#(x 1)
> `[ ,x 1 ]
#(123 1)

> [ 'x x ]
#(x 123)
> '[ 'x x ]
#((quote x) x)

This syntax has been stabilized since version 2.1 and is included in the Ol standard library.

Clone this wiki locally