>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary

16. Word Formation

The interpretation of a written English sentence begins with word formation. The process is based on spaces to separate the sentence into units, but is complicated by matters such as apostrophes and punctuation marks: was and Brown and Ross’ are each single units, but however, is not (since the comma is a separate unit).

The following lists of characters represent sentences in J, and can be executed by applying the do or execute function ". :
   m=: '3 %: y'
   d=: 'x %: y'
   x=: 4
   y=: 27 4096

   ". m
3 16

   do=: ". 
   do d
2.27951 8
The word formation rules of J are prescribed in Part I of the dictionary. Moreover, the word-formation function ;: can be applied to the string representing a sentence to produce a boxed list of its words:
   ;: m
+-+--+-+
|3|%:|y|
+-+--+-+

   words=: ;:
   words d
+-+--+-+
|x|%:|y|
+-+--+-+
The rhematic rules of J apply reasonably well to English phrases:
   words p=: 'Nobly, nobly, Cape St. Vincent'
+-----+-+-----+-+----+---+-------+
|Nobly|,|nobly|,|Cape|St.|Vincent|
+-----+-+-----+-+----+---+-------+

   >words p
Nobly  
,      
nobly  
,      
Cape   
St.    
Vincent

Exercises

16.1   Choose sentences such as pp=:+//.@(*/) from earlier exercises, enclose them in quotes, and observe the effects of word-formation (;:) on them.

16.2   Move the cursor to the left of a line so that it is separated from the line by one or more spaces, and press Ctrl F1 to display the individually boxed words in the sentence.



>>  <<  Ndx  Usr  Pri  JfC  LJ  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary