--------------------------------------------------------------------- J Web Page: www.jsoftware.com Internet discussion group: comp.lang.apl Comments and suggestions: cdburke@interlog.com (Chris Burke) Revision Date: 1997-06-06 ---------------------------------------------------------------------
J is a very high level general-purpose language, with a strong emphasis on functional programming and array processing. J was designed and developed by Ken Iverson and Roger Hui, and implemented by Iverson Software Inc (ISI).
J is distinguished by its simple and consistent rules, a large set of built-in functions, powerful facilities for defining new operations, and a general and systematic treatment of arrays. It is ideal for complex analytical work, modelling, and rapid application development.
It is available on most popular hardware platforms, and the script files used to represent programs are completely portable.
The current system is "J Release 3" (J3). The current version number is 3.04 (May 1997).
There are four manuals:
This is the reference manual for J, and includes introductory tutorials on various aspects of the language.
This manual explains the application development environment and J utility programs that are included with the Windows version, and includes sample applications and templates.
This book contains several hundred phrases useful to beginners in learning the language as well as to experienced programmers.
A gentle introduction to J for the beginner.
J is available on Windows 95/NT, Windows 3.1, DOS 386, Linux, Mac, PowerMac, RS/6000 and Sparc. The Windows 3.1 version runs in Windows under OS/2. The core language is the same on all platforms; programs not making use of platform-dependent features will work unchanged on all systems.
In each case, the language is a full 32 bit implementation with no limit on object size.
An application development environment is currently included only with the Windows and Mac versions, while other systems consist solely of the J language.
J can be used as an OLE Automation server:
The JEXEServer is the full J development system, giving full access to both the client and the J server environments.
The JDLLServer is the J interpreter only, accessed as an in-process server. This is very efficient and is ideal for runtime applications.
The J DLL can also be called directly as an ordinary 32-bit DLL without using OLE, by any application capable of calling 32-bit DLLs.
J supports 32-bit ODBC database access, with drivers for most popular databases, and DDE. J can call procedures in 32-bit DLLs.
Requirements: Windows 95 or NT, 8 MB RAM (more is better), 8 MB hard disk.
Database access is 16-bit ODBC, and DLL calls are to 16-bit DLLs.
Requirements: Windows 3.1 or later, 8 MB RAM (more is better), 8 MB hard disk. This product also runs under the Windows 3.1 capability of Windows 95/NT and OS/2.
Requirements: Mac System 7 or PowerMac, 8 MB RAM (more is better), 8 MB hard disk.
Evaluation $0 time-limited system Educational $50 educational use only Standard $150 one time price - no upgrades Professional $325 includes upgrades for next 15 months
Windows 95/NT - full executable Windows 95/NT - J DLL only Windows 3.1 - full executable
Any disk set $75
Dictionary+User Manual+Phrases+Primer $160Purchased separately:
Dictionary $50 User Manual $50 Phrases $40 Primer $40 Concrete Math Companion (Ken Iverson) $40 Exploring Math (Ken Iverson) $50 Fractals Visualization and J (Clifford Reiter) $50
J is distributed by Strand Software Systems, and other authorized dealers. For information, contact:
Anne Faust email: sales@jsoftware.com Strand Software 19235 Covington Court Shorewood, Minnesota 55331 tel: 612-470-7345 fax: 612-470-9202Local dealers:
Sylvain Baron Sylicom 184, rue Marcel Hartmann 94200 IVRY Paris, France Tel: 331 4521 9850 Fax: 331 4521 9851 Gert Osterburg Technoma Gmbh AM Hochholz 7 Karben 5 FRG 61184 Tel: 6034 2995 Fraser Jackson MasterWork Software Ltd Postal Address: Delivery Address: PO Box 56-036 77 Larsen Crescent Tawa Tawa Wellington Wellington New Zealand New Zealand Tel: +64(4) 232-4440 Fax: +64(4) 232-4440 Richard Hill Adaptable Systems 49 First Street Black Rock, Victoria 3193 Australia Tel: 613 9589 5578 Fax: 613 9589 3220 Email: hillrj@ibm.net tel: 613 9589 5578 fax: 613 9589 3220 Bjorn Helgason Fugl & Fiskur hf Spitalastig 4 101 Reykjavik Iceland Tel: 354-562-5441 or 354-550-6462 Email: bjornhp@simi.is Joachim Hoffmann Muenzgrabenstrasse 68 / 4 A-8010 Graz Austria Tel: 43 316 81 45 29 Fax: 43 316 68 42 43
The following is excerpted from the Introduction and Dictionary:
J is a general-purpose programming language available on a wide variety of computers. Although it has a simple structure and is readily learned by anyone familiar with mathematical notions and notation, its distinctive features may make it difficult for anyone familiar with more conventional programming languages.
Aspects of J that distinguish it from other languages include:
The alphabet is standard ASCII, comprising digits, letters (of the English alphabet), the underline (used in names and numbers), the (single) quote, and others (which include the space) to be referred to as graphics. Alternative spellings for the national use characters (which differ from country to country) appear on page 180.
Numbers are denoted by digits, the underbar (for negative signs and for infinity and minus infinity when used alone or in pairs), the period (used for decimal points and necessarily preceded by one or more digits), the letter e (as in 2.4e3 to signify 2400 in exponential form), and the letter j to separate the real and imaginary parts of a complex number, as in 3e4j_0.56. Also see page 201. A numeric list or vector is denoted by a list of numbers separated by spaces. A list of ASCII characters is denoted by the list enclosed in single quotes, a pair of adjacent single quotes signifying the quote itself: 'can''t' is the five-character abbreviation of the six-character word 'cannot'. The ace a: denotes the boxed empty list <$0 .
Names (used for pronouns and other surrogates, and assigned referents by the copula, as in prices=. 4.5 12) begin with a letter and may continue with letters, underlines, and digits. A name that ends with an underline is a locative, as discussed in Section II.H. A primitive or primary may be denoted by any single graphic (such as + for plus) or by any graphic modified by one or more following inflections (a period or colon), as in +. and +: for or and nor. A primary may also be an inflected name, as in e. and o. for membership and pi times. A primary cannot be assigned a referent by a copula.
The following sentences illustrate the six parts of speech:
fahrenheit=. 50 (fahrenheit-32)*5%9 10 prices=. 3 1 4 2 orders=. 2 0 2 1 orders * prices 6 0 8 2 PARTS of SPEECH +/orders*prices 16 50 fahrenheit Nouns/Pronouns +/\1 2 3 4 5 + - * % bump Verbs/Proverbs 1 3 6 10 15 / \ Adverbs bump=. 1&+ & Conjunction bump prices ( ) Punctuation 4 2 5 3 =. CopulaVerbs act upon nouns to produce noun results; the nouns to which a particular verb applies are called its arguments. A verb may have two distinct (but usually related) meanings according to whether it is applied to one argument (to its right), or to two arguments (left and right). For example, 2%5 yields 0.4, and %5 yields 0.2.
An adverb acts on a single noun or verb to its left. For example, +/ is a derived verb (which might be called plus over) that sums an argument list to which it is applied, and */ yields the product of a list. A conjunction applies to two arguments, either nouns or verbs.
Punctuation is provided by parentheses that specify the sequence of execution as in elementary algebra.
The word =. behaves like the copulas is and are in English, and is read as such, as in area is 3 times 4 for area=. 3*4. The name area thus assigned is a pronoun and, as in English, it plays the role of a noun. Similar remarks apply to names assigned to verbs, adverbs, and conjunctions. Entry of a name alone displays its value. Errors are discussed in Section I.
Nouns are classified in three independent ways: numeric or literal; open or boxed; arrays of various ranks. In particular, arrays of ranks 0, 1, and 2 are called atom, list, and table, or, in mathematics, scalar, vector, and matrix. Numbers and literals are represented as stated in Part I.
Arrays. A single entity such as 2.3 or _2.3j5 or 'A' or '+' is called an atom. The verb denoted by comma chains its arguments to form a list whose shape (given by the verb $) is equal to the number of atoms combined. For example:
$ date=. 1,7,7,6 4 word=. 's','a','w' |. word |. date was 6 7 7 1The verb |. used above is called reverse. The phrase s$b produces an array of shape s from the list b. For example:
(3,4) $ date,1,8,6,7,1,9,1,7 1 7 7 6 1 8 6 7 1 9 1 7 table=. 2 3$ word,'bat' table $table saw 2 3 batThe number of atoms in the shape of a noun is called its rank. Each position of the shape is called an axis of the array, and axes are referred to by indices 0, 1, 2, etc. For example, axis 0 of table has length 2 and axis 1 has length 3.
The last k axes of an array b determine rank-k cells or k-cells of b. The rest of the shape vector is called the frame of b relative to the cells of rank k; if $c is 2 3 4 5, then c has the frame 2 3 relative to cells of rank 2, the frame 2 3 4 5 relative to 0-cells (atoms), and an empty frame relative to 4-cells. If:
] b=.2 3 4 $ 'abcdefghijklmnopqrstuvwx' abcd efgh ijkl mnop qrst uvwxthen the list abcd is a 1-cell of b, and the letters are each 0-cells.
A cell of rank one less than the rank of b is called an item of b; an atom has one item, itself. For example, the verb from (denoted by {) selects items from its right argument, as in:
0{b 1{b 0{0{b abcd mnop abcd efgh qrst ijkl uvwx 2 1{0{b 1{2{0{b 0{3 ijkl j 3 efghMoreover, the verb grade (denoted by /:) provides indices to { that bring items to lexical order. Thus:
g=. /: n=. 4 3$3 1 4 2 7 9 3 2 0 n g g{n 3 1 4 1 0 3 2 2 7 9 2 7 9 3 1 4 3 2 0 3 1 4 3 1 4 3 2 0Negative numbers, as in _2-cell and _1-cell (an item), are also used to refer to cells whose frames are of the length indicated by the magnitude of the number. For example, the list abcd may be referred to either as a _2-cell or as a 1-cell of b.
Open and Boxed. The nouns discussed thus far are called open, to distinguish them from boxed nouns produced by the verb box denoted by < . The result of box is an atom, and boxed nouns are displayed in boxes. Box allows one to treat any array (such as the list of letters that represent a word) as a single entity, or atom. Thus:
words=.(<'I'),(<'was'),(<'it') letters=. 'I was it' $words $letters 3 8 |. words |. letters +--+---+-+ ti saw I |it|was|I| +--+---+-+ 2 3$words,|.words +--+---+--+ |I |was|it| +--+---+--+ |it|was|I | +--+---+--+
Monads and Dyads. Verbs have two definitions, one for the monadic case (one argument), and one for the dyadic case. The dyadic definition applies if the verb is preceded by a suitable left argument, that is, any noun that is not itself an argument of a conjunction; otherwise the monadic definition applies. The monadic case of a verb is also called a monad, and we speak of the monad % used in the phrase %4, and of the dyad % used in 3%4. Either or both cases may have empty domains.
Ranks of Verbs. The notion of verb rank is closely related to that of noun rank: a verb of rank k applies to each of the k-cells of its argument. For example (using the array b from Section A):
,b abcdefghijklmnopqrstuvwx ,"2 b ,"_1 b abcdefghijkl abcdefghijkl mnopqrstuvwx mnopqrstuvwxSince the verb ravel (denoted by ,) applies to its entire argument, its rank is said to be unbounded.
The rank conjunction " used in the phrase ,"2 produces a related verb of rank 2 that ravels each of the 2-cells to produce a result of shape 2 by 12.
The shape of a result is the frame (relative to the cells to which the verb applies) catenated with the shape produced by applying the verb to the individual cells. Commonly these individual shapes agree, but if not, they are first brought to a common rank by adding leading unit axes to any of lower rank, and are then brought to a common shape by padding with an appropriate fill element: space for a character array, 0 for a numeric array, and a boxed empty list for a boxed array. For example:
i."0 s=. 2 3 4 >'I';'was';'here' 0 1 0 0 I 0 1 2 0 was 0 1 2 3 hereThe dyadic case of a verb has two ranks, governing the left and right arguments. For example:
p=. 'abc' q=. 3 5$'wake read lamp ' p,"0 1 q awake bread clampFinally, each verb has three intrinsic ranks: monadic, left, and right. The definition of any verb need specify only its behaviour on cells of the intrinsic ranks, and the extension to arguments of higher rank occurs systematically. The ranks of a verb merely place upper limits on the ranks of the cells to which it applies, and its domain may include arguments of lower rank. For example, matrix inverse (%.) has monadic rank 2, but treats degenerate cases of vector and scalar arguments as one-column matrices.
Agreement. In the phrase p v q, the arguments of v must agree in the sense that their frames (relative to the ranks of v) must be a prefix of the other, as in p,"0 1 q above, and in the following examples:
p," 1 1 q 3 4 5*i. 3 4 abcwake 0 3 6 9 abcread 16 20 24 28 abclamp 40 45 50 55 (i.3 4)*3 4 5 0 3 6 9 16 20 24 28 40 45 50 55If a frame contains 0, the verb is applied to a cell of fills. For example:
($ #"2 i. 1 0 3 4);($ 2 3 %"1 i. 0 2) +---+---+ |1 0|0 2| +---+---+ ($ $"2 i. 1 0 3 4);($ 2 3 %/"1 i. 0 4) +-----+-----+ |1 0 2|0 2 4| +-----+-----+
Unlike verbs, adverbs and conjunctions have fixed valence: an adverb is monadic (applying to a single argument to its left), and a conjunction is dyadic.
Conjunctions and adverbs apply to noun or verb arguments; a conjunction may produce as many as four distinct classes of results.
For example, u&v produces a composition of the verbs u and v; and ^&2 produces the square by bonding the power function with the right argument 2; and 2&^ produces the function 2-to-the-power. The conjunction & may therefore be referred to by different names for the different cases, or it may be referred to by the single term and (or with), which roughly covers all cases.
The comparison x=y is treated like the everyday use of equality (that is, with a reasonable relative tolerance), yielding 1 if the difference x-y falls relatively close to zero. polerant comparison also applies to other relations and to floor and ceiling (<. and >.); a precise definition is given in Part III under equal ( =). An arbitrary tolerance t can be specified by using the fit conjunction (!.), as in x =!.t y.
A sentence is evaluated by executing its phrases in a sequence determined by the parsing rules of the language. For example, in the sentence 10%3+2, the phrase 3+2 is evaluated first to obtain a result that is then used to divide 10. In summary:
Parsing proceeds by moving successive elements (or their values in the case of pronouns and other names) from the tail end of a queue (initially the original sentence prefixed by a left marker �) to the top of a stack, and eventually executing some eligible portion of the stack and replacing it by the result of the execution. For example, if a=. 1 2 3, then b=.+/2*a would be parsed and executed as follows:
$ b =. + / 2 * a $ b =. + / 2 * 1 2 3 $ b =. + / 2 * 1 2 3 $ b =. + / 2 * 1 2 3 $ b =. + / 2 * 1 2 3 $ b =. + / 2 4 6 $ b =. + / 2 4 6 $ b =. + / 2 4 6 $ b =. 12 $ b =. 12 $ 12 $ 12The foregoing illustrates two points: 1) Execution of the phrase 2*1 2 3 is deferred until the next element (the /) is transferred; had it been a conjunction, the 2 would have been its argument, and the monad * would have applied to 1 2 3; and 2) Whereas the value of the name a moves to the stack, the name b (because it precedes a copula) moves unchanged, and the pronoun b is assigned the value 12.
An isolated sequence, such as (+ */), which the normal parsing rules (other than the three labelled trident and bident) do not resolve to a single part of speech is called a train, and may be further resolved as described below.
Meanings are assigned to certain trains of two or three elements and, by implication, to trains of any length by repeated resolution. For example, the trains +-*% and +-*%^ are equivalent to +(-*%) and +-(*%^).
A verb is produced by trains of three or two verbs, as defined by the following diagrams:
FORK HOOK g g g g / \ / \ / \ / \ f h f h y h x h | | / \ / \ | | y y x y x y y yFor example, 5(+*-)3 is (5+3)*(5-3), but if f is a cap ([:) the capped branch simplifies the forks to g h y and g x h y.
The ranks of the hook and fork are infinite.
The following shows a typical J session. User entries are indented 3 spaces, and NB. denotes a comment. Boxed output is shown here with ordinary characters, but where available, true line-drawing characters may be used.
NB. calculate sums and means: count=. # sum=. +/ mean=. sum % count mean 2 3 5 7 4.25 report=. i. 2 3 4 (] ; sum ; sum"2 ; sum"1) report +-----------+-----------+-----------+--------+ | 0 1 2 3|12 14 16 18|12 15 18 21| 6 22 38| | 4 5 6 7|20 22 24 26|48 51 54 57|54 70 86| | 8 9 10 11|28 30 32 34| | | | | | | | |12 13 14 15| | | | |16 17 18 19| | | | |20 21 22 23| | | | +-----------+-----------+-----------+--------+ (] ; mean ; mean"2 ; mean"1) report +-----------+-----------+-----------+--------------+ | 0 1 2 3| 6 7 8 9| 4 5 6 7| 1.5 5.5 9.5| | 4 5 6 7|10 11 12 13|16 17 18 19|13.5 17.5 21.5| | 8 9 10 11|14 15 16 17| | | | | | | | |12 13 14 15| | | | |16 17 18 19| | | | |20 21 22 23| | | | +-----------+-----------+-----------+--------------+ NB. allocate sales by item number: items=. 1 2 2 3 2 3 1 1 2 sales=. 20 25 30 30 15 20 10 15 15 items </. sales +--------+-----------+-----+ |20 10 15|25 30 15 15|30 20| +--------+-----------+-----+ items +//. sales 45 85 50 NB. all permutations of a set: ap=. i.@! A.i. ap 3 0 1 2 0 2 1 1 0 2 1 2 0 2 0 1 2 1 0 allp=. {~ap@# allp &.> 'ca';'cat' +--+---+ |ca|cat| |ac|cta| | |act| | |atc| | |tca| | |tac| +--+---+ NB. calculate decrement rates from population: d1=. [: -. }.%}: d2=. 2&((-.@%~)/\) d3=. -.@}.@(*/\^:_1) pop=. 100 90 72 48 24 9 2 0 d1 pop 0.1 0.2 0.333333 0.5 0.625 0.777778 1 d2 pop 0.1 0.2 0.333333 0.5 0.625 0.777778 1 (d2 -: d3) pop 1 NB. sorted nub of word list: sort=. /:~ open=. > nub=. ~. words=. ;: text=. 'seven maids with seven mops' sort open nub words text maids mops seven with NB. fit 3rd order polynomial to data: x=. _1 _0.5 0 0.5 1 y=. _2 2 1 _1 0.5 f=. (y %. x ^/ i.4)&p. f x _2.00714 2.02857 0.957143 _0.971429 0.492857 f i.5 0.957143 0.492857 30.6 125.279 318.529 f +----------------------------------+-+--+ |0.957143 _4.41667 _1.71429 5.66667|&|p.| +----------------------------------+-+--+ NB. fund accumulation with interest: int=. 0.1 0.1 0.1 0.05 0.05 pay=. 100 120 120 150 200 200 accum=. 1,*/\1+int proj=. +/\&.(%&accum) proj pay 100 230 373 560.3 788.315 1027.73 proj 6#100 100 210 331 464.1 587.305 716.67 NB. continued fraction representation of Pi: rf=. % @ (1&|) Pi=. 1p1 [v=. <. rf ^: (i.10) Pi 3 7 15 1 292 1 1 1 2 1 (+%) /\ 5{. v 3 3.14286 3.14151 3.14159 3.14159 NB. signed area (or volume): area=. vol=. [: det ] ,. %@!@#"1 det=. -/ . * tri=. 0 0,1 0,:3 1 tri;(area tri);(|.tri);(area |.tri) +---+---+---+----+ |0 0|0.5|3 1|_0.5| |1 0| |1 0| | |3 1| |0 0| | +---+---+---+----+ tetrahedron=. 0,=i.3 tetrahedron; vol tetrahedron +-----+---------+ |0 0 0|_0.166667| |1 0 0| | |0 1 0| | |0 0 1| | +-----+---------+
Many features of J are either not present at all, or are very different in other languages. Such features are often stumbling blocks for newcomers to J.
In particular, questions are frequently asked about:
Rank specifies the behaviour of a verb on certain subarrays of its arguments, which for a rank-k verb are referred to as the k-cells.
Each verb is assigned a rank, and a rank may be otherwise specified with the rank conjunction " .
The verb < (box) is useful for illustrating rank. < boxes its argument, and has unbounded rank, which means it boxes its entire argument:
[n=. i.2 3 4 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 <n NB. box n (entire array) +-----------+ | 0 1 2 3| | 4 5 6 7| | 8 9 10 11| | | |12 13 14 15| |16 17 18 19| |20 21 22 23| +-----------+ <"2 n NB. box the 2-cells (tables) +---------+-----------+ |0 1 2 3|12 13 14 15| |4 5 6 7|16 17 18 19| |8 9 10 11|20 21 22 23| +---------+-----------+ <"1 n NB. box the 1-cells (rows) +-----------+-----------+-----------+ |0 1 2 3 |4 5 6 7 |8 9 10 11 | +-----------+-----------+-----------+ |12 13 14 15|16 17 18 19|20 21 22 23| +-----------+-----------+-----------+ <"0 n NB. box the 0-cells (atoms) +--+--+--+--+ |0 |1 |2 |3 | +--+--+--+--+ |4 |5 |6 |7 | +--+--+--+--+ |8 |9 |10|11| +--+--+--+--+ +--+--+--+--+ |12|13|14|15| +--+--+--+--+ |16|17|18|19| +--+--+--+--+ |20|21|22|23| +--+--+--+--+Here is +/ (sum), also of unbounded rank, applied to the same argument:
sum=. +/ sum n NB. sum n 12 14 16 18 20 22 24 26 28 30 32 34 sum"2 n NB. sum the 2-cells 12 15 18 21 48 51 54 57 sum"1 n NB. sum the 1-cells 6 22 38 54 70 86Unbounded rank means maximum rank applicable, which in this case is 3, since n has rank 3. Thus (sum n), (sum"3 n) and (sum"_ n) are all the same.
Negative rank r means positive rank a+r where a is the rank of the argument. Thus
sum"_1 n NB. sum 2-cells (3+_1) 12 15 18 21 48 51 54 57 sum"_2 n NB. sum 1-cells (3+_2) 6 22 38 54 70 86The composition conjunctions @ (atop) and @: (at) differ in the ranks of the result. The rank of u@v is the rank of v; the rank of u@:v is unbounded. A common mistake is to use the wrong one:
[n=. 1 2;10 20 +---+-----+ |1 2|10 20| +---+-----+ +/@> 1 2;10 20 NB. add up each item of n 3 30 NB. rank 0, since > has rank 0 +/@:> 1 2;10 20 NB. add up items of n (rank _) 11 22You can find out the rank of a verb using the adverb b. (basic characteristics). The result shows the monadic, dyadic left and dyadic right ranks:
+/ b. 0 _ _ _ +/@> b. 0 0 0 0 +/@:> b. 0 _ _ _Here rank is used to specify how two arrays are joined together:
[a=.'XYZ' XYZ [b=. >;:'bat cat dat' bat cat dat a,b NB. append a to b XYZ bat cat dat a,"1 1 b NB. append rows of a to rows of b XYZbat XYZcat XYZdat a,"0 1 b NB. append atoms of a to rows of b Xbat Ycat Zdat a,"1 0 b NB. append rows of a to atoms of b XYZb XYZa XYZt XYZc XYZa XYZt XYZd XYZa XYZt a,"0 0 b NB. append atoms of a to atoms of b Xb Xa Xt Yc Ya Yt Zd Za Zt
Unlike other languages, there is no precedence between verbs, or between adverbs and conjunctions. Like other languages, parentheses can be used to specify the sequence of execution.
You can often solve problems with precedence by adding parentheses to an expression:
9-3-4 NB. equivalent to 9-(3-4) 10 (9-3)-4 NB. parentheses change order of execution 2 +/ }. 1 2 3 NB. (1) takes sum of the beheaded list 5 (+/ }.) 1 2 3 NB. (2) applies the hook +/ }. to 1 2 3 3 4 NB. i.e. the expression in parentheses 4 5 NB. is executed first 5 6 a=. +/ }. NB. is the same as (2), not (1), since a 1 2 3 NB. the order of execution is given 3 4 4 5 5 6Boxed display is useful for showing the order of execution:
+/ . * / +-----------+-+ NB. shows that the rightmost adverb applies to |+-----+-+-+|/| NB. the derived verb +/ . * and that ||+-+-+|.|*|| | NB. the left argument of the dot product |||+|/|| | || | NB. is the derived verb +/ ||+-+-+| | || | |+-----+-+-+| | +-----------+-+
From and amend provide all the functionality of bracket indexing found in other languages, and much more.
Examples of from:
[m=. 4 5$'cabletreatbraidrider' cable treat braid rider 2{m NB. pick the 2nd row braid 1 2{"1 m NB. pick columns 1 2 ab re ra id (<2 1){m NB. pick the element in row 2, column 1 r (0 3;2 2;2 3;3 0){m NB. scattered indexing lairExamples of amend:
'godel' 2 } m NB. replace row 2 cable treat godel rider ('xyzt',.'XYZT') 1 2}"1 m NB. replace columns 1 2 cxXle tyYat bzZid rtTer'Z' (<2 1)}m NB. replace element in row 2, column 1 cable treat bZaid rider 'ABCD' (0 3;2 2;2 3;3 0)}m NB. scattered replacement cabAe treat brBCd Dider