> > From: Ian Gorse
> >
> > I am looking for a way to perform a check to see if all the elements
> > are the same or not.
> >
> From: Sherlock, Ric
>
> How about this?
> *./@(-:"_1 _ {.) a
> 1
Here is another one:
(1 = #...@~.) &> a;b;c;d
1 1 0 0
isAllSame0=: -: 1&|.
isAllSame1=: *./@(-:"_1 _ {.)
isAllSame2=: 1 = #...@~.
ts=: 6!:2 , 7!:2...@]
f=: 30 (# ,:) i.10 20 30
20 ts 'isAllSame0 f'
0.00212922717994 1049728
20 ts 'isAllSame1 f'
0.000538559346748 33920
20 ts 'isAllSame2 f'
0.00608321959755 1082944
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm