James G. Sack (jim) wrote:
What about
(1 . 2 3)
maybe: [1, [2, [3,nil]]] .. (there it is again!)
No. (1 . 2 3) is "Not valid".
DOT indicates a pure pair. It must have exactly one sexpr on the left
and exactly one sexpr on the right.
Although, to be fair, there is no particularly good reason why (1 . 2 3)
is not [1, [2, [3, nil]]]. One can make arguments that it is redundant,
ambiguous, etc., but I seriously doubt that anyone has really thought
that far out.
For variety,
given: [[[1, 2], 3], nil]
what was the source?
(((1 . 2) . 3) . ())
or
(((1 . 2) . 3))
So a dumb question:
what _is_ the dot?
(Confession: I've been cutting class, so if it's in the readings, I
apologize -- just dock me)
It's a marker (or perhaps substitution) for a pair.
(1 . 2) === (cons 1 2)
I believe the only mention in SICP is in passing in an exercise. The
reason it comes up is that you define functions with the ability to take
arbitrary numbers of arguments with a "."
For example:
> (define c (lambda (d . e) e))
> (c 1 2 3)
(2 3)
-a
--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg