2025.45 Advent of Advent

It’s that time of the year again: the time for writing Raku Advent Calendar blog posts! So that we can all enjoy them in the darkest days of the year (well, at least on the Northern Hemisphere). The elven have opened up the 2025 list of articles to be. Please add your name and proposed article title: beginner or medium or advanced. Or tongue-in-cheek, or ultra technical. It will all be well appreciated!

London Perl (and Raku) Workshop 2025 is On

Andrew / Organiser:
Well, it was a busy weekend, so I’ll have to update the site on Monday. Thanks for your patience. The event is going ahead as the Short Notice London Perl and Raku Workshop 2025 on 29th November, we’ve got some great talk proposals in, and am looking to confirm the venue the week of the 10th November (hopefully before Friday 14th November), and then it’s all go! =D.

Please visit https://www.londonperlworkshop.com and keep an eye out for the Call for Papers and further announcements. I hope to see you there!

Raku Tips ‘n Tricks

This is the third of the new tips and tricks item, with Nahita as a new contributor:

#RTnT#3: Generate N standard Normals

my \N = 750;
my @normals = sqrt(-2 × log(rand)) × cos(2×π × randxx N;

# Visualize their distribution
my $bin-width = 0.3;
my %binned is default([]) = @normals.classify(*.round: $bin-width);
put (-3, *+$bin-width  +3).map({ .fmt: "%4s {"-" x +%binned{$_}}\n" });

## Sample output
#`[
-3 ----
-2.7 --
-2.4 ------
-2.1 ---------
-1.8 ---------------
-1.5 ------------------------------------
-1.2 --------------------------------------------
-0.9 ------------------------------------------------
-0.6 --------------------------------------------------------------
-0.3 ----------------------------------------------------------------------------------
0 -----------------------------------------------------------------------------------------------------
0.3 ------------------------------------------------------------------------------------
0.6 ----------------------------------------------------------------------------
0.9 ------------------------------------------------------------------
1.2 -------------------------------------------
1.5 --------------------------------
1.8 ----------------------
2.1 ----------
2.4 ------
2.7 -
3 -
]


#`{ What's happening
Short answer:
- Box-Muller transform can make a Normal random number from two Uniform ones. Its formula almost verbatim
translates to Raku. The powerful `xx` with its "thunking" ability allows one to suddenly have a vector of Normals.

- Empirical distribution of the generated numbers is one sanity check of normality; `&round` with its (unexpected)
non-integer argument allows one to "bin" a number, and ever-helpful `&classify` assigns everyone to
their corresponding bin. Second step puts an ASCII representation of the distribution on the terminal.

Long answer: paste.debian.net/1405349

Some references
---------------
- https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform
- https://docs.raku.org/language/operators#infix_xx
- https://en.wikipedia.org/wiki/Thunk
- https://docs.raku.org/language/glossary#Thunk
- https://docs.raku.org/type/List#routine_classify
- https://docs.raku.org/type/Cool#routine_round
- https://docs.raku.org/type/Variable#trait_is_default
}

I hope you like this regular weekly item. To contribute please make a gist and share via the raku channel IRC or Discord.

Weeklies

Weekly Challenge #347 is available for your discovery.

CRA Corner

There is a new Open Source Software Stewards and CRA Whitepaper that describes this new, important role in Open Source projects under the Cyber Resilience Act (CRA) who duties including the publishing of Security Policies – a good read for those who may be interested in OSS security developments. I suspect a call for Stewards will come sometime soon!

New Docs Pull Requests

New Pull Requests

New Raku One-liners

Questions About Raku

Comments About Raku

New Raku Modules

Updated Raku Modules

Winding down

Really nice to see Nahita proposing an item for the Tips & Tricks section – I mean frankly, I think I could write 100s of these myself [please don’t!] … so don’t be shy and keep them coming.

Readers with sharp eyes will notice that this WordPress.com hosted blog now has Raku code highlighting – thanks to the new raku Hilite::Simple module (author yours truly). It is built on the Rainbow module by Patrick Böker and uses RakuAST under the hood. It uses the same default colour scheme as the new https://raku.org website. (and btw it’s a challenge to make HTML that WordPress does not regurgitate).

Big shout out to SmokeMachine for this weeks cover image that recalls the infamous mug throwing incident that started the work on Raku (the language formally known as Prince Perl6).

Please keep staying safe and healthy, and keep up the good work! Even after week 42 of hopefully only 209.

Meanwhile, still: Слава Україні!  Героям слава!

~librasteve (editor-in-chief)

Leave a comment