Quantcast
Channel: In Clojure, how to change (def) a variable value inside a function - Stack Overflow
Browsing latest articles
Browse All 4 View Live

Answer by habrewning for In Clojure, how to change (def) a variable value...

With functions this does not work. Functions work this way that when you call them, the arguments are evaluated before entering the function. That means if you call (bla a), the first what happens is...

View Article



Answer by Syl.Stronne for In Clojure, how to change (def) a variable value...

Also if the var in question has been previously def (declared) dynamic you could make it to get, let's say [temporally | keeping immutability] rendered with new values as following:Edit: References for...

View Article

Answer by Anton Chikin for In Clojure, how to change (def) a variable value...

Yes, technically it is possible with the help of alter-var-root function like this=> (defn bla [entry-value] (alter-var-root entry-value (fn [_] "qwe")))=> #'user/bla=> (def a "asd")=>...

View Article

In Clojure, how to change (def) a variable value inside a function

So, I've just started learning Clojure and I'm now facing a problem that I couldn't google myself out of.Here is my code atm:=> (def a "asd")=> a"asd"=> (defn bla [entry_value] (def...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>