From ... From: Erik Naggum Subject: Re: looking up entries in a table of ranges Date: 2000/02/07 Message-ID: <3158948495513418@naggum.no>#1/1 X-Deja-AN: 583083088 References: <821z6pknby.fsf@je1.jsc.nasa.gov> mail-copies-to: never Content-Type: text/plain; charset=us-ascii X-Complaints-To: newsmaster@eunet.no X-Trace: oslo-nntp.eunet.no 949995399 25695 195.0.192.66 (8 Feb 2000 07:36:39 GMT) Organization: Naggum Software; +47 8800 8879 or +1 510 435 8604; fax: +47 2210 9077; http://www.naggum.no User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 Mime-Version: 1.0 NNTP-Posting-Date: 8 Feb 2000 07:36:39 GMT Newsgroups: comp.lang.lisp * Jason Kantz | I need to make a table that returns an entry for a value in a given | range. And I'm wondering if a more experienced programmer can comment | on whether this is a common data structure with a common name. looks like a sorted association list to me. (assoc 50.0 '((10.0 . "this stuff") (40.0 . "this other stuff") (100.0 . "yet some other stuff")) :test #'<=) => (100.0 . "yet some other stuff") FIND would allow you to use a sequence of more complex objects and use :KEY to extract the slot you want to look at. in any case, I would expect such a function to be called FIND-foo, foo being the object you're looking for. whether you implement it as a general function traversing a list or a function with a fast TYPECASE dispatch on ranges is largely immaterial, though. #:Erik