This file contains 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
; it's a bit cumbersome to set up and there's the unfortunate need to ignore the tag | |
; in the individual methods, but this allows you to leave the interpretation of open | |
; variants, well, *open* for extension by multimethod. | |
; dispatch off the first argument, which will be the tag | |
(defmethod command-multi (fn [tag & data] tag)) | |
; the first argument to the *method* is still the tag | |
(defmulti command-multi :print [_ val] (println val)) | |
(defmulti command-multi :read [_ fname] (slurp fname)) |
This file contains 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
FROM base/devel | |
RUN pacman --noconfirm -Sy jdk7-openjdk | |
RUN pacman --noconfirm -Sy socat | |
ENV LEIN_ROOT 1 | |
RUN curl https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein > /usr/local/bin/lein \ | |
&& chmod +x /usr/local/bin/lein \ | |
&& lein |
This file contains 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
#!/bin/bash | |
. /usr/lib/network/globals | |
. "$SUBR_DIR"/wpa | |
BIN_DIR="$(dirname "$0")" | |
PREFIX="${WIFI_PREFIX:-$BIN_DIR/..}" | |
LIB_DIR="$PREFIX/lib/wifi" | |
NOW="$(date +%s)" |
This file contains 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
data Expr = Var Char | |
| Lam Char Expr | |
| App Expr Expr | |
hasFree :: Char -> Expr -> Bool | |
hasFree c (Var v) = c == v | |
hasFree c (Lam arg body) = c /= arg && hasFree c body | |
hasFree c (App func arg) = hasFree c func && hasFree c arg |
This file contains 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 type-test.lambda | |
(require [clojure.core.typed :refer :all] | |
[clojure.core.match :refer [match]])) | |
(def-alias Expr "An expression" | |
(Rec [e] | |
(U '[(Value :var) Symbol] | |
'[(Value :lam) Symbol e] | |
'[(Value :app) e e]))) |
This file contains 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 type-test.lambda | |
(require [clojure.core.typed :refer :all] | |
[clojure.core.match :refer [match]])) | |
(def-alias Expr "An expression" | |
(Rec [e] | |
(U '[(Value :var) Symbol] | |
'[(Value :lam) Symbol e] | |
'[(Value :app) e e]))) |
This file contains 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 rec [expr] | |
(match expr | |
[:global] 'GLOBAL | |
[:constant x] x | |
[:variable x] x | |
[:lazy-variable x] `(deref ~x) | |
[:if test if-true if-false] `(if ~(rec test) | |
~(rec if-true) | |
~(rec if-false)) | |
[:delist list index] `(get ~(rec list) ~(rec index)) |
This file contains 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
> time node ~/tmp/perf-test.js | |
dynamic | |
real 0m0.697s | |
user 0m0.690s | |
sys 0m0.013s | |
> time node ~/tmp/perf-test.js static | |
static |
This file contains 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
class Monad: | |
@staticmethod | |
def unit(val): | |
raise NotImplemented | |
def bind(self, fn): | |
raise NotImplemented | |
def map(self, map_fn): | |
""" |
This file contains 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
// what i assume the callbacks look like | |
abstract class Callback<T> { | |
abstract void run(T data); | |
} | |
// the binding function a -> m b | |
abstract class Step<T, U> { | |
abstract Action<U> into(final T data); | |
} |