File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed
Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 11(* ) # -> 1
22(* 10 ) # -> 10
33(* 10 20 ) # -> 200
4- (* 1 2 3 4 5 6 7 ) # -> 5040
4+ (* 1 2 3 4 5 6 7 ) # -> 5040
55
66# Can take product of array with splice, but 'product' is better
7- (* ;(range 1 20 )) # -> 1.21645e +17
8- (product (range 1 20 )) # -> 1.21645e +17
7+ (* ;(range 1 20 )) # -> 1.21645100408832e +17
8+ (product (range 1 20 )) # -> 1.21645100408832e +17
Original file line number Diff line number Diff line change 11(apply + (range 10 )) # -> 45
22(apply + []) # -> 0
33(apply + 1 2 3 4 5 6 7 [8 9 10 ]) # -> 55
4- (apply + 1 2 3 4 5 6 7 8 9 10 ) # -> error: expected array| tuple, got number
4+ (apply + 1 2 3 4 5 6 7 8 9 10 ) # -> error: expected array or tuple, got 10
55
66# Can also be used to call macros like functions.
77# Will return the macro expanded code of the original macro.
Original file line number Diff line number Diff line change 44(product (range 1 10 )) # -> 362880
55
66# Product over byte values [0-255] in a string
7- (product " hello" ) # -> 1.35996e+10
7+ (product " hello" ) # -> 13599570816
88
99# Product over values in a table or struct
1010(product {:a 1 :b 2 :c 4 }) # -> 8
You can’t perform that action at this time.
0 commit comments