View a.vm.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { readFile } from "fs/promises"; | |
import { createInterface } from "readline"; | |
import type { Interface } from "readline"; | |
import { CESKM, parse_cbpv, scalar, continuation, topk } from "precursor-ts"; | |
import type { State, Value, Store } from "precursor-ts"; | |
import { | |
createMachine, | |
state, | |
transition, | |
reduce, |
View ctx.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* outputs: | |
* a { a: 3, b: 6, c: 12 } | |
* b { a: 5, b: 10, c: 18 } | |
* c { a: 8, b: 16, c: 27 } | |
* { a: '25', b: '196', c: '900' } | |
* c 900 | |
*/ | |
// todo: use type system to statically verify the key exists in the object. |
View arith.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { _, Functor, Fix, _in, cata, Algebra } from './base'; | |
import { strict as assert } from 'assert'; | |
// The type parameter goes where the grammar would otherwise reference itself. | |
type ArithF<A> | |
= { tag: 'add' ; lhs: A ; rhs: A } | |
| { tag: 'mul' ; lhs: A ; rhs: A } | |
| { tag: 'num' ; n: number } | |
| { tag: 'paren' ; e: A } ; |
View cont.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{- cabal: | |
build-depends: base | |
-} | |
module ContT | |
( ContT | |
, reset | |
, shift | |
, liftIO | |
) |
View twitch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
### | |
# Usage | |
### | |
# twitch <path-to-file> | |
PATH_TO_TWITCH_KEY="$HOME/.config/twitch.key" | |
if [ ! -f "$HOME/.config/twitch.key" ]; then | |
echo "Please write your twitch key to $PATH_TO_TWITCH_KEY" |
View rec.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class cont: | |
def __init__(self, fn): | |
self.fn = fn | |
def __call__(self, *args, **kwargs): | |
return (lambda: self.fn(*args, self, **kwargs)) | |
class tailrec: |
View write_to_fd.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Helper function which writes a string to a file descriptor. | |
*/ | |
static gboolean | |
write_to_fd (int fd, const gchar *message) { | |
gsize bw; | |
GIOChannel *channel = g_io_channel_unix_new (fd); | |
GString *message_str = g_string_new (message); | |
g_string_append (message_str, "\n"); | |
g_io_channel_write_chars (channel, | |
message_str->str, |
View cast.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MEDIA_FILE="$1" | |
if [ -z "$1" ]; then | |
echo "Please specify a media file as the first argument." | |
exit 1 | |
fi | |
CHROMECAST_IP4_ADDRESS="$2" |
View gist:d89ee5442c10ca59ac9a8b621392ed10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang r5rs | |
; Composable syntax-rules macros via the CK abstract machine | |
; | |
; We demonstrate (mutually-) recursive, higher-order applicative | |
; macros with clausal definitions, defined in the style that looks very | |
; much like that of ML or (strict) Haskell. | |
; We write composable, call-by-value--like macros without | |
; resorting to the continuation-passing-style and thus requiring no | |
; macro-level lambda. The syntax remains direct-style, with | |
; nested applications. |
View psilo-typeclass.sl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; Hask-- I mean, psilo with no real typeclasses and one virtual typeclass. | |
; Inspired by [1], this is an exploration of representing all typeclasses | |
; through one distinguished class. | |
; | |
; This version of psilo does not have "real" typeclasses. However faking them | |
; with explicit dictionary passing does seem to correctly infer and check the | |
; constraints. | |
; | |
; The goal then is to figure out how best to represent "real" typeclasses as a | |
; distinguished feature in the language implementation given that we are |
NewerOlder