1
$\begingroup$

I'm reading The implementation of functional programming languages (1987) by Peyton Jones and he mentions (p.307) that the MKAP (make application) instruction is more convenient if the argument is pushed first, followed by the function, and then MKAP. So for example if f x y was being compiled, the G-code would be

PUSH y
PUSH x
PUSH f
MKAP
MKAP

rather than the more natural order of pushing the function first, then the argument:

PUSH f
PUSH x
MKAP
PUSH y
MKAP

The second order appears more intuitive because it follows a left-to-right application order. However, Peyton Jones states that the first order is more convenient. He says this will be shown later in the book but I can't find his reasoning anywhere.

What are the concrete advantages of the argument-first order for MKAP?

asked Mar 30 at 23:56
$\endgroup$

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.