I have been tripped by this error a few times too.

Is there  a J idiom / verb that implements a design-by-contract or
input partameter type checking? For e.g.  scalar vs vector, boxed vs
open tests with friendly messages will help particularly when writing
wrappers to external dlls.

Regards,
Yuva



On 6/14/09, Jimmy Miller <[email protected]> wrote:
> Thanks, I've got it working now.  I believe I've encountered this
> before, where J has the same visual representation for different types
> of data.  I'll have to remember from now on that a vector with one
> element is *not* a scalar!
>
> On Sat, Jun 13, 2009 at 9:31 PM, Sherlock, Ric<[email protected]>
> wrote:
>>> From: Jimmy Miller
>>>
>>> I just had the following session in J 6.02:
>>>
>>>    a;2;'127.0.0.1';80
>>> +--+-+---------+--+
>>> |19|2|127.0.0.1|80|
>>> +--+-+---------+--+
>>>    19;2;'127.0.0.1';80
>>> +--+-+---------+--+
>>> |19|2|127.0.0.1|80|
>>> +--+-+---------+--+
>>>
>>> Now, my question is, given that sdconnect was passed the exact same
>>> argument in both calls, why did it give an error on the first one, and
>>> not the second?  Why does the use of the variable name have anything
>>> to do with it?
>>
>> Because although the argument appears to be the same they aren't.
>>   #$19
>> 0
>>   #$a
>> 1
>>
>> In other words, 19 is atomic (rank 0) whereas a is a one item list.
>> So this should work:
>>   sdcheck sdconnect ({.a);2;'127.0.0.1';80
>>
>>
>> ----------------------------------------------------------------------
>> 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