Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4108
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: special iterator |
| Date | 2011-07-31 11:34 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j13eja$57c$1@smc.vnet.net> (permalink) |
| References | <201107300958.FAA25264@smc.vnet.net> |
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@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@yahoo.com
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: special iterator DrMajorBob <btreat1@austin.rr.com> - 2011-07-31 11:34 +0000
csiph-web