I find myself using
def in the middle of functions for exploring what is happening inside them, or what inputs they get. Here’s a somewhat (but not fully) contrieved example. I am trying to hook a React Native project on
re-frame, and I have never used re-frame before. To learn what arguments are sent to the events, I use
def to be able to use the REPL inside my editor to explore the inputs. The classic example is increasing a click-counter and this is my
It works, but before it worked I had to figure things out and instrumented the function like so:
Then, after clicking my Click me button. I could evaluate the forms and learn about what I was dealing with, like so:
As a beginner in Clojure land, I wonder if this is a ”dirty” way to do it and if I can expect problems doing things like this. It almost feels too easy, and I am trained by life to suspect too easy means I have to pay later in some way.