View permutations.clj
(defn swap
"Swap the elements at positions `i` and `j` in `v`."
{:private true}
[v i j]
(-> v
(assoc i (get v j))
(assoc j (get v i))))
;; SEE:
(defn permutations [coll]
View with_repl_friendly_inspect.rb
def with_repl_friendly_inspect(&block)
x =
case x
# We don't want to and sometimes can't override the #inspect method
# of these classes of values.
when Array,
View conform_case.clj
(ns conform-case
(:require [clojure.spec :as spec]))
(defn build-clause-form
{:private true}
[expression-form clause else-form]
(let [[spec binding-form & body] clause]
`(let [conform-value# (spec/conform ~spec ~expression-form)]
(if (= conform-value# ::spec/invalid)
View intero-scratch.el
(defun intero-scratch-send-paragraph ()
(let* ((source-code-start (save-excursion
(source-code-end (save-excursion
View strum.clj
(ns strum.core
(:refer-clojure :exclude [defn])
[clojure.spec :as spec]
[clojure.spec.test :as spec.test]))
;; ---------------------------------------------------------------------
;; Prelude
;; HACK: Currently, as of Clojure 1.9.0-alpha14, there is a bug with
View cek.clj
(ns machines.cek
[clojure.core.match :as match]
[clojure.spec :as spec]))
;; e ∈ Exp ::= x | (e e) | (λ (x) e)
;; x ∈ Var
;; ς ∈ Σ = Exp × Env × Kont
;; v ∈ Val ::= (λ (x) e)
;; ρ ∈ Env = Var →_fin Val × Env
View state_box.clj
(ns state-box)
(defprotocol IGetState
(-get-state [state key]))
(defprotocol IPutState
(-put-state [state key value]))
(deftype ImmutableBox [get-state put-state state]
use std::io::BufRead;
use std::io::BufReader;
use std::io::ErrorKind;
use std::io::Write;
use std::net::TcpListener;
use std::net::TcpStream;
use std::thread;
use std::time::Duration;
fn handle_tcp_stream(mut tcp_stream: TcpStream) {
View conditionally-run-ruby.el
(when (not (boundp 'inf-ruby-implementations))
(setq inf-ruby-implementations nil))
(defun ~/paths-to-root (file-name)
(let* ((path-parts (s-split "/" (file-name-directory file-name) t))
(build-path (lambda (path-parts)
(concat "/" (s-join "/" path-parts))))
(paths (reduce (lambda (state _)
(let* ((old-path-parts (cdr state))
(new-path-parts (-butlast old-path-parts))
View require_gem.rb
# @return [Array<String>]
def gem_paths
Gem.path.flat_map { |path| Dir.glob("#{path}/gems/*") }
# @param [String] gem_name
# @return [Boolean]
# @raise [LoadError]
def require_gem(gem_name)
if defined?(::Bundler)