Re: Identical elements
- To: mathgroup at smc.vnet.net
- Subject: [mg88431] Re: [mg88374] Identical elements
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Mon, 5 May 2008 06:13:32 -0400 (EDT)
- References: <200805031017.GAA04030@smc.vnet.net>
On 3 May 2008, at 19:17, KFUPM 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
>
Do you really mean identical and not euqal? This is an important
distinction in Mathematica! Assuming that you do:
ls = {1, 1, a, 1};
SameQ @@ ls
False
ls = {a, a, a, a};
SameQ @@ ls
True
Andrzej Kozlowski
- References:
- Identical elements
- From: KFUPM <hussain.alqahtani@gmail.com>
- Identical elements