all repos — min @ f27058c9068a661406f6a444a0c1ad27475e57dc

A small but practical concatenative programming language.

tests/stack.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
'test load
'test import

"stack" describe

  (1 2 3 4 get-stack (1 2 3 4) ==) assert

  ((1 2 3) set-stack get-stack (1 2 3) ==) assert

  (1 id 1 ==) assert

  (2 pop get-stack () ==) assert

  (1 dup get-stack (1 1) ==) assert

  (3 2 (1 +) dip + 6 ==) assert

  (1 2 nip get-stack (2) ==) assert

  (1 2 4 '+ dip get-stack (3 4) ==) assert

  (1 2 4 '+ keep get-stack (1 6 4) ==) assert

  ((1) (2 swap append) sip concat (1 2 1) ==) assert

  (1 (2 3) cons (1 2 3) ==) assert

  (1 2 over get-stack (1 2 1) ==) assert

  (1 2 3 pick get-stack (1 2 3 1) ==) assert

  ((1 2 3) ('sum 'size) => cleave / 2 ==) assert

  ((1 2) (3 4) ((0 get) (1 get)) spread get-stack (1 4) ==) assert

  report
  clear-stack