Recent public codes are listed below. You can filter them by the following programming languages:
- view
- All
- Ada
- Assembler
- Assembler
- AWK (gawk)
- AWK (mawk)
- Bash
- bc
- Brainf**k
- C
- C#
- C++
- C++0x
- C99 strict
- CLIPS
- Clojure
- COBOL
- COBOL 85
- Common Lisp (clisp)
- D (dmd)
- Erlang
- F#
- Factor
- Falcon
- Forth
- Fortran
- Go
- Groovy
- Haskell
- Icon
- Intercal
- Java
- JavaScript (rhino)
- JavaScript (spidermonkey)
- Lua
- Nemerle
- Nice
- Nimrod
- Objective-C
- Ocaml
- Oz
- Pascal (fpc)
- Pascal (gpc)
- Perl
- Perl 6
- PHP
- Pike
- Prolog (gnu)
- Prolog (swi)
- Python
- Python 3
- R
- Ruby
- Scala
- Scheme (guile)
- Smalltalk
- SQL
- Tcl
- Text
- Unlambda
- VB.NET
- Whitespace
-
1
even(X) :- mod(X,2) is 0.
-
1 2 3 4 5 6 7
oddEven(X) :- X > 0, V is mod(X,2), write('odd') := V =:= 1, write('even') := V =:= 0.
-
1 2
num(X) :- mod(X, 2) is 0.
-
1 2
fac(0,1) :- !. fac(N,Nfac) :- N > 0, M is N - 1, fac(M, Mfac), Nfac is N * Mfac.
-
1 2
odd(X):- mod(x, 2) is 0
-
1 2 3 4 5 6 7
oddEven(X) :- X > 0, V is mod(X,2), write('odd') := V =:= 1, write('even') := V =:= 0.
-
1 2 3 4 5
even(X). even(s(s(X))):-even(X). odd(s(X)). odd(s(s(X))):-odd(X). halt.
-
1 2
odd(X):- mod(x, 2) is 0
-
1 2 3 4 5
factoriel(0,1). factoriel(X,Y) :- X1 is X - 1, factoriel(X1,Z), Y is Z*X,!.
-
1 2
is_odd :- Y is mod(X,2). is_even :- Y is mod(X,2).
-
1 2
num(X). mod(X, 2).
-
1 2
odd(X):- mod(x, 2) is 0
-
1 2 3 4 5 6 7 8
:- use_module(library(writef)). count(0):-!. count(X):- writef('%t\n',[X]), succ(XN,X), count(XN).
-
1 2 3 4
even(X). even(s(s(X))):-even(X). odd(s(X)). odd(s(s(X))):-odd(X).
-
1 2 3 4 5
number(0). number(s(s(X))):-number(X). number(s(0)). number(s(s(X))):-number(X).
-
1
odd(x):-x mod 2.
-
1 2
is_odd(X) :- mod(X,2)=1. is_even(X) :- mod(X,2)=0.
-
1 2 3 4 5 6 7 8
factorial(0,1). factorial(A,B) :- A > 0, C is A-1, factorial(C,D), B is A*D. yes
-
1 2 3 4 5
number(0). number(s(s(X))):-number(X). number(s(0)). number(s(s(X))):-number(X)
-
1 2
num(X). mod(X, 2) is 0.
-
1 2 3
M=2. mod(N,M,mod) :- mod==0, write('EVEN').
-
1
even(X) := 0 is mod(X, 2).
-
1 2 3 4
X is 1 :- C rem 2 =/= 0. X is 0 :- C rem 2 =:= 0. write('even') :- X is 1. write('odd'):- X is 0.
-
1 2 3 4 5 6
oddEven(X, RET) :- X > 0, V is mod(X,2), RET is V.
-
1 2 3 4 5 6 7
factorial(0,1). factorial(A,B) :- A > 0, C is A-1, factorial(C,D), B is A*D.
-
1 2
is_odd(X) :- mod(X,2)=1. is_even(X) :- mod(X,2)=0.
-
1 2
num(X). write('even'), nl. :- mod(X, 2) is 0.
-
1 2 3 4 5 6 7
count(0):-!. count(X):- writef('%t\n',[X]), succ(XN,X), count(XN). :- count(100).
-
1 2 3
mod(N,2,mod) :- mod==0, write('EVEN').
-
1
hello_world :- write('Hello World!') ,nl, fail.


