I don't know if this is what you want but here's something using agenda to
convert between the WxHx3 (3D) representation of an image and the flattened
(2D) WxH version, depending on which of the two you provide.
rgb=: 4 : '(x$256)&#:`(256&#.)@.((x = [: {: $) *. 3 = [: # $) y'

On Tue, Jul 26, 2022 at 3:26 PM Jan-Pieter Jacobs <
janpieter.jac...@gmail.com> wrote:

> I don't know whether you had this in mind, but another case (that I don't
> have a concrete example use of) is that of using @. with a vector of
> indices, rather than a single value, allowing to create trains. In
> this case, the gerund verbs can clearly have different result ranks, e.g.
>    +/`%`-`# @. 2 0 1 3
> - (+/ % #)
> (i.e. center a list of data on the mean): - returns a rank 1 result, while
> the other verbs return rank 0 results.
>
> Jan-Pieter
>
> On Tue, 26 Jul 2022, 15:17 Raul Miller, <rauldmil...@gmail.com> wrote:
>
> > On Mon, Jul 25, 2022 at 7:51 PM Elijah Stone <elro...@elronnd.net>
> wrote:
> > > Have you ever written code using @., as in u`v @. w, where the ranks of
> > the
> > > results of u and v differ from one another (for a given rank of x/y)?
> > If so,
> > > an you post a self-contained snippet?  (Don't worry about being
> > runnable; I
> > > just want to get a general idea of the code patterns.)
> >
> > I don't know how I would find such code, though I can imagine having
> > written it.
> >
> > So, instead, I'll describe an example where I might have used this
> > pattern: game logic where the verb advanced the game state (returning
> > an updated game board, or a win/lose/draw game over message).
> >
> > (And, here, depending on what all I was using the gerund for, one of
> > the challenges would probably be making apparent to the reader the
> > relationship between the decision logic (@.w) and the organization of
> > the gerund (u`v ...).)
> >
> > --
> > Raul
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 

Devon McCormick, CFA

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

Reply via email to