Skip to content

Instantly share code, notes, and snippets.

fayvor

Block or report user

Report or block fayvor

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:6241250
/**
* 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._
View gist:6165505
// 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)
You can’t perform that action at this time.