On Wed, Sep 30, 2009 at 10:31 PM, Christian Brabandt <cbli...@256bit.org> wrote: > > Hi Bee! > > On Mi, 30 Sep 2009, Bee wrote: > >> How to use something like repeat() to create a string like: >> >> '" '.(((start at 3 increment by 1) mod 10) for count of 62) >> >> resulting in: >> >> " 34567890123456789012345678901234567890123456789012345678901234 > > fu! Repeat(start, mod, count) > let i=1 > let s=[] > call add(s,a:start) > while i < a:count > call add(s,(s[i-1]+1)%a:mod) > let i+=1 > endw > return join(s, '') > endfu > > :echo Repeat(3,10,62) > 34567890123456789012345678901234567890123456789012345678901234
If you are comfortable with pythonic way of programming, you can get the same with: :echo join(map(range(3,64), 'v:val % 10'), '') 34567890123456789012345678901234567890123456789012345678901234 -- HTH, Hari > > > regards, > Christian > -- > "The Mac OS X kernel should never panic because, when it does, it > seriously inconveniences the user." > --http://developer.apple.com/technotes/tn2004/tn2118.html > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---