Skip to content

Instantly share code, notes, and snippets.

View countvajhula's full-sized avatar

Siddhartha Kasivajhula countvajhula

View GitHub Profile
@countvajhula
countvajhula / module-load.md
Last active September 30, 2022 18:59
Understanding Racket module load time contributions

The Setup

This uses the codeloader tool to generate lots of dummy code. The same aggregate generated code is either contained in a single module or distributed across N=500 modules, and there are two client modules, main-combined.rkt and main-separate.rkt that require either the former or the (myriad) latter. The tests below are run on these "main" modules.

$ ./filecreator 500

Results

@countvajhula
countvajhula / loadlib.rkt
Last active July 12, 2022 01:32
Module load time tester
#!/usr/bin/env racket
#lang cli
(require racket/port
racket/format)
#|
This works by:
1. Running `racket -l <module_name>` and `racket -l racket/base` independently
2. Subtracting the latter from the former.
@countvajhula
countvajhula / RRFI: Universal Equality.rst
Last active March 19, 2022 19:06
RRFI: Two-Level Universal Scheme for Equality
@countvajhula
countvajhula / equality.org
Created February 4, 2022 00:38
Rhombus Meeting: Interface to elementary relations such as equality

0. Motivation

We all want Rhombus to succeed

Not a juggernaut but a flagship

Syntax is one aspect to experiment with and improve

Coherence is another

1. Theoretical stuff

Functions express any notion of equality

That’s why we intuitively reach for functions to tailor equality

“it makes no difference to me”

“if it’s all the same to you, …”

@countvajhula
countvajhula / AoC 2021 Day 1.rkt
Created December 6, 2021 04:09
AoC 2021 Day 1
#lang racket
(require qi
"util.rkt")
(define input (read-input-file "1.txt"))
(define depths
(parse-input input))
@countvajhula
countvajhula / vim-normal-grammar.md
Last active April 20, 2022 00:49
A Grammar for Vim's Normal Mode

A Grammar for Vim's Normal Mode

A rough attempt at characterizing Vim's Normal Mode grammar that I made while writing this Vim series. See the bibliography there for more context.

Notation: | means or, [] means optional, * means zero or more, <> means literal class (e.g. <number> could expand to 1, 2, etc.), ... means there are more instances not enumerated here (these would need to be fleshed out to get a complete grammar).

It could be interesting to use a grammar like this one to organize an interactive Vim cheatsheet.

normal-command = motion-form

| verb-phrase

@countvajhula
countvajhula / gist:87512d3a7ed3ee2b5b55c9f45ac7a871
Last active November 4, 2020 20:08
scribble error with reproviding a required function
examples: exception raised in example
error: "dynamic-require: name is protected\n name: 'syntax-local-expand-observer\n module: #<resolved-module-path:'#%expobs>"
context...:
do-error
.../scribble/eval.rkt:308:23: with-handlers-handler102
.../private/more-scheme.rkt:163:2: select-handler/no-breaks
.../scribble/eval.rkt:356:9
.../private/map.rkt:40:19: loop
[repeats 6 more times]
.../private/manual-vars.rkt:218:40
raco setup: rendering: <pkgs>/relation/scribblings/relation.scrbl
user break
context...:
p
call-in-empty-metacontinuation-frame
check-break-prefix
call-with-empty-metacontinuation-frame-for-swap
l
loop
dynamic-wind
[...]
raco setup: 0 running: <pkgs>/relation/scribblings/relation.scrbl
raco setup: 1 skipping: <pkgs>/unix-signals/unix-signals/unix-signals.scrbl
user break
context...:
user break
context...:p
call-in-empty-metacontinuation-frame
check-break-prefix