Add defun without evaluation

This commit is contained in:
2022-11-03 09:46:23 -04:00
parent 37a614515e
commit ddb5a8f842
17 changed files with 291 additions and 129 deletions

View File

@@ -1,5 +1,6 @@
#include "uclisp.h"
#include "internal.h"
#include "lisp.h"
#include "uclisp.h"
#include "utility.h"
#include <stddef.h>
@@ -84,7 +85,14 @@ struct ucl_object *ucl_list_nth(struct ucl_object *list, int n) {
}
struct ucl_object *ucl_truthy(struct ucl_object *obj) {
// TODO: Implement me
// TODO: Implement me better
if (obj->type == UCL_TYPE_INT) {
return ucl_predicate(obj->integer);
} else if (obj->type == UCL_TYPE_SYMBOL) {
return ucl_predicate(true);
} else if (obj->type == UCL_TYPE_CELL) {
return ucl_predicate(obj->cell.car != NULL);
}
return ucl_error_create("Unimplemented function 'ucl_truthy'");
}