Re: [racket-users] Re: using vim to play with racket

2017-12-20 Thread Greg Hendershott
> Try giving `eval` a namespace that includes `racket/base`:
>
> (define ns (make-base-namespace))
> (eval '(+ 1 2) ns)

p.s. If you don't supply the second, namespace argument to `eval`, it
defaults to `(current-namespace)` -- which by default is an empty
namespace.

So, you can also change the value of the `current-namespace`
parameter, around one or more calls to `eval`:

(parameterize ([current-namespace (make-base-namespace)])
  (eval '(+ 1 2))
  (eval '(+ 1 41)))

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: using vim to play with racket

2017-12-20 Thread Greg Hendershott
> This won't actually work with an argument like "(+ 2 3)", Racket complains
> that
> the '+ is an undefined identifier, but that's a problem on the Racket side
> (I
> don't know that much about Racket yet to be able to do eval magic), not on
> the
> editor side. The RacketEval function is like any other Neovim function,

Instead of `eval` using a default, empty namespace:

(eval '(+ 1 2))

Try giving `eval` a namespace that includes `racket/base`:

(define ns (make-base-namespace))
(eval '(+ 1 2) ns)

See https://docs.racket-lang.org/guide/eval.html#%28part._namespaces%29

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.