Guest User

Untitled

a guest
Apr 28th, 2019
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 1.56 KB | None | 0 0
  1. // 1. Void manifests itself.
  2. void
  3.  
  4. // 2. Iota - an intangible particle that can
  5. //    be distinguished from void.
  6. iota := not void
  7.  
  8. // 3. Boolean proposition is a iota of truthfulness.
  9. bool := iota
  10.  
  11. true, false := bool
  12.  
  13. not x :=
  14.     x := bool
  15.     -> x ?
  16.         true  -> false
  17.         false -> true
  18.  
  19. x and y :=
  20.     x, y := bool
  21.     -> x ?
  22.         true  -> y
  23.         false -> false
  24.  
  25. x or y :=
  26.     x, y := bool
  27.     -> x ?
  28.         true  -> true
  29.         false -> y
  30.  
  31. x xor y :=
  32.     x, y := bool
  33.     -> (x or y) and not (x and y)
  34.  
  35. // 4. Int stands for a whole number.
  36. int ::
  37.     int < int -> bool
  38.     int > int -> bool
  39.     int <= int -> bool
  40.     int >= int -> bool
  41.  
  42.     int + int -> int
  43.     int - int -> int
  44.     int * int -> int
  45.     int / int -> int
  46.     int ^ int -> int
  47.     int % int -> int // mod
  48.  
  49. // 5. List is a sequence of propositions.
  50. item list ::
  51.     append! item to list -> item
  52.     list length -> int
  53.     list[int] -> item
  54.     list[int:int] -> item list
  55.     item in list -> bool
  56.  
  57. // 5. Real stands for a real number.
  58. real ::
  59.     real  < real -> bool
  60.     real  > real -> bool
  61.     real <= real -> bool
  62.     real >= real -> bool
  63.    
  64.     real + real -> real
  65.     real - real -> real
  66.     real * real -> real
  67.     real / real -> real
  68.     real ^ real -> real
  69.  
  70.     rounded real -> real
  71.     floored real -> real
  72.     sqrt real -> real
  73.  
  74. // 6. Rune is a character.
  75. //
  76. //    For any text encoding, there always
  77. //    will be a finite set of characters
  78. //    it assumes. Therefore, it's safe
  79. //    to say any rune can be expressed as
  80. //    as integer.
  81. //
  82. //    Corresponding fact: UTF-8 codepoint
  83. rune := int
  84.  
  85. // 7. String is a sequence of characters.
  86. string := rune list
Add Comment
Please, Sign In to add comment