portray_goal/2

From: josh singer <josh.singer_at_parc-technologies.com>
Date: Mon 23 Jun 2003 01:04:42 PM GMT
Message-ID: <3E899FAFBF56D611B6A500508B9A9DA23427FE@LON-SRV2>
Hi folks, 

I can't get portray_goal/2 to work. It seems to me that the idea of this
goal is to run any applicable portray macro which is visible in the caller
module on the supplied term. 

First I defined this module:

%%%%%%%%%%%%%%%%%% ptest.ecl %%%%%%%%%%%%%%%%

:- module(ptest).

:- export portray(s/1, tr_s/2, []).

:- export tr_s/2.

tr_s(0, 0).

tr_s(s(S), N) :- tr_s(S, N1), N is N1+1.

:- export s/1.

s(0):- !.

s(X):-
	N is X - 1, 
	s(N).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Now I run ECLiPSe 5.6#36, Solaris:

ECLiPSe Constraint Logic Programming System [kernel]
Copyright Imperial College London and ICL
Certain libraries copyright Parc Technologies Ltd
GMP library copyright Free Software Foundation
Version 5.6 #36, Sat Jun  7 00:09 2003
[eclipse 1]:  use_module(ptest).
ptest.ecl  compiled traceable 548 bytes in 0.02 seconds

Yes (0.02s cpu)
[eclipse 2]: portray_goal(s(s(s(0))), X) @ ptest.

X = 3
Yes (0.00s cpu)
[eclipse 3]: portray_goal(s(s(s(0))), X) @ ptest, number(X).

No (0.00s cpu)
[eclipse 4]: 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Goal 2 looks like it is working, but then goal 3 disproves this -- shouldn't
X be a number? It seems that in goal 2 the transformation was just being
applied in the toplevel interpreter.

Or maybe I have misinterpreted what portray_goal/2 is supposed to do...?

cheers, 

josh


Josh Singer
Software Developer, Parc Technologies Limited
Tel. +44 (0)207 261 4067
josh.singer@parc-technologies.com
http://www.parc-technologies.com

This e-mail message is for the sole use of the intended recipient(s)
-its contents are the property of Parc Technologies Limited (or its
licensors) and are confidential. Please do not copy, review, use
(except for the intended purposes), disclose or distribute the e-mail
or its contents (or allow anyone else to do so) without our prior
permission. Parc Technologies Limited does not guarantee that this
e-mail has not been intercepted and amended nor that it is
virus-free. You should carry out your own virus checks before opening
any attachment.  Any opinions expressed in this e-mail message are
those of the author and not necessarily Parc Technologies Limited.
Received on Mon Jun 23 14:06:55 2003

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:23 PM GMT GMT