all repos — min @ 36f1793980184ab8645063b8b66b991d9d0b4d1f

A small but practical concatenative programming language.

prelude.min

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
; Imports
'str       import
'io        import
'logic     import
'num       import
'sys       import
'time      import
'fs        import
'crypto    import

; Mathematical Operators
(1 +)           :succ
(1 -)           :pred
(2 mod 0 ==)    :even?
(even? not)     :odd?

('succ 'pred 'even? 'odd?) 'seal foreach

; Stack Operators
(swap cons)                       :swons
((pop) dip)                       :popd
((dup) dip)                       :dupd
((swap) dip)                      :swapd
((dup) dip i)                     :q
((zap) dip i)                     :k
((cons) dip i)                    :b
((swap) dip i)                    :c
((dip) cons cons)                 :take
(() cons dip)                     :dig1
(() cons cons dip)                :dig2
(() cons cons cons dip)           :dig3
((() cons) dip swap i)            :bury1
((() cons cons) dip swap i)       :bury2
((() cons cons cons) dip swap i)  :bury3

('swons 'popd 'dupd 'swapd 'q 'k 'b 'c 'take 'dig1 'dig2 'dig3 'bury1 'bury2 'bury3) 'seal foreach

; Other
(print pop)                                    :print!
(dprint pop)                                   :dprint!
(puts pop)                                     :puts!
(call pop)                                     :call!
(:ms :q :check (check) (ms sleep q) while)     :interval
(password aes encode)                          :encrypt
(decode password aes)                          :decrypt

('print! 'dprint! 'puts! 'call! 'interval 'encrypt 'decrypt) 'seal foreach


; Unsealed symbols
()                                :startup
("[$1]$$ " (.) %)                 :prompt

; Load all stored symbols

stored-symbols ('load-symbol ROOT with) foreach
'startup ROOT with