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 sim-cincyfp.core) | |
(def min (* 1000 60)) | |
(def min5 (* 5 min)) | |
(def min10 (* 10 min)) | |
(def min15 (* 15 min)) | |
(def min30 (* 30 min)) | |
;; --------------------------------------------------------------------- | |
;; Generating Events |
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
{"nodes":[ | |
{"x":80, "r":40, "label":"Node 1"}, | |
{"x":200, "r":60, "label":"Node 2"}, | |
{"x":380, "r":80, "label":"Node 3"} | |
]} |
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 wine-fun.data | |
(:require [clojure.java.io :as io] | |
[clojure.data.csv :as csv])) | |
(def training-data | |
(let [data (with-open [in-file (io/reader "data/winequality-data.csv")] | |
(drop 1 (doall | |
(csv/read-csv in-file)))) | |
control-count (int (/ (count data) 10)) |
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
<security-domain name="other" cache-type="default"> | |
<authorization> | |
<policy-module code="Delegating" flag="required"/> | |
</authorization> | |
</security-domain> |
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 parser.core | |
(:require | |
[clojure.algo.monads :refer [defmonad with-monad state-t m-reduce]])) | |
(defmonad either-m | |
[m-result (fn [[side value]] {:side side, :value value}) | |
m-bind (fn [mv mf] (mf [(:side mv) (:value mv)]))]) | |
(defn left [v] |
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 ocr-kata.core | |
(:require [clojure.java.io :refer [writer reader resource]])) | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
;; we treat this OCR parser similar to a language | |
;; parser where input into an AST that is | |
;; transform and tagged by diffrent analysis steps | |
;; the ast is then passed to an emmiter. | |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
(def numbers {[0 1 0 1 0 1 1 1 1] 0 |
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
// After reading the trials and tribulations here | |
// http://www.learningclojure.com/2014/05/fizz-buzz-interview-question.html?utm_source=dlvr.it&utm_medium=twitter | |
// I decided to see how easy this is using sum types. | |
// Anser: Pretty easy. :D | |
object Program { | |
def numbers(n: Int): Stream[Int] = Stream.cons(n, numbers(n + 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
(ns baseball.core | |
(:require [clojure.core.async :refer (chan >!! <!! >! <! close! go go-loop)] | |
[clojure.core.match :refer (match)])) | |
;; http://www.variousandsundry.com/cs/blog/2014/02/20/baseball-processes/ | |
;; It’s like playing catch in the backyard. You don’t want to play by yourself. So you tell a friend | |
;; to stand about 20 paces away from you. Once they’re there, they wave their arms to be sure you can | |
;; see them. Having seen them, you throw them the ball. They throw it back as a solid line drive | |
;; right at your mitt. End of process. |
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
(defprotocol KeyListener | |
(key [this key-code])) | |
(defprotocol CollisionListener | |
(collision [this other])) | |
(defprotocol BoundsListener | |
(bounds [this other])) | |
(defprotocol GravityListener |
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 segments) | |
(defrecord Lens [fetch putback]) | |
(defprotocol Segment | |
(-fetch [seg value]) | |
(-putback [seg value subvalue])) | |
(defn fetch [value seg] | |
(-fetch seg value)) |
NewerOlder