#clojure logs

2015-07-18

01:58crocketIs there a way to write https://www.refheap.com/106683 better?
02:00crocketI mean https://www.refheap.com/106684
02:03funglei don't know if its ok to ask a leiningen question here but i changed the dependence of a project to use clojure 1.7 but when i start the repl it throws compilation erors
02:04fungleRetrieving org/clojure/clojure/1.7.0/clojure-1.7.0.pom from central
02:04fungleRetrieving org/clojure/clojure/1.7.0/clojure-1.7.0.jar from central
02:04fungleException in thread "main" java.lang.RuntimeException: Unable to resolve symbol: create in this context, compiling:(/tmp/form-init3567741596872273906.clj:4199:33)
02:51crocketHow do I check whether a channel is closed without using <! or <!!?
02:51crocket<! is already used in a go-loop
02:53crocketIt seems only one thread can take a value from a channel at a time.
02:55crocketDoes clojure.core.async have 'closed?' function?
03:36crockethi
03:36crocketI have a sequence of async channels.
03:36crocketHow do I detect if any of them emits a value?
05:35crocketHow do I disable ANSI colors in rotor-appender in timbre?
05:37crocketTell me
06:22maeGh4ChSo... Is there a tutorial\introduction to om next? I've watched the David Nolen's talk, and he says they have gotten rid of cursors, but the documentation in the om's wiki still describes om with cursors.
06:23maeGh4ChSo it makes me think the wiki describes the old version of om. I've tried googling stuff related to "om next", but got nothing.
06:53wasamasaif there's nothing like a blog post explaining changes and the upstream docs weren't updated, the sources are going to be your next-best bet
08:28zophycan i express on the command line an argument to java that references the clojure.jar as a classpath and also express a class that will compile a provided filename of a clojure source file and then instantiate a jvm with the compiled code being executed ?
08:29zophysimply illustrated: "java -cp clojure.jar clojure-compile-and-run code.clj"
09:24puredangerClojure 1.8.0-alpha2 is out https://groups.google.com/d/msg/clojure/LT7vDT6fWxA/OGkR5j3Y3yAJ
09:32justin_smithcrocket: about the async channels - you can make a mult on one and tap it, the mult will get the same input the channel did
09:48crocketjustin_smith, a mult?
09:52crocketjustin_smith, Do I have to close a mult separately from tapped channels?
09:52crocketWhat happens to a mult when tapped channels close?
10:01puredangermany libs have already been rewritten to use cljc files and reader conditionals
10:01puredangerso: many
10:01dysfuni've been holding on on using them in a few of mine
10:01puredangerit requires clojure 1.7 as a min bar so it's happened faster than I expected
10:02dysfuni bet midje isn't one though
10:04puredangerprob not
10:04dysfunand it's not :/
10:09crocketWhat is feature expression?
10:09dysfuner, we're calling them reader conditionals i think. feature expressions is the lisp name
10:09crocketWhat is it?
10:09dysfunbut they're reader macros to allow you to provide different code to different compilers (e.g. clojure and clojurescript)
10:10puredangerhttp://dev.clojure.org/display/design/Reader+Conditionals
10:10puredangerhttp://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example
10:13crocketWoohoo!!!
10:13dysfuni'm looking forward to having a lot more clojurescript libraries available
10:15crocketCan I just plug clojure 1.7 in cider and existing projects?
10:19justin_smithcrocket: yes, you can make cider use whichever clojure version you like
10:19justin_smithexcept maybe not some of the really old ones...
10:21crocketgood
10:21crocketjustin_smith, I just want to be notified of closed channels.
10:21crocketThe channels are used somewhere else.
10:22justin_smithcrocket: then make a mult, make a go loop that repeats (reading and throwing away) while the channel is not closed, then sends a message when the channel is closed
10:22justin_smithI guess
10:23justin_smithbut why does someone who isn't reading from the channel need to know if it is closed?
10:23justin_smithmaybe the one sending to the channel should do something special when it is done, instead?
10:27crocketThe channels signal DDNS updates.
10:28crocketIf any channel is closed, it means there is a problem, so I need to close the program.
10:28crocketWhen any DDNS updater throws an exception, I should close the associated channel.
10:28justin_smithcrocket: whoever is reading from the channel is in a loop, right?
10:29justin_smithcrocket: if so, when the channel closes, it should exit the loop, then send the message that triggers the apropriate notification or recovery
10:29justin_smithwho better than the one using the channel to trigger some action if the channel closes
10:29crocketjustin_smith, https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L48
10:30crocketI currently use another channel to be notified.
10:30crocketjustin_smith, https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L136 is where the program exits.
10:31justin_smithcrocket: this is where you should be detecting the closed channel https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L30
10:31justin_smithcrocket: turn the when-let into an if-let
10:31justin_smiththe other arm of the if can send to one of the alarms
10:32crocketand?
10:33crocketjustin_smith, The else clause is executed when chimes is closed.
10:33justin_smithcrocket: and that means that start-updating! needs to pass a channel into launch-provider-updater!, and launch-provider-updater! can send an alarm on that channel
10:33justin_smithcrocket: line 30 - that's the only good place to detect the channel close isn't it?
10:33justin_smiththere's no else clause there
10:34crocketjustin_smith, If chimes channel is closed, the go-loop exits.
10:34crocketgo-loop itself returns a channel that signal its exit.
10:34justin_smithcrocket: what I am saying is if you care about that channel closing, do something about it right there
10:35crocketlike?
10:35crockethttps://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L136 needs to be changed, too.
10:35justin_smithOK, so when the go loop exits you get a nil on :updater-ch which is read in -main
10:35justin_smithso that means you are detecting closed channels
10:36justin_smithwhat else do you need then?
10:36crocketI want to use only :chimes channels to detect close.
10:36crocketI want to use only :chimes channels to detect close in -main
10:36crocketHowever, the go-loops read from chimes channels already.
10:37crocketIf I read chimes from -main, -main will compete with go-loops for :chimes.
10:37justin_smithcrocket: that's when you need a mult, if you need to read the same channel more than one place
10:37crocketThis means -main and go-loops read :chimes alternately.
10:37justin_smithif the original is closed, all the mults from it are too
10:37crocketI am not familiar with mult yet.
10:38justin_smiththen familiarize yourself - wasn't mult the first thing I suggested?
10:38crocketCan I read directly from a mult?
10:38justin_smithit returns a new channel that gets all the messages the original does
10:38crocketWhat the hell is tap, then?
10:38justin_smithcrocket: you create a mult, you make things send to the mult
10:38crocketI just need to read from a mult.
10:38justin_smiththen you use tap, and read from the channels returned from tap
10:38justin_smithno, you tap a mult
10:39justin_smiththe thing returned from mult is what should be written to
10:39justin_smiththen you use tap to get channels you can read from
10:39justin_smithoff of the mult
10:39justin_smithI was being a bit sloppy talking about it before, sorry, I had assumed you would look it up and figure it out
10:39crocketDoes it means that chime-ch should use a mult channel in the first place?
10:39justin_smithright
10:39crocketI read about it.
10:40crocketBut, I am too sleepy.
10:40justin_smithbbl, reading a book
10:41crocketIt's weird.
10:41crocketI create a channel, create a mult from it, and tap the mult to create a new channel.
10:42justin_smithcrocket: you don't need the initial channel
10:42justin_smithmake a mult from the channel, send to the mult, use tap to create the channels you will be reading
10:42dysfunjustin_smith: an ebook though, right? we wouldn't want you walking away from a screen ;)
10:43justin_smithdysfun: actual book!
10:43dysfunlike made of dead tree and everything?
10:43justin_smithyeah, I know, it's barbaric
10:43dysfunit is, but you won't notice until you decide to move house/apartment
10:47crocketjustin_smith, Why do you waste the original channel?
10:47crocketdoesn't make sense
10:54crocketjustin_smith, Do you usually read directly from a mult?
11:00crocketIt seems I better not use a mult now.
11:01kungijustin_smith: actual book is the best kind of book! :-)
11:03kungiCan someone help me in making this code sinppet a bit more readable: https://gist.github.com/Kungi/19ffc88c4f1acf40f1c5
11:06dysfunwhy do you want them as keywords?
11:06kungidysfun: why not?
11:06dysfunwell keywords are usually used where you're going to provide what is essentially a known string key
11:07dysfuni'd just leave them as integers for the keys
11:07dysfun,(reduce (fn [acc {:keys [role infocenter_id]}] (assoc acc infocenter_id (keyword role))) {} [{:role "SITE-ADMIN" :infocenter_id 2} {:role "SITE-ADMIN" :infocenter_id 3}])
11:07clojurebot{2 :SITE-ADMIN, 3 :SITE-ADMIN}
11:08dysfunotherwise you're going to have to turn all your id numbers into keywords before you look them up
11:09kungidysfun: I actually do this. But the result is only used in one location.
11:09dysfunseems like you're adding an unnecessary step, but you should be able to adjust the above if you want to keep it that way
11:10kungidysfun: using integers makes more sense. I will refactor this. Thank you! :-)
11:10dysfunyw :)
11:11crocketOk, I got the hang of mult.
11:16kungidysfun: This is so much more pleasant to read.
11:17dysfunkungi: well it only does the necessary work :)
11:17dysfunclojure's collection functions are your friend, and there are lots of them to help shorten your code
11:17dysfunhttp://conj.io/ is a good reference
11:20crockethell
11:20crocketclojure 1.7 rocks.
11:21puredangerHow so?
11:40crocketIt just does.
11:40crocketjustin_smith, In clojure 1.7.0, the original channel should be written to, and the tapped channels should be read from.
11:40crocketThe mult is not needed after creating taps.
11:41puredangerOh, well no argument from me :)
11:43crocketCan clojure be used as an embedded language?
11:45crocketI want to just add clojure scripts to any JVM program on the run.
11:45dysfunthere's even a library that injects a clojure repl into your process :)
11:47crocketno
11:47dysfunclojure is just a library, you can do whatever you'd do with a library
11:47crocketxchat has python script modules.
11:48crocketI wonder if I can add clojure script modules to a JVM program.
11:48justin_smithcrocket: the clojure language is a java library, and cannot be used in the jvm without the full clojure compiler
11:49justin_smithcrocket: you can include clojure in a java project, but that requires the full language
11:49crocketok
11:49crocketIf I include the full compiler, can I add clojuer script modules to JVM programs?
11:51dysfunwhy wouldn't you be able to?
11:52crocketIs there a pre-existing library for that?
11:52justin_smithcrocket: sure, but they aren't really "scripts" per se - clojure is a compiler, it generates jvm bytecode which can then be invoked via the clojure api
11:53dysfuncrocket: yes, i wrote one https://github.com/irresponsible/oolong
11:53justin_smithcrocket: clojure.java.api http://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html
11:54dysfunloading bits of code at runtime is not as straightforward as you might think, there are all sorts of gotchas
11:54justin_smithdysfun: wait, how is oolong related to using clojure from java?
11:55amalloyjustin_smith: you don't think crocket meant cljs on the jvm?
11:55dysfunjustin_smith: it's not, it's related to the other thing he said, having scripts
11:55justin_smithOK, maybe I don't understand what you guys mean by scripts
11:55justin_smithamalloy: oh, maybe...
11:57dysfunjustin_smith: plugins need some sort of way of obtaining resources in a dependency-driven fashion. oolong solves that part
11:58dysfunand i might one day get around to finishing it's big sister library which supports loading plugins packaged as jars
13:18bitpimp_brew is installing leiningen 2.5.0… good version?
13:20justin_smithbitpimp_: it's OK, but it's a bit silly to use brew for lein
13:20justin_smithbitpimp_: lein is a single shell script, and is better at managing deps than brew is
13:20bitpimp_ah ok… felt a little guilty, to be honest.
13:20bitpimp_I'll install it the proper way then.
13:20scriptoryeah, it's more straightforward to just put the lein script in some place you control
13:20justin_smithbitpimp_: lein knows how to upgrade itself, yeah
13:20justin_smithexactly
13:21bitpimp_attempting to abort the angular nightmare I'm getting into on a work job and wondering if I can somehow get the somewhat simple app working in clojure. ;-)
13:22bitpimp_tall order, given my lack of knowledge, by hey, it's still just Saturday.
13:22justin_smithbitpimp_: cool - if you are replacing angualr I assume you'll be using cljs?
13:22bitpimp_that was the plan.
13:22justin_smithbitpimp_: if so, definitely check out figwheel and reagent
13:22justin_smithit's a pretty slick setup once it's working
13:22bitpimp_cool… was thinking of reagent. don't tell Alan.
13:22justin_smithheh
13:38bitpimp_I just think I can possibly sell my company on React instead of Angular to start, but not a non-React approach.
13:38justin_smithbitpimp_: react is so much better than the other options...
13:39bitpimp_oh totally… looking forward to it. just that the next step in this set of stairs is 10' tall. ;-)
13:45kavkazHey guys, the project that I'm doing for an independent research position under my professor involves machine learning. I don't really know much about AI or machine learning, but my professor recommended me to look into Lisp-derived languages
13:47kavkazSo I chose clojure because it is a Lisp language (if I'm correct in saying that) and it seems powerful. Anyways, I wanted to get into machine learning, what is a simple challenge I could do to start? Is clojure a good language for this?
13:56arrubinkavkaz: There are always the Kaggle challenges.
13:56arrubinThis book is available: http://www.amazon.com/Clojure-Machine-Learning-Akhil-Wali/dp/1783284358
13:56arrubinI do not believe that Clojure is a popular option for this though.
13:57kavkazarrubin: Hmm... interesting. What would you say is a popular option for this?
13:57arrubinShould be able to use things like Spark though.
13:57arrubinkavkaz: Python, at least for initial implementation.
13:57kavkazarrubin: I see.
13:58arrubinI am not trying to dissuade you from using Clojure for this.
13:58arrubinhttp://www.mikeivanov.com/post/116884531461/machine-learning-with-clojure-and-spark-using
13:58arrubinClearly people are doing it.
13:58arrubinBut it is nowhere near as popular as things like Python.
14:00kavkazarrubin: I've watched Rich Hickey's talk about Clojure at JavaOne. He said that some things can be done much more easily in Clojure than Java. Interesting thing is that I've made a code parser in Java for my project (it analyzes Java code, extracts methods, etc) and it's quite long. Is one of those scenaries that Clojure would make things easier in? Say if I tokenized everything, then used Clojure to
14:00kavkazrecognize the syntax of the tokens?
14:00justin_smithmachine learning, AKA statistics
14:01justin_smith(OK, that might be a bit unfair)
14:01bitpimpwhat is the site Jon Pither was part of building, again? the real estate site?
14:02arrubinkavkaz: Parsing lisps is far easier. I am not sure about parsing other languages in lisps. If you ask people who like a language they are probably going to tell you that it is easier.
14:03justin_smithkavkaz: we have tools in clojure that parse and analyze clojure syntax
14:03justin_smithkavkaz: also, the reading and compilation steps are separate, so it is straightforward to read some forms, perform some data transform on them, then compile the result
14:04justin_smithkavkaz: so objectively this is much easier than the java equivalent would be
14:05justin_smithkavkaz: unless you mean you have to accept java input? not sure what your task is here
14:06kavkazI input a Java class. The code is tokenized, and I identify the methods within the class, their arguments, their return value
14:08justin_smithyou want a java paraser then, there's probably a good java one that you could use from clojure
14:08arrubinThere are standard libraries for accessing the Java compiler and walking the AST and such.
14:08arrubinIn Java that is.
14:08justin_smithkavkaz: what about using the compiled code? we have good tools for working with the bytecode
14:08justin_smithand getting things like method calls, arguments, return types
14:09kavkazjustin_smith: I want to use the same application for both Java and C# code. The syntax is almost the same but some keywords may be different. But this is why I want to use the code rather than the compile java code
14:20kavkazjustin_smith, arrubin, thank you both! I will look more into what I can do with clojure.
14:21arrubinbitpimp: OnTheMarket.com?
14:21justin_smithkavkaz: I could easily see trying to parse both java and c# with the same code turning into a much harder problem than anticipated
14:22bitpimpor rightmove.co.uk?
14:22bitpimpjust wanted to show someone a successful clojure project, and just watched his talk.
14:23arrubinbitpimp: https://uk.linkedin.com/pub/jon-pither/1/649/393
14:24arrubinHe claims to have completed a few projects in Clojure.
14:24arrubinI believe that Room Key uses Clojure.
14:24arrubinI know there are others.
14:24arrubinPeople are not very loud about it.
14:25arrubinhttp://dev.clojure.org/display/community/Clojure+Success+Stories
14:25arrubinhttp://cognitect.com/clojure#successstories
14:28kavkazjustin_smith: Yep. Could you see yourself doing this in Clojure though?
14:29arrubinkavkaz: If it makes a difference, Clojure runs on both the JVM and the CLR.
14:33bitpimp@arrubin onthemarket.com… you were right.
14:33bitpimp@arrubin that site will help me convince colleagues and various people clojure is viable for real projects ( a foregone conclusion, here, I'm sure )
14:34arrubinbitpimp: Take a look at the two success stories links, especially the Cognitect one.
14:34arrubinI actually know of an even better example. One moment.
14:34bitpimp@arrubin cool
14:37bitpimp@arrubin roomkey is pretty tight, too.
14:38arrubinhttp://gotocon.com/chicago-2013/presentation/Lisp%20and%20Cancer
14:38arrubinHe gave the talk at another conference before, but I cannot find a good video.
14:40bitpimp@arrubin that's a fantastic link for me, bc I work at a company that does so-called big data stuff (in spark/hadoop/storm/etc) and so this is more similar
14:42arrubinYou could also look over the talks from the last few years at Clojure/conj and Clojure West and find other examples.
14:42arrubinhttps://www.youtube.com/watch?v=6xlyWjqFDWs&amp;index=18&amp;list=PLZdCLR02grLoc322bYirANEso3mmzvCiI
14:43arrubinI have not watched that, but it seems relevant.
14:44bitpimp@arrubin this weekend's clojurescript foray is the result of having to get deeper into angular for a front-end, for an Spark prediction engine for infections in hospitals
14:44arrubinInteresting.
14:44bitpimpI'm not particularly enjoying Angular, partly bc I'm not a front-end dev
14:44arrubinYeah, I do not like to get involved in front-end work.
14:44bitpimp@arrubin but the cancer project link is helpful being in healthcare as well
14:45bitpimp@arrubin if I can use clojure for the front-end though it might be more tolerable
14:45arrubinPerhaps. I have not tried it.
14:47arrubinbitpimp: https://www.youtube.com/watch?v=s8P3GQI1iQA&amp;list=PLZdCLR02grLp__wRg5OTavVj4wefg69hM&amp;index=7
14:47bitpimp@arrubin oh man, that is sweet
14:48bitpimp@arrubin perfect
15:00kungi /query #clojure-emacs
15:01kungim(
15:10whompis there any good documentation on working with 2 or more dimensional sequences in clojure? problems like http://www.4clojure.com/problem/138 have me wanting to go imperative
15:13justin_smithwhomp: you can use arrays in clojure, and if the arrays don't leave the body of your function (eg. they are only used internally, and all inside one thread) your code is still functional.
15:14justin_smithwhomp: that said, you can usually figure out something good using recursion and / or update-in for nested sequences
15:15justin_smithalso, that's a hard problem
15:15justin_smith(in clojure especially)
15:19egogiraffeas a little side to talking about multi-dimensional sequences like that, i was recently spending time thinking about how to best/most idiomatically implement a game board for a game i'm writing in clojure. obviously my mind first went to well, 2d array, but ended up getting passed that to thinking about it as a map keyed by row col position, with the value being the relevant information about the piece
15:19kwladykai have special file console_draw.clj which i use to debug app, this file "translate" data into graphical form to be more human readable. It is not part of "src" and not part of "test". What i know i should put this file into something like "dev" folder and add this folder into dev profile in project.clj? Yes?
15:19egogiraffeoccupying it. is this a reasonable approach, in people's opinions?
15:20kwladykaIf yes i added in project.clj :profiles {:dev {:source-path "dev"}} but when i have open this file in intellij it has marked as error everything
15:20kwladykain this file
15:20justin_smithegogiraffe: with nested vectors you can easily do indexed lookup with get-in
15:20kwladykawhat am i doing wrong?
15:21whomphey my computer crapped out right after i asked my question, did anyone post anything about resources for multi-dimensional stuff?
15:21justin_smithkwladyka: the proper key is :source-paths
15:22justin_smithwhomp: we have core.matrix for matrix stuff, or you can use get-in / update-in with nested vectors, or you can use mutable arrays, your code is still functional if they don't leave the thread or function scope
15:23whompjustin_smith, cool thx :)
15:23egogiraffejustin_smith: hm, yeah, i had also thought about nested vectors, was just reading the chapter on collections in JoC. i might end up going either way, or both ways, in writing it, since it's largely exploring writing something larger in clojure, have only put together a few tiny toys thus far.
15:24kungiDoes anyone of you know emacs and helm and cider a bit and would like to help me write "helm-cider-history"? I am currently very much stuck.
15:24justin_smith,(get-in [[1 2 3][4 5 6][7 8 9]] [1 1])
15:24clojurebot5
15:24justin_smith,(update-in [[1 2 3][4 5 6][7 8 9]] [1 1] + 42)
15:25clojurebot[[1 2 3] [4 47 6] [7 8 9]]
15:25kwladykajustin_smith, with :source-paths it doesn't work too
15:25kwladykato be more precise, i am using this file only in repl for now if it changes something
15:25justin_smithkwladyka: also the arg needs to be in a vector
15:25justin_smith:source-paths ["dev"]
15:36kwladykaintellij say "file console_draw.clj is not under a source root
15:36kwladykaand "add source root" "add test root"
15:41kwladykaand another question namespace of this file should be dev.console-draw or dev.app-name.console-draw or app-name.console-draw?
15:52arrubinhttps://twitter.com/ieure/status/614130731770617856
15:52arkhrepost ; ) It's good though
15:52kwladykaok it works :)
15:52kwladykathx
17:26rhg135can I use datamoic in a public domain work as long as I don't include any datmoic code, or do I need to hack around sql?
17:54arkhrhg135: yes https://my.datomic.com/downloads/free
17:54rhg135cool, thanks arkh
17:56alchemis7Is there any clojure version of gRPC yet? (http://www.grpc.io/)
18:04mainframer /msg NickServ identify
18:17rs0what are the go-to Clojure libraries these days for creating web services?
18:24wasamasaring, compojure, hiccup, ...
18:25ed-grs0, I'm happy with liberator
18:33rhg135is there any function similar to clojure.core/load, but returns the last form as load-file?
18:36arkhrhg135: read-string, if you slurp from a file ahead of time
18:37rhg135this is on the classpath though
18:37rhg135not an absolute path
18:39arkhdoes 'resource' fit your needs?
18:40rhg135oh right
18:40rhg135you can slurp an url
18:41rhg135thx arkh
18:46rhg135read-string returns the first form arkh
18:49rhg135also this is actual code
19:30Farehi
19:30FareI updated clojure to 1.7.0, and I get weird messages when I try to lein repl
19:31FareCompilerException java.lang.RuntimeException: No such var: user/help, compiling:(/tmp/form-init4536175725656162830.clj:1:11084)
19:31Farealso, lein test works great but lein repl fails to find tools.trace
19:36Farealso, I have a Exception in thread "main" java.io.IOException: File name too long, compiling:(pyjure/desugar.clj:371:25)
19:37Fareline 371 column 25 is a match statement :-(
19:40vasFare: like a regex?
19:40amalloyFare: are you using an encrypted filesystem? if you have very deeply nested lambdas, the classname generated can be too long for your fs to accept; in practice i have only seen this happen to someone on an encrypted filesystem (which does some weirdness that leads to longer filenames)
19:41Farelike core.match
19:41amalloyyes, i expect the macros in core.match would expand to quite a lot of lambdas
19:41Farethe block device is encrypted, but the filesystem doesn't know that.
19:42amalloyyou would think so, but then again a stranger on the internet just guessed that your disk is encrypted
19:55gfredericks~amalloy is a stranger on the internet
19:55clojurebotRoger.
19:56amalloygfredericks: i have some candy if you want
19:57gfredericksamalloy: I'm not worried all I have to do is never tell you my last name or what state I live in
19:57amalloyalso stay out of chat rooms
19:58gfredericksa/s/l
19:59amalloythose were the days
20:00gfredericksnow it's s/l/a/c/k
20:01gfrederickswhich looks similar if you squint
20:02Fareit's not that hard to guess that a disk is encrypted. A lot of developers encrypt their disk. Beware the post hoc ergo propter hoc fallacy.
20:03FareI'll just suppose that clojure 1.7 + core.match makes AOT unhappy because of long function names, without any interference with block device encryption, which seems preposterous.
20:04YeffGoldblumWhat does everyone develop on besides emacs? (If anything...haha)
20:05Fareouch, AOT seems to hate UTF-8 characters in function names :-(
20:05SeyleriusYeffGoldblum: Emacs is the only thing worth developing on.
20:05Fareis that new with clojure 1.7 ? I hadn't noticed before, but then again, lein repl was not using AOT
20:06rs0meanwhile, in the 21st century, lots of people like Cursive
20:06amalloyrs0: dogma is more exciting than pragmatism, alas
20:06amalloyFare: no
20:06Farereal hackers don't use emacs — they use unxz to reduce the amount of typing needed.
20:06SeyleriusExcept it's proprietary, and you can duplicate most if not all of its features in Emacs.
20:09rs0let's not pretend that setting up vim or emacs to have a subset of IDE features is anything other than an ordeal
20:10rs0to rich hickey's point, when you tell someone "oh just use emacs," you're handing them a soldering iron
20:11SeyleriusI like my soldering iron, thank you very much.
20:12amalloySeylerius: you're entitled to like your soldering iron. i do too. but it's also not very helpful to tell people that using anything else makes you not a real programmer
20:12SeyleriusFair enough.
20:13SeyleriusThey're still real programmers. They're just in proprietary-ville.
20:13rs0it's not even a very good text editor. it gives you RSI
20:14rs0fervent emacs fandom correlates like nothing i've ever seen with carpal tunnel syndrome
20:17uptownhashtag assumes facts not in evidence
20:17rs0http://www.emacswiki.org/emacs/RepeatedStrainInjury
20:17rs0http://ergoemacs.org/emacs/emacs_hand_pain_celebrity.html
20:19uptownso, you know, _2_, circa 20 years ago.
20:19vasI have a datomic key that I copied to my box but it is not working with gpg. Is it not the correct way to scp a credentials.clj.gpg over? does it need to be generated on the box?
20:28whomphow can i mutate a transient list? i tried (set! i new-val list) but no dice
20:28rs0whomp: that's not what set! is for
20:28Seyleriuswhomp: Try assoc!
20:28whompthx guys :)
20:28rs0whomp: you basically write code using persistent collections and then change assoc to assoc! and so on
20:28rs0conj becomes conj!
20:28whompok cool
20:29rs0remember that you have to use the return value
20:29rs0just like with persistent collections
20:29rs0it's not like an ArrayList or something where update operations just return 'void'
20:30Seyleriusrs0: Do you /have/ to use the return value, or is it simply that it /does/ return the collection?
20:31rs0Seylerius: you /have/ to
20:31SeyleriusBecause if you have to, how is it mutating anything
20:31rs0Seylerius: a conj! on a transient vector may allocate a new array, and only the returned transient will reference it
20:32rs0Seylerius: try it for yourself. conj! stuff in-place to a transient. it'll grow to about 8 or 16 elements and then silently drop everything after that
20:32SeyleriusWow.
20:32SeyleriusWhat's the point of being able to mutate it, then?
20:32rs0Seylerius: take it from someone who's done it https://github.com/rschmitt/dynamic-object/commit/60cfe0d289d71fa7e9acedf0cab98828b18be3d5
20:33rs0Seylerius: because it's about an order of magnitude faster to build up a new collection from elements
20:33SeyleriusAh, speed. Okay, that's a valid reason.
20:33SeyleriusAnd then mess with it like normal once you've speed-built it
20:33Seylerius?
20:34rs0Seylerius: yeah. ArrayList works the same way internally when its buffer fills up, it just encapsulates the reallocate-and-copy
20:34amalloySeylerius: transients don't promise to mutate; rather, they don't promise *not* to mutate
20:34rs0Seylerius: i've written a handy dandy Java wrapper for clojure's persistent and transient collections https://github.com/rschmitt/collider
20:35rs0in case you like java... or your employer does
20:36rs0but if you look at the Transient wrappers, they encapsulate this stuff and just return void
20:36rs0amalloy: transients also used to enforce thread-local usage
20:36rs0amalloy: they put a stop to that in clojure 1.7 for performance reasons
20:37rs0and also because there are legitimate and safe reasons to use a transient from more than one thread
20:38irctc1901Why is there an arity-1 equality? Has anyone here ever used it?
20:38rs0irctc1901: does it return a transducer?
20:39irctc1901no
20:39SeyleriusInteresting. So spool memory-intensive colls up through transients, then use normal functions and let them accidentally get turned into persistents?
20:40rs0Seylerius: accidentally?
20:41SeyleriusHeh. Just as a matter of using coll-producing functions.
20:41SeyleriusLike map it or something.
20:42irctc1901rs0: is Seylerius comment related to mine
20:42rs0,(doc =)
20:42Seyleriusirctc1901: Unlikely.
20:42clojurebot"([x] [x y] [x y & more]); Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value, not an identity, comparison."
20:42rs0,(source =)
20:42clojurebotSource not found\n
20:43rs0irctc1901: weird. it just returns 'true' for all values of x
20:43rs0irctc1901: oh, i know why
20:43rs0irctc1901: it's for reduction
20:43irctc1901give me a 5 word description?
20:44rs0hm, maybe not. i don't know!
20:44irctc1901ok, interesting, thanks!
20:44amalloyirctc1901: honestly it should have a 0-arity version too, which should also be true
20:45rs0amalloy: that's what i was thinking, vis-a-vis reducing functions
20:45amalloyso you can write stuff like (apply = coll) to see if all items in the coll are the same
20:45rs0irctc1901: it was specifically added by rich himself in commit c4d6cb54b923f71bf80755ccb7fbbc62d0891a0e
20:45irctc1901bam fantastic example, I understand now
20:46irctc1901can/should I submit a pull req for that (now that you've mentioned it)
20:46irctc1901(and perhaps a mention of this usage in the doc string....applying to colls)
20:47amalloyno, it will never happen unless rich himself decides to do it on his own. it's not a new suggestion
20:47rs0irctc1901: i dunno, you can define a monoid over the booleans in at least two useful different ways
20:48rs0irctc1901: (true, and) and (false, or)
20:48amalloyrs0: right, but...so what? true is still the identity for =
20:48amalloyjust like ##(every? even? []) is true
20:48lazybot⇒ true
20:49rs0hm, and the identity for not= would be false?
20:51amalloyright
20:51amalloy"are any of the elements in this empty collection different from one another? no"
20:54tomjackwhat does "identity for =" mean?
20:55rs0tomjack: for all values of xs, (apply = xs) is equals to (= true (apply = xs))
20:55rs0i think that's basically the gist of it
20:56rs0it's like how 1 is the identity for multiplication
20:56rs0and 0 is the identity for addition
20:57bitpimpflappy bird, running: check!
20:57tomjackinteresting
20:57bitpimpvery cool.
20:58bitpimpfigwheel rocks.
20:58amalloywell, "identity for =" is certainly the wrong wording
21:02mcint__wrong? Unfamiliar or unusual, but isn't = just another function (in the context of clojure)
21:02mcint__it holds no priviledged place in syntax
21:02gfrederickshe's probably saying "identity" as used in algebra doesn't really fit here
21:02gfrederickslike when talking about a monoid
21:03mcint__ok, I see the language mismatch
21:04amalloyidentity for = would mean that (= true x) is the same as x
21:04amalloythish is only true for the two values true and false
21:11mcint__so, since ='s input and output domain don't match, you could only call it an identity for inputs restricted to {true, false}
21:11mcint__...actually, not even that
21:11mcint__(= false) => true ? no?
21:12tomjackI guess the rule is "push negation under quantifiers", and then whether true or false is 'the identity' depends on whether the resulting quantifier is ∀ or ∃ ?
21:14gfredericksfor monoids the identity is returned by the 0-arg arity, but ##(=)
21:14lazybotclojure.lang.ArityException: Wrong number of args (0) passed to: core/=
21:15tomjackso (not<=) is false, (>) is true, but otherwise not<= and > agree? :)
21:18mcint__gfredericks: as amalloy has said, true is not an/the identity for =
21:19gfredericksyeah I was just saying another thing
21:20mcint__ok, and by extension, saying that the language Is doing the correct thing now for 0-arity
21:21amalloygfredericks: too late. you're now stuck in this conversation. everything you say for the rest of your life will be interpreted in the context of the identity element for =
21:21gfredericksis this an identity crisis?
21:22gfredericks(= this identity-crisis)?
21:23tomjackI don't think I had ever heard of clojure/boot.clj
21:23rs0tomjack: yeah, they changed the name to core.clj
21:24tomjackI guess (=) disappeared in the same commit as boot.clj?
21:24rs0was there ever a 0-arity variant?
21:25tomjackuhh, doesn't the c4d6cb54b923f71bf80755ccb7fbbc62d0891a0e you pointed out contain them?
21:25mcint__(and how are you performing your search? git log -S ??)
21:26tomjackyeah, I tried `git log -p -S '([x] true)'` but failed to find when it disappeared
21:27tomjackoh, d'oh. I knew I was confused :)
21:27rs0git blame **/core.clj
21:27rs0the commit i referenced just adds 1-arity variants. i didn't say anything about 0-arity variants
21:27tomjack([x] true) is 1-ary, not 0-ary...
21:41gfredericksjust to make the conversation more confusing I should point out that ##(- 42)
21:41lazybot⇒ -42
21:46bitpimpcan anyone direct me to an example of actual clojure code from a large scale project? not clojure libraries, but rather, the kind of code used on something along the lines of roomkey or soundcloud or the like. I'm curious to see how it ends up looking once you move beyond tutorial code.
21:47bitpimpobviously, those are closed projects, which why I'm asking for something equivalent and representative.
21:48bitpimplanguages like java look messy partly because of the inherent messiness of the domains, and I want to see how much clojure mitigates that.
21:49bitpimpalso, how intelligible it is… huge java names can be helpful in messy domains, horrible as they are.
21:53rs0bitpimp: i don't think they're directly comparable. for starters, a Clojure code base will typically be quarter or a fifth the size of the functionally equivalent Java code base, in terms of lines of code
21:54rs0bitpimp: furthermore, Clojure places a heavy cultural and technical emphasis on reuse and composition
21:56rs0bitpimp: here's an example that comes to mind of weirdly readable Clojure code that solves a very, very hard problem https://github.com/krajj7/BotHack/tree/master/src/bothack
21:57rs0bitpimp: in a highly complicated domain
21:57rs0i think this was written over the course of a year as part of a master's thesis
21:58rs0it's the most Clojure code i've ever seen in one place (non-library)
22:02rs017k lines, according to a quick line count. you could credibly claim that the Java equivalent of this code would be at least 70,000 lines, which puts it roughly in the same order of magnitude as Tomcat's servlet container implementation. large-scale enough?
22:05amalloycool, i didn't realize there was a video of the ascension
22:07uptownwhat's the toughest problem that core.logic has been applied to? anyone got an interesting link?
22:12gfredericksuptown: I used it for the 2d layouts of http://gfredericks.com/gfrlog/98
22:13gfredericksI don't think I've ever heard of it being used for something serious in a really compelling way
22:14uptowngfredericks: thanks, interesting
23:06virmundihello. is Midje still in vogue?
23:11amalloyit's as vague as it's always been
23:11justin_smithit remains controversial
23:32justin_smith,(defn h [] (->> 'clojure.core ns-publics keys shuffle (take 2) (#(str (first %) '-in- (second %))) symbol))
23:32clojurebot#'sandbox/h
23:32justin_smith,(repeatedly h)
23:32clojurebot(fn-in-pmap frequencies-in-constantly push-thread-bindings-in-reductions my-doc-in-re-matcher unchecked-dec-in-butlast ...)
23:33justin_smiththat last one sounds saucy
23:33justin_smithunchecked? you rogue you
23:33justin_smith,(repeatedly h)
23:33clojurebot(error-mode-in-keyword? complement-in-print-dup ns-in-aset-short set-error-mode!-in-reset-meta! reader-conditional?-in-dorun ...)
23:34bitpimp@rs0 thanks! I'll take a look at that code. I understand clojure is definitely smaller in size. I'm just curious how it looks when it gets used on real life junk like a lot of Java does (transactional processing of employee records or so on)… roomkey would probably involve a lot of that. but I'm super interested in the link you sent… thanks!
23:45crocketyahoo