MathGroup Archive 2010

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

Search the Archive

Newbie question: Using expanded Boolean Criteria w the Select funtion

  • To: mathgroup at smc.vnet.net
  • Subject: [mg111601] Newbie question: Using expanded Boolean Criteria w the Select funtion
  • From: Scotty <Scotty at yahoo.com>
  • Date: Sat, 7 Aug 2010 01:30:49 -0400 (EDT)

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


  • Prev by Date: parallel computing and message disabling
  • Next by Date: Re: Convex hull in 3D
  • Previous by thread: Re: parallel computing and message disabling
  • Next by thread: Re: Newbie question: Using expanded Boolean Criteria w the Select funtion