Picat
Implementation of programming language PicatPicat implementation from the language designers.
Examples:
Hello, World!:
Example for versions Picat 0.7main =>
print("Hello, World!\n").
Hello, World!:
Example for versions Picat 0.7main =>
println("Hello, World!").
Factorial:
Example for versions Picat 0.7This 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.7This 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.
Comments
]]>blog comments powered by Disqus
]]>