[Date Prev] [Date Next] [Thread Prev] [Thread Next] Date Index Thread Index Search archive:
Date:Mon Jan 22 01:56:16 1998 
Subject:Re: member(mars, [a mars bar]) => -- Help!! 
From:Aaron Sloman See text for reply address 
Volume-ID:980122.01 

[Delayed response because of problems with Birmingham news machine.]

David FitzGerald <d.p.fitzgerald-csai97@cs.bham.ac.uk> writes:

> Date: Sat, 17 Jan 1998 17:19:46 +0000
> Organization: School of Computer Science, The University of Birmingham, U.K.
>
> member(mars, [a mars bar]) =>
>
> This returns false, as you would imagine.
>
> However, does anyone know if it is possible to get "member" or another
> operator to display true for this.
>
> I am trying to get POP11 to asert whether or not a word is in a list or
> not - but it is much more difficult that I thought it would be.

[a mars bar] is a list of words, as you clearly realise.

However
    member(mars, [a mars bar])

checks whether the value of the Pop-11 variable "mars" is in the
list. (Didn't you get a "Declaring variable" warning message?)

What was the value of the variable supposed to be?

If you didn't want to use the value of the variable, but wanted to
check whether the word "mars" is in the list, then you have to quote
the word

    member("mars", [a mars bar]) =>
    ** <true>

In Pop-11, unlike most list processing languages, list brackets
automatically quote words, whereas outside the list expression you
have to use explicit quotation. In the list expression you can turn
off quotation using "^", or "%". See TEACH LISTS

Aaron
-- 
Aaron Sloman, ( http://www.cs.bham.ac.uk/~axs/ )
School of Computer Science, The University of Birmingham, B15 2TT, UK
EMAIL A.Sloman at cs.bham.ac . uk
Phone: +44-121-414-4775 (Sec 3711)       Fax:   +44-121-414-4281