Thanks for all your reply. I'll look them up.
is there any way to generate dynamic args for for
(for [a1 [1 2 3]
a2 [1 2 3]]
;;do sth
)
to
(for [a1 [1 2 3]
a2 [1 2 3]
...
an [1 2 3]
]
;;do sth
)
for can be built by using map and mapcat
(for [x xs] e)
=> (map (fn [x] e) es)
(for [x xs y ys] e)
=> (mapcat (fn [x] (map (fn [y] e) ys)) xs)
Etc
You could write a macro that generates a for
expression with a different number of bindings determined at compile time, but instead you might want to consider a function that generates the cross product of its input sequences.
For example, the cartesian-product
function in the math.combinatorics
library mentioned in the library's README here: https://github.com/clojure/math.combinatorics
@andy.fingerhut thanks for your help
• I want to learn Clojure, where is a good tutorial
Living Clojure is a great book -- your local library might have some clojure books or you could request your local library to get some ^.^
Thanks everyone
try "resources" from https://www.reddit.com/r/Clojure/
There are lots of free resources (some commercial ones too) https://clojure.org/community/resources If you like learning fromvideo, take a look at https://practical.li/ (there are free books too)
101 videos on clojure is enough for getting job ?
Creating all those videos helped me get my current job, I cannot guarantee if it would get anyone else a job :)
If a person can do the first 60 or so challenges on http://4clojure.com and come up with some nice answers for the Clojure track on http://Exercism.io, that would certainly help give a very good grounding in the core Clojure language. Then it just depends on what other esoteric requirements a company as part of their hiring process
@imxingquan https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f