Elmer -

since your expression only combines "x" and "y" but does not use either one
separately, why not make this the argument to your function?  I.e.

   dealx=: 3 : 'y$52?52'  NB.EG dealx 5 2

Also, this returns an array with the shape specified rather than with the
reversed shape.
That is, your specification takes, e.g. "2" & "5" in that order but returns
an array with shape "5 2" - this seems unnecessarily complex.

Additionally, by making the function monadic, you leave the door open to add
a backwardly compatible dyadic variant at some point in the future, e.g.

   dealx=: 3 : 0
   52 dealx y
:
   y$x?x
)

This defaults to the same thing as the preceding definition for the monadic
case but allows you to specify a differently-sized deck if you want, e.g. to
include a joker:

   53 dealx 5 2

Regards,

Devon
On Mon, Mar 1, 2010 at 9:27 AM, Elmer Fittery <[email protected]>wrote:

>
> dealx =: (4 : '(y, x) $ ( 52 ? 52 )')
>
> Thanks a lot.
>
> I found reference to dealx at jsoftware.com, but it seemed
> to be removed from the language sometime in 2000.
>
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to