Warm tip: This article is reproduced from serverfault.com, please click
j vim

Run J script as if it were line-by-line entered into the interpreter

发布于 2020-12-01 17:48:39

Is there a way to run the script as if it were typed into the interpeter? The benefits are that I don't need echos everywhere, the work done is saved as a file, and I can use vim to do the editing. Example:

example.ijs

x =. 1
x + 3

terminal

   x =. 1
   x + 3
4

If not, I'll write a vimscript that can do the above then share them here. The advantage of a vimscript solution is that I could have commands to run the entire file, the current line, the current selection, everything up to and including the current line, or whatever else is useful.

Related but not a duplicate: How to call J (ijconsole) with a script automatically

Questioner
JDG
Viewed
0
Tikkanz 2020-12-07 04:39:57

Use loadd rather than load to run the script and display the lines and results.

   loadd 'example.ijs'
   x =. 1
   x + 3
4