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: Anonymous 2009-07-27 17:26

>>28
Is that some CPS style?!

Here's my inflexible attempt at it, in plain old CL, without call/cc:


(princ
 ((lambda (x)
    (concatenate 'string (mapcan #'list (first x) (second 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))))

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