mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 13:51:50 +03:00
32 lines
721 B
Plaintext
32 lines
721 B
Plaintext
(defmodule Char
|
|
(register = (Fn [Char Char] Bool))
|
|
(register str (Fn [Char] String))
|
|
(register to-int (Fn [Char] Int))
|
|
(register from-int (Fn [Int] Char))
|
|
(register copy (Fn [&Char] Char))
|
|
(register format (Fn [&String Char] String))
|
|
|
|
(defn random []
|
|
(from-int (Int.random)))
|
|
|
|
(defn random-between [a b]
|
|
(from-int (Int.random-between (to-int a) (to-int b))))
|
|
|
|
(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))
|
|
|
|
(defn /= [a b]
|
|
(not (= a b)))
|
|
)
|