replicate

clojure.core

  • (replicate n x)
DEPRECATED: Use 'repeat' instead.
Returns a lazy seq of n xs.

1 Example top

  • user=> (apply str (replicate 7 \space))
           ; 7 spaces
    
    user=> (replicate 7 (rand-int 10))
    (3 3 3 3 3 3 3) ; the same number
Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/core.clj:2585 top

(defn replicate
  "DEPRECATED: Use 'repeat' instead.
   Returns a lazy seq of n xs."
  {:added "1.0"
   :deprecated "1.3"}
  [n x] (take n (repeat x)))
Vars in clojure.core/replicate:
Used in 0 other vars

Comments top

No comments for replicate. Log in to add a comment.