squint 2025-03-18

Hey y'all! I was wondering if it's possible to make variables defined in let blocks mutable? I'm currently using this little workaround but I'm hoping there's a better way

(let [data {:drawdata []
             :linenum 0
             :workinglen 500}        
       lineheight 20]
   (set! (.-linenum data) 1))

By design they are not mutable, this is against Clojure's design. If you need mutability, you can indeed use a mutable object, or an atom

Makes sense. Wasn't sure if there was a reader macro or something. Thank you!

👍 1

Glad to help. If you're making something cool with squint, please share :)