Fork me on GitHub
#clojure
<
2018-11-18
>
todo04:11:23

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.]

jsa-aerial18:11:58

Basically that is how LightTable was done (with ClojureScript). I believe the same is true for ProtoRepl (which should have more support these days)

didibus22:11:54

You can also look at Nightcode and Nightlight

didibus22:11:49

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.

kapil04:11:25

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?

richiardiandrea05:11:18

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

Audrius10:11:50

Please tell me what is your favorite code formatting library? Maybe you just trust your IDE's formatting?

andrea.crotti10:11:40

Emacs does the right job, but otherwise cljfmt is the only one I know

Audrius10:11:27

do you think it is Emacs by it self, or the job is done by Paredit ar Cider?

andrea.crotti10:11:47

I think mostly Emacs + Clojure mode, cider might add a bit of extra smartness around macros

andrea.crotti10:11:08

but paredit doesn't really affect formatting imho, it simply helps you working with sexpressions

šŸ‘ 4
john14:11:16

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?

emccue17:11:07

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

john17:11:38

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

john18:11:51

Maybe defpatch, in the spirit of "dispatch," but sorta like you're "patching" the definition šŸ™‚

Hermes17:11:56

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!!

jonoflayham18:11:50

@davidpty looks related to https://github.com/amalloy/ordered/pull/37. Does it happen with say Java 8?

sova-soars-the-sora19:11:34

I would love love love to see a page that shows me how to dissect an atom like a surgeon with code examples

sova-soars-the-sora19:11:04

I have to constantly re-reference basic material with regards to atoms and data storage. it's a shocker

sova-soars-the-sora19:11:52

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"...

noisesmith19:11:15

An atom only holds a single value - usually that value is a hash-map, but that's not always the case.

hiredman19:11:33

an atom is a pointer to a value that can be be atomically compared and swapped for another value

hiredman19:11:40

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

noisesmith19:11:19

you can also set or remove a validator or a watch function

hiredman19:11:40

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

hiredman19:11:52

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

cfleming23:11:51

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.

cfleming23:11:54

Before I start bashing out the code-walking code, which is often a bit of a mess of edge cases, I thought Iā€™d check if such a thing existed.

cfleming23:11:02

Does anyone know of anything like this?

cfleming23:11:54

Actually, it looks like zippers would be the best way to do this.

šŸ¤ 4