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