Skip to content

Instantly share code, notes, and snippets.

💭
In search of a programming language that's not mostly shite

Max Bernstein tekknolagi

💭
In search of a programming language that's not mostly shite
Block or report user

Report or block tekknolagi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bnf.py
import inspect
import ast
def terminal(s):
return "<%s>" % s
def define_name(o):
return terminal(o.id) if isinstance(o, ast.Name) else o.s
@tekknolagi
tekknolagi / specification.md
Created Oct 24, 2018 — forked from rain-1/dcs.rkt
Dotted Canonical S-expressions - DCSexps
View specification.md

Dotted Canonical S-expressions - DCSexps

This is a specification for an s-expression interchange format that attempts to improve upon [2]rivest's canonical s-expressions.

It is an output format for a subset of s-expressions. Those containing only pairs and atoms.

It was designed with the following desirable properties in mind:

  • It has the canonicity property that (EQUAL? A B) implies the DCS output of A is byte equal to the DCS output of B.
  • It has the non-escaping property that arbitrary binary blobs can be contained as atoms without any processing. A consequence of this is that dcsexps can be nested easily.
View megan.py
import matplotlib.pyplot as plt
import numpy as np
from decimal import *
getcontext().prec = 1000
e = Decimal(np.e)
def y1(x):
View ex.py
import itertools
import math
import matplotlib.pyplot as plt
import numpy as np
import tufte
from collections import namedtuple
SNPoint = namedtuple('SNPoint', ['sn_name', 'z_cmb', 'mu_mag', 'err_mu',
'sample', 'flag'])
View Makefile
# Pandoc with my options
PANDOCBIN=stack exec pandoc -- --smart --standalone --from=markdown+footnotes \
--filter pandoc-include-code
# Special options for ether PDF or HTML
PANDOCPDF=$(PANDOCBIN) --include-in-header header.tex
PANDOCWEB=$(PANDOCBIN) --self-contained --include-in-header header.html
# Where the output should go
OBJDIR=_gen
View myocamlbuild.ml
open Ocamlbuild_pack
open Ocamlbuild_plugin
let astgen = "./astgen.native"
let compile_c ~impl ~native tags arg out =
let tags =
tags ++ "ocaml" ++ (if native then "native" else "byte") ++ "compile"
in
View astgen.ml
type stream =
{ mutable line_num: int; mutable chr: char list; chan: in_channel };;
let stringOfChar c =
String.make 1 c;;
let read_char stm =
match stm.chr with
| [] ->
let c = input_char stm.chan in
View gadt.ml
type _ showable = ..
let show : type a. a showable -> a -> string = fun _ x ->
failwith "Failed overloading resolution."
type _ showable += Int : int showable
let show : type a. a showable -> a -> string = function
| Int -> string_of_int
| showable -> show showable
View tufts.io-ns-proposal.md
View sat.ml
type formula = [
| `Atom of string
| `Not of formula
| `Or of formula list
| `And of formula list
]
type redformula = [
| `Atom of string
| `NotAtom of string
You can’t perform that action at this time.