b=:%: i.14 f=: 13 :'(=<.)y' g=: 13 :'y=<.y' f = <. g ] = <. (f b)-:g b 1
Maybe J could simplify the display of function g. Linda -----Original Message----- From: Programming <programming-boun...@forums.jsoftware.com> On Behalf Of 'Bo Jacoby' via Programming Sent: Tuesday, June 12, 2018 6:13 PM To: programm...@jsoftware.com Subject: Re: [Jprogramming] Finding integers: (=<.) %: i.26 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 Den 22:42 tirsdag den 12. juni 2018 skrev Henry Rich <henryhr...@gmail.com>: 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 > https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.j > software.com%2Fforums.htm&data=02%7C01%7C%7C88acfb56840f4d94844808d5d0 > b1ba5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636644384111070286 > &sdata=EiynACNrQDActLmjRO%2FfG3wHSDXMMu8mw3I8cOsHiQg%3D&reserved=0 --- This email has been checked for viruses by AVG. https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.avg.com&data=02%7C01%7C%7C88acfb56840f4d94844808d5d0b1ba5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636644384111070286&sdata=DQMJpb7Vv%2BHD1AY7dbmi1BmbkplFOiO%2BFPiEGfzIFU8%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C88acfb56840f4d94844808d5d0b1ba5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636644384111070286&sdata=EiynACNrQDActLmjRO%2FfG3wHSDXMMu8mw3I8cOsHiQg%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.jsoftware.com%2Fforums.htm&data=02%7C01%7C%7C88acfb56840f4d94844808d5d0b1ba5a%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636644384111070286&sdata=EiynACNrQDActLmjRO%2FfG3wHSDXMMu8mw3I8cOsHiQg%3D&reserved=0 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm