5 ms·
What you want is basically the compiler optimization called deforestation: http://en.wikipedia.org/wiki/Deforestation_ http://en.wikipedia.org/wiki/Deforestati
by nostrademons 18y ago
What you want is basically the compiler optimization called deforestation:
http://en.wikipedia.org/wiki/Deforestation_ http://en.wikipedia.org/wiki/Deforestation_(computer_science)
It's only valid in a pure language, and in a strict language, it has the embarassing side-effect that it can sometimes make non-terminating programs terminate.
- silentbicycle 18y agoJust a note: you need to quote the parens in the link like so: http://en.wikipedia.org/wiki/Deforestation_%28computer_science%29 http://en.wikipedia.org/wiki/Deforestation_%28computer_scien... And no, I don't know why this isn't mentioned in the FAQ or (better yet) the formatting options...
- flashgordon 18y agoactually thanks guys for the great link... going deeper found this paper by Walder (one of the big gurus behind monads).. certainly a great read... was wondering why non-terminating progs would terminate till I read this paper (though thinking about it common sense would explain why)... http://homepages.inf.ed.ac.uk/wadler/papers/deforest/deforest.ps http://homepages.inf.ed.ac.uk/wadler/papers/deforest/defores...
- gruseom 18y agoThank you. This is interesting and I will have to make time to read Wadler's paper. This part of the program I'm working on is sort of compiler-like, so maybe a technique like that would work. (More likely, though, I'll end up sticking with the less elegant solution I already have, which involves defining two sets of functions rather than just the mapping ones.)