Skip to content

Instantly share code, notes, and snippets.

@semperos
semperos / rich-already-answered-that.md
Created May 28, 2021 16:49 — forked from reborg/rich-already-answered-that.md
A curated collection of answers that Rich gave throughout the history of Clojure

Rich Already Answered That!

A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.

How to use:

  • The link in the table of content jumps at the copy of the answer on this page.
  • The link on the answer itself points back at the original post.

Table of Content

@semperos
semperos / pull-request-template.md
Last active August 8, 2016 17:12 — forked from Lordnibbler/pull-request-template.md
Sample Pull Request Template

Stories

Status

Check these boxes as they're completed.

  • Dev Planning/Spike
  • 30% Review
@semperos
semperos / 00_destructuring.md
Created November 5, 2015 18:26 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors

@semperos
semperos / div.clj
Last active September 11, 2015 22:12 — forked from gfmurphy/Div.hs
Readability
(defn digits
"Generate a list of digits contained in the number"
[number]
(loop [found-digits '() base (quot number 10) digit (rem number 10)]
(let [found-digits (conj found-digits (if (neg? digit) (- digit) digit))]
(if (zero? base)
found-digits
(recur found-digits (quot base 10) (rem base 10))))))
(defn divisible-digits
@semperos
semperos / SizeOf.java
Last active December 30, 2015 19:49 — forked from bnyeggen/SizeOf.java
import java.lang.reflect.*;
//This is still basically an estimate, but should be reasonably accurate.
public class SizeOf {
//4 bytes on 32 bit JVM
public static final int REFERENCE_SIZE = 8;
public static int deepSize(boolean b) { return 1; }
public static int deepSize(byte b) { return 1; }
public static int deepSize(char c) { return 2; }