Re: call, ..= operator, records (newbie)
- From: "levilista@xxxxxxxxx" <levilista@xxxxxxxxx>
- Date: Wed, 21 May 2008 07:13:57 -0700 (PDT)
On May 21, 4:04 pm, Martin Riener <e9927...@xxxxxxxxxxxxxxxxxxxx>
wrote:
levili...@xxxxxxxxx wrote:
I define a 'toy predicate' plus:
plus(X,Y):- Y is X+1.
Then I try the following:
24 ?- F=plus,F(2,X).
ERROR: Syntax error: Operator expected
ERROR: F=plus,F(2,X
ERROR: ** here **
ERROR: ) .
Why do I get an error here?
I know it can be solved with the introduction of a new variable (see
below) , but I'm just curious why.
26 ?- F=plus,X=..[F,2,Z], call(X).
F = plus,
X = plus(2, 3),
Z = 3.
:- X=..[plus,2,Y], X.
works for me too (swi)... as for why higher order predicates have to be
explicit, i am too unaware of the context of the
creation/standardisation of the language. i guess that seperate
atom/function/predicate spaces play a role in this, but perhaps some of
the prolog implementors on the list could help us out?
greetings Martin
Thanks.
.
- References:
- call, ..= operator, records (newbie)
- From: levilista@xxxxxxxxx
- Re: call, ..= operator, records (newbie)
- From: Martin Riener
- call, ..= operator, records (newbie)
- Prev by Date: Re: call, ..= operator, records (newbie)
- Next by Date: Re: In which cases/problems is Prolog faster than Java?
- Previous by thread: Re: call, ..= operator, records (newbie)
- Next by thread: Visual Prolog Application and Language Conference 2008 in Saint Petersburg
- Index(es):
Relevant Pages
|
|