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-23 8:38

>>73
C provides visual cues, diverse syntax that you could decode with minimal knowledge. These commas/braces/semicolons that Lisp/Haskell enthusiasts hate separate content visually an semantically: they help to segment the code into distinctive small chunks vs seas of parens(Lisp) or long streams or words with operators(Haskell).
The above means Lisp/Haskell produce write-only code, that normal people don't bother deciphering. If you have autism though and see patterns everywhere, its not a problem to read it - though you will never convince people its readable because it "works for you".

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