For Programmers: Free Programming Magazines  


Home > Archive > Prolog > December 2004 > documentation on the caret









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 documentation on the caret
Marco Scoffier

2004-12-20, 3:56 am


can someone point me to somewhere online which describes how the caret
works in :

v(e,1,X^go(X)) --> [went].

I found this usage here:
http://courses.essex.ac.uk/lg/LG619/mt/index_0.html#32

It looks like I am getting extra "slots" without changing the "footprint"
of my rule and this is what I want (I am not using the correct words I
know).

Unfortunately google-ing for the '^' or 'prolog caret' does not work very
well.

Thank you for your help,

--
Marco
Jens Kilian

2004-12-20, 3:58 pm

Marco Scoffier <marco@metm.org> writes:
> can someone point me to somewhere online which describes how the caret
> works in :
>
> v(e,1,X^go(X)) --> [went].


It's an operator. It doesn't *do* anything - your grammar rule just happens
to have as third parameter a compound term whose functor is '^'/2. You could
have written either of the following with essentially the same effect:

v(e, 1, X-go(X)) --> [went].
v(e, 1, foo(X, go(X))) --> [went].

IIRC, only bagof/3 and setof/3 treat '^'/2 specially - there it acts as an
existential quantifier.

HTH,
Jens.
--
mailto:jjk@acm.org As the air to a bird, or the sea to a fish,
http://www.bawue.de/~jjk/ so is contempt to the contemptible. [Blake]
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com