Furry Paws
Version of implementation Furry Paws of programming language FPThis one probably has only one version.
Examples:
Hello, World! - FP (123):
~x
is constant-value function (denoted with %
in Interactive FP).
emit
is a function which writes its argument to stdout.
main
is a function which is the first to be invoked when the program is executed.
main = emit.(return ~"Hello, World!\n")
Factorial - FP (124):
This example works in exactly the same way as the one in Interactive FP, except for that it doesn’t define zero
function, since it’s built-in. Note that here all operations are done within integer data type, and 13! overflows it, so the program can be called only to print factorials up to 12!. show
is another way to output data.
dec = sub.[id, ~1]
seq = zero -> [id] ; cat.[seq.dec, [id]]
factorial = zero -> ~1 ; mul.[id, factorial.dec]
main = show.(return @factorial.(seq.~12))
Fibonacci numbers - FP (125):
This example works exactly like the one for Interactive FP.
one = eq.[id, ~1]
dec = sub.[id, ~1]
seq = one -> [~1] ; cat.[seq.dec, [id]]
fibonacci = lt.[id, ~3] -> ~1 ; add.[fibonacci.sub.[id, ~1], fibonacci.sub.[id, ~2]]
main = show.(return @fibonacci.(seq.~16))
Comments
]]>blog comments powered by Disqus
]]>