> 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