🐐 First order functions

This commit is contained in:
2026-04-21 18:12:15 +02:00
parent db5b7bf144
commit 693054491f
18 changed files with 407 additions and 46 deletions

9
snippets/fvnctio.cent Normal file
View File

@@ -0,0 +1,9 @@
DEFINI apply (f, x) VT {
REDI (INVOCA f (x))
}
DESIGNA dbl VT FVNCTIO (n) VT {
REDI (n * II)
}
DICE(INVOCA apply (dbl, VII))

BIN
snippets/fvnctio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

11
snippets/invoca_expr.cent Normal file
View File

@@ -0,0 +1,11 @@
// Immediately invoked
DICE(INVOCA FVNCTIO (x) VT { REDI (x + I) } (V))
// From an array
DESIGNA fns VT [FVNCTIO (x) VT { REDI (x + I) }]
DICE(INVOCA fns[I] (V))
// Passing a named function as an argument
DEFINI apply (f, x) VT { REDI (INVOCA f (x)) }
DEFINI sqr (x) VT { REDI (x * x) }
DICE(INVOCA apply (sqr, IV))

BIN
snippets/invoca_expr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -78,7 +78,7 @@ contexts:
scope: support.class.module.centvrion
keywords:
- match: '\b(AETERNVM|ALVID|AVGE|AVT|CONTINVA|DEFINI|DESIGNA|DISPAR|DONICVM|DVM|ERVMPE|EST|ET|FACE|INVOCA|IN|MINVE|MINVS|NON|PER|PLVS|REDI|RELIQVVM|SI|TABVLA|TVNC|VSQVE|VT|CVM)\b'
- match: '\b(AETERNVM|ALVID|AVGE|AVT|CONTINVA|DEFINI|DESIGNA|DISPAR|DONICVM|DVM|ERVMPE|EST|ET|FACE|FVNCTIO|INVOCA|IN|MINVE|MINVS|NON|PER|PLVS|REDI|RELIQVVM|SI|TABVLA|TVNC|VSQVE|VT|CVM)\b'
scope: keyword.control.centvrion
operators: