Skip to content

Instantly share code, notes, and snippets.

View samebchase's full-sized avatar
🦑

Samuel Chase samebchase

🦑
View GitHub Profile
# Sort a flat directory full of Markdown files named using the
# YYYY-MM-DD format into a directory tree that looks something like
# the following:
#
# 2023/
# 01 - January/
# 2023-01-12.md
# 2023-01-19.md
# 2023-01-28.md
# 02 - February/
@Hirrolot
Hirrolot / CoC.ml
Last active April 5, 2024 15:34
How to implement dependent types in 80 lines of code
type term =
| Lam of (term -> term)
| Pi of term * (term -> term)
| Appl of term * term
| Ann of term * term
| FreeVar of int
| Star
| Box
let unfurl lvl f = f (FreeVar lvl)
@deadpixi
deadpixi / uuid4-apljk.md
Last active October 15, 2022 14:58
UUIDv4 in three different array languages.

UUIDv4 Generation in Three Different Array Languages

Here we see the same UUIDv4 generation function written in three different APL(-like) languages: APL, J, and K.

The algorithm is very simple, but one that lends itself well to implementation in an array language:

  • Generate a list of 36 random numbers between 0 and 15.
  • Transform each of those digits into a single-character string of the corresponding hex digit.
  • Join those characters together into a 36-character string.
  • Replace some of the characters with dashes.
  • Replace the character representing the version nybble with 4 (to indicate a version 4 UUID).
  • Constrain the character whose top two bits represent the variant to one that indicates the UUID is an RFC4122 UUID.
@digikar99
digikar99 / lisp-resources-digikar-2020.md
Last active November 9, 2023 04:35
If programming is more than just a means of getting things done for you, then Common Lisp is for you!
@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,

@alabamenhu
alabamenhu / Grammar proposal.md
Last active November 21, 2021 15:32
Grammar proposal

This is designed to be a working proposal. Comments/corrections/suggestions are welcome, as the first draft was written fairly hastily. I'm working on doing a rough implementation to play around with, beginning with the Binex proposal, which can be found here. It is not currently a full implementation of this proposal, but progressing rapidly.

Background

Grammars in Raku are awesome, and allow for some truly amazing text parsing.
Unfortunately, they are less than ideal for binary files, and there is no way to have them support matching objects, both of which would be very useful (image being able to pattern match on an AST!) This requires writing complex and/or error prone workaround code.

Goal

@stettix
stettix / things-i-believe.md
Last active March 20, 2024 17:45
Things I believe

Things I believe

This is a collection of the things I believe about software development. I have worked for years building backend and data processing systems, so read the below within that context.

Agree? Disagree? Feel free to let me know at @JanStette. See also my blog at www.janvsmachine.net.

Fundamentals

Keep it simple, stupid. You ain't gonna need it.

@xkr47
xkr47 / README.md
Last active November 11, 2019 12:20
Simple calculator in https://raku.org/ language, with support for time durations & base 2..36

Example session:

2+3

Result: 5₁₀

5d

Result: 5,00:00:00 = 5.000000 days
         120:00:00 = 120.000000 hours
@BriSeven
BriSeven / get on my lawn .md
Last active October 28, 2022 02:58
Get On My Lawn Software

Get ON my lawn is a software philosophy that believes good software grows better with time.

Get on my lawm shuns trends and salesmen disguised as programmers.

Get on my lawn shuns the fancy new framework.