Skip to content

Instantly share code, notes, and snippets.

View mix.clj
(defn mix*
"Helper function for mix."
{:private true}
(if (seq colls)
(if (seq (first colls))
(lazy-seq (cons (ffirst colls)
(mix* (conj (subvec colls 1)
(rest (first colls))))))
(recur (subvec colls 1)))
View profile_clj_to_deps_edn.clj
(require '[meander.epsilon :as m])
(m/rewrite (read-string (slurp "project.clj"))
(defproject _ _ . !key !value ...)
(m/cata [:DEPS_EDN (m/map-of !key !value)])
[:DEPS_EDN {:dependencies ?dependencies
:profiles ?profiles
:source-paths !paths
:resource-paths !paths}]
noprompt / deps.edn
Last active May 22, 2019
Implementing L-System examples from the "Algorithmic Beauty of Plants" with Meander
View deps.edn
{:paths ["src"]
:deps {org.clojure/clojure {:mvn/version "1.10.0"}
org.clojure/clojurescript {:mvn/version "1.10.439"}
org.clojure/test.check {:mvn/version "0.10.0-alpha3"} {:mvn/version "0.3.0"}
meander/delta {:mvn/version "0.0.85"}
quil/quil {:mvn/version "3.0.0"}}
:aliases {:test {:extra-paths ["test"]
:extra-deps {org.clojure/test.check {:mvn/version "0.10.0-alpha3"}
com.cognitect/test-runner {:git/url ""
View meander_delta_interpreter.clj
(:require [ :as r.match]
[ :as r.syntax]
[ :as r.util]))
(defn genmut
{:tag :mut
:symbol (gensym "*m__")})
View k-combinations.clj
(defn swap
"Swap the elements at positions `i` and `j` in `v`."
{:private true}
[v i j]
(-> v
(assoc i (nth v j))
(assoc j (nth v i))))
;; SEE:
(defn permutations
View aws-example.clj
(ns scratch
[ :as json]
[clojure.string :as string]
[meander.strategy.alpha :as r]
[meander.match.alpha :as r.match]))
(def service-2-json
(slurp "")))
noprompt / sql_auto_shout.el
Last active Feb 22, 2019
Automatically shout SQL keywords and builtins
View sql_auto_shout.el
(defun ~/end-of-previous-face-change (face-name)
(let ((continue t)
(answer nil))
(while continue
(let ((p (or (previous-single-property-change (point) 'face)
(if (= p 1)
(setq continue nil)
View derive_specs.clj
(require '[spec-provider.provider :as sp])
(defn derive-specs [var & args]
(let [ns-sym (ns-name (:ns (meta var)))
ns-name (name ns-sym)
derived-specs (atom [])
fn-var-info (into [] (keep (fn [[var-sym var]]
(let [x (deref var)]
(when (fn? x)
[var var-sym x]))))
View if_not.clj
(ns if-not.bench
(:require [criterium.core]))
(defmacro if-not*
([test then] `(if ~test nil ~then))
([test then else]
`(if ~test ~else ~then)))
(criterium.core/bench (if-not false 1 2))
;; Evaluation count : 5375474880 in 60 samples of 89591248 calls.
noprompt / example-out.txt
Created Mar 14, 2018
Write all public documentation for the ns named ns-sym to *out*.
View example-out.txt
Synchronous client library for interacting with Datomic.
This namespace is a wrapper for datomic.client.api.async.
Functions in this namespace that communicate with a separate
process take an arg-map with the following optional keys:
:timeout Timeout in msec.