15 lines
408 B
Text
15 lines
408 B
Text
;;; Use shorthand syntax to create list.
|
|
lvars l1 = [1 2 three 'four'];
|
|
;;; Allocate a single list node, with value field 1 and the link field
|
|
;;; pointing to empty list
|
|
lvars l2 = cons(1, []);
|
|
;;; print first element of l1
|
|
front(l1) =>
|
|
;;; print the rest of l1
|
|
back(l1) =>
|
|
;;; Use index notation to access third element
|
|
l1(3) =>
|
|
;;; modify link field of l2 to point to l1
|
|
l1 -> back(l2);
|
|
;;; Print l2
|
|
l2 =>
|