MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: fast way of appending x zeros to a list?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79109] Re: [mg79090] fast way of appending x zeros to a list?
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Thu, 19 Jul 2007 03:22:43 -0400 (EDT)
  • References: <200707180658.CAA04531@smc.vnet.net>

On Jul 18, 2007, at 2:58 AM, kristoph wrote:

> 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.

I'm not sure I understand what your problem is, if you know K then

PadLeft[data,Length[data]+K]

is equivalent to your Do loop.

Regards,

Ssezi


  • Prev by Date: Re: fast way of appending x zeros to a list?
  • Next by Date: Re: conditionals on lists
  • Previous by thread: fast way of appending x zeros to a list?
  • Next by thread: Re: fast way of appending x zeros to a list?