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,065 |
Nodes: | 10 (0 / 10) |
Uptime: | 104:56:01 |
Calls: | 13,703 |
Calls today: | 1 |
Files: | 186,945 |
D/L today: |
5,508 files (1,878M bytes) |
Messages: | 2,413,637 |