On 9/11/07, Raul Miller <[EMAIL PROTECTED]> wrote:
> On 9/11/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
> > On 9/11/07, Raul Miller <[EMAIL PROTECTED]> wrote:
> > > The point was the order in which things happen -- modifying f
> > > changes the definition of g.
> >
> > oh yes, interesting point. That degree of dynamism will not be supported.
>
> In other words, you do not want named verbs?  Why?
>

Raul, this example shows the extent of verb naming.


;;; First a simple number:
> 5
5

;;; Now let's box the number. Note the #& indicating boxed data
;;; the J code would be < 5
> (Box 5)
#&5

;;; Now let's open the box. In J: > < 5
> (Open (Box 5))
5

;;; Let's create a rank-3 array with shape 2 3 4. the argument passed
to Integers
;;; is a rank-1 array representing the shape.
;;; Dont confuse #, the array read syntax with #& the syntax for boxed data
> (define a (Integers (rank-1 2 3 4)))
> a
#,(array vector ((0 . 1) (0 . 2) (0 . 3)) (((0 1 2 3) (4 5 6 7) (8 9
10 11)) ((12 13 14 15) (16 17 18 19) (20 21 22 23))))

;;; Let's box the rank-3 array
> (Box a)
#&#,(array vector ((0 . 1) (0 . 2) (0 . 3)) (((0 0 0 0) (0 0 0 0) (0 0
0 0)) ((0 0 0 0) (0 0 0 0) (0 0 0 0))))

;;; Let's create a new verb (the whole point of this post and response to Raul)
;;; which has rank-2 and will call Box (a verb of infinite rank)
> (define NewBox (Rank Box 2))

;;; Let's box the data by 2-cells. Note the #& after each 3x4 rank-2 array
> (NewBox a)
#(#&#,(array vector ((0 . 2) (0 . 3)) ((0 0 0 0) (0 0 0 0) (0 0 0 0)))
#&#,(array vector ((0 . 2) (0 . 3)) ((0 0 0 0) (0 0 0 0) (0 0 0 0))))

-- 

J IRC Channel irc://irc.freenode.org/jsoftware
Redick - Scheme Library for J Programming  - http://redick.metaperl.com
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to