2 ms·
it was a stupid joke about the y combinator. you can arrange a version with more function arguments that'll call all of the parts with their lambda friends. so
by jfoutz 9y ago
it was a stupid joke about the y combinator. you can arrange a version with more function arguments that'll call all of the parts with their lambda friends. so they can all call each other.
so something vaguely like
(define local-state)
(super-y
(lambda (inc get set v)
(set inc get set (+ 1(get inc get set v))))) ;this one is inc
(lambda (inc get set v) local-state) ;this one is get
(lambda (inc get set v) (set! local-state v)) ; this one is set
you don't really even need local state, just pass around an accumulator.
Once you have lambdas and a system that allows infinite types, mutual visibility is pretty easy to come by, mutual anonymous recursion is something i think is super nifty.
you can save yourself some pain by sticking the functions in a map, of course and passing that around instead.