I often use tables of data with the first row being column titles:

   ]dmat=. ('ht';'wt';'age'),<"0]60 120 16,72 205 44,70 195 49,:66 125 46
+--+---+---+
|ht|wt |age|
+--+---+---+
|60|120|16 |
+--+---+---+
|72|205|44 |
+--+---+---+
|70|195|49 |
+--+---+---+
|66|125|46 |
+--+---+---+
   'tit dat'=. split dmat
   tit
+--+--+---+
|ht|wt|age|
+--+--+---+
   dat=. >dat
NB. Either use the columns as needed:
   ]hts=. dat{"1~tit i. <'ht'
60 72 70 66

NB. Or assign each to its title:
   (tit)=. |:dat
   ht
60 72 70 66
   wt
120 205 195 125
   age
16 44 49 46

On Mon, Aug 25, 2008 at 12:00 PM, Philip A. Viton <[EMAIL PROTECTED]> wrote:

>
> The standard J way to pass data to a verb is
>
> 'a b c' =. y
>
> One problem is that this requires you to keep track of the order of the
> arguments, and if you add an argument you need to re-write in 2 places: the
> call and in the verb. Has anyone come up with a way to pass
> equality-separated strings (eg, ('a=2';'b=5')  or maybe for us
> ('a=.2';b=.5'))? One way that I think would work is to use packing, but I
> think that requires you to first set the values of the arguments, and then
> pack them, since the right arg for pack is a set of names, not names and
> their values.
>
> Any suggestions?
>
> ------------------------
> Philip A. Viton
> City Planning, Ohio State University
> 275 West Woodruff Avenue, Columbus OH 43210
> [EMAIL PROTECTED]
>
> ----------------------------------------------------------------------
> 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