Es6's algorithm problem, solving the analysis process

topic description

ask the god to help me analyze it. I feel a little dizzy

related codes

(fn =>
    (f =>
        f(f)
    )(f =>
        fn(n =>
            f(f)(n)
        )
    )
)(g =>
    n => [1, 2].indexOf(n) > -1 ? 1 : g(n - 1) + g(n - 2)
)(10)

what result do you expect? What is the error message actually seen?

the running result of this program is 55. I want to know the process and ideas.

Jul.19,2021

is actually the summation of the Fibonacci series, using a Y fixed point combiner with a little bit of skill.

except for the Y fixed point combiner, it is a simple recursion.

derive Y group zygote by JavaScript


stay away from the programmer


Fibonacci item 10, that is, this number is equal to the sum of the first two terms


Fibonacci sequence summation
is actually a recursive
but you can't read it. The es6 structure assignment is more concise
. It's best to check whether it's number or a lot of useless numbers

.

Let me translate:
I don't know why that person wrote so much trouble

(function boqie(n) {
    if (n<=2){
        return 1;
    }
    return boqie(n-1)+boqie(n-2)
})(10)
Menu