MathGroup Archive 2008

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

Search the Archive

Re: Identical elements

  • To: mathgroup at
  • Subject: [mg88431] Re: [mg88374] Identical elements
  • From: Andrzej Kozlowski <akoz at>
  • Date: Mon, 5 May 2008 06:13:32 -0400 (EDT)
  • References: <>

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,

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

  ls = {a, a, a, a};

SameQ @@ ls

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