On 9/10/07, Raul Miller <[EMAIL PROTECTED]> wrote:
> On 9/10/07, Terrence Brannon <[EMAIL PROTECTED]> wrote:
> > scratch once again. Now, I have monadic # implemented and implemented
> > properly:
> ...
>
> I haven't studied this very closely, but on your web page you talk about
> cloning functions when applying rank.  I am not sure this is the right
> approach (but I might be wrong, since I don't really know what you
> mean by "cloning").

Basically, what it boils down to is that Scheme functions have no
concept of rank. So I needed some way of attributing Scheme functions
with rank. In version 66 of Redick, that led to this sort of calling
convention:

(monad-apply Tally array)

and then Tally looked like

(define (Tally array)
  (let ([rank *Infinite*])
    ... do tally things)

so I had a function that worked, but I had no way of changing it's
rank. Also it's very easy in J to clone a function:

f =. +/"1
g =. +/"2

so I wanted more natural-looking calling but also wanted to be able to
reproduce a function but with varying ranks... so i wrote up that
essay as a plea for help, but some experimentation with Scheme object
systems gave me way to create attributes for a function and have the
function look up its rank and work accordingly.

And cloning worked fine as well... thus you saw:

(define new-Tally (Rank Tally 2)) ;;; same as new_TAlly =: #"2
and so on.
and you saw the results were framed correctly based on henry's tutorial book.

>
> Anyways, here's a case which I think illustrates my concern:
>
>    f=: +/ %#
>    g=:f"1
>    g i.3 3
> 1 4 7

yes here the data is of shape 3 3. the effective rank is 1 because
rank 1 < rank 2 .
so using the Fine Line essay on the wiki, we know our frame is of shape 3.
so g will be applied 3 times to 3 1-cells -
  0 1 2    NB. 1
  3 4 5    NB. 4
  6 7 8    NB. 7

>    f=: +/
>    g i.3 3
> 3 12 21

 verb rank is 1. noun rank is 2. so effective rank is 1. therefore the
frame is 3 and the verb will be applied to a series of 1-cells:

  0 1 2    NB. 3
  3 4 5    NB. 12
  6 7 8    NB. 21

What concern did you have regarding those examples?

That is how I compute it mentally. Of course, shoe-horning this into
Redick is a target for the future. The next thing is to get a bunch of
monads implemented.

Then move on into dyads and whatever else Henry lays out in J for C in
nitty gritty details.

-- 

J IRC Channel irc://irc.freenode.org/jsoftware
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to