Reduct  v1.0.4-3-gdaf0d70
A functional and immutable language.
Loading...
Searching...
No Matches
list_impl.h File Reference
#include "core.h"
#include "handle.h"
#include "item.h"
#include "list.h"
Include dependency graph for list_impl.h:

Go to the source code of this file.

Functions

static reduct_list_node_treduct_list_node_new (struct reduct *reduct)
 
static reduct_list_node_treduct_list_node_copy (reduct_t *reduct, reduct_list_node_t *node)
 
REDUCT_API reduct_list_treduct_list_new (reduct_t *reduct)
 
static reduct_list_node_treduct_list_find_leaf (reduct_list_t *list, reduct_size_t index, reduct_size_t tailOffset)
 
static reduct_list_node_treduct_list_assoc_internal (reduct_t *reduct, reduct_uint32_t shift, reduct_list_node_t *node, reduct_size_t index, reduct_handle_t val)
 
REDUCT_API reduct_list_treduct_list_assoc (struct reduct *reduct, reduct_list_t *list, reduct_size_t index, reduct_handle_t val)
 Create a new list with an updated value at the specified index.
 
REDUCT_API reduct_list_treduct_list_dissoc (struct reduct *reduct, reduct_list_t *list, reduct_size_t index)
 Create a new list with the element at the specified index removed.
 
REDUCT_API reduct_list_treduct_list_slice (struct reduct *reduct, reduct_list_t *list, reduct_size_t start, reduct_size_t end)
 Create a new list by slicing an existing list.
 
REDUCT_API reduct_handle_t reduct_list_nth (struct reduct *reduct, reduct_list_t *list, reduct_size_t index)
 Get the nth element of the list.
 
REDUCT_API struct reduct_item * reduct_list_nth_item (struct reduct *reduct, reduct_list_t *list, reduct_size_t index)
 Get the nth element of the list as an item.
 
static reduct_list_node_treduct_push_tail (reduct_t *reduct, reduct_uint32_t shift, reduct_size_t index, reduct_list_node_t *parent, reduct_list_node_t *tailNode)
 
REDUCT_API void reduct_list_append (reduct_t *reduct, reduct_list_t *list, reduct_handle_t val)
 
REDUCT_API void reduct_list_append_list (reduct_t *reduct, reduct_list_t *list, reduct_list_t *other)
 
REDUCT_API reduct_bool_t reduct_list_iter_next (reduct_list_iter_t *iter, reduct_handle_t *out)
 Get the next element from the iterator.
 

Function Documentation

◆ reduct_list_node_new()

static reduct_list_node_t * reduct_list_node_new ( struct reduct *  reduct)
inlinestatic

Definition at line 9 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_node_copy()

static reduct_list_node_t * reduct_list_node_copy ( reduct_t reduct,
reduct_list_node_t node 
)
static

Definition at line 21 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_new()

REDUCT_API reduct_list_t * reduct_list_new ( reduct_t reduct)

Definition at line 28 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_find_leaf()

static reduct_list_node_t * reduct_list_find_leaf ( reduct_list_t list,
reduct_size_t  index,
reduct_size_t  tailOffset 
)
static

Definition at line 42 of file list_impl.h.

Here is the caller graph for this function:

◆ reduct_list_assoc_internal()

static reduct_list_node_t * reduct_list_assoc_internal ( reduct_t reduct,
reduct_uint32_t  shift,
reduct_list_node_t node,
reduct_size_t  index,
reduct_handle_t  val 
)
static

Definition at line 57 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_assoc()

REDUCT_API reduct_list_t * reduct_list_assoc ( struct reduct *  reduct,
reduct_list_t list,
reduct_size_t  index,
reduct_handle_t  val 
)

Create a new list with an updated value at the specified index.

Parameters
reductPointer to the Reduct structure.
listPointer to the source list.
indexThe index to update.
valThe new value to set.
Returns
A pointer to the newly created list.

Definition at line 74 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_dissoc()

REDUCT_API reduct_list_t * reduct_list_dissoc ( struct reduct *  reduct,
reduct_list_t list,
reduct_size_t  index 
)

Create a new list with the element at the specified index removed.

Parameters
reductPointer to the Reduct structure.
listPointer to the source list.
indexThe index of the element to remove.
Returns
A pointer to the newly created list.
Todo:
There is definetly a better way to do this

Definition at line 106 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_slice()

REDUCT_API reduct_list_t * reduct_list_slice ( struct reduct *  reduct,
reduct_list_t list,
reduct_size_t  start,
reduct_size_t  end 
)

Create a new list by slicing an existing list.

Parameters
reductPointer to the Reduct structure.
listPointer to the source list.
startThe starting index (inclusive).
endThe ending index (exclusive).
Returns
A pointer to the newly created list slice.

Definition at line 131 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_nth()

REDUCT_API reduct_handle_t reduct_list_nth ( struct reduct *  reduct,
reduct_list_t list,
reduct_size_t  index 
)

Get the nth element of the list.

Parameters
reductPointer to the Reduct structure.
listPointer to the list.
indexThe index of the element to retrieve.
Returns
The handle of the nth element.

Definition at line 157 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_nth_item()

REDUCT_API struct reduct_item * reduct_list_nth_item ( struct reduct *  reduct,
reduct_list_t list,
reduct_size_t  index 
)

Get the nth element of the list as an item.

Parameters
reductPointer to the Reduct structure.
listPointer to the list.
indexThe index of the element to retrieve.
Returns
A pointer to the item of the nth element.

Definition at line 172 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_push_tail()

static reduct_list_node_t * reduct_push_tail ( reduct_t reduct,
reduct_uint32_t  shift,
reduct_size_t  index,
reduct_list_node_t parent,
reduct_list_node_t tailNode 
)
static

Definition at line 179 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_append()

REDUCT_API void reduct_list_append ( reduct_t reduct,
reduct_list_t list,
reduct_handle_t  val 
)

Definition at line 198 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reduct_list_append_list()

REDUCT_API void reduct_list_append_list ( reduct_t reduct,
reduct_list_t list,
reduct_list_t other 
)

Definition at line 242 of file list_impl.h.

Here is the call graph for this function:

◆ reduct_list_iter_next()

REDUCT_API reduct_bool_t reduct_list_iter_next ( reduct_list_iter_t iter,
reduct_handle_t out 
)

Get the next element from the iterator.

Parameters
iterPointer to the iterator.
outPointer to store the retrieved handle.
Returns
REDUCT_TRUE if an element was retrieved, REDUCT_FALSE if the end was reached.

Definition at line 255 of file list_impl.h.

Here is the call graph for this function:
Here is the caller graph for this function: