I have a really really huge hash table and whenever I try to alter the hash, the entire hash is returned, which crashes my REPL. Is there a way I can ask Clojure to just set the value and return nil?
Thank You.
I have a really really huge hash table and whenever I try to alter the hash, the entire hash is returned, which crashes my REPL. Is there a way I can ask Clojure to just set the value and return nil?
Thank You.
No. Clojures data types are immutable. Also they use shared structure so actually creating a new value is very very cheap for memory and performance. There are options to increase the memory available to the JVM like java -server. Also you can create Java objects which are mutable if you really need them.
dorun
always returns nil
:
(dorun (alter ...))
If all you want is to prevent the REPL from printing huge data structures, use *print-level*
or *print-length*
.
user> (set! *print-level* 2)
2
user> {:foo {:bar {:baz {:quux 1}}}}
{:foo {:bar #}}
user> (set! *print-length* 2)
2
user> (range 100)
(0 1 ...)