Y combinator: Difference between revisions
Content added Content deleted
(→{{header|Quackery}}: added some more commentary) |
|||
Line 316: | Line 316: | ||
--> |
--> |
||
The version below works with Algol 68 Genie 2.8.4 tested with Linux kernel release 5. |
The version below works with Algol 68 Genie 2.8.4 tested with Linux kernel release 5.18.5-200.fc36.x86_64 |
||
<lang algol68>BEGIN |
<lang algol68>BEGIN |
||
Line 328: | Line 328: | ||
# Y_combinator = |
# Y_combinator = func_gen => ( x => x( x ) )( x => func_gen( arg => x( x )( arg ) ) ) ; # |
||
PROC y combinator = ( PROC( F ) F func gen ) F: |
PROC y combinator = ( PROC( F ) F func gen ) F: |
||
Line 341: | Line 341: | ||
# |
|||
⚫ | |||
factorial = |
|||
⚫ | |||
; |
|||
# |
|||
F factorial = |
|||
⚫ | |||
y combinator( |
|||
⚫ | |||
⚫ | |||
⚫ | |||
( fac , ) |
( fac , ) |
||
) |
|||
; |
; |
||
# |
|||
⚫ | |||
fibonacci = |
|||
Y_combinator( |
|||
⚫ | |||
) |
|||
; |
|||
# |
|||
F fibonacci = |
|||
⚫ | |||
y combinator( |
|||
⚫ | |||
⚫ | |||
⚫ | |||
( fib , ) |
( fib , ) |
||
) |
|||
; |
; |
||
# factorial = Y_combinator( fac_gen ) ; # |
|||
F factorial = y combinator( fac gen ) ; |
|||
# fibonacci = Y_combinator( fib_gen ) ; # |
|||
F fibonacci = y combinator( fib gen ) ; |
|||