This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-07-04
Channels
- # announcements (5)
- # beginners (56)
- # calva (2)
- # cider (30)
- # circleci (2)
- # cljsrn (90)
- # clojars (3)
- # clojure (18)
- # clojure-dev (9)
- # clojure-europe (3)
- # clojure-greece (14)
- # clojure-ireland (6)
- # clojure-italy (6)
- # clojure-nl (7)
- # clojure-norway (1)
- # clojure-spec (1)
- # clojure-sweden (3)
- # clojure-uk (14)
- # clojurescript (52)
- # cursive (5)
- # data-science (9)
- # datomic (3)
- # emacs (26)
- # expound (11)
- # figwheel (3)
- # figwheel-main (6)
- # fulcro (24)
- # garden (1)
- # graalvm (101)
- # liberator (1)
- # mount (1)
- # off-topic (1)
- # pathom (27)
- # portland-or (2)
- # reagent (13)
- # reitit (2)
- # ring (1)
- # shadow-cljs (10)
- # spacemacs (11)
- # sql (6)
Hi, I am looking for some interesting open source (would like to contribute). Can someone please suggest me?
Hi, I'm looking for something like prettier (https://prettier.io/) for clojure. It's an opinnionated code formatter that works across editors. What's awesome with this is that it removes all originial styling and reprints it pretty printed.
Look into https://github.com/kkinnear/zprint for a whole-project formatter. We standarised on https://tonsky.me/blog/clojurefmt across Cider and Cursive, and it’s working very well.
afaict it would be hard to remove all original styling because of macros. You would prbably want clojure.test/are
to contain the same number of forms as its argv
on each line, and other macros could have similar constraints. https://clojuredocs.org/clojure.test/are
Hi, I’ve created this testing library: https://github.com/ccfontes/eg Hope someone finds it useful.
Is there a nice way to get Robert Hooke (https://github.com/technomancy/robert-hooke) like behaviour with functions on records? I'm trying to record metrics for each invocation of every function on a large number of records, and don't really want to modify the implementations.
@clojurians971 the only thing I can think of is using def-derived-map to reduce boilerplate a bit https://github.com/ztellman/potemkin#def-derived-map
but maybe it makes more sense to use deftype, and delegate all the map methods plus the interface / protocol methods of the target
@clojurians971 zach tellman did a clever trick in manifold by making 1 out of 1024 records a stat emitting record. https://github.com/ztellman/manifold/blob/master/src/manifold/deferred.clj#L340 maybe this could help you?
not sure if a sampling approach helps you but there's an example if you wanted to browse it
Cool, thanks. I'm happy for every invocation to be gather metrics, it's just a shame that I can't iterate over all vars on the protocol and wrap the invocation.
if it's strictly protocols and not interfaces, you actually can access the method programatically, and you can even get the protocols implemented from a record programatically
user=> (defrecord Foo [])
user.Foo
user=> (defprotocol IBar (do-bar [this]))
IBar
user=> IBar
{:on user.IBar, :on-interface user.IBar, :sigs {:do-bar {:name do-bar, :arglists ([this]), :doc nil}}, :var #'user/IBar, :method-map {:do-bar :do-bar}, :method-builders {#'user/do-bar #object[user$eval163$fn__164 0x565b064f "user$eval163$fn__164@565b064f"]}}
user=> (keys (:method-map IBar))
(:do-bar)
user=> (defrecord Bar [] IBar (do-bar [_]))
user.Bar
user=> (clojure.set/difference (supers Bar) (supers Foo))
#{user.IBar}
that should be a starting point to iterating protocols on a record, finding the methods in them, and wrapping them programmatically