The Lua Century

203 views
Skip to first unread message

David Sicilia

unread,
Mar 13, 2025, 10:14:30 PMMar 13
to lu...@googlegroups.com
I assert that Lua is the only programming language where this is true:

assert( century[17].start == 1600 )

i.e., the 17th century represents the 1600s.  Therefore, Lua should be the preferred programming language for all historians.

Sainan

unread,
Mar 14, 2025, 4:16:00 AMMar 14
to lu...@googlegroups.com
This should hold for any language with 1-based indexing, so Lua is far from the only applicable language.

Not to mention that even a 0-based language like JavaScript could have this semantic in an array like [-100, 0, 100, 200, ...].

-- Sainan

Marc Chantreux

unread,
Mar 14, 2025, 5:07:53 AMMar 14
to 'Sainan' via lua-l
On Fri, Mar 14, 2025 at 08:15:51AM +0000, 'Sainan' via lua-l wrote:
> Not to mention that even a 0-based language like JavaScript could have this semantic in an array like [-100, 0, 100, 200, ...].

indeed. when it comes to "langages for non-programmers", I would really
use langages like raku to write a DSL that could be as natural as
possible so the capacity to define postfixed operator is important to
write thinks like

17th.middle.year == 1650
Trafalgar + 1week

Ruby use monkey patching to do this which is a bit ugly and dangerous
but raku, for exemple has operator definition:

class Century {
has Date $.begin;
has Date $.middle;
has Date $.end;
}

sub postfix:<th> (Int \d) returns Century {
my \begin = (d - 1) * 100;
Century.new:
end => (Date.new: year => begin + 99),
middle => (Date.new: year => begin + 50),
begin => (Date.new: year => begin)
}

regards

--
Marc Chantreux
Pôle CESAR (Calcul et services avancés à la recherche)
Université de Strasbourg
14 rue René Descartes,
BP 80010, 67084 STRASBOURG CEDEX
03.68.85.60.79

Gé Weijers

unread,
Mar 18, 2025, 11:11:22 PMMar 18
to lu...@googlegroups.com
As year 0 does not exist century[1].start should be 1. Shouldn't century[17].start not be 1601? 


--

sur-behoffski

unread,
Mar 19, 2025, 12:13:38 AMMar 19
to lu...@googlegroups.com
On 2025-03-19 13:40, Gé Weijers wrote:
> [...] Shouldn't century[17].start not be 1601? [...]

A purist would need to model Gregorian or Julian Calendars,
GMT/UTC +- leap seconds, time zones etc. as well... s-b


Pierre Chapuis

unread,
Mar 19, 2025, 4:18:45 AMMar 19
to lu...@googlegroups.com
The problem with Lua people is they'll probably want to use a Lunar Calendar (https://en.wikipedia.org/wiki/Lunar_calendar) :)

--
Pierre Chapuis
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages