users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: variable fonction


From: Lindsey Spratt
Subject: Re: variable fonction
Date: Mon, 24 Mar 2003 08:07:36 -0600


On Monday, March 24, 2003, at 06:24  AM, Gilles Dégottex wrote:

                eval( A(B, C), R) :- A \= /, eval(B,Be), eval(C,Ce), R is A(Be, 
Ce).

GProlog does not support variable functors. You need to use univ ('=..') instead.
You might write this function as:

eval( Term, R) :-
        Term =.. [A, B, C],
        A \= /,
        eval(B, Be),
        eval(C, Ce),
        EvalTerm =.. [A, Be, Ce],
        R is EvalTerm.


Lindsey Spratt
http://homepage.mac.com/lspratt






reply via email to

[Prev in Thread] Current Thread [Next in Thread]