mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
24 lines
496 B
Plaintext
24 lines
496 B
Plaintext
(use Array)
|
|
(Project.no-echo)
|
|
|
|
(deftype Age [x Int])
|
|
|
|
(defmodule Age
|
|
(defn = [a b]
|
|
(= (Age.x a) (Age.x b)))
|
|
(defn > [a b]
|
|
(> (Age.x a) (Age.x b)))
|
|
(defn < [a b]
|
|
(< (Age.x a) (Age.x b)))
|
|
|
|
(implements = Age.=)
|
|
(implements > Age.>)
|
|
(implements < Age.<)
|
|
)
|
|
|
|
(defn main []
|
|
(let-do [ints (Array.sort [10 3 75 40])
|
|
ages (Array.sort [(Age.init 10) (Age.init 3) (Age.init 75) (Age.init 40)])]
|
|
(IO.println &(Array.str &ints))
|
|
(IO.println &(Array.str &ages))))
|