Why do people prefer list comprehensions like
(for [x '(1 2 3)] (* 2 x)) instead of (map #(* %1 2) '(1 2 3))?
Are there benefits to this kind of programming?
1. Is it more readable?
2. Is it faster in some cases?
3. Is it better for certain kinds of operations and data structures?
For your given example, there are no benefits; but in general,
foris useful when you’re joining two (or more) sequences, or when you need to do some filtering – aforwith:letand:whenis usually more readable than a chain of nestedmapandfilter.