> Wow.  Just when I think I'm starting to get proficient in the language...
>    M (4 $. [: $. =) 6 32 58

One might never stop learning, or relearning J  ;)

[Jgeneral] (i. 2 3) i. 4 NB. you know what i mean... how do iget it to
work?!
Dan Bron
http://www.jsoftware.com/pipermail/general/2007-May/029887.html





On Fri, Nov 13, 2020 at 1:26 PM Devon McCormick <[email protected]> wrote:
>
> Wow.  Just when I think I'm starting to get proficient in the language...
>    M (4 $. [: $. =) 6 32 58
> 0 1 1
> 1 2 2
> 2 3 3
>
> This sparse array approach behaves differently from my proposal for an
edge
> condition (lookup not found):
>    M (4 $. [: $. ="_ 0~) 99           NB. Empty result for "not found"
>    M (([: $ [) #: ] i.~ [: , [) 99    NB.  versus potentially misleading
> result.
> 0 0 0
>
> I stumbled on this in my attempt to accommodate an array right argument
> with Ric's solution:
>    M ([: 4&$.@:$. ="_ 0~) 2 3$6 7 8 32 58 59
> 0 1 1 0 0
> 0 1 2 0 1
> 0 1 3 0 2
> 1 2 2 1 0
> 2 3 3 1 1
> 2 3 4 1 2
>
> This appears to indicate the indexes into the left argument in the first 3
> columns and the indexes of the corresponding items on the right in the
last
> two columns (because a 3D argument on the left and a 2D argument on the
> right).
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to