this post was submitted on 21 Nov 2023
1 points (100.0% liked)

Lisp

53 readers
3 users here now

founded 1 year ago
MODERATORS
 

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?

you are viewing a single comment's thread
view the rest of the comments

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).