Last active
January 4, 2016 16:39
-
-
Save pfctdayelise/8648478 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
% Generate/verify memes in Prolog. | |
noun(apple). | |
noun(banana). | |
noun(orange). | |
noun(kiwifruit). | |
irregular_noun(kiwifruit, kiwifruit). | |
verb(eat). | |
verb(clean). | |
verb(buy). | |
verb(cook). | |
plural_noun(Sg, Pl):- | |
irregular_noun(Sg, Pl), !. | |
plural_noun(Sg, Pl):- | |
atom_concat(Sg, s, Pl). | |
% http://knowyourmeme.com/memes/x-all-the-y | |
x_all_the_ys(Str):- | |
noun(Noun), | |
plural_noun(Noun, Pluralnoun), | |
atom_concat(Pluralnoun, '!', Ys), | |
verb(Verb), | |
[Verb, all, the, Ys] = Words, | |
atomic_list_concat(Words, ' ', Str). | |
% http://knowyourmeme.com/memes/xzibit-yo-dawg | |
yo_dawg(Str):- | |
noun(Noun), | |
plural_noun(Noun, Pluralnoun), | |
[so, i, put, Pluralnoun, in, your, Pluralnoun] = Rest, | |
[yo, dawg, i, heard, you, like, Pluralnoun|Rest] = Words, | |
atomic_list_concat(Words, ' ', Str). | |
yo_dawg(Str):- | |
verb(Verb), | |
noun(Noun), | |
plural_noun(Noun, Pluralnoun), | |
[so, you, can, Verb, while, you, Verb] = Rest2, | |
[so, i, put, Pluralnoun, in, your, Pluralnoun|Rest2] = Rest, | |
[yo, dawg, i, heard, you, like, Pluralnoun|Rest] = Words, | |
atomic_list_concat(Words, ' ', Str). | |
meme(x_all_the_ys). | |
meme(yo_dawg). | |
ismeme(S):- | |
meme(Pred), | |
call(Pred, S). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment