From 95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 18 Aug 2015 16:06:19 +0200 Subject: Exported all problems from the SQLite database into the new directory structure. --- .../denotational_semantics_aux__predicates.py | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 prolog/facts/denotational_semantics_aux__predicates.py (limited to 'prolog/facts/denotational_semantics_aux__predicates.py') diff --git a/prolog/facts/denotational_semantics_aux__predicates.py b/prolog/facts/denotational_semantics_aux__predicates.py new file mode 100644 index 0000000..4bf315b --- /dev/null +++ b/prolog/facts/denotational_semantics_aux__predicates.py @@ -0,0 +1,32 @@ +id = 2 + +name = 'denotational semantics aux. predicates' + +facts = '''\ +findblank(R, Bx) :- + findblank(R, 1, Bx). +findblank([0|_], Bx, Bx) :- !. +findblank([_|T], Cx, Bx) :- + Cx1 is Cx + 1, + findblank(T, Cx1, Bx). + +swap([H1,H2|T],2,[H2,H1|T]). +swap([H|T],C0,[H|NewT]):- + C0 > 2, + C is C0 - 1, + swap(T,C,NewT). + +swap(R, I1, I2, NewR) :- + (I1 < I2, !, + Ix1 = I1, Ix2 = I2 + ; + Ix1 = I2, Ix2 = I1), + Cut1 is Ix1 - 1, + Cut2 is Ix2 - Ix1 - 1, + length(LBef, Cut1), + length(LMid, Cut2), + lists:append(LBef, [E1|RRest], R), + lists:append(LMid, [E2|LAft], RRest), + lists:append(LBef, [E2|RIntermediate], NewR), + lists:append(LMid, [E1|LAft], RIntermediate). +''' -- cgit v1.2.1