Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: hashing intervals

by sundialsvc4 (Abbot)
on Jul 30, 2013 at 03:11 UTC ( #1046940=note: print w/replies, xml ) Need Help??


in reply to hashing intervals

Your data could be expressed in an SQL (or SQLite) table with columns (low, high, value).   If the problem were to be approached in this way, the values associated with an entire table-full of values-of-interest could be obtained using a simple INNER JOIN query, e.g.:

SELECT a.search_for, b.code
FROM table_of_values a
INNER JOIN table_of_ranges b
ON (a.search_for IS BETWEEN b.low AND b.high)
SORT BY a.search_for

Obviously, “it all depends on what you are doing and on the context in which you are doing it,” but this eliminates the need to “write a Perl program” altogether.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1046940]
help
Chatterbox?
[stevieb]: yeah, so the wiringPi library appears to be missing/injecting incorrect defined variables into I2C calls, and it's all over the map. I'm going to have to revisit and use something else, write something else, or scrutinize the code and fix

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2017-06-23 00:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (532 votes). Check out past polls.