[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calculations while sorting?
From: |
Ben Pfaff |
Subject: |
Re: Calculations while sorting? |
Date: |
Tue, 05 Aug 2008 10:09:36 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) |
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've forgotten where I was going with this,
but you can bet it was scathing."
--DesiredUsername