[Jprogramming] Getting J to work with .NET

Mark Needham m.h.needham at gmail.com
Mon Jul 12 07:25:23 HKT 2010


It's working for me with some statements in the ijs file but not when I
define a verb for some reason:
ijs file
result =: 2 + 2
square =: *:
centigrade =: verb define
t1 =. y - 32
t2 =. t1 * 5
t3 =. t2 % 9
)
Then I've got this code:
 var cSharpSession = new CSharpSession();
 cSharpSession.Load("C:/Playbox/JForTheWin/WillJWork/bin/Debug/script.ijs");
 cSharpSession.Eval("mark =: centigrade 5");
 var csharpResult = cSharpSession.Variable("mark");
 Console.Write(csharpResult);
where CSharpSession is the one from the other tutorial.
It blows up on trying to load the script with a 'value error' but it seems
to me that the definition is correct? Is there something else I need to do?
Cheers, Mark
On 9 July 2010 14:12, Alex Rufon <alex_rufon at ist-systems.com> wrote:
> Going home in a few minutes and sat back when I remembered you question.
>> For example, you have a script file: c:\foo.ijs
>> NB. START OF FILE
> foo=: verb define
> temp=. i. 5 5
> smoutput temp
> data=. ": {: "1 temp
> data fwrite 'c:\test.txt'
> )
>> NB. You should put this here to "auto-execute" the foo verb
> NB. this is a bit of a trick, there are others like
> NB. setting ARGV_z_ to a set of values and reference that
> foo ''
> NB. END OF FILE
>> So when you do the following in C#:
> var session = new Session();
> session.Load("c:\foo.ijs");
>> The file: C:\test.txt will be created.
>>>> -----Original Message-----
> From: programming-bounces at jsoftware.com [mailto:
> programming-bounces at jsoftware.com] On Behalf Of Mark Needham
> Sent: Friday, July 09, 2010 8:15 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Getting J to work with .NET
>> 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?
>> On 9 July 2010 12:20, Alex Rufon <alex_rufon at ist-systems.com> wrote:
>> > To get the result.
> >
> > Session Obj = new Session();
> > Obj.Eval("result=: 2 + 2");
> > Int result = 0;
> > Obj.Variable("result",result);
> >
> >
> > -----Original Message-----
> > From: programming-bounces at jsoftware.com [mailto:
> > programming-bounces at jsoftware.com] On Behalf Of Mark Needham
> > Sent: Friday, July 09, 2010 6:51 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Getting J to work with .NET
> >
> > Ah cool, thanks.
> >
> > So then if I've follow the instructions from there it should be
> > possible to execute some J by doing the following (in C#)
> >
> > new Session().Eval("2 + 2")
> >
> > ?
> >
> > I tried that but I wasn't really sure what I need to do to get the
> > result from that evaluation. Am I going about this the wrong way?
> >
> > Cheers, Mark
> >
> > On 9 July 2010 10:03, Alex Rufon <alex_rufon at ist-systems.com> wrote:
> >
> > > Hi Mark,
> > >
> > > I wrote that guide for J601a and it will fail miserably if you're
> > > using J602.
> > >
> > > Please refer to http://www.jsoftware.com/jwiki/Guides/J%20VB.NET for
> > > more information.
> > >
> > > r/Alex
> > >
> > > -----Original Message-----
> > > From: programming-bounces at jsoftware.com [mailto:
> > > programming-bounces at jsoftware.com] On Behalf Of Mark Needham
> > > Sent: Friday, July 09, 2010 3:44 PM
> > > To: programming at jsoftware.com
> > > Subject: [Jprogramming] Getting J to work with .NET
> > >
> > > I've been following the guide to try and get J to work with C# -
> > > http://www.jsoftware.com/jwiki/Guides/J%20CSharp - but trying out
> > > the included demo app I can't find the 'JExeServerLib' dll.
> > >
> > > It shows as an unfound reference in Visual Studio and I don't see it
> > > on the COM list of dlls.
> > >
> > > Any ideas?
> > >
> > > Thanks, Mark
> > > --------------------------------------------------------------------
> > > -- 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
> > ----------------------------------------------------------------------
> > 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 によって変換されたページ (->オリジナル) /