MathGroup Archive 2001

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

Search the Archive

Re: List-Operations on Heads other than List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29757] Re: List-Operations on Heads other than List
  • From: "Allan Hayes" <hay at haystack.demon.co.uk>
  • Date: Sat, 7 Jul 2001 02:26:02 -0400 (EDT)
  • References: <9i068k$h0i$1@smc.vnet.net> <9i3pf2$lsh$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

"Orestis Vantzos" <atelesforos at hotmail.com> wrote in message
news:9i3pf2$lsh$1 at smc.vnet.net...
.....
> do keep in mind though, that Select searches in all the levels of your
> expression and you might get weird results because of this.
....

Orestis,

Select only selects from level one, ignoring heads.
You may be thinking of  Cases:

Select[h[a,b[c],d, e], MatchQ[#,_Symbol]&, 2]

        h[a,d]

Cases[h[a,b[c],d, e], _Symbol,{1, 2}, 4,Heads\[Rule]True]

        {h,a,b,c}

Note that Select uses the head h as a wrapper while Cases uses List.

--
Allan
---------------------
Allan Hayes
Mathematica Training and Consulting
Leicester UK
www.haystack.demon.co.uk
hay at haystack.demon.co.uk
Voice: +44 (0)116 271 4198
Fax: +44 (0)870 164 0565





  • Prev by Date: Re: freebsd and mathematica
  • Next by Date: Partitioning 1-D list into 2-D Matrix
  • Previous by thread: Re: List-Operations on Heads other than List
  • Next by thread: Should Pure Functions Require &