I hereby claim:
- I am chouser on github.
- I am chouser (https://keybase.io/chouser) on keybase.
- I have a public key whose fingerprint is 2835 9367 72DD 2F1C BBCF BBED 94AE 902B F718 ED2A
To claim this, I am signing this object:
(def ^:dynamic *err-info* nil) | |
(defmacro with-error-data [data & body] | |
`(let [old-data# *err-info*] | |
(when *err-info* | |
(set! *err-info* (merge *err-info* ~data))) | |
(let [result# (do ~@body)] | |
;; if no exception was thrown above, revert *err-info*: | |
(when *err-info* | |
(set! *err-info* old-data#)) |
https://4clojure.oxal.org/#/problem/117 | |
; 227 | |
#(loop [[[y x] & q] (for [[y r] (map list (range) %) | |
[x c] (map list (range) r) | |
:when (= \M c)] | |
[y x]) | |
b (vec (map vec %))] | |
(if x | |
(if (= \C ((b y) x)) | |
true |
(ns us.chouser.malli-play | |
(:require [malli.core :as m] | |
[malli.error :as me]) | |
(:import (clojure.lang ExceptionInfo))) | |
;; {:deps {metosin/malli {:mvn/version "0.10.1"}}} | |
;; No refinement chaining yet | |
;; No clear separation of constraint violation from runtime error | |
(defn var-sym [v] |
;; primitive lazy-seq | |
(defn filter-with-context-ls [pred n coll] | |
(let [step (fn step [buffer suffix coll] | |
(lazy-seq | |
(when-let [[v & more] (seq coll)] | |
(if (pred v) | |
(concat (take-last n buffer) [v] (step [] n more)) | |
(if (pos? suffix) | |
(cons v (step [] (dec suffix) more)) | |
(step (conj buffer v) 0 more))))))] |
(ns us.chouser.merge-sort | |
"Experiments in parallel folding of vectors" | |
(:require [clojure.core.reducers :as r] | |
[criterium.core :as c] | |
[dom-top.core :refer [loopr]])) | |
(set! *warn-on-reflection* true) | |
(defn array-type | |
"Return a string representing the type of an array with dims |
(ns io.chouser.experiment | |
(:require [clojure.core.async :as async])) | |
(defn bang [] | |
(future | |
(dotimes [i 10] | |
(async/go | |
(print (str "start " i "\n")) (flush) | |
(Thread/sleep 20000) | |
(prn :done i))))) |
; In England the currency is made up of pound, £, and pence, p, and | |
; there are eight coins in general circulation: | |
; | |
; 1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p). | |
; | |
; It is possible to make £2 in the following way: | |
; | |
; 1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p | |
; | |
; How many different ways can £2 be made using any number of coins? |
(ns party.units | |
(:refer-clojure :exclude [+ - * /]) | |
(:require [clojure.algo.generic.arithmetic :as ari :use [+ - * /]] | |
[clojure.algo.generic.math-functions :refer [pow]] | |
[clojure.repl :refer [doc source apropos dir find-doc]])) | |
(defrecord Measurement [sym factor units] | |
clojure.lang.IFn | |
(invoke [a b] (* a b))) |
I hereby claim:
To claim this, I am signing this object: