This seems like a simple matter; perhaps it is so simple that it is difficult to find a search that will find the answer. In Scheme (specifically, the implementation of Guile, if that matters), how can I evaluate something that has been pointed out?
Here is what I am trying to do.
I basically need to make sure that the function that I define gets its arguments evaluated in a certain order, because the side effects caused by evaluating one argument depend on evaluating the other arguments. However, the diagram says that the arguments can be evaluated in any order, so I want to manually force it by specifying the arguments, and then manually evaluating them in the order in which it is necessary.
It looks like "eval" should do what I want, but it has two problems:
- Its use is discouraged, so I feel that there must be a better way to accomplish what I want to do here.
- The diagram shows that eval takes a second parameter, which is the environment. It bothers me. I want it to appear in the same environment in which the operator appears, so why do I need a second parameter? Is it possible? I played with eval a bit, and it seems that some implementations require different parameters (for example, mit-scheme does not even know what it is (interaction environment) !!!)
I tried other tricks, like building lambda:
(list 'lambda '() '(car (bc)))
but it looks like it would have to be evaluated to create a procedure. I also tried:
(list lambda '() '(car (bc)))
but this returns a "primitive inline macro" that doesn't work either.
Edit: It looks like the macro will work to control the evaluation order: (defmacro test1 (ab) `(begin, b, a))
source share