>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  User

This script defines core utilities for the J standard library. Definitions are loaded into the z locale.


A abspath, adverb, apply, assert
B bind, boxopen, boxxopen, bx
C clear, conjunction, CR, CRLF, cutLF, cutopen
D datatype, Debug, def, define, DEL, dfh, do, drop, dyad
E each, EAV, echo, EMPTY, empty, erase, every, evtloop, exit, expand
F fetch, FF, file2url, fixdotdot, fliprgb
G getalpha, getargs, getenv
H hfd
I inv, inverse, iospath, isatty, isutf16, isutf8, items
L leaf, LF, LF2, list
M monad
N nameclass, namelist, names, nc, nl, Note, noun
O on
P pick
R rows
S script, scriptd, setalpha, sign, sminfo, smoutput, sort, split, stderr, stdin, stdout
T TAB, table, take, timespacex, timex, tmoutput, toCRLF, toHOST, toJ, tolist, tolower, toupper, type
U ucp, ucpcount, usleep, utf8, uucp
V verb

abspath v absolute file system path name
adverb n integer 1
apply v apply verb x to y
bx v indices of 1's in boolean (same as I.)
conjunction n integer 2
CR n carriage return character
CRLF n CR,LF pair
cutLF v cut text on LF, removing empties
Debug n debug flag, initialized to 0
def c : (explicit definition)
define a : 0 (explicit definition script form)
DEL n ascii 127 character
dfh v decimal from hex
do v name for ".
drop v name for }.
dyad n integer 4
each a each (&.>)
EAV n ascii 255 character
echo v write argument to session
EMPTY n empty matrix (i.0 0)
empty v return empty result (i.0 0)
erase v erase namelist
every a every (&>)
evtloop v initialize event loop
exit v name for 2!:55 (exit)
fetch v name for {::
FF n formfeed character
file2url v convert to file:// format
fixdotdot v fix up a/b/c/d/../../e/../f to a/b/f
fliprgb v flip between argb and abgr byte order
getalpha v get alpha channel
getargs v get args
getenv v cover for get environment variable, 2!:5
hfd v hex from decimal
inv a inverse (^:_1)
inverse a inverse (^:_1)
iospath v iOS file system path
isutf16 v if character string is valid UTF-16
isutf8 v if character string is valid UTF-8
items a name for ("_1)
leaf a leaf (L:0)
LF n linefeed character
LF2 n LF,LF pair
monad n integer 3
nameclass v name for 4!:0
namelist v name for 4!:1
names v formatted namelist
nc v name for 4!:0
noun n integer 0
on c name for @:
pick v pick (>@{)
rows a rows ("1)
script v load script, cover for 0!:0
scriptd v load script with display, cover for 0!:1
setalpha v set alpha channel
sign v sign (*)
sminfo v info box or output to session
smoutput v output to session
sort v sort up
stderr v name for 1!:2&5
stdin v name for 1!:1&3 with obverse stdout
stdout v name for 1!:2&4
TAB n tab character
take v name for {.
tmoutput v output to stdout
toCRLF v converts character strings to CRLF delimiter
toHOST v converts character strings to Host delimiter
toJ v converts character strings to J delimiter (linefeed)
tolist v convert boxed to list
tolower v convert text to lower case
toupper v convert text to upper case
type v object type
verb n integer 3

assert (verb)

assertion failure if 0 e. y e.g. 'invalid age' assert 0 <: age

bind (conjunction)

binds monadic verb to an argument creating a new verb that ignores its argument. e.g. fini=: sminfo bind 'finished...'

boxopen (verb)

Box argument if open.

e.g. if script=: 0!:0 @ boxopen, then either
  script 'work.ijs' or script <'work.ijs'

See also boxxopen.

Use cutopen to allow multiple arguments.

boxxopen (verb)

Box argument if open and not empty.

See also boxopen.

clear (verb)

Clear all names in locale, returns any names not erased.


clear 'myloc'

cutopen (verb)

Cut argument if open. This allows an open argument to be given where a boxed list is required.

Most common situations are handled. it is similar to boxopen, except allowing multiple arguments in the character string.

x is optional delimiters, default LF if in y, else blank
y is boxed or an open character array.

if y is boxed it is returned unchanged, otherwise:
if y has rank 2 or more, the boxed major cells are returned
if y has rank 0 or 1, it is cut on delimiters in given in x, or
  if x not given, LF if in y else blank. Empty items are deleted.

e.g. if script=: 0!:0 @ cutopen, then

   script 'work.ijs util.ijs'

datatype (verb)

unicode/unicode4 are literal2/literal4 in J dictionary

expand (verb)

form: boolean expand data

isatty (verb)

Test whether a file descriptor refers to a terminal


list (verb)

syntax: {width} list data accepts data as one of:

 boxed list
 character vector, delimited by CR, LF or CRLF; or by ' '
 character matrix

formats in given width, default screenwidth

nl (verb)

Selective namelist.


[mp] nl sel

 sel: one or more integer name classes, or a name list.
       if empty use: 0 1 2 3.
 mp: optional matching pattern. If mp contains '*', list names
       containing mp, otherwise list names starting mp. If mp
       contains '~', list names that do not match.

e.g. 'f' nl 3 - list verbs that begin with 'f'
     '*com nl '' - list names containing 'com'

Note (verb)

Monadic form:

This enables multi line comments without repeated NB.-and requires a right parenthesis in the first column of a line to close. The right argument may be empty, numeric, text, or any noun. Reads and displays the comment text but always returns an empty character string so the comment is not duplicated on screen.

The right argument can number or describe the notes, e.g.

  Note 1     Note 2.2   or    Note 'The special case' etc.

Dyadic form:

This permits a single consist form of comment for any lines which are not tacit definitions. The left argument must be a noun. The function code displays the right argument and returns the left argument.


Note 1
... note text

split (verb)

Split head from tail.


   split 'abcde'
   2 split 'abcde'

table (adverb)

table - function table (adverb)


   1 2 3 * table 10 11 12 13
│*│10 11 12 13│
│1│10 11 12 13│
│2│20 22 24 26│
│3│30 33 36 39│

timespacex (verb)

Time and space for expressions.


[repetitions] timespacex 'expression'


   10 timespacex &> 'q:123456787';'3^10000x'
0.005 58432
0.061 52352

See also timex.

timex (verb)

Time expressions.


[repetitions] timex 'expression'

See also timespacex.

ucp (verb)

This is 7-bit ascii (if possible) or literal2 with UTF-16 encoding (compare uucp).

inverse is utf8.

ucpcount (verb)

Counts number of literal2 in a string when converted to UTF-16

A unicode codepoint has one or two literal2, this gives the number of literal2, not unicode codepoint

usleep (verb)

linux max value around 33 minutes
windows minimum resolution in milliseconds.

utf8 (verb)

Convert string to literal with UTF-8 encoding

Inverse of ucp.

uucp (verb)

Convert text to literal2 with UTF-16 encoding

This is always literal2 (compare ucp)

>>  <<  Usr  Pri  JfC  LJ  Phr  Dic  Voc  !:  Help  User