replicate is a function that takes an integer and a sequence and returns the sequence repeated n times.
E.g. replicate 3 ["a"]
returns ["a", "a", "a"]
Does Common Lisp have an equivalent function, or do I have to write one?
replicate is a function that takes an integer and a sequence and returns the sequence repeated n times.
E.g. replicate 3 ["a"]
returns ["a", "a", "a"]
Does Common Lisp have an equivalent function, or do I have to write one?
(make-sequence 'list n :initial-element element)
Use make-list
(make-list 3 :initial-element 'a)
It evaluates to
(A A A)
(make-list 3 :initial-element '(a))
? –
Synapsis (make-sequence 'list n :initial-element element)
© 2022 - 2024 — McMap. All rights reserved.