Hello Clojurians, I have a question on best practice for populating an array with a sequence of numbers.
This is not a seq structure. I'm referring to a mathematical sequence, e.g., 1, 2, 3, 4, 5, 6, 7, ..., n
My background is in statistical programming, so generating lists of numbers is suprisingly common, and useful!
In the R language, to produce an array of numbers you would do:
seq(1, 10) => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Or shorthand:
1:10 => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
Either of these are considered idiomatic as they are readable and fast.
Assigning the array to a variable would then be:
nums = seq(1, 10)
nums => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
What is the Clojure way of doing this?
Unfortunately I am having trouble searching the web for a solution as, inevitably, any search including "sequence" brings one to https://clojuredocs.org/clojure.core/seq.