40 if (a ==
nullptr || b ==
nullptr || (a->
type != b->
type)) {
82 while (na !=
nullptr) {
99 for (
size_t i = 0; i < sa->
inner.
len; i++) {
102 if (ra.maybe_error !=
nullptr || rb.maybe_error !=
nullptr) {
125 TODO(
"VQuote payload is not defined yet");
128 PANIC(
"Unknown value tag in srn_value_eq");
135 return srn_hash(engine, buf,
sizeof(buf));
162 return srn_hash(engine, &d,
sizeof(d));
173 return srn_hash(engine, sym,
sizeof(*sym));
179 return srn_hash(engine, k,
sizeof(*k));
190 PANIC(
"Lists are not hashable");
196 for (
size_t i = 0; i < s->
inner.
len; i++) {
198 if (r.maybe_error !=
nullptr) {
199 PANIC(
"Corrupted seq during hash");
208 PANIC(
"Hashmaps are not hashable");
212 PANIC(
"Closures are not hashable");
217 return srn_hash(engine, e,
sizeof(*e));
221 TODO(
"VQuote payload is not defined yet");
224 PANIC(
"Unknown value tag in srn_value_hash");
#define AS_LIST(value_ref)
#define AS_F64(value_ref)
#define AS_SYMBOL(value_ref)
static srn_value_t false_v
@ VError
VError should be last.
#define AS_STRING(value_ref)
#define AS_I64(value_ref)
#define AS_MAP(value_ref)
#define AS_SEQ(value_ref)
static srn_value_t true_v
#define AS_ERROR(value_ref)
#define AS_CLOSURE(value_ref)
#define AS_KEYWORD(value_ref)
srn_hash_t srn_hash(const srn_engine_t *engine, const void *data, size_t len)
srn_value_t * srn_value_eq(srn_context_t *ctx, const srn_value_t *a, const srn_value_t *b)
Check to values for equality. Return a boolean.
static srn_value_t * equality_to_value(bool cond)
static srn_hash_t combine2(srn_engine_t *engine, srn_hash_t a, srn_hash_t b)
srn_hash_t srn_value_hash(srn_context_t *ctx, const srn_value_t *v)
Compute the xxHash32 of a value using the engine seed.
seq_lookup_result_t seq_get(const srn_context_t *ctx, const seq_t *seq, size_t n)
Negative index is not supported.
This is an implementation of bit - partitioned, persistent, immutable sequence For more information,...
bool srn_string_eq(const srn_string_t *a, const srn_string_t *b)
size_t len
logical length.
srn_engine_t * engine
Long term state of the compiler.
Engine is a structure to own the long living and main pieces of the compiler.
A list is a singly linked sequence of values.
struct srn_list_node_t * next
Since all the values are immutable and persistent.
A persistent, immutable, indexed sequence.
uint8_t buffer[]
The buffer that holds the WTF8 sequence.
size_t len
length of the WTF-8 sequence in bytes
#define PANIC_IF_NULL(ptr)