Hi all,
I’ve been stuck on this for a few days. I’m writing a simple evaluator for the Forth exercise on Exercism.
My progress can be found here.
For the life of me I can’t seem to figure out how to pass the “can use different words with the same name” test and the test after understandably infinitely loops. I know my approach is wrong within the assignCommand
function but I can’t think of how to force the value out of the pair and then use the new value as part of the new definition.
I’ve tried creating a temp variable/environment and trying to run the name first to see I can get the value in a new env and then redefining the name in the new environment but those don’t work.
Or maybe I need a new function which checks to see if the Text
supplied to mkState
is an existing member of the environment and forces it to use old values…but for now I’m out of ideas.
Any help is greatly appreciated. Thank you.