Skip to content

Instantly share code, notes, and snippets.

View ckirkendall's full-sized avatar

Creighton Kirkendall ckirkendall

  • Blue Manta Consulting
  • Cincinnati, Ohio
View GitHub Profile
ckirkendall / clojure-match.clj
Created June 15, 2012 02:26 — forked from bkyrlach/Expression.fs
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
ckirkendall / A-Objective.txt
Created September 14, 2012 16:40 — forked from bkyrlach/TreeMagic.scala
Adventures in Type Theory: Parametric Polymorphism(Generics) vs Adhoc Polymophism(Type Classes) (Java,Scala,C#,F#,Nemerle,Haskell)
The Objective
This language experiment was designed to show how parametric polymorphism and type classes are
implemented in different languages. The implementation languages where chosen out of personal
preference. I am well aware it's not complete and would love for you to help me with that. If
you don't see your favorite language please add it as a comment. I am also not an expert in all
of these languages but did try to make them as idiomatic as possible. If you believe there is a
better solution please leave a comment with the implementation.
The Code
ckirkendall / A-sum-higher-kinds.clj
Created June 19, 2012 22:12 — forked from bkyrlach/GenericVersion.scala
Polymorphism - Summation of Higher Kinds(Clojure, Ocaml, Haskell, Scala, Java).
(defrecord Tree [left elm right])
(defprotocol Monoid
(append [a b] )
(identity [a] ))
(defprotocol Foldable
(foldl [l f i])
(mfirst [l]))
ckirkendall / core.clj
Created May 9, 2018 04:10
Simple Event Simulation in Clojure
(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
ckirkendall / data.json
Last active March 21, 2017 13:50 — forked from ChrisJamesC/data.json
d3js: text in circles + json
{"x":80, "r":40, "label":"Node 1"},
{"x":200, "r":60, "label":"Node 2"},
{"x":380, "r":80, "label":"Node 3"}
(:require [ :as io]
[ :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))
<security-domain name="other" cache-type="default">
<policy-module code="Delegating" flag="required"/>
ckirkendall / core.clj
Created January 22, 2014 11:44
This was just for fun to see how much effort it would take. It is a functional clojure version of the java bouncy ball tutorial.
(ns bouncy.core
(:require [goog.math :as math :refer [Vec2]]
[goog.math.Vec2 :as vec]))
(declare step draw-circle)
(def app {:elems [{:pos (Vec2. 100 100) :speed (Vec2. -3 5) :radius 20}
{:pos (Vec2. 200 200) :speed (Vec2. 5 3) :radius 30}
{:pos (Vec2. 300 200) :speed (Vec2. 7 6) :radius 5}
{:pos (Vec2. 400 200) :speed (Vec2. -5 -6) :radius 10}
ckirkendall / design.markdown
Last active January 3, 2016 22:59
Enliven Component Model

##Sketch for Enliven Component Model

This design page is a sketch of how I see enliven being used for dynamic templates in the browser.

Design Principles

  1. All state is in an application state object.
  2. State is scoped through lenses.
  3. Users should not have to manage lenses manually.
  4. There is no tree walking; paths/lenses, for dom manipulation, are determined at compile time.
(defn bind-view-watch-fn [id render-func]
(let [ky (str "EVB:" nid)]
(fn [ctx ref oval nval]
(let [node (.getElementById js/document id)]
(if node
(render-func node nval)
(remove-watch ref ky))))))