Arc Forumnew | comments | leaders | submitlogin
1 point by ambition 6021 days ago | link | parent

For completeness (and in case someone can spot my mistake!) here's the broken Y Combinator version:

    (def Y2 (m) ((fn (f) (m (fn (a result) (f f) a result)))
          		(fn (f)	(m (fn (a result) (f f) a result)))))
    ; broken
    (def accumulate (combiner null-value term a next b)
    	((Y2 (fn (r)
    			(fn (a result)
    		   		(if (> a b) result
    		       		(r (next a) (combiner (term a) result))))))
    		a 
    		null-value))