Some fixes
This commit is contained in:
parent
0aac6f18b2
commit
f55386304b
2 changed files with 9 additions and 6 deletions
|
@ -515,22 +515,21 @@ struct Object *func_newline(
|
|||
|
||||
void display_pair(struct Object *const pair)
|
||||
{
|
||||
assert(pair);
|
||||
assert(pair->type == TYPE_PAIR);
|
||||
assert(Object_is_pair(pair));
|
||||
|
||||
struct Object *pair1[2] = { Object_new_pair(pair->pair.car, NULL), NULL };
|
||||
struct Object *pair1[2] = { pair->pair.car, NULL };
|
||||
func_display(1, pair1);
|
||||
|
||||
if (!pair->pair.cdr) return;
|
||||
|
||||
printf(" ");
|
||||
|
||||
if (pair->pair.cdr->type == TYPE_PAIR) {
|
||||
if (Object_is_pair(pair->pair.cdr)) {
|
||||
display_pair(pair->pair.cdr);
|
||||
return;
|
||||
}
|
||||
|
||||
printf(". ");
|
||||
struct Object *pair2[2] = { Object_new_pair(pair->pair.cdr, NULL), NULL };
|
||||
struct Object *pair2[2] = { pair->pair.cdr, NULL };
|
||||
func_display(1, pair2);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,11 @@ int main()
|
|||
struct Object *const result = eval(program);
|
||||
|
||||
printf("=> ");
|
||||
eval(Object_build_list(2, Object_new_symbol("displayln"), result));
|
||||
eval(Object_build_list(
|
||||
2,
|
||||
Object_new_symbol("displayln"),
|
||||
Object_build_list(2, Object_new_symbol("quote"), result)
|
||||
));
|
||||
}
|
||||
|
||||
exit(EXIT_SUCCESS);
|
||||
|
|
Loading…
Reference in a new issue