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
3375 | |
3376 | |
3408 | |
3409 | |
3410 | |
3411 | |
3447 | |
4822 | |
4823 | |
4824 |
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 swap_col(A, i, j) | |
col_i = A[:,i] | |
col_j = A[:,j] | |
A[:,i] = col_j | |
A[:,j] = col_i | |
end | |
function swap_row(A, i, j) | |
row_i = A[i,:] |
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
using Compose | |
function koch_side(n) | |
if n == 1 | |
return compose(context(), | |
line([(0,1),(1/3,1),(1/2, 1 - (sin(pi/3)/3)),(2/3,1),(1,1)])) | |
else | |
ks = koch_side(n - 1) | |
return compose(context(), | |
(context(0,2/3,1/3,1/3), ks), |
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
using Compose | |
function koch_side(n) | |
if n == 1 | |
return compose(context(), | |
line([(0,1),(1/3,1),(1/2, 1 - (sin(pi/3)/3)),(2/3,1),(1,1)])) | |
else | |
ks = koch_side(n - 1) | |
return compose(context(), | |
(context(0,2/3,1/3,1/3), ks), |
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
set nocompatible | |
set backupdir=~/.vim/backups | |
set undofile | |
set undodir=~/.vim/undo " remember undos across sessions | |
set noswapfile | |
" ---------------------------------------------------------------------------- | |
" Text Formatting | |
" ---------------------------------------------------------------------------- |
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 = Expr(symbol("F_{n + 1}")) | |
#b = Expr(symbol("F_n")) | |
#c = Expr(symbol("F_{n - 1}")) | |
a = Expr(:a) | |
b = Expr(:b) | |
c = Expr(:c) | |
# fibonacci matrix | |
F = [ 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
Require Import Notations. | |
Generalizable All Variables. | |
Require Import Setoid. | |
Class Group {A : Type}(comp: A -> A -> A)(inv: A -> A)(iden: A) := { | |
assoc: forall a b c : A, comp a (comp b c) = comp (comp a b) c; | |
left_id: forall a : A, comp iden a = a; | |
right_id: forall a : A, comp a iden = a; | |
left_inv: forall a : A, comp (inv a) a = iden; | |
right_inv: forall a : A, comp a (inv a) = iden |
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
var alg = require("algorithms"), | |
sort = alg.mergeSort; | |
/* | |
* Huffman coding. | |
* | |
* @api public | |
*/ | |
var huffman = function(alphabet){ |
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
var algorithms = require("algorithms"), | |
fs = require("fs"); | |
var dynamicLowMem = function(capacity, values, weights){ | |
var max = function(x, y){ | |
return x ^ ((x ^ y) & -(x < y)); | |
} | |
var items = values.length, | |
value = 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
import System.Environment | |
import System.IO | |
import Data.Char | |
main = do | |
args <- getArgs | |
let action = args !! 0 | |
shift = read (args !! 1) :: Int | |
file = args !! 2 | |
handle <- openFile file ReadMode |