[Jprogramming] Getting J to work with .NET

Mark Needham m.h.needham at gmail.com
Fri Jul 9 20:51:04 HKT 2010


Ah cool - thanks. I was originally following the instructions from there but
I thought I wasn't supposed to seeing as I'm using j602 instead of j601!
I've got it running a script following what you guys said either way which
is pretty cool!
On 9 July 2010 14:00, Alex Rufon <alex_rufon at ist-systems.com> wrote:
> I suggest looking at:
> http://www.jsoftware.com/jwiki/Guides/J%20CSharp#Methods
>> -----Original Message-----
> From: programming-bounces at jsoftware.com [mailto:
> programming-bounces at jsoftware.com] 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: programming-bounces at jsoftware.com [mailto:
> programming-bounces at jsoftware.com] 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 <m.h.needham at gmail.com>
> 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
>


More information about the Programming mailing list

AltStyle によって変換されたページ (->オリジナル) /