Re: [eclipse-clp-users] List of Terms to Term

From: Kish Shen <kisshen_at_...5...>
Date: Tue, 23 Feb 2010 18:41:26 +0000
Christian Wirth wrote:
> Kish Shen schrieb:
>> Christian Wirth wrote:
>>
>>> i want to convert a list of terms into a term:
>>>
>> I am not clear what you mean by this: a list of terms *is* a term itself.
> Not every list, only when its correctly nested. I simply have a list 
> where each element is a term: [pred(A,B),pred2(A,C),pred3(B,C)] is not a 
> correct term, but a list of terms (, is the element seperation symbol, 
> not the AND symbol)
> 

There seem to be some misunderstanding here. Are you under the 
impression that a list is not a term? This is not correct. In fact, any 
valid Prolog data structure is a term, so, I repeat, a list of terms is 
by definition a term itself. Do you by any chance mean a structure 
rather than a term? Even in this case, list are actually structures -- 
nested ./2 structures, but because they occur so often, Prolog provide 
special syntax that lets you write them more easily. This is discussed 
in any introductory Prolog textbook.


> The problem i have is, i need to call \+(\+(List)) .. but i get an 
> error:  type error in existing_file([d_role(Player, state), 'd_++'(_403, 
> _478, state), 'd_++'(_403, _478, state), d_cell(_402, _478, state)], 
> [".eco", "", ".ecl", ".pl"], [readable], _786)
>

\+ \+ (List) does not make sense -- the argument of \+/1 should be a 
goal, not any data structure. In this case, your list is being treated 
as a list of files to be compiled.

Cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.
Received on Tue Feb 23 2010 - 18:41:33 CET

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST