8 ms·
Not really, the C++ macro provides information about which source file the statement was generated from, as well as color coding.
by Ives 7y ago
Not really, the C++ macro provides information about which source file the statement was generated from, as well as color coding.
- kazinator 7y ago1> (defmacro dbg (expr) (with-gensyms (val) ^(let ((,val ,expr)) (format t "~a: ~s -> ~s\n" (source-loc-str ',expr) ',expr ,val) ,val))) dbg 2> (dbg (cons 1 2)) expr-2:1: (cons 1 2) -> (1 . 2) (1 . 2) 3> (dbg (+ 2 2)) expr-3:1: (+ 2 2) -> 4 4 4> (progn (dbg (list 1 2)) (dbg (cons 1 2)) (dbg (+ 1 2))) expr-4:2: (list 1 2) -> (1 2) expr-4:3: (cons 1 2) -> (1 . 2) expr-4:4: (+ 1 2) -> 3 3 Colorization is just inserting some trivial ANSI codes. Arguably, this just slows down the program even more and increases the size of the log files. It can be done as a post-processing filter.