aboutsummaryrefslogtreecommitdiffstats
path: root/src/bootstrap/primitives.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-10-13 17:18:31 +0200
committerBad Diode <bd@badd10de.dev>2021-10-13 17:18:31 +0200
commite068d45199bb23452821727e5b82a2307ae0256d (patch)
tree3ea7c52adda766e4732306c0fa0787e0244edc15 /src/bootstrap/primitives.c
parented1f406102738812fafa5e49ee131fe06c177687 (diff)
downloadbdl-e068d45199bb23452821727e5b82a2307ae0256d.tar.gz
bdl-e068d45199bb23452821727e5b82a2307ae0256d.zip
Add eq? primitive procedure
Diffstat (limited to 'src/bootstrap/primitives.c')
-rw-r--r--src/bootstrap/primitives.c47
1 files changed, 29 insertions, 18 deletions
diff --git a/src/bootstrap/primitives.c b/src/bootstrap/primitives.c
index 8369fa8..2a82782 100644
--- a/src/bootstrap/primitives.c
+++ b/src/bootstrap/primitives.c
@@ -880,21 +880,32 @@ proc_list(Environment *env, Object *obj) {
880// Polymorphic procedures. 880// Polymorphic procedures.
881// 881//
882 882
883//Object * 883Object *
884//proc_equal(Object *args) { 884proc_equal(Environment *env, Object *obj) {
885// // TODO: stub 885 if (obj == obj_nil || obj->cdr == obj_nil) {
886// (void) args; 886 error_push((Error){
887// return NULL; 887 .type = ERR_TYPE_RUNTIME,
888//} 888 .value = ERR_NOT_ENOUGH_ARGS,
889 889 });
890//// TODO: fixnum left/right shift, mask, invert 890 return obj_err;
891//// TODO: implement and test missing procedures 891 }
892//// TODO: add primitives for type transforms: string->symbol, symbol->string, etc 892 Object *a = eval(env, obj->car);
893//// TODO: properly implement nested environments 893 if (a == obj_err) {
894//// TODO: implement support for quotes and semi-quotes 894 return obj_err;
895//// TODO: LAMBDA 895 }
896//// TODO: let 896 Object *b = eval(env, obj->cdr->car);
897//// TODO: better error handling? 897 if (b == obj_err) {
898//// TODO: Revise all instances where we are returning an object, since currently 898 return obj_err;
899//// we may be returning a pointer to an object instead of a new one. Check also 899 }
900//// on eval function and everytime we do make_xxx(obj). 900 return obj_eq(a, b) ? obj_true : obj_false;
901}
902
903
904// TODO: fixnum left/right shift, mask, invert
905// TODO: add primitives for type transforms: string->symbol, symbol->string, etc
906// TODO: implement support for semi-quotes
907// TODO: LAMBDA
908// TODO: let
909// TODO: Revise all instances where we are returning an object, since currently
910// we may be returning a pointer to an object instead of a new one. Check also
911// on eval function and everytime we do make_xxx(obj).