🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.prolog
Article #2797

Re: list syntax

#2797
From: Micha Meier
Date: Mon, 05 Oct 1987 08:35
29 lines
2054 bytes
In article <2278@mulga.oz> lee@mulga.UUCP (Lee Naish) writes:
>
>	H.T is more readable
>	H.T says the functor is '.' and there are two arguments, H and T
>	H.T is one less character
>	H.T doesn't use 'funny' characters used for letters in Europe
>	H.T is not a syntactic special case (well,.. less so)
>
I definitely agree that the dot notation is more readable for pairs, however
if we adopt it, what is 1.2? If it is a pair, how do we write the real number?
If it is the real, the pair has to be written like '.'(1, 2) which is not
very nice, either. In any case the parser has to care much more what
to do with the dot (pair, real number, fullstop, part of another identifier,
solve conflicts like 1.2.3) so it IS a special syntactic case.

  As far as lists are concerned, I find [1, 2, 3] more readable than 1.2.3.[];
when teaching how this all works it is useful to see the nil at the end,
however when writing programs, the nil is just an end-marker and I prefer
not to see it at all.
  Another disadvantage of the dor notation is that H.T is an operator
and one has to care about its precedence.  When I see [a++b, c++d]
I know what it means, whereas a++b.c++d.[] needs the parentheses.

  For the use with functor/3 and =../2 the pair has to have a functor
and in many systems it is the dot so that when it is declared as an operator,
the dot notation works, which is a sort of compromise for those who want
to use it. Why it isn't defined in BSI what the functor of a pair is?

--Micha
Technical Details
Message-ID: <438@ecrcvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!unido!ecrcvax!micha
References: <5265@jade.BERKELEY.EDU> <2278@mulga.oz>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!mcvax!unido!ecrcvax!micha
From: micha@ecrcvax.UUCP (Micha Meier)
Newsgroups: comp.lang.prolog
Subject: Re: list syntax
Message-ID: <438@ecrcvax.UUCP>
Date: Mon, 5-Oct-87 04:35:34 EDT
Article-I.D.: ecrcvax.438
Posted: Mon Oct  5 04:35:34 1987
Date-Received: Fri, 9-Oct-87 02:26:21 EDT
References: <5265@jade.BERKELEY.EDU> <2278@mulga.oz>
Reply-To: micha@ecrcvax.UUCP (Micha Meier)
Organization: ECRC, Munich 81, West Germany
Lines: 29