summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/functions.c b/functions.c
index 7952565..9eb6406 100644
--- a/functions.c
+++ b/functions.c
@@ -30,7 +30,7 @@ fnmonad monadfunctiondefs[] = {
0, /* < */
0, /* > */
0, /* ≥ */
- 0, /* ≡ */
+ fnDepth, /* ≡ */
fnTally, /* ≢ */
0, /* ∨ */
0, /* ∧ */
@@ -367,6 +367,16 @@ fnSame(Array *right)
}
Array *
+fnDepth(Array *right)
+{
+ int uniform;
+ int depth = arraydepth(right, &uniform);
+ if(!uniform)
+ depth = -depth;
+ return mkscalarint(depth);
+}
+
+Array *
fnTally(Array *right)
{
return mkscalarint(right->rank==0 ? 1 : right->shape[0]);