Re: Extracting a sub-list?
- To: mathgroup at smc.vnet.net
- Subject: [mg37944] Re: Extracting a sub-list?
- From: Mark Westwood <MarkCWestwood at compuserve.com>
- Date: Thu, 21 Nov 2002 00:38:10 -0500 (EST)
- References: <arg52u$6bd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Angle
Try something like
Cases[Table[x/2, {x, 1, 5}], _Integer]
Hope this helps.
Regards
Mark Westwood
AngleWyrm wrote:
>
> How do I extract the subset of answers in a list that are pure integers?
> As an example,
>
> in:
> Table[x/2, {x, 1, 5}]
> IntegerQ /@ %
>
> out:
> { 1/2, 1, 3/2, 2, 5/2 }
> { False, True, False, True, False }
>
> But I want to get a result of:
> { 1, 2 }
>
> -:¦:-
> AngleWyrm