Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

I thought I had it all figured out

Name: LISPPER 2012-12-31 8:27

But then this fucker had to post some Prolog code and I was mesmerized. Fuck. FUCK.

Name: Anonymous 2012-12-31 9:19

Blessed be the Theorem Prover, for He will never give up the pursuit of truth.


singleton(X,[X]).

Name: Anonymous 2012-12-31 9:24

Beware the false axioms of the devil. A bottomless pit of despair and inconsistency await those tempted by the false presumptions.


unordered_merge([],[],[]).
unordered_merge(Xs,[Y|Ys],[Y|Zs]) :- unordered_merge(Xs,Ys,Zs).
unordered_merge([X|Xs],Ys,[X|Zs]) :- unordered_merge(Xs,Ys,Zs).

Name: Anonymous 2012-12-31 9:28

It is never too late to get back on the right path. Cast aside your contradictions and embrace the Lord as your savior.


reduce_pairs(_,[],[]).
reduce_pairs(_,[X],[X]).
reduce_pairs(Op,[X1,X2|Xs],[Z|Zs]) :- call(Op,X1,X2,Z), reduce_pairs(Op,Xs,Zs).

balanced_reduce(_,[X],X).
balanced_reduce(Op,Xs,Z) :- Xs \= [X], reduce_pairs(Op,Xs,Ys), balanced_reduce(Op,Ys,Z).

Name: Anonymous 2012-12-31 9:34

God be my guide. Don't let me stray. Keep me among you in your kingdom of correctness.


permutation(Xs,Ys) :- map(singleton,Xs,XSingles), balanced_reduce(unordered_merge,XSingles,Ys).

permutations(Xs,Ys) :- findall(Perm,permutation(Xs,Perm),Ys).

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List