Convert Java array to list or Clojure sequence?

How to convert a Java array to a Clojure sequence data structure such as a list or another sequence?

This question shows how to do the opposite; Clojure docs show how to create, mutate, and read arrays; but is there a built-in way to convert them to lists or some other Clojure native sequence?

+4
source share
1 answer

Yes, there is a way to convert an array to a list! The code (seq java-array-here)converts the array to ArraySeq, which implements ISeqand, therefore, can be considered like any other Clojure sequence .

+7
source

All Articles