In the eval function of chapter 4 we have different eval-foo…s, which deal with the special syntax. Why the apply function is not just part of eval function. So we could have some dispatch condition in case analysis such as …((application? exp) (eval-application exp env))… . Why do we make it harder?

  • ManWhoTwistsAndTurns@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Besides the concept distinction, there is a purely practical concern in that you want apply to be available as a callable function in instances where you have a list of values you wish to supply as arguments to a function. i.e. Ordinary function calls have the form (function arg1 arg2...), but in some cases the values arg1/arg2/… aren’t bound to symbols(or there could be an arbitrary number of them not known at compile time) but are the elements of a list args, so you can write (apply 'function args).