Skip to content

Instantly share code, notes, and snippets.

View flexibeast's full-sized avatar

Alexis flexibeast

View GitHub Profile
@metametadata
metametadata / spec-plus.cljc
Last active March 4, 2019 12:22
Helpers for core.spec. Also see the related discussion: https://groups.google.com/forum/#!topic/clojure/i8Rz-AnCoa8
(ns libs.spec-plus
"Helpers for core.spec. Only tested in Lumo at the moment."
(:require [clojure.spec.alpha :as s]
[clojure.spec.test.alpha :as st]
[clojure.set :as set]
[cljs.analyzer :as ana])
#?(:cljs (:require-macros [libs.spec-plus])))
(defmacro speced-keys
"The same as s/keys but asserts that all keys have specs already registered.
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active January 8, 2026 15:29
Hyperlinks in Terminal Emulators
(ns utils.cond
"A collection of variations on Clojure's core macros. Let's see which features
end up being useful."
{:author "Christophe Grand"}
(:refer-clojure :exclude [cond when-let if-let]))
(defmacro if-let
"A variation on if-let where all the exprs in the bindings vector must be true.
Also supports :let."
([bindings then]
@stelleg
stelleg / hm_scott.lhs
Last active July 4, 2016 10:42
Hindley Milner + Scott Encoding Musings
Sometimes it would be nice if a type system could automatically "do it's best"
to restrict what a value will be. For example, the type `Bool` is the compiler
saying the value will either be `True` or `False`, but it doesn't know which.
What we want is the compiler to be able to be precise when possible, so instead
of always saying `Bool` (or "I don't know"), it could say `True`, `False`, or
`Bool`. This gist shows how Hindley Milner already has this capability that can
be exercised by using Church or Scott encodings of simple data types.
> {-# LANGUAGE RankNTypes #-}
> import qualified Data.Maybe as M