Reduct  v4.0.5-1-g4851deb
A functional and immutable language.
Loading...
Searching...
No Matches
standard.h
Go to the documentation of this file.
1#ifndef REDUCT_STANDARD_H
2#define REDUCT_STANDARD_H 1
3
4#include <reduct/defs.h>
5#include <reduct/item.h>
6
7struct reduct;
8
9/**
10 * @file standard.h
11 * @brief Built-in library registration and operations.
12 * @defgroup stdlib Stdlib
13 *
14 * The standard library provide a set of pre-defined native functions for use in Reduct expressions.
15 *
16 * @see native
17 *
18 * @{
19 */
20
21/**
22 * @brief Built-in library sets.
23 */
37
39 reduct_handle_t msg);
41REDUCT_API reduct_handle_t reduct_try(struct reduct* reduct, reduct_handle_t callable, reduct_handle_t catchFn);
42
46 reduct_handle_t callable);
51
52REDUCT_API reduct_handle_t reduct_len(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
54 reduct_handle_t step);
55REDUCT_API reduct_handle_t reduct_concat(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
56REDUCT_API reduct_handle_t reduct_append(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
57REDUCT_API reduct_handle_t reduct_prepend(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
63 reduct_handle_t defaultVal);
65 reduct_handle_t value, reduct_handle_t fillVal);
68 reduct_handle_t callable, reduct_handle_t fillVal);
72 reduct_handle_t end);
76 reduct_handle_t newVal);
79REDUCT_API reduct_handle_t reduct_find(struct reduct* reduct, reduct_handle_t handle, reduct_handle_t callable);
81 reduct_handle_t defaultVal);
83 reduct_handle_t val);
86 reduct_handle_t callable);
89REDUCT_API reduct_handle_t reduct_merge(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
90REDUCT_API reduct_handle_t reduct_explode(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
91REDUCT_API reduct_handle_t reduct_implode(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
93
96REDUCT_API reduct_handle_t reduct_join(struct reduct* reduct, reduct_handle_t listHandle, reduct_handle_t sepHandle);
97REDUCT_API reduct_handle_t reduct_split(struct reduct* reduct, reduct_handle_t srcHandle, reduct_handle_t sepHandle);
98REDUCT_API reduct_handle_t reduct_upper(struct reduct* reduct, reduct_handle_t srcHandle);
99REDUCT_API reduct_handle_t reduct_lower(struct reduct* reduct, reduct_handle_t srcHandle);
100REDUCT_API reduct_handle_t reduct_trim(struct reduct* reduct, reduct_handle_t srcHandle);
101
102REDUCT_API reduct_handle_t reduct_is_atom(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
103REDUCT_API reduct_handle_t reduct_is_number(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
104REDUCT_API reduct_handle_t reduct_is_lambda(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
105REDUCT_API reduct_handle_t reduct_is_native(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
106REDUCT_API reduct_handle_t reduct_is_callable(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
107REDUCT_API reduct_handle_t reduct_is_list(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
108REDUCT_API reduct_handle_t reduct_is_empty(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
109REDUCT_API reduct_handle_t reduct_is_nil(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
110
113 reduct_handle_t compilerArgs);
116 reduct_handle_t content);
119REDUCT_API reduct_handle_t reduct_print(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
120REDUCT_API reduct_handle_t reduct_println(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
123REDUCT_API reduct_handle_t reduct_format(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
124REDUCT_API reduct_handle_t reduct_now(struct reduct* reduct);
126REDUCT_API reduct_handle_t reduct_env(struct reduct* reduct);
128
129REDUCT_API reduct_handle_t reduct_min(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
130REDUCT_API reduct_handle_t reduct_max(struct reduct* reduct, size_t argc, reduct_handle_t* argv);
132 reduct_handle_t maxVal);
156
157/**
158 * @brief Register a set from the standard library to the Reduct instance.
159 *
160 * @param reduct Pointer to the Reduct structure.
161 * @param sets The sets to register.
162 */
164
165/** @} */
166
167#endif
#define REDUCT_API
Definition defs.h:24
REDUCT_API reduct_handle_t reduct_split(struct reduct *reduct, reduct_handle_t srcHandle, reduct_handle_t sepHandle)
REDUCT_API reduct_handle_t reduct_last(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_keys(struct reduct *reduct, reduct_handle_t list)
REDUCT_API reduct_handle_t reduct_cos(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_assoc(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t index, reduct_handle_t value, reduct_handle_t fillVal)
REDUCT_API reduct_handle_t reduct_asinh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_ceil(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_append(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_tanh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_ends_with(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t suffix)
REDUCT_API reduct_handle_t reduct_all(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_unique(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_atan(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_trim(struct reduct *reduct, reduct_handle_t srcHandle)
REDUCT_API reduct_handle_t reduct_dissoc_in(struct reduct *reduct, reduct_handle_t list, reduct_handle_t path)
REDUCT_API reduct_handle_t reduct_floor(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_update(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t index, reduct_handle_t callable, reduct_handle_t fillVal)
REDUCT_API reduct_handle_t reduct_chr(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_is_nil(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_dissoc(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t index)
REDUCT_API reduct_handle_t reduct_read_line(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_repeat(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t count)
REDUCT_API reduct_handle_t reduct_println(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_sin(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_values(struct reduct *reduct, reduct_handle_t list)
REDUCT_API reduct_handle_t reduct_print(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_read_char(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_acosh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_find(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_sort(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_min(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_env(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_is_native(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_cosh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_reverse(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_acos(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_assert(struct reduct *reduct, reduct_handle_t state, reduct_handle_t cond, reduct_handle_t msg)
REDUCT_API reduct_handle_t reduct_is_number(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_sinh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_seed(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_throw(struct reduct *reduct, reduct_handle_t msg)
REDUCT_API reduct_handle_t reduct_replace(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t oldVal, reduct_handle_t newVal)
REDUCT_API reduct_handle_t reduct_chunk(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t size)
REDUCT_API reduct_handle_t reduct_format(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_upper(struct reduct *reduct, reduct_handle_t srcHandle)
REDUCT_API reduct_handle_t reduct_merge(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_starts_with(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t prefix)
REDUCT_API reduct_handle_t reduct_apply(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_index_of(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t target)
REDUCT_API void reduct_stdlib_register(struct reduct *reduct, reduct_stdlib_sets_t sets)
Register a set from the standard library to the Reduct instance.
REDUCT_API reduct_handle_t reduct_first(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_rand(struct reduct *reduct, reduct_handle_t minVal, reduct_handle_t maxVal)
REDUCT_API reduct_handle_t reduct_uptime(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_concat(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_ord(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_rest(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_log(struct reduct *reduct, reduct_handle_t val, reduct_handle_t base)
REDUCT_API reduct_handle_t reduct_sqrt(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_contains(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t target)
REDUCT_API reduct_handle_t reduct_lower(struct reduct *reduct, reduct_handle_t srcHandle)
REDUCT_API reduct_handle_t reduct_is_lambda(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_any(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_filter(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_exp(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_join(struct reduct *reduct, reduct_handle_t listHandle, reduct_handle_t sepHandle)
REDUCT_API reduct_handle_t reduct_explode(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_run(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_prepend(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_args(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_len(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_flatten(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t depth)
REDUCT_API reduct_handle_t reduct_nth(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t index, reduct_handle_t defaultVal)
REDUCT_API reduct_handle_t reduct_get_in(struct reduct *reduct, reduct_handle_t list, reduct_handle_t path, reduct_handle_t defaultVal)
REDUCT_API reduct_handle_t reduct_atan2(struct reduct *reduct, reduct_handle_t y, reduct_handle_t x)
REDUCT_API reduct_handle_t reduct_map(struct reduct *reduct, reduct_handle_t list, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_range(struct reduct *reduct, reduct_handle_t start, reduct_handle_t end, reduct_handle_t step)
REDUCT_API reduct_handle_t reduct_is_callable(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_round(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_read_file(struct reduct *reduct, reduct_handle_t path)
REDUCT_API reduct_handle_t reduct_slice(struct reduct *reduct, reduct_handle_t handle, reduct_handle_t start, reduct_handle_t end)
REDUCT_API reduct_handle_t reduct_abs(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_reduce(struct reduct *reduct, reduct_handle_t list, reduct_handle_t initial, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_asin(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_atanh(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_init(struct reduct *reduct, reduct_handle_t handle)
REDUCT_API reduct_handle_t reduct_implode(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
reduct_stdlib_sets_t
Built-in library sets.
Definition standard.h:25
REDUCT_API reduct_handle_t reduct_tan(struct reduct *reduct, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_pow(struct reduct *reduct, reduct_handle_t base, reduct_handle_t exp)
REDUCT_API reduct_handle_t reduct_max(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_now(struct reduct *reduct)
REDUCT_API reduct_handle_t reduct_assoc_in(struct reduct *reduct, reduct_handle_t list, reduct_handle_t path, reduct_handle_t val)
REDUCT_API reduct_handle_t reduct_update_in(struct reduct *reduct, reduct_handle_t list, reduct_handle_t path, reduct_handle_t callable)
REDUCT_API reduct_handle_t reduct_try(struct reduct *reduct, reduct_handle_t callable, reduct_handle_t catchFn)
REDUCT_API reduct_handle_t reduct_import(struct reduct *reduct, reduct_handle_t path, reduct_handle_t compiler, reduct_handle_t compilerArgs)
REDUCT_API reduct_handle_t reduct_write_file(struct reduct *reduct, reduct_handle_t state, reduct_handle_t path, reduct_handle_t content)
REDUCT_API reduct_handle_t reduct_is_empty(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_is_list(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
REDUCT_API reduct_handle_t reduct_clamp(struct reduct *reduct, reduct_handle_t val, reduct_handle_t minVal, reduct_handle_t maxVal)
REDUCT_API reduct_handle_t reduct_is_atom(struct reduct *reduct, size_t argc, reduct_handle_t *argv)
@ REDUCT_STDLIB_SEQUENCES
Definition standard.h:29
@ REDUCT_STDLIB_ALL
Definition standard.h:35
@ REDUCT_STDLIB_SYSTEM
Definition standard.h:33
@ REDUCT_STDLIB_HIGHER_ORDER
Definition standard.h:28
@ REDUCT_STDLIB_ERROR
Definition standard.h:27
@ REDUCT_STDLIB_STRING
Definition standard.h:30
@ REDUCT_STDLIB_INTROSPECTION
Definition standard.h:31
@ REDUCT_STDLIB_TYPE_CASTING
Definition standard.h:32
@ REDUCT_STDLIB_STATE
Definition standard.h:26
@ REDUCT_STDLIB_MATH
Definition standard.h:34
Item management.
Handle type.
Definition defs.h:119