If you install the 'general/misc' addon using Package Manager <http://code.jsoftware.com/wiki/JAL/Package_Manager/> there is a script (validate.ijs) that provides many tools for testing type/structure including:
NB.* inrange v (low, high) inrange data NB.* isbalanced v pair isbalanced string NB.* isboolean v data is all 0 or 1 NB.* isboxed v is boxed NB.* ischaracter v data is character NB.* iscounter v data is non-negative integer (counting number) NB.* iscomplex v data is complex NB.* isdate v is date (as yyyy mm dd) NB.* isempty v data is empty NB.* isinteger v data is all integer NB.* ismatrix v data is a matrix NB.* isnumeric v data is numeric NB.* isrational v data is rational NB.* isreal v data is all real NB.* isscalar v data is a scalar NB.* isunicode v data is unicode (literal2 or literal4) NB.* isliteral2 v data is literal2 NB.* isliteral4 v data is literal4 NB.* isunique v data has no duplicates NB.* isutf8 v text is valid UTF-8 NB.* isutf16 v text is valid UTF-16 NB.* isvector v data is a vector On Tue, Apr 4, 2017 at 7:34 AM, Louis de Forcrand <[email protected]> wrote: > A few useful shortcuts: > > isBoxed=: 0 < L. > isChar=: {.@, e. a."_ > isInt=: = <. > isReal=: = + > > Louis > > > On 2 Apr 2017, at 14:43, 'Pascal Jasmin' via Programming < > [email protected]> wrote: > > > > datatype or 3!:0 > > > > > > datatype 3 4.1 0 > > > > > > > > > > ________________________________ > > From: Herbert Weissenbaeck // Privat <[email protected]> > > To: [email protected] > > Sent: Sunday, April 2, 2017 8:33 AM > > Subject: [Jprogramming] type/domain of an argument > > > > > > > > quick beginner's question: > > > > how can i test whether an x or y argument is an array of int or an array > of float or an array of char or of any other type (to avoid domain errors > and handle different types differently in functions)? > > > > thank you > > > > herbert > > > > > > ---------------------------------------------------------------------- > > > > 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
