MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Identical elements


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


  • Prev by Date: 32-bit front-end on 64-bit machine
  • Next by Date: Re: Identical elements
  • Previous by thread: Identical elements
  • Next by thread: Re: Identical elements