Roger Hui:

> I suggest that as usual, you should write the expression
> in the "best" way, and then wait for the implementation
> to catch up.
>
> What might the "best" way be?  Perhaps:
>
> ({...@[ f ]) *. ({:@[ g ])
>
> where f and g are one of < <:

As written, f should be any of < <:, and g any of > >:.  E.g.
oo=: ({...@[<]) *. ({:@[>])

But why is using [, ] and @, which you suggest, preferable to
hooks, which can provide the same but terser, as in

oo=: (> {.) *. (< {:)
oc=: (> {.) *. (<:{:)
co=: (>:{.) *. (< {:)
cc=: (>:{.) *. (<:{:)

or (using other middle verbs)

oo=: (>{.) > (>:{:)
oc=: (>{.) > (> {:)
co=: (<{.) < (< {:)
cc=: (<{.) < (<:{:)

For the two semi-closed cases, it is possible to have variants
that are just as simple but work correctly even when it is not
known, for an interval (y1,y2), which of y1 and y2 is the larger:

oc=: (>{.) ~: (>{:)
co=: (<{.) ~: (<{:)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to