Skip to content

Instantly share code, notes, and snippets.

View waffletower's full-sized avatar

Christopher Penrose waffletower

  • Portland, Oregon
View GitHub Profile
@waffletower
waffletower / gist:2577a19da18f751b10298235005e601e
Last active April 10, 2025 23:09
Bind metadata to a Clojure function without a var via defrecord
Via clojure.core, metadata associations are only available to vars.
This is a method to associate metadata with lambda functions,
perhaps purposely exposing data a function closes upon, as encapsulation
is the *only* supported behavior for closure data.
(defrecord MetaFn
[md f]
clojure.lang.IFn
(applyTo [this args]
(apply (:f this) args))
@waffletower
waffletower / samelocal.clj
Last active August 29, 2018 17:49
local date string in given time zone
(-> (java.time.ZonedDateTime/now)
(.withZoneSameLocal (java.time.ZoneId/of "America/Chicago"))
t/date-time->iso-local-date)