mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 05:45:37 +03:00
commit
d9a2da18b0
@ -74,6 +74,7 @@ The margin of error is 0.00001.")
|
||||
(not (neg? x)))
|
||||
|
||||
(defn id [x] x)
|
||||
(defn const [x] (fn [_] x))
|
||||
|
||||
(defn null? [p]
|
||||
(Pointer.eq NULL (the (Ptr t) p)))
|
||||
@ -106,4 +107,4 @@ The margin of error is 0.00001.")
|
||||
(defn /= [a b]
|
||||
(not (= a b)))
|
||||
|
||||
)
|
||||
)
|
||||
|
21
test/generics.carp
Normal file
21
test/generics.carp
Normal file
@ -0,0 +1,21 @@
|
||||
(load "Test.carp")
|
||||
|
||||
(use Test)
|
||||
|
||||
(deftest test
|
||||
(assert-equal test
|
||||
1
|
||||
(id 1)
|
||||
"id works I"
|
||||
)
|
||||
(assert-equal test
|
||||
&(Maybe.Just 1)
|
||||
&(id (Maybe.Just 1))
|
||||
"id works II"
|
||||
)
|
||||
(assert-equal test
|
||||
20
|
||||
((const 20) 1)
|
||||
"const works"
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user