Last modified on 15 June 2009, at 03:12

Clojure Programming/Examples/API Examples/Sequence Operators

interposeEdit

user=> (apply str (interpose "|" ["hi" "mum" "and" "dad"]))
"hi|mum|and|dad"

interleaveEdit

user=> (interleave [1 2 3] [:a :b :c])
(1 :a 2 :b 3 :c)

reverseEdit

user=> (apply str (interpose " " (reverse (.split "I am cold" " "))))
"cold am I"

butlastEdit

user=> (butlast "hello")
(\h \e \l \l)

replaceEdit

(apply str (replace {\l ""} "hello world"))
=> "heo word"