1) yes, but it might not be a good idea. (You can form x and y into a
sequence which can be passed as a single argument, and then extract
arguments from that sequence.)

2) If Q is expensive to compute, I am aware of two other options:

(a) use a name to refer to its result (as you have done here), or

(b) use the memoize (M.) adverb (assuming Q's arguments are
sufficiently constrained).

You might also combine (a) and (b) by constructing your own
reinterpretation of the M. adverb if that suits your design.

--
Raul



On Thu, Aug 10, 2023 at 9:14 AM Marcin Żołek
<marcin.zo...@students.mimuw.edu.pl> wrote:
>
> Let U, V, W, P, Q be dyads and
>
> F =: dyad define
>     (tmp U y) V x W y P tmp =. x Q y
> )
>
> Tacit form of F, for example, is
>
> F =: (Q U ]) V [ W ] P Q
>
> but in this definition Q is repeated.
>
> 1. Is it possible to convert definition of F to tacit form without repeating 
> Q in definition?
> 2. Does the interpreter recognize repetition of Q and evaluate Q only once? 
> How to make the interpreter not evalute Q twice?
>
> Thanks,
> Martin
> ----------------------------------------------------------------------
> 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