Lists
![]()
Lists are a way to conveniently store species on the stack. A list species is at its core, an ordered container of other species. Lists are able to hold any species imaginable, and do not prevent practitioners from mixing the types of species present in an individual list.
A, B, C, num$() → list$() Reads the number at the head and creates a list of matching length from species on the capsum. The list is ordered such that species added to the capsum earlier are further ahead on the returned list. eg. A, B, C, 3 → list of A, B and C, in that order
list, A$() → list$() Adds the species at the head to the end of the list below the head. If given a list at the head, that list is added to the end of the list below the head, preserving order in both lists.
list, A$() → list$() Adds the species at the head to the start of the list below the head. If given a list at the head, that list is added at the front of the list below the head, preserving order in both lists.
list$() → list$() Removes all null elements from a list. Useful for cleaning data a practitioner does not know to be fully composed of valid values.
list$() → list$(), A Pops a list, removes the element at the head, then pushes the resulting list and the element removed from the front of that list, in that order (the species removed from the list is at the head).
list, num$() → A$() Returns the element at the position of the list specified by the number at the head.
list, A, num$() → list$() Replaces the element on the list at the position specified by the number at the head with the species below the head. eg. list, A, 2 → list with 2nd element replaced by A
list, num$() → list, list$() Splits a list by the number at the head. Returns a list with the elements up to the given number (the ‘left’ side), and a list with the elements after place denoted by the number (the ‘right’ side). eg. list, 2 → list of first 2 elements, list of the remaining elements
list, A, num$() → list$() Adds a given element at the place on a list specified by the number at the head. Does not delete existing elements, simply shifts them by a place. eg. list, A, 3 → list with A at the 3rd place, where the original third place is now at the 4th place
list, num$() → list$() Pops a list, removes the element at the place specified by the number, and then returns the resulting list. Does not leave a null value behind. eg. list, 3 → list without its 3rd element
list, num, num$() → list$() Pops a list, selects the elements starting from the number below the head and ending at the number at the head. eg. list, 1, 4 → list of elements starting at the 1st element and ending at the 3rd element
list|str$() → num$() Pops a list off the capsum and returns the number of elements it contains. Offers the same functionality for strings.