Re: Fibonacci solution on RosettaCode

new topic     » goto parent     » topic index » view thread      » older message » newer message
coconut said...
bruce1961 said...

I really like Euphoria! So incredibly expressive ...

I just put together a solution for Fibonacci Sequence, using an embedded byte-coded interpreter approach. I can see myself using this for quite a number of the other tasks.

Kind regards, Bruce.

Be serious, they where not asking for a compiler design exercice they were just asking for a fibonacci function. I added iterative and recursive version of it.

The stdlib version is just two lines:

include std/math.e 
? fib(x) 

It's implemented using the constant time formula.

public function fib(integer i) 
        return floor((power( mathcons:PHI, i) / mathcons:SQRT5) + 0.5) 
end function 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu