[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: fancy sorting



On Wed, 2004-03-31 at 06:26, muppet wrote:
> What do you guys think?  Any ideas on how to improve this?

Just a humble attempt to find and kill all C-style for-loops. :-)

Other than that I think it's a good idea and a nice implementation.  It
should probably have "list" somewhere in the filename to indicate that
it deals with lists, though.

Bye,
-Torsten
--- fancy_sorting_orig.pl	2004-03-31 16:58:17.000000000 +0200
+++ fancy_sorting.pl	2004-03-31 16:40:26.000000000 +0200
@@ -25,9 +25,9 @@
 # also make it pointless to do what we're about to do, so bear with me.
 #
 my $model = Gtk2::ListStore->new (qw(Glib::String));
-for (my $i = 0; $i < 5 ; $i++) {
- for (my $j = 0; $j < 5 ; $j++) {
-  for (my $k = 0; $k < 5 ; $k++) {
+foreach my $i (0 .. 4) {
+ foreach my $j (0 .. 4) {
+  foreach my $k (0 .. 4) {
     $model->set ($model->append, 0, "$i, $j, $k");
   }
  }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]