summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/eval.c b/eval.c
index bfe211e..1070cb2 100644
--- a/eval.c
+++ b/eval.c
@@ -22,8 +22,8 @@ Datum *lookup(Datum);
int bindingstrengths[11][11] = {
/* A F H MO DO AF ( ) ← IS N */
- 6, 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, /* A */
- 2, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, /* F */
+ 6, 3, 3, 4, 0, 0, 0, 0, 0, 0, 0, /* A */
+ 2, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, /* F */
0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, /* H */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* MO */
5, 5, 5, 0, 0, 0, 0, 0, 0, 0, 0, /* DO */
@@ -37,8 +37,8 @@ int bindingstrengths[11][11] = {
evalfn evalfns[11][11] = {
/* A F H MO DO AF ( ) ← IS N */
- strand, dyadfun, 0, monadop, 0, 0, 0, 0, 0, 0, 0, /* A */
- monadfun, 0, 0, monadop, 0, 0, 0, 0, 0, 0, 0, /* F */
+ strand, dyadfun, dyadfun, monadop, 0, 0, 0, 0, 0, 0, 0, /* A */
+ monadfun, 0, monadop, monadop, 0, 0, 0, 0, 0, 0, 0, /* F */
0, 0, 0, monadop, 0, 0, 0, 0, 0, 0, 0, /* H */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* MO */
dyadop, dyadop, dyadop, 0, 0, 0, 0, 0, 0, 0, 0, /* DO */
@@ -192,8 +192,13 @@ dyadfun(Datum left, Datum right)
traceprint("Applying left argument to function\n");
Datum result;
result.shy = 0;
- result.tag = BoundFunctionTag,
- result.func = right.func;
+ result.tag = BoundFunctionTag;
+ if(right.tag == FunctionTag)
+ result.func = right.func;
+ else if(right.tag == HybridTag){
+ result.func.type = FunctypeHybrid;
+ result.func.code = right.hybrid;
+ }
result.func.left = left.array;
incref(left.array);
return result;
@@ -256,7 +261,12 @@ monadop(Datum left, Datum right)
result.shy = 0;
result.tag = FunctionTag,
result.func.type = FunctypeOp;
- result.func.operator = right.operator;
+ if(right.tag == MonadicOpTag || right.tag == DyadicOpTag)
+ result.func.operator = right.operator;
+ else{
+ result.func.operator.type = OperatortypeHybrid;
+ result.func.operator.code = right.hybrid;
+ }
result.func.operator.left = arg;
result.func.left = nil;
if(arg->tag == ArrayTag)