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 lambda-calc.core) | |
;; THIS MACRO CREATES A LAMBDA THAT IS COMPATABLE WITH LAMBDA AS DEFINED IN | |
;; LAMBDA CALCULUS -> CURRIED NON-RECURSIVE | |
(defmacro f* [args & body] | |
(let [fsym (gensym "fn") | |
alist (for [n (range 1 (count args))] | |
(take n args)) | |
curries (map #(do `(~(vec %) (partial ~fsym ~@%))) alist)] | |
`(fn ~fsym ~@curries (~args ~@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 workbench.enlive.predicate | |
(:require | |
[clojure.zip :as z] | |
[workbench.enlive.engine | |
:refer [compile-step]] | |
[workbench.enlive.select | |
:refer [zip-select]])) | |
;; ## Builtin predicates | |
;; |
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
;; The macros | |
;; most macros here alias names from select.cljs | |
;; they will get used in regular calls | |
(ns lib.select | |
(:require | |
[clojure.string :as str])) | |
;; selector syntax | |
(defn intersection [preds] |
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
(defprotocol XmlNode | |
(get-parent [_]) | |
(get-children [_])) | |
(def empty-node | |
(reify XmlNode | |
(get-parent [_] nil) | |
(get-children [_] '()))) | |
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 '[clojure.string :only (split)]) | |
(defn break-long-word [n word] | |
(if (> (count word) n) | |
[(take n word) (break-long-word n (drop n word))] | |
[word])) | |
(defn break-long-words [n words] | |
(mapcat #(break-long-word n %) words)) |
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
abstract class Show<A> { | |
public static register(Class c, Show s){ | |
Map<Class,Object> shows=TypeClassFactory.tcs.get(Show.class) | |
if(shows!=null){ | |
shows.put(c,s); | |
}else{ | |
shows = new Map<Class,Object>(); | |
shows.put(c,s); | |
TypeClassFactory.tcs.put(Show.class, shows); |
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 spell-checker.speller) | |
(defonce training-data (re-seq #"[a-z]+" (.toLowerCase (slurp "/home/ckirkendall/Development/clojure/spelling-jam/data/big.txt")))) | |
(defonce NWORDS (atom (frequencies training-data))) | |
(defn deletes [word] |
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
package org.cinjug; | |
import java.util.Iterator; | |
interface Seq<T> { | |
public T next() throws EmptySequenceException; | |
public T peek() throws EmptySequenceException; | |
public boolean hasNext(); |
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 chatter-box.event-bus-test | |
#+cljs | |
(:require-macros [cemerick.cljs.test :refer [deftest testing is]] | |
[cljs.core.async.macros :refer [go]]) | |
(:require | |
[chatter-box.event-bus :as bus :refer [create-bus Component init accept-message? get-channel]] | |
#+clj [clojure.test :as test :refer [deftest testing is]] | |
#+cljs [cemerick.cljs.test :as t] | |
#+clj [clojure.core.async :as a :refer [alts! <! >! chan timeout go]] | |
#+cljs [cljs.core.async :as a :refer [alts! <! >! chan timeout]])) |
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 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)))))) | |