Skip to content

Instantly share code, notes, and snippets.

@rzezeski
Last active December 21, 2015 01:29
Show Gist options
  • Save rzezeski/6227738 to your computer and use it in GitHub Desktop.
Save rzezeski/6227738 to your computer and use it in GitHub Desktop.
:- op(250,xfx,:).
initial(1).
final(1).
arc(1,1,a:b).
transduce1(Node,[],[]) :-
final(Node).
transduce1(Node1,Tape1,Tape2) :-
arc(Node1,Node2,Label),
traverse1(Label,Tape1,NewTape1,Tape2,NewTape2),
transduce1(Node2,NewTape1,NewTape2).
traverse1(L1:L2,[L1|RestTape1],RestTape1,[L2|RestTape2],RestTape2).
testtrans1(Tape1,Tape2) :-
initial(Node),
transduce1(Node,Tape1,Tape2).
%% testtrans1([a,a], X).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment