1. Fibonacci solution on RosettaCode

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.

new topic     » topic index » view message » categorize

2. Re: Fibonacci solution on RosettaCode

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.

new topic     » goto parent     » topic index » view message » categorize

3. Re: Fibonacci solution on RosettaCode

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.

There's actually a stdlib routine, math:fib() - though it suffers from the limitation of the maximum value that a double (64bit float) can store.

new topic     » goto parent     » topic index » view message » categorize

4. Re: Fibonacci solution on RosettaCode

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 message » categorize

5. Re: Fibonacci solution on RosettaCode

coconut said...

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.

Okay, it was a bit over the top. But it was fun. And I learned a bit more about Eu4 in the process.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu