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 10:52

added to varmacro.h as:
#define validargs(args...) !(sum(apply(zeroargs,args)))

Name: Anonymous 2016-01-23 11:06

>>74
Haskell & Lisp use whitespace as a separator. Why the fuck do you need more punctuation than that? C syntax is just messy and backwards in its goals: Harder to parse, harder for the human to input, harder for the human to read.

When C came out, everybody was railing against the ridiculous semicolons everywhere, because other languages weren't stupid enough to do that. You're just living in an age of Stockholm Syndrome.

Name: Anonymous 2016-01-23 11:19

>>82
H a s k e l l & L i s p u s e w h i t e s p a c e a s a s e p a r a t o r . W h y t h e f u c k d o y o u n e e d m o r e p u n c t u a t i o n t h a n t h a t ? C s y n t a x i s j u s t m e s s y a n d b a c k w a r d s i n i t s g o a l s : H a r d e r t o p a r s e , h a r d e r f o r t h e h u m a n t o i n p u t , h a r d e r f o r t h e h u m a n t o r e a d.

When(C) came.out();
everybody? was:railing; against== the ridiculous semicolons everywhere;
because other languages weren't stupid enough to do that;
You're= just= living( in(an,nage))->of Stockholm Syndrome;

Name: Anonymous 2016-01-23 11:26

>>83
For the first case, I think you mean:

Haskell & Lisp use whitespace as a separator. Why the fuck do you need more punctuation than that? C syntax is just messy and backwards in its goals: Harder to parse, harder for the human to input, harder for the human to read.

Because that's already space-delimited symbols. Like our normal Latin-ish languages. Dumbfuck.

Name: Anonymous 2016-01-23 11:32

>>84
i g u e s s i t s e a s i e r t o r e a d i f y o u h a v e a u t i s m

Name: Anonymous 2016-01-23 11:38

w h o n e e d s a n y t h i n g b e s i d e s w h i t e s p a c e i t s a p e r f e c t l y c r o m u l e n t p u n c t u a t i o n s t y le th a t r e pl a c e s a ll th e s e i ne f f ic i en c e s o f e n gl i sh l a n g u a g e a n d s im p l if i e s s en t en c e s t r u c t u r e t o f o ll o w t h e h as k el l s t a n d ar d

Name: Anonymous 2016-01-23 11:48

y, e, s, c, o, m, m, a, s, l, i, k, e, i, n, C, a, r, e, w, a, y, b, e, t, t, e, r, a, n, d, d, o, n, t, a, d, d, a, n, y, t, h, i, n, g, v, i, s, u, a, l, l, y, s, o, t, h, e, y, d, o, n, t, d, i, s, r, u, p, t, r, e, a, d, i, n, g, a, t, a, l, l, a, n, d, e, v, e, r, y, b, o, d, y, a, l, r, e, a, d, y, u, s, e, s, s, p, a, c, e, s, w, i, t, h, t, h, e, m, s, o, i, t, a, l, l, w, o, r, k, s, o, u, t, i, n, t, h, e, e, n, d, r, i, g, h, t;

Name: Anonymous 2016-01-23 11:54

>>87
C==doesn't(limit){ itself to white-space and comma-only syntax};
It=has !!operators + distinct from ? functions : variables, semicolons;
and {braces.separating_content()}.

Name: Anonymous 2016-01-23 12:01

Why not just use Tcl? It's also a string-based language, but an actual programming language at that.

Name: Anonymous 2016-01-23 12:20

>>89
C preprocessor is simpler and is always present with a C compiler - its part of C standard. TCL could be used as preprocessor( www.drdobbs.com/open-source/c-preprocessing-with-tcl/184410635 ) if you add it as dependency, but extending the preprocessor(_TokenOf()) is more beneficial long-term, since even Tcl is in C.
Any extension in the preprocessor benefits the entire software industry since at the base its layer of C code & C macros(and can be used with Assembler).
There tons of C macros in every large C project, like e.g. Linux kernel. Making them less verbose, less cryptic and complex would actually be useful and orderPP would be useless.

Name: Anonymous 2016-01-23 21:07

>>90
Then as I've said before, just use C to generate C, if the priority is to do metaprogramming only with the standard C toolchain. It's a lot more sane and far less hackish of a setup.

Name: Anonymous 2016-01-24 5:12

>>91
Macros are more elegant and integrate into the code better.
Its like JavaScript that generates the webpage on which its loaded.

Name: Anonymous 2016-01-24 5:24

Its like JavaScript that generates the webpage on which its loaded.
Oh boy.

Name: Anonymous 2016-01-24 8:27

>>93
A better analogy would be PHP embedded in the page, but i don't like PHP.

Name: Anonymous 2016-01-24 20:27

>>74
diverse
Diversity is shit. Homogenous syntax is lightyears ahead of any Blub syntax, it's easier to edit and read and write. You just need to get a real text editor and not some mouse-dragger.

Name: Anonymous 2016-01-24 20:58

real text editor
More like text interpreters for programming text. Editors actually edit text, emacsitors and vimitors require you to execute commands and macros to accomplish tasks.

Name: Anonymous 2016-01-25 9:47

>>95
Not just easier for a human to read & write, but also for the computer. Get that thing to start cranking out code for you so you don't have to. It's a pain in the ass when most other languages require you to build up source code as text blobs.

Name: Anonymous 2016-01-25 20:19

>>95
That's offensive. The correct term is "point-and-drool". You're giving textual text editors a bad name.

Name: Anonymous 2016-01-25 20:26

u just need good mice with 8K dpi and you can click faster than these nerds mistyping lunix commands into their text processors

Name: Anonymous 2016-01-26 2:45

macro expand these dubs

Name: Anonymous 2016-01-26 16:23

>>100
nice

also, just 10 more for some epic trips.

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