Re: special iterator
- To: mathgroup at smc.vnet.net
- Subject: [mg120627] Re: special iterator
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sun, 31 Jul 2011 07:27:43 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201107300958.FAA25264@smc.vnet.net>
- Reply-to: drmajorbob at yahoo.com
If "explore" means "Print", it could be
list = Range[10];
j = 4;
MapIndexed[#2 != {j} && Print@# &, list];
1
2
3
5
6
7
8
9
10
or
Scan[Print, Delete[list, j]]
1
2
3
5
6
7
8
9
10
I can think of no functional solution that doesn't produce (and discard)
an extraneous list of length n or n-1, where n is Length@list.
Bobby
On Sat, 30 Jul 2011 04:58:46 -0500, lorenzo <lorenzo_ktm at yahoo.it> wrote:
> Hello everybody,
>
> I would like to define an iterator to explore all the elements in a list
> except for the one of index j.
>
> something like:
> {index,0,Length[myList]} and if index == j ---> index++
>
> Is it possible?
> Can I do this without deleting the j-th element?
>
> Thank you very much for helping :)
>
--
DrMajorBob at yahoo.com
- References:
- [Mathematica] special iterator
- From: lorenzo <lorenzo_ktm@yahoo.it>
- [Mathematica] special iterator