This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-18
Channels
- # 100-days-of-code (2)
- # beginners (10)
- # boot (1)
- # calva (8)
- # cider (13)
- # cljdoc (7)
- # clojure (32)
- # clojure-uk (15)
- # clojurescript (9)
- # code-reviews (1)
- # cursive (8)
- # datomic (1)
- # emacs (1)
- # fulcro (9)
- # hoplon (4)
- # nrepl (1)
- # off-topic (30)
- # onyx (2)
- # re-frame (11)
- # reitit (3)
- # shadow-cljs (33)
- # tools-deps (3)
- # vim (5)
I know about https://gist.github.com/gregsh/b7ef2e4ebbc4c4c11ee9 . It has not reached a level for 'practical' use for met yet. Has anyone here managed to script IntelliJ (or any other IDE) in Clojure like one scripts Emacs in Elisp ? [I'm basically looking for an IDE that I can dynamically reprogram in Clojure.]
Basically that is how LightTable was done (with ClojureScript). I believe the same is true for ProtoRepl (which should have more support these days)
But the truth is, you won't find anything nearly as good as Emacs. I'd say for that it is a better investment to just use Emacs and learn some Emacs Lisp. Which is a lot easier once you know Clojure.
Curious to know if there is a standard workflow to navigate Protocol implementations. Particularly jump from a protocol method call to it's implementation. Example
(ns dirigent.protocols)
(defprotocol Trippable
(tripped? [this])
(run-body [this body-fn])
(reset-trip [this]))
(ns dirigent.records.counter)
(defrecord CounterCB
[circuit-breaker-name counter-state failure-pred threshold timeout]
tcp/Trippable
(tripped? [this]
true)
(run-body [this body-fn]
(ctl/info "Running the body and counting errorr if possible"))
(reset-trip [this]
(ctl/info "Resetting the trip")))
(ns dirigent.records.sliding-window)
(defrecord SlidingWindowCB
[circuit-breaker-name counter-state failure-pred threshold timeout]
tcp/Trippable
(tripped? [this]
true)
(run-body [this body-fn]
(ctl/info "Running the body and counting errorr if possible"))
(reset-trip [this]
(ctl/info "Resetting the trip")))
(ns dirigent.core
(:require [dirigent.protocols :refer [run-body]]))
(defn run-main
[cb-record]
;; cb-record can either be CounterCB or SlidingWindowCB
(run-body cb-record))
I would like to navigate from run-body
in dirigent.core/run-main
to implementations dirigent.records.sliding-window
or dirigent.records.counter
I came across this issue on cider
https://github.com/clojure-emacs/cider/issues/1969
I have rough solution which works by changing cider-nrepl
info
middleware
https://gist.github.com/kapilreddy/6923f310d00ed28b3d0cc667e2733963 (Edited)
https://github.com/clojure-emacs/cider-nrepl/blob/v0.18.0/src/cider/nrepl/middleware/info.clj#L81 (Original)
Wanted to know if,
1. Is this the right approach of structuring code so that navigation becomes easier?
2. Is there a better approach to solve this?I would post this in the issue you mention and potentially open a PR against cider-nrepl
, where that piece of code lives. Putting it there is a good thing because Slack will swallow this message soon
@U0C8489U6 Sure. Will do.
Please tell me what is your favorite code formatting library? Maybe you just trust your IDE's formatting?
Emacs does the right job, but otherwise cljfmt is the only one I know
I think mostly Emacs + Clojure mode, cider might add a bit of extra smartness around macros
but paredit doesn't really affect formatting imho, it simply helps you working with sexpressions
So I'm thinking about throwing a repo together for this prototype predicate dispatch thing I put together here: https://stackoverflow.com/questions/53329709/dispatching-function-calls-on-different-formats-of-maps/53354967#53354967
Anybody got a good idea for a library name? poly? polypred? predicate-dispatch? And what should be the name of the main defmethod-like macro? Currently it's defpoly
but defpd
might be clear enough?
I like predicate-dispatch. I don't really have any good names for the macro since defpoly
immediately raises the "poly-what?" question and I think defpd
is just a bit too terse
Is "poly" from "polymorphic" not the closest semantic to what we're talking about? "multi" is another obvious one, but there's some semantic overlap there with "multi"methods
Maybe defpatch
, in the spirit of "dispatch," but sorta like you're "patching" the definition š
I just installed Java/Leiningen/InteliJ on my Mac. I am getting strange error messages when I include libraries. Is there some way to verify if the install went ok? The rep works, but I don't know why this error comes up. When I worked on Linux with the same code, all was fine... Many thanks!!
@davidpty looks related to https://github.com/amalloy/ordered/pull/37. Does it happen with say Java 8?
I would love love love to see a page that shows me how to dissect an atom like a surgeon with code examples
I have to constantly re-reference basic material with regards to atoms and data storage. it's a shocker
most of the things i want to do are very basic: add a map to an atom, search an atom for a map with a matching :username "value"...
An atom only holds a single value - usually that value is a hash-map, but that's not always the case.
an atom is a pointer to a value that can be be atomically compared and swapped for another value
pointer dereference and atomic cas are the only two operations that exist for it, anything else is some operation on a value pointed to by the atom, not an operation on atoms
you can also set or remove a validator or a watch function
my point is just, an atom has those two operations only, and anything else "adding" whatever, or "searching", or whatever, have nothing to do with atoms
right, fair
so if you find yourself not knowing how to do whatever with an atom, the atom is not the part that matters, in reality you just don't know how to do whatever (search for things in a map, add things to a map, etc), so should focus on basic data structure manipulation (update-in, conj, seq, contains?, assoc) and ignore/forget anything to do with atoms
Iām looking for some code which would take a randomly-generated code form (from a spec or some other grammar) and then randomly break it in various ways in order to write generative tests for code using the parsed form.