Skip to content

Instantly share code, notes, and snippets.

class CapturedExitcode is Exception {
has $.exitcode;
}
sub embed-script($path --> List) {
my $out = Channel.new but role :: { has $.exitcode is rw; };
my $in = Channel.new but role :: { method put(Any:D \value){ self.send: value ~ $?NL } };
@wimvanderbauwhede
wimvanderbauwhede / raku-junctions-reconstructed.md
Last active October 15, 2020 09:14
Reconstructing Raku's Junctions

Reconstructing Raku's Junctions

Junctions in Raku are cool but at first glance they do not follow the rules for static typing. I was curious about their formal typing semantics, so I deconstructed and then reconstructed junctions from a functional, static typing perspective.

Junctions in Raku

Raku has this neat feature called Junctions. A junction is an unordered composite value. When a junction is used instead of a value, the operation is carried out for each junction element, and the result is the junction of the return values of all those operators. Junctions collapse into a single value when used in a Boolean context. Junctions can be of type all (&), any (|), one (^) or none (empty junction).

For example,

@raiph
raiph / .md
Last active February 17, 2024 23:12
Raku's "core"

Then mathematical neatness became a goal and led to pruning some features from the core of the language.

— John McCarthy, History of Lisp

If you prefer programming languages with a tidy and tiny core, you're in for a treat. This article drills down to the singleton primitive at the heart of Raku's metamodel ("model of a model") of a model of computation ("how units of computations, memories, and communications are organized")1.

The reason I've written this article

It began with u/faiface's reddit post/thread "I'm impressed with Raku"2. One of their sentences in particular stood out for me:

@jmhebert
jmhebert / nano_flash_sh.log
Created March 17, 2020 14:23
Nano flash.sh log from command line
###############################################################################
# L4T BSP Information:
# R32 , REVISION: 3.1
###############################################################################
# Target Board Information:
# Name: jetson-nano-qspi-sd, Board Family: t210ref, SoC: Tegra 210,
# OpMode: production, Boot Authentication: ,
###############################################################################
./tegraflash.py --chip 0x21 --applet "/home/jeff/nvidia/nvidia_sdk/JetPack_4.3_Linux_P3448/Linux_for_Tegra/bootloader/nvtboot_recovery.bin" --skipuid --cmd "dump eeprom boardinfo cvm.bin"
Welcome to Tegra Flash
@Ovid
Ovid / cor.md
Last active September 12, 2021 08:02
Cor—A minimal object system for the Perl core

NAME

Cor — A minimal OO proposal for the Perl core

VERSION

This is version 0.10 of this document.

AUTHOR

enum Command (
CMD_Copy => 0,
CMD_ByteRepeat => 1,
CMD_WordRepeat => 2,
CMD_ByteInc => 3,
CMD_CopyExisting => 4
);
grammar AlttpDecompression {
@djerius
djerius / compare.pl
Created July 22, 2018 17:39
benchmark hash element assignment and testing
use Benchmark ':all';
my @array = 1 .. 1000;
cmpthese(
10000,
{
'%foo = map { $_ => 1 } @array' => sub {
my %foo = map { $_ => 1 } @array;
@RabaDabaDoba
RabaDabaDoba / ANSI-color-codes.h
Last active April 19, 2024 06:01 — forked from iamnewton/bash-colors.md
The entire table of ANSI color codes working in C!
/*
* This is free and unencumbered software released into the public domain.
*
* For more information, please refer to <https://unlicense.org>
*/
//Regular text
#define BLK "\e[0;30m"
#define RED "\e[0;31m"
#define GRN "\e[0;32m"
@md2perpe
md2perpe / README.md
Last active August 18, 2019 16:18
Railroad diagram for 'Hey Jude'
@xsot
xsot / instructions.md
Last active March 3, 2024 13:42
sed maze solver

Usage

sed -E -f solver.sed input where input is a file containing the maze.

For best results, resize your terminal to match the height of the maze. To disable animations, delete the lines containing p.

Maze format

The solver assumes the following:

  • The maze only contains the characters # \nSE
  • Every line has the same number of characters
  • There is only one start (S) and end (E)