pspp-dev
[Top][All Lists]
Advanced

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

design question


From: Jason Stover
Subject: design question
Date: Thu, 23 Jun 2005 20:55:15 +0000
User-agent: Mutt/1.4.2.1i

For the categorical recoding routines, I need to pass the data in the
active file twice. I'm sure there is a way to do this with only one
data pass, but doing so would be a nontrivial and premature optimization.

So I have two choices, which can be described as follows.  Assume cf
is my casefile *. I had decided to use method 1 before emailing the
list; I'm asking about method 2 mostly out of curiosity.

1.  
    i = 0; 
    for(r = casefile_get_reader (cf);
      casereader_read (r, &c) ; case_destroy (&c)) 
    {
        /*
         * I copy the data I need from the active file and
         * pass through them again if necessary.
         */
        store_data (&stored_data, i);
        i++;
    }
    number_of_data = i;

     for (j = 0; j < number_of_data; j++)
        {
          /* Second data pass here */
          do_wa (stored_data, j);
        }

2. (I know this is technically illegal, but is something like
it legal?)

  for(r = casefile_get_reader (cf);
      casereader_read (r, &c) ; case_destroy (&c)) 
    {
        /* Do part one. */
    }
  for(r = casefile_get_reader (cf);
      casereader_read (r, &c) ; case_destroy (&c)) 
    {
        /* Do part two. */
    }

I was going to use method 1, but I started wondering if anyone should
ever use method 2, or something like it? The casefile is discarded
after the cases are read (according to a comment in casefile.c). Does
'discarded' mean the data are no longer accessbile, ever ever ever?
Is method 2 an abomination?

-Jason
-- 
address@hidden
SDF Public Access UNIX System - http://sdf.lonestar.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]