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
SHELL = /bin/bash | |
all: test-c test-cc test-cpp | |
clean: | |
-rm c cpp cc | |
test-c: c | |
@echo "running c version..." | |
@time ./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
module Cell where | |
data Cell item topology | |
= Cell | |
{ get :: IO item | |
, set :: item -> IO () | |
, move :: topology -> Cell item topology | |
, location :: topology | |
} |
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
ghc -O3 sin-gen && ./sin-gen && aplay -f S16_LE -r 8000 test.wav |
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 AST where | |
import qualified Data.Map as Map | |
import Data.Map (Map) | |
import Control.Monad.State as State | |
import Data.List | |
data Ast | |
= App [Ast] -- stack of actions |
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
#include <math.h> | |
#include <memory.h> | |
#include <iostream> | |
#include <vector> | |
using namespace std; | |
template <int WIDTH, int HEIGHT, class Cell = char, Cell empty = '?'> | |
struct Image |
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 qualified Control.Monad.State as State | |
import Control.Monad.State (State) | |
import qualified Data.Map as Map | |
import Data.Map (Map) | |
import Data.Maybe | |
type Image = Map (Int, 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
import qualified Data.Set as Set | |
import Data.Set (Set) | |
import qualified Data.Map as Map | |
import Data.Map (Map) | |
import Data.List | |
import System.IO |
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
Require Import List. | |
Definition compose (A B C : Set) (f : B -> C) (g : A -> B) : (A -> C) := | |
fun x => f (g x). | |
Notation "f @ g" := (compose _ _ _ f g) (at level 50). | |
Fixpoint map (A B : Set) (f : A -> B) (az : list A) : list B := | |
match az with |
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
Require Import List. | |
Fixpoint fold_left_raw | |
(A B : Set) | |
(step : A -> B -> B) | |
(accum : B) | |
(src : list A) | |
: B | |
:= |
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 Control.Arrow | |
import System.Directory (getDirectoryContents, doesDirectoryExist) | |
import System.Environment (getArgs) | |
import System.FilePath.Posix ((</>)) | |
import Data.String.Utils (startswith, endswith, rstrip) | |
main :: IO () |