[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What?
Am Sonntag den, 11. August 2002, um 13:15, schrieb Rainer Joswig:
In article <000f01c24120$53941dd0$9c8bfd3e@wilde>,
"Jason Trenouth" <jason.trenouth@bigfoot.com> wrote:
----- Original Message -----
From: "mw" <nsp4@mac.com>
To: <info-dylan@ai.mit.edu>
Sent: Sunday, August 11, 2002 2:45 AM
Subject: What?
What is this language? I have never heard of it before.
One reductionist breakdown might be:
Dylan = Scheme + CLOS + Smalltalk + Pascal
Scheme for basic semantics.
What is that exactly? Lisp1, tail-recursion, "?" naming convention for
predicates. What else?
No special function bindings, i.e. literal lambdas. "!" for mutating operations,
but not always. "-setter" is also indicating mutation.
Common Lisp Object System (CLOS) for the object system, and exception
handling.
What about: parameter list , keywords, numerics, setters,
multiple values, lots of the library functions, ... ?
Looks a lot like Common Lisp to me.
The numeric tower is scheme-like. But you are right. Many concepts come from CL.
Must be the influence of the inventors :-)
<..>
To see how near to CL this is:
// Example: summing a stream of integers
define method sum-stream ( stream )
let sum = 0;
let n = #f;
while ( n := read-line( stream, on-end-of-stream: #f ) )
sum := sum + string-to-integer( n );
end;
sum
end;
(defmethod sum-stream ((stream stream))
(loop for line = (read-line stream nil nil)
while line sum (parse-integer line)))
// Example 3: more functional
define method read-lines ( stream )
let collection = make( <stretchy-vector> );
let line = #f;
while ( line := read-line( stream, on-end-of-stream: #f ) )
add!( collection, line );
end;
collection
end;
define method sum-stream ( stream )
reduce( \+, map( string-to-integer, read-lines( stream ) ) )
end;
(defmethod read-lines ((stream stream))
(loop for line = (read-line stream nil nil)
while line collect line))
Something like this would be interesting:
define method read-lines ( stream )
choose-until(identity, lazy-sequence(curry(read-line, stream, on-end-of-stream: #f )))
end;
With appropriate definitions of choose-until and lazy-sequence.
(defmethod sum-stream ((stream stream))
(reduce #'+ (read-lines stream) :key #'parse-integer))
Let's check it out:
Welcome to Macintosh Common Lisp Version 4.something-i-won't-tell-you!
;-) [guess: MacOS X Mach-O, command-line]
? (with-input-from-string (stream
"1
2
3
4")
(sum-stream stream))
10
Hehe, I hear the Gwydion Dylan people are adding more Lisp stuff
to Dylan.
Actually it is an interactive listener/interpreter similar to the AppleDylan and Fun-O listeners.
It is in an embryonal state right now. We intend it to be invocable from the macro expander too.
We do not plan to adapt the CL(ish) syntax.
Greetings to Hamburg,
Gabor
Rainer Joswig
- References:
- Re: What?
- From: Rainer Joswig <joswig@lispmachine.de>