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
(define tolerance 0.00001) | |
(define (fixed-point f first-guess) | |
(define (close-enough? v1 v2) | |
(< (abs (- v1 v2)) tolerance)) | |
(define (try guess) | |
(let ((next (f guess))) | |
(if (close-enough? guess next) | |
next |
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
public class Next<A, B, C> extends Task<A, C> { | |
private Task<A, B> task; | |
private Task<B, C> nextTask; | |
public Next(Task<A, B> task, Task<B, C> nextTask) { | |
this.task = task; | |
this.nextTask = nextTask; | |
} |
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
(query+ (frame+ {:column-metadata {"x" {:datatype :uri | |
:expression :one-to-one}} | |
:alias "topframe__1" | |
:source "topframe"} | |
(distinct+) | |
(project+ [x id]) | |
(bind+ {x (new-function | |
{:op "iri" | |
:args [(new-function | |
{:op "http://www.w3.org/2005/xpath-functions#concat" |
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
(ns revelytix.spyder.query.interface | |
(:require [revelytix.sparql.parse :as sparqlp] | |
[revelytix.spyder.query.plan :as plan] | |
[revelytix.spyder.query.optimize :as opt] | |
[revelytix.spyder.query.process :as process] | |
[revelytix.spyder.log :as log]) | |
(:import [revelytix.spyder.query.api QueryException] | |
[revelytix.spyder.sql.plan_tree QueryContext])) | |
(defn always [x] |
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 'ring.middleware.stacktrace) | |
(defn buggy [_] | |
(throw (Exception. "splork"))) | |
(defn roachy [req] | |
(try | |
(buggy req) | |
(catch Exception e | |
(throw (Exception. "splunch" e))))) |
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
// This class does something with the board. I don't completely understand it, our teacher wrote it | |
package ui; | |
import centipede.Main; | |
import java.awt.event.KeyEvent; | |
import java.awt.event.KeyListener; | |
import javax.swing.JFrame; | |
import javax.swing.JTextArea; |
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 [m] | |
(let [keys (set (keys m)) | |
key-map (into {} (for [k keys] [k k]))] | |
(select-keys m (vals key-map)))) |
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
(ns pallet-simple | |
(:use [pallet core compute resource]) | |
(:use [pallet.crate.automated-admin-user]) | |
(:use [pallet.crate.couchdb :only (couchdb)]) | |
(:use [pallet.crate.java :only (java)]) | |
(:use [pallet.crate.jetty :only (jetty)])) | |
(def ec2-access-id "Your-Access-ID-Here") | |
(def ec2-secret-key "Your-Secret-Key-Here") |
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
require File.expand_path(File.dirname(__FILE__) + '/edgecase') | |
# Greed is a dice game where you roll up to five dice to accumulate | |
# points. The following "score" function will be used calculate the | |
# score of a single roll of the dice. | |
# | |
# A greed roll is scored as follows: | |
# | |
# * A set of three ones is 1000 points | |
# |
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
(ns revelytix.test-triplestore | |
(:use [reveltix.triplestore :only (*connection* connect-to dispose execute-command resultMessage= create-graph drop-graph insert-triple load-file)])) | |
(def *HOST* "rmi://australia/server1") | |
(def *FAMILY* "family") | |
(def *N3_FAMILY_FILE* "test/data/family.n3") | |
(def *SELECT-ALL* "select ?s ?p ?o where { ?s ?p ?o }") | |
;; Connection Fixture, establishes a connection for all execute-command calls to use | |
(defn connection-fixture [f] |
NewerOlder