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
(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
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
#!/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
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
(defmacro defvariant | |
[name [[tag & variant-binders] & other-binders] body] | |
`(defmethod ~name ~tag [[_# ~@variant-binders] | |
~@other-binders] | |
~body) | |
[name [tag & binders] body] | |
`(defmethod ~name ~tag [[_# ~@binders]] ~body)) | |
; CompilerException java.lang.RuntimeException: Unable to resolve symbol: & in this context, compiling:(/tmp/form-init8620656005427572977.clj:1:1) |
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 Variant | |
class Caser | |
attr_reader :value | |
def initialize(variant) | |
@variant = variant | |
@invoked = false | |
end | |
def try_case(tag, &b) | |
if @variant.tag == tag |
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
module Kernel | |
def cases(o, cases={}) | |
o = [o] unless o.is_a? Array | |
raise "invalid" unless o[0].is_a? Keyword | |
selection = cases[o[0]] || cases[:else] || raise("non-exhaustive cases!") | |
selection.call(*cases[1..-1]) | |
end | |
end |
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
#!/usr/bin/env ruby | |
require 'gtk3' | |
fname = ARGV[0] | |
def window(&b) | |
w = Gtk::Window.new | |
proc { w.instance_eval(&b) } | |
end |
OlderNewer