Fork me on GitHub
#clojure
<
2016-03-11
>
jonahbenton03:03:24

@ag no, there is no merging, the second require should overwrite the first

jonahbenton03:03:59

hey @rcanepa: when you make an uberjar, you are making something that does not use lein. So you'll need some other mechanism for configuration. One option is a command line parameter interface (https://github.com/clojure/tools.cli); another is environment variables or system properties (https://github.com/weavejester/environ), or perhaps either of those to specify the location of an edn configuration file (https://clojure.github.io/clojure/clojure.edn-api.html).

danielcompton06:03:57

@firstclassfunc: Mark Derricutt is a good person to talk to about that

cky06:03:47

.oO(That’s a very small world. I was about to comment earlier today how #C0FCN8L1Y needs @talios. I should ping him to join.)

cky06:03:57

@danielcompton: Huh, you’re in Auckland too, eh? Nice. (I used to live in Auckland, and I know Mark IRL.)

jasonbell09:03:21

Is @talios not on here? I’ll have to bend his ear about that.

nha09:03:15

When trying that in the REPL :

(require 'clojure.inspector)

(clojure.inspector/inspect-tree '(1 (a b) 2 (c d) 3 (e f )))
I get a javax.swing.JFrame object back but no popup Did it change ? I remember doing something like that and getting a popup : http://justinsboringpage.blogspot.fr/2011/01/view-data-from-clojure-repl.html

nha09:03:44

Ah nevermind they were hidden

jonathanj10:03:45

@lmergen: Another possibility from earlier:

user=> (map (partial zipmap [:key :value]) {:name "Joe Awesome" :email ""})
({:key :name, :value "Joe Awesome"} {:key :email, :value "”})

lmergen11:03:36

ah that looks like a very clever solution

lmergen11:03:43

but it's just a little bit less intuitive what it does, i htink

lmergen11:03:59

otoh, zipmap is probably the best operation for this

octahedrion11:03:55

what's a way I can make certain data structures print differently ? I'm sharing results with our team and it would be nice if things like vectors of keywords were printed as simple strings like xyz not [:x :y :x]

octahedrion11:03:27

(sorry [:x :y :z]!)

octahedrion11:03:06

I can't do by type, it needs to be by structure...maybe prismatic schema has something ?

mmeix11:03:22

maybe: apply str (map name [:x :y :z]))

mmeix11:03:52

returns "xyz" in this case

mmeix11:03:02

(parens missing, so:)

mmeix11:03:08

(apply str (map name [:x :y :z]))

octahedrion11:03:42

@mmeix: ok, thanks but I was hoping for a more general solution

mmeix11:03:52

maybe with vector?and keyword?and so on?

octahedrion11:03:37

i think Schema coercions/bijections & Fipp are the way to go

danielstockton11:03:26

Can anyone tell me why lein test tries to run tests in the user namespace?

danielstockton11:03:53

And lein test my.test-namespace fails with class not found, even though it is in the test/ dir

danielstockton12:03:36

I have a user.clj inside a /dev folder, with the following leiningen config: :profiles {:dev {:source-paths ["dev"] :dependencies [[org.clojure/tools.namespace "0.2.11"]]}})

joost-diepenmaat13:03:46

good afternoon people. Quick question: is it legal to (require ‘[some.long.namespace :as long.namespace]) ?

rcanepa13:03:17

@jonahbenton: Thanks!… I will check those options.

joost-diepenmaat13:03:23

IOW using dots in namespace aliases: yep! or oh no!?

joost-diepenmaat13:03:34

that will make some code here a little bit nicer

joost-diepenmaat13:03:46

thanks @nberger for that link.

danielstockton14:03:57

Can anyone point me to an open source project using the reloaded workflow with a route to deploy to production and run tests through leiningen? Having trouble working out how to make everything work.

nberger14:03:24

@danielstockton: clojars uses the reloaded workflow, is deployed to production and has tests that run with lein test, so you could take a look there: https://github.com/clojars/clojars-web

danielstockton14:03:11

Perfect example, thanks

danielstockton15:03:56

Does lein need tests to be organized like test/proj/test and proj.test.namespace (two test directories)?

danielstockton15:03:09

I generated this structure with lein new, but that's the only difference I can see.

danielstockton15:03:51

lein test should use the :test profile right, so shouldn't pick up my :dev profile config like :init-ns user

hugesandwich15:03:26

Is it possible for codox to generate output from a deftype? Specifically, I have functions implementing a protocol inside the deftype and while it is valid clojure to add a doc string to each function, codox doesn't seem to pick it up. I don't think it makes sense to document only the protocol itself because the implementation details are where you actually want specific docs.

hugesandwich15:03:39

to be clear, I don't mean on the type definition, just the protocol implementation

schaueho16:03:54

@danielstockton: Glancing through https://github.com/technomancy/leiningen/blob/master/doc/PROFILES.md, I think that lein test merges in the test profile -- presumably into the dev profile. You should be able to disable the dev profile explicitly by lein with-profile -dev test.

danielstockton16:03:14

Unfortunately it still tries to run the user namespace 😞

jimmy16:03:59

hi guys, does anyone use clojure with protocol buffer ? is this the right lib to use https://github.com/flatland/clojure-protobuf . I find it's a bit oudated

danielstockton16:03:17

Is lein caching something somewhere, should I try clearing some files? I had init-ns set up globally to user before but it's now under the :dev profile.

schaueho16:03:23

You're sure you had this setting only in your project.clj and not in ~/.lein/profiles.clj?

Nicolas Boskovic20:03:15

xposting from #C077KDE3A: I'm having a db issue with a recent version of Luminus (I think), where trying to operate on a database is giving me this: 'IllegalArgumentException db-spec mount.core.DerefableState@6dc3d84b is missing a required parameter clojure.java.jdbc/get-connection (jdbc.clj:292)'

hiredman20:03:42

you are passing a derefable state to something that needs a connection or a connection spec

hiredman20:03:56

likely you forgot to deref the derefable state

hiredman20:03:14

the line number and fill will be somewhere in the stacktrace

Lambda/Sierra21:03:42

@danielstockton: Clojure itself, not Leiningen, loads the user.clj file on startup.

Lambda/Sierra21:03:59

This cannot be disabled.

josh.freckleton21:03:38

what is the easiest way to rename an entire project? (files/dirs/namespaces/etc.) Possible?

hiredman21:03:20

I feel like I should also point out, that there are many orthogonal names used for clojure projects, so for example you can change the the maven coordinates (group-id, artifact-id) without touching namespaces at all

josh.freckleton21:03:58

@hiredman: checking it out now... thanks...

dm321:03:21

that's interesting... I usually use sed

hiredman21:03:03

clojure allows more than is generally used in practice, what is generally used in practice has a regular structure that tools can exploit for this sort of thing, but having something that handles all valid clojure files is more complicated

josh.freckleton21:03:52

@dm3 all good suggestions, sed might be easier for now, I'll give it a go simple_smile

firstclassfunc22:03:18

Ok guys gonna ask this here, Has anyone used Leiningan templates and tried to copy binary files like images?

firstclassfunc22:03:19

Never mind.. Figured out you create a raw resource such as ' (def raw (raw-resourcer "brocade”))'

hugesandwich23:03:45

What seems like a better design, a huge namespace with a single deftype that wraps a Java object, and implements many protocols, vs. a few separate namespaces that are all passing in the same Java object? Alternatively, I suppose I could also use extend or extend-type depending on what I do. I've already split things up into some nice protocols and switching between the two is pretty much seamless. I don't think people will call this from Java that much, but it's a possibility (but i don't want to bother with gen-class).

hugesandwich23:03:13

I should mention that the code is fairly performance sensitive