|
Serene Runtime 1.0.0
C runtime for the Serene programming language
|
Go to the source code of this file.
Data Structures | |
| struct | srn_list_node_t |
| A list is a singly linked sequence of values. More... | |
| struct | srn_list_t |
| Since all the values are immutable and persistent. More... | |
Typedefs | |
| typedef struct srn_list_node_t | srn_list_node_t |
| A list is a singly linked sequence of values. | |
| typedef struct srn_list_t | srn_list_t |
Functions | |
| srn_value_t * | srn_list_make (srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *const *items, size_t count) |
| Build a list from an array of elements. | |
| srn_value_t * | srn_list_cons (srn_context_t *ctx, srn_metadata_t *metadata, srn_value_t *value, srn_value_t *list) |
Prepend value to list, returning a new list. | |
| typedef struct srn_list_node_t srn_list_node_t |
A list is a singly linked sequence of values.
Nodes hold a value and a pointer to the next node; the list header caches the length and points at the head node. Empty lists are represented by nil_v; a list value with tag VList always has at least one element.
| typedef struct srn_list_t srn_list_t |
| srn_value_t * srn_list_cons | ( | srn_context_t * | ctx, |
| srn_metadata_t * | metadata, | ||
| srn_value_t * | value, | ||
| srn_value_t * | list ) |
Prepend value to list, returning a new list.
list may be nil_v (treated as the empty list); the input list is not modified — its nodes are shared with the returned list.
Definition at line 48 of file lists.c.
| srn_value_t * srn_list_make | ( | srn_context_t * | ctx, |
| srn_metadata_t * | metadata, | ||
| srn_value_t *const * | items, | ||
| size_t | count ) |
Build a list from an array of elements.
When count == 0, returns nil_v (empty lists have no allocated representation). Otherwise allocates one node per element plus the list header, all in ctx.
Definition at line 24 of file lists.c.