#clojure log - Jan 24 2016

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:26 tsantos: I recently had to upgrade all sorts of things in my project.clj (like clojure version, clojurescript version, etc.). I even upgraded to lein 2.5.3 and bower 0.5.1. Now lein-bower fails with an error I can’t even track down:

0:26 clojure.lang.Compiler$CompilerException: java.lang.IllegalAccessError: with-json-file does not exist, compiling:(leiningen/bower.clj:1:1)

0:27 justin_smith: tsantos: did you run "lein clean" after all your updates?

0:27 tsantos: Searching the net is getting me nowhere, of course which makes me suspect some sort of local problem but both my osx and linux dev boxes fail.

0:27 yep

0:28 justin_smith: tsantos: could be an incompatibility in versions. an error reported on line 1 is almost always an error in a namespace required by the ns in question

0:28 (a compile time error, of course)

0:28 tolstoy: maybe "lein deps :tree"

0:28 tsantos: Yeah, I thought about such incompatibilities but I really can’t figure out the debug process to get them re-aligned

0:29 justin_smith: so leiningen.bower is requiring an ns that is now broken, in that it calls with-json-file that is no longer present

0:30 with-json-file is part of clojure.data.json

0:32 tsantos: is clojure 1.8.0 trouble?

0:32 justin_smith: wait, maybe it isn't in clojure.data.json

0:32 tsantos: not in my experience, it was a very smooth upgrade

0:32 tsantos: maybe it would help to back up and upgrade one thing at a time?

0:33 tsantos: I wish I could… I ended up needing something that had me doing a giant update (which of course never goes smoothly)

0:33 justin_smith: tsantos: weird, I'm not finding google results for any project or namespace that defines "with-json-file" right now (there was a false positive for clojure.data.json, but I can't find it anywhere - maybe it only exists in old versions?)

0:35 tsantos: maybe… could it be that I need an older version of leiningen since it’s in leiningen/bower.clj

0:36 justin_smith: tsantos: source reading ftw http://i.imgur.com/7Q72p9Y.jpg

0:36 err

0:36 lol mispaste

0:36 tsantos: hehe

0:36 justin_smith: tsantos: I mean, source reading ftw https://github.com/chlorinejs/lein-bower/blob/master/src/leiningen/bower.clj#L5

0:36 it thinks that leiningen.npm has something called with-json-file

0:37 so you need to override your leiningen.npm version to get a version that has that, or fix lein-bower to no longer use this function which has been remopved from leiningen.npm

0:38 tsantos: I saw that same line but missed the .npm part of the namespace.

0:41 Awesome, I backed out a lein-npm version update and it’s working! Thank you much for walking me through that.

0:42 justin_smith: np, glad it was that simple

0:52 makyn: Hello I am having trouble with lein new [template_that_isn't_locally_available]

0:52 when I run for example lein new chestnut <project>

0:53 Failed to resolve

0:53 does anybody know what could be happening?

0:53 justin_smith: makyn: works locally, can you share the exact error?

0:54 makyn: yes

0:55 Failed to resolve version for chestnut:lein-template:jar:RELEASE: Could not find metadata chestnut:lein-template/maven-metadata.xml in local (/home/user/.m2/repository)

0:55 This could be due to a typo in :dependencies or network issues.

0:55 If you are behind a proxy, try setting the 'http_proxy' environment variable.

0:56 justin_smith: makyn: weird, it should be looking in more places than just local - can you share a paste of your ~/.lein/profiles.clj ?

0:56 makyn: yes

0:56 don't have one

0:56 justin_smith: lein version?

0:57 makyn: I just installed

0:57 it must be the latest one

0:57 justin_smith: does a regular "lein new project-name" work?

0:57 makyn: Leiningen 2.5.3 on Java 1.8.0_66-internal OpenJDK 64-Bit Server VM

0:57 justin_smith: makyn: well, that can depend on how you installed it

0:58 makyn: yes a regular new works

0:58 does lein work with openjdk 8?

0:58 justin_smith: weird, I tried "lein new chestnut deleteme" just now, and it worked

0:58 yes, definitely

0:58 I'm on 1.8.0_05

0:59 makyn: I'm definitely not behind any proxy

0:59 justin_smith: yeah, I mean it should have mentioned actual repos it looked in, but it just listed your local cache, as if it wasn't checking any of the actual repos

1:00 makyn: do you have the same version as me? maybe I should try with an older version

1:00 justin_smith: 2.5.3

1:01 tolstoy: rm -rf ~/.m2?

1:01 makyn: I did already 2 times

1:01 justin_smith: tolstoy: in my experience that never actually helps

1:01 tolstoy: Oh. Missed that. ;)

1:02 makyn: tolstoy: no, I just did it earlier today, it:s not in the chat

1:02 the only think I can think of is that somehow zsh or prezto has messed up with the installation or with lein

1:03 I'm going to try in vanilla bash session

1:03 justin_smith: yeah, considering you don't even have a profiles.clj I don't see what the issue would be here

1:03 unless clojars.org has you on a blacklist or something I don't know

1:04 makyn: clojars.org is not down, is it?

1:04 the repo I mean

1:04 justin_smith: no

1:05 makyn: I would not have been able to create a chestnut project if clojars was down, they host their template on clojars

1:05 tolstoy: lein new chestnut works fine for me. I know that's soooo helpful. ;)

1:05 makyn: justin_smith: unless you already had it cached in your .m2

1:05 no?

1:05 clojurebot: no is tufflax: there was a question somewhere in there, the answer

1:05 justin_smith: makyn: no, it downloaded

1:05 makyn: right

1:05 justin_smith: "Retrieving chestnut/lein-template/0.8.1/lein-template-0.8.1.jar from clojars"

1:06 makyn: can you ping clojars.org? see their site?

1:07 makyn: ping works but has 2000ms latency

1:07 not normal right?

1:08 justin_smith: weird

1:08 makyn: by the way I just did a clean install in bash and had the same problem

1:09 justin_smith: iirc even leiningen bootstraps its own standalone jar from clojars

1:09 tolstoy: clojars.org is 90ms for me.

1:10 makyn: I have ping of 50ms to google.com

1:10 so it is not my network

1:10 anyway, I'll try later and see

1:10 thank you guys for your help

1:11 justin_smith: makyn: another option, try to replicate your setup on a vps

1:11 if you think it's worth a buck or two spinning up a box for an experiment at least

1:11 makyn: Thank you, yes maybe it's worth

1:11 highclasshole: I don't seem to be having an issue with clojars

1:11 makyn: I'll wait a while first just in case

1:12 by the way, I'm in Japan

1:12 highclasshole: oh no idea then

1:12 justin_smith: makyn: I know that clojars was ddos'd recently, and maybe some rule that got set up to limit the ddos traffic is affecting you?

1:12 makyn: could be

1:13 I had a 4k ms respone time now

1:13 to ping

1:13 tolstoy: Hm. You have 'chestnut:lein-template/maven-metadata.xml' and I have 'lein-template/maven-metadata-clojars.xml'.

1:14 I wonder if you should delete ~/.m2/respository/chestnut. Then again, if removing the whole cache didn't fix it (recognizing justin_smith's caveat).

1:15 makyn: tolstoy: yes I deleted .m2 and .lein before doing a clean install

1:15 justin_smith: also, you can just do mv ~/.m2 ~/m2-backup and save a lot of silly downloading

1:15 (and move it back after your experiment if it didn't fix anything)

1:15 makyn: yes, it was empty anyway as it is a clean install

1:18 pilne: ,(= true 1)

1:18 clojurebot: false

1:19 pilne: ,(if 1 "truthy" "falsey")

1:19 clojurebot: "truthy"

1:19 pilne: O.o

1:19 what the fuck

1:19 justin_smith: pilne: only nil and false are falsey

1:19 pilne: but....

1:19 ,(= true 1)

1:19 clojurebot: false

1:19 justin_smith: pilne: thus all other things are truthy

1:20 truthy doesn't mean equal to true, it means treated as non-false by if

1:20 pilne: O.o

1:20 ,(= false 1)

1:20 clojurebot: false

1:20 pilne: is it saying it can't/won't compare or coerece so it is false?

1:20 justin_smith: pilne: what's your obsession with the number 1 here?

1:21 pilne: what?

1:21 1 isn't true!

1:21 they are two different values

1:21 ,(if Double/NaN :yes :no)

1:21 clojurebot: :yes

1:22 justin_smith: even NaN is truthy

1:22 and it's not equal to anything

1:22 ,(= Double/NaN Double/NaN)

1:22 clojurebot: false

1:22 pilne: ok

1:22 i think i get it

1:30 ty

1:33 tolstoy: Is there a way to create a new instance of a record (via defrecord) without using the literal symbol?

1:34 (new (lookup-type ...) "param")?

1:34 justin_smith: (into (empty instance) map)

1:34 if you have an instance

1:36 tolstoy: It works in ClojureScript, interestingly.

1:38 justin_smith: correction, you can use into, but not empty

1:38 I misremembered

1:40 tolstoy: Yes, the into worked. Seems hacky, though. In other words, not super appropriate for this.

1:41 Right now, my client sends messages as [:topic data], so I just have a case statement based on the topic. Works.

1:41 But if I want those messages to be typed, I'd have to share definitions between client and server.

1:42 Eh.

2:21 justin_smith: tolstoy: so maybe the answer has to do with what the message is supposed to mean

2:21 is it a data object used by the other side? is it used to pick an implementation / behavior?

2:22 it might be simpler to just have a router logic, where one key decides which handler gets the message and the handler uses the rest of the data

2:33 tolstoy: justin_smith: That's what I actually do. [topic data] and I route based on the topic.

2:33 justin_smith: aha, like sente

2:33 (or how I use it at least)

2:33 tolstoy: Yeah.

2:33 justin_smith: but where would you need to use a specific record type in this?

2:34 tolstoy: It might work well if you're sending messages around a single app (not across the wire).

2:34 Each "message type" would implement various protocols.

2:35 justin_smith: hmm, to me message implies generic data, something that wouldn't carry behaviors

2:35 tolstoy: Then the thing that receives the message could just (when (satisfies? protocol msg) (invoke! msg state p1 p2))

2:35 That kind of thing.

2:35 Yeah, there was a debate about it awhile ago on the mailing list.

2:37 In a CLJS app, for instance, you can have protocols that return a new state, or that do something with history ... I don't know.

2:37 justin_smith: to me message dispatch and multimethods and protocols and case statements are all variations of the same effective act (picking an action or data transform among alternatives given the data that came in), and you shouldn't need a protocol on objects in messages any more than you need a case statement based on your args in a multimethod...

2:37 but maybe there's something I'm missing

2:39 tolstoy: I don't know if you're missing anything. Sometimes I try things just to see if some bit of intuition will teach me something.

2:39 You could imagine a react-app like thing where clicking on something generates an event message.

2:39 Some times the event message signals a state update.

2:40 Maybe another time it signals a send down the socket.

2:40 justin_smith: sure, I absolutely do these things

2:40 tolstoy: You could, say, have a "state-update" namespace where you "extend-protocol" all the message types that update state.

2:40 Keeping that logic together, but not mixed in with all the socket stuff.

2:41 justin_smith: right but then you need a rich set of types in order to keep the two ends in sync, and really only one end cares about the type and so you've gained nothing over a simple keyword based router

2:41 tolstoy: You can then "query" the messages to find out how to dispatch them. (Not that you couldn't by convention and multimethods.)

2:42 No, no, doing it over the network is diminising returns in about 2 seconds. ;)

2:42 justin_smith: OK

2:43 tolstoy: Static-typing the data center: that's for those people who think ProtoBuf is a good idea.

2:48 Seems like it might be an interesting way to create domain-specific events in a ClojureScript application.

5:12 favetelinguis: anyone knows if it is possible to go back and change the content of commited files in git? realised i have commited sensetive configs :s

5:14 amalloy: try #git

5:51 oracle123: I am going to download web via a sock5 proxy. What's the best solution library to use? I checked the jsoup for clojure, but can't find the doc about how to set the proxy.

5:52 ridcully: oracle123: http://docs.oracle.com/javase/7/docs/technotes/guides/net/proxies.html

5:53 most likely some sysprop to set

5:55 oracle123: But I don't want to set it systematically, only some code needs such proxy.

6:31 anybody used clj-http? I use the "get" function to return the page, it took 7 second, while use curl it only took 4 seconds. why is clj-http much slower then curl?

7:36 lxsameer: hi, I'm using zookeeper with clojure, is it logical to use a var to store the current leader ?

8:30 engblom: I have a problem with deref for atoms: It is too slow. Is there a faster way to read an atom?

8:31 I am storing all output streams in an atom. When adding and removing, swap! is good as I can be sure no stream got lost. But when using those streams, I would need a faster way than just deref.

8:42 adicto: I would like to define an other arity function for the core "keys" function. I would like to define: (defn [& maps] (mapcat keys maps)). What is best practice for"monkey patching" a core function

8:43 (defn keys...*

9:02 gfredericks: adicto: you want a function that takes multiple maps and returns all their keys?

9:02 (and what makes you think monkey-patching is the best way to solve the problem?)

9:06 favetelinguis: when i use a websocket library sente how does the client know the adress of the server? I newer specify it in cljs?

9:09 Howling: favetelinguis: Maybe it runs it on localhost by default

9:25 engblom: Please, any have a look at this: http://pastebin.com/DV6PTEGa . In this case bench1 is 6500 times faster than bench2. I would want to know where the bottleneck is?

9:28 I would expect bench2 to be a bit slower as it does a bit more (looking up from a vector, having an 'if' etc) but not 6500 times slower.

9:56 adicto: gfredericks: yes that is what I want. A keys function that takes multiple maps as argument

9:56 gfredericks: I could write a seperate function for that or I could monkey patch the existing one.

11:02 gfredericks: adicto: monkey-patching is considered a pretty extreme tactic, so generally writing your own function is better when possible

11:32 kwladyka: What is the best method to check if org.postgresql.util.PSQLException exist to avoid CompilerException java.lang.RuntimeException: Unable to resolve symbol: a in this context ?

11:33 (resolve 'org.postgresql.util.PSQLException) throw exception too

11:34 maybe something with find-ns?

11:37 i can try call org.postgresql.util.PSQLException and check if it throws exception heh.... but it is not the way how i would to that

11:43 ha i found a solution!

11:43 (clojure.reflect/resolve-class (.getContextClassLoader (Thread/currentThread)) 'org.postgresql.util.PSQLException)

12:34 justin_smith: ,(Class/forName "String")

12:34 clojurebot: #error {\n :cause "String"\n :via\n [{:type java.lang.ClassNotFoundException\n :message "String"\n :at [java.net.URLClassLoader$1 run "URLClassLoader.java" 366]}]\n :trace\n [[java.net.URLClassLoader$1 run "URLClassLoader.java" 366]\n [java.net.URLClassLoader$1 run "URLClassLoader.java" 355]\n [java.security.AccessController doPrivileged "AccessController.java" -2]\n [java.net.URLClassLoade...

13:32 TimMc: There is no best practice for monkey patching, since monkey patching is a bad practice...

13:32 (Which is not to say one should never, ever do it, just that it's a solution of *last* resort.)

13:33 justin_smith: also I would totally do (distinct (mapcat keys maps)) instead

13:33 and not call it keys

13:43 ,(into #{} (mapcat keys) [{:a 0 :b 1} {:b 2 :c 3}]) ; final answer

13:44 clojurebot: #{:c :b :a}

14:17 pilne: i found my happiness!

14:17 ,(= (boolean 1) true)

14:17 clojurebot: true

14:17 pilne: bazanga!

14:20 justin_smith: haha

14:20 ,(= (boolean 0) true)

14:20 clojurebot: true

14:20 justin_smith: ,(= (boolean Double/NaN) true)

14:20 clojurebot: true

14:21 justin_smith: ,(= (boolean ()) true)

14:21 clojurebot: true

14:21 justin_smith: ,(= (boolean nil) true)

14:21 clojurebot: false

14:27 highclasshole: ,(= (boolean nil) false)

14:27 clojurebot: true

14:38 J_Arcane: Magic.

14:43 csd_: Can anyone recommend a free platform for deploying small Clojure webapps?

14:44 highclasshole: free teir AWS I guess not totally free

14:45 csd_: i had a bad experience with AWS :-/ not even sure they would let me be a customer

14:45 highclasshole: digitalocean 5/mo is lowest price

14:45 thats pretty cheap

14:45 server space usually ain't free ya kno

14:46 csd_: yeah i know but im not going to make any money on this so *shrug*

14:46 justin_smith: heroku has a free tier

14:46 highclasshole: ah cool then do that

14:46 csd_: justin_smith: but your app cant be up for more than i think 18 hours per day?

14:46 justin_smith: ,(= (boolean nil) true)

14:46 clojurebot: false

14:47 justin_smith: csd_: not sure (the above was a mistake)

14:48 csd_: the thing with heroku is that they kill the app when it's idle, and it takes forever to spin back up

14:48 highclasshole: yeah 18 hours a day

14:48 csd_: you used to be able to just periodically ping your site to get around it, but then they overtly limited how long it could be up period

14:48 used to be 24 hrs

14:48 highclasshole: 7$ a month for unlimited

14:49 so digitalocean 5 dollars heroku 7 dollars

14:49 csd_: do you have any experience with google app engine

14:49 highclasshole: i don't think you will do a lot better unless you have a friend with server space

14:49 csd_: it says it's free but it's sketchy when i go to their signup page

14:49 highclasshole: I've not used it personally

14:52 csd_: from what I can tell its free only if you use under the allowed bandwidth and instance hours

14:53 looks like u might be able to leave it up all day tho maybe

14:53 https://cloud.google.com/appengine/docs/quotas?hl=en

14:54 csd_: at one point i signed up with AWS on a free trial. i played around with it for a day and forgot about it. next think i know im being billed for hundreds of dollars

14:54 highclasshole: you gotta use the free teir not a free trial

14:55 csd_: i forget which i used

14:55 thankfully they didnt refer it to collections AFAIK

14:55 highclasshole: ec2 free tier is only for 750hours per month

14:56 so you have to spin down spin up

14:56 csd_: i wonder whether 512 Mb ram on digital ocean's free plan is enough

14:57 highclasshole: er nevermind you can keep 1 instance up for 1 whole month aws free tier, but its only for 12 months I see

14:57 justin_smith: csd_: if you're careful I think you could make it fit

14:57 elvis4526: What would be the typical use for metadatas ?

14:58 csd_: because i would need a database instance too

14:58 highclasshole: well it sounds like you want a lot for free heh

14:59 csd_: i guess

14:59 heroku used to do it

14:59 (look how that ended up though)

15:00 LucidTortoise: Clojure For the Brave and True has literally the best introduction, and convincing motivation. To learn Emacs.

15:00 Two days ago I never even touched it. Now I use emacs for everything.

15:02 wink: LucidTortoise: irc as well? :P

15:03 LucidTortoise: Nope, I have done IRC for longer. For #Godot and #Pharo

15:03 highclasshole: He means are you using IRC in emacs

15:03 LucidTortoise: I keep trying to gain competence in Smalltalk, but the pull of functional languages is strong.

15:03 highclasshole: emacs has an IRC plugin

15:04 LucidTortoise: Oh, hah. Not yet. I don't know how to do that yet. I am on Textual for OS X

15:04 highclasshole: its in the package manager forget the name

15:04 LucidTortoise: Let me see if I can get that running.

15:05 wink: didn't want to give you funny ideas. but you said "everything" ;)

15:05 LucidTortoise: Haha. Emacs is simply my favorite place to type.

15:05 highclasshole: haha yea I'm good on IRC in emacs

15:06 I can't get into emacs maybe I need to try evil or something

15:06 LucidTortoise: When you all say Clojure Web apps, that is basically just a website written in Clojure, as opposed to an amalgamation of tech like HTML, CSS, etc?

15:07 highclasshole: could be either

15:07 LucidTortoise: I want to create a website, and at first I was considering Seaside using Pharo, but now I am curious what I can use to build a website with Clojure.

15:07 justin_smith: LucidTortoise: I use clojurescript on the frontend too, in my webapp

15:08 LucidTortoise: I have already more knowledge with Clojure in a two days than I do with Smalltalk after... ten days? I am really new to both/

15:09 justin_smith There is no syntactical difference between Clojure and Clojurescript right?

15:09 justin_smith: very minor ones - the difference is host interop, different hosts

15:10 and some of the interop has slightly different syntax allowed

15:10 LucidTortoise: I was a bit confused when I say Light Table uses ClojureScript, but now I understand better why.

15:11 highclasshole: LucidTortoise: you could look into Luminus it is a curated set up libraries and a set of templates to get you writing webapp pretty quick in clojure

15:11 LucidTortoise: I see. Then it seems I don't have to peek out of Clojure to write a webapp, or do you still need to use HTML/CSS? Oh, or do you just use some flavor of markdown and avoid it all?

15:11 highclasshole: you can do whatever you want

15:12 LucidTortoise: Found it. Looks simple enough. Thanks highclasshole.

15:17 J_Arcane: LucidTortoise: I do my web apps entirely in CLJ/CLJS. Compojure/-api on the backend, reagent on the front end, which takes hiccup syntax, so no need for raw HTML. On my last project even the CSS was mostly Bootstrap with some in-house customizations.

15:19 LucidTortoise: Neat. J_Arcane I have never actually built a website, though I have followed to the end of a few tutorials, but have forgotten it all. I am going to start out with something simple, but I am glad I can mostly stay inside the language.

15:19 J_Arcane: I'm soon writing a tutorial series on building a full-stack app under my employer's sponsorship.

15:19 kwladyka: LucidTortoise the best in Clojure is... you don't need any framework.

15:19 LucidTortoise: I will look up all of that.

15:19 kwladyka: LucidTortoise just use tools which you need

15:19 LucidTortoise: The data is the framework?

15:19 J_Arcane: LucidTortoise: Ahh, if you're rusty on HTML/CSS itself, which you'll need to know a jot of, then a bit of freshening up might help there.

15:20 I used to recommend Codecademy for the basics, but they've started paywalling all the project exercises.

15:20 kwladyka: Luminus is framework.

15:21 LucidTortoise: Yeah, I'll either redo the Codecademy tuts... or not. I'll probably go through the W3C(??) official tutorial.

15:21 Guh, I have a Safari Books account. I am sure there is something brilliant and thorough on there.

15:22 justin_smith: w3c has tutorials?

15:22 oh, they do

15:22 highclasshole: Liminus is a framework but really they just wrap a lot of the libraries you would use

15:22 LucidTortoise: Well, they have the reference. Anyways, Pragmatic Bookshelf has a book on Clojure Web Dev, so I will read through that.

15:22 highclasshole: been a good intro into getting my feet wet with it

15:23 LucidTortoise: J_Arcane I am very curious to see your tutorial. Please let me know when it is complete!

15:24 highclasshole Yeah, Liminus seems to have everything I need to get started.

15:24 highclasshole: Luminus I meant to say heh

15:25 J_Arcane: yeah, the tricky bit with Clojure web dev is that it seems to move so quickly. A lot of the stuff I found when I was getting started just baffled me, it wasn't until I got employed that I got pointed to the stack I default to now.

15:25 Even my tutorial series is being delayed slightly because compojure-api has a new version coming very soon and I want to make sure it's up to date.

15:26 Hoplon is another option if you want an all-in-one framework in a more "reactive programming" style, though I am not a fan of their custom build system. https://hoplon.io/

15:29 MacTortoise: Nice. Now I never need to leave emacs!

15:30 Yeah. Let me preach to the choir for only a second. Not only is Emacs super powerful and flexible, it give me thhat pseudo-nostalgic feeling of working on an ancient machine... from a galaxy far, far away.

15:32 highclasshole: Take it to the next level http://www.informatimago.com/linux/emacs-on-user-mode-linux.html

15:33 MacTortoise: That is hilarious. I might actually do that on a Raspberry Pi.

15:35 J_Arcane: At "work" I still basically use a slightly tweaked version of the Brave Clojure Emacs config.

15:36 MacTortoise: Yeah, the author really did make a solid configuration.

15:38 csd_: what is the easiest way to run a .clj as a one-off script? like, if i want to have a bootstrap.clj within a larger project

15:39 justin_smith: csd_: java -jar clojure.jar script.clj

15:39 if you need deps you can make your own uberjar (and still make clojure.main your main)

15:40 csd_: hrm i'm surprised it's so difficult

15:40 justin_smith: because there's a whole four items on the command line?

15:46 highclasshole: I don't think I'd consider that difficult

15:48 csd_: *shrug* i have a dependency in mine and i'm at a loss for how to deal with it

15:50 highclasshole: I would build it into a jar then

15:50 an uberjar

15:52 csd_: are you just trying to setup your database or something?

15:53 csd_: yeah

15:54 can i use leiningen to create that other uberjar? it seems like it only acts on the main project.

15:54 i imagine my relative inexperience with java is part of why i'm not getting this

15:54 highclasshole: may wanna look at https://github.com/yogthos/migratus

15:54 justin_smith: csd_: you can run "java -cp some.jar clojure.main" to get a repl from any clojure uberjar

15:55 csd_: even just a normal uberjar from your project

15:55 it will run clojure.main instead of your -main

15:58 highclasshole: or just build the bootstrap into your project and add an arg that would trigger it

15:58 java -jar myproject.jar bootstrap

15:58 justin_smith: sure, yeah, an arg to main that migrates

16:02 neoncontrails: Remind me... what's the functional way to count the number of 'true' elements of a vector?

16:03 justin_smith: (count (filter pred v))

16:03 neoncontrails: Brilliant. Thanks

16:05 justin_smith: , (transduce (comp (filter true?) (map (constantly 1))) + 0 [false true false false true]) ; fancy pants way

16:05 clojurebot: 2

16:05 MacTortoise: ,(+ 1 1)

16:05 clojurebot: 2

16:05 MacTortoise: Hah

16:07 Bots are the best... As long as they are topical and not some hijacking by a new member who just learned how to maker their own bots...

16:07 That got annoying quick.

16:21 I didn't realize how quickly Clojure develops. A book about Clojure published in Dec 2015 only coverse version 1.6!

16:21 csd_: if i choose uberjar :aot :all in lein, must each file have its own -main defined?

16:22 justin_smith: not at all, you don't even need a -main

16:22 (you can use clojure.main to launch one of your functions)

16:23 csd_: hrm, i'm getting a class not found exception when compiling

16:23 it happened after i enabled aot all

16:23 J_Arcane: MacTortoise: Well, in fairness, 1.6 was the standard for quite a while. 1.7 and 1.8 came along *very* quickly and recently.

16:23 justin_smith: odd

16:23 csd_: also, you can just not aot, and skip all of this for sorting out another time

16:24 csd_: yes i need to stop wasting time on this

16:25 justin_smith: not using aot ends up working like - java -cp my-uber.jar clojure.main -m my.ns

16:25 and that invokes my.ns/-main with any other args from the command line

16:26 csd_: maybe me doing lein ring uberjar is screwing something up

16:27 justin_smith: I can see using ring to generate an uberwar, but for uberjar I would just use lein uberjar

16:27 MacTortoise: J-Arcane I didn't know that. I suppose the language itself is super stable. It must be everything else that uses it that can become quickly out of date.

16:28 justin_smith: if you don't have a -main that can launch the web server already, well that's very simple and a good thing to have anyway

16:28 MacTortoise: I guess I can't trust a book to learn web stuff? Hah, that probably is wrong/

16:28 J_Arcane: MacTortoise: Yeah. When it comes to web libraries it seems like there's a bit more churn, at least on the front end.

16:29 justin_smith: MacTortoise: clojure is very good about backward compatibility. You can run code written for 1.6 in 1.8 clojure, it's just that 1.8 has new features too (or bug fixes / performance enhancements, etc.)

16:29 Surgo: speaking of compatibility, I have a question about the new direct linking in 1.8. I don't entirely understand if it will break compatibility or not

16:29 justin_smith: with a large codebase, typical consequences of upgrading clojure versions are maybe having to rename some functions to make error messages go away

16:30 s/error/warning

16:30 Surgo: do you call def inside functions?

16:30 Surgo: Let's say I redefine functions to hook them, like with the robert-hooke library or just on my own (pretty straightforward to do). Let's say my code redefines a core library function

16:30 justin_smith: Surgo: if so, yes, direct linking will break that code

16:30 Surgo: because the core library comes compiled with direct-linking, would this hook stop working?

16:31 justin_smith: yes, and you should feel bad for redefining things in core

16:32 Surgo: it's a perfectly valid pattern to hook a function if you need to provide some sort of functionality around it :(

16:32 no need to feel bad about doing so

16:33 justin_smith: the problem with redefining things in core, is you are messing with everyone's code - even if it's just changing the performance

16:34 Surgo: sure but if I'm writing a program and not a library that's not really a concern

16:34 and that's what I'm asking about (I realize now that's ambiguous); libraries can't depend on the behavior anymore, but can end programs?

16:35 justin_smith: sure, that's true - is there a non-direct-linked version of the jar available?

16:35 Surgo: That's what I'm trying to find out :) the jar in this case is the clojure core library

16:36 justin_smith: right, clojure.jar

16:37 Surgo: I've read the following: "Code compiled with direct linking actually retains both the direct and dynamic call paths so this is always a compile-time decision." I'm not entirely sure I understand what that means -- I get to choose at compile time for clojure.jar whether I use the direct-linking path or the dynamic path?

16:37 justin_smith: Surgo: at compile time for your code

16:38 there's a command line that turns direct linking on or off, and that's interesting that they can apply it retroactive at the compiler stage

16:38 but very cool

16:38 Surgo: Okay. So when I compile my end program, I can choose to use clojure.jar with dynamism instead of direct linking, so the hooking behavior will work as normal

16:38 Is that correct?

16:38 justin_smith: right, and the arg is not provided by default

16:38 so you have to explicitly ask for direct linking

16:39 Surgo: I think it might be the other way around that I have to ask for it not to be direct linked

16:40 justin_smith: no, that's not the case

16:40 Surgo: Gah! This is confusing. I think it's that I can choose at compile time whether my code uses the dynamic/direct linking path, but the choice has already been made for clojure core, so function calls within clojure.core are already direct and can't be overridden

16:40 justin_smith: there's no "don't direct link" command line

16:40 Surgo: at least, that's what I'm getting from this quote in the changelog: "With this change, clojure.core itself is compiled with direct linking and therefore other namespaces cannot redefine core fns and have those redefinitions seen by core code."

16:40 justin_smith: hmm

16:41 Kamuela: Where is the repository found for the dependencies I use?

16:42 Surgo: if you mean the source code repo, could be anywhere on the internet

16:42 if you mean the jar, usually clojars

16:42 justin_smith: Surgo: I have clojure 1.8 open right here in a repl, I used alter-var-root to change a clojure.core function and it worked

16:42 Surgo: though I guess I did not test any clojure.core code that called my changed function...

16:43 Surgo: justin, what worked? An inter-core function call?

16:43 ah

16:43 Kamuela: I mean when I simply add something to project.clj dependencies, where is it coming from?

16:43 Surgo: Have to run and eat -- I'll find an inter-core function call and see if that sees the change or not

16:43 Kamuela: clojars

16:43 Kamuela: That's an online repository?

16:43 justin_smith: Kamuela: also maven central, and many people use sonatype too (iirc it is not there by default though)

16:43 Kamuela: yes, these are all maven repositories

16:44 Kamuela: Thank you both

16:44 kwladyka: How can i use exactly this namespace https://github.com/metaphor/lein-flyway/blob/master/src/flyway/flyway.clj from this dependencies? There is a namespace with functions which i exactly need.

16:44 I consider copy & paste or make from this depndency

16:44 justin_smith: kwladyka: why not just declare lein-flyway as a dep and use it?

16:44 Kamuela: So things on maven I can use by just adding to project.clj dependencies without any alteration?

16:44 justin_smith: I guess that requires pulling all of lein into your project though

16:45 kwladyka: justin_smith i want use it inside code, not in lein

16:45 justin_smith: kwladyka: that doesn't matter

16:45 you can use lein code

16:45 just put it in deps and not plugins

16:45 the drawback is pulling in the lein deps of course

16:46 kwladyka: mmm and how to exactly use it form code?

16:46 *from

16:46 justin_smith: by requiring the namespace and calling the function

16:46 just like any other ns

16:47 kwladyka: oh it works like that.... so simple...

16:47 i didn't expect it is so simple :)

16:47 thank you :)

16:48 neoncontrails: kwladyka: lein is unexpectedly awesome like that :-)

16:48 kwladyka: i was trying to do it in more complex way :)

16:54 neoncontrails: Trying to figure something out. If I launch "lein repl" from command line, it has no problem loading the namespace declared in project.clj under " :main ^:skip-aot". But if I run (in-ns 'myapp.models.mymodel), it creates a brand new namespace object. Doesn't load the one defined in my dir structure. Why?

16:55 justin_smith: neoncontrails: because in-ns doesn't load code

16:55 neoncontrails: justin_smith: is there an alternative method that does?

16:55 justin_smith: you want to use require first (doto 'myapp.models.mymodel require in-ns)

16:55 Kamuela: I wonder if there's such a thing as a Clojure junior position

16:56 justin_smith: Kamuela: my company had some junior clojure devs until recently

16:57 neoncontrails: justin_smith: (!!) thanks, that does exactly the trick

16:57 kaylindris: what happened to them? they learned and became >junior?

16:57 arcatan: i was a junior clojure dev in 2013

17:07 justin_smith: kaylindris: sadly we had some layoffs, but we might be hiring more in the future again

17:08 part of it was about balance really, like we had too much backend expertise and not much frontend...

17:10 highclasshole: im not really a jr dev, but ik learning clojure on the job; i decided to rip out and replace stuff writtwn in java and groovy with clojure

17:11 autogen_: nn

17:14 neoncontrails: Is there an easy way to refactor a namespace so defs are evaluated in a normal order? (i.e. if (def baz (foo 'bar)) comes before (defn foo [x] (str x)), then evaluate foo's definition before baz's)

17:15 Or maybe not refactor, but simply change the evaluation strategy

17:16 pilne: the book "seven languages in seven weeks" (not working through it, just giving it a read, really helped to convince me that clojure was the language for me (and also a better understanding of scheme and common lisp).

17:16 justin_smith: neoncontrails: clojure reads forms start to end, so that using a file will act the same as using a repl

17:16 pilne: hrm... clojure + actors = pseudo OO with lispy goodness?

17:16 justin_smith: neoncontrails: you can use declare and declare all the defs at the top, if you really want things in an arbitrary order

17:22 neoncontrails: justin_smith: oh cool. That works, in a way. Is there maybe an IDE tool to help you reorder your defs in the static file itself?

17:22 pilne: i think though... for my enigma machine coding project, i'm going to have to start really simple again (i.e. everything hardcoded, even if i want to implement options down the road)

17:22 justin_smith: neoncontrails: not sure... maybe this is something slamhound can do though?

17:24 neoncontrails: justin_smith: great suggestion, I'll give this a whirl

17:27 pilne: if I recall correctly the actor model actually arises organically in lisp, as a consequence of treating functions as first-class citizens

17:33 pilne: i can see that (: lisps are too much fun... i just wish the "smug lisp weeneis" would stop getting all riled up when people talk about clojure being "a" lisp lol.

17:34 without my exposure to clojure, i would never have even wanted to touch lisp/scheme tbh lol.

17:34 the parens scared me, but with clojure using all sorts of brackets, it made it less scary

17:37 J_Arcane: I genuinely do not understand that. but then I grew up with BASIC.

17:37 so I was looked down on by all the smug weenies of every language. ;)

17:39 pilne: lmao, so many that i run into are like "it can't be "a" lisp unless it is common lisp" and i want to be like... "i really doubt mccarthy would agree with you"

17:40 hell, i've seen some go full plaid nerdrage over the idea that scheme is a lisp!

17:56 neoncontrails: pilne: in re: your earlier suggestion about lispy OO... you might find this interesting: http://www.kurtm.net/archive/2002-Summer-cs61a-public_html/labs/lab5.1.pdf

17:59 pilne: that HW assignment really blew my mind. It's Scheme syntax, but you should be able to follow along. It's basically how you would go about implementing objects as functions, using only lazy evaluation and apply statements

18:09 loophole_: pilne: i like cl but clojure is way more useful imo

18:11 pilne: i like anything that works like a lisp, this guy has a bitbucket with a lot of transpilers for langauges that lets you use them with a lispy syntax at the least (and often macros and such too).

18:11 and thank you neoncontrails

18:12 loophole_: heh I hacked a connection pool with a ref. seems to work just fine. the trick is to use delays and promises

18:19 pilne: you find a nice idea how to implement OO in CL in grahams book "On lisp" http://www.paulgraham.com/onlisp.html

18:19 pilne: this book is a nice read

18:19 neoncontrails: ^great book

18:20 jey: interesting/neat that it's still well-regarded

18:20 princeso: ,(let [x 1] (eval '(+ x 1)))

18:20 clojurebot: #error {\n :cause "Unable to resolve symbol: x in this context"\n :via\n [{:type clojure.lang.Compiler$CompilerException\n :message "java.lang.RuntimeException: Unable to resolve symbol: x in this context, compiling:(NO_SOURCE_PATH:0:0)"\n :at [clojure.lang.Compiler analyze "Compiler.java" 6688]}\n {:type java.lang.RuntimeException\n :message "Unable to resolve symbol: x in this context"\n ...

18:20 loophole_: neoncontrails: yep his book aboout macros is quite nice too

18:22 princeso: (let [x 1] (eval `(+ ~x 1)))

18:26 justin_smith: princeso: eval does not see your local environment

18:26 pilne: i like my copy indeed (: lisp is an incredible basis for langauge design

18:26 loophole_: has somebody experience with orientdb?

18:29 the clojure driver seems to be out of date and I'm not sure if the database is stable enough to put some work into a updated/new one. the features seem nice but I read also a lot of negative opinions

18:29 neoncontrails: pilne: heh. It blew my mind when it hit me that a Lisp program is essentially just a domain-specific language

18:29 pilne: it reminds me of forth in that regard

18:30 loophole_: pilne: forth is on my list of languages to learn

18:31 pilne: afaik sun had a forth interpreter on their hardware controlers so one could configure the hw with forth

18:31 pilne: i'm actually toying around with prolog too

18:31 neoncontrails: pilne: have you looked into SICP? You'd love it

18:31 pilne: i have a copy of that too neoncontrails (:

18:32 i tend to reccomend "how to design programs" alongside "dr racket" for people who aren't as comfy with a computer, but want a similar "experience"

18:32 princeso: loophole_ my bad, this is the "real thing" i want do do (let [x 1] (eval '(let [y 1] (+ x y))))

18:33 loophole_: pilne: I add "land of lisp" for fun :)

18:33 pilne: heh, i point people to his "casting spels in clojure" tutorial for a quick and dirty repl intro

18:34 neoncontrails: pilne: the 5th chapter of SICP has you implement a FORTH-like imperative language, which is essentially just a register machine program

18:34 princeso: justin_smith: How do macros get the &env map?

18:34 pilne: i <3 lisps, i love a lot of "things" about haskell, but i'm not a haskeller, i know my limits (:

18:34 loophole_: princeso: why eval? it is especially slow in clojure

18:35 pilne: erlang is nice too

18:35 pilne: have you seen "lisp flavored erlang" loophole_?

18:36 princeso: loophole_ is to generate functions, that thing is done just once

18:36 loophole_: pilne: nope

18:36 pilne: http://docs.lfe.io/

18:37 lisp metaprogramming combined with the power of the beam vm kinda scares me :p

18:37 loophole_: pilne: nice

18:38 pilne: erlang is a platform for distributed computing that happens to have a programming language included ;)

18:40 pilne: what i mean by that is, that erlang is much more yhan just a programming language

18:44 pilne: i haven't had the chance to really dig into erlang much, what i've gleaned has intrigued me

18:45 loophole_: pilne: unfortunately one has to almost to learn the language twice. for once the programming language and then the OTP gen_server/supervisor/ stuff

18:47 pilne: the otp stuff hides much of the erlang primitives and introduces new concepts

18:47 pilne: ahhh

18:47 loophole_: pilne: once you have learned them it's great

18:49 pilne: the otp library implements many patterns to build reliable programs and has many good habits already included.

18:49 pilne: always a plus (:

18:51 loophole_: pilne but you don't send messages around but write callbacks. the otp library doe the message sending. because of that erlang programs feel different when you write them in OTP style, if that makes any sense

18:53 pilne: it does

18:58 arpunk: pilne: loophole_ is right, Erlang is more than just the language. But LFE is very nice and fun to work with. As with Elixir, LFE is not tied to vanilla Erlang

19:00 pilne: hmmm, maybe after i've somewhat mastered clojure and the jvm for my evil whims, i'll set my eyes on the beam vm (although i'm curretly planning on really digging into haskell, common lisp, and possibly "lux" (i spend way too much time at work googling and reading up on interesting niche things....

19:00 loophole_: pilne today I had this funny idea to write a connection pool and manage the connections in a ref. maybe the idea is silly but it works. when you request a connection you get a delay, when yoe derefernce it the connection gets started. if you request a connection thats above the max-connections threshold you get a promise that gets delivered as soon as a connection is given back

19:01 pilne: and how do you end a connection?

19:01 loophole_: pilne: that way the ref deals not with side-effects but with dealy/promise objects

19:03 pilne i have to call a function that closes the connection and creates a new delay in the pool

19:04 pilne: sweet

19:04 very simple and robust (:

19:04 loophole_: pilne: you get either a delay or a promise but since you dereference both it makes no difference

19:05 pilne: about 60 lines of code + tests

19:09 pilne: sometimes i think my life would be very different if instead of having c++98 and java 1.2 shoved down my throat academically, i had gotten pascal and then SICP >.<

19:10 which is what *should* have happened if my teachers had not ben OO-kool-aid gung-ho >.<

19:11 loophole_: pilne: c++ templates are just a very ugly implementation of lisp macros :D

19:11 pilne: yeup

19:14 loophole_: pilne: this is interesting but will make your eyes bleed :) http://www.amazon.com/Modern-Design-Generic-Programming-Patterns/dp/0201704315

19:14 TMA: pilne: even starting with pascal, lisp was a revelation. another revelation was prolog

19:17 pilne: i started with (poorly taught) c++98 and then java after just dabbling around with basic, scripts, and some python, then java was forced down my gullet, i sadly didn't learn about the fun things until very recently

19:19 loophole_: pilne: I found my way to functional programming via perl. I did lots of stuff in perl at that time. a colleague pointed me to http://hop.perl.plover.com/.

19:20 pilne: after that book i started with CL

19:20 pilne: nice

19:21 i'm so very hooked on lisps, i appreciate what haskell is, and I want to have a good understanding of it, but i see haskell as a hobby, and lisps as my way back into useful programming (:

19:22 loophole_: pilne: a friend of mine hacked a cobol interpreter in haskell.

19:23 pilne: O.o

19:23 loophole_: pilne: exactly

19:23 :)

19:23 pilne: i've heard haskell is absolutely fantastic for parsing and lexing though

19:25 loophole_: pilne: I heard that also. unfortunately I never get past the basics. I started learning several times but it doesn't stick

19:25 pilne: same, i do good through calculus, but all this other stuff just takes a while for my old brain to grasp

19:27 loophole_: pilne: http://www.cs.yale.edu/publications/techreports/tr1049.pdf

19:29 pilne: page 8 for the results

19:29 pilne: page 8/9

19:33 pilne: task was to program a weapons system 85 lines of haskell vs 1105 lines of c++

19:34 pilne: lisp was not to bad either 274 lines of code and the shortest development time

19:35 pilne: i've seen that before (:

19:35 haskell is very powerful, but the learning curve is sharp, i feel like i'll always be learning something with lisps, but it will be a more gradual curve

19:36 loophole_: pilne on my list is scala and ocaml

19:37 pilne: the pragmatist in me says scala (or maybe kotlin)... but >.<

19:39 loophole: pilne scala looks nice. I just don't know how many scala programmers really write functional code.

19:40 pilne: afaik scala is not strictly functional. If java programmers use it as java with a nicer syntax, then this code is no fun

19:41 pilne: but I'm talking out of my ass here, since I have no proof of my guesses :)

19:42 xeno: loophole: well, that's theoretical, since they don't... they try to use scala as a better java, figures out that it's quicker to write java in java and never look at scala again

19:43 loophole: xeno: nice ;)

19:43 xeno: not really :/

19:43 although admittedly, scala has some issues :/

19:46 loophole: xeno: example?

19:52 neoncontrails: Trying to quickly test whether a table exists before initializing it. Is there a way to rewrite the line "(format "select 1 from %s" (sqlize table-key))" in this function to eliminate the "sqlize" dependency? https://github.com/xsc/ritual/blob/master/src/ritual/table.clj

19:52 *rewrite the sexpr, to be more precise

19:56 loophole: neoncontrails: what is your goal? or why do you want that? I don't understand the problem (I'm stupid)

20:00 neoncontrails: loophole: I need my initialize function to check if a table exists before trying to create it. The problem I'm running up against is jdbc/sql-query errors if you try to query a table that doesn't exist; it doesn't return 'nil' or an empty list

20:04 pilne: what does it return?

20:07 rager: is there a problem with lein search right now?

20:07 when I try to use it, it hangs after this: "Downloading https://clojars.org/repo/.index/nexus-maven-repository-index.properties"

20:07 neoncontrails: loophole: to be more specific though, I'm mostly curious what that line is doing in the context of that threading macro, and how I could rewrite it without that line. I don't need to format the string I'm checking against the db-spec, it's already sqlizable

20:08 rager: I saw some chatter about the problem 2-3yrs ago, but nothing that acctually pointed towards a fix

20:08 I've left it overnight, and it still doesn't complete, but the link downloads fine

20:09 loophole: neoncontrails: your specific question:

20:09 (defn create-select [sqlizer-fn table-key] (format "select 1 from %s" (sqlizer table-key)))

20:10 (defn sqlizer [k] (name k))

20:10 (partial create-select sqlizer)

20:10 ((partial create-select sqlizer) :da_key

20:10 )

20:10 neoncontrails: dont know if that helpes makes sense

20:11 result is "select 1 from da_key"

20:12 neoncontrails: of course create-select is just a replecement for your function

20:14 neoncontrails: this handles your sqlizer fun as a parameter, but doesn't help with the jdbc problem

20:15 neoncontrails: loophole: that works! Thanks, I've never been completely sure how to use partial in situations like these

20:15 loophole: cool :)

20:19 neoncontrails: I made an error but I guess you found it already

20:19 wrong: (defn create-select [sqlizer-fn table-key] (format "select 1 from %s" (sqlizer table-key)))

20:19 right: (defn create-select [sqlizer-fn table-key] (format "select 1 from %s" (sqlizer-fn table-key)))

20:21 neoncontrails: loophole: yeah I figured that was just a typo :-)

20:21 loophole: neoncontrails: k

20:22 bbl

20:33 neoncontrails: before I go to bed. partial is not very complicated. example

20:33 :

20:33 neoncontrails: (defn three-params [a b c] [a b c])

20:34 (defn naive-partial [f a] (fn [b c] (f a b c)))

20:34 (let [f (naive-partial three-params :a)] (f :b :c))

20:37 neoncontrails: partial is more generic but that is basically what it does.

20:38 result is of course [:a :b :c]

20:38 i'm gone now

21:42 nathanic: hi, can anyone explains what this error is? Only [lib.ns :only (names)] specs supported in :use / :use-macros; offending spec: [loom.graph]

21:43 i have a (:use [loom.graph]) in a cljc file, not sure what this message means or why that sets it off

21:43 justin_smith: nathanic: it's saying you can't use it unqualified

21:43 you need to use the :only key to specify which things to import

21:44 nathanic: justin_smith: oh, okay. i just couldn't get a meaning out of that wording

21:44 justin_smith: thanks!

21:45 so is this a general clojurescript thing? no import *?

21:46 i normally use :require and :refer but i was working off an example for loom that relies on unqualified imports

21:47 justin_smith: nathanic: funny enough, our version of import doesn't allow *

21:47 but that has nothing to do with require / use

21:48 nathanic: I wasn't aware of cljs not allowing unqualified use, because I never try to do that

21:48 nathanic: in my experience use is common in examples in readmes, and very rare in actual code :P

21:48 nathanic: I wonder if that was a technical limitation or an Opinion? (An Opionin I generally share)

21:49 but if you're working off an unfamiliar example, and it doesn't make clear which symbols come from which ns's, it's annoying to go back and explicitize the refs

21:52 justin_smith: it's true

22:31 amalloy: it's an opinion, i'm sure. it wouldn't be hard to look up all classes in a package and import them

23:05 domokato: i've got a problem you guys might find fun

23:08 MONODA: My emacs session with cider crashed and now when I try to refresh my code into my repl session I get "CompilerException java.lang.RuntimeException: No such var: user/reset"

23:09 domokato: i have a list of ranges i.e. ([0 1] [-2 3] [5 14] [-25 -5] [2 4]) and a function (ranges-overlap? range-a range-b) and I want to merge any overlapping ranges recursively and end up with i.e. ([-2 4] [5 14] [-25 -5])

23:09 MONODA: Any ideas? I feel like i've tried everything

23:09 domokato: how should i go about it?

23:11 justin_smith: domokato: something like (reduce (fn [ranges r] (merge r ranges)) [] ranges)

23:11 domokato: s/merge/range-merge

23:13 domokato: justin_smith: merge? like for maps?

23:14 justin_smith: then range-merge is something like (fn [r ranges] (map (fn [rng] (if (ranges-overlap? r rng) [(apply min (concat r rng)) (apply max (concat r rng))] rng)) ranges)

23:14 where it expands ones that overlap, but leaves the rest alone

23:14 domokato: very rough sketch

23:18 MONODA: I've double checked my dependencies and everything seems fine

23:19 justin_smith: MONODA: so after restarting your repl and restarting CIDER, code reloading is not working?

23:19 MONODA: Yes

23:21 Any ideas why

23:22 justin_smith: any messages when cider connects, about middleware or cider versions or anything?

23:24 LucidTortoise: MONODA Try running the repl in the command line. Does it load?

23:24 MONODA: the repl runs fine

23:25 i can run (-main) as well from the repl

23:25 domokato: justin_smith: after you merge two ranges, don't you have to recheck the other ranges? let's say [0 2] skips merging with [3 5] but later merges with [1 4] to make [0 4]. [3 5] should be checked again because it might overlap now

23:25 MONODA: The only message I get is: "CompilerException java.lang.RuntimeException: No such var: user/reset"

23:25 which I assume is a namespace issue or dependency issue but I can't seem to find anything wrong with what I have

23:26 justin_smith: domokato: first you would check [0 2] against every other range, then check [3 5] against every other, etc.

23:26 MONODA: http://pastebin.com/0HsFstft

23:26 justin_smith: domokato: you would find all the overlaps, even with merges

23:26 MONODA: my project.clj

23:27 LucidTortoise: Sorry MONODA I really don't know enough about Emacs and Clojure (yet) to help.

23:27 justin_smith: MONODA: typically cider-nrepl would be in profiles and not in the project file (though if you are doing this as a solo project this likely doesn't matter much)

23:28 MONODA: Right. Also, when I try: (require '[clojure.tools.namespace.repl :refer [refresh]])

23:28 I get "FileNotFoundException Could not locate clojure/tools/namespace/repl__init.class or clojure/tools/namespace/repl.clj on classpath. clojure.lang.RT.load (RT.java:456)"

23:29 justin_smith: MONODA: well, I doubt that the clojure.tools.namespace project, when loaded as a plugin, adds itself to your classpath in the process

23:29 MONODA: I think it's meant to be used as a dependency, not a plugin

23:29 then again, cider-nrepl should be pulling it in itself

23:31 MONODA: That's what I was thinking

23:32 Seems to be a cider issue.

23:32 I was require c.t.n.r/refresh if I list it under dependencies

23:32 and then I can run (refresh)

23:33 but cider still won't run (refresh) when I run cider-refresh

23:33 justin_smith: sounds like they have namespace / scope issues?

23:36 domokato: justin_smith: but if the processed ranges so far are ([0 2] [3 5]) and the next range is [1 4] then you'll end up with ([0 4] [1 5]) which now overlap, but you'll never know?

23:37 justin_smith: domokato: that's why I did a reduce

23:38 you would know because you reduce, and take the new range, and merge it with any applicable, and merge that merged one with any others too

23:39 so you start with [[0 2] [3 5] [1 4]] - first you do [0 2] - at the last step it merges with [1 4]

23:39 so next you have [[3 5] [0 4]] and you repeat the process

23:40 domokato: I know what I shared before wasn't exactly right, but this logic is doable if you do a reduce and update all ranges at each step of the reduce

23:43 domokato: justin_smith: okay i'll figure it out. thanks!

Logging service provided by n01se.net