push
Appends an element to the end of an array and returns a new array
(push element arr)Returns
Parameters
Examples
(push 5 [1, 2])
;;=> [1, 2, 5]
(def arr1 [1, 2, 3])
(push 4 arr1)
;;=> [1, 2, 3, 4]
arr1 ;; arr1 remains the same
;;=> [1, 2, 3]
(push! 5 arr1)
;;=> 5
arr1
;;=> [1, 2, 3, 5]
Last updated