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.List.Split | |
import Control.Applicative | |
import Control.Monad | |
rows :: String -> [[Double]] | |
rows xs = (map read) <$> splitOn " " <$> lines xs | |
columns :: [[Double]] -> [[Double]] | |
columns rs = map (map head) $ | |
takeWhile (any (/= [])) $ |
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 NoMonomorphismRestriction, TupleSections, MonadComprehensions #-} | |
module MPDDatabase where | |
import Data.List | |
import qualified Database as D | |
import Control.Monad | |
import Text.ParserCombinators.Parsec | |
import Control.Applicative hiding ((<|>), optional) | |
data Directory = DirTerminal (String, String, [DContents]) deriving (Show) |
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 NoMonomorphismRestriction, TupleSections, MonadComprehensions #-} | |
module MPDDatabase where | |
import Data.List | |
import qualified Database as D | |
import Control.Monad | |
import Text.ParserCombinators.Parsec | |
import Control.Applicative hiding ((<|>), optional) | |
data Directory = DirTerminal (String, String, [DContents]) deriving (Show) |
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
#lang racket | |
(require unstable/list) | |
;; Helper functions | |
(define (on f g) | |
(λ (x y) (f (g x) (g y)))) | |
(define/contract ((<$> f) pair) | |
(-> (-> any/c any/c) (-> pair? pair?)) |
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
<?php | |
function compose($f, $g) { | |
return function() use($f, $g) { | |
$args = func_get_args(); | |
return $f(call_user_func_array($g, $args)); | |
}; | |
} | |
function add1($a) { | |
return $a + 1; |
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
from itertools import * | |
class Cont(object): | |
def __init__(self, func, *args): | |
self.args = args | |
self.func = func | |
self.done = False | |
def next(self): | |
if self.done: |
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
data Day = Mon | Tues | Wed | Thurs | Fri | Sat | Sun deriving (Enum, Ord, Eq, Show) | |
daysFromNow :: Day -> Int -> Day | |
daysFromNow day n = toEnum $ (fromEnum day) + n `mod` 6 | |
main = do | |
print $ daysFromNow Mon 2 | |
print $ daysFromNow Sat 7 | |
print $ daysFromNow Wed 13 |
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/python2 | |
import xchat | |
from time import sleep | |
from threading import Thread as Thd | |
import Queue as Q | |
__module_name__ = "ts" | |
__module_version__ = "1" | |
__module_description__ = "ts" |
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
function foo() { | |
var a = 1; | |
function bar() { | |
var a = 2; | |
console.log(a); | |
} | |
bar(); | |
console.log(a); | |
} |
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
function foo() { | |
var a = 1; | |
function bar() { | |
a = 2; | |
console.log(a); | |
} | |
bar(); | |
console.log(a); | |
} |