Hi Ian, 
They both work but don't feel very Jish to me :-). 

Note that the 2nd solution can be simplified to:
 
". ,',.'&,&> ;:z

Ric

> From: Ian Clark
> Sent: Thursday, 17 June 2010 12:25
> 
> May I offer a blonde solution?
> 
> require'strings'
> z=: 'Var1 Var2 Var3 Var4 Var5'
> ". z rplc ' ';',.'
> 
> or if use of rplc is out-of-order...
> 
> ". ,',',.'.',.>;:z
> 
> 
> On Thu, Jun 17, 2010 at 12:29 AM, Sherlock, Ric
> <[email protected]> wrote:
> > How best to form a matrix from a list of noun names where each noun
> is a list of values that will form a column in the matrix?
> >
> > Below is one solution, are there better ones?
> >
> > Named nouns:
> > 'Var3 Var5 Var4 Var1 Var2' =: 5 7 ?...@$ 60
> >
> > evoke=: 3 : 'y~'
> > toMatrix =: [: ,.&:>/ [: evoke&.> ;:
> >
> >   toMatrix 'Var1 Var2 Var3 Var4 Var5'
> > 16 36  6 31 37
> >  0 46 35 32 40
> > 24  5 59 58 14
> > 24 17 52  0  6
> > 11  8 14 10 38
> > 13 48 39 42 13
> > 23 42 20 11 58
> >
> > ---------------------------------------------------------------------
> -
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> >
> ----------------------------------------------------------------------
> 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