From 69d4a8f20cbc60bae27aef9a36857324a04c581f Mon Sep 17 00:00:00 2001 From: Peter Mikkelsen Date: Fri, 28 Jan 2022 14:32:59 +0000 Subject: =?UTF-8?q?Implement=20disclose=20(monadic=20=E2=8A=83)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 6c9f837..eedacb9 100644 --- a/functions.c +++ b/functions.c @@ -39,7 +39,7 @@ fnmonad monadfunctiondefs[] = { fnMix, /* ↑ */ fnSplit, /* ↓ */ fnEnclose, /* ⊂ */ - 0, /* ⊃ */ + fnDisclose, /* ⊃ */ fnNest, /* ⊆ */ 0, /* ⌷ */ fnGradeUp, /* ⍋ */ @@ -496,6 +496,15 @@ fnEnclose(Array *right) } } +Array * +fnDisclose(Array *right) +{ + if(right->size == 0) + return fillelement(right); + else + return arrayitem(right, 0); +} + Array * fnNest(Array *right) { -- cgit v1.2.3