summaryrefslogtreecommitdiff
path: root/sanctuary.fs
diff options
context:
space:
mode:
authorkitty <nepeta@canaglie.net>2026-03-23 20:26:02 +1100
committerkitty <nepeta@canaglie.net>2026-03-23 20:26:02 +1100
commitae1c341e4ce177a83fa678615103f32677888ed8 (patch)
treeaed038ca593129d11db8fa6ab24d8e55fef16d74 /sanctuary.fs
parent1456d7073742e39985aa093bdbc152f4f9cd07a4 (diff)
strings + nip and tuck
Diffstat (limited to 'sanctuary.fs')
-rw-r--r--sanctuary.fs13
1 files changed, 13 insertions, 0 deletions
diff --git a/sanctuary.fs b/sanctuary.fs
index 6bdfbfc..6bc19e1 100644
--- a/sanctuary.fs
+++ b/sanctuary.fs
@@ -6,6 +6,9 @@
: decimal 10 base ! ;
: hex 16 base ! ;
+: nip swap drop ;
+: tuck swap over ;
+
: <mark here ;
: <resolve here 4 + - d, ;
: >mark here 0 d, ;
@@ -52,4 +55,14 @@
0 constant false
-1 constant true
+
+: cmove, dup >r here swap cmove r> allot ;
+: s" 1 >in +! [ char " ] literal parse ( a u )
+ branch >mark >r 2dup cmove, nip ( u ) ( R: mark )
+ r> dup >resolve 4 + ( u a )
+ postpone literal ( a ) postpone literal ( u ) ; immediate compile-only
+
+1 constant stdout
+2 constant stderr
+
bye