Rudolf Adamkovič Personal site


My log macro

(λ log [sexp ?depth]
  "Print the SEXP and its value to DEPTH, then return it."
  (let [depth (+ (or ?depth 0) 2)
        sexp-view (view sexp)]
    `(let [view# (require :fennel-view)
           value# ,sexp
           value-view# (view# value# {:depth ,depth})]
       (print (if (= ,sexp-view value-view#)
                  (string.format "DEBUG: %s" ,sexp-view)
                  (string.format "DEBUG: %s: %s" ,sexp-view value-view#)))
       value#)))

© 2025 Rudolf Adamkovič under GNU General Public License version 3.
Made with Emacs and secret alien technologies of yesteryear.