The map function does not actually run the displayed function for each member of the collection. rather, it returns the "lazy" cell. this is very similar to your classic single-level list with one very important difference, the data in each cell is calculated at a time when it is not being read at the time of its determination (this result, of course, is preserved for subsequent readings). Therefore, to run a function, you must read the result of the function launch. Since in this case you do not care about the results of the function only in that it ran clojure, it provides an excellent wrapper function called
(dorun .... insert your map here .... )
who will create a map, read the results and immediately throw them away, losing memory, saving them later.
If you use a mapping function to the results that you want to keep, use the dose instead.
Arthur ulfeldt
source share