debug: Add procedure debugging tools, lambda-utils: Add new library

This commit is contained in:
2026-07-21 20:35:05 +03:00
parent 21cb73729d
commit f5260cea9c
12 changed files with 259 additions and 9 deletions
+22 -4
View File
@@ -1,9 +1,27 @@
(define print
(lambda args
(map (lambda (item) (display item (current-error-port))) args)))
(define-syntax debug-display
(syntax-rules ()
((_ obj)
(begin
(print "[DEBUG] " 'obj ": " obj #\newline)
obj))))
(define-syntax debug
(syntax-rules ()
((_ obj)
(begin
(display 'obj)
(display ": ")
(write obj)
(newline)
(print "[DEBUG] " 'obj ": " obj #\newline)
obj))))
(define-syntax debug-proc
(syntax-rules ()
((_ proc arg ...)
(begin
(print "[DEBUG] Calling: " 'proc ", arguments: " '(arg ...))
(let ((result (apply proc (list arg ...))))
(print ", returned: " result #\newline)
result)))))