P.S. I have to smile that validate.ijs uses 3!:0 right after its definition of
isboxed:
isboxed=: 0: < L.
ischaracter=: 3!:0 = 2:
I still agree it is best to program within the abstract language!
Kip Murray wrote:
> Thank you for pointing out the distinction between the abstract language and
> its
> implementation, and for the pointer to validate.ijs.
>
> I have some thinking to do: as Raul pointed out on the first day,
>
> L. E
> 0
>
> so E =: 0$<1 will not do for an empty set if I use isboxed =: 0 < L. in my
> definition of IsSet. In fact, 0 < L. rules out empties in the sense isempty
> =:
> (0 e. $) . A famous point set theorist, R. L. Moore, refused to entertain
> the
> notion of an empty set!
>
> In any case, I agree it is best to program within the abstract language, and
> the
> evidence now is that "boxed" in the definition of Link ; means 0 < L. .
>
> Thanks again,
> Kip
>
>
> Dan Bron wrote:
>>> Here's a concrete example. We
>>> know J (the notation) requires
>>> arrays to be homogeneous.
>> Perhaps a more germane example would've been:
>>
>> five =. {.5 2.3
>> five
>> 5
>>
>> Is five an integer?
>>
>> isInteger =. 4 = 3!:0
>> isInteger five
>> 0
>>
>> Not according to. 3!:0 . So maybe that's an inappropriate definition of.
>> isInteger? Maybe instead:
>>
>> isInteger =. =<.
>> isInteger five
>> 1
>>
>> The tests in the standard 'validate' script follow this pattern, and take
>> pains to avoid implementation details:
>>
>> NB. http://www.jsoftware.com/svn/base/trunk/main/main/validate.ijs
>>
>> load'validate'
>> isboxed
>> 0<L.
>>
>> Perhaps we can take that as Jsoftware's endorsement of this pattern as a
>> best practice.
>>
>> -Dan
>>
>>
>> Excuse typos; this message was composed on a phone.
>> ----------------------------------------------------------------------
>> 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