mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-12 04:58:18 +03:00
commit
2cacc516cf
@ -12,6 +12,11 @@
|
|||||||
|
|
||||||
(defn inc-ref [x] (+ @x 1))
|
(defn inc-ref [x] (+ @x 1))
|
||||||
|
|
||||||
|
(defn cmp [a b]
|
||||||
|
(if (= @a @b)
|
||||||
|
0
|
||||||
|
(if (> @a @b) 1 -1)))
|
||||||
|
|
||||||
(defn main []
|
(defn main []
|
||||||
(let [a (range 0 9 1)
|
(let [a (range 0 9 1)
|
||||||
b (Array.replicate 5 "Hi")]
|
b (Array.replicate 5 "Hi")]
|
||||||
@ -91,6 +96,11 @@
|
|||||||
&(range 10 1 -2)
|
&(range 10 1 -2)
|
||||||
"range backwards works as expected if we dont exactly hit"
|
"range backwards works as expected if we dont exactly hit"
|
||||||
)
|
)
|
||||||
|
(assert-equal test
|
||||||
|
&[1 2 3 4 5 6 7 8 9]
|
||||||
|
(sort &(range 9 1 -1) cmp)
|
||||||
|
"sort works as expected"
|
||||||
|
)
|
||||||
(assert-equal test
|
(assert-equal test
|
||||||
&[@"Hi!" @"Hi!" @"Hi!" @"Hi!" @"Hi!"]
|
&[@"Hi!" @"Hi!" @"Hi!" @"Hi!" @"Hi!"]
|
||||||
&(endo-map excl b)
|
&(endo-map excl b)
|
||||||
|
Loading…
Reference in New Issue
Block a user