
% List all permutations of a name:
listperms(W) :-
	name(W,S1),
	perm(S1,S2),
	name(X,S2),
	write(X), nl,
	fail.
listperms(_).
perm([],[]).
perm([C|S1],S2) :-
	perm(S1,P1),
	cat(X,Y,P1),
	cat(X,[C|Y],S2).


foo :-	write('cmd: '),
	get0(X),
	ord(C,X),
	cmd(C), !,
	foo.
cmd(q) :- !, fail.		% exit
cmd(_) :- write(foo), nl.
