Skip to content

Commit 0e638ca

Browse files
authored
Add example for accumulate
1 parent 9e44e8d commit 0e638ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

examples/accumulate.janet

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
(reduce + 0 [1 2 3 4]) #-> 10
2+
(accumulate + 0 [1 2 3 4]) # -> @[1 3 6 10]
3+
4+
(reduce + 0 []) # -> 0
5+
(accumulate + 0 []) # -> @[]
6+
7+
(reduce string "" ["J" "a" "n" "e" "t"]) # -> "Janet"
8+
(accumulate string "" ["J" "a" "n" "e" "t"]) # -> @["J" "Ja" "Jan" "Jane" "Janet"]

0 commit comments

Comments
 (0)