Add defun without evaluation
This commit is contained in:
@@ -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'");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user