I 'm fleshing out some of these ideas here: https://github.com/lynaghk/todoFRP/tree/master/todo/angular-cljs
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 crossfilter.busses | |
(:use-macros [c2.util :only [p pp]] | |
[clojure.core.match.js :only [match]] | |
[crossfilter.macros :only [subscribe!]]) | |
(:require [clojure.string :as str] | |
[goog.pubsub.PubSub :as goog.pubsub.PubSub] | |
[goog.object :as gobj])) | |
(set! *print-fn* #(.log js/console %)) |
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
(rewrite-layer | |
{:mapping {:y :mpg} | |
:stat (stat/quantiles)}) | |
;; => | |
{:mapping {:upper :q75, :min :min, :lower :q25, :max :max, :middle :q50, :y :mpg} | |
:stat #com.keminglabs/c2po$stat$quantiles {:dimension :mpg} | |
:geom #com.keminglabs/c2po$geom$boxplot {}} |
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
;;Support for simple constraints on lvars during unification was added in 76fd4d7c: | |
;; | |
;; https://github.com/clojure/core.logic/commit/76fd4d7c155161d74ad5cd8d87955148eece1fe0 | |
;; | |
;;but these constraints apply to a single lvar only. | |
;;The unifier could support more general constraints if it accepted an explicit predicate function. | |
;;For instance, given this `data-numeric?` predicate and `spec` data: | |
(defn data-numeric? [data dimension] |
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
#Build OpenCV and the new Java JNI interface described here: https://github.com/emchristiansen/opencv/commit/0d323087fadaf931dbaf4120b69f0839b745b888 | |
git clone git://github.com/Itseez/opencv.git | |
cd opencv | |
cmake -DBUILD_opencv_java=ON | |
ant jar |
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
#Idiomatic record constructors in Ruby | |
#My C2PO grammar of graphics uses records (typed maps, basically) to represent pieces of the grammar. | |
#E.g., in Clojure you can specify a linear scale via a constructor function: | |
# | |
# (scale/linear :domain [0 10] :label "The X Axis") | |
# | |
#returns the appropriate scale.linear record with the two key/value pairs given above. | |
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 scratch.main | |
(:use-macros [c2.util :only [p pp]] | |
[serialization :only [test-data]]) | |
(:require [cljs.reader :refer [read-string]] | |
[goog.date.DateTime :as DateTime] | |
[clojure.string :as str])) | |
(defn parse-tagged-string | |
"Parse a tagged string within JSON. | |
Assumes string begins with a throwaway first character and there is a single space between the tag and its data." |
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
;;5-minute sketch of tagged literals in JSON via the little known second argument to the browser's JSON.parse. | |
;;It's no EDN, but it's still a hell of a lot nicer than the usual JSON-deserialization state of affairs. | |
(ns shim.json | |
(:require [goog.date.DateTime :as DateTime])) | |
(defn parse-tagged-string | |
"Parse a tagged string within JSON. | |
Assumes string begins with a throwaway first character and there is a single space between the tag and its data." |
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 cheshire-test ;;this is cheshire 5.1.0 | |
(:require [cheshire | |
[core :as json] | |
[generate :refer [add-encoder encode-map]]])) | |
(json/generate-string {:x (java.util.Date.)}) ;;works fine: {"x":"2013-04-12T19:05:54Z"} | |
;;I want to print out dates as {"#inst":"2013-04-12T19:05:54Z"} | |
(add-encoder java.util.Date | |
(fn [date json-generator] |
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 sublisto | |
"The sequence x appears in y." | |
[x y] | |
(fresh [a b c] | |
(appendo a x b) | |
(appendo b c y))) | |
(->> (run* [q] | |
(sublisto [:b :r :r :c] q) | |
(sublisto [:r :c :c :b] q) |