MathGroup Archive 2010

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

Search the Archive

All componens different

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111996] All componens different
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Mon, 23 Aug 2010 02:51:46 -0400 (EDT)

Given a list v of natural numbers I'm looking for a function d[v_] that 
returns True if all components are different and False otherwise.

One solution is

d1[v_] := ! Or @@ Flatten[Table[v[[i]] == v[[k]], {i, 1, Length[v]}, 
{k, i + 1, Length[v]}]]

Can you find more efficient (and elegant) solutions?

Regards,
Wolfgang 



  • Prev by Date: Re: "Abort Evaluation" does not work
  • Next by Date: Re: Filling from x_1 to x_2
  • Previous by thread: Re: Binning a dependent variable (CORRECTION)
  • Next by thread: Re: All componens different