Re: Forth Frustrations



On Apr 2, 1:52 pm, "J Thomas" <jethom...@xxxxxxxxx> wrote:
On Apr 2, 1:37 pm, Andreas Kochenburger <a...@xxxxxxxxxx> wrote:
Factoring is one thing. But some algorithms or formulae do not allow it.

If it can work to use an algorithm that does allow factoring, that
algorithm will usually be easier to write and debug, and it might be
simpler and also more efficient. But sometimes that isn't possible.
And sometimes there isn't time to spare to find out whether it's
possible or not.

I don't buy into the idea that an algorithm can't be factored. If it
can't be factored, then it must be so small that it is not needed.
The only time I could not factor a function to make it simpler to code
in Forth was when it had for loops with relatively little code inside
the loop other than stack juggling. Moving the inner code to another
function did not make anything more clear and actually would make it
worse since all references to the loop variable more difficult. If
there was much code inside the loop then it could easily be worth the
effort of making another function.



.



Relevant Pages