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
∴ lein2 all test | |
Performing task 'test' with profile(s): 'dev,1.2' | |
Testing clj-http.test.client | |
Testing clj-http.test.cookies | |
Testing clj-http.test.core | |
Ran 47 tests containing 175 assertions. |
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
function A(i,j) { | |
return 1/((i+j)*(i+j+1)/2+i+1); | |
} | |
function Au(u,v) { | |
for (var i=0; i<u.length; ++i) { | |
var t = 0; | |
for (var j=0; j<u.length; ++j) | |
t += A(i,j) * u[j]; | |
v[i] = t; |
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 mist.logic.datalog | |
(:use clojure.core.logic | |
[clojure.set :only [union, difference]]) | |
(:require clojure.walk)) | |
(defn- all-o [goal args] | |
(conde | |
[(emptyo args)] | |
[(fresh [arg rest] | |
(conso arg rest args) |
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
class Ns | |
def initialize | |
use.each do |pkg, method_names| | |
method_names.each do |name| | |
self.class.send(:define_method, name) do |*args| | |
pkg.method(name).call(*args) | |
end | |
end | |
end | |
end |
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 datomic-play.core | |
(:use [datomic.api :only [db q] :as d]) | |
(:require [clojure.core.logic :as l] | |
[clojure.pprint :as pp])) | |
(def uri "datomic:dev://localhost:4334/hello") | |
(defprotocol IUnifyWithDatum | |
(unify-with-datum [u v s])) |
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
-- | Lock-step folding. | |
-- | |
-- This module presents an elegant way of executing multiple left folds | |
-- on one list using constant memory. For example, the mean can be | |
-- expressed as: | |
-- | |
-- @ | |
-- average = foldLeft $ (/) <$> sumF <*> lengthF | |
-- @ |
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
(def users [{:name "Brian" :age 22} {:name "Ben" :age 19}]) | |
;; Takes a "path", returns a function that takes an "object" and | |
;; returns a "costate" | |
(defn lens [p] | |
(fn [o] | |
{:get (get-in o p) | |
:set #(assoc-in o p %1)})) | |
(def myAgeLens (lens [0 :age])) |
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
; y has upper bound x, z has upper bound (Seqable y) | |
typed.core=> (ann foo (All [x [y :< x] [z :< (Seqable y)]] | |
[x y z -> Any])) | |
[typed.core/foo (All [x [y :< x] [z :< (clojure.lang.Seqable y)]] (Fn [x y z -> Any]))] | |
typed.core=> (declare foo) | |
#'typed.core/foo | |
;cf = check-form | |
typed.core=> (cf (foo 2 2 [2])) | |
Any |
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
No implementation of method: :lb of protocol: #'clojure.core.logic/IInterval found for class: clojure.lang.Keyword | |
java.lang.IllegalArgumentException | |
Restarts: | |
0: [CONTINUE] Pass exception to program | |
1: [ABORT] Abort request. | |
2: [IGNORE] Do not enter debugger for this exception type | |
3: [IGNORE-MSG] Do not enter debugger for this exception message | |
4: [IGNORE-CATCH] Do not enter debugger for exceptions with catch location clojure.lang.LazySeq.* | |
5: [IGNORE-LOC] Do not enter debugger for exceptions with throw location clojure.core.* |
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 foami.core | |
"FOreign Asynchronous Mechanism Interop" | |
(:require [clojure.core.async :as async])) | |
(def ^:private abandon (doto (async/chan) async/close!)) | |
(def ^:private pending-writes (async/chan)) | |
(defn put! | |
"Tries to put a val into chan, returns either: true if put succeeded, false if chan is |