Re: local eval

2023-04-27 Thread Damien Mattei
`(quote ,Largs) `(cons (quote ,(car Largs)) (quote-all ,@(cdr Largs) ;; but we then have to eval-uate all the expression at end (define-macro ($nfx$ . Largs) `(local-eval (infix-with-precedence2prefix (! (quote-all ,@Largs))) (the-environment))) and with the magic re-export in module: ;;

Re: local eval

2023-04-26 Thread Damien Mattei
ompute expr env) (display "evaluate : expr =") (display expr) (newline) ;;(eval expr2eval (interaction-environment))) (local-eval expr2eval env)) i just need the good macro that finally replace the last line: (local-eval expr2eval env) evaluate the expression expr2eval in the environment

Re: local eval

2023-04-26 Thread Mikael Djurfeldt
al-var > (syntax-rules () > ((_ var) var))) > > ? > > Then you don't need to import (ice-9 local-eval) and re-export things from > there. > > Just for elucidation: > > The reason why we chose the syntax-case macro system for Guile was that it > *both* g

Re: local eval

2023-04-26 Thread Mikael Djurfeldt
How about: (define-syntax eval-var (syntax-rules () ((_ var) var))) ? Then you don't need to import (ice-9 local-eval) and re-export things from there. Just for elucidation: The reason why we chose the syntax-case macro system for Guile was that it *both* gives you hygiene *and* qu

Re: local eval

2023-04-26 Thread Robby Zambito
Damien Mattei writes: > i can not make it run i always have something unbound , not reach the var i > but local-eval is unbound now? I added this line to the module definition #:re-export (local-eval the-environment) Did you also add that? The way the unhygienic macros wo

Re: local eval

2023-04-26 Thread Damien Mattei
i can not make it run i always have something unbound , not reach the var i but local-eval is unbound now? On Mon, Apr 24, 2023 at 6:24 PM Damien Mattei wrote: > thank you, i will try the old macro form. > Damien > > On Mon, Apr 24, 2023 at 4:24 PM Robby Zambito > wrote: >

Re: local eval

2023-04-24 Thread Damien Mattei
thank you, i will try the old macro form. Damien On Mon, Apr 24, 2023 at 4:24 PM Robby Zambito wrote: > > Whoops I had a duplicate export from when I was testing with things, but > you get the idea :) >

Re: local eval

2023-04-24 Thread Robby Zambito
Hi Damien The issue you are running into is related to macro hygiene. If you implement eval-var using the non-hygienic define-macro, it works how you want. (define-module (Scheme+) #:use-module (ice-9 local-eval) #:re-export (local-eval the-environment) #:export (eval-var eval-var

local eval

2023-04-24 Thread Damien Mattei
hello, i need to local eval some vars for an infix evaluator but i can not find a way to use local eval in my context,here is an example that illustrate my problem: ;; file Scheme+.scm (define-module (Scheme+) #:use-module (ice-9 local-eval) #:export (eval-var)) (include-from-path "