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
(macroexpand '(fnk [a/b] (+ 1 a/b))) ; => | |
(clojure.core/with-meta | |
(clojure.core/fn [{:or {}, a$b2238 :a/b}] (+ 1 a$b2238)) | |
{:req-deps [:a/b], :opt-deps []}) |
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 write-output [out-file coll] | |
(spit out-file | |
(clojure.string/join | |
(map | |
#(str (:email %) \newline | |
" ~ " (:question %) \newline) | |
coll)))) |
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
;; A basic Ring handler | |
(defn handler [request] | |
{:status 200 | |
:headers {} | |
:body "Hello World"}) | |
;; Which can also be written: | |
(def handler |
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
;; Here is a spike of a lightweight in-process pubsub mechanism that allows pure ;; functional consumers, both blocking and asynchronous. | |
;; This defines the event stream, in this case just a series of numbers, | |
;; a new one produced each second | |
(defn timer [] | |
(lazy-seq | |
(do | |
(Thread/sleep 1000) | |
(cons (System/nanoTime) (timer))))) |
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
(use '[datomic.api :only [db q] :as d]) | |
(def schema | |
[{:db/doc "A programming language" | |
:db/id (d/tempid :db.part/db) | |
:db/ident :lang | |
:db/valueType :db.type/string | |
:db/cardinality :db.cardinality/one | |
:db.install/_attribute :db.part/db} |
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
(ns dj.plurality) | |
(defmacro defplural-body [pluralfn-name arg-list & resolver-body] | |
`(def ~pluralfn-name (let [implementations# ~(if (resolve pluralfn-name) | |
`(atom (or @(:dj.plurality/implementations (meta ~pluralfn-name)) | |
[])) | |
`(atom []))] | |
(with-meta (fn ~pluralfn-name ~(into [] (rest arg-list)) | |
(let [~(first arg-list) @implementations#] | |
~@resolver-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
(ns overtone.examples.internal-sequencer | |
(:use [overtone.live])) | |
;; A fully server-side sample sequencer. | |
;; ===================================== | |
;; This example demonstrates some of the benefits of moving all synth | |
;; triggers inside the server itself. For example, it allows you to | |
;; modify the synthesis with *immediate* effect (rather than waiting for | |
;; the next bar/chunk to be scheduled) and you can use a global pulse to |
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
(use '[datomic.api :only [q db] :as d]) | |
(def uri "datomic:mem://accounts") | |
;; create database | |
(d/create-database uri) | |
;; connect to database | |
(def conn (d/connect uri)) |
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
(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 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
AA = Rickard Stark (M) AB = Eddard Stark (M) AC = Catelyn Tully (F) | |
AD = Brandon Stark (M) AE = Benjen Stark (M) AF = Jon Snow (M) | |
AG = Robb Stark (M) AH = Sansa Stark (F) AI = Arya Stark (F) | |
AJ = Bran Stark (M) AK = Rickon Stark (M) AL = Hoster Tully (M) | |
AM = Minisa Whent (F) AN = Edmure Tully (M) AO = Lysa Tully (F) | |
AP = Jon Arryn (M) AQ = Robert Arryn (M) AR = Tytos Lannister (M) | |
AS = Tywin Lannister (M) AT = Joanna Lannister (F) AU = Kevan Lannister (M) | |
AV = Cersei Lannister (F) AW = Jamie Lannister (M) AX = Tyrion Lannister (M) | |
AY = Robert Baratheon (M) AZ = Joffrey Baratheon (M) BA = Myrcella Baratheon (F) | |
BB = Tommen Baratheon (M) BC = Lancel Lannister (M) BD = Steffon Baratheon (M) |