From J Wiki
Jump to navigation Jump to search

Beginner requirements, OOTB, Out-of-the-box experience, J7 migration, Language Slapdown final draft, famous computer scientists, role of programming for ideas, notation and thought, array thinking, visualizing J, publicity outside the J community

Location:: ThomasNet, New York, NY

Meeting Agenda for NYCJUG 20101214

1. Beginner's regatta: what do beginners need?  See "Thoughts from Gosi.pdf".

Starting to wrap up J7: what do we want to see?  See "J OOTB Experience
Suggestions.pdf".  What do we see now?  See "Introduction to J7 Server.pdf"
and "Moving from J6 to J7-myExperience.pdf".

2. Show-and-tell: final "LanguageSlapdown-Jin5Minutes-byDevonMcCormick.pdf".

Poster contest: caption for Ken?  See "Famous Computer Scientist Posters.pdf".

3. Advanced topics: notation and thought - see
"RoleOfProgrammingInFormulationOfIdeas_AIM-2002-018.pdf" and
"Notation And Thinking at Dick Lipton.pdf".

Further signs of APL's influence - see "IfYouAreUsingALoopYouAreDoingItWrong.pdf" -
and debate on the value of notation.

4. Learning, teaching and promoting J, et al.: breaking out of the box: an example
to publicize - see "ArrayThinkingAndVisualJ.pdf".  What other venues might we
consider?  See "Publicizing J in the Wider World.pdf".

Beginner's regatta

J and APL : Chicken and Egg?

We looked at File:Thoughts from Gosi.pdf on some "chicken and egg" problems, one of the most relevant being: how do you learn J if you're not already using it? How do you use J if you haven't already learned it?

He also has some questions and observations we should consider, like the following:

I am very often surprised to see people get impressed by J and then they do not start using it.
I am pretty sure that the number of J users are growing but I am also sure there a huge number who see it and do not start to use it.
I have all kinds of theories of why not.
One is that it takes some time to understand J and it takes some effort.
Many or most people do not want to spend the time needed to get past the barrier of understanding.
I do believe we need more text describing simple cases.
I have in many years tried to produce simple examples.
It is very hard to get feedback what is good and what is needed.

These latter two points have been repeatedly emphasized in our NYCJUG meetings: we need to better understand what beginners need and to make available numerous, simple examples of using J to accomplish common tasks.

The J "Out-Of-The-Box Experience" - Some Suggestions

We looked at File:J OOTB Experience Suggestions.pdf on how to improve the initial experience of J with the 7.01 version. Among the suggestions that seem to resonate the most with members of the group was this one:

The out-of-the-box experience is almost there for JHS. IMO it just needs some more work on the starting shortcut/batch file.

Introduction to J7 Server

The server is started with this command:

"C:\Program Files\J701\bin\jconsole" ~addons/ide/jhs/core.ijs -js " init_jhs_ '' "

The initialization code sets up the server to listen at local url The defaults are set in ~addons/ide/jhs/config/jhs_default.ijs. Some of these values are as follows:

NB. private port range 49152 to 65535
PORT=: 65001
NB. 0 localhost jlogin if PASS set; 1 localhost ok (no jlogin even if PASS set)
LHOK=: 1
NB. 'localhost' access from same machine; 'any' access from any machine (should set PASS)
BIND=: 'localhost'
NB. '' no jlogin; '...' jlogin password
PASS=: ''
NB. User ID for PASS; JUM ignores and sets USER to be JUM username (jhs folder)
USER=: ''

The core code for the server is here:

   CR+/ . =fread 'c:/program files/j701/addons/ide/jhs/core.ijs'

This code begins with extensive introductory comments about caching (which is avoided to prevent possible confusion), cookies and an overview of how the application works. We’ll start by looking at the input function.

NB. J needs input - y is prompt - '' '   ' '      '
input=: 3 : 0
   logjhs 'prompt'
   logapp 'jhs input prompt: ',":#y
      if. _1~:SKSERVER do. try. ".'urlresponse_',URL,'_ y' catch. end. end. NB. jijx
      if. _1~:SKSERVER do. jbad'' end.
      getdata'' NB. get and parse http request
      if. 1=NVDEBUG do. smoutput seebox NV end. NB. HNV,NV
      if. (-.OKURL-:URL)*.(0~:#PASS)*.(-.cookie-:gethv'Cookie:')*.-.LHOK*.PEER-:LOCALHOST
                             do. r=. 'jev_get_jlogin_ 0'
      elseif. 'post'-:METHOD do. r=. getv'jdo'
      elseif. '.'e.URL       do. r=. 'jev_getsrcfile_jfilesrc_ URL_jhs_'
      elseif. 1              do. r=. 'jev_get_',URL,'_'''''
   logapp 'jhs sentence: ',r
   if. JZWSPU8-:3{.r do. r=. 3}.r end. NB. empty prompt kludge
   r                                   NB. J sentence to run

      logappx 'input error'
      exit'' NB. 2!:55[11 crashes

This global is used above:

JZWSPU8=: 226 128 139{a. NB. empty prompt kludge - ​ \200B

The prompt in JZWSPU8 is a multi-byte HTML sequence, partially explained here (from

From UTF-8 to Unicode UCS-4: Let's take a UTF-8 byte sequence. The first byte in a new sequence will tell us how long the sequence is. Let's call the subsequent decimal bytes z y x w v u.

If z is between and including 0 - 127, then there is 1 byte z. The decimal Unicode value ud = the value of z.

If z is between and including 192 - 223, then there are 2 bytes z y; ud = (z-192)*64 + (y-128)

If z is between and including 224 - 239, then there are 3 bytes z y x; ud = (z-224)*4096 + (y-128)*64 + (x-128)

So, this prompt is (as stated in the comment):

   64 #. 226 128 139-224 128 128

Some other relevant globals are


This latter string is important because it names a locale, as seen in the fourth line of the input verb seen above:

      if. _1~:SKSERVER do. try. ".'urlresponse_',URL,'_ y' catch. end. end. NB. jijx

This response verb looks like this:

urlresponse_jijx_=: 3 : 0
if. 0=#y do.
 t=. JZWSPU8
 t=. (6*#y)$' '
 PROMPT_jhs_=: y
t=. '<div id="prompt" class="log">',t,'</div>'
d=. LOGN,t
if. METHOD-:'post' do.
 jhrajax d

So I don’t understand the following:

   JZWSPU8_jijx_=: a.{~226 128 161  NB. Change prompt to double dagger?

   a. i. PROMPT_jijx_
32 32 32
   a. i. JZWSPU8_jijx_
226 128 161
   JZWSPU8_jhs_=: a.{~226 128 161  NB. Change prompt to double dagger?

This latter attempt has the same (non-) effect. However, erasing JZWSPU8_jhs_ crashes the server, so the global is being used - it's just not obvious to me how it works to achieve the three spaces prompt.

File:Introduction to J7 Server.pdf

Moving from J6 to J7 – My Experience

Having an extensively customized J environment as I do required me to make a number of changes which I’ll outline here.

Changes to System Global Names

Perhaps the most critical change in J7 for me was the change in spelling of some of the handy default global variables, from the “j” locale, used for shortcuts and aliasing.

J 6.02 System Global J 7.01 System Global

It looks like we shouldn't be updating these globals directly as I did for my exercise - the GTKIDE configuration option for folders tells us

NB. name begins with lowercase - added to SystemFolders_j_
NB. name begins with uppercase - defines UserFolders_j_

so my customizations really belong here - is this used by jconsole as well? Maybe not...

Also, there appears to be a bug in how this folder configuration file is processed. For example, the following entries

User C:/amisc/JSys/user
Code ~User/code

do not result in Code being set to C:/amisc/JSys/user/code as one might expect.

Besides these name changes, the most pervasive change is the adoption of the forward slash as the path separator, a change I attempted - unsuccessfully - at the same time as the accommodation for the new globals. This backward-compatible accommodation took the following form:

buildPublic=. 3 : 0
   'nms fls'=. y
   if. nameExists 'Public_j_' do.
       Public_j_=: addOnlyNewNames Public_j_;nms;<fls
       PUBLIC_j_=: addOnlyNewNames PUBLIC_j_;nms;<fls


addOnlyNewNames=: 3 : 0
NB.* addOnlyNewNames: add name, file pairs, e.g. to PUBLIC_j_, for names not on list.
   'NmFlList nms fls'=. y
   'nms fls'=. boxopen&.>nms;<fls
   NmFlList=. NmFlList,,.&>/(<-.nms e. 0{"1 NmFlList)#&.>boxopen&.>nms;<fls
NB.EG PUBLIC_j_=: addOnlyNewNames PUBLIC_j_;('thing1';'thing2');<'\th1.ijs';'\th2.ijs'

This allows me to continue to use the same code with J 6.02 as with J 7.01 going forward.

One other change that affected me was the disappearance of the global variable IFCONSOLE. However, since this is due to the consolidation of the J engine, the necessity of using this also disappears.

Using the GTK interface seems to trigger an error upon using any of the “Configure” (Edit/Configure) options, but may reflect a problem with my machine rather than a J7 problem. In fact, this problem seemed to fix itself as subsequent attempts to invoke the configuration editor worked properly.

Quite a few of the problems I have encountered moving from J6 to J7 seem due to my idiosyncratic startup customizations being non-standard. I need to re-vamp these to be more in line with the J conventions such as the new GTKIDE config files mentioned above. However, my short-term goal is to minimize the differences between my J6 and J7 environments - I'd like to have an invariant code base between them, so I'll have to endure some teething pains in the near future.

Missing Libraries

Invoking my usual start routine turned up a number of files which appear to be missing from the J7 installation though I’m not completely sure about this as I had trouble run the package manager from behind a firewall. I fixed this by copying missing directories from J6. Missing are the directory “~system/packages” and many of the “~system/main” files.

Potential Improvements

Once I made it past the crashes of the GTK IDE caused by attempting to use the “Edit/Configure” options, I noticed some areas which could be improved. Here’s what the first part of the initial base configuration looks like: ConfigBase0.jpg

This starts out with useful explanation of possible values but then slacks off. The mention of the foreign conjunction values in the initial explanation could be augmented either by including that documentation directly or at least pointing out where to find it. Also, notice that “DisplayForm” is set twice.

However, this graphical interface to the simple text file of J commands is a good way to handle configuration files as it helps us remember where the file is located but gives us the option of modifying it by alternate methods.

File:Moving from J6 to J7-myExperience.pdf


Language Slapdown

I've put up my latest attempt to promote J in five minutes, also available as File:LanguageSlapdown-Jin5Minutes-byDevonMcCormick.pdf. This event was cancelled, so I didn't have a chance to give the talk but it may yet be re-scheduled.

Famous Computer Scientists

We briefly discussed a File:Famous Computer Scientist Posters.pdf - design your own Ken Iverson poster! This is based on some existing posters like this one featuring John McCarthy:


Advanced topics

Some thoughts about notation, programming and how these influence our thinking.

File:RoleOfProgrammingInFormulationOfIdeas AIM-2002-018.pdf

File:Notation And Thinking at Dick Lipton.pdf

File:IfYouAreUsingALoopYouAreDoingItWrong.pdf: some APL ideas are starting to bubble up into the collective consciousness but there's a lot still to be learned.

Learning, teaching and promoting J

File:ArrayThinkingAndVisualJ.pdf: some examples of using visual tools on the 'net for explaining J - see Bob Therriault's many examples.

File:Publicizing J in the Wider World.pdf: some suggestions and a caution about publicizing J outside our own, small community.