Carp/examples/static_array.carp

5 lines
159 B
Plaintext
Raw Normal View History

2020-04-23 15:35:49 +03:00
(defn main []
2020-04-29 11:54:41 +03:00
(let-do [xs $[1 2 3 4 5]]
(StaticArray.map! xs &(fn [x] (* @x 2)))
(println* (StaticArray.reduce &(fn [total x] (+ total @x)) 0 xs))))