[Prev][Next][Index][Thread]
Re: C# is not Dylan (was: Re: C# : The new language from M$)
"Michael T. Richter" <mtr@ottawa.com> writes:
> > i admit that the boilerplate mishmash of parens, braces and
> > semicolons can help a human find their way, e.g., i think C's for
> > (;;){} is easier than lisp's (do ()()()).
>
> Yes. Finally I've met someone in the Lisp camp who recognizes this
> feature.
Speaking of loops, I have started using Common Lisp for some of my
programs instead of Scheme because of its standardization of important
things like packages, but one thing I really miss from Scheme is the
"named let" syntax for function calls. I think this syntax beats both
Common Lisp's `do' and `labels', as well as C's `for (;;) {}'
construction, in terms of terseness and clarity. I suppose it
wouldn't be hard to write a `letf' macro or something, though.
If you haven't seen the Scheme "named let" before, it looks like:
(define (remove p l)
(let remove ((l l)
(result '()))
(cond ((null? l) result)
((eqv? p (car l)) (remove (cdr l) result))
(else (remove (cdr l) (cons (car l) result))))))
which is equivalent to
(define (remove p l)
(letrec ((remove
(lambda (l result)
(cond ((null? l) result)
((eqv? p (car l)) (remove (cdr l) result))
(else (remove (cdr l) (cons (car l) result)))))))
(remove l '())))
and the Common Lisp construction:
(defun remove (p l)
(labels ((remove (l result)
(cond ((null l) result)
((eql p (car l)) (remove (cdr l) result))
(t
(remove (cdr l) (cons (car l) result))))))
(remove l '())))
Follow-Ups:
References: