Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Head wanted

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29835] Re: [mg29818] Head wanted
  • From: BobHanlon at aol.com
  • Date: Fri, 13 Jul 2001 04:19:16 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

In a message dated 2001/7/12 2:59:56 AM, antoine.zahnd at iprolink.ch writes:

>How is it possible to return all the symbols ( belonging to the current
>context ),  having a prescribed Head ?
>

namesOfType[type_, context_:"Global"] := 
  Select[Names[context<>"`*"], Head[ToExpression[#]] == type&];

e = {a, b=5, c=3I, d = "string"};

namesOfType[#]& /@ {Symbol, String, Integer, Complex, List}

{{"a", "context", "namesOfType", 
   "type"}, {"d"}, {"b"}, {"c"}, 
  {"e"}}


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: Re: Voronoy Diagrams ?
  • Next by Date: Re: kernel problem for trigonometry
  • Previous by thread: Head wanted
  • Next by thread: Re: Head wanted