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 n 1000) | |
(def ds (dataset [:x :y] (partition | |
2 | |
(interleave (sample-normal n) | |
(sample-exp n))))) | |
(def plot (scatter-plot ($ :x ds) ($ :y ds))) | |
(view plot) |
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
edw@li246-89:~/dev/cascalog$ lein compile | |
Warning: problem requiring hooks: java.lang.IllegalAccessError: extract-javac-tasks is not public (javac.clj:1) | |
...continuing without hooks completely loaded. | |
Compiling 31 source files to /home/edw/dev/cascalog/classes | |
Note: Some input files use or override a deprecated API. | |
Note: Recompile with -Xlint:deprecation for details. | |
Note: Some input files use unchecked or unsafe operations. | |
Note: Recompile with -Xlint:unchecked for details. | |
WARNING: :namespaces in project.clj is deprecated; use :aot. | |
WARNING: :namespaces in project.clj is deprecated; use :aot. |
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
edw@li246-89:~/dev/cascalog$ lein repl | |
Warning: problem requiring hooks: java.lang.IllegalAccessError: extract-javac-tasks is not public (javac.clj:1) | |
...continuing without hooks completely loaded. | |
REPL started; server listening on localhost:18550. | |
user=> (use 'cascalog.playground) (bootstrap) | |
nil | |
nil | |
user=> (?<- (stdout) [?person] (age ?person 25)) | |
java.lang.NoClassDefFoundError: cascalog/graph/proxy$java/lang/Object$EdgeFactory$4210cf45 (NO_SOURCE_FILE:0) | |
user=> |
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
Edwins-MacBook-Pro:cascalog edw$ cat ls-lR | |
total 80 | |
-rw-r--r-- 1 edw staff 32472 Dec 7 12:46 LICENSE | |
-rw-r--r-- 1 edw staff 3735 Dec 7 12:46 README.markdown | |
drwxr-xr-x 4 edw staff 136 Dec 7 12:47 classes | |
drwxr-xr-x 9 edw staff 306 Dec 7 12:46 lib | |
-rw-r--r-- 1 edw staff 0 Dec 7 13:58 ls-lR | |
-rw-r--r-- 1 edw staff 695 Dec 7 12:46 project.clj | |
drwxr-xr-x 4 edw staff 136 Dec 7 12:46 src | |
drwxr-xr-x 3 edw staff 102 Dec 7 12:46 test |
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
(defn wildcard? [var] | |
(= "*" (subs (name var) 0 1))) | |
(defn make-output-values [vars] | |
(let [wildcards (filter wildcard? vars) | |
subsets (map set (clojure.contrib.combinatorics/subsets wildcards))] | |
(map #(vec (filter identity | |
(map (fn [var] | |
(if (wildcard? var) | |
(and (contains? % var) |
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 WORKS | |
(?- (lfs-textline "unified-traffic") (apply union (vals (traffic-plan "2010-12-12")))) | |
;; THIS DOESN'T | |
(let [all-queries (apply union (vals (traffic-plan "2010-12-12")))] | |
(?- (lfs-textline "unified-traffic-sorted") | |
(<- [?key ?visits ?transactions ?visit-revenue] | |
(all-queries ?key ?visits ?transactions ?visit-revenue) | |
(:sort ?visit-revenue :desc) (reverse :true)))) |
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
(defmapcatop set-bucket | |
([s v inv] | |
(if (contains? s v) (list inv) '())) | |
([s v inv outv] | |
(if (contains? s v) (list inv) (list outv))) | |
([s v inv outv bothv] | |
(list bothv (if (contains? s v) (list inv) (list outv))))) | |
(def x (memory-source-tap [["a" 1] | |
["b" 1] |
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
(defn- make-getter [indices] | |
(let [indices (if (sequential? indices) indices [indices])] | |
(fn [coll] (map #(nth coll %) indices)))) | |
(defn map* [indices proc coll] | |
(let [getter (make-getter indices)] | |
(map #(apply proc (getter %)) coll))) | |
(defn filter* [indices pred? coll] | |
(let [getter (make-getter indices)] |
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
var handler = function(req, res) { | |
var channel = req.params.channel; | |
client.lrange(channel, 0, -1, function(err, myRange) { | |
res.end(JSON.stringify(myRange)); | |
}); | |
} |
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
;;;; Magic 3 -- a Web application server in Scheme (Scheme 48) | |
;;;; By Edwin Watkeys | |
;;;; | |
,open srfi-13 srfi-14 fluids sockets i/o primitives threads byte-vectors encodings text-codecs extended-ports queues srfi-1 posix-time ascii define-record-types silly cells handle srfi-27 srfi-8 posix-i/o interrupts posix-processes posix-files posix-regexps tables time queues simple-signals os-strings | |
;;;; Sample code is at the bottom of the file. To start the server, | |
;;;; eval: (start "password") | |
OlderNewer