1%-----------------------------------------------------------------------------%
    2% vim: ft=prolog ts=4 sw=4 et wm=0 tw=0
    3%-----------------------------------------------------------------------------%
    4:- module(evil, [ '...'//0,
    5                  if/2,     op(1175, xfx, if),
    6                  not/1,    op(1175, yf, not),
    7                  unless/2, op(1175, xfx, unless) ]).    8:- meta_predicate (0 if -).    9:- meta_predicate (0 not).   10:- meta_predicate (0 unless -).

Evil Prolog

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.
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. /
   40:- multifile license:license/3.   41licence:license(wtfpl, lgpl,
   42                [ comment('Do What The Fuck You Want To Public License'),
   43                  url('http://www.wtfpl.net/txt/copying')]).
   44:- license(wtfpl).
 unless(+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 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.
   65Term unless Condition :-
   66    ( \+ call(Condition) -> call(Term) ).
 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.
   87Term if Condition :-
   88    ( call(Condition) -> call(Term) ).
 ...// 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.
  110... --> []|[_],... .
 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).
  129Term not :-
  130    \+ call(Term)