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
--myApply :: (Num a0) => (a0 -> a0 -> a0) -> [a0] -> a0 | |
--myApply func list | |
-- = func (head list) value | |
--where value = | |
data Fraction = Fraction { numerator :: Int | |
,denominator :: Int } deriving (Eq) | |
addFractions :: Fraction -> Fraction -> Fraction |
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
--myApply :: (Num a0) => (a0 -> a0 -> a0) -> [a0] -> a0 | |
--myApply func list | |
-- = func (head list) value | |
--where value = | |
data Fraction = Fraction { numerator :: Int | |
,denominator :: Int } deriving (Show, Eq) | |
addFractions :: Fraction -> Fraction -> Fraction |
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
--myApply :: (Num a0) => (a0 -> a0 -> a0) -> [a0] -> a0 | |
--myApply func list | |
-- = func (head list) value | |
--where value = | |
data Fraction = Fraction { numerator :: Int | |
,denominator :: Int } deriving (Show, Eq) | |
addFractions :: Fraction -> Fraction -> Fraction |
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 std.stdio, std.string; | |
uint factorial(uint number) { | |
uint product = number; | |
foreach (multiplicand; 2..number) { | |
product *= multiplicand; | |
} | |
return product; | |
} | |
void swap(T)(ref T a, ref T 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 std.stdio, std.string; | |
uint factorial(uint number) { | |
uint product = number; | |
foreach (multiplicand; 2..number) { | |
product *= multiplicand; | |
} | |
return product; | |
} | |
void swap(T)(ref T a, ref T 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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
"Bundle 'gmarik/vundle' | |
" colorsupport placed at the top because it takes the first of rtp and uses it to cache, apparently another plugin somewhere in here is messing with it | |
Bundle 'colorsupport.vim' |
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 BinaryTree where | |
import Data.Maybe(fromJust) | |
data Tree a = Leaf a | Node a (Tree a) (Tree a) deriving (Show, Eq) | |
isNode (Node _ _ _) = True | |
isNode _ = False | |
isLeaf (Leaf _) = True | |
isLeaf _ = False |
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 BinaryTree where | |
import Data.Maybe(fromJust) | |
data Tree a = Leaf a | Node a (Tree a) (Tree a) deriving (Show, Eq) | |
isNode (Node _ _ _) = True | |
isNode _ = False | |
isLeaf (Leaf _) = True | |
isLeaf _ = False |
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
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
"Bundle 'gmarik/vundle' | |
" colorsupport placed at the top because it takes the first of rtp and uses it to cache, apparently another plugin somewhere in here is messing with it | |
Bundle 'colorsupport.vim' | |
Bundle 'godlygeek/tabular' |
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 Sudoku( SudokuCell, SudokuGroup ) where | |
data SudokuCell = SudokuCell { cellRow :: Int, cellColumn :: Int, cellValue :: Int } deriving (Show) | |
instance Eq SudokuCell where | |
(SudokuCell _ _ xval) == (SudokuCell _ _ yval) = xval == yval | |
data SudokuGroup = SudokuGroup { groupCells :: [[SudokuCell]] } deriving Show | |
data SudokuTable = SudokuTable { tableGroups :: [[SudokuGroup]] } deriving Show | |
--sudokuGroupGetCell :: SudokuGroup -> Int -> Int -> SudokuCell | |
--sudokuGroupGetCell group row column = if (length cells == 0) then -1 else ((cells !! row) !! column) |