Skip to content

Instantly share code, notes, and snippets.

@gam
gam / perl6_hackathon_notes.txt
Created April 21, 2012 08:59
notes from perl6 hackathon
tote - sdlc loop running tests on file modification
interesting kata to use a perl6 idiom: prime factors (because of the 1,1 {@_ ...}, where the @_ collects all previous arguments - could create the sieve of Eratosthenes)
gather for @values {
...
yield $value;
...
}
@gam
gam / Combinations.java
Created March 16, 2012 00:18
First naïve Java implementation of Eirik's tuple combination challenge
import java.util.ArrayList;
import java.util.List;
public class Combinations {
public List<List<Boolean>> generateCombinations(List<List<Boolean>> values) {
List <List<Boolean>> accumulator = new ArrayList<List<Boolean>>();
List<Boolean> firstTuple = values.get(0);
List<List<Boolean>> remainingTuples = values.subList(1, values.size());
@gam
gam / gist:948247
Created April 29, 2011 12:48
tree pretty printer in clojure - variation
(defn print-tree
([tree]
(print-tree tree ""))
([tree prefix]
(apply str prefix (first tree) "\n"
(map #(print-tree %1 (str prefix "\t")) (rest tree)))))
(deftest print-tree-test
(is (= (print-tree
'(parent