Skip to content

Instantly share code, notes, and snippets.

View Bronsa's full-sized avatar

Nicola Mometto Bronsa

View GitHub Profile
;; nothing to see here, just an innocuous comment
;; (defn hi ([] (println "evil hello")) {:eval (println "launching missles")})
(defn hi [] (println "hello"))
(defun gensymify (body &optional (mappings (make-hash-table :test #'equal)))
(mapcar
(lambda (el)
(cond
((listp el)
(gensymify el mappings))
((and (symbolp el)
(not (symbol-package el)))
(let* ((n (symbol-name el))
(s (gethash n mappings)))

Keybase proof

I hereby claim:

  • I am bronsa on github.
  • I am bronsa (https://keybase.io/bronsa) on keybase.
  • I have a public key ASCzWD00qg9lymRGO1Mo23V988s1dTgSHTTuoot8BTGI8go

To claim this, I am signing this object:

(require '[clojure.tools.analyzer :as a]
'[clojure.tools.analyzer.jvm :as a.j]
'[clojure.tools.analyzer.ast :as ast]
'[clojure.tools.analyzer.utils :as u]
'[clojure.tools.analyzer.passes.jvm.emit-form :as j.e]
'[clojure.tools.analyzer.passes.emit-form :as e])
(defn ^:private mexpansions
([ast _] (mexpansions ast))
([ast]
@Bronsa
Bronsa / gist:5014762
Last active December 14, 2015 02:38
simple lisp interpreter, with continuations
(ns lisp.core)
(defprotocol Continuation
(resume [this v]))
(defmacro defcontinuation [name [& fields] & body]
`(defrecord ~(symbol (str name "-cont")) [~'k ~@fields]
Continuation
~@body))
(def tree '[:and a [:or b [:or c d]]])
(def db '{:a #{a d} :b #{b c} :d #{a c}})
;; (defn compile* [o el]
;; (if (coll? o)
;; (compile o el)
;; (get el o)))
;; (defmulti compile (fn [[op r l] el] op))
package clojure.lang;
import java.util.Comparator;
import java.util.Map;
import java.util.concurrent.Callable;
public class interfaces {
public static interface ISeq extends IPersistentCollection {
Object first();
(defn throw-arity [this n]
(let [name (-> this .getClass .getSmpleName)
suffix (.lastIndexOf name "__")
elided-name (if (= suffix -1) name (.substring name 0 suffix))]
(throw (clojure.lang.ArityException. n (.replace elided-name \_ \-)))))
(def AFn
(list
'java.lang.Callable
(def AFn
(list
'java.lang.Callable
'(call [this] (-invoke this))
'java.lang.Runnable
'(run [this] (-invoke this))
'IFn
(map (fn [args] (list '-invoke (vec (cons 'this args))
(ns clojure.lang.traits
(:require [brochure.def :refer [deftrait]]
[clojure.lang.protocols :refer :all]))
(deftrait AReference [^:unsynchronized-mutable meta]
IMeta
(-meta [this]
(locking this meta))
IResetMeta