Talk:Odd word problem: Difference between revisions

(→‎Explanations: return value restrictions?)
Line 7:
I guess I need to further clarify: this is '''not''' about text processing. Reversing English words and reading/writing a-z is about as unineresting as it can get, just pretend they are some token irreversible action that's potentially very complicated and cannot be simply queued as data, and you need to perform them in certain order depending on the input. In a strict sense, the current python and go code aren't correct, either (passing saved data by return). --[[User:Ledrug|Ledrug]] 22:21, 3 November 2011 (UTC)
:I'm not seeing the problem with the previous Python code. Why not allow returning a character from the recursive function? How is returning a boolean any different that returning a character? —[[User:Sonia|Sonia]] 23:34, 3 November 2011 (UTC)
:: The operations required by the task are only symbolic. "Reading a char" could represent arbitrarily complex data input, while "writing a char" could be be arbitrarily complex manipulation on such data. The boolean return only indicates if input is exhausted, while swapping variables or returning a value for deferred processing may mean detaching that data from the state under which it was obtained, and may be questionable. Using a closure or continuation to capture both data and state is maybe more to the spirit, but then since there's no way to precisely state what "complex" means here, I'd say the Go solution is acceptible. --[[User:Ledrug|Ledrug]] 00:09, 4 November 2011 (UTC)
 
== Other References ==
Anonymous user