NYCJUG/2010-06-15

From J Wiki
Jump to navigation Jump to search

Thinking in J, notation as a tool of thought, example of easy-to-understand PostScript, IDE, emacs, GTK, poker in J, motivation to code

Meeting Agenda for NYCJUG 20100615

1. Beginner's regatta: Thinking in J - see File:ThinkingInJ.pdf.

Drinking in J - see the NYCJUG placemat "NYCJUGPlacemat.ps".

2. Show-and-tell: An example of "Brownian Tree" J code for Rosetta Code - see File:DiffLimAggForRCeg.pdf.

3. Advanced topics: J 7.01 IDE versus emacs - how do I get "viewmat" to work? See File:JgtkIJS-1st6pp.pdf, File:J GTKIDE IJS-1st6pp.pdf and File:JGTKworking.pdf.

4. Learning, teaching and promoting J: Tracy Harms's poker talk - see File:TracyHarmsPokerTalk.pdf and File:ExamplesOfMotivationsToCode.pdf.

Beginner's Regatta

Thinking in J

From Dan Bron <j@bron.us>
To Chat forum <chat@jsoftware.com>
Date Wed, Jun 9, 2010 at 2:33 PM
Subject Re: [Jchat] on the J thought style again

Alexander Mikhailov wrote:

> "from the input array, take first element and do Foo to it.
> If the result is X, stop, otherwise get second element and
> do Foo to it. If the result is X, stop... etc. If the
> result of last element is still not X, return Y"

Roger Hui wrote:

> foo=: >:
> X=: 6
> }.^:(X ~: foo@{.)^:_ ] 3 1 4 1 5 9
> 5 9

Thomas Costigliola wrote:

> I think you can omit the second ^: for tiny performance gain:
> (}.~ X ~: foo@{.)^:_ ] 3 1 4 1 5 9
> 5 9

Very clean, very elegant. So, to finish the solution, and implement the "else, return Y" clause (as well as the implied "return a single value" constraint), we might write:

   ([: {.!.Y (}.~ X ~: foo@{.)^:_ ) 3 1 4 1 5 9
5

Making this a reusable verb:

   foo =: >:
   X =: 6
   Y =: _999
   justFooIt =: [: {.!.Y (}.~ X ~: foo@{.)^:_
   justFooIt 3 1 4 1 5 9
5

Now let's confirm the "else, return Y" logic. We'll change X so it's not found in the input, and re-fix the definition of justFooIt to pick up the new value of X:

   X =: 11
   justFooIt =: [: {.!.Y (}.~ X ~: foo@{.)^:_
   justFooIt 3 1 4 1 5 9
_999

Drinking in J

We have an official J drink organizer! Well, actually it's a bit of modified Postscript originally intended as an organizer for drinks in a port tasting (as you can possibly tell from the unaltered title). Someone made an APL/J/K placemat out of it:

APLJKplacemat.jpg

We have since modified it as an NYCJUG version:

NYCJUGPlacemat.jpg

There was a bug in the original adaptation for the APL/J/K version. Having the titles font set to "/TimesNewRomanPS-BoldMT" resulted in the letter "h" rendering as the letter "Ü", so we saw this:

ATW with TimesNewRomanPS-BoldMT font.jpg

The original from which these were adapted is found here.

Show and Tell

Diffusion-limited Aggregation

We looked at some J code for diffusion-limited aggregation, a topic eventually dealt with at length, as seen here, continuing here, culminating in this code.

Advanced Topics

We looked at J's GTK interface in some detail but, since this is no longer supported, we will not go into detail on this here.

Anyone interested in this can consult the relevant documents: File:JgtkIJS-1st6pp.pdf, File:J GTKIDE IJS-1st6pp.pdf and File:JGTKworking.pdf.

Learning, Teaching, and Promoting J

Correspondence About Promoting J

From:	 Devon McCormick <devonmcc@gmail.com>
Date:	 Tue, Jun 1, 2010 at 10:19 AM
Subject: How did your poker talk go?

Hi Tracy - I was just reminded of your talk a while back on using J to score poker hands.

How did it go? Did people seem open to the "weird" notation or did you conceal it? Do you have any tips on doing this sort of thing in the future?

Maybe you can chime in with a summary of this if you attend the next NYCJUG - we should have a tele-presence on this one this month (6/8).

Thanks,

Devon


From:	 Tracy Harms <kaleidic@gmail.com>
Date:	 Tue, Jun 1, 2010 at 3:04 PM
Subject: Re: How did your poker talk go?

Hi, Devon.

Giving that talk was a rush. I've had few opportunities to share my enthusiasm over the years, so I put a lot into this. I had a very receptive audience. The main shortcoming was that I attempted to present more than the allotted time accommodated. I ran over by at least a half hour. Most of my audience stayed with me, though, and the few who left before I finished left at the point where the talk was scheduled to be done.

I didn't hide the weird notation at all. I did have one explicit verb with a select.case. structure but most of what I showed was more typical. After all, I wrote the code to solve the problem to my satisfaction, and only after I'd written it did I decide to use it as introductory material. I only focused on a portion of the code, trying to emphasize the relationship between my thoughts about the problem domain and the code I wrote to fit it.

There were definitely some "aha!" moments in the crowd. For example, my eldest son (who has remained remarkably aloof from J, given how obsessed I've been) was really struck by the availability of Obverse via Power.

I don't know whether telepresence at next week's NYCJUG will be possible for me. It's a maybe, though.

Thanks for remembering that I'd given that talk, and inquiring. I look forward to future occasions to help people learn J. I should contact the people who attended, to see who may have additional interest. There were 17 people there, not including me.

-- Tracy