summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/functions.c b/functions.c
index 9eb6406..c4b5cee 100644
--- a/functions.c
+++ b/functions.c
@@ -57,7 +57,7 @@ fnmonad monadfunctiondefs[] = {
fnReverseLast, /* ⌽ */
fnReverseFirst, /* ⊖ */
fnTranspose, /* ⍉ */
- 0, /* ⍎ */
+ fnExecute, /* ⍎ */
0, /* ⍕ */
fnSelfReference1, /* ∇ */
};
@@ -715,6 +715,23 @@ fnTranspose(Array *right)
}
Array *
+fnExecute(Array *right)
+{
+ if(right->type != AtypeRune)
+ throwerror(nil, EType);
+ Rune *code = pparray(right);
+ Datum *result = evalline(code, nil, 1);
+ free(code);
+ if(!result)
+ throwerror(L"No result produced by ⍎", EDomain);
+ if(result->tag != ArrayTag)
+ throwerror(L"Result of ⍎ must be an array", EType);
+ Array *res = result->array;
+ free(result);
+ return res;
+}
+
+Array *
fnSelfReference1(Array *right)
{
DfnFrame *dfn = getcurrentdfn();