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
betweenTimes :: Integral b => b -> Time -> Time -> Time -> Bool | |
betweenTimes n s e t = and [normT >= s, normT < e] where normT = fromIntegral (mod (floor t) n) | |
playForLoop :: Integral b => b -> Time -> Time -> Pattern a -> Pattern a | |
playForLoop n s e = playWhen (betweenTimes n s e) | |
seqPLoop :: Integral b => b -> [(Time, Time, Pattern a)] -> Pattern a | |
seqPLoop n = stack . (map (\(s, e, p) -> playForLoop n s e ((sam s) ~> p))) |
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/python | |
# Mandelbrot pattern generator by Bob Webb, 2012. | |
# Generates a Mandelbrot pattern as a 2D array of numerical values (number of iterations) that's then pickled. | |
# I need to get round to pickling metadata as well but not now. Har har. | |
import sys | |
import numpy | |
import pickle | |
import math |
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 qualified Data.Maybe as M | |
import Debug.Trace | |
-- Type type | |
data Type = Val Char | Arrow Type Type deriving Eq | |
instance Show Type where | |
show (Val c) = [c] | |
show (Arrow t1 t2) = "(" ++ (show t1) ++ " -> " ++ (show t2) ++ ")" | |
-- Substitution type |
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
# this code might not be correct | |
# but i thought the idea was kinda funny | |
# templating engines are still much better | |
# the pallets team are doing god's work | |
# i'm so sorry |
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 random | |
import nltk | |
from nltk.tokenize import TreebankWordTokenizer | |
""" | |
INSTALLATION INSTRUCTIONS: | |
Install nltk | |
Use the nltk downloader to install the Penn Treebank corpus | |
and averaged_perception_tagger |
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
use std::fmt; | |
/* | |
Made this to experiment with making abstract data structures in Rust. | |
I'm not entirely convinced that it's necessary to use Box here... | |
*/ | |
fn flip(p: &Point) -> Point { | |
Point{ x: p.y, y: p.x } |
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 python | |
# -*- coding: utf-8 -*- | |
# Python dependency injection experiment!! | |
# Provides a DependencyScope object which lets you declare | |
# dependencies and inject them in functions à la AngularJS | |
class DependencyScope: | |
def __init__(self): | |
self.dependencies = {} |
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
#include <stdio.h> | |
int main(void) | |
{ | |
FILE *fp; | |
fp = stdin; | |
int depth = 0; | |
int 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
#include <stdio.h> | |
#include <stdlib.h> | |
/** | |
Very simple stack / linked list data structure for | |
holding integers. | |
**/ | |
typedef struct Cell { |
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 decimal | |
import math | |
import random | |
from matplotlib import pyplot as plt | |
def bet(p): | |
return random.random() < p |
OlderNewer