Skip to content

Instantly share code, notes, and snippets.

View cofinalsubnets's full-sized avatar

gwem cofinalsubnets

  • 🕊
  • 22:11 (UTC -04:00)
View GitHub Profile
module Runty
UNDENTERS = %w{ elsif end when rescue \} ] ) }
class << self
def process(str)
@istack = [0]
ls=str.split(?\n).select{|l|l=~/\w/}
ls.each_with_index do |l,i|
if indentation(l) > ilvl
wind l
elsif indentation(l) < ilvl
@cofinalsubnets
cofinalsubnets / ebnf.hs
Created March 11, 2013 21:12
EBNF in a couple lines of Haskell
import Data.List
import Data.Char
import Data.Maybe
newtype Form = Form (String -> Bool)
(=~) :: String -> Form -> Bool
s =~ (Form f) = f s
splits :: String -> [(String,String)]
#!/usr/bin/env scheme-script
(import (chezscheme))
(define (S i) i)
(define (A i) (- i))
(define (T n) (lambda (i) (+ n i)))
(define (apply-symmetry s t)
(if (pair? t)
#include <string.h>
#include <stdio.h>
#include "wgc.h"
#define WGC_MEM_POOL_SIZE 1000
#define WGC_REF_POOL_SIZE 256
typedef struct ref {
char *data;
struct ref *next_root;
import Control.Monad
import Control.Applicative
import Data.List
-- "many" takes a datum and distinguishes it as an atom or a combination
-- "one" produces a value from an atom
-- "from" produces a value from a combination
-- "nothing" is the value of an "empty" combination (unit type)
{-# LANGUAGE Rank2Types, FlexibleInstances, MultiParamTypeClasses #-}
import Data.Set (Set, fromList, toList, intersection, union, empty, singleton)
import Control.Monad
import Control.Monad.Identity hiding (fix)
type MSet = forall m. (Monoid m, Ord m) => Set m
-- what's the math that underlies this ??
#!/usr/bin/env sh
cat <<OK
extralegal license * $1
this license imposes no legal constraints on the use, duplication, or
modification of the covered material. however, it is the copyright holder's
intention that:
- any copy made of the material should include a copy of this license; and that
#!/usr/bin/python3
from functools import *
import random
import uuid
import math
from PIL import Image, ImageDraw, ImageColor
def count(zero, succ, n):
x = zero
for _ in range(n):
@cofinalsubnets
cofinalsubnets / Makefile
Last active December 25, 2017 18:55
sixp
CC := gcc
NAME := sixp
INSTALLDIR := /usr/local/bin
LIB := lib.6p
FIB := fib.6p
REPL := repl.6p
CFLAGS := -Og -g -Wall -Werror -Wpedantic -std=c11
$(NAME): $(NAME).c