This module is intended to further the cause of Evil in the Prolog
community. It accomplishes this by providing predicates that will render
code difficult (and even impossible!) to follow even while retaining
correctness.
It is no accident that many of these examples of evil come from mimicking
other programming languages...
So signal your alliegance proudly with a use_module(evil).
at the head
of your code. Take a stand. For evil.
- author
- - Michael T. Richter <ttmrichter@gmail.com>
- version
- - 1.0
- See also
- - http://en.wikipedia.org/wiki/Theodicy
- deprecated
- - Use sanity instead please.
- copyright
- - (c)2012 Michael T. Richter
- license
- - This program is free software. It comes without any warranty,
to the extent permitted by applicable law. You can redistribute
it and/or modify it under the terms of the Do What The Fuck You
Want To Public License, Version 2, as published by Sam Hocevar.
See the file COPYING in the project root directory or consult
http://www.wtfpl.net/txt/copying for more details.
- To be done
- - There is no end to the evil available out there. This module
is eternally in a state of flux.
- +Term:term unless +Condition:pred is nondet
- Have you ever thought that the traditional conditional structure of
(
Condition -> True_path ; False_path )
was boringly easy to read and reason
about? Worry no longer with the patented tail-placed negating conditional!
Amaze your friends by saying things like this:
write('I like evil!'), nl unless 1 = 2.
Your friends will respect your ability to render their lives devoid of
meaning (at least while they read your code).
- Arguments:
-
Term | - An arbitrary term that gets evaluated if Condition is
false. |
Condition | - A conditional expression used to decide whether or not
Term is evaluated. |
- deprecated
- - Use
( Condition -> True_path ; False_path )
instead.
- if(+Term:term, +Condition:pred) is nondet
- Have you ever thought that the traditional conditional structure of
(
Condition -> True_path ; False_path )
was boringly easy to read and reason
about? Worry no longer with the patented tail-placed conditional! Amaze
your friends by saying things like this:
write('I like evil!'), nl if 1 = 1.
Your friends will respect your ability to render their lives devoid of
meaning (at least while they read your code).
- Arguments:
-
Term | - An arbitrary term that gets evaluated if Condition is
true. |
Condition | - A conditional expression used to decide whether or not
Term is evaluated. |
- deprecated
- - Use
( Condition -> True_path ; False_path )
instead.
- ...// is det
- This little piece of evil comes from the documentation of SWI-Prolog. It
permits you to write code like this snippet taken from the point of origin:
file_contains(File, Pattern) :-
phrase_from_file((..., Pattern, ...), File).
Amaze your friends with executing code that looks like it has meta-syntactic
expressions in it! Make lots of friends and influence lots of people!
- author
- - Jan Wielemaker (Like I would claim credit for this stinker!)
- See also
- - http://www.swi-prolog.org/pldoc/doc_for?object=phrase_from_file/2
- deprecated
- - Use the following instead:
any --> [].
any --> [_], any.
- not(Term:term) is semidet
- This piece of vileness is something I like to call the "Bill & Ted
Operator". How is it used? Simplicity itself!
==
1=2 not. % true
1=1 not. % false
1=1, 2=2, 3=3, 4=4 not. % false
1=1, 2=2, 3=3, 4=3 not. % true
- Arguments:
-
Term | - An arbitrary Prolog term. |
- author
- - thanosQR on the ##prolog channel at FreeNode
- deprecated
- - Use the following instead:
\+ (1=1, 2=2, 3=3, 4=3).