On 6/19/21 7:20 AM, Christopher Lam wrote:
Agree set! is not a desirable form. It is not consistently optimisable. I cannot find the reference in the manual.

Also consider the first form: you're building a list in 3 passes -- call iota to generate a list, call filter to navigate the list again, then fold to accumulate your answer. Therefore it's O(3N).

The preferred form is definitely from the little schemer.

Haskell has something called stream fusion which can optimize the extra
passes out in many cases. I wonder if Guile or any of the other scheme
compilers can do that? As someone who has spent the majority of my life
writing high performance C and Fortran code, the inefficiencies in a lot
of functional programming is something I don't care for. On the other
hand, writing functional code is fun.


Reply via email to