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
;;; kiloseconds.lisp -- Bring Kiloseconds to StumpWM | |
;;; | |
;;; Copyright 2009 Ben Duffield | |
;;; | |
;;; This module is free software; you can redistribute it and/or modify | |
;;; it under the terms of the GNU General Public License as published by | |
;;; the Free Software Foundation; either version 2, or (at your option) | |
;;; any later version. | |
;;; | |
;;; This module is distributed in the hope that it will be useful, |
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
function randomColor() { | |
var color = (0xffffff * Math.random()).toString(16); | |
return "#" + color.replace(/\./i,"").slice(0,6); | |
}; | |
function fallbackFor(arg, fallback) { | |
return (typeof arg !== 'undefined') ? arg : fallback; | |
} | |
function require(arg, name) { |
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 | |
moves = [[1,3],[0,2,4],[1],[0],[1,5],[4]] | |
cat = 5 | |
next_position = lambda x : random.choice(moves[x]) | |
def experiment(): | |
time = 0 | |
pos = 0 |
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
nats = do | |
n <- [0..] | |
b <- [0..n] | |
return (b,n-b) |
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 Data.List (intercalate) | |
showMatrix xs = intercalate "\n" $ map show xs | |
tranRow row = map (\x -> [x]) row | |
transpose :: [[a]] -> [[a]] | |
transpose [] = [[]] | |
transpose (x:[]) = tranRow 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
type Vector a = [a] | |
data Shape = Square Float | Rectangle Float Float | Circle Float | |
area :: Shape -> Float | |
area (Square x) = x * x | |
area (Rectangle a b) = a * b | |
area (Circle r) = pi * r * r |
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
he moves a file across, making a copy of a middle america that never was. he's feeling ripped because of a running stream of cracked cellphone chatter into her ear. "meat and mind, manny. meat, and mind. | |
the meter maid looks anxiously at her from his overnight bag, then drags on soiled jeans and tank top | |
the cat hears the sound of lobster minds singing in the scottish highlands | |
an aberration of starlight skews the color of stale beer | |
what! from the finest spider silk and spun glass, but it might as well as eyeballs. the chinese - fighter? missile platform? supercomputer? - is switched off. |
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.Map as Map | |
import Data.Char | |
import System.Random | |
type MarkovMap = Map.Map [String] [String] | |
makeMarkovMap :: Int -> [String] -> MarkovMap | |
makeMarkovMap n ws = makeMap n ws Map.empty | |
where |
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
he moves a file across, making a copy of a middle america that never was. he's feeling ripped because of a running stream of cracked cellphone chatter into her ear. "meat and mind, manny. meat, and mind. | |
the meter maid looks anxiously at her from his overnight bag, then drags on soiled jeans and tank top | |
the cat hears the sound of lobster minds singing in the scottish highlands | |
an aberration of starlight skews the color of stale beer | |
what! from the finest spider silk and spun glass, but it might as well as eyeballs. the chinese - fighter? missile platform? supercomputer? - is switched off. |
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
sieve :: [Integer] -> [Integer] | |
sieve [] = [] | |
sieve (p:xs) = p : sieve [x | x <- xs, x `mod` p > 0] | |
primes = sieve [2..] |