Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/_42.janet
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
(*) # -> 1
(* 10) # -> 10
(* 10 20) # -> 200
(* 1 2 3 4 5 6 7) #-> 5040
(* 1 2 3 4 5 6 7) # -> 5040

# Can take product of array with splice, but 'product' is better
(* ;(range 1 20)) #-> 1.21645e+17
(product (range 1 20)) #-> 1.21645e+17
(* ;(range 1 20)) # -> 1.21645100408832e+17
(product (range 1 20)) # -> 1.21645100408832e+17
2 changes: 1 addition & 1 deletion examples/apply.janet
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(apply + (range 10)) # -> 45
(apply + []) # -> 0
(apply + 1 2 3 4 5 6 7 [8 9 10]) # -> 55
(apply + 1 2 3 4 5 6 7 8 9 10) # -> error: expected array|tuple, got number
(apply + 1 2 3 4 5 6 7 8 9 10) # -> error: expected array or tuple, got 10

# Can also be used to call macros like functions.
# Will return the macro expanded code of the original macro.
Expand Down
2 changes: 1 addition & 1 deletion examples/product.janet
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
(product (range 1 10)) # -> 362880

# Product over byte values [0-255] in a string
(product "hello") # -> 1.35996e+10
(product "hello") # -> 13599570816

# Product over values in a table or struct
(product {:a 1 :b 2 :c 4}) # -> 8