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