Re: Identical elements
- To: mathgroup at smc.vnet.net
- Subject: [mg88410] Re: [mg88374] Identical elements
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Mon, 5 May 2008 06:09:45 -0400 (EDT)
- Reply-to: hanlonr at cox.net
ident[x_List] := Length[Union[x]] == 1; n = 100000; ident /@ RandomInteger[{0, 1}, {n, 3}]; Count[%, True]/n // N 0.25012 Bob Hanlon ---- KFUPM <hussain.alqahtani at gmail.com> wrote: > Dear All > > I have a list and i need to test whether all the elements in the list > are identical or no. What is the efficient way to do that? The output > should be true if all elements are the same and False otherwise. One > line command is preferred if possible. > > Your help is highly appreciated. > > Regards, > > HMQ >