Skip to content

Instantly share code, notes, and snippets.

print("yo")
/**
* The Matrix Example
* http://wiki.neo4j.org/content/The_Matrix
*/
import collection.JavaConversions._
import org.neo4j._
import org.neo4j.graphdb._
import org.neo4j.graphdb.Traverser._
import org.neo4j.scala._
@fayvor
fayvor / gist:6165505
Last active December 20, 2015 16:59 — forked from deanh/gist:6164844
// merge calls itself recursively
def merge(l1: List[Int], l2: List[Int]): List[Int] = {
// termination cases
(l1, l2) match {
case (Nil, Nil) => Nil
case (x, Nil) => x
case (Nil, y) => y
case (_, _) => l1.head.compare(l2.head) match {
case -1 => l1.head :: merge(l1.tail, l2)
case _ => l2.head :: merge(l2.tail, l1)