guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Syntactic significance of dot


From: Richard Shann
Subject: Re: Syntactic significance of dot
Date: Tue, 23 Sep 2014 09:49:44 +0100

On Tue, 2014-09-23 at 00:01 +0300, Marko Rauhamaa wrote:
> Richard Shann <address@hidden>:
> 
> > I've come across some (working) scheme code whose meaning I can't
> > unravel. The problem is there is a "." character whose significance
> > eludes me. The guile reference doesn't index this character, and I can
> > only find references to it in writing literal pairs.
> 
> That's what it's for and nothing else, including in your example.
> 
>     (a b . c)
> 
> is equivalent to
> 
>     (a . (b . c))

Thank you for the replies to my email. I see that in the case I cited it
is being used to construct a list - the last element is a list.

This looks like a major omission in the guile documentation, under pairs
http://www.gnu.org/software/guile/manual/html_node/Pairs.html#Pairs
it says:

"Pairs can literally get entered in source code or at the REPL, in the
so-called dotted list syntax. This syntax consists of an opening
parentheses, the first element of the pair, a dot, the second element
and a closing parentheses."

and under lists
http://www.gnu.org/software/guile/manual/html_node/List-Syntax.html#List-Syntax

"The syntax for lists is an opening parentheses, then all the elements
of the list (separated by whitespace) and finally a closing
parentheses."

but the syntax for a list can also be 
...then elements of the list (separated by whitespace) a dot followed by
a list followed by a closing parenthesis"

- this doesn't quite describe using this syntax for improper lists
though.

Anyway, I am thoroughly educated on this topic now :) Thank you both
very much.

Richard









reply via email to

[Prev in Thread] Current Thread [Next in Thread]