Skip to content
TobiasWrigstad edited this page Sep 29, 2014 · 6 revisions

Here is a tentative fibonacci number calculation using Encore:

class Fib
  def fib(n:int) : int 
    if n < 2 then n else 
       plet 
         x = fib(n-1) 
         y = fib(n-2)
       in
         x + y 

In the code above, the plet statement runs the initialisation of x and y in parallel, and blocks until they are assigned until it executes x + y.