Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Macro-writing challenge

Name: Anonymous 2016-01-16 13:19

Write a macro check-arguments-non-nil to be used in function definitions, that would expand to assertion about every argument being non-nil.
The intended usage of this macro:

(defun foo (a b c d)
(check-arguments-non-nil)
foo-body)


This should expand to:

(defun foo (a b c d)
(assert (and (not (null a)) (not (null b)) (not (null c)) (not (null d)))
(a b c d)
"Null argument in FOO")
foo-body)


The macro must work whatever the number and names of the function parameters.

Name: Anonymous 2016-01-16 15:07

>>5
I never said CL macros weren't unhygienic.

>>6
(defun/+ (anusoidal non-nil) foo (a b c d) foo-body)
; ->
(defun/anusoidal anusoidal-foo (a b c d) foo-body)
(defun/non-nil foo (a b c d) (anusoidal-foo a b c d))
; -> or
(defun foo (a b c d)
(assert-anusoidal a b c d)
(assert-non-nil a b c d)
foo-body)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List