diff options
author | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-01-11 17:43:24 +0000 |
---|---|---|
committer | Peter Mikkelsen <petermikkelsen10@gmail.com> | 2022-01-11 17:43:24 +0000 |
commit | 4a92ef13f83ec4fe79d6dd815f1b9fe492a404fe (patch) | |
tree | c5c263289354c2e2fd1f4822cfac389c23a9ffb7 /apl9.h | |
parent | fe701a61f4d057597dab3d46ba0fe31e550b41df (diff) |
Add dyadic function application, and implement dyadic ⍴
Diffstat (limited to 'apl9.h')
-rw-r--r-- | apl9.h | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -21,13 +21,14 @@ typedef enum typedef enum { AtypeInt, - AtypeArray + AtypeArray, } arrayDataType; /* Data types */ typedef struct Array Array; typedef struct Expr Expr; +typedef struct Function Function; typedef struct Datum Datum; struct Array @@ -50,6 +51,15 @@ struct Expr Datum *toks; }; +struct Function +{ + union { + int code; + Expr *dfn; + }; + Array *left; +}; + struct Datum { datumTag tag; @@ -57,10 +67,12 @@ struct Datum Array *array; int code; Expr expr; + Function func; }; }; typedef Array* (*fnmonad)(Array*); +typedef Array* (*fndyad)(Array*, Array*); /* Function prototypes for the different source files */ /* print.c */ @@ -90,6 +102,7 @@ Array *fnShape(Array *); /* Dyadic functions from functions.h */ Array *fnCatenateFirst(Array *, Array *); +Array *fnReshape(Array *, Array *); /* Global variables */ extern Rune *errormsg; /* eval.c */ @@ -98,4 +111,5 @@ extern Rune primfuncnames[]; /* function.c */ extern Rune primmonopnames[]; /* lexer.c */ extern Rune primdyadopnames[]; /* lexer.c */ extern Rune primhybridnames[]; /* lexer.c */ -extern fnmonad monadfunctiondefs[]; /* function.c */
\ No newline at end of file +extern fnmonad monadfunctiondefs[]; /* function.c */ +extern fndyad dyadfunctiondefs[]; /* function.c */
\ No newline at end of file |