This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns retry | |
| (:import [java.util.function Supplier] | |
| [java.util.concurrent CompletableFuture TimeUnit])) | |
| (defn with-retry | |
| "given an op wanting retries, and a strategy for backoff, | |
| returns a CompletableFuture that can be waited on | |
| op takes no args | |
| A backoff strategy is a function of an exception, returning nil or a number of milliseconds to backoff" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| proto = <syntax> { import | package | option | message | enum | service | emptyStatement } <ws> | |
| (* Header *) | |
| syntax = ws "syntax" ws "=" ws ( "'proto3'" | '"proto3"' ) ws ";" | |
| import = <ws "import" ws> [ "weak" | "public" ] <ws> strLit <ws ";"> | |
| package = <ws "package" ws> fullIdent <ws ";"> | |
| option = <ws "option" ws> optionName <ws "=" ws > constant <ws ";"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;; needs a refer-clojure exclude on iteration | |
| (defn iteration | |
| "returns a channel of items given step!, a function of some (opaque continuation data) k | |
| step! calls can get bufsize ahead of consumption (asynchronously) | |
| step! - fn of k/nil to chan yielding (opaque) 'ret' | |
| :bufsize - buffer this many step! calls, default 1 | |
| :some? - fn of ret -> truthy, indicating there is a value |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns day3 | |
| (:require [util])) | |
| (defn adjacent-range | |
| "returns [(dec lo), (inc hi)], lo clamped by 0, hi clamped by arg" | |
| [lo hi hi-clamp] | |
| [(max (dec lo) 0) | |
| (min (inc hi) hi-clamp)]) | |
| (defn scan-adjacent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {:paths ["."] | |
| :deps {org.clojure/clojure {:mvn/version "1.12.3"}} | |
| :aliases {:repro {:exec-fn repro/main} | |
| :accelerate {:jvm-opts ["-XX:-UseCompressedOops"]} | |
| ;; < 1.12 has a different, correct impl of LazySeqs using monitors, not RLocks | |
| :monitors {:deps {org.clojure/clojure {:mvn/version "1.11.4"}}}}} |
OlderNewer