MathGroup Archive 2001

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

Search the Archive

Re: Head wanted


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