lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Fri, Jun 5, 2015 at 7:13 AM, Roberto Ierusalimschy <roberto@inf.puc-rio.br> wrote:
Let us get real. Why would you want an item 2015.0605?? 

Well it's a language feature, right? Non-integer numeric keys have been valid for years (from the beginning?).  If you make something a feature, someone will find a use for it.

Just off the top of my head, I could imagine a data structure for analyzing Jurassic CO2 levels or temperature or whatever, which uses a sequence for percentiles, and entries for the actual measurement, keyed on fractional MYA with a step of 0.5, (i.e. 140.25, 140.75, 141.25, ..., 201.25). Note that with this scheme there's no possible range overlap, the gap is quite large, and the by-year section will never have an integer key. If we didn't know ahead of time the granularity of the percentile entries, we could use (#t/100) to calculate their width.

Lua 5.3 on 64 bit OS X gives the result I'd expect/want, but my reading of the manual suggests that this is (currently) an implementation detail and could get tripped up, especially if the gap/overlap constraints weren't in place. I'll let you and the community decide if that's The Right Thing™ or not, but there are usecases that could benefit from a stricter definition of sequence.

--
Brigham Toskin