See source code below.

(require '[clojure.spec.alpha :as s]) | |
(defn- regex-cond-helper | |
[expr-sym clauses default] | |
(if-not (empty? clauses) | |
(let [inner-clause (regex-cond-helper expr-sym (rest clauses) default) | |
{:keys [regex bindings body] :as clause} (first clauses) | |
regex (case (first regex) | |
:regex (second regex) | |
:else `(re-pattern ~(second regex))) |
#!/usr/bin/env bb | |
;; Example usage: | |
;; api_diff_bb.clj org.clojure/clojure "1.9.0" "1.10.1" | |
;; Output: | |
;; clojure/core_deftype.clj:587:1: warning: Arity 4 of clojure.core/emit-method-builder was removed. | |
;; clojure/core/reducers.clj:24:1: warning: clojure.core.reducers/compile-if was removed. | |
(require '[babashka.pods :as pods]) |
Number of hands of poker
Poker users a 52-card deck, where each card is unique. After shuffling, a player gets five random cards. How many different hands are there? Remember, in poker, the order of the cards in your hand does not matter.
Write a function that takes the number of cards in a hand h
and the number of cards in the deck d
and calculates how many possible hands there are.
(defn combinations [d h]
.....
)
Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.
For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.
But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.
SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil
; A REPL-based, annotated Seesaw tutorial | |
; Please visit https://github.com/daveray/seesaw for more info | |
; | |
; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
; Seesaw's basic features and philosophy, but only scratches the surface | |
; of what's available. It only assumes knowledge of Clojure. No Swing or | |
; Java experience is needed. | |
; | |
; This material was first presented in a talk at @CraftsmanGuild in | |
; Ann Arbor, MI. |