Skip to content

Instantly share code, notes, and snippets.

@aplusbi
aplusbi / line_iterator.cpp
Created January 12, 2013 05:30
Using an istream_iterator to read lines into a vector.
#include<iostream>
#include<fstream>
#include<iterator>
#include<algorithm>
#include<numeric>
#include<vector>
#include<string>
using namespace std;
struct Line
@aplusbi
aplusbi / tree.ml
Created April 1, 2012 18:06
Quick OCaml tree example
type tree = Node of tree * int * tree | Nil
open Printf
let rec print_tree t =
match t with
| Node (left, data, right) -> print_tree left;
printf "%d\n" data;
print_tree right
| Nil -> ();;