Anonymous user
Y combinator: Difference between revisions
m
→{{header|ALGOL 68}}
Line 316:
-->
The version below works with Algol 68 Genie
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 , )
)
;
|