comp.lang.tcl
[Top] [All Lists]

Re: How to turn a very long list into smaller lists

Subject: Re: How to turn a very long list into smaller lists
From: ZB
Date: 30 May 2008 18:17:39 GMT
Newsgroups: comp.lang.tcl

Dnia 30.05.2008 Mel <MelHeravi@xxxxxxxxx> napisał/a:

> I have a list that is very long and I need to break it into smaller
> lists of say 50 elements (the original list is a muliple of 50.

An example operating much shorter lists - you'll have to expand it a little
to reach the needed sizes:

#v+
  set ii 0
  foreach {a b c} {1 2 3 4 5 6 7 8 9} {
    set ::list$ii [list $a $b $c]
    puts [set ::list$ii]
  }

  1 2 3
  4 5 6
  7 8 9
#v-

That "puts", of course, is just for "visual effects".
-- 
ZB

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy