Skip to content

Commit d51c8f7

Browse files
authored
Merge pull request #429 from sogaiu/tweak-minus-examples
Tweak examples for -
2 parents 719fa45 + 3c129c3 commit d51c8f7

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

examples/-.janet

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33
(- 1 2) # -> -1
44
(- 1.4 -4.5) # -> 5.9
55

6-
# Equivalent to (- first (+ ;rest))
76
(- 1 2 3 4 5 6 7 8 9 10) # -> -53
7+
(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
811

9-
# Janet can subtract types that support the :- or :r- method
12+
# can subtract types that support the :- or :r- method
1013
(- (int/s64 "10") 10) # -> <core/s64 0>

0 commit comments

Comments
 (0)