> From: butch.lakeshsore
> 
> I want to use the validate.ijs verb isinteger.
> 
>     isinteger 3
> 1
>     isinteger 3 3.5
> 0
> 
> The isinteger verb returns a boolean 0/1 depending if all
> the data is integer.
> 
> I wanted to use it to return a boolean vector/array/matrix
> depending based on
> each is an integer or not.

Numbers in an array are all the same type. If there is an integer in an 
otherwise Boolean array, the rest of the array is promoted to type integer. If 
there is a floating point number in an integer array, then the whole array is 
stored as floats. If you want to look at each number individually then you need 
to work at the atomic level using rank 0.

   isinteger"0  ] 3 3.5
1 0
 
> Could somebody please explain why:
> 
> given y is a vector
> 
> ( -: <. ) y
> 
> returns a scalar?

That is equivalent to:
 y -: <. y   NB. does y match the floor of y

-: compares its left and right argument to see if they match in their entirety.
>From the dictionary:
"x -: y yields 1 if its arguments match: in shapes, boxing, and elements; but 
using tolerant comparison"

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to