For Programmers: Free Programming Magazines  


Home > Archive > Scheme > February 2008 > scheme stack allocation









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author scheme stack allocation
joeschmoe9876@gmail.com

2008-02-11, 7:28 pm

I have a few problems I cant figure out, If anyone could help, that
would be great!

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.
Barry Margolin

2008-02-12, 4:35 am

In article
<266e3426-a208-41ce-9a82-319c5a451221@l1g2000hsa.googlegroups.com>,
joeschmoe9876@gmail.com wrote:

> I have a few problems I cant figure out, If anyone could help, that
> would be great!
>
> 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, barmar@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 ***
Aaron Hsu

2008-02-13, 4:34 am

On 2008-02-11 23:28:34 -0600, Barry Margolin <barmar@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.

--
Aaron Hsu <arcfide@sacrideo.us>
http://www.sacrideo.us

Jens Axel Soegaard

2008-02-13, 4:34 am

joeschmoe9876@gmail.com skrev:
> I have a few problems I cant figure out, If anyone could help, that
> would be great!
>
> 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.


How many stacks do we have?

--
Jens Axel Søgaard
Barry Margolin

2008-02-13, 7:19 pm

In article <2008021222480416807-arcfide@sacrideous>,
Aaron Hsu <arcfide@sacrideo.us> wrote:

> On 2008-02-11 23:28:34 -0600, Barry Margolin <barmar@alum.mit.edu> said:
>
>
> 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.

--
Barry Margolin, barmar@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 ***
Aaron Hsu

2008-02-14, 4:36 am

On 2008-02-13 17:01:26 -0600, Barry Margolin <barmar@alum.mit.edu> said:

> 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.
--
Aaron Hsu <arcfide@sacrideo.us>
http://www.sacrideo.us

Jed Davis

2008-02-14, 7:18 pm

joeschmoe9876@gmail.com writes:

> 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;)))-)
Abdulaziz Ghuloum

2008-02-14, 7:18 pm

Jed Davis wrote:

<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!))) Σ)))
-)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com