Jump to content

Y combinator: Difference between revisions

m
Line 316:
-->
 
 
The version below works with Algol 68 Genie 23.80.43 tested with Linux kernel release 5.18.5-200.fc36.x86_64.
N.B. 4 warnings are issued of the form
 
a68g: warning: 1: declaration hides a declaration of "..." with larger reach, in closed-clause starting at "(" in line dd.
 
These could easily be fixed by changing names, but I believe that doing so would make the code harder to follow.
 
<lang algol68>BEGIN
Line 351 ⟶ 357:
( F fac ) F:
( ( F fac , INT n ) INT: IF n = 0 THEN 1 ELSE n * fac( n - 1 ) FI )
( fac , )
)
;
Line 368 ⟶ 374:
( F fib ) F:
( ( F fib , INT n ) INT: CASE n IN 1 , 1 OUT fib( n - 2 ) + fib( n - 1 ) ESAC )
( fib , )
)
;
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.