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
class Regex: | |
def simplify(self): | |
raise NotImplementedError | |
def __add__(self, other): | |
return RegexPlus(self, other) | |
def __mul__(self, other): | |
return RegexTimes(self, other) |
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
{-# LANGUAGE DeriveFunctor #-} | |
import Control.Monad.State | |
import Control.Monad.Writer | |
import Control.Monad.Except | |
import Control.Monad.Free | |
import qualified Data.Map.Strict as M | |
data GoExpr = | |
GoInt 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
class Main inherits IO { | |
i : Int <- 1; | |
s : String; | |
main() : Object {{ | |
while (i <= 16) loop { | |
out_string(line(i).concat(nline)); | |
i <- i + 1; | |
} pool; | |
print_lines(); | |
i <- 17; |
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
{-@ LIQUID "--no-termination" @-} | |
{-@ LIQUID "--short-names" @-} | |
{-@ LIQUID "--diff" @-} | |
module KMP (search) where | |
import Language.Haskell.Liquid.Prelude (liquidError) | |
import Data.IORef | |
import Control.Applicative ((<$>)) | |
import qualified Data.Map as M |
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
{ | |
"metadata": { | |
"name": "Document System" | |
}, | |
"nbformat": 3, | |
"nbformat_minor": 0, | |
"worksheets": [ | |
{ | |
"cells": [ | |
{ |
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
% chapter6.pl | |
append2([], L, L). | |
append2([X|T], L2, [X|L3]) :- append(T, L2, L3). | |
prefix(P, L) :- append2(P, _, L). | |
suffix(S, L) :- append2(_, S, L). | |
sublist(Sub, L) :- suffix(S, L), prefix(Sub, S). |
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
# classify_politics.py | |
# manually classify tweets as political or not | |
import sys | |
import json | |
if __name__ == "__main__": | |
#read tweets from JSON file |
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
# contractions.py | |
# list from: http://en.wikipedia.org/wiki/Wikipedia:List_of_English_contractions | |
contractions = [ | |
("aren't", "are not"), | |
("can't", "cannot"), | |
("can't've", "cannot have"), | |
("'cause", "because"), | |
("could've", "could have"), | |
("couldn't", "could not"), | |
("couldn't've", "could not have"), |