Define a scheme function with a parameter that can safely be stack
allocated. Justify your answer.
Define a scheme function with a parameter that cannot safely be stack
allocated. Justify your answer.
Describe an analysis that could be applied to a scheme function to
determine if it is safe to stack allocate its parameters. Keep in mind
that function s can call other functions, passing their parameters as
arguments.
Sorry, we're not going to do your homework for you. Tell us how far
you've gotten, and what's confusing you, and people will then help fill
in the blanks.
--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
> Sorry, we're not going to do your homework for you. Tell us how far
> you've gotten, and what's confusing you, and people will then help fill
> in the blanks.
You would think that he would post something that didn't look so
blatantly like homework.
--
Aaron Hsu <arc...@sacrideo.us>
http://www.sacrideo.us
> On 2008-02-11 23:28:34 -0600, Barry Margolin <bar...@alum.mit.edu> said:
>
> > Sorry, we're not going to do your homework for you. Tell us how far
> > you've gotten, and what's confusing you, and people will then help fill
> > in the blanks.
>
> You would think that he would post something that didn't look so
> blatantly like homework.
Are you new to Usenet? It's really not that uncommon for posters to
quote the problem set verbatim.
> Are you new to Usenet? It's really not that uncommon for posters to
> quote the problem set verbatim.
I am not new, but actually, I haven't seen a lot of these cases where
it was so blatant.
> Define a scheme function with a parameter that can safely be stack
> allocated. Justify your answer.
Anything can be stack-allocated; it just might have to be moved later.
See, canonically, http://home.pipeline.com/~hbaker1/CheneyMTA.html
--
#!/usr/bin/env scheme-script
#!r6rs (import (rename (rnrs) (lambda \x3bb;) (set! \x5316;))) ((\x3bb;
':['"JdDvs" '"e ai\n"]) (\x3bb; (\x3a3;) (\x3bb; (set!) (string-for-each
(\x3bb; (\x3c7;) (display \x3c7;) (\x5316; set! (call/cc set!))) \x3a3;)))-)
<quote>
#!/usr/bin/env scheme-script
#!r6rs (import (rename (rnrs) (lambda \x3bb;) (set! \x5316;))) ((\x3bb;
':['"JdDvs" '"e ai\n"]) (\x3bb; (\x3a3;) (\x3bb; (set!) (string-for-each
(\x3bb; (\x3c7;) (display \x3c7;) (\x5316; set! (call/cc set!))) \x3a3;)))-)
</quote>
Or, you can pretty-print it (that won't compromise its unintelligibility
in any way).
(import (rename (rnrs) (lambda λ) (set! 化)))
((λ ': ('"JdDvs" '"e ai\n"))
(λ (Σ)
(λ (set!)
(string-for-each
(λ (χ) (display χ) (化 set! (call/cc set!))) Σ)))
-)