next up previous contents
Next: 3.2.5 Deanonymization Up: 3.2 The bastron transformers Previous: 3.2.3 Flattering

3.2.4 Tuple- and cons-passivating

 

Tuple- and cons-passivating (command: passtup) replaces active, parenthesized tup and cns calls containing only constants, variables, and structures/lists by passive, bracketed tup structures, i.e. lists, and cns structures, respectively.

For example, the tup and cns expressions in

list3(E) :- & tup(E,E,E).
cons2(E) :- & cns(E,E).
contain variables only, and thus are tup- and cns-passivated to structures as, respectively, in
list3(E) :- & [E,E,E].                  % [E,E,E] shortens tup[E,E,E]
cons2(E) :- & cns[E,E].

Sample dialog (only after flatten becomes second tup passive):

rfi-p> az listn([],_) :- & tup().               % [] for 0
rfi-p> az listn([L],E) :- & tup(E|listn(L,E)).  % [L] for n+1
rfi-p> passtup
rfi-p> listing
listn([],_) :- & [].
listn([L],E) :- & tup(E|listn(L,E)).
rfi-p> flatten
rfi-p> listing
listn([],_) :- & [].
listn([L],E) :- _1 is listn(L,E) & tup(E|_1).
rfi-p> passtup
rfi-p> listing
listn([],_) :- & [].
listn([L],E) :- _1 is listn(L,E) & [E|_1].



Harold Boley (boley@informatik.uni-kl.de)