Why doesnt Clojure execute this function at all? -
I'm called a function that displays a dialogue with the message. I need to mute this function in all the items in goodbye but Closer does not show me any message what am I doing?
(defn show [message] (.javax.swing.JOptionPane (showMessageDialog nil message)) (defn action [] (map show '(Hello sweet love)))
The map function does not actually run the mapp function on every memeber of the collection.
Rather it returns a 'lazy-opposition' cell. It looks like its classic single link with a very significant difference, the data in each cell is defined when it did not define it (This result is definitely stored then reads later). So to run the function actually you have to read the result of running the function. Because in this case you do not care only about the results of the function, which is run by the closure.
(Door ... insert your map here ....) / code>
This will create the map, read the results and immediately remove them to destroy them with the accumulation of memory later.
If you map the functions with such functions where you want to keep, use doseq instead.
Comments
Post a Comment