in reply to taking a subset of HoHoA, retaining relative structure?

Probably the first thing I'd do is invert the HoA of the source structure, since the numbers are of primary importance; you won't need the letters ($a, etc.) until constructing the new structure.

So

'I' => { $a => [4,10,200], $b => [75,350], . . .
becomes
'I' => { 4 => $a, 10 => $a, 200 => $a, 75 => $b, 350 => $b, . . .

But you didn't say what should happen if a number appears in more than one list, e.g.

'I' => { $a => [10,200], $b => [75,200,350], . . .

Maybe that just won't happen.

More importantly, what should be the behavior if a number is in two different "clusters", e.g.

$interval = 500; 'I' => { $a => [200,500,800], . . .

In this case, 200 and 500 could be a cluster, and 500 and 800 could be a cluster. (Again, maybe this just won't happen.)

We're building the house of the future together.

Replies are listed 'Best First'.
Re^2: taking a subset of HoHoA, retaining relative structure?
by mdunnbass (Monk) on Oct 18, 2006 at 20:40 UTC
    Good questions, all. I didn't address them at first for 2 basic reasons. First, my post was already so long, and second, I haven't the foggiest notion of what I should do.

    I guess, in terms of the latter question

    $interval = 500; 'I' => { $a => [200,500,800], ...
    I guess my thoughts are, it's not *likely* to happen, but can. In that case, I was sort of thinking that if they overlap by $interval/2 or more, then just lump them together. Although, this can be dealt with at a later time.

    As for a number appearing in more than 1 list, ideally, again, this wouldn't happen, but I have to assume it will. Always assume the user will f*** up your program somehow, right?

    Matt