I'm a little rusty,

is ds different than

(u/ x) u y
?

ds=: 1 : 0        NB. dyadic scan
> 
>   :
> 
>   for_j. |.x do. y=. j u y end.
> 
>   )


--- "R.E. Boss" <[EMAIL PROTECTED]> wrote:

> There are good reasons to redefine the dyadic adverb
> / called "table" in the
> vocabulary, and one reason not to do so. 
> 
>  
> 
> 0)      One of the aims of an array programming
> language should be to make
> explicit loops (for, while) superfluous. Or at least
> avoidable at no cost.
> 
> 1)       The current definition of u/ is only a
> shorthand for u"(lu,_) 
> 
> 2)      It is preferable that monadic and dyadic use
> of primitives match as
> much as possible
> 
> 3)      There exists a good candidate for dyadic /
> 
> _1) Incompatibility
> 
>  
> 
> Some remarks
> 
> 1)       There are cases in which explicit loops are
> unavoidable if good
> performance is important. 
> 
> Even(?) Hui used a for-loop in a recent verb
>
http://www.jsoftware.com/pipermail/programming/2006-September/003258.html
> 
> 
> If I replace in his verb comp the line
> 
>   for_e. g do. c=. (<./i) (i=. {&c^:_ >e)}c end.  
> 
> with the equivalent
> 
>   c=. (({~^:_ )~ ([:<./{)`[`]}  ])&.>/ (|.g),<c 
> 
> to obtain verb comp1, than I get (for e=: edgs~ 5e4)
> a far worse performance
> 
>    ts 'comp e'
> 
> 0.45996326 7448832
> 
>    ts 'comp1 e'
> 
> 2.6279606 7448896
> 
>    (comp -: comp1) e
> 
> 1
> 
>  
> 
> 2)      More primitives are shorthand for
> complicated expressions, e.g.  /.
> is equivalent to  1 : '[EMAIL PROTECTED] ='
> 
> See
> http://www.jsoftware.com/jwiki/PrimitivePrimitives
> for other examples.
> 
> But  u"(lu,_) is not complicated (enough) for a
> shorthand. 
> 
> What's more, the title (table) does not even reflect
> its outcome. 
> 
> Try 1 2 3 ;/ 4 5 6 7 as one of the problems I
> encountered when my J learning
> curve was a quite bit steeper than today.  Of course
> 1 2 3 ;"0/ 4 5 6 7
> gives the desired outcome, but if you know that,
> than you also can come up
> with the equivalent  1 2 3 ;"0"0 _ [ 4 5 6 7 
> 
>  
> 
> 3)      There are many examples, < and > belonging
> to the best, where
> monadic and dyadic use have nothing in common. But
> if they do, it is at
> least of mnemonic use. 
> 
>  
> 
> 4)      The good candidate I am proposing is just
> the 'for'-loop Hui used. 
> 
> So I would like to have
> 
>    x u/ y                       
> 
> to be defined by " apply u/ on the concatenation of
> x and y" 
> 
> or, more formally, equivalent to
> 
>   ds=: 1 : 0        NB. dyadic scan
> 
>   :
> 
>   for_j. |.x do. y=. j u y end.
> 
>   )
> 
> Then performance can be further improved by special
> coding ...!
> 
>  
> 
>       _1) No remarks on incompatibility.
> 
>  
> 
>  
> 
> R.E. Boss 
> 
>  
> 
>
----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to