Home > Archive > Prolog > September 2004 > Problem with matching sin(...) etc.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Problem with matching sin(...) etc.
|
|
| Thorsten 2004-09-09, 3:59 pm |
| Hello.
Is there a way to match sin(...) cos(...) etc. at this line:
vereinfacht(T,T) :- atomic(T).
I want to match all atomics and different predicates like
my own pot(x,y) etc. and certainly the arithmetic things
like cos(...) and that.
I can use that:
vereinfacht(T,T) :- atomic(T) | compound(T).
But now was all accepted, all non atomic too... :-(
By the way:
-----------
What is the logical OR?
OR --> |
OR --> ;
???
I can't find this information on different
Prolog-eBooks :-(
Greetings,
Thorsten
| |
| Jens Kilian 2004-09-09, 8:56 pm |
| Thorsten <my@yahoo.com> writes:
> Is there a way to match sin(...) cos(...) etc. at this line:
> vereinfacht(T,T) :- atomic(T).
>
> I want to match all atomics and different predicates like
> my own pot(x,y) etc. and certainly the arithmetic things
> like cos(...) and that.
>
> I can use that:
> vereinfacht(T,T) :- atomic(T) | compound(T).
>
> But now was all accepted, all non atomic too... :-(
Try this:
vereinfacht(T, T) :-
atomic(T)
; member(T, [sin(_), cos(_), ...]).
> By the way:
> -----------
> What is the logical OR?
> OR --> |
> OR --> ;
The standard is ;/2 for logical or; but older dialects had '|' as an alternate
syntax. For portability, always use ;/2.
HTH,
Jens.
|
|
|
|
|