This file contains hidden or 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
;; doesn't work | |
(map #([(% 0) (% 2)]) [[1 2 3] ["a" "b" "c"]]) | |
;; throws... | |
;; Wrong number of args (0) passed to: PersistentVector | |
;; [Thrown class clojure.lang.ArityException] | |
;; works | |
(map #(vector (% 0) (% 2)) [[1 2 3] ["a" "b" "c"]]) |
This file contains hidden or 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
(defmacro defcrudo | |
[name & forms] | |
(let [forms (if (vector? (first forms)) | |
(list forms) | |
forms)] | |
`(defn ~name | |
~@(map (fn [form] | |
(let [args (first form)] | |
`(~args (oc/with-db | |
(apply og/open-graph-db! orient-rconn-info) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type"> | |
<title>Example</title> | |
<link rel="http://example.com/example-rel-1" href="/example-1"> | |
</head> | |
<body> | |
<a rel="http://example.com/example-rel-2" href="/example-2">example2</a> | |
</body> |
This file contains hidden or 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 plus [[mv & mvs]] | |
(plus-step mv mvs)) | |
(defmacro plus [mvs] | |
`(let [mvs# (quote ~mvs) | |
mv# (eval (first mvs#))] | |
(monads.core/plus-step mv# (rest mvs#)))) | |
(deftype maybe-monad [v] | |
clojure.lang.IDeref |
This file contains hidden or 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
(defmacro plus-maybe [mvs] | |
`(let [mvs# (quote ~mvs) | |
mv# (eval (first mvs#)) | |
mvs# (clojure.core/map (fn [mv#] | |
(if (= (class mv#) maybe-monad) | |
mv# | |
(eval mv#))) | |
(rest mvs#))] | |
(monads.core/plus-step mv# mvs#))) |
This file contains hidden or 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 '[clojure.algo.monads :as am]) | |
(require '[monads.core :as m]) | |
;-------------- algo.monads version #1 ---------------; | |
(def set-sequence-m (am/sequence-t am/set-m)) | |
(am/with-monad set-sequence-m | |
(am/m-plus #{(list 1 2)} #{(list)} #{(list 3 4)})) |
This file contains hidden or 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 '[clojure.algo.monads :as am]) | |
(require '[monads.core :as m]) | |
;-------------- algo.monads version #1 ---------------; | |
(def sequence-sequence-m (am/sequence-t am/sequence-m)) | |
(am/with-monad sequence-sequence-m | |
(am/m-plus (list (list 1 2 )) (list (list)) (list (list 3 4)))) |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<head> | |
<title>Line Example</title> | |
<!--[if lte IE 9]><script src="https://raw.github.com/mhemesath/r2d3/master/r2d3.v2.js"></script><![endif]--> | |
<!--[if gte IE 10]><!--> | |
<script src="http://d3js.org/d3.v2.js"></script> | |
<!--<![endif]--> | |
</head> | |
<body> |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<head> | |
<title>Line Example</title> | |
</head> | |
<body> | |
<!--[if lte IE 8]><script src="http://192.168.177.105:3000/javascripts/r2d3.v2.js"></script><![endif]--> | |
<!--[if gte IE 9]><!--> | |
<script src="http://192.168.177.105:3000/javascripts/d3.v2.js"></script> | |
<!--<![endif]--> |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="chrome=1"> | |
<head> | |
<title>Line Example</title> | |
<!--[if lte IE 8]><script src="https://raw.github.com/mhemesath/r2d3/master/r2d3.v2.js"></script><![endif]--> | |
<!--[if gte IE 9]><!--> | |
<script src="http://d3js.org/d3.v2.js"></script> | |
<!--<![endif]--> | |
</head> |