fast way of appending x zeros to a list?
- To: mathgroup at smc.vnet.net
- Subject: [mg79090] fast way of appending x zeros to a list?
- From: kristoph <kristophs.post at web.de>
- Date: Wed, 18 Jul 2007 02:58:56 -0400 (EDT)
Dear all, I'm looking for a fast way to append 0's to a list. Unfortunately, I append a variable number of 0's to a list which is generated by a For[...]-loop. Therefore, PadLeft[...] is not variable enough to append exactly x zeros to the list. At the moment I use: Do[PrependTo[data,0],{K}] where the K depends on certain factors. In case you have an idea to append exactly x zeros to the left quickly I would be more that happy since I heard that the PrependTo[...] and AppendTo[...] functions are very slow. Thanks a lot.
- Follow-Ups:
- Re: fast way of appending x zeros to a list?
- From: Sseziwa Mukasa <mukasa@jeol.com>
- Re: fast way of appending x zeros to a list?