Ken - I don't know if this is what you want:

   ]atv=. <;._1&>,'&',&.><;._2]0 : 0
att5=1830
att2=3371&att6=3188&att3=536&att4=1176&att7=1832
att0=1732&att7=4102&att3=797
att6=4278&att1=3480&att2=4333&att5=2933&att7=1160
att1=808&att2=2321&att4=3544&att5=3794
)

+---------+---------+---------+---------+---------+
|att5=1830|         |         |         |         |
+---------+---------+---------+---------+---------+
|att2=3371|att6=3188|att3=536 |att4=1176|att7=1832|
+---------+---------+---------+---------+---------+
|att0=1732|att7=4102|att3=797 |         |         |
+---------+---------+---------+---------+---------+
|att6=4278|att1=3480|att2=4333|att5=2933|att7=1160|
+---------+---------+---------+---------+---------+
|att1=808 |att2=2321|att4=3544|att5=3794|         |
+---------+---------+---------+---------+---------+

   ]avp=. <;._1&.>'=',&.>atv
+-----------+-----------+-----------+-----------+-----------+
|+----+----+|++         |++         |++         |++         |
||att5|1830||||         |||         |||         |||         |
|+----+----+|++         |++         |++         |++         |
+-----------+-----------+-----------+-----------+-----------+
|+----+----+|+----+----+|+----+---+ |+----+----+|+----+----+|
||att2|3371|||att6|3188|||att3|536| ||att4|1176|||att7|1832||
|+----+----+|+----+----+|+----+---+ |+----+----+|+----+----+|
+-----------+-----------+-----------+-----------+-----------+
|+----+----+|+----+----+|+----+---+ |++         |++         |
||att0|1732|||att7|4102|||att3|797| |||         |||         |
|+----+----+|+----+----+|+----+---+ |++         |++         |
+-----------+-----------+-----------+-----------+-----------+
|+----+----+|+----+----+|+----+----+|+----+----+|+----+----+|
||att6|4278|||att1|3480|||att2|4333|||att5|2933|||att7|1160||
|+----+----+|+----+----+|+----+----+|+----+----+|+----+----+|
+-----------+-----------+-----------+-----------+-----------+
|+----+---+ |+----+----+|+----+----+|+----+----+|++         |
||att1|808| ||att2|2321|||att4|3544|||att5|3794||||         |
|+----+---+ |+----+----+|+----+----+|+----+----+|++         |
+-----------+-----------+-----------+-----------+-----------+
   ]atts=. {.&>avp
+----+----+----+----+----+
|att5|    |    |    |    |
+----+----+----+----+----+
|att2|att6|att3|att4|att7|
+----+----+----+----+----+
|att0|att7|att3|    |    |
+----+----+----+----+----+
|att6|att1|att2|att5|att7|
+----+----+----+----+----+
|att1|att2|att4|att5|    |
+----+----+----+----+----+
   ]vals=. ,"2 }.&>avp
+----+----+----+----+----+
|1830|    |    |    |    |
+----+----+----+----+----+
|3371|3188|536 |1176|1832|
+----+----+----+----+----+
|1732|4102|797 |    |    |
+----+----+----+----+----+
|4278|3480|4333|2933|1160|
+----+----+----+----+----+
|808 |2321|3544|3794|    |
+----+----+----+----+----+
   ]unqat=. a:-.~/:~~.,atts
+----+----+----+----+----+----+----+----+
|att0|att1|att2|att3|att4|att5|att6|att7|
+----+----+----+----+----+----+----+----+
   unqat i."1 atts
5 8 8 8 8
2 6 3 4 7
0 7 3 8 8
6 1 2 5 7
1 2 4 5 8
   ]ixs=. (13 : '(i.#y),&.>"(0 1) y')unqat i."1 atts
+---+---+---+---+---+
|0 5|0 8|0 8|0 8|0 8|
+---+---+---+---+---+
|1 2|1 6|1 3|1 4|1 7|
+---+---+---+---+---+
|2 0|2 7|2 3|2 8|2 8|
+---+---+---+---+---+
|3 6|3 1|3 2|3 5|3 7|
+---+---+---+---+---+
|4 1|4 2|4 4|4 5|4 8|
+---+---+---+---+---+
   }:"1 (vals) ixs}5 9$a:
+----+----+----+---+----+----+----+----+
|    |    |    |   |    |1830|    |    |
+----+----+----+---+----+----+----+----+
|    |    |3371|536|1176|    |3188|1832|
+----+----+----+---+----+----+----+----+
|1732|    |    |797|    |    |    |4102|
+----+----+----+---+----+----+----+----+
|    |3480|4333|   |    |2933|4278|1160|
+----+----+----+---+----+----+----+----+
|    |808 |2321|   |3544|3794|    |    |
+----+----+----+---+----+----+----+----+

Good luck,

Devon

On Tue, Nov 11, 2008 at 4:18 PM, Raul Miller <[EMAIL PROTECTED]> wrote:

> On Tue, Nov 11, 2008 at 3:38 PM, Lettow, Kenneth <[EMAIL PROTECTED]>
> wrote:
> ... lots of stuff...
>
> First off, I think you should have explicitly included
>   require'strings'
> to get the definition of cut that you use.
>
> Second off, the idiom I use to convert numbers to boxed words is ":each
> This works because the monad > on an integer is the identity function,
> but with a rank of 0.
>
> For example:
>   ":each i.8
>
> Anyways, long story short, your genattdat was too complicated for
> me to understand, so I rewrote it (and made a subtle change that
> hopefully does not matter):
>
> genattdat=: 3 : 0  NB. Verb to generate dummy data
>  MAXATTS=. 8      NB. maximum demo attributes per line
>  MAXVAL=. 5000    NB. max dummy value
>  attrlist=: 'att'&,@":each i.MAXATTS
>  res=. ":i.0 0
>  for. i.y do.     NB. generate y lines
>   randatts=. ({~  [EMAIL PROTECTED] ? #) attrlist
>   randvals=. ":each (#randatts) ?MAXVAL
>   res=. res,}:;randatts,.(<'='),.randvals,.<'&'
>  end.
> )
>
> This was totally irrelevant to your question, but it
> helped me think about your problem.
>
> Anyways, you seem to be having a problem converting
> token-identified values into position-identified values.
>
> But you are starting out with a sequence of tokens, and
> it would make sense to me to keep your intermediate
> results in that form.  For example, instead of using
> keepmsk, I might use keepinds:
>   ]keepinds=: atts i."1 keepattributes
>   ]keepinds {"1 vals,.a:
>
> I was also tempted to mess with your definitions for atts and
> vals, but I probably would have wanted to use regular
> expressions there, which might have totally changed
> the structure of the problem and would not have addressed
> the more basic point you were asking about.
>
> Anyways, there was nothing wrong with your approach, except
> that selection masks inherently discard order that i. by
> itself would keep.
>
> FYI,
>
> --
> Raul
> ----------------------------------------------------------------------
> 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