跳转到内容

Clojure 编程/示例/API 示例/序列运算符

来自维基教科书,开放的书籍,开放的世界

interpose

[编辑 | 编辑源代码]
user=> (apply str (interpose "|" ["hi" "mum" "and" "dad"]))
"hi|mum|and|dad"

interleave

[编辑 | 编辑源代码]
user=> (interleave [1 2 3] [:a :b :c])
(1 :a 2 :b 3 :c)
user=> (apply str (interpose " " (reverse (.split "I am cold" " "))))
"cold am I"
user=> (butlast "hello")
(\h \e \l \l)
(apply str (replace {\l ""} "hello world"))
=> "heo word"
华夏公益教科书