MathGroup Archive 2010

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

Search the Archive

Re: Newbie question: Using expanded Boolean Criteria w the Select

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111633] Re: Newbie question: Using expanded Boolean Criteria w the Select
  • From: Derivator <salcedo at ugr.es>
  • Date: Sun, 8 Aug 2010 07:21:33 -0400 (EDT)
  • References: <i3ir49$spr$1@smc.vnet.net>

On 7 ago, 07:31, Scotty <Sco... at Yahoo.com> wrote:
> To find all 6 letter words where the 1st & last characters are not
> equal, the following works & returns a list of 9921 words
>
> l1 = Select[DictionaryLookup[], StringLength[#] == 6 & ]; Length[l1]
> l2 = Select[l1, StringTake[#, 1] != StringTake[#, -1] & ]; Length[l2]
>
> 10549
>
> 9921
>
> What does it take to get this single boolean expression working w
> select??? i.e. How can it be done in 1 step??
>
> Select[DictionaryLookup[],
>  {StringLength[#] == 6} && {StringTake[#, 1] != StringTake[#, -1]} & ]
>
> TIA Scotty

Select[DictionaryLookup[],(StringLength[#]==6&&StringTake[#,1]!
=StringTake[#,-1])&]//Length
 9921

L.L.


  • Prev by Date: Re: Rearrange equation II
  • Next by Date: Re: Rearrange equation II
  • Previous by thread: problem with calling Mathematica from a Web application in ASP .NET
  • Next by thread: ExistsURLQ