2023-07-01

First taste of Perl 6

Woohoo! Running it is believing. Now I believe Perl 6's regex voodoo is a reality, not just a figment of my imagination.

$

My first non-"Hello world!" Perl 6 program

#Perl6

Invoking perl6 from the good ol' command line

ekliao@ELI-1T-Side-MBP14 ~ % perl6

Welcome to Rakudo™ v2023.06.
Implementing the Raku® Programming Language v6.d.
Built on MoarVM version 2023.06.
To exit type 'exit' or '^D'

Entering actual code here

[0] > for '/usr/share/dict/words'.IO.lines -> $word {
* say $word if lc($word) ~~ /^ .e.rl $/;
* }

Executing code

ceorl
pearl
[0] > 

As is its wont, in just two lines of code, Perl 6 does something that would have taken like 20 lines in Python and 100 lines in Java in my guesstimation: it takes in all words in the built-in English word file (/usr/share/dict/words), one per line, and prints all words that match the regex `^ .e.rl ---

First taste of Perl 6

Woohoo! Running it is believing. Now I believe Perl 6's regex voodoo is a reality, not just a figment of my imagination.

. Turns out there are two.

One apparent convenience Perl 6 has over Perl 5 is that the whitespace inside a regex pattern is by default ignored, to enhance readability. Another feature not illustrated here is that single-line comments (beginning with the # character) can be embedded in regex too. I really appreciate this effort to encourage more regexing!

Next ...

I ventured into finding and installing a GUI IDE.


Learning French mot par mot, un mot à la fois

$

ChatGPT can do French to English literal translation, dictionary style

#gpt
In researching this mysterious French word that sounds like /ʁe "ɡlo/, I pulled this from the web, from a French-French dictionary site:

src
#paste/b

Définitions de « réglo »

Trésor de la Langue Française informatisé

Réglo, adj. inv.,arg. Conforme au règlement: des souliers réglo, marins 1917; une cravate réglo, bleue, soldats. 1917 (Esn., Notes compl. « Poilu », [1919] 1956). [En parlant de pers.] Correct dans son comportement.Est-ce que j'ai déjà vu des sœurs qui ne soient pas réglo? (Giono,Gds chemins, 1951, p. 184).

Wiktionnaire

Adjectif - français

réglo \ʁe.ɡlo\ masculin et féminin identiques (Familier)

  1. Conforme au règlement ; règlementaire.
    • En théorie il retape ces épaves : passage au marbre, tôlerie, mécanique, toujours réglo ; puis il revend les épaves remises à neuf, enfin, c'est ce qui apparaît au grand jour.— (Pierre Leterrier, Chantage tous risques, Éditions Rageot, 1992, chap. 5)

#paste/e

I then asked GPT to translate into English for me, to confirm my understanding of the definitions.

src: GPT

Definitions of "réglo"

Trésor de la Langue Française informatisé

Réglo, adj. inv., slang. Conforming to the regulations: "réglo" shoes, sailors 1917; a "réglo" tie, blue, soldiers 1917 (Esn., Notes compl. "Poilu", [1919] 1956). [Referring to people] Correct in behavior. "Have I ever seen sisters who are not 'réglo'?" (Giono, Gds chemins, 1951, p. 184).

Wiktionary

Adjective - French

réglo \ʁe.ɡlo\ (masculine and feminine identical) (informal)

  1. Conforming to the rules; regulatory.
    • "In theory, he repairs these wrecks: alignment, bodywork, mechanics, always 'réglo'; then he resells the refurbished wrecks, that's what appears on the surface." (Pierre Leterrier, Chantage tous risques, Éditions Rageot, 1992, chapter 5)

Bingo! This word is perfect and exactly what I wanted. Now I can use "règlo" more confidently, in meaning and in spelling, whenever I feel like dissing, like here when complaining about PDF Annotator being straitlaced, LOL.