Fork me on GitHub
#clojure
<
2018-06-09
>
rplevy00:06:59

Have there been any developments on the problem of dealing with interactions of libraries and their transitive dependencies? This is always a pain point when upgrading a project with many dependencies to new versions. Maybe the solution is microservices and minimizing the use of libraries altogether in those services, but perhaps there are better ideas out there I'm not aware of.

ackerleytng00:06:01

in spec, is there a way to create a binding?

ackerleytng00:06:27

if i were to write a spec for map

ackerleytng00:06:45

map could take any collection, but i want to create a binding for the type in the collection

ackerleytng00:06:18

and then say that the function mapped over the collection must take an argument that matches the spec in the binding

seancorfield00:06:45

@ackerleytng I'm not quite clear what you're asking about -- can you give a code example?

ackerleytng00:06:32

suppose we want to write a spec for clojure's builtin map function

ackerleytng00:06:16

map should take a collection with elements that all match a spec, say :foo

ackerleytng00:06:12

such that the spec for map would be something like (s/fdef map :args (s/cat :f (s/fspec :args :foo) :coll (s/coll-of :foo)))

ackerleytng00:06:16

something like that?

ackerleytng00:06:29

is there a way to bind foo temporarily

seancorfield01:06:21

Well, the issue there is that map is generic and there really isn't a direct 1:1 mapping between the collection "types" and the function input argument "type" -- you could write a spec for a specific wrapper around map that was designed to work with a specific type.

seancorfield01:06:02

clojure.core/map is pretty much impossible to write an accurate spec for I think.

seancorfield01:06:31

You could define your own int-map function that only accepted (s/coll-of int) and therefore required a function whose argument was restricted to int (well, actually any type that int can be coerced to -- and that's part of the problem). Do you see what I mean @ackerleytng?

ackerleytng01:06:48

Ah ok then the spec would be a bit too tight

seancorfield01:06:02

(map (fn [^double d] (* 2.0 d)) [1 2 3 4]) for example

ackerleytng01:06:38

Anyway on the function that I'm speccing, I tried what you suggested with int, and clojure said it couldn't find something that satisfies in 100 tries

ackerleytng01:06:52

Don't have the exact message now...

seancorfield01:06:09

Sounds like you need to provide a custom generator then.

seancorfield01:06:22

(there's a #clojure-spec channel if you want to dig deep into spec)

bio11:06:39

>Searchable message archives are at https://clojurians-log.clojureverse.org/ @ul It seems bot hasn’t been working since 2018-04-17

matan16:06:56

Looking for help on what do I need to do or precondition, in order to connect a repl to a running clojure 1.8/1.9 program. Sorry but I do not find https://clojure.org/guides/repl/enhancing_your_repl_workflow#writing-repl-friendly-programs of extreme help... your guidance or reference to a good source, would be much appreciated!

dpsutton17:06:04

@matan what editor are you using?

matan17:06:40

@dpsutton Atom + proto-repl

matan17:06:01

Or should I say now Microsoft Atom :-)))))

johnj17:06:34

Can an expression that's passed to -e be saved somewhere in the deps.edn file for later activation ?

benzap18:06:50

@lockdown- is this something to do with the clj tool?

macrobartfast19:06:06

I just put a question into the beginner channel regarding a websocket implementation, if anyone has time to look at it.

genekim21:06:09

@noisesmith @hiredman @seancorfield @lloydshark Thanks for all the help, all! Y’all are fantastic! So, there was a network exception of “could not connect”. But this didn’t explain the future block not running. I ended rewriting the TCP call with just Java interop, getting rid of clj-tcp library. All is working now, and much faster now, too. Good enough for me! Thx again!