跳轉到內容

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"
華夏公益教科書