53 lines
736 B
Plaintext
53 lines
736 B
Plaintext
operator `<`(a, b: int): bool {
|
|
#pragma[magic: "LessThan", pure]
|
|
}
|
|
|
|
|
|
operator `+`(a, b: int): int {
|
|
#pragma[magic: "Add", pure]
|
|
}
|
|
|
|
|
|
operator `-`(a, b: int): int {
|
|
#pragma[magic: "Subtract", pure]
|
|
}
|
|
|
|
|
|
operator `-`(a, b: float): float {
|
|
#pragma[magic: "SubtractFloat64", pure]
|
|
}
|
|
|
|
fn clock: float {
|
|
#pragma[magic: "SysClock64"]
|
|
}
|
|
|
|
|
|
fn print(x: int) {
|
|
#pragma[magic: "PrintInt64"]
|
|
}
|
|
|
|
|
|
fn print(x: float) {
|
|
#pragma[magic: "PrintFloat64"]
|
|
}
|
|
|
|
|
|
fn print(x: string) {
|
|
#pragma[magic: "PrintString"]
|
|
}
|
|
|
|
|
|
fn fib(n: int): int {
|
|
if n < 2 {
|
|
return n;
|
|
}
|
|
return fib(n - 2) + fib(n - 1);
|
|
}
|
|
|
|
|
|
print("Computing the value of fib(30)");
|
|
var x = clock();
|
|
print(fib(30));
|
|
print(clock() - x);
|
|
print("Done!");
|