2017-06-26 12:15:03 +03:00
|
|
|
(defmodule Char
|
2017-11-29 17:28:21 +03:00
|
|
|
(register = (Fn [Char Char] Bool))
|
2017-11-14 20:33:03 +03:00
|
|
|
(register str (Fn [Char] String))
|
|
|
|
(register to-int (Fn [Char] Int))
|
|
|
|
(register from-int (Fn [Int] Char))
|
2017-11-22 18:25:05 +03:00
|
|
|
(register copy (Fn [&Char] Char))
|
2017-12-30 22:16:31 +03:00
|
|
|
(register format (Fn [&String Char] String))
|
2017-12-01 14:02:36 +03:00
|
|
|
|
2017-12-28 20:10:38 +03:00
|
|
|
(defn random []
|
2017-12-29 12:28:46 +03:00
|
|
|
(from-int (Int.random)))
|
2017-12-28 20:10:38 +03:00
|
|
|
|
|
|
|
(defn random-between [a b]
|
2017-12-29 12:28:46 +03:00
|
|
|
(from-int (Int.random-between (to-int a) (to-int b))))
|
2017-12-28 20:10:38 +03:00
|
|
|
|
2017-12-01 14:02:36 +03:00
|
|
|
(defn meaning [char-ref]
|
|
|
|
(cond
|
|
|
|
(= @char-ref \0) 0
|
|
|
|
(= @char-ref \1) 1
|
|
|
|
(= @char-ref \2) 2
|
|
|
|
(= @char-ref \3) 3
|
|
|
|
(= @char-ref \4) 4
|
|
|
|
(= @char-ref \5) 5
|
|
|
|
(= @char-ref \6) 6
|
|
|
|
(= @char-ref \7) 7
|
|
|
|
(= @char-ref \8) 8
|
|
|
|
(= @char-ref \9) 9
|
|
|
|
-1))
|
2017-11-14 20:33:03 +03:00
|
|
|
)
|