[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What?
In article <3D57A1E1.A5C24DD0@lucent.com>,
Gabor Greif <ggreif@lucent.com> wrote:
> Rainer Joswig wrote:
> > > A, IMHO, much better iteration package is
> > ITERATE from Jonathan Amsterdam. The above code
> > then looks:
> >
> > (defmethod read-lines ((stream stream))
> > (iter (for line = (read-line stream nil nil))
> > (while line)
> > (collect line)))
> >
> > Hehe.
> >
> > http://www-2.cs.cmu.edu/afs/cs/project/ai-repository/ai/lang/lisp/code/it
> > er/iterate/0.html
>
>
> Well, I cannot help, but this very much reminds me of infix syntax :-)
>
> The usage of punctuation always counted as the distinguishing feature of
> infix syntax.
Hmm, why do you think Lisp's (or in prefix Dylan years ago) usage of
"prefix" syntax needs to be primitive? In reality prefix is more
complex and infix is not really infix.
There are quite a few diffent ways how Lisp uses "syntax".
- some examples of data type syntax:
Symbols foo, foo\A, |foo|
Numbers 1 1.0 #c(2 3) 1/3
Strings "hhhh"
Arrays #(a b c)
Comments ; #| |#
Pairs ( . )
and many more
- symbol naming conventions
*var*, +const+ , predicate-p , setf
- function calls:
(foo 3 :bar 4 :baz 5)
- keyword value pairs
(defclass foo ()
((slot :accessor foo-slot :type number)))
- lambda lists
(lambda (a b &key bar (baz 3))
(list a b bar baz))
- scope/bindings
(labels ((foo (a b &key bar (baz 3))
(list a b bar baz)))
(foo 3 :bar 4 :baz 3))
- clauses
(cond ((numberp a) a)
((stringp a) (parse-integer a))
(t (error)))
- Patterns
(destructuring-bind (a (b . c)) foo
(list a b c))
- embedded languages
(loop for i from 3 below 10 count (oddp i))
and more...
The good thing is that each "expression" and "sub-expression"
has surrounding parentheses.
Thus it is easily identifieable and it has something on the screen
that stands for the expression (very important!).
Example:
1 + 2 <- what can I "touch" here with a cursor to mean the whole
expression without ambiguity? I have to "select" the
whole expression.
(1 + 2) <- here I can click on the parentheses and I can manipulate
the whole expression. The expression has a grouping and
a visual "handle".
I can understand that Dylan does no longer follow above ideas and tries
to be compatible with the mainstream. I also can understand that
maintaining
two (or more) surface syntaxes would not be a really practicable idea.
I also understand that one might not want to switch syntax again.
But the Lisp syntax has its merits and it has several usage types (see
above).
- Follow-Ups:
- Re: What?
- From: Gabor Greif <ggreif@lucent.com>
- Re: What?
- From: Bruce Hoult <bruce@hoult.org>
- References:
- What?
- Re: What?
- From: "Jason Trenouth" <jason.trenouth@bigfoot.com>
- Re: What?
- From: Rainer Joswig <joswig@lispmachine.de>
- Re: What?
- From: Andreas Bogk <andreas@andreas.org>
- Re: What?
- From: Bruce Hoult <bruce@hoult.org>
- Re: What?
- From: Rainer Joswig <joswig@lispmachine.de>
- Re: What?
- From: Gabor Greif <ggreif@lucent.com>