On 11/5/2023 1:04 PM, Janis Papanagnou wrote:
Fast pre-calculated solutions can also be legible.
Apparently we just have different ideas of legible
- to me a hash lookup
is the clear and obvious way to implement this rather than a bunch of
if/else regexp comparisons.
Taking the idea of your variant further can simplify it even, e.g.
function nth_pre (num)
{
if (num ~ /[^0-9]/) return num
return num e[num%100]
}
[...]
That's a very good idea. [...]
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,070 |
Nodes: | 10 (0 / 10) |
Uptime: | 158:41:01 |
Calls: | 13,734 |
Calls today: | 2 |
Files: | 186,966 |
D/L today: |
808 files (292M bytes) |
Messages: | 2,418,677 |