Fifty Shades of J/Chapter 3
Table of Contents ... Glossary ... Previous Chapter ... Next Chapter
Principal Topics
- , (ravel/append) ,.(ravel item , stitch) ,: (laminate) -. (less), β (rank conjunction), autostereograms
Joinery
It is a happy accident that βjoinβ is not the name of a primitive verb in J because this makes it appropriate to use the word as a generic name for the three primitive verbs append, stitch and laminate. Some analogies with what goes on in the wood-yard seem appropriate.
Suppose I have a pile of planks and I want to stack a second pile on top. My appender (,) takes good care of me so that I do not have to worry about imbalance due to non-matching widths, although it does keep appropriate space clear in order to keep everything in tidy overall order.
]App=.(2 3$'abc'),(3 4$'defg') abc abc defg defg defg
Next I use my stitcher (,.) when I want to stack two planks side by side, and then join plank to plank in matching pairs. Naturally the stitcher only works when the number of planks in the two piles are equal.
]St=.(2 3$'abc'),.(2 4$'defg') abcdefg abcdefg
Next my laminator (,:) starts a new pile from two existing piles. Like the appender I do not have to worry about imbalance due to non-matching widths.
]Lam=.(2 3$'abc'),:(3 4$'defg') abc abc defg defg defg
The shaper ($) starts its work as a laminator and continues as an appender. In this sense the laminator is one of the lowest level (most primitive) operators in the overall J tool kit, and thus one of the most pervasive verbs even although its explicit usage is relatively small.
Another valuable little tool is my gouge (-.) which helps me dig out unwanted bits like knots
'abcdef'-.'bd' acef
When it comes to finding and rearranging things in the workshop, I reach for one of what I call my monadics. First the raveller (,) which lays everything out in a line, using my gouge to close up the spaces which may have been put in for overall tidiness :
Ravel=.-.&' '@, (Ravel App);(Ravel St);(Ravel Lam) ββββββββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββ βabcabcdefgdefgdefgβabcdefgabcdefgβabcabcdefgdefgdefgβ ββββββββββββββββββββ΄βββββββββββββββ΄βββββββββββββββββββ
Next my spacesaver tool which I affectionately call my βriβ (short for Ravel Items). This comes into play in two circumstances, one when I want to stack a plank vertically instead of horizontally
,.'abcd' a b c d
and the other when I want to put my two laminated stacks one on top of the other which I can do in either of two ways
(,.Lam);(,/Lam) ββββββββββββββ¬βββββ βabc abc βabc β βdefgdefgdefgβabc β β β β β βdefgβ β βdefgβ β βdefgβ ββββββββββββββ΄βββββ
each of which has the effect of reducing the number of piles (rank in J terminology).
($Lam);($,.Lam);($,/Lam) βββββββ¬βββββ¬ββββ β2 3 4β2 12β6 4β βββββββ΄βββββ΄ββββ
My accountant tells me that ,. (ravel items) is also very handy for making lists into columns (easier to total up, I suppose)
,.i.5 0 1 2 3 4
To complete the picture, my itemizer puts a band around all of my timber arrangements. You wonβt see any visible difference but the shaper shows it clearly :
($App);($St);($Lam) βββββ¬ββββ¬ββββββ β5 4β2 7β2 3 4β βββββ΄ββββ΄ββββββ ($,:App);($,:St);($,:Lam) βββββββ¬ββββββ¬ββββββββ β1 5 4β1 2 7β1 2 3 4β βββββββ΄ββββββ΄ββββββββ
What I havenβt told you about is my packing machine known as the βboxerβ which opens up many possibilities for joining at the package level which will be exploited elsewhere.
<"1 App ββββββ¬βββββ¬βββββ¬βββββ¬βββββ βabc βabc βdefgβdefgβdefgβ ββββββ΄βββββ΄βββββ΄βββββ΄βββββ <"1 St βββββββββ¬ββββββββ βabcdefgβabcdefgβ βββββββββ΄ββββββββ <"1 Lam ββββββ¬βββββ¬βββββ βabc βabc β β ββββββΌβββββΌβββββ€ βdefgβdefgβdefgβ ββββββ΄βββββ΄βββββ <"2 Lam ββββββ¬βββββ βabc βdefgβ βabc βdefgβ β βdefgβ ββββββ΄βββββ
The last step is a demonstration of the tools in use. The editor was not sympathetic to my idea of distributing a set of planks with Vector, so I have to fall back on a diagram from the book βHow the Mind Worksβ by the American psychologist Stephen Pinker. He uses this diagram to explain how autostereograms are constructed. The basis of the diagram is that in the short lines two 4s have been removed; in the long lines two Xs have been inserted between 3 and 4. The diagram is itself an autostereogram - look at these two areas and use stereogram viewing techniques and you should see a raised and a recessed rectangular block respectively.
123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 1234567890123456789012356789012356789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 12345678901234567890123X4567890123X456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890 123456789012345678901234567890123456789012345678901234567890
A blueprint for the diagram is:
Here is how the appender, stitcher and gouge realise this blueprint
t=.'123X4567890' u=.t-.'X' v=.u-.'4' a=.21 20$u b=.3 40$u c=.(6 18$v),.6 20$u d=.(6 22$t),.6 20$u a,.b,c,b,d,b
Another possibility is to use ,.
A=.3 60$u B=.(6 20$u),.(6 18$v),.6 20$u C=.(6 20$u),.(6 22$t),.6 20$u
The Pinker diagram is then obtained by
A , B , A , C , A
Ah well, time to close up the workshop for another day.