This file contains hidden or 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 Control.Monad | |
import Data.Char | |
import Data.List | |
import Data.Ord | |
import System.IO | |
type Time = Double | |
type User = (String, Time) | |
readUser :: String -> User |
This file contains hidden or 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
module C208i | |
class Gradient | |
def initialize(gradient) | |
if gradient.length > 0 | |
@chars = gradient.chars | |
else | |
raise Exception.new("Gradient string must not be empty.") | |
end | |
end |
This file contains hidden or 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 ruby | |
module Machine | |
class Tape | |
def initialize(alphabet, initial='') | |
@alphabet = ('_' + alphabet).chars.uniq.join '' | |
@head = 0 | |
@tape = Hash.new | |
initial.each_char do |c| | |
self.write c |
This file contains hidden or 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
-- My eyes! The goggles do nothing! | |
import Data.Char | |
import Data.List | |
import Data.Maybe | |
import qualified Data.Map.Strict as Dm | |
type Symbol = Char | |
type Alphabet = [Symbol] | |
type State = String |
This file contains hidden or 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 | |
if [ $# -eq 0 -o "$1" == "--help" ]; then | |
echo "Usage: $(basename $0) device screen [-q]" | |
echo "device The device to set the screen for." | |
echo " Possible devices:" | |
xsetwacom --list devices | sed -n 's/\(.*\)id:.*/ * \1/p' | |
echo "screen The screen to set the given device's region to." | |
echo " Possible screens:" | |
echo " * screen (the entire display)" |
This file contains hidden or 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 Data.Maybe | |
import Data.List | |
import Data.Char | |
data Successor = Literal Double | |
| Previous Int | |
| Binary (Double -> Double -> Double) Successor Successor | |
| Unary (Double -> Double) Successor | |
type Term = (Int, Double) |
This file contains hidden or 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 Data.Maybe | |
import Data.List | |
import Data.Char | |
-- AST structure for successors | |
data Successor = Literal Double | |
| Previous Int | |
| Binary (Double -> Double -> Double) Successor Successor | |
| Unary (Double -> Double) Successor |
This file contains hidden or 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
// Don't know why these functions aren't part of the language but there you are. | |
module Util | |
module String = | |
let splitArray (delimiters: string list) (s: string) = | |
s.Split((Array.ofList delimiters), System.StringSplitOptions.None) | |
let splitArrayMax (delimiters: string list) max (s: string) = | |
s.Split((Array.ofList delimiters), max, System.StringSplitOptions.None) |
This file contains hidden or 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
open Util // fs-util available at https://gist.github.com/Quackmatic/2309d4f7b93631c99f22 | |
/// Relation tree structure. | |
type Relation = | |
| Add of left: Relation * right: Relation | |
| Subtract of left: Relation * right: Relation | |
| Multiply of left: Relation * right: Relation | |
| Divide of left: Relation * right: Relation | |
| Constant of value: float | |
| Relative of offset: int |
This file contains hidden or 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
open System | |
open System.Text.RegularExpressions | |
type Passage = { speakers: string list; lines: string list } | |
type Scene = { numeral: string; setting: string; speakers: string list; passages: Passage list } | |
type Act = { numeral: string; scenes: Scene list } | |
type Token = | |
| OpenAct of numeral: string |