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
# Warps a song | |
import scipy.io.wavfile as wav | |
import numpy as np | |
import sys | |
if len(sys.argv) != 3: | |
print sys.argv | |
print("Error: Must run as: python Warp.py in.wav out.wav") | |
sys.exit(1) |
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
{-# LANGUAGE MultiParamTypeClasses, ScopedTypeVariables #-} | |
import Prelude hiding (compare) | |
data Order f = Lt | Gt | Eq | |
class OrdI a f where | |
compare :: a -> a -> Order f -- Could use a proxy too | |
data IntOrd |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import qualified Data.ByteString as BS | |
import qualified Data.ByteString.Lazy as BL | |
import qualified Data.ByteString.Builder as BB | |
import qualified Data.Text as TS | |
import qualified Data.Text.Lazy as TL | |
import qualified Data.Text.Internal.Builder as TB | |
import qualified Control.DeepSeq as DS |
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
{-# LANGUAGE QuasiQuotes, ScopedTypeVariables, TypeOperators, | |
FlexibleContexts, TypeFamilies, GeneralizedNewtypeDeriving, | |
StandaloneDeriving, DataKinds, FlexibleInstances #-} | |
module Main (main, kernel) where | |
import Prelude hiding ( traverse,) | |
import Data.Array.Repa as R hiding ((++)) | |
import Data.Array.Repa.Repr.Vector (toVector, computeVectorS) | |
import Data.Array.Repa.Stencil (Stencil, Boundary(BoundClamp,BoundConst)) | |
import Data.Array.Repa.Stencil.Dim2 (stencil2, makeStencil2, mapStencil2) |
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
{-# LANGUAGE QuasiQuotes, ScopedTypeVariables, TypeOperators, | |
FlexibleContexts, TypeFamilies, GeneralizedNewtypeDeriving, | |
StandaloneDeriving, DataKinds, FlexibleInstances #-} | |
module Main (main, kernel) where | |
import Prelude hiding ((*), (/), traverse, sin) | |
import Data.Array.Repa as R hiding ((++)) | |
import Data.Array.Repa.Repr.Vector (toVector, computeVectorS) | |
import Data.Array.Repa.Stencil (Stencil, Boundary(BoundClamp,BoundConst)) | |
import Data.Array.Repa.Stencil.Dim2 (stencil2, makeStencil2, mapStencil2) |
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
-- Reaktor orbital challenge solution | |
-- Will Yager | |
import Data.Map (Map, keys, (!), fromList) | |
import Data.Set (Set, empty, notMember, insert) | |
import Data.List (find) | |
import Data.List.Split (splitOn) | |
data Cartesian = Cartesian Double Double Double deriving (Eq, Show) | |
data Polar = Polar {lat :: Double, lon :: Double, alt :: Double} deriving (Show) | |
data Line = Line {a :: Cartesian, b :: Cartesian} | |
data ID = Start | ID Int | End deriving (Eq, Ord, Show) |
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
-- Monoid | |
class Ding a where | |
dong : a -> a -> a | |
-- Verified monoid | |
class Ding a => VDing a where | |
law1 : (x,y,z : a) -> dong x (dong y z) = dong (dong x y) z | |
instance Ding Nat where | |
dong = (+) |
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 Prelude hiding (pi) | |
import Data.Ratio ((%)) | |
import Data.List(findIndex, splitAt) | |
-- Thanks to augustss on stackoverflow | |
showRational :: Int -> Rational -> String | |
showRational n r = | |
let d = round (abs r * 10^n) | |
s = show (d :: Integer) |
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
-- A first exploration into ST freeze/thaw fusion. | |
-- will.yager@gmail.com | |
{-# LANGUAGE RankNTypes, MultiParamTypeClasses, BangPatterns #-} | |
import Control.Monad.ST (ST, runST) | |
import qualified Data.Vector as V | |
import qualified Data.Vector.Mutable as M | |
import Control.Monad.Primitive (PrimMonad, PrimState) |
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
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-} | |
import Prelude hiding (writeFile) | |
import Control.Monad.ST (ST, runST) | |
import Data.Array (Array) | |
import Data.Array.IO (IOArray) | |
import Data.Array.Unboxed (UArray) | |
import Data.Array.IArray (IArray, bounds, (!)) | |
import Data.Array.ST (STArray, runSTArray, runSTUArray) | |
import Data.Array.MArray (MArray, newArray, getBounds, freeze, readArray, writeArray) |