Skip to content

Instantly share code, notes, and snippets.

@trepca
Last active December 12, 2023 06:31
Show Gist options
  • Save trepca/f5aa4c1ec32486e6a6a979d3a352e8ac to your computer and use it in GitHub Desktop.
Save trepca/f5aa4c1ec32486e6a6a979d3a352e8ac to your computer and use it in GitHub Desktop.
Chialisp assert macro for debugging by @prozacchiwawa
(mod (N)
(include *standard-cl-23*)
(defun assert_ (items)
(if (r items)
(qq (if (unquote (f items)) (unquote (assert_ (r items))) (x (unquote (c 1 (f items))))))
(f items)
)
)
(defmac assert items (assert_ items))
(assert (> 50 N) (> N 20) (logand N 1) N)
)
@trepca
Copy link
Author

trepca commented Dec 12, 2023

It will show you exactly which condition in assert fails, super useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment