hashmaps can now be printed and keys deleted

This commit is contained in:
Felix Brendel
2019-10-06 18:57:15 +02:00
parent a0c4b16629
commit c80478a2cb
5 changed files with 54 additions and 2 deletions
+6
View File
@@ -848,6 +848,12 @@ proc load_built_ins_into_environment() -> void {
hm_set(hm->value.hashMap, key, value);
return Memory::nil;
};
define((hash-map-delete! hm key), "TODO") {
fetch(hm, key);
try assert_type(hm, Lisp_Object_Type::HashMap);
hm_delete_object(hm->value.hashMap, key);
return Memory::nil;
};
define((vector . args), "TODO") {
fetch(args);
Lisp_Object* ret;
+1 -1
Submodule src/ftb updated: 94ad64f6bb...9c5512b182
+9 -1
View File
@@ -284,7 +284,15 @@ proc print(Lisp_Object* node, bool print_repr = false, FILE* file = stdout) -> v
case (Lisp_Object_Type::Continuation): fputs("[continuation]", file); break;
case (Lisp_Object_Type::CFunction): fputs("[C-function]", file); break;
case (Lisp_Object_Type::Pointer): fputs("[pointer]", file); break;
case (Lisp_Object_Type::HashMap): fputs("[hashmap]", file); break;
case (Lisp_Object_Type::HashMap): {
for_lisp_obj_hash_map (node->value.hashMap) {
fputs(" ", file);
print(key, true, file);
fputs(" -> ", file);
print((Lisp_Object*)value, true, file);
fputs("\n", file);
}
} break;
case (Lisp_Object_Type::String): {
if (print_repr) {
putc('\"', file);