mirror of
				https://github.com/roc-lang/roc.git
				synced 2025-11-04 06:38:28 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			13 lines
		
	
	
	
		
			268 B
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
	
		
			268 B
		
	
	
	
		
			Text
		
	
	
	
	
	
app "fibonacci"
 | 
						|
    packages { pf: "fibonacci-platform/main.roc" }
 | 
						|
    imports []
 | 
						|
    provides [main] to pf
 | 
						|
 | 
						|
main = \n -> fib n 0 1
 | 
						|
 | 
						|
# the clever implementation requires join points
 | 
						|
fib = \n, a, b ->
 | 
						|
    if n == 0 then
 | 
						|
        a
 | 
						|
    else
 | 
						|
        fib (n - 1) b (a + b)
 |