将Java数组转换为Clojure列表或序列? [英] Convert a Java array into a Clojure list or sequence?

查看:73
本文介绍了将Java数组转换为Clojure列表或序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Java数组转换为Clojure序列数据结构,例如列表或其他序列?

How do I convert a Java array into a Clojure sequence data structure, such as a list, or other sequence?

问题显示了如何进行逆运算; Clojure文档展示了如何创建,变异和读取数组.但是是否有内置的方法可以将它们转换为列表或其他Clojure本机序列?

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?

推荐答案

是的,有一种方法可以将数组转换为列表!代码(seq java-array-here)会将数组转换为实现ISeqArraySeq,因此可以像对待其他Clojure

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.

这篇关于将Java数组转换为Clojure列表或序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆