Re: DeleteCases
- To: mathgroup at smc.vnet.net
- Subject: [mg27893] Re: DeleteCases
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Fri, 23 Mar 2001 04:31:12 -0500 (EST)
- References: <99chk4$8bn@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Robert,
t={1,2,3,4};
DeleteCases[t,_?(#>2&)] (*parentheses essential*)
{1,2}
or
DeleteCases[t, x_/;x>2]
{1,2}
--
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
"Robert Schuerhuber" <robert.schuerhuber at gmx.at> wrote in message
news:99chk4$8bn at smc.vnet.net...
> hi!
> i've a rather simple question with the deletecases, but unfortunately i
> couldn't find a clue in the mathematica-help (again ..):
>
> i want to to use DeleteCases to remove number of lists, which are
> greater than a given limit, eg.
>
> t={1,2,3,4}
> DeleteCases[t, ????]
>
> should remove all entries greater than 2, therefore
>
> t={1,2}
>
> which pattern do i have to use?
>
> regards, robert
>
>