Question

write the shortest ML function you can that would not work correctly if implemented using statically...

write the shortest ML function you can that would not work correctly if implemented using statically allocated activation records. explain why it would fail. (hint: try to think ld a recursive function such that the calling activation's x is needed after recursice call)

write the shortest ML function you can that wouls not work correctly if implemented using a dynamically allocated stack kf activation records plus nesting link. why it would fail. (hint: think of function has degree three with two anonymous functions as arguments)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

fun x 1 = 1

|   x n = x (n - 1);

---

all the best

please upvote

2)

fun f x =
  let
    fun g y = x + y
  in
    g
  end;

Fails since a dynamically allocated stack of activation records plus nesting links will not accommodate the return value of a function which requires the use of values from the containing function.

Add a comment
Know the answer?
Add Answer to:
write the shortest ML function you can that would not work correctly if implemented using statically...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT