squint

2024-06-14T17:39:40.442129Z

anybody got simple debug macros? like one that prints a form and its value? something more fun than raw js/console.log

borkdude 2024-06-14T18:14:48.068259Z

(defmacro inspect [form]
  (list 'js/console.log (list 'quote (pr-str form)) :-> form))

2024-06-27T09:50:32.010829Z

This has evolved to

(defmacro i [form]
    `(let [~'result ~form]
       (js/console.log ~(pr-str form) :-> ~'result)
       ~'result))
used like (um/i (identity {:tag "good-one"}))

borkdude 2024-06-27T09:51:02.190279Z

yeah :)

2024-06-27T09:55:12.491739Z

it's already a big improvement over raw javascript

2024-06-16T12:09:37.270719Z

gotcha

2024-06-15T12:07:37.774049Z

nice! Thank you.

borkdude 2024-06-15T16:51:27.051289Z

btw it's better to let- bind the form so it will only be evaluated once, then print it and then return the result, but you can probably figure this out