[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calculations while sorting?
From: |
John Darrington |
Subject: |
Re: Calculations while sorting? |
Date: |
Wed, 6 Aug 2008 09:09:55 +0800 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Tue, Aug 05, 2008 at 10:09:36AM -0700, Ben Pfaff wrote:
John Darrington <address@hidden> writes:
> I suppose this is one way of doing it, but it exposes (what I have in
> the past considered to be) casereader internals, and I'm not convinced
> that it's easier (from the point of view of the person writing
> procedures).
For what it's worth, I have never intended that any of the
functions used there be considered internal to the casereader or
sorting code. In particular, sort_execute() is only really meant
as a convenience function for a common case.
> My idea would have done the above with something similar to:
>
> const int n_stats = 3;
> struct statistics stats[n_stats];
> stats[0] = foo_create ();
> stats[1] = bar_create ();
> stats[2] = moments_create ();
> output = sort_execute (statistics_reader_create (input, stats,
n_stats));
>
> It just needs a very general purpose casereader/translator which is
> created with the function
>
> struct casereader *
> statistics_reader_create (struct casereader *, struct statistics *,
int);
As I said, I don't see anything wrong with that. Your code does
look a little simpler than mine, I admit. It would be easy to
implement it in terms of casereader_translator. Do you want me
to build something like that, or do you feel comfortable writing
it yourself?
I'm happy to give it a go.
Thanks.
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
signature.asc
Description: Digital signature