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++) {
105 PANIC_IF(ra.maybe_error !=
nullptr || rb.maybe_error !=
nullptr,
"Corrupted seq during eq");
126 TODO(
"VQuote payload is not defined yet");
129 PANIC(
"Unknown value tag in srn_value_eq");
136 return srn_hash(engine, buf,
sizeof(buf));
184 return srn_hash(engine, &d,
sizeof(d));
195 return srn_hash(engine, sym,
sizeof(*sym));
201 return srn_hash(engine, k,
sizeof(*k));
212 PANIC(
"Lists are not hashable");
218 for (
size_t i = 0; i < s->
inner.
len; i++) {
220 if (r.maybe_error !=
nullptr) {
221 PANIC(
"Corrupted seq during hash");
230 PANIC(
"Hashmaps are not hashable");
234 PANIC(
"Closures are not hashable");
239 return srn_hash(engine, e,
sizeof(*e));
243 TODO(
"VQuote payload is not defined yet");
246 PANIC(
"Unknown value tag in srn_value_hash");
#define AS_LIST(value_ref)
#define AS_F64(value_ref)
#define AS_SYMBOL(value_ref)
@ 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)
#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_hash_t srn_value_hash(const srn_context_t *ctx, const srn_value_t *v)
Compute the xxHash32 of a value using the engine seed.
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_value_t * srn_value_eq(const srn_context_t *ctx, const srn_value_t *a, const srn_value_t *b)
Check to values for equality. Return a boolean.
bool srn_value_hashable(const srn_value_t *v)
Whether v can be a hash key.
seq_lookup_result_t seq_get(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 runtime error, a tag classifying the failure and a human-readable message.
A list is a singly linked sequence of values.
struct srn_list_node_t * next
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)
#define PANIC_IF(cond, msg)