Examples
Fibonacci
fib.hd
func calculate(n int64) -> int64
if((n is 0) or (n is 1))
put n
end
put fib(n-1) + fib(n-2)
endvar calculate lambda::(int64)->int64 = { x => ((x == 0) or (x == 1)) ? x : calculate(x-1) + calculate(x-2) }main.hd
with fib from fib.hd
with console from std:io
with Int fixed from std:int
fib.calculate(parse(value=console.in(),raise=false,defaultValue=0))Perceptron
Factorial
main.hd
Last updated