[plt-scheme] Scope question
And to give you a slightly different answer, the problem with your code is
not the scope, but assuming that the "append" function modifies the list you
pass it in-place. It doesn't. See the description of "append" in r5rs.
But, as others have said, if you're going to write Scheme, it might be a
good idea to spend some time learning how to write idiomatic Scheme (as
opposed to transcribing a C-inspired languages into Scheme):
... Lisp aficionados just laugh and laugh when they read
code produced by someone who frst learned Fortran and then spent
four to eight working days learning Scheme [...] This is because
such code is just Fortran code transliterated, and Fortran is
imperative whereas Scheme is quasi functional.
- Richard P. Gabriel, "Patterns of Software"
In addition to "How To Design Programs", "An Introduction To Scheme and its
Implementation", "The Scheme Programming Language", "Teach Yourself Scheme
in Fixnum Days", and, of course, "Structure and Interpretation of Computer
Programs" are all available free of charge on the Web. The schemers.org web
site has a more complete list.
--
Evgeny