This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
clpfd:clpfd_equal_(A, B) :- | |
( cyclic_term(A) | |
-> domain_error(clpfd_expression, A) | |
; cyclic_term(B) | |
-> domain_error(clpfd_expression, B) | |
; false | |
). | |
clpfd:clpfd_equal_(A, B) :- | |
( nonvar(A), | |
( A= ?(C) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- use_module(library(chr)). | |
:- chr_constraint player/3, rocket/3, target/2, input/1, tick/0. | |
player(X,Y,H),input(space) ==> rocket(X,Y,H). | |
tick \ rocket(X,Y,H) <=> NX is X + cos(H) * V, NY is Y + sin(H) * V, rocket(NX, NY, H). | |
rocket(X,Y,_), target(TX, TY, _) <=> near(X,Y,TX,TY), explosion(TX,TY). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go(Y) :- | |
setof(X, a_tweet(X), Tweets), | |
random_permutation(Tweets, RandTweets), | |
!, | |
member(Y, RandTweets). | |
a_tweet(X) :- | |
phrase(rando_tweet, Code), | |
length(Code, L), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
?: (what do I hate) ^keep() ^repeat() @0 = ^query(direct_sv %user hate ?) | |
if(^length(@0) = 0) { | |
You don't hate anything | |
} else if (^length(@0) = 1) { | |
You hate ^first(@0object). | |
} else if (^length(@0) = 2) { | |
You hate ^first(@0object) and ^first(@0object). | |
} else { | |
_1 = ^length(@0) - 1 | |
You hate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
english(X) :- | |
phrase(sentence, X). | |
sentence --> sentence(_). | |
sentence(Number) --> | |
noun_phrase(Number), | |
verb_phrase(Number). | |
noun_phrase(Number) --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(login_advisor2, [login_advisor2/0]). | |
/** <module> Login Advisor rev 2 | |
* | |
* This is an expert system like tool to help set up | |
* an identity instance | |
*/ | |
:- dynamic question_answer/2. | |
login_advisor2 :- | |
retractall(question_answer(_, _)), % TODO expand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(clpfdwsc, [go/1]). | |
:-use_module(library(clpfd)). | |
go(M) :- | |
wsc([[0,0,0,0]], M), | |
flatten(M, FM), | |
label(FM). | |
wsc([[1,1,1,1]|R], [[1,1,1,1]|R]). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(clpstr, [ | |
cl_len/2, | |
cl_regex/2, | |
cl_insensitive/2, | |
cl_str/1 | |
]). | |
/** <module> Constraint Logic Programming over strings | |
* | |
* constraints over 'real' strings | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- chr_constraint temp_persist/2, collect_persist/2, get_persist/2. | |
get_all_persistant(S, Persistant) :- | |
chr_trace, chr_leash(-all), | |
get_persist(S, Persistant). | |
persistant(S, Data), get_persist(S, _) ==> temp_persist(S, Data). | |
get_persist(S, Persist) <=> collect_persist(S, Persist). | |
temp_persist(S, Data), collect_persist(S, Persist) <=> | |
Persist = [Data | Rest], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:- module(cooking, [go/0]). | |
:- use_module(library(http/thread_httpd)). | |
:- use_module(library(http/http_dispatch)). | |
:- use_module(library(http/http_parameters)). | |
:- use_module(library(http/http_session)). | |
:- use_module(library(http/html_write)). | |
:- use_module(library(chr)). |
NewerOlder