Using the a) option in Raul's reply -

L =. > @: {. @: [                               NB. use the "x" value from list
R =. > @: {: @: [                               NB. use the "y" value from list

xy =. ;                                         NB. x and y into a list. [[Only 
if y is not boxed]]
xy =. ,&:<                                              NB. x and y into a list.

fn =. xy ((L a ]) c (R d ])) b          NB. x & y combined, factor out 
b-replace with ] 

Ian


Ian Shannon
Landscape Modelling and Decision Support Section
Department of Environment, Climate Change & Water (NSW)
email: Ian.Shannon ()  environment.nsw.gov.au

Date: Tue, 28 Sep 2010 16:56:46 -0400
From: Raul Miller <rauldmil...@gmail.com>
Subject: Re: [Jprogramming] An Abbreviation
To: Programming forum <programming@jsoftware.com>
Message-ID:
        <aanlktim=d+a6d9gx8wq8l8aohor2fy0nq_52hfahg...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Sep 28, 2010 at 4:50 PM, Justin Paston-Cooper
<paston.coo...@gmail.com> wrote:
> Is there an abbreviation for the following fork? I don't want the
> computation of <<x b y>> to happen twice.
>
> ([ a b) c (] d b)

When you need to intermix three (or more) values in J,
you have several options:

[1] Compose some (or all) of them into a list
[2] Use an explicit definition
[3] recompute some of them

Each has its own advantages and disadvantages.

-- 
Raul
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
This email is intended for the addressee(s) named and may contain confidential 
and/or privileged information. 
If you are not the intended recipient, please notify the sender and then delete 
it immediately.
Any views expressed in this email are those of the individual sender except 
where the sender expressly and with authority states them to be the views of 
the Department of Environment, Climate Change & Water NSW.

PLEASE CONSIDER THE ENVIRONMENT BEFORE PRINTING THIS EMAIL

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

Reply via email to