mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
43 lines
1.4 KiB
Plaintext
43 lines
1.4 KiB
Plaintext
(defmodule Long
|
|
(register + (λ [Long Long] Long))
|
|
(register - (λ [Long Long] Long))
|
|
(register * (λ [Long Long] Long))
|
|
(register / (λ [Long Long] Long))
|
|
(register < (λ [Long Long] Bool))
|
|
(register > (λ [Long Long] Bool))
|
|
(register = (λ [Long Long] Bool))
|
|
(register mod (λ [Long Long] Long))
|
|
(register seed (λ [Long] ()))
|
|
(register random (λ [] Long))
|
|
(register random-between (λ [Long Long] Long))
|
|
(register str (λ [Long] String))
|
|
(register from-string (λ [&String] Long))
|
|
(register bit-shift-left (λ [Long Long] Long))
|
|
(register bit-shift-right (λ [Long Long] Long))
|
|
(register bit-and (λ [Long Long] Long))
|
|
(register bit-or (λ [Long Long] Long))
|
|
(register bit-xor (λ [Long Long] Long))
|
|
(register bit-not (λ [Long] Long))
|
|
(register inc (λ [Long] Long))
|
|
(register dec (λ [Long] Long))
|
|
(register to-int (λ [Long] Int))
|
|
(register from-int (λ [Int] Long))
|
|
(register copy (λ [&Long] Long)) ;; TODO: Should not be needed when refs to value types are auto-converted to non-refs.
|
|
(register format (Fn [&String Long] String))
|
|
|
|
(defn /= [x y]
|
|
(not (Long.= x y)))
|
|
|
|
(register safe-add (λ [Long Long (Ref Long)] Bool))
|
|
(register safe-sub (λ [Long Long (Ref Long)] Bool))
|
|
(register safe-mul (λ [Long Long (Ref Long)] Bool))
|
|
|
|
(register abs (λ [Long] Long))
|
|
|
|
(defn max [a b] (if (> a b) a b))
|
|
(defn min [a b] (if (< a b) a b))
|
|
|
|
(defn even? [a] (= (mod a 2l) 0l))
|
|
(defn odd? [a] (not (even? a)))
|
|
)
|