I was aware that I'd arranged for the central verb to only work on the
right-hand side, and I see that here you have corrected that and
produced the intended result. This turns out to be what I was reaching
toward.

What took me a while to understand is how the left-hand side is
interpreted here. I initially envisioned that it must provide the x
argument for dn (aka todate) which is defined for zero and one, but
not for a date-list (1800 2 5). As you know, it doesn't. In the
process of writing this reply it occurred to me that &. must work
similarly to u&v so that both arguments independently receive the
rightmost transformation. OK, that makes sense.

Unfortunately in this case it means that the left-hand argument has to
be encoded in a peculiar manner, which runs contrary to the clarity I
was reaching for. I'm glad I've improved my sense of how dyadic Under
supports both arguments, though. There will come a time where I'll
need that, though that time is not now.

Thank you very much for the help!


On Mon, Mar 9, 2009 at 1:12 PM, R.E. Boss <[email protected]> wrote:
> As you can see from
>
>   (((7*[) (+[)&....@] 3&{...@]))
> +-------+-------------------+--------------+
> |+-+-+-+|+-------------+-+-+|+--------+-+-+|
> ||7|*|[|||+-----+--+--+|@|]|||+-+-+--+|@|]||
> |+-+-+-+|||+-+-+|&.|dn|| | ||||3|&|{.|| | ||
> |       ||||+|[||  |  || | |||+-+-+--+| | ||
> |       |||+-+-+|  |  || | ||+--------+-+-+|
> |       ||+-----+--+--+| | ||              |
> |       |+-------------+-+-+|              |
> +-------+-------------------+--------------+
>
> the central verb Works on the RHS only.
>
> Perhaps this is what you want?
>
>    5( ((7 tod...@*[) (+[)&.dn 3&{...@]) , 3&}...@])now
> 2009 4 13 11 14 34
>
>
> R.E. Boss
>
>
> -----Oorspronkelijk bericht-----
> Van: [email protected]
> [mailto:[email protected]] Namens Tracy Harms
> Verzonden: maandag 9 maart 2009 19:48
> Aan: Programming forum
> Onderwerp: [Jprogramming] Under
>
> I'm having difficulty using Under where it seems that it should be
> natural to do so. I vaguely recall this difficulty being discussed
> here before, but I don't recall the answer.
>
>   load 'dates'
>
>   ]now=: <.6!:0''
> 2009 3 9 11 14 34
>
> NB. I can accomplish the desired program as shown below.
>   wf=:  ([: todate (7*[) + todayno@(3&{...@])) , 3&}...@]
>   5 wf now
> 2009 4 13 11 14 34
>
>   NB. What I can't do is rely on this relationship
>   dn =: todayno :. todate
>
>   NB. to rely on Under along these lines:
>   weeksfrom=:  ((7*[) (+[)&....@] 3&{...@]) , 3&}...@]
>
> NB. However, the left parameter (result of (7*[)) is obscured by the
> use of &. (i.e. inaccessible when the addition is to occur)
>
> Can Under be used in a circumstance like this?
>
> Tracy
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> 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