Skip to content

Instantly share code, notes, and snippets.

Meikel Brandmeyer kotarak

Block or report user

Report or block kotarak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@kotarak
kotarak / rest_returns_seqables.clj
Last active Aug 29, 2015
rest returns seqables
View rest_returns_seqables.clj
(defn repeat-x
[x]
(reify clojure.lang.Seqable
(seq [this]
(reify clojure.lang.ISeq
(first [this] x)
(next [this] (seq (repeat-x x)))
(more [this] (next this))))))
@kotarak
kotarak / benchmarks.txt
Last active Aug 29, 2015
Transmuter benchmarking
View benchmarks.txt
(def v (vec (concat (range 1000) (range 1000))))
(into [] …)
seq / transducer / transmuter
(distinct v): 969µs / 489µs / 331µs
(interpose nil v): 458µs / 43µs / 102µs
(take 1000 v): 114µs / 34µs / 28µs
(drop 1000 v): 41µs / 51µs / 43µs
(map inc v): 68µs / 43µs / 56µs
(filter even? v): 51µs / 29µs / 45µs
View transmuter_usage.clj
(require '[transmuter.core :as t])
(require '[transmuter.async :as at])
; Not a dependency of transmuters. Must be provided
; separately by the application!
(require '[clojure.core.async :as async])
(def input (range 1000000))
; Pipeline definitions are vectors of pipes.
View mutabots.clj
(ns mutabots
"Reimplementation of transducers, in terms of processing functions instead
of reducing functions.
tl;dr: reducing-fn based transducers are a special case, influenced by reducers,
of processing-fn based transducers.
In Clojure 1.7.0-alpha2, transducers are expressed in terms of the existing
concept of reducing functions.
To sum it up, a transducer has currently the signature :
View meikel-q.clj
(defn queue-process-uncontrolled
[input output stats]
(async/go
(loop [q clojure.lang.PersistentQueue/EMPTY]
(let [[val-to-q ch] (async/alts!
(if-let [v (peek q)]
[input [output v]]
[input]))]
(swap! stats update-stats-as-you-see-fit q)
(cond
View gist:6394311
user=> (ns foo.bar (:refer-clojure :exclude [map]))
nil
foo.bar=> (def map :my-map)
#'foo.bar/map
foo.bar=> map
:my-map
foo.bar=> (in-ns 'user)
#<Namespace user>
user=> (ns foo.bar)
nil
@kotarak
kotarak / lispy_AST_transform.groovy
Created Aug 7, 2013
You can write Lisp in any language.
View lispy_AST_transform.groovy
def loadMethod = ZweigBuilder.toNode([
method: "load",
modifier: ["public", "static"],
returnType: ClassHelper.VOID_TYPE,
body: [
[if: [not: flagField],
then: [on: mutexField,
synchronize: [
[if: [not: flagField],
then: [do: [
@kotarak
kotarak / build.gradle
Created Nov 20, 2012
Immutant deployment failing on me
View build.gradle
buildscript {
repositories {
maven { url 'http://127.0.0.1:7080/archiva/repository/internal' }
}
dependencies {
classpath 'clojuresque:clojuresque:1.5.2'
}
}
You can’t perform that action at this time.