Re: Mapping and AppendTo
- To: mathgroup at smc.vnet.net
- Subject: [mg91764] Re: [mg91719] Mapping and AppendTo
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sun, 7 Sep 2008 05:38:24 -0400 (EDT)
- Reply-to: hanlonr at cox.net
Use Append rather than AppendTo
M = {{0, 1, 2}, {4, 5, 6, 7}};
M = Append[#, 8] & /@ M
{{0,1,2,8},{4,5,6,7,8}}
Bob Hanlon
---- "Schettler wrote:
=============
Hello--
I would like mix use of Map and AppendTo in the following way (e.g.):
M = {{0,1,2},{4,5,6,7}};
AppendTo[#,8]&/@M;
Of course, this doesn't work, because {0,1,2} is not a symbol name,etc.
Is there a way to use Hold or Sow to make this construct work?
Thanks!
M. Schettler
--
Bob Hanlon