Picat

Appeared in:
2013
Influenced by:
Paradigm:
Typing discipline:
File extensions:
.pi
Versions and implementations (Collapse all | Expand all):
Programming language

Picat is a logic-based multi-paradigm programming language with functional and scripting language features.

Picat was created by Neng-Fa Zhou and Jonathan Fruhman.

Elements of syntax:

Inline comments %

Picat logo
Picat logo

Examples:

Hello, World!:

Example for versions Picat 0.7
main =>
     print("Hello, World!\n").

Hello, World!:

Example for versions Picat 0.7
main =>
     println("Hello, World!").

Factorial:

Example for versions Picat 0.7

This example implements recursive factorial definition using a predicate.

factorial(0, F) => F = 1.
factorial(N, F), N > 0 => factorial(N - 1, F1), F = N * F1.

main =>
     foreach (I in 0 .. 16)
          factorial(I, F),
          writef("%w! = %w\n", I, F)
     end.

Factorial:

Example for versions Picat 0.7

This example implements recursive factorial definition using a function.

factorial(0) = 1.
factorial(N) = F, N > 0 => F = N * factorial(N - 1).

main =>
     foreach (I in 0 .. 16)
          writef("%w! = %w\n", I, factorial(I))
     end.