[Cst-1b] Mistake in Prolog Notes?

Kevin Chan kkfc2@cam.ac.uk
Wed, 17 May 2000 22:00:45 +0100


Mo

I think the point is that in dot notation the tail needs to be a list of
whatever the head is hence if the head is a list as it is in the example
then the tail must be a list of lists.  In the example the tail is a simple
list and hence it doesn't conform to the rules for a list

That is what I think anyways

Kev






----- Original Message -----
From: M.Y.W.Y.B. <mywyb2@hermes.cam.ac.uk>
To: CST 1b Revision List <cst-1b@srcf.ucam.org>
Sent: Wednesday, May 17, 2000 10:00 PM
Subject: Re: [Cst-1b] Mistake in Prolog Notes?


> --On Mittwoch, 17. Mai 2000, 21:37 +0100 "Nic Infante"
> <ngli2@thor.cam.ac.uk> wrote:
>
> > I think it's not a proper list as the first term [a,b] is a list and
> > the second c (an atom since in lower case) is not. notation, the second
> > term . In the dot notation, (c,[]) would have to be a list of lists,
which
> > it can't be.  [[a,b],C] could be a list since C is a variable and could
be
> > instantiated to a list. Although I've just noticed that he's got
> > [[the,cat],sat] as an example of a list so I'm not sure.
>
> In Prolog list elements needn't have the same type (unlike ML).
>
> So
> [ 3.14, apple, [1], (a,b) ]
> is a proper list.
>
> Therefore if you've got the term .(X,Y), the necessary and sufficient
> condition for it being a proper list is that Y has to be a proper list of
> length >= 0.
> In the example, Y corresponds to .(c,[]) which clearly is a list.
>
> Moritz
>
>
>
> _______________________________________________
> CST-1B mailing list
> CST-1B@srcf.ucam.org
> http://www.srcf.ucam.org/mailman/listinfo/cst-1b
>