MathGroup Archive 2000

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

Search the Archive

Re: Testing the Head of List Elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25249] Re: Testing the Head of List Elements
  • From: leko at ix.netcom.com (J. Leko)
  • Date: Sun, 17 Sep 2000 04:47:28 -0400 (EDT)
  • References: <8psf4k$9n1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Marshall,

One way of accomplishing this is to use the Select command, with the
StringQ test condition. For example, try the following:

In[7]:= Select[{"a", 23.0, \[Alpha], 4, "376", -7}, StringQ]

Out[7]= {"a", "376"}

Note that if your list has already been assigned a name, then simply
substitute it in place of the list.

Regards,

J. Leko
University of Alabama in Huntsville

Please reply to leko*j at cspar.uah.edu and remove the *


In article <8psf4k$9n1 at smc.vnet.net>, "Marshall Bartlett"
<mgb_news at hotmail.com> wrote:

> I'm something of a newbie with Mathematica; please excuse my ignorance.
> 
> I am looking for a clever way to select elements from a list based on their
> type (Head).  Specifically, I want to extract all the elements of type
> dtring from a list of elements of different types (string, number,
> character, etc.).
> 
> Any suggestions?
> 
> --
> --------------------------------------------------------------
> Marshall Bartlett
> Department of Geology and Geophysics
> University of Utah
> mgb_news at hotmail.com
> --------------------------------------------------------------


  • Prev by Date: Use of Miscellaneous`RealOnly` Package
  • Next by Date: Re: How to display the desired numerical precision?
  • Previous by thread: Re: Testing the Head of List Elements
  • Next by thread: Re: Testing the Head of List Elements