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
#ifndef MODULEA_H | |
#define MODULEA_H | |
#include "moduleB.h" | |
typedef struct | |
{ | |
... | |
} ModuleAType; |
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.FixedList -- this doesn't come with haskell, do a 'cabal install fixed-list' to install it | |
-- or get it from here: http://hackage.haskell.org/package/fixed-list-0.1.5 | |
-- more documentation on this library is here: http://hackage.haskell.org/packages/archive/fixed-list/0.1.5/doc/html/Data-FixedList.html | |
-- These are all built in haskell modules | |
import Control.Applicative | |
import Data.Foldable | |
import Prelude hiding (sum, concat) | |
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
module Language.Try5.Parser where | |
import Control.Monad | |
import Control.Monad.Identity | |
-- import Text.Parsec.Pos | |
import Text.Parsec.Prim | |
import Text.Parsec.Expr | |
import Text.Parsec.Combinator |
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
data Statement = ExprStmt ParsedExpr | |
| VarDef String | |
| ConstDef String ParsedExpr | |
| Foreign String | |
| Assign String ParsedExpr | |
| FuncDef String [ParsedStatement] Bool ParsedStatement | |
| Scope [ParsedStatement] | |
| For ParsedStatement ParsedStatement ParsedStatement ParsedStatement | |
| While ParsedExpr ParsedStatement | |
| DoWhile ParsedExpr ParsedStatement |
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 Control.Monad | |
import Control.Monad.Error | |
instance Error (RuntimeError a) where | |
data Expr = Number Int | |
| SomethingElse | |
deriving (Show, Eq, Ord) | |
data Type = Func Type Type |
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
-- div2.hs | |
data Nat = Zero | Succ Nat | |
deriving (Eq, Ord) | |
instance Show Nat where | |
show a = show $ fromEnum a | |
instance Num Nat where | |
a + Succ b = Succ a + 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 | |
-- simple binomial coefficient function | |
binomial :: (Integral a) => a -> a -> a | |
binomial _ 0 = 1 | |
binomial 0 _ = 0 | |
binomial n k = (n - k + 1)*binomial n (k - 1) `div` k | |
fact :: (Num a, Enum a) => a -> a |
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
template<int r, int c, class T> class Matrix; | |
template<int d, class T> | |
class Vector | |
{ | |
public: | |
Vector() | |
{ } | |
Vector(const T v[]) |
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
#include <stdio.h> | |
template <class T1, class T2> | |
class Either | |
{ | |
bool isLeft; | |
union | |
{ | |
T1 left; | |
T2 right; |
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 Image | |
import math | |
im = Image.open("minecraft_map_topo.png") | |
rotatedTopo = im.rotate(-90) | |
im = Image.open("minecraft_map.png") | |
rotatedTerrain = im.rotate(-90) | |
terrainPix = rotatedTerrain.load() |