diff --git a/bin/pre.slime b/bin/pre.slime index a5584bc..6c2be08 100644 --- a/bin/pre.slime +++ b/bin/pre.slime @@ -411,7 +411,7 @@ by the key 'from' and ends with the number defined in 'to'." result) (define (map fun seq) - :doc "Takes a function and a sequence as arguments and returns a new + "Takes a function and a sequence as arguments and returns a new sequence which contains the results of using the first sequences elemens as argument to that function." (if (null? seq) diff --git a/src/built_ins.cpp b/src/built_ins.cpp index 3e90afa..fab2f56 100644 --- a/src/built_ins.cpp +++ b/src/built_ins.cpp @@ -229,12 +229,10 @@ namespace Slime { Lisp_Object_Type type = Memory::get_type(definee); switch (type) { case Lisp_Object_Type::Symbol: { - // BUG(Felix): Defining with doc string crashes if (form != Memory::nil) { Lisp_Object* doc = thing; try_void assert_type(doc, Lisp_Object_Type::String); try_void assert_type(form, Lisp_Object_Type::Pair); - form = form->value.pair.rest; thing = form->value.pair.first; try_void assert(form->value.pair.rest == Memory::nil); // TODO docs @@ -1053,16 +1051,17 @@ namespace Slime { } return Memory::t; }; - define((print (:sep " ") (:end "\n") . things), "TODO") { + define((print (:sep " ") (:end "\n") (:repr ()) . things), "TODO") { profile_with_name("(print)"); - fetch(sep, end, things); + fetch(sep, end, repr, things); if (things != Memory::nil) { - print(things->value.pair.first); + bool print_repr = repr != Memory::nil; + print(things->value.pair.first, repr); for_lisp_list(things->value.pair.rest) { print(sep); - print(it); + print(it, repr); } } diff --git a/src/io.cpp b/src/io.cpp index 289a664..3c0749c 100644 --- a/src/io.cpp +++ b/src/io.cpp @@ -304,7 +304,7 @@ namespace Slime { } proc string_buider_to_string(Array_List string_builder) -> char* { - int len = 1; + size_t len = 1; int idx = 0; for (auto str : string_builder) { len += strlen(str); @@ -479,6 +479,10 @@ namespace Slime { return string_buider_to_string(string_builder); } + default: + create_generic_error("A Lisp_Object of type-id %d cannot be converted to a string", + (int)(Memory::get_type(node))); + return nullptr; } }