home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / developm / language / j32.sit / j.rsrc / TEXT_1102__.txt < prev    next >
Text File  |  1991-06-13  |  2KB  |  29 lines

  1. m : n  (Conjunctions)
  2.  
  3. EXPLICIT DEFINITION (_ _ _)  If n is non-numeric, the conjunction : produces a verb whose monadic and dyadic cases are determined by m and n, respectively. If f=.'2 $:y.' : 'y.^%x.', then f 64 is the square root and 3 f 64 is the cube root of 64. As illustrated by the foregoing, x. and y. denote the arguments and $: denotes the function being defined, thus providing the "self-reference" that is also useful in recursive definition. In general, m and n are boxed lists, the sentences in the boxes being executed in a sequence determined by the suite $..
  4.  
  5. An open list (as illustrated above) is treated as a single box, and the items of an open table are treated as a list of boxes. Thus:
  6.  
  7.       a=. ',x.[$.=.y.#1'
  8.       b=. a;'x.=.(x.,0)+(0,x.)'
  9.       g=. '1$: y.' : b
  10.    1 g 4               g 4
  11. 1 4 6 4 1              1 4 6 4 1
  12.  
  13. The suite $. is initially set to i.ns, where ns is the number of sentences; in this example, it is reset to execute sentence 1 the number of times specified by the right argument. The result of the verb is the result of the sentence executed last.
  14.  
  15. Any name assigned by the copula =. is made strictly local on its first assignment; that is, values assigned to the name have no effect on the use of the name outside of the verb or within other verbs invoked by it. The names x. y. $. $: are also local.
  16.  
  17. If sentence k begins with a name followed by a right parenthesis, the name is local and  is set to k}.i.ns. Such a label is useful in setting the suite to effect branching.
  18.  
  19. Adverbs. If n is 1, then m : n is an adverb. If r=. '|.&x.&|.' : 1, then ΓÇô/\ r 1 2 3 4 yields 2 3 1 4.
  20.  
  21. Conjunctions. If n is 2, then m : n produces a conjunction. For example, if po is:
  22.    ('$.=.1,y.#2';'a=.]';'a=.x.&a') : 2
  23. then o. po 2 (1) is the square of pi.
  24. ________________________________
  25.  
  26. m : v  u : n  u : v  (Conjunction)
  27.  
  28. EXPLICIT DEFINITION (_ _ _)  The first argument specifies the monadic case, and the second argument the dyadic case, using in m and n the conventions defined under m : n .
  29.