Almost truthy...

This commit is contained in:
Simon Forman 2023-02-04 22:58:16 -08:00
parent 6159165acd
commit b70229d727
2 changed files with 49 additions and 3 deletions

View File

@ -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;
}
*/
/*

View File

@ -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);*/