46 if ( frame->args > 0 ) {
49 }
else if ( !
nilp( frame->arg[0] ) ) {
52 ( L
"First arg to `hashmap`, if passed, must "
53 L
"be an integer or `nil`.`" ),
NIL );
56 if ( frame->args > 1 ) {
58 hash_fn = frame->arg[1];
59 }
else if (
nilp( frame->arg[1] ) ) {
64 ( L
"Second arg to `hashmap`, if passed, must "
65 L
"be a function or `nil`.`" ),
NIL );
69 if (
nilp( result ) ) {
75 if ( frame->args > 2 &&
80 cursor =
c_cdr( cursor ) ) {
89 map->
payload.hashmap.buckets[bucket_no] =
91 map->
payload.hashmap.buckets[bucket_no] );
147 for (
int i = 0; i < payload->
n_buckets; i++ ) {
struct cons_pointer authorised(struct cons_pointer target, struct cons_pointer acl)
TODO: does nothing, yet.
#define truep(conspoint)
true if conspoint points to something that is truthy, i.e.
#define functionp(conspoint)
true if conspoint points to a function cell, else false
#define NIL
a cons pointer which points to the special NIL cell
struct cons_pointer make_exception(struct cons_pointer message, struct cons_pointer frame_pointer)
Construct an exception cell.
struct cons_pointer c_cdr(struct cons_pointer arg)
Implementation of cdr in C.
#define nilp(conspoint)
true if conspoint points to the special cell NIL, else false (there should only be one of these so it...
struct cons_pointer c_string_to_lisp_string(wchar_t *string)
Return a lisp string representation of this wide character string.
struct cons_pointer c_car(struct cons_pointer arg)
Implementation of car in C.
#define pointer2cell(pointer)
given a cons_pointer as argument, return the cell.
#define integerp(conspoint)
true if conspoint points to an integer cell, else false
struct cons_pointer make_cons(struct cons_pointer car, struct cons_pointer cdr)
Construct a cons cell from this pair of pointers.
An indirect pointer to a cons cell.
#define url_fwprintf(f,...)
struct cons_pointer lisp_hashmap_put_all(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Lisp function expecting two arguments, a hashmap and an assoc list.
void dump_map(URL_FILE *output, struct cons_pointer pointer)
struct cons_pointer lisp_get_hash(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
A lisp function signature conforming wrapper around get_hash, q.v.
struct cons_pointer lisp_hashmap_put(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Expects frame->arg[1] to be a hashmap or namespace; frame->arg[2] to be a string-like-thing (perhaps ...
struct cons_pointer lisp_make_hashmap(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
Lisp funtion of up to four args (all optional), where.
struct cons_pointer lisp_hashmap_keys(struct stack_frame *frame, struct cons_pointer frame_pointer, struct cons_pointer env)
#define DFLT_HASHMAP_BUCKETS
struct cons_pointer make_integer(int64_t value, struct cons_pointer more)
Allocate an integer cell representing this value and return a cons_pointer to it.
struct cons_pointer hashmap_put(struct cons_pointer mapp, struct cons_pointer key, struct cons_pointer val)
Store this val as the value of this key in this hashmap mapp.
struct cons_pointer hashmap_put_all(struct cons_pointer mapp, struct cons_pointer assoc)
Copy all key/value pairs in this association list assoc into this hashmap mapp.
struct cons_pointer make_hashmap(uint32_t n_buckets, struct cons_pointer hash_fn, struct cons_pointer write_acl)
Make a hashmap with this number of buckets, using this hash_fn.
struct cons_pointer hashmap_keys(struct cons_pointer mapp)
return a flat list of all the keys in the hashmap indicated by map.
uint32_t get_hash(struct cons_pointer ptr)
Get the hash value for the cell indicated by this ptr; currently only implemented for string like thi...
int64_t to_long_int(struct cons_pointer arg)
Return the closest possible int64_t representation to the value of this arg, expected to be an intege...
struct cons_pointer print(URL_FILE *output, struct cons_pointer pointer)
Print the cons-space object indicated by pointer to the stream indicated by output.
struct cons_pointer hash_fn
struct cons_pointer write_acl
union vector_space_object::@5 payload
we'll malloc size bytes for payload, payload is just the first of these.
#define pointer_to_vso(pointer)
given a pointer to a vector space object, return the object.
struct cons_pointer buckets[]
The payload of a hashmap.
a vector_space_object is just a vector_space_header followed by a lump of bytes; what we deem to be i...