histo for strings?
Nov 21, 2006 at 6:38pm
histo for strings?
Is there an object or extrenal somewhere out there that can keep a running tally of how many times messages have been received? I have searched around but can’t find anything about this specifically.
Nov 22, 2006 at 1:26am
generally, i’d suggest:
it’d be nice to see an example patch that illustrates what you’re after better…
Nov 22, 2006 at 3:52am
Not really much in the way of an example patch needed to say what I was going for…
I was getting lists in the format “i s s” (ie. “1 2C On”) and I was looking for a way to keep a running tally of how often each combination came up. I thought maybe if I could turn it into a string there would be some sort of match/histo hybrid.
I ended up going for a more hardcoded approach – using a combination of route and atoi to get unique ID #s for the various lists and feeding them into a series of histo objects. Not the most elegant solution, but it works because I have a pretty controlled # of messages I can receive.
I was trying to stay away from coll because I’ve read that its one of the slower objects for querying data, and timing is relatively crucial for my application. Of course… who knows if my abstraction is really any faster.
Nov 22, 2006 at 6:09am
> I was getting lists in the format “i s s” (ie. “1 2C On”)
you could always use [checklist] by jasch.
my idea was simply to have a list of all your possible strings in [coll] (as the indexes) and then to query coll for the numbered index out of it’s middle-left outlet.
> I was trying to stay away from coll because I’ve read that its one of the slower objects for querying data,
this is simply not true.
Nov 22, 2006 at 6:17am
Ah, I see now… the coll index thing seems like a pretty clean solution. I guess the stories I’ve heard about its slowness are probably in cases where there is MUCH more data involved.
What I was really looking for (and, it seems, doesn’t exist) is an object that would keep track of these lists *without* it being pre-meditated. In either case we’ve discussed in this thread, adding a new possible combination would require that I go into the code and “teach” that combination to the patch myself…. whereas, with histo, I don’t necessarily have to tell it ahead of time to expect a 6. It just starts tallying once it gets the first one…
The checklist object seems on the right track… but it’s not doing any of the tallying that I needed.
And, to clarify… the list is arriving synchronously from a pack object.
Nov 22, 2006 at 8:00am
b -> counter
Nov 23, 2006 at 5:42pm
Ah sorry…. I should clarify:
I meant how many times various *specific* messages have been received. ie… if i get the message “go Dan go” an object that will keep a tally and say “you’ve received the message ‘go Dan go’ 12 times since I was last cleared”
b -> counter would certainly work if i was only trying to keep a tally of messages overall…. but I need more granularity than that.
as I mentioned earlier… I found a workaround for my particular situation but it seems to be an interesting topic for general discussion.
You must be logged in to reply to this topic.