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
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
#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
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
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
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
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
Doubtful it stood; | |
As two spent swimmers, that do cling together | |
And choke their art. The merciless Macdonwald-- | |
Worthy to be a rebel, for to that | |
The multiplying villanies of nature | |
Do swarm upon him--from the western isles | |
Of kerns and gallowglasses is supplied; | |
And fortune, on his damned quarrel smiling, | |
Show'd like a rebel's whore: but all's too weak: | |
For brave Macbeth--well he deserves that name-- |
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
Doubtful it stood; | |
As two spent swimmers, that do cling together | |
And choke their art. The merciless Macdonwald-- | |
Worthy to be a rebel, for to that | |
The multiplying villanies of nature | |
Do swarm upon him--from the western isles | |
Of kerns and gallowglasses is supplied; | |
And fortune, on his damned quarrel smiling, | |
Show'd like a rebel's whore: but all's too weak: | |
For brave Macbeth--well he deserves that name-- |