On Fri, Jun 5, 2009 at 11:58 PM, PackRat<[email protected]> wrote:
> As a newer J learner, I've been meaning to ask something for quite a
> while now, and Raul's response gives me an opportunity.
>
> But first, Raul, I have an imponderable: your solution works for the
> test case, and yet it fails with
>
> |domain error
> | (~...@[,.+&.>//.)/|:t1
>
> for the "real" data, which are structured EXACTLY like the test data,
> only with longer key names and far more rows. Since I can't attach
> files in the forum, can I email you the actual data file I'm using
> (less than 2800 bytes) so that you might have a better chance to figure
> out what's going on? One possibility for the problem is that the
> values in the second column are actually literal, not numeric (I
> neglected to note that, sorry)--however, since I don't completely
> understand your code (see below), I'm not sure where/how to make any
> changes to the code that might be needed for that adjustment.
Sure, you can mail it to me.
A simple test, though, for the likely cause, would be:
1 {::"1 t1
This should give you a list of numbers. It will give you a
domain error if any values in t1 are not numbers.
>> I hope my explanation is clear enough -- if not, and
>> if the relevant dictionary entries do not clear things
>> up for you, just ask.
>
>> t1=: col1 ,. ]&.> col2
>> t2=: (~...@[ ,. +&.>//.)/ |:t1
>
> I understand much of what you wrote, but I'm having the darndest time
> understanding the DYADIC use of "[" and "]"--which is my long-standing
> question in mind that I mentioned at the start of this message.
monadic - 1
dyadic 3 - 1
Dyadic means you have two arguments, a left one and
a right one.
[ is the left identity verb, so gives you its left argument (assuming
there is one).
] is the right identity verb, so gives you its right argument.
> moment was that "[" referred to the noun in the left "x position" with
> reference to the entire tacit verb expression and that "]" referred to
> the noun in the right "y position" with reference to the entire verb
> expression--in other words, in "x tacitverbexpression y", any "["
> within the tacit verb expression refers to the value of x and any "]"
> within the tacit verb expression refers to the value of y. I don't
> know if this understanding is correct, though.
That's reasonably close. I can provide some examples where
"getting x or y" is not really what they do, but let's get through
this current topic first.
> Taking the Dictionary definition exactly and literally, it would appear
> that in t1 everything to the left of the "]" should be thrown out and
I was not able to follow your line of thought here. Perhaps if
we could work through some examples I could understand
what you were saying?
However:
2 [ 3
2
2 ] 3
3
I hope this helps.
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm