How do I convert a Java array into a Clojure sequence data structure, such as a list, or other sequence?
This question shows how to do the inverse; The 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?
Yes, there is a way to convert an array to a list! The code (seq java-array-here)
will convert the array into an ArraySeq
, which implements ISeq
, and thus can be treated like any other Clojure sequence .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.