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
;; init.el | |
;; Vincent Foley - vfoley@gmail.com | |
(require 'cl) | |
(defmacro when-package-installed (package-name &rest body) | |
`(if (package-installed-p ,package-name) | |
(progn ,@body) | |
(warn "package %s is not installed" ,package-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
.text | |
_main: | |
cmp %ebx, %ecx | |
mov $1, %eax | |
je equal | |
mov $0, %eax | |
equal: | |
ret | |
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
type nat = Zero | Succ of nat | |
let rec int_of_nat x = | |
match x with | |
| Zero -> 0 | |
| Succ x' -> 1 + int_of_nat x' | |
let rec nat_of_int x = | |
match x with | |
| 0 -> Zero |
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 java.util.Set; | |
import mclint.util.Parsing; | |
import ast.*; | |
import natlab.toolkits.analysis.core.ReachingDefs; | |
import natlab.toolkits.analysis.core.UseDefDefUseChain; | |
import natlab.toolkits.filehandling.GenericFile; | |
import natlab.toolkits.path.FileEnvironment; | |
import natlab.tame.BasicTamerTool; | |
import natlab.tame.tir.*; |
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
fn insertion_sort<T: PartialOrd>(xs: &mut Vec<T>) { | |
for i in 1..(xs.len() - 1) { | |
let mut j = i; | |
while j > 0 && xs[j-1] > xs[j] { | |
xs.swap(j, j-1); | |
j -= 1; | |
} | |
} | |
} |
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
type t = node list | |
and node = Node of (char * node list) | Eow | |
let empty = [] | |
let mem word nodes = | |
let len = String.length word in | |
(* Return the children nodes of the node containing the character c, |
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 CMap = Map.Make(struct | |
type t = char | |
let compare = Char.compare | |
end) | |
type t = Trie of (t CMap.t * bool) | |
let empty = Trie (CMap.empty, false) | |
let add word trie = |
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 CMap = Map.Make(struct | |
type t = char | |
let compare = Char.compare | |
end) | |
type t = Trie of (t CMap.t * bool) | |
let empty = Trie (CMap.empty, false) | |
let add word trie = |
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
use std::io; | |
use std::collections::HashMap; | |
use std::collections::VecDeque; | |
#[derive(Debug, PartialEq, Copy, Clone)] | |
enum Command { | |
Assign { bot: usize, value: usize }, | |
Give { | |
src: usize, // from which bot? | |
dst1: usize, // to which bot/bin? |
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
impl <'a> IntoIterator for &'a Bitmap { | |
type Item = u16; | |
type IntoIter = SharedBitmapIterator<'a>; | |
fn into_iter(self) -> Self::IntoIter { | |
return SharedBitmapIterator { offset: 0, bitmap: &self }; | |
} | |
} | |
impl IntoIterator for Bitmap { | |
type Item = u16; |