% start :- display([1,2,3,...,30],
%          nl(
%          nrev([1,2,3,...,30],Rev,
%          display(Rev,
%          nl(
%          halt
% )))))

predicate(start/0
	put_structure '.'/2 2
	unify_constant 30
	unify_constant '[]'
	put_structure '.'/2 3
	unify_constant 29
	unify_value 2
	put_structure '.'/2 2
	unify_constant 28
	unify_value 3
	put_structure '.'/2 3
	unify_constant 27
	unify_value 2
	put_structure '.'/2 2
	unify_constant 26
	unify_value 3
	put_structure '.'/2 3
	unify_constant 25
	unify_value 2
	put_structure '.'/2 2
	unify_constant 24
	unify_value 3
	put_structure '.'/2 3
	unify_constant 23
	unify_value 2
	put_structure '.'/2 2
	unify_constant 22
	unify_value 3
	put_structure '.'/2 3
	unify_constant 21
	unify_value 2
	put_structure '.'/2 2
	unify_constant 20
	unify_value 3
	put_structure '.'/2 3
	unify_constant 19
	unify_value 2
	put_structure '.'/2 2
	unify_constant 18
	unify_value 3
	put_structure '.'/2 3
	unify_constant 17
	unify_value 2
	put_structure '.'/2 2
	unify_constant 16
	unify_value 3
	put_structure '.'/2 3
	unify_constant 15
	unify_value 2
	put_structure '.'/2 2
	unify_constant 14
	unify_value 3
	put_structure '.'/2 3
	unify_constant 13
	unify_value 2
	put_structure '.'/2 2
	unify_constant 12
	unify_value 3
	put_structure '.'/2 3
	unify_constant 11
	unify_value 2
	put_structure '.'/2 2
	unify_constant 10
	unify_value 3
	put_structure '.'/2 3
	unify_constant 9
	unify_value 2
	put_structure '.'/2 2
	unify_constant 8
	unify_value 3
	put_structure '.'/2 3
	unify_constant 7
	unify_value 2
	put_structure '.'/2 2
	unify_constant 6
	unify_value 3
	put_structure '.'/2 3
	unify_constant 5
	unify_value 2
	put_structure '.'/2 2
	unify_constant 4
	unify_value 3
	put_structure '.'/2 3
	unify_constant 3
	unify_value 2
	put_structure '.'/2 2
	unify_constant 2
	unify_value 3
	put_structure '.'/2 0
	unify_constant 1
	unify_value 3
	put_void 1
	put_definition 'halt'/0 2
	put_definition 'nl'/1 3
	unify_value 2
	put_definition 'display'/2 2
	unify_variable 4
	unify_value 3
	put_definition 'nrev'/3 3
	unify_value 0
	unify_value 4
	unify_value 2
	put_definition 'nl'/1 1
	unify_value 3
	execute 'display'/2 
)

predicate('halt'/0
	halt
)

% append([],X,X,C) :- demo_execute(C).
% append([X|Xs],Ys,[X|Zs],C) :- append(Xs,Ys,Zs,C).

predicate('append'/4
	switch_on_term 1 2 3
label 1
	try 2
	trust 3
label 2
	get_constant '[]' 0
	get_value 1 2
	demo_execute 3
label 3
	get_structure '.'/2 0
	unify_variable 4
	unify_variable 0
	get_structure '.'/2 2
	unify_value 4
	unify_variable 2
	execute 'append'/4
)

% nrev([],[],C) :- demo_execute(C).
% nrev([X|Xs],Rev,C) :- nrev(Xs,Rev2,append(Rev2,[X],Rev,C)).

predicate('nrev'/3
	switch_on_term 1 2 3
label 1
	try 2
	trust 3
label 2
	get_constant '[]' 0
	get_constant '[]' 1
	demo_execute 2
label 3
	get_structure '.'/2 0
	unify_variable 3
	unify_variable 0
	put_structure '.'/2 5
	unify_value 3
	unify_constant '[]'
	put_definition 'append'/4 4
	unify_variable 6
	unify_value 5
	unify_value 1
	unify_value 2
	put_value 6 1
	put_value 4 2
	execute 'nrev'/3
)







	
