summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/functions.c b/functions.c
index cf5402a..4d9a69f 100644
--- a/functions.c
+++ b/functions.c
@@ -44,7 +44,7 @@ fnmonad monadfunctiondefs[] = {
0, /* ⌷ */
0, /* ⍋ */
0, /* ⍒ */
- 0, /* ⍳ */
+ fnIndexGenerator, /* ⍳ */
0, /* ⍸ */
0, /* ∊ */
0, /* ⍷ */
@@ -143,6 +143,19 @@ fnEnclose(Array *right)
}
Array *
+fnIndexGenerator(Array *right)
+{
+ /* TODO only works for creating vectors */
+ vlong n = right->intdata[0];
+ Array *res = mkarray(AtypeInt, 1, n);
+ res->shape[0] = n;
+ vlong io = globalIO();
+ for(vlong i = 0; i < n; i++)
+ res->intdata[i] = i + io;
+ return res;
+}
+
+Array *
fnNest(Array *right)
{
if(simplearray(right))