Y combinator: Difference between revisions
Content added Content deleted
m (→{{header|Julia}}: Restored the Julia version of Ismaei-vc) |
|||
Line 3,442: | Line 3,442: | ||
=={{header|Julia}}== |
=={{header|Julia}}== |
||
<lang julia> |
<lang julia> |
||
⚫ | |||
⚫ | |||
_ _ _(_)_ | Documentation: https://docs.julialang.org |
|||
⚫ | |||
(_) | (_) (_) | |
|||
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help. |
|||
| | | | | | |/ _` | | |
|||
| | |_| | | | (_| | | Version 1.6.3 (2021-09-23) |
|||
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release |
|||
|__/ | |
|||
julia> using Markdown |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
""" -> |
|||
Y = f -> (x -> x(x))(y -> f((t...) -> y(y)(t...))) |
Y = f -> (x -> x(x))(y -> f((t...) -> y(y)(t...))) |
||
Y |
|||
</lang> |
</lang> |
||
Line 3,453: | Line 3,465: | ||
<lang julia> |
<lang julia> |
||
⚫ | |||
julia> "# Factorial" |
|||
#9 (generic function with 1 method) |
|||
⚫ | |||
⚫ | |||
julia> "# Fibonacci" |
|||
#13 (generic function with 1 method) |
|||
⚫ | |||
julia> |
julia> Y(fac).(1:10) |
||
10-element |
10-element Vector{Int64}: |
||
1 |
1 |
||
2 |
2 |
||
Line 3,472: | Line 3,484: | ||
3628800 |
3628800 |
||
julia> |
julia> Y(fib).(1:10) |
||
10-element |
10-element Vector{Int64}: |
||
1 |
1 |
||
1 |
1 |