Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Clojure 中,我可以a..b使用(range a b). 但据我所知,这是一个懒惰的序列。我可以只生成一个数字列表和/或向量a..b吗?
a..b
(range a b)
注意:我是 Clojure 的新手。
你的意思是像
user> (vec (range 2 7)) [2 3 4 5 6] user> (apply list (range 2 7)) (2 3 4 5 6) user> (into [] (range 2 7)) [2 3 4 5 6] user> (into '() (range 2 7)) (6 5 4 3 2) ; <-- note the order user> (into #{} (range 2 7)) #{2 3 4 5 6}