[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: A useful useless fact about Lua keywords
- From: Marc Balmer <marc@...>
- Date: Tue, 14 Sep 2021 15:44:30 +0200
> Am 14.09.2021 um 00:48 schrieb Hugo Musso Gualandi <hgualandi@inf.puc-rio.br>:
>
> As of Lua 5.4, there are no two keywords that share the same first and last letter. There are some that start with the same two letters, (else/elseif, repeat/return) but if we look at the first and last letter they are unique. For example, the only keyword that starts with "e" and ends with "f" is "elseif".
>
> One application of this useless fact would be if one wants to build a perfect hashing function for just Lua keywords. The hash function wouldn't have to look at all the characters of the word; just the first and last one should be enough.
This is only consequential as the name of the Lua programming shares the same property, which can not be said for e.g. C, which starts and ends with the same letter 'C'.