fi =: (= <.)

Consider whether you want intolerant comparison.

Henry Rich

On 6/12/2018 4:40 PM, Skip Cave wrote:
I want to find the integers in a vector of floating point numbers, by
generating a boolean marking vector indicating the locations of the
integers in the floating-point vector:

Generate a vector of integers & store in a, and generate a second vector of
floating and integer numbers by taking the square root of a:

b =. %: a=. 1+i.20


Create an integer-finding/marking verb:


fi =. 3 :'(<.y)=y'


Use 'fi' to find the integers in b:

fi b

1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0


Use the mark vector to find the perfect squares in a, by finding the
integers in b:


a#~ fi b

1 4 9 16

My question is:  What are some tacit ways to implement the fi verb?

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


---
This email has been checked for viruses by AVG.
http://www.avg.com

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

Reply via email to