fun lazy {LAppend Xs Ys}
case Xs of nil then Ys
[] X|Xr then X|{LAppend Xr Ys}
end
end
When first element is needed it returns X|<promised next elems> and it calculates the next elements on the need basis.
As I go along with "Concepts, Techniques and Models of Computer Programming by Peter Van Roy and Seif Haridi", I'll be putting my thoughts and solution to the exercises(ones that I'm able to crack :) ) here. Please let me know if any of the code snippets presented in solutions give errors as I might have made a mistake in correctly copying the code or something else.
fun lazy {LAppend Xs Ys}
case Xs of nil then Ys
[] X|Xr then X|{LAppend Xr Ys}
end
end
No comments:
Post a Comment