#clojure log - Jul 18 2015

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

1:58 crocket: Is there a way to write https://www.refheap.com/106683 better?

2:00 I mean https://www.refheap.com/106684

2:03 fungle: i 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

2:04 Retrieving org/clojure/clojure/1.7.0/clojure-1.7.0.pom from central

2:04 Retrieving org/clojure/clojure/1.7.0/clojure-1.7.0.jar from central

2:04 Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: create in this context, compiling:(/tmp/form-init3567741596872273906.clj:4199:33)

2:51 crocket: How do I check whether a channel is closed without using <! or <!!?

2:51 <! is already used in a go-loop

2:53 It seems only one thread can take a value from a channel at a time.

2:55 Does clojure.core.async have 'closed?' function?

3:36 hi

3:36 I have a sequence of async channels.

3:36 How do I detect if any of them emits a value?

5:35 How do I disable ANSI colors in rotor-appender in timbre?

5:37 Tell me

6:22 maeGh4Ch: So... 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.

6:23 So it makes me think the wiki describes the old version of om. I've tried googling stuff related to "om next", but got nothing.

6:53 wasamasa: if 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

8:28 zophy: can 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 ?

8:29 simply illustrated: "java -cp clojure.jar clojure-compile-and-run code.clj"

9:24 puredanger: Clojure 1.8.0-alpha2 is out https://groups.google.com/d/msg/clojure/LT7vDT6fWxA/OGkR5j3Y3yAJ

9:32 justin_smith: crocket: about the async channels - you can make a mult on one and tap it, the mult will get the same input the channel did

9:48 crocket: justin_smith, a mult?

9:52 justin_smith, Do I have to close a mult separately from tapped channels?

9:52 What happens to a mult when tapped channels close?

9:59 * dysfun only just noticed clojure 1.7 was out

9:59 * dysfun wonders how many libraries will make use of feature expressions for cross-compiler portability

10:01 puredanger: many libs have already been rewritten to use cljc files and reader conditionals

10:01 so: many

10:01 dysfun: i've been holding on on using them in a few of mine

10:01 puredanger: it requires clojure 1.7 as a min bar so it's happened faster than I expected

10:02 dysfun: i bet midje isn't one though

10:04 puredanger: prob not

10:04 dysfun: and it's not :/

10:09 crocket: What is feature expression?

10:09 dysfun: er, we're calling them reader conditionals i think. feature expressions is the lisp name

10:09 crocket: What is it?

10:09 dysfun: but they're reader macros to allow you to provide different code to different compilers (e.g. clojure and clojurescript)

10:10 puredanger: http://dev.clojure.org/display/design/Reader+Conditionals

10:10 http://danielcompton.net/2015/06/10/clojure-reader-conditionals-by-example

10:13 crocket: Woohoo!!!

10:13 dysfun: i'm looking forward to having a lot more clojurescript libraries available

10:15 crocket: Can I just plug clojure 1.7 in cider and existing projects?

10:19 justin_smith: crocket: yes, you can make cider use whichever clojure version you like

10:19 except maybe not some of the really old ones...

10:21 crocket: good

10:21 justin_smith, I just want to be notified of closed channels.

10:21 The channels are used somewhere else.

10:22 justin_smith: crocket: 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:22 I guess

10:23 but why does someone who isn't reading from the channel need to know if it is closed?

10:23 maybe the one sending to the channel should do something special when it is done, instead?

10:27 crocket: The channels signal DDNS updates.

10:28 If any channel is closed, it means there is a problem, so I need to close the program.

10:28 When any DDNS updater throws an exception, I should close the associated channel.

10:28 justin_smith: crocket: whoever is reading from the channel is in a loop, right?

10:29 crocket: if so, when the channel closes, it should exit the loop, then send the message that triggers the apropriate notification or recovery

10:29 who better than the one using the channel to trigger some action if the channel closes

10:29 crocket: justin_smith, https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L48

10:30 I currently use another channel to be notified.

10:30 justin_smith, https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L136 is where the program exits.

10:31 justin_smith: crocket: 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:31 crocket: turn the when-let into an if-let

10:31 the other arm of the if can send to one of the alarms

10:32 crocket: and?

10:33 justin_smith, The else clause is executed when chimes is closed.

10:33 justin_smith: crocket: 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:33 crocket: line 30 - that's the only good place to detect the channel close isn't it?

10:33 there's no else clause there

10:34 crocket: justin_smith, If chimes channel is closed, the go-loop exits.

10:34 go-loop itself returns a channel that signal its exit.

10:34 justin_smith: crocket: what I am saying is if you care about that channel closing, do something about it right there

10:35 crocket: like?

10:35 https://github.com/crocket/clj-ddns-client/blob/master/src/clj_ddns_client/core.clj#L136 needs to be changed, too.

10:35 justin_smith: OK, so when the go loop exits you get a nil on :updater-ch which is read in -main

10:35 so that means you are detecting closed channels

10:36 what else do you need then?

10:36 crocket: I want to use only :chimes channels to detect close.

10:36 I want to use only :chimes channels to detect close in -main

10:36 However, the go-loops read from chimes channels already.

10:37 If I read chimes from -main, -main will compete with go-loops for :chimes.

10:37 justin_smith: crocket: that's when you need a mult, if you need to read the same channel more than one place

10:37 crocket: This means -main and go-loops read :chimes alternately.

10:37 justin_smith: if the original is closed, all the mults from it are too

10:37 crocket: I am not familiar with mult yet.

10:38 justin_smith: then familiarize yourself - wasn't mult the first thing I suggested?

10:38 crocket: Can I read directly from a mult?

10:38 justin_smith: it returns a new channel that gets all the messages the original does

10:38 crocket: What the hell is tap, then?

10:38 justin_smith: crocket: you create a mult, you make things send to the mult

10:38 crocket: I just need to read from a mult.

10:38 justin_smith: then you use tap, and read from the channels returned from tap

10:38 no, you tap a mult

10:39 the thing returned from mult is what should be written to

10:39 then you use tap to get channels you can read from

10:39 off of the mult

10:39 I was being a bit sloppy talking about it before, sorry, I had assumed you would look it up and figure it out

10:39 crocket: Does it means that chime-ch should use a mult channel in the first place?

10:39 justin_smith: right

10:39 crocket: I read about it.

10:40 But, I am too sleepy.

10:40 justin_smith: bbl, reading a book

10:41 crocket: It's weird.

10:41 I create a channel, create a mult from it, and tap the mult to create a new channel.

10:42 justin_smith: crocket: you don't need the initial channel

10:42 make a mult from the channel, send to the mult, use tap to create the channels you will be reading

10:42 dysfun: justin_smith: an ebook though, right? we wouldn't want you walking away from a screen ;)

10:43 justin_smith: dysfun: actual book!

10:43 dysfun: like made of dead tree and everything?

10:43 justin_smith: yeah, I know, it's barbaric

10:43 dysfun: it is, but you won't notice until you decide to move house/apartment

10:47 crocket: justin_smith, Why do you waste the original channel?

10:47 doesn't make sense

10:54 justin_smith, Do you usually read directly from a mult?

11:00 It seems I better not use a mult now.

11:01 kungi: justin_smith: actual book is the best kind of book! :-)

11:03 Can someone help me in making this code sinppet a bit more readable: https://gist.github.com/Kungi/19ffc88c4f1acf40f1c5

11:06 dysfun: why do you want them as keywords?

11:06 kungi: dysfun: why not?

11:06 dysfun: well keywords are usually used where you're going to provide what is essentially a known string key

11:07 i'd just leave them as integers for the keys

11:07 ,(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:07 clojurebot: {2 :SITE-ADMIN, 3 :SITE-ADMIN}

11:08 dysfun: otherwise you're going to have to turn all your id numbers into keywords before you look them up

11:09 kungi: dysfun: I actually do this. But the result is only used in one location.

11:09 dysfun: seems 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:10 kungi: dysfun: using integers makes more sense. I will refactor this. Thank you! :-)

11:10 dysfun: yw :)

11:11 crocket: Ok, I got the hang of mult.

11:16 kungi: dysfun: This is so much more pleasant to read.

11:17 dysfun: kungi: well it only does the necessary work :)

11:17 clojure's collection functions are your friend, and there are lots of them to help shorten your code

11:17 http://conj.io/ is a good reference

11:20 crocket: hell

11:20 clojure 1.7 rocks.

11:21 puredanger: How so?

11:40 crocket: It just does.

11:40 justin_smith, In clojure 1.7.0, the original channel should be written to, and the tapped channels should be read from.

11:40 The mult is not needed after creating taps.

11:41 puredanger: Oh, well no argument from me :)

11:43 crocket: Can clojure be used as an embedded language?

11:45 I want to just add clojure scripts to any JVM program on the run.

11:45 dysfun: there's even a library that injects a clojure repl into your process :)

11:47 crocket: no

11:47 dysfun: clojure is just a library, you can do whatever you'd do with a library

11:47 crocket: xchat has python script modules.

11:48 I wonder if I can add clojure script modules to a JVM program.

11:48 justin_smith: crocket: the clojure language is a java library, and cannot be used in the jvm without the full clojure compiler

11:49 crocket: you can include clojure in a java project, but that requires the full language

11:49 crocket: ok

11:49 If I include the full compiler, can I add clojuer script modules to JVM programs?

11:51 dysfun: why wouldn't you be able to?

11:52 crocket: Is there a pre-existing library for that?

11:52 justin_smith: crocket: 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:53 dysfun: crocket: yes, i wrote one https://github.com/irresponsible/oolong

11:53 justin_smith: crocket: clojure.java.api http://clojure.github.io/clojure/javadoc/clojure/java/api/package-summary.html

11:54 dysfun: loading bits of code at runtime is not as straightforward as you might think, there are all sorts of gotchas

11:54 justin_smith: dysfun: wait, how is oolong related to using clojure from java?

11:55 amalloy: justin_smith: you don't think crocket meant cljs on the jvm?

11:55 dysfun: justin_smith: it's not, it's related to the other thing he said, having scripts

11:55 justin_smith: OK, maybe I don't understand what you guys mean by scripts

11:55 amalloy: oh, maybe...

11:57 dysfun: justin_smith: plugins need some sort of way of obtaining resources in a dependency-driven fashion. oolong solves that part

11:58 and i might one day get around to finishing it's big sister library which supports loading plugins packaged as jars

13:18 bitpimp_: brew is installing leiningen 2.5.0… good version?

13:20 justin_smith: bitpimp_: it's OK, but it's a bit silly to use brew for lein

13:20 bitpimp_: lein is a single shell script, and is better at managing deps than brew is

13:20 bitpimp_: ah ok… felt a little guilty, to be honest.

13:20 I'll install it the proper way then.

13:20 scriptor: yeah, it's more straightforward to just put the lein script in some place you control

13:20 justin_smith: bitpimp_: lein knows how to upgrade itself, yeah

13:20 exactly

13:21 bitpimp_: 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:22 tall order, given my lack of knowledge, by hey, it's still just Saturday.

13:22 justin_smith: bitpimp_: cool - if you are replacing angualr I assume you'll be using cljs?

13:22 bitpimp_: that was the plan.

13:22 justin_smith: bitpimp_: if so, definitely check out figwheel and reagent

13:22 it's a pretty slick setup once it's working

13:22 bitpimp_: cool… was thinking of reagent. don't tell Alan.

13:22 justin_smith: heh

13:38 bitpimp_: I just think I can possibly sell my company on React instead of Angular to start, but not a non-React approach.

13:38 justin_smith: bitpimp_: react is so much better than the other options...

13:39 bitpimp_: oh totally… looking forward to it. just that the next step in this set of stairs is 10' tall. ;-)

13:45 kavkaz: Hey 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:47 So 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:56 arrubin: kavkaz: There are always the Kaggle challenges.

13:56 This book is available: http://www.amazon.com/Clojure-Machine-Learning-Akhil-Wali/dp/1783284358

13:56 I do not believe that Clojure is a popular option for this though.

13:57 kavkaz: arrubin: Hmm... interesting. What would you say is a popular option for this?

13:57 arrubin: Should be able to use things like Spark though.

13:57 kavkaz: Python, at least for initial implementation.

13:57 kavkaz: arrubin: I see.

13:58 arrubin: I am not trying to dissuade you from using Clojure for this.

13:58 http://www.mikeivanov.com/post/116884531461/machine-learning-with-clojure-and-spark-using

13:58 Clearly people are doing it.

13:58 But it is nowhere near as popular as things like Python.

14:00 kavkaz: arrubin: 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:00 recognize the syntax of the tokens?

14:00 justin_smith: machine learning, AKA statistics

14:01 (OK, that might be a bit unfair)

14:01 bitpimp: what is the site Jon Pither was part of building, again? the real estate site?

14:02 arrubin: kavkaz: 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:03 justin_smith: kavkaz: we have tools in clojure that parse and analyze clojure syntax

14:03 kavkaz: 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:04 kavkaz: so objectively this is much easier than the java equivalent would be

14:05 kavkaz: unless you mean you have to accept java input? not sure what your task is here

14:06 kavkaz: I input a Java class. The code is tokenized, and I identify the methods within the class, their arguments, their return value

14:08 justin_smith: you want a java paraser then, there's probably a good java one that you could use from clojure

14:08 arrubin: There are standard libraries for accessing the Java compiler and walking the AST and such.

14:08 In Java that is.

14:08 justin_smith: kavkaz: what about using the compiled code? we have good tools for working with the bytecode

14:08 and getting things like method calls, arguments, return types

14:09 kavkaz: justin_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:20 justin_smith, arrubin, thank you both! I will look more into what I can do with clojure.

14:21 arrubin: bitpimp: OnTheMarket.com?

14:21 justin_smith: kavkaz: I could easily see trying to parse both java and c# with the same code turning into a much harder problem than anticipated

14:22 bitpimp: or rightmove.co.uk?

14:22 just wanted to show someone a successful clojure project, and just watched his talk.

14:23 arrubin: bitpimp: https://uk.linkedin.com/pub/jon-pither/1/649/393

14:24 He claims to have completed a few projects in Clojure.

14:24 I believe that Room Key uses Clojure.

14:24 I know there are others.

14:24 People are not very loud about it.

14:25 http://dev.clojure.org/display/community/Clojure+Success+Stories

14:25 http://cognitect.com/clojure#successstories

14:28 kavkaz: justin_smith: Yep. Could you see yourself doing this in Clojure though?

14:29 arrubin: kavkaz: If it makes a difference, Clojure runs on both the JVM and the CLR.

14:33 bitpimp: @arrubin onthemarket.com… you were right.

14:33 @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:34 arrubin: bitpimp: Take a look at the two success stories links, especially the Cognitect one.

14:34 I actually know of an even better example. One moment.

14:34 bitpimp: @arrubin cool

14:37 @arrubin roomkey is pretty tight, too.

14:38 arrubin: http://gotocon.com/chicago-2013/presentation/Lisp%20and%20Cancer

14:38 He gave the talk at another conference before, but I cannot find a good video.

14:40 bitpimp: @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:42 arrubin: You could also look over the talks from the last few years at Clojure/conj and Clojure West and find other examples.

14:42 https://www.youtube.com/watch?v=6xlyWjqFDWs&index=18&list=PLZdCLR02grLoc322bYirANEso3mmzvCiI

14:43 I have not watched that, but it seems relevant.

14:44 bitpimp: @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:44 arrubin: Interesting.

14:44 bitpimp: I'm not particularly enjoying Angular, partly bc I'm not a front-end dev

14:44 arrubin: Yeah, I do not like to get involved in front-end work.

14:44 bitpimp: @arrubin but the cancer project link is helpful being in healthcare as well

14:45 @arrubin if I can use clojure for the front-end though it might be more tolerable

14:45 arrubin: Perhaps. I have not tried it.

14:47 bitpimp: https://www.youtube.com/watch?v=s8P3GQI1iQA&list=PLZdCLR02grLp__wRg5OTavVj4wefg69hM&index=7

14:47 bitpimp: @arrubin oh man, that is sweet

14:48 @arrubin perfect

15:00 kungi: /query #clojure-emacs

15:01 m(

15:10 whomp: is 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:13 justin_smith: whomp: 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:14 whomp: that said, you can usually figure out something good using recursion and / or update-in for nested sequences

15:15 also, that's a hard problem

15:15 (in clojure especially)

15:19 egogiraffe: as 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:19 kwladyka: i 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:19 egogiraffe: occupying it. is this a reasonable approach, in people's opinions?

15:20 kwladyka: If 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:20 in this file

15:20 justin_smith: egogiraffe: with nested vectors you can easily do indexed lookup with get-in

15:20 kwladyka: what am i doing wrong?

15:21 whomp: hey my computer crapped out right after i asked my question, did anyone post anything about resources for multi-dimensional stuff?

15:21 justin_smith: kwladyka: the proper key is :source-paths

15:22 whomp: 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:23 whomp: justin_smith, cool thx :)

15:23 egogiraffe: justin_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:24 kungi: Does 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:24 justin_smith: ,(get-in [[1 2 3][4 5 6][7 8 9]] [1 1])

15:24 clojurebot: 5

15:24 justin_smith: ,(update-in [[1 2 3][4 5 6][7 8 9]] [1 1] + 42)

15:25 clojurebot: [[1 2 3] [4 47 6] [7 8 9]]

15:25 kwladyka: justin_smith, with :source-paths it doesn't work too

15:25 to be more precise, i am using this file only in repl for now if it changes something

15:25 justin_smith: kwladyka: also the arg needs to be in a vector

15:25 :source-paths ["dev"]

15:36 kwladyka: intellij say "file console_draw.clj is not under a source root

15:36 and "add source root" "add test root"

15:41 and another question namespace of this file should be dev.console-draw or dev.app-name.console-draw or app-name.console-draw?

15:52 arrubin: https://twitter.com/ieure/status/614130731770617856

15:52 arkh: repost ; ) It's good though

15:52 kwladyka: ok it works :)

15:52 thx

17:26 rhg135: can 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:54 arkh: rhg135: yes https://my.datomic.com/downloads/free

17:54 rhg135: cool, thanks arkh

17:56 alchemis7: Is there any clojure version of gRPC yet? (http://www.grpc.io/)

18:04 mainframer: /msg NickServ identify

18:17 rs0: what are the go-to Clojure libraries these days for creating web services?

18:24 wasamasa: ring, compojure, hiccup, ...

18:25 ed-g: rs0, I'm happy with liberator

18:33 rhg135: is there any function similar to clojure.core/load, but returns the last form as load-file?

18:36 arkh: rhg135: read-string, if you slurp from a file ahead of time

18:37 rhg135: this is on the classpath though

18:37 not an absolute path

18:39 arkh: does 'resource' fit your needs?

18:40 rhg135: oh right

18:40 you can slurp an url

18:41 thx arkh

18:46 read-string returns the first form arkh

18:49 also this is actual code

19:30 Fare: hi

19:30 I updated clojure to 1.7.0, and I get weird messages when I try to lein repl

19:31 CompilerException java.lang.RuntimeException: No such var: user/help, compiling:(/tmp/form-init4536175725656162830.clj:1:11084)

19:31 also, lein test works great but lein repl fails to find tools.trace

19:36 also, I have a Exception in thread "main" java.io.IOException: File name too long, compiling:(pyjure/desugar.clj:371:25)

19:37 line 371 column 25 is a match statement :-(

19:40 vas: Fare: like a regex?

19:40 amalloy: Fare: 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:41 Fare: like core.match

19:41 amalloy: yes, i expect the macros in core.match would expand to quite a lot of lambdas

19:41 Fare: the block device is encrypted, but the filesystem doesn't know that.

19:42 amalloy: you would think so, but then again a stranger on the internet just guessed that your disk is encrypted

19:55 gfredericks: ~amalloy is a stranger on the internet

19:55 clojurebot: Roger.

19:56 amalloy: gfredericks: i have some candy if you want

19:57 gfredericks: amalloy: I'm not worried all I have to do is never tell you my last name or what state I live in

19:57 amalloy: also stay out of chat rooms

19:58 gfredericks: a/s/l

19:59 amalloy: those were the days

20:00 gfredericks: now it's s/l/a/c/k

20:01 which looks similar if you squint

20:02 Fare: it'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:03 I'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:04 YeffGoldblum: What does everyone develop on besides emacs? (If anything...haha)

20:05 Fare: ouch, AOT seems to hate UTF-8 characters in function names :-(

20:05 Seylerius: YeffGoldblum: Emacs is the only thing worth developing on.

20:05 Fare: is that new with clojure 1.7 ? I hadn't noticed before, but then again, lein repl was not using AOT

20:06 rs0: meanwhile, in the 21st century, lots of people like Cursive

20:06 amalloy: rs0: dogma is more exciting than pragmatism, alas

20:06 Fare: no

20:06 Fare: real hackers don't use emacs — they use unxz to reduce the amount of typing needed.

20:06 Seylerius: Except it's proprietary, and you can duplicate most if not all of its features in Emacs.

20:09 rs0: let's not pretend that setting up vim or emacs to have a subset of IDE features is anything other than an ordeal

20:10 to rich hickey's point, when you tell someone "oh just use emacs," you're handing them a soldering iron

20:11 Seylerius: I like my soldering iron, thank you very much.

20:12 amalloy: Seylerius: 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:12 Seylerius: Fair enough.

20:13 They're still real programmers. They're just in proprietary-ville.

20:13 rs0: it's not even a very good text editor. it gives you RSI

20:14 fervent emacs fandom correlates like nothing i've ever seen with carpal tunnel syndrome

20:17 uptown: hashtag assumes facts not in evidence

20:17 rs0: http://www.emacswiki.org/emacs/RepeatedStrainInjury

20:17 http://ergoemacs.org/emacs/emacs_hand_pain_celebrity.html

20:19 uptown: so, you know, _2_, circa 20 years ago.

20:19 vas: I 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:28 whomp: how can i mutate a transient list? i tried (set! i new-val list) but no dice

20:28 rs0: whomp: that's not what set! is for

20:28 Seylerius: whomp: Try assoc!

20:28 whomp: thx guys :)

20:28 rs0: whomp: you basically write code using persistent collections and then change assoc to assoc! and so on

20:28 conj becomes conj!

20:28 whomp: ok cool

20:29 rs0: remember that you have to use the return value

20:29 just like with persistent collections

20:29 it's not like an ArrayList or something where update operations just return 'void'

20:30 Seylerius: rs0: Do you /have/ to use the return value, or is it simply that it /does/ return the collection?

20:31 rs0: Seylerius: you /have/ to

20:31 Seylerius: Because if you have to, how is it mutating anything

20:31 rs0: Seylerius: a conj! on a transient vector may allocate a new array, and only the returned transient will reference it

20:32 Seylerius: 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:32 Seylerius: Wow.

20:32 What's the point of being able to mutate it, then?

20:32 rs0: Seylerius: take it from someone who's done it https://github.com/rschmitt/dynamic-object/commit/60cfe0d289d71fa7e9acedf0cab98828b18be3d5

20:33 Seylerius: because it's about an order of magnitude faster to build up a new collection from elements

20:33 Seylerius: Ah, speed. Okay, that's a valid reason.

20:33 And then mess with it like normal once you've speed-built it

20:33 ?

20:34 rs0: Seylerius: yeah. ArrayList works the same way internally when its buffer fills up, it just encapsulates the reallocate-and-copy

20:34 amalloy: Seylerius: transients don't promise to mutate; rather, they don't promise *not* to mutate

20:34 rs0: Seylerius: i've written a handy dandy Java wrapper for clojure's persistent and transient collections https://github.com/rschmitt/collider

20:35 in case you like java... or your employer does

20:36 but if you look at the Transient wrappers, they encapsulate this stuff and just return void

20:36 amalloy: transients also used to enforce thread-local usage

20:36 amalloy: they put a stop to that in clojure 1.7 for performance reasons

20:37 and also because there are legitimate and safe reasons to use a transient from more than one thread

20:38 irctc1901: Why is there an arity-1 equality? Has anyone here ever used it?

20:38 rs0: irctc1901: does it return a transducer?

20:39 irctc1901: no

20:39 Seylerius: Interesting. So spool memory-intensive colls up through transients, then use normal functions and let them accidentally get turned into persistents?

20:40 rs0: Seylerius: accidentally?

20:41 Seylerius: Heh. Just as a matter of using coll-producing functions.

20:41 Like map it or something.

20:42 irctc1901: rs0: is Seylerius comment related to mine

20:42 rs0: ,(doc =)

20:42 Seylerius: irctc1901: Unlikely.

20:42 clojurebot: "([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:42 rs0: ,(source =)

20:42 clojurebot: Source not found\n

20:43 rs0: irctc1901: weird. it just returns 'true' for all values of x

20:43 irctc1901: oh, i know why

20:43 irctc1901: it's for reduction

20:43 irctc1901: give me a 5 word description?

20:44 rs0: hm, maybe not. i don't know!

20:44 irctc1901: ok, interesting, thanks!

20:44 amalloy: irctc1901: honestly it should have a 0-arity version too, which should also be true

20:45 rs0: amalloy: that's what i was thinking, vis-a-vis reducing functions

20:45 amalloy: so you can write stuff like (apply = coll) to see if all items in the coll are the same

20:45 rs0: irctc1901: it was specifically added by rich himself in commit c4d6cb54b923f71bf80755ccb7fbbc62d0891a0e

20:45 irctc1901: bam fantastic example, I understand now

20:46 can/should I submit a pull req for that (now that you've mentioned it)

20:46 (and perhaps a mention of this usage in the doc string....applying to colls)

20:47 amalloy: no, it will never happen unless rich himself decides to do it on his own. it's not a new suggestion

20:47 rs0: irctc1901: i dunno, you can define a monoid over the booleans in at least two useful different ways

20:48 irctc1901: (true, and) and (false, or)

20:48 amalloy: rs0: right, but...so what? true is still the identity for =

20:48 just like ##(every? even? []) is true

20:48 lazybot: ⇒ true

20:49 rs0: hm, and the identity for not= would be false?

20:51 amalloy: right

20:51 "are any of the elements in this empty collection different from one another? no"

20:54 tomjack: what does "identity for =" mean?

20:55 rs0: tomjack: for all values of xs, (apply = xs) is equals to (= true (apply = xs))

20:55 i think that's basically the gist of it

20:56 it's like how 1 is the identity for multiplication

20:56 and 0 is the identity for addition

20:57 bitpimp: flappy bird, running: check!

20:57 tomjack: interesting

20:57 bitpimp: very cool.

20:58 figwheel rocks.

20:58 amalloy: well, "identity for =" is certainly the wrong wording

21:02 mcint__: wrong? Unfamiliar or unusual, but isn't = just another function (in the context of clojure)

21:02 it holds no priviledged place in syntax

21:02 gfredericks: he's probably saying "identity" as used in algebra doesn't really fit here

21:02 like when talking about a monoid

21:03 mcint__: ok, I see the language mismatch

21:04 amalloy: identity for = would mean that (= true x) is the same as x

21:04 thish is only true for the two values true and false

21:11 mcint__: so, since ='s input and output domain don't match, you could only call it an identity for inputs restricted to {true, false}

21:11 ...actually, not even that

21:11 (= false) => true ? no?

21:12 tomjack: I 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:14 gfredericks: for monoids the identity is returned by the 0-arg arity, but ##(=)

21:14 lazybot: clojure.lang.ArityException: Wrong number of args (0) passed to: core/=

21:15 tomjack: so (not<=) is false, (>) is true, but otherwise not<= and > agree? :)

21:18 mcint__: gfredericks: as amalloy has said, true is not an/the identity for =

21:19 gfredericks: yeah I was just saying another thing

21:20 mcint__: ok, and by extension, saying that the language Is doing the correct thing now for 0-arity

21:21 amalloy: gfredericks: 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:21 gfredericks: is this an identity crisis?

21:22 (= this identity-crisis)?

21:23 tomjack: I don't think I had ever heard of clojure/boot.clj

21:23 rs0: tomjack: yeah, they changed the name to core.clj

21:24 tomjack: I guess (=) disappeared in the same commit as boot.clj?

21:24 rs0: was there ever a 0-arity variant?

21:25 tomjack: uhh, doesn't the c4d6cb54b923f71bf80755ccb7fbbc62d0891a0e you pointed out contain them?

21:25 mcint__: (and how are you performing your search? git log -S ??)

21:26 tomjack: yeah, I tried `git log -p -S '([x] true)'` but failed to find when it disappeared

21:27 oh, d'oh. I knew I was confused :)

21:27 rs0: git blame **/core.clj

21:27 the commit i referenced just adds 1-arity variants. i didn't say anything about 0-arity variants

21:27 tomjack: ([x] true) is 1-ary, not 0-ary...

21:41 gfredericks: just to make the conversation more confusing I should point out that ##(- 42)

21:41 lazybot: ⇒ -42

21:46 bitpimp: can 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:47 obviously, those are closed projects, which why I'm asking for something equivalent and representative.

21:48 languages like java look messy partly because of the inherent messiness of the domains, and I want to see how much clojure mitigates that.

21:49 also, how intelligible it is… huge java names can be helpful in messy domains, horrible as they are.

21:53 rs0: bitpimp: 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:54 bitpimp: furthermore, Clojure places a heavy cultural and technical emphasis on reuse and composition

21:56 bitpimp: 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:57 bitpimp: in a highly complicated domain

21:57 i think this was written over the course of a year as part of a master's thesis

21:58 it's the most Clojure code i've ever seen in one place (non-library)

22:02 17k 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:05 amalloy: cool, i didn't realize there was a video of the ascension

22:07 uptown: what's the toughest problem that core.logic has been applied to? anyone got an interesting link?

22:12 gfredericks: uptown: I used it for the 2d layouts of http://gfredericks.com/gfrlog/98

22:13 I don't think I've ever heard of it being used for something serious in a really compelling way

22:14 uptown: gfredericks: thanks, interesting

23:06 virmundi: hello. is Midje still in vogue?

23:11 amalloy: it's as vague as it's always been

23:11 justin_smith: it remains controversial

23:32 ,(defn h [] (->> 'clojure.core ns-publics keys shuffle (take 2) (#(str (first %) '-in- (second %))) symbol))

23:32 clojurebot: #'sandbox/h

23:32 justin_smith: ,(repeatedly h)

23:32 clojurebot: (fn-in-pmap frequencies-in-constantly push-thread-bindings-in-reductions my-doc-in-re-matcher unchecked-dec-in-butlast ...)

23:33 justin_smith: that last one sounds saucy

23:33 unchecked? you rogue you

23:33 ,(repeatedly h)

23:33 clojurebot: (error-mode-in-keyword? complement-in-print-dup ns-in-aset-short set-error-mode!-in-reset-meta! reader-conditional?-in-dorun ...)

23:34 bitpimp: @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:45 crocket: yahoo

Logging service provided by n01se.net