I suggest looking at: http://www.jsoftware.com/jwiki/Guides/J%20CSharp#Methods
-----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Alex Rufon Sent: Friday, July 09, 2010 8:53 PM To: Programming forum Subject: Re: [Jprogramming] Getting J to work with .NET I wrote a wrapper function for that, so you can just do: var session = new Session(); session.Eval("result=: 2 + 2"); var result = session.Variable("result"); Console.Write(result); session.Load("C:\samplescript.ijs"); but it's essentially the same as what Raul is suggesting: /// <summary> /// Loads an external script into the current J session /// </summary> /// <param name="fileName">Complete path and filename to the script to be loaded</param> public void Load(string fileName) { string script; // Assign the filename to a J variable this.Variable("script2load",fileName); // Check if were in debug mode first. if (this.debug) { // Were debugging so we show what were loading and stop on error script = "0!:001 < script2load"; } else { // Not debugging, dont need to show script script = "0!:0 < script2load"; } // Now evaluate the script. this.Eval(script); } -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Raul Miller Sent: Friday, July 09, 2010 8:21 PM To: Programming forum Subject: Re: [Jprogramming] Getting J to work with .NET On Fri, Jul 9, 2010 at 8:15 AM, Mark Needham <[email protected]> wrote: > Cool! I changed it a little to work in C#: > > var session = new Session(); > session.Eval("result=: 2 + 2"); > var result = session.Variable("result"); > Console.Write(result); > > What would I need to do if I wanted to execute a J script file > directly rather than just individual expressions? session.Eval("0!:0<'script.ijs'"); ought to work Or, if you want a dynamic name, use a variable to identify the script. -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
