Created
September 14, 2017 12:33
-
-
Save jcoglan/dbbd014dd375bde50336b5d89d8d9eeb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
require 'bundler/setup' | |
require 'infer' | |
program = Infer::Prolog.program <<-PL | |
s --> foo,bar,wiggle. | |
foo --> [choo]. | |
foo --> foo,foo. | |
bar --> mar,zar. | |
mar --> me,my. | |
me --> [i]. | |
my --> [am]. | |
zar --> blar,car. | |
blar --> [a]. | |
car --> [train]. | |
wiggle --> [toot]. | |
wiggle --> wiggle,wiggle. | |
PL | |
Infer::Prolog.execute_and_print program, 's(X,[]).', :limit => 3 |
This file contains hidden or 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
?- s(X, []). | |
————————————————————————————————————————————————— —————————————————————————————————————————— ————————————————————————————————————— —————————————————————————— | |
me([i, am, a, train, toot], [am, a, train, toot]) my([am, a, train, toot], [a, train, toot]) blar([a, train, toot], [train, toot]) car([train, toot], [toot]) | |
————————————————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————— | |
mar([i, am, a, train, toot], [a, train, toot]) zar([a, train, toot], [toot]) | |
——————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— —————————————————— | |
foo([choo, i, am, a, train, toot], [i, am, a, train, toot]) bar([i, am, a, train, toot], [toot]) wiggle([toot], []) | |
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— | |
s([choo, i, am, a, train, toot], []) | |
X = [choo, i, am, a, train, toot] | |
————————————————————————————————————————————————— —————————————————————————————————————————— ————————————————————————————————————— —————————————————————————— | |
me([i, am, a, train, toot], [am, a, train, toot]) my([am, a, train, toot], [a, train, toot]) blar([a, train, toot], [train, toot]) car([train, toot], [toot]) | |
——————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————— | |
foo([choo, choo, i, am, a, train, toot], [choo, i, am, a, train, toot]) foo([choo, i, am, a, train, toot], [i, am, a, train, toot]) mar([i, am, a, train, toot], [a, train, toot]) zar([a, train, toot], [toot]) | |
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— —————————————————— | |
foo([choo, choo, i, am, a, train, toot], [i, am, a, train, toot]) bar([i, am, a, train, toot], [toot]) wiggle([toot], []) | |
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— | |
s([choo, choo, i, am, a, train, toot], []) | |
X = [choo, choo, i, am, a, train, toot] | |
————————————————————————————————————————————————————————————— —————————————————————————————————————————————————————— ————————————————————————————————————————————————— —————————————————————————————————————— | |
me([i, am, a, train, toot, toot], [am, a, train, toot, toot]) my([am, a, train, toot, toot], [a, train, toot, toot]) blar([a, train, toot, toot], [train, toot, toot]) car([train, toot, toot], [toot, toot]) | |
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ————————————————————————————————————————————————————————————————————————————————————————————— ———————————————————————————— —————————————————— | |
mar([i, am, a, train, toot, toot], [a, train, toot, toot]) zar([a, train, toot, toot], [toot, toot]) wiggle([toot, toot], [toot]) wiggle([toot], []) | |
——————————————————————————————————————————————————————————————————————— ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ———————————————————————————————————————————————————— | |
foo([choo, i, am, a, train, toot, toot], [i, am, a, train, toot, toot]) bar([i, am, a, train, toot, toot], [toot, toot]) wiggle([toot, toot], []) | |
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— | |
s([choo, i, am, a, train, toot, toot], []) | |
X = [choo, i, am, a, train, toot, toot] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment