How about this?
   *./@(-:"_1 _ {.) a
1
   *./@(-:"_1 _ {.) b
1
   *./@(-:"_1 _ {.) c
0
   *./@(-:"_1 _ {.) d
0

> -----Original Message-----
> From: [email protected] [mailto:programming-
> [email protected]] On Behalf Of Ian Gorse
> Sent: Thursday, 12 November 2009 08:43
> To: Programming forum
> Subject: [Jprogramming] Checking if all elements are the same
> 
> Hi everyone,
> 
> This is slightly related my other thread on how to check if the first
> and last element were the same.
> 
> If I have
> a=. 2 2 2 2 2 2 2 2
> b=. 10 4 $ 2
> c=. 2 2 2 2 2 2 4
> d=. (10 4 $ 2) , 2 2 2 4
> 
> It can be seen that the list 'a' contains all the same number
> It can be seen that all the rows in matrix 'b'  are the same
> It can be seen that the list 'c' _doesn't_ contain all the same number
> It can be seen that the last row of the matrix 'd' is different of the
> result, thus d doesn't contain all the same rows.
> 
> I am looking for a way to perform a check to see if all the elements
> are the same or not.
> 
> I have managed to come up with a solution, but it is very ugly and
> inefficient
> 
> Thanks
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to