Fork me on GitHub
#clojure
<
2019-07-24
>
Sal Kadam02:07:08

need help on core.async Caused by: java.lang.ClassNotFoundException: clojure.core.async.Mutex using lein repl with :dependencies [[org.clojure/clojure "1.9.0"] [org.clojure/core.async "0.4.500"] [me.raynes/conch "0.8.0"] [com.draines/postal "2.0.3"] [propertea "1.3.1"] [instaparse "1.4.10"] [com.taoensso/timbre "4.10.0"]]

Alex Miller (Clojure team)02:07:26

That class doesn’t exist anymore

Alex Miller (Clojure team)02:07:56

You must have an old version aot compiled in somewhere or a dep mismatch

Alex Miller (Clojure team)02:07:52

Would probably be helpful to do a lein clean, or lein deps :tree or a stack trace etc

Sal Kadam03:07:38

@alexmiller thanks, lein clean worked, i will keep clojure 1.7 for tonight , tried upgrading to 1.9 has many error with in my code ( clojure.core/ns did not conform to spec )

seancorfield03:07:49

@skadam A lot of those errors can be "fixed" by updating to more recent dependencies I suspect (unless they're genuinely coming from your code and not libraries?).

seancorfield03:07:39

This page lists known errors in popular libraries that were detected by Spec and subsequently fixed by correcting the syntax https://archive.clojure.org/design-wiki/display/design/Errors%2Bfound%2Bwith%2Bcore%2Bspecs.html

Sal Kadam03:07:01

will look at it @seancorfield thanks for pointing

carkh05:07:10

hum how can i make the deps.edn load my user.clj in src/dev/user.clj ?

salam05:07:04

@carkh if i understood your question correctly, you would like src/dev/user.clj to be loaded when you run a repl from within the src directory (where deps.edn is located). if that's the case, then you may use :extra-paths as documented here: https://clojure.org/reference/deps_and_cli#_make_classpath

carkh05:07:49

let me try that

carkh05:07:10

oh but that's in an alias right ?

salam05:07:20

something like this:

{:deps {aleph {:mvn/version "0.4.6"}
        integrant {:mvn/version "0.7.0"}}

 :paths ["src" "resources"]

 :aliases {:dev {:extra-deps {integrant/repl {:mvn/version "0.3.1"}}
                 :extra-paths ["dev"]}

           :uberjar {:extra-deps {seancorfield/depstar {:mvn/version "0.2.2"}}}}}

carkh05:07:58

yes the trouble is that i'm launching from cider, and i don't thinkit launches my :dev alias

carkh06:07:34

yes no dev in that command line ><

carkh06:07:05

and i don't want to put it in the main paths because it's for dev ... looks like cannot be solved

salam06:07:14

oh, i'm not so familiar with cider. i'm a cursive user and there's a way to specify an alias to run with use clj.

carkh06:07:50

i'll go and bother the cider people with this ! thanks for your help

salam06:07:14

sounds good. you're welcome! 🙂

carkh06:07:54

ahaaa for future reference : (setq cider-clojure-cli-global-options "-A:server:client:dev")

salam06:07:07

there you go. 🙂

carkh06:07:16

thanks again =)

carkh06:07:50

and that works, i tried with .dir-locals.el to make it project dependant but no dice

henrik11:07:43

I wanted to implement a couple of functions that retrieves the next or previous value in a collection given a predicate, and cycles to the end or beginning of the collection if the predicate matches a value at the beginning or end of the collection respectively. I.e.,

(next-item (partial = 3) [1 2 3 4 5])     ;; => 4
(next-item (partial = 5) [1 2 3 4 5])     ;; => 1
(next-item (partial = 1) [1])             ;; => nil
(next-item (partial = 1) [])              ;; => nil
(next-item true? [1 2 3 4 5])             ;; => nil

(previous-item (partial = 3) [1 2 3 4 5]) ;; => 2
(previous-item (partial = 1) [1 2 3 4 5]) ;; => 5
(previous-item (partial = 1) [1])         ;; => nil
(previous-item (partial = 1) [])          ;; => nil
(previous-item true? [1 2 3 4 5])         ;; => nil

henrik11:07:15

This is what I came up with. Is this a decent implementation, or could it be improved?

helios12:07:27

I have one tip. Instead of doing (if pred something nil), use when which automatically returns nil when the predicate is falsey

👍 4
avivak17:07:36

you can write it in a shorter form:

(defn next-item [pred coll] 
  (->> (concat (rest coll) (take 2 coll))
       (drop-while  (complement pred)) fnext))

(defn previous-item [pred coll]
  (next-item pred (reverse coll)))

👍 4
roklenarcic13:07:43

I am making a library, that has an optional part namely, you can pass edn or yaml as configuration. I want to make dependency on yaml parsing library optional, so the library user can include it or not. The problem is how to make yaml parse namespace require conditional. Any ideas?

ghadi13:07:20

You could conditionally load it if the user submits yaml. See the function requiring-resolve

ghadi13:07:59

(yaml is truncatable without detection, beware)

roklenarcic13:07:46

what do you mean by truncatable without detection?

ghadi13:07:18

if you remove lines from the end of a yaml file, it's still valid yaml @roklenarcic

ghadi13:07:30

not so with JSON

stathissideris15:07:10

hello, maybe I dreamt it, but I remember a project that involved “compiling” clojure functions and their dependencies and uploading them to AWS lambda for execution. I really can’t remember its name, does anyone know what I’m talking about?

stathissideris15:07:32

it would walk the code to figure out which parts are necessary

mpenet15:07:56

@nathanmarz was talking about something similar a few days ago too.

mpenet15:07:11

portkey looks quite nice btw

hjrnunes20:07:12

Hi. Anyone has an idea on how to get the equivalent of (map vector coll1 coll2) as a transducer? e.g.

(into [] (map vector [:a :b]) [1 2])
=> [[:a 1] [:b 2]]

Alex Miller (Clojure team)20:07:41

you can't in into, only sequence has multi-coll transducer support (which returns a lazily realized sequence, so probably not too useful)

hjrnunes21:07:04

@alexmiller thanks, I'll look into it