On 7/28/07, Tracy Harms <[EMAIL PROTECTED]> wrote:
> John Randall, in summarizing advice for J programming,
> wrote the following:
>
> > Avoid small selections: use #~f whenever possible.
> > I almost never use @. .

This, I believe, is efficiency advice -- @. with low rank
currently does not have much in the way of special
code, but needs it.  On the other hand monads like
(#~ f) don't need special code, as such.

> As I having been studying gerunds recently, agenda
> (@.) was showcased in conjunction with them.  My
> questions today are:
>
> Is the advice regarding 'selection', above, not
> applicable with regard to the use of agenda with
> gerunds.

As I understand it, it's efficiency advice -- so it should
take back seat to issues of correctness, and design.

That said, if you're learning it's probably a good idea
to make sure you try some exercises both ways so
you feel comfortable with both approaches.

> If not, the claim suggests it is typically better to
> find an alternative to agenda. What is the heart of
> the disadvantage of agenda?  Is it a matter of speed
> of the resulting computation?

Primarily, yes.

That said, working with some alternatives is probably
a good idea for just about anything.

> How should the term 'selection' be understood in that
> advice?

Both (#~f) and @. can be though of as "selecting"
some parts of some nouns.

In the case of (#~ f), f is presumably a verb which produces a boolean
for each item -- the item is selected if the boolean is 1, and is not
selected if the boolean is 0.

In the case of @. you are applying a verb from its gerund left arg
based on the result of its right arg.  If you are applying it to items,
this might be analogous to what you can do with (#~f) and/or
(#~ [EMAIL PROTECTED])

I hope this helps -- I might be missing some important context
which could render what I'm saying useless or nonsensical.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to