Skip to content

Instantly share code, notes, and snippets.

@reborg
reborg / rich-already-answered-that.md
Last active July 8, 2024 07:19
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

;; try this form-by-form at a REPL
(require '[clojure.spec.alpha :as s])
;; create an inline DSL to describe the FizzBuzz world
(defmacro divides-by
[nm n]
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n)))))
;; specify FizzBuzz
(divides-by ::fizz 3)
import cats.effect.ExitCase._
import cats.effect.Sync
import cats.effect.concurrent.Ref
import cats.syntax.flatMap._
import cats.syntax.functor._
trait Tap[F[_]] {
def apply[A](effect: F[A]): F[A]
}
@joinr
joinr / deps.edn
Last active January 29, 2020 13:45
A fancy repl setup derived from https://asciinema.org/a/296507 by didibus
{:aliases {:repl {:extra-deps {com.bhauman/rebel-readline {:mvn/version "RELEASE"}
io.aviso/pretty {:mvn/version "RELEASE"}
mvxcvi/puget {:mvn/version "RELEASE"}
org.clojure/clojure {:mvn/version "RELEASE"}
com.gfredericks/user.clj {:mvn/version "RELEASE"}
clj-commons/pomegranate {:mvn/version "RELEASE"}}
:main-opts ["-m" "rebel-readline.main"]}
:fancy {:extra-deps {org.clojure/core.async {:mvn/version "RELEASE"}
org.clojure/core.logic {:mvn/version "RELEASE"}
org.clojure/test.check {:mvn/version "RELEASE"}