문제

In order to learn what a fixed-point combinator is and is used for, I wrote my own. But instead of writing it with strictly anonymous functions, like Wikipedia's example, I just used define:

(define combine (lambda (functional)
                  (functional (lambda args (apply (combine functional) args))))

I've tested this with functionals for factorial and fibonacci, and it seems to work. Does this meet the formal definition of a fixed-point combinator?

도움이 되었습니까?

해결책

The answer is no, because according to the blog referred to in the previous answer, it doesn't even meet the definition of combinator, since 'combine' is a free variable.

다른 팁

EDIT: While chessweb or anyone else corroborates his answer, temporarily consider his answer correct and this one wrong.


It seems the answer is yes. Apparently the exact same combinator appears here, midway down the page:

(define Y
    (lambda (f)
      (f (lambda (x) ((Y f) x)))))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top