J4.05 is available for Linux and Sun and won't be available for other Unix platforms. All effort will be put into expediting the J4.06 release for all supported Unix platforms. Earlier releases are available for other Unix systems.
License - prokey
J is free on all platforms! You can download, redistribute, and run J for free.
There is a fee for a professional key (prokey) that enables features required for
commercial development of large systems.
A prokey enables: debug suspension, performance monitor, and ijl
encoding. The prokey is queried and set by 9!:30 and 9!:31.
13!:0[1 (debug suspension) or 6!:10 (performance monitor) or
3!:6 (ijl encode) fail with domain error if a prokey is not set.
A prokey is licensed for a single user on a single system.
Verb prokey, defined in profile, sets a prokey in your home
directory in file .j_prokey. When you start J, profile reads this
file as an argument to 9!:31. To set this file with key '1234-123-1234'
start J and run the following:
prokey '1234-123-1234'
J can be downloaded and installed from www.jsoftware.com
in 3 parts : jconsole (platform dependent binary), J library, and J help.
Run jconsole to run J and Control-d to exit.
jconsole gives a file name error for profile.ijs if it can't find the J library.
J is running, but without profile.
jconsole looks for the library in /usr/local/lib/j and loads profile. Set the JLIB
environment variable to have it look elsewhere.
Run jconsole -jnoprofile to not load the profile.
With profile loaded:
JDIR_j_
- full path of library directory
jhelp 'netscape' - run browser on J help
J4.05 for Unix is one level behind the J for Windows release. J help documents the latest release and has some Windows centric bias. Unix users must exercise patience and common sense in figuring out what does and does not apply and in ignoring or interpreting the Windows centric material. The Dictionary, Release, and Phrases books, except for obvious release and system differences, apply to J for Unix. The Primer applies, except as noted in the text. The User manual has useful material for Unix users, but has lots of Windows stuff. The Index applies except for references to Windows only scripts and labs.
readline
jconsole uses readline to get input. See the readline man page.
Edit the inputrc file to add J specific macros. For example, to have a J macro to advance
a lab add the following:
$if jconsole
Control-j: "labgo 0\r"
$endif
In J, Control-j executes labgo'' which advances a lab to the next step.
Labs can teach you all kinds of things and are a good way to start learning J.
Labs are a series of steps where the computer
gives you the next piece of information, shows you examples, and then lets you
experiment before proceeding. Use the following for Labs:
lablist '' NB. lab categories
lablist 1 NB. labs in category 1 (language)
labrun 8 NB. run lab 8 - A Taste of J (1)
labgo '' NB. advance to next section in lab
If you defined the readline Control-j macro, use Control-j to advance through the lab.
J can call external libraries with the dll call facility provided by the 15!:x foreign family. You can write applications in J that use routines from other languages and system libraries just like a C programmer. load 'dll' to define utilities for system calls and routines written in other languages.
Socketsload 'socket' to define utilties for working with sockets. These utilities use dll call to call the system socket routines. There are socket labs.
Regular expressionsload 'regex' to define utilties for working with regular expressions. These utilities use dll call to call the system regex routines. There is a regex lab.
#! J scripts
A #! J script (hash bang J script)
is a text file that starts with #!/usr/local/bin/jconsole and has been made executable with chmod +x.
Try the following:
create file sumsquares with 3 lines of text:
#!/usr/local/bin/jconsole
echo +/*:0".>,.2}.ARGV
exit''
make it executable and run it
./sumsquares 1 2 3 4 5
Use NB. to comment out the exit'' to stay in J.
Profile loads jconsole with the following definitions that are
useful in #! J scripts:
ARGV - boxed list of jconsole, script name, and arguments
echo - format and display output
getenv - get value of environment variable
stdin - read from standard input
stdout - write to standard output
stderr - write to standard error
exit - exit J (arg is return code)
stdin is defined with stdout as its obverse (see the :.
conjunction). When used with &. (under conjunction), as
in foo&.stdin '' stdin is first called, reading all of standard
input. That input is the argument to foo, and the result is passed
to the inverse of stdin, which is stdout. A verb which
transforms a character list can be combined with the stdin verb
with under to apply the transformation as a Unix filter.
As an example we will create a Unix filter which reverses all the
characters in a file. Rather than just using |. we'll use
(|.@}: , {:) which reverses all but the last character, and
appends the last character to it. For files which end in a newline,
this reverses the file keeping that newline at the end. Define the
#! J script reverse as follows:
#!/usr/local/bin/jconsole rev=. |.@}: , {: rev&.stdin '' exit''If you wanted to do a complete reverse of a file which does not end in a newline you could do the following:
The verb defined below calls a program, writes to its standard input, and reads its output.
run=: 4 : 0 'p o i'=. 2!:2 x. NB. Run command, save Process, Output, Input y. fwrite i NB. Write to its input fclose i NB. Close its input 2!:3 p NB. Wait for process to terminate z=.fread o NB. Read its output fclose o NB. Close its output z NB. Result )