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 15:14

(let ((C call-with-current-continuation))
  (apply (lambda (x y) (x y))
         (map ((lambda (r) ((C C) (lambda (s)
                                    (r (lambda l (apply (s s) l))))))
               (lambda (f) (lambda (l)
                             (if (null? l)
                                 C
                                 (lambda (k) (display (car l)) ((f (cdr l))
                                                                (C k)))))))
              '((#\H #\v #\space #\o #\space #\e #\d #\y #\u #\space #\i #\p #\t #\d #\y #\?)
                (#\a #\e #\y #\u #\r #\a #\space #\o #\r #\s #\c #\space #\o #\a #\space #\newline)))))

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