josh singer wrote: > > Okay, I suspected as much. Is there any builtin way to run general portrays > without writing them to a stream? > If not, this might be quite handy in future. Not builtin, but it's basically like this: :- tool(portray_term/2, portray_term/3). portray_term(Term, Portrayed, ContextModule) :- ( % find applicable transfrmation functor(Term, N, A), once ( current_macro(N/A, TN/TA, Options, DefMod)@ContextModule, memberchk(write, Options), nonmember(goal, Options), nonmember(clause, Options) ), functor(TransGoal, TN, TA), arg(1, TransGoal, Term), arg(2, TransGoal, TopPortrayed), ( TA > 2 -> arg(3, TransGoal, ContextModule) ; true ), % call toplevel transformation DefMod:TransGoal@ContextModule -> true ; TopPortrayed = Term ), % then transform arguments functor(TopPortrayed, PN, PA), functor(Portrayed, PN, PA), ( for(I,1,PA), param(TopPortrayed,Portrayed,ContextModule) do arg(I, TopPortrayed, Arg), arg(I, Portrayed, PortrayedArg), portray_term(Arg, PortrayedArg, ContextModule) ). portray_term(Term, Term, _). -- Joachim Schimpf / phone: +44 20 7594 8187 IC-Parc / mailto:J.Schimpf@imperial.ac.uk Imperial College London / http://www.icparc.ic.ac.uk/eclipseReceived on Mon Jun 23 16:58:29 2003
This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:08:23 PM GMT GMT