Raven Manual - Lists
The word list ( in ... i n -- ) takes n items from the stack and places them in a list. The square brackets [ ] can be used to easily group and count stack items.
[ 1 2 3 ] list as $mylist
Note that lists can hold any combination of data types as items. The words set ( item list index -- ) and get ( list index -- item ) access aggregate data types. Conceptually they are equivalent to Forth's ! and @.
# Retrieve a list item from slot 3 $mylist 3 get as $int3 # Replace the list item in slot 3 17 $mylist 3 set
|