There was an error while loading. Please reload this page.
2 parents 719fa45 + 3c129c3 commit d51c8f7Copy full SHA for d51c8f7
1 file changed
examples/-.janet
@@ -3,8 +3,11 @@
3
(- 1 2) # -> -1
4
(- 1.4 -4.5) # -> 5.9
5
6
-# Equivalent to (- first (+ ;rest))
7
(- 1 2 3 4 5 6 7 8 9 10) # -> -53
+(def nums (range 1 11)) # -> @[1 2 3 4 5 6 7 8 9 10]
8
+(def frst (first nums)) # -> 1
9
+(def rest (slice nums 1)) # -> [2 3 4 5 6 7 8 9 10]
10
+(- frst (+ ;rest)) # -> -53
11
-# Janet can subtract types that support the :- or :r- method
12
+# can subtract types that support the :- or :r- method
13
(- (int/s64 "10") 10) # -> <core/s64 0>
0 commit comments