diff --git a/implementations/C/joy.c b/implementations/C/joy.c index 85d47ea..112b9a8 100644 --- a/implementations/C/joy.c +++ b/implementations/C/joy.c @@ -582,9 +582,27 @@ clear(JoyListPtr stack, __attribute__((unused)) JoyListPtr expression) } -void div_joyfunc(JoyListPtr stack, JoyListPtr expression) {stack = expression;} -void mod(JoyListPtr stack, JoyListPtr expression) {stack = expression;} -void truthy(JoyListPtr stack, JoyListPtr expression) {stack = expression;} +void +truthy(JoyListPtr stack, JoyListPtr expression) +{ + *stack = EMPTY_LIST; +} +/* + JoyListPtr s = stack; + JoyList node = pop_any(stack); + switch (node->head->kind) { + case joyTrue: + stack = s; + case joyFalse: + stack = s; + case joyInt: + push_thing( + if (node->head->value.i); + default: + + stack = expression; +} +*/ /* diff --git a/implementations/C/notes b/implementations/C/notes index 9795ced..d6a315a 100644 --- a/implementations/C/notes +++ b/implementations/C/notes @@ -1,3 +1,31 @@ + +So how do we want to handle definitions? Read a defs.txt file at +compile time? Build defs.c from defs.txt? + +void +defname(JoyListPtr stack, JoyListPtr expression) +{ + def_node = some C initializer? + def_node = text_to_expression("dup mul"); + push_quote(def_node, expression); +} + +...? + +I think the easiest thing to do at the mo' would be to hardcode the defs +as an array of strings and then read them and convert at start time? + + + + + + + + + + + + /*mpz_t pi;*/ /*char *text = (char *)TEXT;*/ /*mpz_init_set_str(pi, "3141592653589793238462643383279502884", 10);*/