Next: , Previous: , Up: API  


1.3 (kracht lists)

1.3.1 Macros

Macro: evaluate-thunks x

Given a list of functions that don’t take any inputs, run each one of those functions and return a list of what each function returned.

1.3.2 Procedures

Procedure: alist-set alist key value

Return a new association list based on ALIST with KEY mapped to VALUE. If KEY already exists its entry is replaced in place, otherwise a new entry is consed onto the front. ALIST itself is never mutated.

Procedure: alist? obj

Return #t if OBJ is a valid association list (a list where every element is a pair), otherwise return #f.

Procedure: assoc-lens xs keys

Deeply look up a value within nested association lists XS by traversing the sequence of KEYS sequentially. Traversal stops and returns #f as soon as an intermediate value is not an association list.

Procedure: assoc-ref-or alist field KEY: #:default

Look up FIELD in ALIST. Return the associated value if found, otherwise return DEFAULT (which defaults to #f).

Procedure: assoc-ref-or-empty-str alist field

Look up FIELD in ALIST. Return the associated value if found, or an empty string "" if the field does not exist or matches #f.

Procedure: flatten-list xs

Recursively flatten a nested list structure XS into a flat, one-dimensional list.

Procedure: shuffle-fy xs KEY: #:state

Returns a randomly shuffled copy of XS. List shuffle which implements the modern Fisher-Yates shuffle algorithm. It converts the list to a vector for efficient O(1) random access and mutation, shuffles the vector in-place, and then converts it back to a list. Pass STATE (a random state, as returned by ‘random-state-from-platform‘) to shuffle deterministically; otherwise the current global random state is used and never reseeded as a side effect.


Next: (kracht prelude), Previous: (kracht io), Up: API