all repos — min @ ac3a195499364a7e700aaa7922cec9ddf1551bac

A small but practical concatenative programming language.

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

"num" describe

  (2 2 + 4 ==) assert
  (1 3.0 + 4 ==) assert
  (3.1 3.9 + 7 ==) assert
  (3 -2.1 + 0.8999999999999999 ==) assert

  (3 3 - 0 ==) assert
  (-5 -4 - -1 ==) assert
  (-4 3.7 - -7.7 ==) assert

  (-2 4 * -8 ==) assert
  (-2.5 -2 * 5 ==) assert
  (3 3 * 9 ==) assert

  (5 2 / 2.5 ==) assert
  (1 3 / 0.3333333333333333 ==) assert
  (-3 2 / -1.5 ==) assert

  (5 2 div 2 ==) assert
  (1 3 div 0 ==) assert
  (-3 2 div -1 ==) assert
  
  (5 2 mod 1 ==) assert
  (4 2 mod 0 ==) assert
  (-3 2 mod -1 ==) assert

  (1000 random 1000 <) assert

  ((1 2 3 4 5) sum 15 ==) assert

  (0 :c
    (c 10 <) (c succ @c) while
    c 10 ==) assert

  ((1 2 3 4 5) (even?) filter (2 4) ==) assert

  ((1 2 3 4 5) (even?) any?) assert

  ((2 4 6 8) (even?) all?) assert

  report
  clear-stack