> will send '1+1' to the J session.
> Is there a simple way to get it to be executed also?
You want 0!:111 or some variation (your options are at [1]):
EXPR=:'1+1'
0!:111 EXPR
1+1
2
> What if EXPR contains LF? ...and yes, I was coming to that:
> what if EXPR is an explicit definition? ...Or even a whole
> script?
Your EXPR can be multi-lined: an entire J script (including explicit
definitions), in fact. And yet it doesn't introduce a new name context
(i.e. it can still access your local names, if you're calling it from an
explicit definition).
In fact, 0!: is exactly how "load" and friends work. Try for example
loadd 'script' (or 1 load 'script') or press CTRL+SHIFT+W (as opposed to
just CTRL+W) in an IJS window.
> Please don't say "only a fool would want to do that".
When do we ever say that here?
-Dan
[1] Definition of 0!: :
http://www.jsoftware.com/help/dictionary/dx000.htm
PS: A different, but related, function is provided by runimmx1_jijs_ .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm