Module list_ops

Module list_ops 

Source
Expand description

List operations for Seq

Higher-order combinators for working with lists (Variants). These provide idiomatic concatenative-style list processing.

§Examples

# Map: double each element
my-list [ 2 * ] list-map

# Filter: keep positive numbers
my-list [ 0 > ] list-filter

# Fold: sum all elements
my-list 0 [ + ] list-fold

# Each: print each element
my-list [ write_line ] list-each

Re-exports§

pub use patch_seq_list_each as list_each;
pub use patch_seq_list_empty as list_empty;
pub use patch_seq_list_filter as list_filter;
pub use patch_seq_list_fold as list_fold;
pub use patch_seq_list_get as list_get;
pub use patch_seq_list_length as list_length;
pub use patch_seq_list_make as list_make;
pub use patch_seq_list_map as list_map;
pub use patch_seq_list_push as list_push;
pub use patch_seq_list_set as list_set;

Functions§

patch_seq_list_each
Apply a quotation to each element of a list (for side effects)
patch_seq_list_empty
Check if a list is empty
patch_seq_list_filter
Filter a list, keeping elements where quotation returns true
patch_seq_list_fold
Fold a list with an accumulator and quotation
patch_seq_list_get
Get an element from a list by index
patch_seq_list_length
Get the length of a list
patch_seq_list_make
Create an empty list
patch_seq_list_map
Map a quotation over a list, returning a new list
patch_seq_list_push
Append an element to a list (functional - returns new list)
patch_seq_list_set
Set an element in a list by index (functional - returns new list)