Does this restrict use of J's strengths such as loose typing of different
numeric types and automatic extension to arrays? For instance, could I
define a single "sum" method that would work when used in the following
ways?
sum(1,2,3,4)
sum(1,2,3.14,4.56,5.67)
sum([table of numbers])
On 3/5/08, dly <[EMAIL PROTECTED]> wrote:
>
> Oleg - this solution fits right in to .NET and would probably lead to
> increased use of J!
>
> Donna
> [EMAIL PROTECTED]
>
>
>
>
>
> On 5-Mar-08, at 5:30 PM, Oleg Kobchenko wrote:
>
> > This is really interesting how managed to embed
> > J session into a .NET desktop application.
> >
> > Regarding calling J from .NET code, what I meant
> > that, in particular since people can be put off
> > by J code, it could even be more upsetting when
> > it is intermingled with C# code, even if it is
> > constructing simple expressions and calls to J verbs
> > defined in script.
> >
> > I think that it would cleaner if a calling convention
> > is established, so that from C# it looks almost like
> > calling another C# library.
> >
> > One way to achieve this is how Web Services are built--
> > with the use of generated artifacts. You start with a
> > separate J script file with certain syntax conventions
> > for top-level verbs; then you write a few verbs and
> > run the generator; it will produce the C# wrapper class
> > with those verbs as public methods; it is referenced and
> > imported into C# program; then simply instanciated and
> > called as any C# class.
> >
> > The syntax convention can even support multiple even
> > typed parameters. For example,
> >
> > NB.@ int add(int a, int b)
> > add=: 3 : 0
> > 'a b'=: y
> > a + b
> > )
> >
> > which in the generated artifact wrapper class will become
> >
> > class MyJLib {
> > JClass _j = new JClass();
> > ...
> > public MyJLib() {
> > _j.Do("load '~user/myj/myjlib.ijs'");
> > }
> > ...
> > public int add(int a, int b) {
> > _j.Set("a",a);
> > _j.Set("b",b);
> > _j.Do("z=: add a;b",b);
> > return _j.Get("z");
> > }
> > ...
> > }
> >
> > Now it is used simply:
> >
> > MyJLib jl = new MyJLib();
> >
> > int c = jl.add(11,22);
> >
> >
> > Note that such approach can easily generate other
> > interfaces: Web Services, Java beans, etc.
> >
> >
> > --- Alex Rufon <[EMAIL PROTECTED]> wrote:
> >
> >> Hello Oleg,
> >>
> >> Thanks for the links. Your examples are actually better and I'll
> >> use them on Saturday.
> >>
> >> In the last part of your email, you mention something about
> >> letting the developers feel the
> >> awesome power of interactive execution of a J Session.
> >> Unfortunately, the J session window
> >> "scares" them and the "cryptic" way of getting data from a
> >> database actually puts them off. So I
> >> created an application called SmartEOE.IDE. I did it partly as a
> >> solution to the problem and to
> >> actually build a true Model-Viewer-Controller application in C#.
> >> The idea is that the developers
> >> have a tree window for each Library->J Script and an editor window
> >> for the actual scripts. They
> >> can then run and test the script in the embedded J window at the
> >> same time it allows them to
> >> retrieve data from familiar data sources and be able to send it to
> >> the J session. I took some
> >> screenshots and uploaded them to my website in:
> >> http://amrufon.spaces.live.com/photos/cns!2B169BDA829381E6!194/
> >>
> >> I will be emphasizing that before they embed their J scripts into
> >> their C# code, they can test
> >> it out with "real" data in the IDE. So when they are happy, they
> >> can then proceed and update
> >> their C# code with the J script, compile then deploy.
> >>
> >> Of course, I will still show them that there is an option where
> >> they can encapsulate all of the
> >> code that uses J so that it becomes a black box library. Still, my
> >> intention right now is to get
> >> them interested to use in-line J scripts and then later on convert
> >> C# modules into J verbs
> >> leaving the C# function as a wrapper method.
> >>
> >> Again ... thanks. :)
> >>
> >> r/Alex
> >>
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED] [mailto:chat-
> >> [EMAIL PROTECTED] On Behalf Of Oleg Kobchenko
> >> Sent: Tuesday, March 04, 2008 7:28 PM
> >> To: Chat forum
> >> Subject: RE: [Jchat] Re: the purity of quantified conception
> >>
> >> You should be prepaired that developers may not be as
> >> technically naive as their technical managers.
> >>
> >> http://www.csharp-station.com/HowTo/StringJoinSplit.aspx
> >>
> >> So starting with this example you should admit that
> >> it was simple enough so that the managers would get it
> >> and be lured to get you guys here, but now we gonna
> >> talk about some real cool stuff.
> >>
> >> .NET has vast standard libraries that handles numerous
> >> stock operations on simple objects like strings and collections.
> >> Whereas the forte of J is a few really powerful operations
> >> which generalize over higher-order structures in compact
> >> yet expressive notation(*).
> >>
> >> To expand on the Join example, you can show how to turn
> >> a matrix into HTML table in a one-liner.
> >>
> >> A second example of the .NET/J distinction can be that
> >> J has no dedicated operation for SubStr found in mostly
> >> any language library. However is can be easily done with
> >> Cut <;.0 and easily generalized to simultaneous multiple
> >> substrings in a one-liner and to a sub-matrix etc.
> >> Related examples here are running average (infix) and matrix
> >> convolution with <;.3 (another cut).
> >>
> >> Of course C# developers are really excited about Linq. So you
> >> must show Linq as they've never seen before, the way
> >> it is done in J
> >>
> >> http://www.jsoftware.com/jwiki/DB/Flwor
> >>
> >> (*) J notation best preserves its clarity when maintained
> >> separately from the client calling code, so its best not
> >> intermingle C# and J code, but keep a thin calling layer
> >> with clean separate C# and J sources. To this end,
> >> it is helpful to organize J code with externally callable
> >> entry points (top-level verbs) and some kind of convention.
> >> It is the same with SQL. Also keeping it separate makes
> >> use of the full power of J session for trial-and-error
> >> experimentation--another advantage of interpretive environment
> >> worth showing off.
> >>
> >>
> >> --- Alex Rufon <[EMAIL PROTECTED]> wrote:
> >>
> >>> The WAN is down so I can't work ... then I accidentally click on
> >>> this email.
> >>>
> >>> I am basically the ONLY J programmer in our office. Were
> >>> basically a C# and VB.NET software
> >>> house but our core processing is done in J. Unfortunately, I am
> >>> the only J programmer (I can
> >>> repeat that as a mantra you know).
> >>>
> >>> For the longest time (going 8 years now), I've been trying to
> >>> convince other teams to adopt J
> >>> into their project ... and quite frankly I continue to fail.
> >>>
> >>> You said:
> >>> " People don't embrace J because, having been exposed to its awe-
> >>> inspiring qualities, they are
> >>> swept away by "the purity of quantified conception." That is
> >>> likely to be a factor, but
> >> without
> >>> a sense that J provides what they need in their actual context
> >>> they'll never go beyond initial
> >>> dabbling."
> >>>
> >>> Is VERY-VERY true.
> >>>
> >>> Last Saturday, I did another presentation to the Technical
> >>> Managers trying to convince them to
> >>> adopt J. But this time, I tried another approach (read this as
> >>> being sneaky). Instead of doing
> >>> examples on how it works, what the language is about and its
> >>> capabilities. I showed them how I
> >>> use C# with J to do the following:
> >>> 1. Array processing
> >>> 2. File processing
> >>> 3. Converting MS-SQL DataSet to SQL INSERT statements
> >>>
> >>> For the array processing, one of my example is creating the classic:
> >>> Select * from FRUITS where NAME in ('Orange','Apple','Banana')
> >>>
> >>> Normally, to do this in C#, they would have
> >>> string[] data = {"Orange","Apple","Banana"};
> >>>
> >>> What they actually need is to have the data in this format:
> >>> 'Orange','Apple','Banana'
> >>>
> >>> To do this in C# they have to loop through each of the item in
> >>> the array like so:
> >>> string result = "";
> >>> for (int i = 0; i < data.length; i++)
> >>> {
> >>> result += "'" + data[i].tostring() + "',";
> >>> }
> >>> // We have to remove the ending "," comma
> >>> if (result.length > 0)
> >>> {
> >>> result = result.trim(result.length - 1,1);
> >>> }
> >>>
> >>> Where if they use J, all they need to do is:
> >>> JSession objSession = new JSession();
> >>> string[] data = {"Orange","Apple","Banana"};
> >>> string result;
> >>> // Send the data to EOE
> >>> objSession.Variable("Temp1",(object)data);
> >>> // Process the data
> >>> objSession.Eval("res=: ',' charsep '''' ,~ each '''' with each
> >>> Temp1");
> >>> // this can even be shortened with
> >>> // objSession.Eval("res=: datasep Temp1");
> >>> // Get the data back to C#
> >>> result= (string)objSession.Variable("res");
> >>> // SQL command
> >>> string sqlCommand = "Select * from FRUITS where NAME in (" +
> >>> result + ")";
> >>>
> >>> And the other thing I pointed out is that in the original C#
> >>> code, they have to do this:
> >>> // We have to remove the ending "," comma
> >>> if (result.length > 0)
> >>> {
> >>> result = result.trim(result.length - 1,1);
> >>> }
> >>>
> >>> By putting things into the perspective of what they need now, I
> >>> may have some measure of
> >>> success. A few of the Technical Managers want to do another
> >>> session on Saturday but this time
> >>> they will be bringing their developers and wants a more detailed
> >>> discussion on the language.
> >> The
> >>> warehousing team is actually scheduling a meeting when I get back
> >>> to the Philippines for me to
> >>> help with their developers on data processing.
> >>>
> >>> I hope that this continues and I can encourage more people to
> >>> adopt the language. :)
> >>>
> >>> r/Alex
> >>>
> >>>
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED] [mailto:chat-
> >>> [EMAIL PROTECTED] On Behalf Of Tracy Harms
> >>> Sent: Friday, January 25, 2008 4:17 AM
> >>> To: [email protected]
> >>> Subject: [Jchat] Re: the purity of quantified conception
> >>>
> >>> Randy MacDonald wrote:
> >>>
> >>>> Happy New Year, Tracy;
> >>>
> >>> A belated Happy New Year to you, too, Randy.
> >>>
> >>>>
> >>>> My personal thought about that "law" that says all systems of
> >>>> sufficient complexity are equivalent to lisp, my thought is,
> >>>> that all matter of sufficient temperature becomes plasma. True,
> >>>> but not of much use in the ordinary world.
> >>>
> >>> I had not recognized the allusion to that saying, so thanks for
> >>> pointing it out.
> >>>
> >>>> BTW, did the xkcd post have such an effect on the lisp community?
> >>>
>
> >>> Touch�
>
> >>>
> >>> Perhaps there is a fine line between desiring to see the beauty
> >>> of J more widely recognized,
> >> and
> >>> falling into factional squabbling. Lisp has had a small but
> >>> fervent user base for a long time,
> >>> and XKCD is one manifestation of that. At the point I start
> >>> letting myself think "if they only
> >>> knew..." I've fallen off the edge into fantasy.
> >>>
> >>> People don't embrace J because, having been exposed to its awe-
> >>> inspiring qualities, they are
> >>> swept away by "the purity of quantified conception." That is
> >>> likely to be a factor, but
> >> without
> >>> a sense that J provides what they need in their actual context
> >>> they'll never go beyond initial
> >>> dabbling.
> >>>
> >>> --
> >>> Tracy
> >
> >
> >
> >
> >
> > ______________________________________________________________________
> > ______________
> > Be a better friend, newshound, and
> > know-it-all with Yahoo! Mobile. Try it now. http://
> > mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
--
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm