| xdef in ac.scm exports Scheme procedures to Arc, but it's ugly to have to add every Scheme procedure I want to use to ac.scm. Anarki has seval which evals a Scheme expression, so another way to get at a Scheme procedure is to say: (= semaphore-post (seval 'semaphore-post))
which is much nicer. However, if I'm only using a Scheme procedure in one place in my code, I don't want to have to stop to make it a top level function, or clutter my top level namespace. I'd like to be able to say ... code code code ...
((scheme post-semaphore) s)
... code code code ...
with (scheme x) being expanded a macro expansion time, instead of being evaluated at run time like seval is.Since there's the limitation of not being able to return a procedure value from a macro expansion, I can't just say (mac scheme (x) (seval x))
so I was starting to think about hacks like having the macro set a uniq global variable and then expanding to that variable... when I thought, "oh wait, Arc is getting compiled to Scheme, so all that needs to happen is to have (scheme x) insert x in the compiled output".So add to the definition of ac in ac.scm: ((eq? (xcar s) 'scheme) (cadr s))
and, that simply, (scheme x) does what I'm looking for. |