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 combin开发者_高级运维ator?
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)))))
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.
精彩评论