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

Useful feature for next version of C

Name: Anonymous 2009-07-26 20:31

A ->= operator, and possibly .=, which would make it easier to go through linked lists and other such structures with lots of pointers. Instead of writing

p = p -> next;

it can now be

p ->= next;

or, if you're working with binary trees, instead of


while(t && t->v != i)
 if(t->v < i)
  t = t -> l;
 else
  t = t -> r;


it becomes


while(t && t->v != i)
 t ->= (t->v < i) ? l : r;


I'm working on a C-like compiler and I thought this would be a good idea.

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !frozEn/KIg 2009-07-28 17:45

I use macros within macros. It helps reduce clutter and can be manipulated easily. e.g.
#define MAXBUF 1000
#define NMAX MAXBUF*8


_________________________________________
http://xs135.xs.to/xs135/09042/av922.jpg
Velox Et Astrum gamedev forum: http://etastrum.phpbb3now.com
We've arranged a civilization in which most crucial elements profoundly depend on science and technology. We have also arranged things so that almost no one understands science and technology. This is a prescription for disaster. We might get away with it for awhile, but sooner or later this combustible mixture of ignorance and power is going to blow up in our faces.

Name: Anonymous 2009-07-28 18:25

>>41
* sees what FV calls macros
* throws up

Name: Anonymous 2009-07-28 18:39

>>42
I don't think it has to have parameters to be called a macro, dude. The throwing up and the confusion are normal reactions to prolonged FV exposure, though.

Name: Anonymous 2009-07-28 23:22

>>39
Name one.

Name: Anonymous 2009-07-28 23:23

Common Lisp

Name: Anonymous 2009-07-28 23:49

>>1

Or you could, you know, write out a few more letters and make it not look retarded as hell?

Also, who unbanned Frozenvoid?

Name: Anonymous 2009-07-29 0:17

>>29

(princ
 ((lambda (x)
    (concatenate 'string (multiple-value-call #'mapcan #'list (values-list x))))
  '((#\H #\v #\  #\o #\   #\e #\d #\y #\u #\   #\i #\p #\t #\d #\y #\?)
    (#\a #\e #\y #\u #\r  #\a #\  #\o #\r #\s  #\c #\  #\o #\a #\  #\newline))))

Made it more generic, m-v-c + values-list now let us have a variable list of arguments to mapcan/mapcar.
OT: m-v-c is how APPLY is actually implemented on some implementations, such a lovely special operator.

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