Having finished the introduction to Prolog I posted
earlier, I though I had a neat way of permuting lists. I was wrong (it had an infinite loop), but it was worth it to find
this tutorial which included:
perm([X|Y],Z) :- perm(Y,W), takeout(X,Z,W).
perm([],[]).
which is pretty neat, even if it only works one way (more details
here).
Anyone have a better implementation (apart from the built-in)?
PS It contains much more than that - even some quite involved NLP stuff.
Posted to Logic/Declerative by andrew cooke on 12/16/00; 11:07:17 AM
|
|