#clojure log - Sep 17 2014

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

0:01 xeqi: well, it sounds like linearizing all the actions using the same session. I'd expect you could do that by building a session-store that locks

0:01 possibly memory-store + extra map from req-key to (Object.) to lock on

0:02 kyun: Would slurp return the lazy string?

0:02 xeqi: though I wouldn't bother unless this was a hard requirement for your system

0:02 mmitchel_: ^

0:02 mmitchel_: xeqi: i see what you mean

0:03 hmm

0:04 yeah, it is a requirement unfortunately

0:07 xeqi: if you only really care about 2 overlapping actions having a combined session at the end, then you could attempt to diff the session from the store and the session from the response

0:08 or the one from the request and the one in the response, then apply the diff over the one in the store

0:09 justin_smith: is this something a transaction would help with?

0:09 xeqi: but that sounds like it might not work well for somethings like flash

0:11 TEttinger: kyun, slurp is not lazy

0:12 there are functions that can lazily read from a file as a stream, though

0:13 kyun: Thanks, and I think if it is lazy that will more easy to use.

0:15 mmitchel_: xeqi: ok thanks for your help! will think more about this.

0:15 justin_smith: you mean the problem i've asked for help on?

0:15 i wondered about a transaction too

0:17 justin_smith: you want a clean transaction semantics, such that a deletion does not get undone by some other concurrent event, right?

0:18 mmitchel_: justin_smith: exactly

0:20 justin_smith: so, the changes have to be ordered

0:22 would retrying with an atom work, as long as the other operations respected a deleted session and did not recreate it?

0:23 mmitchel_: yeah i think so

0:24 justin_smith: you are already using an atom right? in that case what you want is probably to wrap your updating functions in a wrapper that returns a deleted session if the input is a deleted session

0:25 mmitchel_: yes using an atom already

0:26 justin_smith: the other change this may require is if session creation is currently implicit, you would want an explicit "create session" that expects to create one (and does not fail for a deleted session like other ops should)

0:32 mmitchel_: justin_smith: thinking... :)

0:35 justin_smith: you said "wrap your updating functions" -- you mean the update function used in the swap! ?

0:35 justin_smith: yeah, anything touching that atom

0:35 mmitchel_: ok

0:35 justin_smith: or maybe this would be a good place to use a validator function

0:36 I guess you would need to switch to a ref for that

0:38 mdeboard[IND]: Are there any project templates out there for lcojurescript including om?

0:41 sdfgsdfg: Does anyone understand this notation for the usage of the seesaw timer : (timer f & {:keys [start? initial-value], :or {start? true}, :as opts})

0:41 justin_smith: sdfgsdfg: that's parameter destructuring

0:42 sdfgsdfg: do you know where I can find this notation explained or see examples?

0:42 justin_smith: sadly, destructure lacks a doc string - here's an intro http://blog.jayfields.com/2010/07/clojure-destructuring.html

0:42 the destructuring in let / loop / fn / defn all work the same

0:42 sdfgsdfg: tyvm will take a look

1:29 ncthom91: hi all! Quick question: I have a map, and a vector (or array..) of keys that I want to remove from the map. What's the best way to do this?

1:30 justin_smith: (apply dissoc m ks)

1:30 ,(apply dissoc {;a 0 :b 1 :c 2} [:a :b])

1:30 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

1:30 justin_smith: err

1:31 ,(apply dissoc {:a 0 :b 1 :c 2} [:a :b])

1:31 clojurebot: {:c 2}

1:31 ncthom91: awesome, thanks!

1:41 hmm... another quick question. If I'm inside a go-loop, how can I recurse not back into the go loop but into the function in which this go-loop is defined?

1:41 justin_smith: you can't, looping recursion does not work that way

1:42 ncthom91: justin_smith what's the alternative?

1:44 i could move hte loop outside of the go block?

1:44 and then recurse at the end of the loop

1:46 justin_smith: go blocks return immediately, if you put one inside a loop, you are just creating multiple blocks

1:46 the alternative (the right way to do it) is to use channels to communicate with the code inside the go block

1:51 raspasov: Nickname is already in use.

1:51 oops

2:04 vmarcinko: hi, am complete noob related to interepers/compilers/DSLs... and I now have to implement simple interpreter for one simple rule engine... Definition of rules is already given as data structure (not text), same as LISp, but with vectors instead of lists, and now i have a small tree that I should walk, leaves first, and replace the ndoes as I'm interpreting the nodes...

2:04 so the dsl looks like

2:04 [:and [:somefn1 arg1 arg2] [:somefn2 arg1 arg2]]

2:05 any suggestion how to implement hti smost easily - using clojure.walk or zippers ort?

2:05 never done something similar so...

2:06 ddellacosta: vmarcinko: check out https://github.com/akhudek/zip-visit

2:07 vmarcinko: ok, thanx...

2:08 ddellacosta: vmarcinko: that combined with clojure.zip's vector-zip (http://clojure.github.io/clojure/clojure.zip-api.html#clojure.zip/vector-zip) should make it pretty simple

2:09 vmarcinko: ah, great...

2:09 didnt know about hat second thing

2:10 ddellacosta: vmarcinko: clojure.zip makes this pretty easy

2:10 especially w/zip-visit

2:33 kyun: Oh, leiningen need jvm 1.7

3:07 akurilin: Does anybody know what exactly happens with Ring when it receives more than the :max-threads concurrent requests set at server start?

3:07 By default it's 50

3:07 does is drop HTTP requests, does it queue them up somehow?

3:08 I should actually find a tool that will test htat for me :)

3:14 Actually I just ran ab against it, definitely doesn't drop anything. Cool stuff

3:15 mercwithamouth: test

3:42 kyun: It seem that alias clj='java -cp clojure-1.6.0/clojure-1.6.0.jar clojure.main' is a easy way.

3:43 hyPiRion: kyun: lein works fine with 1.6, but is a bit iffy with very old 1.6 versions

3:44 https://github.com/technomancy/leiningen/blob/stable/doc/FAQ.md and search for TieredStopAtLevel to find a workaround if that's your issue

3:45 kyun: Version is 1.6.0_29-b11

3:45 hyPiRion: should be sufficient – what is the issue you're having?

3:48 kyun: Thank you

3:54 papachan: how i can convert a nested hashmap to string?

3:55 hyPiRion: ,(pr-str {:foo {:bar :baz}})

3:56 clojurebot: "{:foo {:bar :baz}}"

3:56 hyPiRion: papachan: Is that what you want? ^

3:56 papachan: but if i want {"a" {:value "b"}} to "a=b"

4:16 TEttinger: papachan: ##(let [m {"a" {:value "b"}}] (str (key m) (apply str (vals (val m))))

4:16 papachan: ##(let [m {"a" {:value "b"}}] (str (key m) (apply str (vals (val m)))))

4:16 lazybot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry

4:17 TEttinger: papachan: ##(let [m {"a" {:value "b"}}] (reduce (fn [[k v]] (str k (apply str (vals v))))))

4:17 lazybot: clojure.lang.ArityException: Wrong number of args (1) passed to: core$reduce

4:17 TEttinger: papachan: ##(let [m {"a" {:value "b"}}] (reduce (fn [[k v]] (str k (apply str (vals v)))) m))

4:17 lazybot: ⇒ ["a" {:value "b"}]

4:17 TEttinger: gaaaah

4:17 papachan: TEttinger ?

4:18 TEttinger: sorry, trying to solve the a=b thing

4:18 I will privmsg the bot

4:18 mercwithamouth: does the clojure for the brave ebook have more chapters than the web version?

4:19 clgv: TEttinger: your reduce function is missing the second param

4:19 papachan: TEttinger i am trying to pr-str with replace :p not the best solution

4:19 clgv: TEttinger:what is your exact goal?

4:19 papachan: clgv having "a=b"

4:19 TEttinger: ##(let [m {"a" {:value "b"}}] (reduce (fn [s [k v]] (str k "=" (apply str (vals v)))) "" m))

4:19 lazybot: ⇒ "a=b"

4:19 papachan: yuuu

4:19 so fast

4:19 clgv: ah

4:20 TEttinger: you know about `reduce-kv` as well, right?

4:20 TEttinger: no

4:20 clgv: then you do now ;)

4:20 TEttinger: I mostly just use reduce like this

4:20 (doc reduce-kv)

4:20 clojurebot: "([f init coll]); Reduces an associative collection. f should be a function of 3 arguments. Returns the result of applying f to init, the first key and the first value in coll, then applying f to that result and the 2nd key and value, etc. If coll contains no entries, returns init and f is not called. Note that reduce-kv is supported on vectors, where the keys will be the ordinals."

4:20 clgv: ##(let [m {"a" {:value "b"}}] (reduce-kv (fn [s k, v] (str k "=" (apply str (vals v)))) "" m))

4:20 lazybot: ⇒ "a=b"

4:21 clgv: more efficient and no destructuring needed

4:21 TEttinger: so it's the same with less destructuring?

4:21 clgv: yeah

4:21 TEttinger: huh

4:21 papachan: TEttinger is this (reduce (fn [s [k v]] (str k "=" (apply str (vals v)))) "" m)

4:21 clgv: and if I remember correctly without creating intermediate sequences

4:22 TEttinger: papachan, might be better with (reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m)

4:22 zot: is there a trivial way to run lein for another working directory? (ie, don't want to cd foo/project; lein in my makefile, and have the CWD be wrong and hard to deal with)

4:22 (i mean outside of generating an uberjar, btw)

4:23 TEttinger: ,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] ((reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m))

4:23 clojurebot: #<RuntimeException java.lang.RuntimeException: EOF while reading>

4:23 TEttinger: ,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] (reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m))

4:23 clojurebot: "a=b"

4:23 papachan: trying to concat

4:23 m hash map can be several

4:24 TEttinger: ,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] (reduce-kv (fn [s k v] (str s ", " k "=" (apply str (vals v)))) "" m))

4:24 clojurebot: ", foo=bar, a=b"

4:24 clgv: ,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] (reduce-kv (fn [s k v] (str s (when s ", ") k "=" (apply str (vals v)))) nil m))

4:24 clojurebot: "foo=bar, a=b"

4:25 clgv: %15held01%$

4:25 lol

4:25 papachan: cool

4:25 TEttinger: %15held01%$ ?

4:25 leet speek?

4:26 suvash: can somebody help me with cider-clojure-emacs issue on the #clojure-emacs channel ?

4:27 too less people there, hence asking here.

4:37 papachan: suvash ?

4:40 mpenet: anyone had surprises with utf-8 encoding on java7 ? an app that was working fine under 6 now doesn't seem to respect jvm flags passed at startup

4:46 TEttinger: mpenet, on windows, linux, mac, what>

4:46 windows may have issues with utf-8 flags in general

4:47 mpenet: linux

4:48 we pass -Dfile.encoding=UTF-8 to java, LC_* are correctly set, somehow the jvm set everything as "ANSI_X3.4-1968"

4:48 ex: "file.encoding" "ANSI_X3.4-1968",

4:48

4:50 suvash: papachan: i replied you on #clojure-emacs

6:12 CookedGryphon: test.check - how do I generate a float in a range nicely?

6:30 kevin_: What is the equation of metadata.getDirectory(ExifSubIFDDirectory.class) in clojure? I'm using https://code.google.com/p/metadata-extractor/wiki/GettingStarted

6:31 hyPiRion: CookedGryphon: if you're okay with the upper and lower bounds being integers:

6:31 (gen/bind (gen/tuple (gen/choose lower upper) gen/pos-int) (fn [[i v]] (+ (double i) (double (/ v)))))

6:31 or something along those lines

6:32 CookedGryphon: hyPiRion: I've done it really rather nicely, one sec I'll gist it

6:32 hyPiRion: oh, pos-int should be s-pos-int

6:32 ah, cool

6:32 CookedGryphon: https://gist.github.com/AdamClements/f53cbce895e470d1935c

6:33 so that is bounded by size, so it starts off with the simpler cases (bounds of the range) and gets to ever more fiddly floats as it grows

6:33 and then the in-range one does the same just by multiplying up the values from the 0.0 to 1.0 one

6:35 clgv: CookedGryphon: something like that should be in included in test.check - can you create a ticket? if you have a CA you can attach your implementation to it to speed up the process

6:36 CookedGryphon: Sure, no problem. I have a CA already

6:37 vt240: Does the REPL have tab completion for java objects/classes? I tried google, and there are a lot of old posts where people say it's a good idea, and it's being implemented, so I'm just wondering whether it already is there and I'm just missing it...

6:38 agarman: it has completion for static methods.

6:39 vt240: but not instance methods?

6:39 agarman: no

6:40 inside Intellij+Cursive or Emacs+Cider, there is more complete completion

6:40 vt240: what if I want to see the instance methods?

6:40 (clojure/reflect/reflect foo)

6:40 ?

6:41 cfleming: agarman: Don't recent versions of nREPL do this via clojure-complete?

6:41 vt240: uh, clojure.reflect/reflect

6:41 agarman: ,(doseq [x (.getMethods (type ""))] (prn (.getName x)))

6:41 clojurebot: "equals"\n"toString"\n"hashCode"\n"compareTo"\n"compareTo"\n"indexOf"\n"indexOf"\n"indexOf"\n"indexOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"valueOf"\n"length"\n"isEmpty"\n"charAt"\n"codePointAt"\n"codePointBefore"\n"codePointCount"\n"offsetByCodePoints"\n"getChars"\n"getBytes"\n"getBytes"\n"getBytes"\n"getBytes"\n"contentEquals"\n"contentEquals"...

6:41 cfleming: agarman: I'm not sure since I always use Cursive, but I thought so.

6:42 agarman: cfleming: it may be available from nREPL, but the command line REPL doesn't seem to do any tab completion of instance methods.

6:44 with iterm, I use it's autocompletion but have to prime it with (doseq [x (.getMethods (type ""))] (prn (symbol (str "." (.getName x)))))

6:44 vt240: Should I try Cursive then?

6:44 agarman: definitely

6:44 vt240: I assumed that emacs + cider was the way to go

6:44 agarman: or counterclockwise

6:45 or emacs + cider if you don't mind learning emacs

6:45 counterclockwise + eclipse is good too

6:45 there's a VIM plugin for clojure that one of the guys here uses

6:45 vt240: cool

6:47 cider uses nrepl, doesn't it

6:47 CookedGryphon: clgv: Can I just link the gist? Or should I attach a patch/source file?

6:47 vt240: yeah, it does, I just scrolled up

6:47 I'm more of an emacs person than vim

6:48 agarman: vt240: all of 'em use nREPL

6:50 vt240: if you don't have emacs setup, you should look at emacs-live, it's a good starting point for clojure dev

6:51 vt240: agarman: I'm using emacs-live actually :)

6:51 it does have tab-completion for static methods, just not sure it has for instance methods

6:53 agarman: it is strange with instance methods

6:53 clgv: CookedGryphon: you should attach a patch file

6:53 vt240: agarman: strange how?

6:53 clgv: CookedGryphon: and even better test cases to test your new impl

6:53 clojurebot: Pardon?

6:54 agarman: vt240: I've still not figured out when instance methods come up and when they don't

6:54 vt240: agarman: I haven't been able to make them come up at all :/

6:54 seems they might exist though https://raw.githubusercontent.com/purcell/ac-nrepl/master/ac-nrepl.el

6:57 agarman: vt240: actually they come up now, but it brings up a ton of methods from a ton of types

6:58 vt240: you mean all the parent classes up to Object?

6:58 cfleming: agarman: Yeah, you can't make it any better than that without type inference.

6:58 agarman: And even that is only if the instance object is already present after the thing you're completing.

6:58 vt240: I'm in a repl, and the symbol has a value

6:58 agarman: cfleming: yeah it's better than before

6:59 looks like it's showing all methods for instances that have been imported in the nREPL

7:00 cfleming: agarman: Cursive will have type inference soon, and then you'll be able to do (object.method<complete>) and it'll switch it to (.method object <caret>)

7:00 agarman: Yeah, it can't do much more than that.

7:00 agarman: cfleming: that will make 7 people using cursive here very happy

7:01 cfleming: agarman: Nice :-)

7:01 vt240: that's a cool feature. I'll try to implement in emacs :p

7:01 cfleming: That should hopefully come close to Java's ability to discover APIs through completion.

7:02 agarman: cfleming: are you the author of cursive

7:02 cfleming: agarman: Yup

7:03 agarman: Now's the moment to tell me your complaints :-)

7:03 agarman: cfleming: no, not at all, it's made life so much easier for the folks coming from the Java dev world

7:04 cfleming: agarman: Awesome, glad to hear it

7:05 agarman: cfleming: I use emacs 95% of the time and eclipse+ccw rest of time, but that's because IntelliJ is IMO no longer $300 better than eclipse.

7:05 cfleming: though you're doing a good job of countering my opinion :-p

7:06 cfleming: agarman: Hehe, I guess it remains to be seen if Cursive will be $100 better than emacs!

7:06 agarman: Cursive works with IntelliJ community edition too

7:07 agarman: I can't use that for work

7:07 cfleming: Ah, ok - do you need the enterprise features?

7:07 agarman: we released our first open source project last week, but most of our development is closed

7:08 cfleming: That's ok, you can use the community edition for closed source development.

7:08 There's no restrictions on that, it just doesn't have the enterprise features.

7:09 agarman: cfleming: the java projects here require a couple of the features, but I use eclipse whenever I work with those projects

7:10 cfleming: agarman: Ok. Generally the community edition will work with any project, you just won't get the additional support.

7:10 agarman: I'd argue that even without the support IntelliJ is better than Eclipse, but that's just me :-)

7:11 agarman: I agree that it's better than Eclipse, just the gap is much narrower than it was a few years ago

7:11 cfleming: Yeah, that's probably true in terms of functionality.

7:12 I'm not a fan of the Eclipse UI.

7:12 But things like Mylyn are pretty awesome, and have no decent alternative for IntelliJ

7:12 agarman: cfleming: yeah I'm not much into any UI...first thing I do in any app is disable all the noisy menus and buttons

7:13 cfleming: if intellij could go all text panes ala emacs, I'd be game for using it

7:13 more often

7:13 cfleming: agarman: Yeah, I actually have a doc page on how to do that for Cursive users

7:13 You can get it pretty minimal.

7:13 agarman: cfleming: link please?

7:14 cfleming: https://cursiveclojure.com/userguide/ui.html

7:15 agarman: cfleming: that looks awesome

7:16 cfleming: agarman: Cool - you can configure the UI pretty much however you like.

7:19 agarman: cfleming: http://i.imgur.com/OJn3Jmy.png is how my emacs layout looks

7:19 cfleming: agarman: Sure, you can do that, or pretty close to it.

7:19 agarman: cfleming: I use emacs --daemon as well, which I'd sorely miss in other IDEs

7:20 cfleming: agarman: What does that do?

7:20 agarman: cfleming: emacs starts up when I boot, every instance of emacs attaches to a single emacs copy

7:20 cfleming: if I close an emacs client, I can reopen without losing my work

7:21 cfleming: agarman: Ok, since IntelliJ autosaves, you shouldn't ever lose work.

7:22 agarman: http://www.emacswiki.org/emacs/EmacsAsDaemon

7:23 nvm, that's not the link I was looking for

7:23 https://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html

7:23 that's it

7:23 cfleming: Ah, ok

7:24 agarman: basically, starting a new instance of emacs is instantaneous

7:24 cfleming: IntelliJ/Cursive aren't so good as general editors of single text files - they're very project-based.

7:24 There's nothing to stop you using emacs when you need a text editor and IntelliJ for project work. I do that with sublime for git messages etc.

7:25 agarman: no doubt, emacs without cider, clojure-mode et al isn't very good for working on projects

7:26 cfleming: currently only time I use eclipse (or intellij if I switch) is when I need a break point or to work on java code

7:26 cfleming: again, thank you

7:27 cfleming: agarman: No worries!

8:21 visof: hi

8:21 agarman: hi

8:21 visof: clojure deps lib, is installed from ~/.m2/repository , can i change this path?

8:21 i'm trying to package my app as rpm

8:22 so i need to package it with its deps

8:22 agarman: can you do uberjar?

8:23 visof: agarman: to get a jar file with app + deps and use and deploy this jar?

8:23 agarman: yeah

8:24 we uberjar our apps for simple deployment to our servers.

8:25 if you're using leiningen 'lein help uberjar'

8:26 visof: agarman: thank you very much, i maybe use lein ring uberwar and deploy in tomcat

8:26 agarman: also look at where the word uberjar comes up in https://github.com/technomancy/leiningen/blob/stable/sample.project.clj

8:27 visof: kk, :-)

8:39 CookedGryphon: clgv: Ticket submitted TCHECK-43, I made some improvements and added tests

8:43 zamaterian: visof, take care that it uberwar doesn't include dev dependencies in the war files

8:52 clgv: CookedGryphon: awesome :)

9:11 visof: i have created war package for my ring app using lein ring uberwar and deployed to tomcat, is the routes are going to be different when using tomcat rather than ring?

9:12 i have checked the logs i got 404

9:19 wjlroe: visof, I think it depends on the Context Path you mount the app in in tomcat, not 100% sure

9:25 zamaterian: visof, when deploying a warfile the name of the war files is normal used as the first part of the context eg /name-of-war/someroute unless its named ROOT.war then the context is /someroute

9:31 visof: zamaterian: i have renamed my app as ROOT.war but i write the same routes as in ring but i got 404 for tomcat and right for ring

9:43 zamaterian: visof, try adding a echo route like this http://pastebin.com/XAE5Xh19

9:45 visof: zamaterian: to my routes?

9:47 zamaterian: I normally add a regex context to my routes, to avoid renaming the war file. http://pastebin.com/KnXDS5zZ

9:47 visof, yes to your routes it echos the request back as a string response.

9:50 visof: zamaterian: i'm trying to do this

9:55 zamaterian: visof, if you have problems hitting hte echo route just change context/path to '*'

10:08 SagiCZ1: hi.. anybody uses regexpal.com ? how do i turn on multiline matching? and how do i do that in clojure?

10:16 jeffterrell: SagiCZ1: I think you can say ?m at the beginning of your regex.

10:17 As in, #"?mpattern"

10:17 SagiCZ1: jeffterrell: thanks.. and in regexpal its the "dot matches all" option

10:24 alex____1: hi

10:26 SagiCZ1: is there an easy way to dump a whole text file into string? something like FileUtils.fileToString()

10:27 tobik: SagiCZ1: (slurp filename)

10:27 SagiCZ1: tobik: that sure was easy, no need for fancy buffered readers, thank you

10:53 visof: hi

10:54 i need to make sure has type of [[]] and not [] , how can i do this?

10:55 need to make sure my method got argument of type of [[]] and not [] or [[[]]]

10:55 what is the best way to do this?

10:56 schmir: visof: most probably you shouldn't do that

10:57 visof: schmir: why?

10:57 schmir: what alternatives?

10:58 schmir: visof: just let it fail at runtime

10:58 why do you think you have to do that?

11:01 you normally do not check the type passed to a function at runtime -- at least not in order to throw an error and inform the caller that he should pass a certain type

11:01 cbp: visof: you can use a precondition

11:06 SagiCZ1: is there a clojure way to do this?

11:06 ,(.contains "Hello" "ll")

11:06 clojurebot: true

11:06 cbp: is that not clojure?

11:07 SagiCZ1: it is but it uses String method..

11:07 i thought i should rather use clojure.string

11:07 clgv: SagiCZ1: that is the idiomatic clojure way

11:08 SagiCZ1: you could use regexps but that'd be overkill

11:08 hyPiRion: yeah, that's idiomatic

11:08 ,((comp boolean re-find) #"ll" "Hello") ; not so idiomatic

11:08 clojurebot: true

11:08 SagiCZ1: alright, thanks :)

11:08 xemdetia: SagiCZ1, If anything the way you presented is incredibly easy to understand

11:11 oskarth_: Is anyone familiar with something like pg's code-tree (https://news.ycombinator.com/item?id=32766) for Clojure?

11:11 SagiCZ1: xemdetia: i know it is.. but i got confused once i found some duplicate methods in clojure.string.. why should i use clojure.string.split over (.split "hello" "l")

11:12 clgv: hyPiRion: that re-find is idiomatic but pretty complex for the task to solve ;)

11:12 hyPiRion: you should have left out the (comp boolean ..) though ;)

11:13 SagiCZ1: stupid question here.. when i am threading using ->> it inserts the thing as last in the list.. so its not wise to use function literals there? what if one of the functions would rather get the argument as first and not last?

11:14 hyPiRion: clgv: why should I? Usually you'd do (def re-contains? (comp boolean re-find))

11:14 SagiCZ1: ,(->> 3 #(println %))

11:14 clojurebot: #<sandbox$eval74$fn__75 sandbox$eval74$fn__75@1c6de20>

11:14 hyPiRion: ,'(->> 3 #(println %)) ; this is what the ->> macro sees

11:14 clojurebot: (->> 3 (fn* [p1__100#] (println p1__100#)))

11:15 SagiCZ1: so it would put the 3 at the end of the (fn..) list ?

11:15 hyPiRion: yes

11:16 You can wrap it in a set of parens again if you want to call the anonymous function, but it's not very readable.

11:17 SagiCZ1: ok thanks..

11:19 clgv: hyPiRion: since `re-find` returns nil or something truthy - so no need for `boolean`

11:21 SagiCZ1: is there any way i could read java source code string and turn it into the real string? for example: "abc" + "cde" + \* some comment *\ "end" --> "abccdeend" .. i need to "read" java source..

11:22 rweir: how did you end up wanting to evaluate java source code?

11:22 hyPiRion: clgv: Yeah, I might be in minority wanting my stuff to be actual true and false values.

11:24 SagiCZ1: rweir: my college wrote a LOT of sql scripts into strings in our source file and i need to pull them to external files

11:24 rweir: yowzer

11:24 SagiCZ1: i guess i could filter out the comments and + signs using some clever regexes.. but evaluating would be more bug proof

11:25 arohner: so I found something amusing, that might explain the clojure.tools.logging + AOT issues:

11:25 lein do clean, compile clojure.tools.logging clojure.tools.logging

11:25 that reliably crashes for me, and I don't know why

11:26 agarman: SagiCZ1: lein no.disassemble let's you disassemble in the REPL

11:26 SagiCZ1: agarman: do i want to disassemble the code?

11:26 clgv: SagiCZ1: only you know ;)

11:27 hyPiRion: SagiCZ1: that's hard to solve without a java parser and a constant folder

11:27 SagiCZ1: i already managed to pull the strings out

11:27 its always String sql = "some horrible string"

11:27 hyPiRion: alright, and it never contains variable names, just strings?

11:28 SagiCZ1: hyPiRion: just strings and comments

11:28 xemdetia: some people just enjoy the pain

11:28 SagiCZ1: (multi-line strings)

11:28 agarman: SagiCZ1: is there any logic around the strings that's important?

11:28 hyPiRion: It's probably regexable.

11:29 SagiCZ1: hyPiRion: yeah i think regex expert would be done in minutes.. i thought it would be easier to evaluate it.. maybe if i somehow invoke java to print it and catch the output?

11:29 agarman: yes.. our whole business logic of the app

11:29 xemdetia: is there just a way to take a class file and have it emit string constants

11:30 maybe that would be faster

11:30 SagiCZ1: xemdetia: is there?

11:30 xemdetia: I have no idea

11:30 I just am suggesting it in case it helped someone else

11:32 clgv: decompiler can extract string constants ;)

11:32 xemdetia: That's true

11:33 SagiCZ1: clgv: which one?

11:34 clgv: SagiCZ1: any decompiler

11:34 SagiCZ1: but wait.. since java has such a common syntax with javascript.. maybe i could use some javascript eval

11:37 but how would i invoke javascript from clojure

11:37 xemdetia: SagiCZ1, you say you have your Strings pulled out

11:37 how do you have that

11:37 did you just do a regex pulling out String to first ;?

11:37 or something?

11:38 SagiCZ1: xemdetia: yes regex

11:38 xemdetia: pulled the methods first, then located the sql variable

11:39 xemdetia: what's stopping you from stripping the leading String varname =, capturing only the "'s and replacing the ';' with a ','

11:39 then slapping that big mother in a big ol string array

11:39 SagiCZ1: xemdetia: nothing that actually sounds like a great idea

11:39 xemdetia: String stuff = { "sql1","sql2"+"moresql", "blah" };

11:40 then java evals your strings

11:40 and you dump to a file

11:40 SagiCZ1: why did i forget about the little fact that the strings actually have to be in quotes

11:40 xemdetia: and ride off into the sunset

11:40 SagiCZ1: thanks mate!

11:40 xemdetia: np

11:40 SagiCZ1: (inc xemdetia)

11:40 lazybot: ⇒ 1

11:44 daniel_: (inc lazybot)

11:44 lazybot: ⇒ 30

11:44 daniel_: (inc daniel_)

11:44 lazybot: You can't adjust your own karma.

11:44 agarman: (dec daniel_)

11:44 lazybot: ⇒ -1

11:44 agarman: :-p

11:44 xemdetia: That should be default behaviour

11:44 'what are you even doing'

11:50 SagiCZ1: lel

11:50 is there a character literal for space?

11:50 justin_smith: ,\space

11:50 gzmask: \space I think

11:50 clojurebot: \space

11:50 justin_smith: ,(first " ")

11:50 clojurebot: \space

11:51 SagiCZ1: thank you very much

11:51 justin_smith: ,((juxt first identity) " the final frontier")

11:51 clojurebot: [\space " the final frontier"]

11:52 TimMc: >_<

11:52 opqdonut: :D

12:09 SagiCZ1: maybe im losing my mind a little bit.. but what would be the best way to return whats inside the <> parens from this string? "hello <Type> 123" .. i got this

12:09 ,(re-find #"<.+>" "hello <Type> 123")

12:09 clojurebot: "<Type>"

12:10 SagiCZ1: can the re-find return only what i want? "Type" ?

12:10 cbp: you wanna use parens to capture a group

12:10 SagiCZ1: re-groups maybe

12:11 ,(re-groups #"<(.+)>" "hello <Type> 123")

12:11 clojurebot: #<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/re-groups>

12:11 justin_smith: ,(re-find #"<(.+)>" "hello <Type> 123")

12:11 clojurebot: ["<Type>" "Type"]

12:11 SagiCZ1: justin_smith: why did it return both?

12:11 justin_smith: that's what re-find does

12:11 noonian: ,(doc re-find)

12:11 clojurebot: "([m] [re s]); Returns the next regex match, if any, of string to pattern, using java.util.regex.Matcher.find(). Uses re-groups to return the groups."

12:11 justin_smith: match, followed by the groups

12:12 SagiCZ1: justin_smith: thanks

12:17 mp: is there a way to define "clojure 1.7.0-latest" in lein's dependencies (for dev purposes of course, not to be released)

12:17 or "clojure 1.7.* including alphas and betas"

12:18 noonian: mp: you can build your own lein and point the lein script to use it

12:19 sorry, i had it setup that way for a while so i could use the new version of tools.cli but i can't find the custom build anymore

12:19 mp: I meant in project.clj of my project, as used by lein

12:20 noonian: well, if you put the clojure 1.7 alpha in your dependenceis it will use that clojure for your own code, but to get leiningen to use 1.7 you would need to build lein yourself

12:21 e.g. this is the first entry in the :dependencies vector of my project: [org.clojure/clojure "1.7.0-alpha2"]

12:28 mdeboard: arrdem: Are you at StrangeLoop?

12:29 gzmask: the clojure-unity team?

13:21 stompyj: is anyone here using kafka consumers via clj-kafka?

13:30 agarman: stompyj: we were using it for awhile

13:30 stompyj: agarman: why did you stop? (if you don’t mind me asking)

13:30 I can’t get the consumer portion of the example code to work… its bizarre

13:32 agarman: stompyj: we may be using it again, I'd have to check

13:32 stompyj: we stopped because they didn't support consuming from whitelists

13:33 stompyj: cool, no worries, its probably not worth the effort on your end, I’ll keep digging

13:33 ahh ok

13:33 agarman: stompyj: but looks like my pull request was merged in, so folks may have switched back to clj-kafka

13:34 stompyj: are you on kafka 0.8 or 0.8.1. Now I’m wondering if 0.8.1 broke compat. about to download 0.8 and check

13:36 agarman: using 0.8.1.1

13:36 and zk 3.4.6

13:38 stompyj: dang, and clj-kafka works

13:38 interesting

13:38 ok, danke

13:38 agarman: stompyj: btw, we're only using clj-kafka as a roll-up for zk & kafka deps atm

13:39 stompyj: aha

13:39 ok

13:39 agarman: AFAICT still doesn't support multiple topics on a single consumer

13:40 stompyj: yeah, it seems very thin as a client lib

13:41 agarman: yeah, we decided we didn't want to fork it and are just using our own thin wrapper around the scala lib

13:42 https://github.com/nubank/clj-kafka looks to be the most updated fork

13:42 stompyj: this current project, even if I could consume from a single consumer, I’d be OK, but I had some bigger schemes down the line I’ll have to reconsider, unless I want to factor in some fork+contribute or write-my-own-lib

13:42 yeah, I downloaded that recently, and will try that soon

13:42 thanks

13:42 agarman: kk, :-)

13:43 stompyj: I would have thought that clojure+kafka would have been a more widely used combo

13:43 agarman: we use kafka for event sourcing and logging

13:46 SegFaultAX: agarman: Would you mind talking a little more about that pipeline? That's a use case we're currently investigating as well.

13:47 agarman: SegFaultAX: for how we use Kafka?

13:50 SegFaultAX: agarman: As it pertains to event sourcing specifically.

13:51 stompyj: SegFaultAX: we’re in the beginning stages, but we’re embracing this idea of “universal logging”

13:52 currently we have two websocket connections, multiple pub subs streams flying around, log files, events that get published to kissmetrics, librato, messages that get queued up to send emails either now or in the future

13:52 we’re attempting to take all of those different tributaries and turn them into a river of events

13:52 everything goes into kafka, and coming out, whoever is interested in a particular event can take action

13:53 SegFaultAX: One thing we're struggling with is determining a good structure for each record that works across multiple services in different languages.

13:53 Which keys are required, which are optional, how to make the record/message/event structure extensible in a meaningful way.

13:54 stompyj: yeah, that will be our step #2

13:54 right now just moving each existing stream into it’s own topic will solve a huge part of our issue

13:54 but then the next step is how to we come up with a common schema

13:54 SegFaultAX: In the simplest terms, if "User A" did thing "Foo", what is a good record format to represent that action. And furthermore, if that action had multiple side effects, what structure do those derivative messages take. Etc.

13:54 stompyj: changed thought in mid-sentence there, sry

13:56 SegFaultAX: Everyone who writes about message oriented architectures or CQRS or event sourcing never seems to actually describe the events/messages themselves.

13:56 stompyj: haha, 100% agreed

13:56 I wonder about that

13:56 whenever I ask people directly, I get handwavey answers

13:56 I think it’s still being sussed out by most people

13:56 SegFaultAX: It's always some hand-wavy crap like "just send a message when a user makes a payment"

13:57 stompyj: we decided to use a pretty basic structured format to start, and we archive everything on s3

13:57 with the idea that, as we figure things out, we should be able to replay events

13:57 and transform them into whatever schema we decide on

13:58 there is one good book on it, but it’s a MEAP

13:58 one sec

13:58 SegFaultAX: Furthermore, not every message is generated in the context of processing an HTTP request. So your schema needs to handle those cases as well.

13:58 stompyj: http://manning.com/dean/

13:58 this one is not bad, but it’s not complete

13:59 the author runs a consultancy on top of a product they wrote, and they have some interestign schema ideas in there

13:59 he actually criticized transit in a very light way, because of it’s lack of schema

13:59 on the HN comments of the official announcement

14:00 I’m going to the storm NYC meetup tonight, where I’ll be harassing as many people as I can to get answers on how their schemas are laid out :)

14:02 SegFaultAX: technomancy: Ping.

14:04 technomancy: Just curious if you have any insight on uniform logging structures from multiple, heterogeneous backends. I seem to recall you've written/talked about this topic a bit in the past.

14:10 technomancy: SegFaultAX: in a meeting ATM. I haven't written about it, but Mark Mcgranaghan's Conj talk is a good start

14:11 justin_smith: amalloy_: if I have two lazy sequences, that are both derived from the same lazy-seq, but I don't feel like calculating the original seq twice, and I don't want to hold onto any element of the original past the point where both have used it, is there a straightforward idiom for doing this?

14:12 I would use the input seq directly to avoid holding the head, but here it is input to two different sequences

14:12 (also, of course, I am open to suggestions from all, just thought he would likely know if anyone did)

14:16 hyPiRion: ,(let [orig (range) incr (map inc orig) decr (map dec orig)] [incr decr])

14:16 clojurebot: [(1 2 3 4 5 ...) (-1 0 1 2 3 ...)]

14:16 hyPiRion: justin_smith: like that? ^

14:16 justin_smith: hyPiRion: the problem is that holds onto the head of orig

14:17 what if I wrapped each of the results in a (drop 100000000)

14:17 dbasch: justin_smith: it seems like you want a wrapper where you can have an access counter for the head, and let go when it reaches 0

14:17 hyPiRion: justin_smith: Then the head is probably GCed

14:17 justin_smith: hyPiRion: oh, if it is than of course no worries

14:17 stompyj: SegFaultAX: as a follow-up, the 0.8.1 branch of pingles/clj-kafka does work with 0.8.1, so I think master only has compat with 0.8

14:18 justin_smith: hyPiRion: because that is effectively what I am doing already, I just looked at the code and thought that would be a leak

14:18 stompyj: thx for the hekp

14:19 hyPiRion: justin_smith: It'll leak if you're still inside the let, but not outside of it

14:19 justin_smith: dbasch: that would have the right semantics, but wouldn't it be messy to implement?

14:19 hyPiRion: so uh

14:20 justin_smith: hyPiRion: OK, yeah, the elements are taken outside the let block, so all is good there

14:20 hyPiRion: alright, then it doesn't retain the head of orig

14:20 justin_smith: hyPiRion: what I really have is two parallel lazy sequences, each ordered, zipped together into one ordered lazy sequence, and that ordered lazy seq is the only thing escaping scope

14:21 hyPiRion: parallel as in pmap or something like that?

14:22 justin_smith: as in generated in parallel from the same input, not threaded

14:22 (the generation is a bit nonlinear, so the sorting has to come after the generation of the two parts)

14:22 arrdem: mdeboard: I wish :P

14:24 hyPiRion: well, two lazy seqs generated from another lazy seq wouldn't retain the head from the original at least

14:24 justin_smith: cool

14:50 stompyj: technomancy: have you guys announced the successor to pulse?

14:54 technomancy: stompyj: sort of ... http://r.32k.io/l2met-introduction

14:54 stompyj: thx

14:54 technomancy: stompyj: unfortunately in production we're actually using librato's private fork, which is very divergent

14:55 actually the "history" section there is pretty good

14:56 amalloy: hyPiRion: re justin_smith's question, i'm fairly sure being inside the let doesn't make the head be held onto any more than it would be outside

14:56 stompyj: technomancy: interesting. what was the motivation to go to Go instead of clojure?

14:56 amalloy: as soon as you've gone "past" the point in your let expr where the sequence is used for the last time, the compiler nulls out the field so it's eligible for gc

14:57 SegFaultAX: technomancy: Oh, my mistake. :) Even still, do you have any thoughts on the topic (when you have a free moment)

14:57 justin_smith: amalloy: thanks, glad to know it works that way

15:06 technomancy: stompyj: it was just written by a different engineer

15:06 stompyj: technomancy: fair enough. :)

15:07 technomancy: stompyj: no idea why google go was chosen in particular; I can't see the appeal personally

15:08 stompyj: yeah, I just watched Mark’s talk, and I agree with his point, that clojure seems like a very natural choice for event streams

15:08 amalloy: justin_smith: the compiler is pretty good about not hanging onto things you don't actually need. you have to try pretty hard to cause problems like that

15:09 stompyj: Go (given the little I’ve used it) doesn’t seem to be anywhere near as natural a fit

15:09 technomancy: stompyj: upstream of l2met it's largely erlang, which in this case is an even better fit

15:09 stompyj: aha! that makes more sense, I looked at the github repo and saw 95% Go

15:10 technomancy: stompyj: https://github.com/heroku/logplex

15:10 ^ my day job

15:10 stompyj: cool to see erlang become more popular, back when I used it in the mid-2000s it was just us idiots writing mobile code who used it

15:11 ahhh very cool

15:11 technomancy: do you guys still use much clojure @ heroku these days?

15:13 technomancy: stompyj: there are a couple of small codebases, nothing under active development.

15:14 stompyj: technomancy: interesting. sorry to keep bugging you, last question, do you keep supporting leiningen because you dig clojure outside of work?

15:17 technomancy: are you going to be at clojure/conj?

15:18 technomancy: stompyj: I do get time to work on Leiningen here and there at work; it was what I was originally hired for. I don't think I'll make it to the conj this year though.

15:20 stompyj: aha, ok! thanks!

15:22 mmeixner: newbie-test

15:32 irctc: Hi, I'm getting a java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn

15:33 but ,being new to clojure, I don

15:33 ''t have any idea why

15:33 http://codepaste.net/fi6t4n

15:33 here is the code

15:33 (jornada *equipos 4) behaves as expected

15:34 but (jornada *equipos* 1) returns the exception

15:34 SegFaultAX: irctc: Can you share the full trace with us as well?

15:34 irctc: java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn /home/carlos/Programacion/codere/calendario.clj:56 -STAR-equipos-STAR-/jornada /home/carlos/Programacion/codere/calendario.clj:65 -STAR-equipos-STAR-/eval6474

15:34 this?

15:34 SegFaultAX: Not in the channel please. :)

15:34 clojurebot: this is a better one i think: https://github.com/michaelklishin/neocons

15:34 irctc: oh sorry

15:34 justin_smith: irctc: ((nth (robin equipos) (- jornada 1)))

15:34 that is likely your problem, too many parens

15:35 ,((nth '(0 1 2) 1))

15:35 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

15:35 irctc: oh

15:35 yes

15:35 thank you

15:35 justin_smith: I suggest a clojure book - parens don't work like they do in most other languages

15:35 TheMonarc: which version of eclipse should i install, if i want to write some clojure?

15:35 http://www.eclipse.org/downloads/?osType=linux

15:36 SegFaultAX: TheMonarc: The one spelled "IntelliJ"

15:36 * SegFaultAX ducks

15:37 irctc: is clojure programming any good?

15:37 also, is the rest of the code somewhat idiomatic clojure?

15:37 TheMonarc: seriously, which version

15:38 justin_smith: amalloy: hyPiRion: if the tail is not held onto, why would this blow the heap for a large n? https://www.refheap.com/90363

15:38 (it does, btw)

15:38 TheMonarc: wait

15:38 so intellij is better for clojure?

15:39 technomancy: TheMonarc: the counterclockwise site probably has advice for what to download

15:39 TheMonarc: i'm coming from windows/.NET dev environment

15:40 justin_smith: TheMonarc: for eclipse I would say the standard version, or the "for java developers" version

15:40 TheMonarc: from what I have heard, if you have the cash intellij plus cursive is better (but they are not free)

15:40 amalloy: justin_smith: you're returning an arbitrarily large sequence for arbitrarily large n

15:40 TheMonarc: oh, i'm def. sticking with free stuff for now

15:41 amalloy: so if you realize the entire result at once (eg, to print it), that could take any amonut of space. that's one possible problem

15:41 justin_smith: amalloy: it's lazy and it leads with a drop-while, I am calling it as (first (f (* 111111111 111111111)))

15:41 no printing whatsoever

15:41 TimMc: TheMonarc: Other options include emacs and vim, if you have familiarity with those.

15:42 cfleming: justin_smith: Currently Cursive is free (in beta) and it works with the free and OSS IntelliJ community edition.

15:42 justin_smith: cfleming: oh, cool, good to know

15:42 cfleming: justin_smith: Cursive will probably be free for at least another couple of months.

15:42 Raynes: lol someone is going to charge for Cursive?

15:43 cfleming: Raynes: yup

15:43 * Raynes nods vigorously

15:44 amalloy: i would try running it myself, but you have not included the definitions of breakdown or palindrome.

15:44 justin_smith: amalloy: I fully expect the current algo to spin its wheels for a long time before reaching the goal, but I don't expect a heap blowup

15:45 amalloy: https://www.refheap.com/90364 this is the whole thing, kind of ugly, but correct for smaller inputs

15:45 more than kind of ugly - very ugly actually

15:48 amalloy: justin_smith: you intend for palindromic? to not be used at all?

15:49 justin_smith: amalloy: sorry, it is partially complete, and currently unused

15:49 instead of detecting palindromes, it is generating them

15:50 dbasch: I have a file containing lines of mostly edn, but once in a while there may be a line of json (don't ask). What would be a good way to parse this other than try edn, catch and try json?

15:50 stompyj: cfleming: but since cursive isn’t a jetbrains project, there’s no incentive to purchase a intellij license right?

15:51 community intellij + cursive

15:51 amalloy: justin_smith: so what is an input that should blow the heap?

15:51 justin_smith: (if bound to pals) -> (first (pals (* 111111111 111111111)))

15:51 it takes a while, but it does it

15:52 I am sure I can solve the exercise part, but am interested in the larger questions regarding how lazy items are handled that my current flawed version brings up

15:53 SegFaultAX: justin_smith, TheMonarc: IntelliJ has a community edition which is free.

16:02 technomancy: leiningen 1.x got removed from apt-get

16:03 (which is a good thing)

16:06 Gurkenmaster: ,(which is a good thing)

16:06 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: which in this context, compiling:(NO_SOURCE_PATH:0:0)>

16:06 gzmask: why people still using lein 1.x is beyond my understanding

16:06 Gurkenmaster: :(

16:06 amalloy: hmmmmm. so your whole heap is taken up by c.l.PersistentList objects, which afaict you only ever produce by reversing things in palindrome, justin_smith

16:06 SegFaultAX: Beacuse of Reasons (tm)

16:07 amalloy: oh, and in breakdown

16:07 justin_smith: amalloy: weird - shouldn't those be collected?

16:07 gzmask: Reason #1, laziness (not clojure laziness)

16:08 justin_smith: amalloy: the lists in palindrome don't escape scope, and the calls to breakdown are all in a lazy sequence - so unless the head of that lazy sequence is being held onto, I don't see the cause

16:11 amalloy: right, i don't really get what's going on yet

16:18 technomancy: gzmask: because it was in apt-get =)

16:19 justin_smith: amalloy: working on a much simpler test case, that should reveal the same behavior (waiting to see, takes a while to run out of heap)

16:19 amalloy: justin_smith: i mean, i've disassembled the function sample itself, and it very definitely does not hold onto any of: inputs/odd/even

16:20 it sets those to null before it calls iterate/map

16:20 and the heap seems full of teeny tiny lists, length like 3 or 4

16:20 which seems like those in palindrome

16:21 justin_smith: well, used by palindrome, produced by breakdown

16:22 amalloy: no, they both produce small lists

16:22 palindrome calls reverse

16:22 justin_smith: ahh, the reverse, right

16:22 amalloy: (which, by the way, you could just use vectors and rseq, instead of lists and reverse)

16:22 justin_smith: indeed

16:32 insamniac: i really need to make use of http://mmamath.com

16:33 justin_smith: insamniac: your username leads me to believe you may be from the Boston area

16:33 insamniac: nah, it's just my name is sam

16:34 and it was my aol username when i was 15 because i was oh so clever

16:34 AimHere: Wouldn't an insamniac be someone who can't Sam?

16:35 insamniac: I don't think it works that way

16:35 Unless there's an analogous word that makes your theory make sense.

16:36 amalloy: insamniac: well, insomniac. the "somn" root means sleep

16:36 eg, somnolent

16:36 insamniac: So I can't salmon

16:37 man i thought he was gonna beat rashad. they certainly had different career trajectories after that!

16:37 AimHere: Fair enough. This channel wasn't about to demand that you leap upstream, spawn and die anyways, so I think we're okay with that

16:37 arrdem: AimHere: leaping upstream is nearly impossible with jira anyway..

16:43 amalloy: man, i dunno what is going on with your function, justin_smith

16:44 chunking is one thing i'm a little concerned about, i guess, since (map f (range)) is chunked, but 32 medium-sized lists shouldn't be a problem

16:45 justin_smith: OK, thanks, I am also looking into this with a profiler

16:48 (first (drop (* 111111111 111111111) (let [r (map (fn [_] (int-array 1000)) (range)) s (map first r)] s)))

16:48 the above made a virgin repl jump from ~250m used heap to ~2.5 gig used heap, very quickly

16:49 and the spikes are jumping from around 2.5g to around 250m, and back again, as the function runs

16:50 noonian: i like my repls more experienced

16:51 technomancy: (inc arrdem)

16:51 lazybot: ⇒ 36

16:51 insamniac: holy crap, i just now realized that i posted that link above in #clojure, rather than the mma channel

16:51 justin_smith: http://i.imgur.com/ueiNTdg.png screenshot

16:52 insamniac: I just figured it was some kind of math pun that would be tied back to clojure

16:52 hoangelos: anyone here use the jclouds api in clojure? I'm getting a totally cryptic error when I run the blockstore function.

16:53 noonian: hoangelos: i've only use pallet which abstracts over jclouds

16:53 stompyj: insamniac: hahahahaha AMAZING

16:53 (inc insamniac)

16:53 lazybot: ⇒ 2

16:53 noonian: but i think you can definitely have problems if your versions of jclouds and jclouds providers etc. doesn't match up

16:53 stompyj: that makes two people who like clojure and MMA

16:54 noonian: lol, i assumed rashad was some dev :P

16:55 insamniac: haha

16:55 hoangelos: noonian: I get this error when I try to call blobstore function: http://pastebin.com/QSB2pPYS

16:55 insamniac: oh yeah that comment was completely out of context

16:56 hoangelos: My args are "aws-s3" as the provider, next the access key, and then the secret key.

16:56 The access key and secret key are correct.

16:57 stompyj: One time I heard that Karo Parysian is better then Anderson Silva because Ryo Chonan beat Silva, but lost to Parysian

16:57 serious MMA Math going on there

16:57 justin_smith: yeah, you could do some fun stuff with graph algorithms

16:58 hoangelos: noonian: the error is less than helpful. A multiple choice of 17 things. I'm getting the feeling like I'm either missing a library that's a dependency or something.

16:58 cfleming: stompyj: It's not required, right, unless you need the Ultimate edition features.

16:58 hoangelos: I used the dependencies from https://github.com/jclouds/jclouds-examples/blob/master/blobstore-clojure/project.clj have a different version of clojure though.

16:59 cfleming: stompyj: They would most likely be the web support, and maybe the node.js stuff if you're doing cljs.

16:59 amalloy: justin_smith: have you tried replacing (range) with (iterate inc 0), to see if chunking is relevant?

16:59 cfleming: stompyj: Cursive provides some integration with JS for cljs, but it's pretty minimal, and just for completion etc in cljs, not really for editing JS.

17:00 stompyj: But right, for a lot of use cases the community edition is fine.

17:00 justin_smith: amalloy: good call. Each test is kind of slow (I guess I could reduce my default max heap for this...)

17:00 stompyj: cfleming: thanks for the info! I switched to Cursive for clojure dev, but its killing me that my ruby scripts aren’t getting the IDE love

17:01 cfleming: stompyj: Right, that would be another thing that an IntelliJ license would solve.

17:01 stompyj: I'd like to get Cursive working with Rubymine, but that's tricky since it doesn't include the Java support that Cursive relies on.

17:02 stompy: At some point I'll extract a minimal amount of that from IntelliJ CE, then Cursive would run in Rubymine, PyCharm, WebStorm (for cljs) etc.

17:04 noonian: hoangelos: i might try using jclouds-all instead of jclouds-allblobstore

17:04 stompyj: cfleming: yeah, it’s not a super big deal, I use vi for non-clojure projects, but I wrote a Thor script to handle automation of provision and deploy

17:04 noonian: i remember having to throw deps in there until my error messages changed and then play detective to figure out what I actually needed

17:05 gzmask: clojuredoc is down. what is that nice new clojure online doc site's name?

17:05 cfleming: gzmask: Grimoire

17:05 gzmask: thanks !

17:05 noonian: gzmask: http://clojure-doc.org/ maybe?

17:05 stompyj: does anyone know how fast conj tickets are going?

17:06 arrdem: oh shit clojuredocs.org is down

17:06 insamniac: stompyj: is this in san francisco?

17:06 cfleming: Maybe they're updating to their new version?

17:06 gzmask: they should ... it's getting outdated

17:06 noonian: arrdem: woah, grimoire is sweet!

17:06 arrdem: noonian: <3

17:06 stompyj: insamniac: this clojure/conj is in Washington DC

17:08 insamniac: the MMA Math was in Boston

17:08 cfleming: It's clojure/west that's on the west coast - it was in SF this year.

17:09 stompyj: insamniac: also, what mma IRC channel exists

17:11 devirr: anyone know of a good tutorial to deploy a clojurescript app with intel xdk to android?

17:11 noonian: when is the conj? i have family in d.c.

17:11 insamniac: #MMA-TV on efnet

17:11 noonian: stompyj: lol

17:11 insamniac: stompyj: a bunch of savages in there.

17:11 stompyj: I’d expect nothing eless

17:12 insamniac: stompyj: I think it's actually the community for a streaming site, but i never bothered to check.

17:12 stompyj: I’m going to go in there and say that the Weidman got lucky twice

17:12 insamniac: hah

17:13 can't keep the weidman down

17:18 gzmask: arrdem: girmoire need some serious SEO. I googled "clojure document" and it's not on first page

17:20 noonian: instructions for obtaining documentation is included in the documentation

17:20 arrdem: gzmask: the issue is in lack of inbound links and clojuredocs hugepagerank score. not much I can do about either.

17:20 gzmask: known issue tho...

17:21 insamniac: stompyj: Oh, figures I'm moving from the east coast to the west and then the conj is coming to DC.

17:23 arrdem: gzmask: https://github.com/clojure-grimoire/grimoire/issues/57 if you have suggestions

17:24 gzmask: arrdem: I agree on having a "clojure-grimoire.org" instead of the sub domain right now

17:24 google probably will rank a sub domain differently

17:25 mbriggs: hey guys, does anyone know off hand how to negate "attr=" from clojure.data.zip.xml? i want "attr-not=". probably simple, i just am new to zippers in general

17:26 gzmask: arrdem: and probably submit your google sitemap if you haven't. add some keyword meta tags to your html too

17:27 xemdetia: I thought meta tags were basically ignored at this poiint

17:27 deadghost: ^

17:27 gzmask: <title>Clojure Cheat Sheet (Clojure 1.3 - 1.6, sheet v16)</title> This isn't a particularly SEO friendly title too

17:28 arrdem: it's all pretty much voodo anyway...

17:28 :/

17:28 deadghost: clearly add a pinterest and social media buttons

17:28 2. ???

17:28 lazybot: deadghost: How could that be wrong?

17:28 arrdem: deadghost: off with your head

17:28 deadghost: 3. rank!

17:29 xemdetia: from the last tech talks I watched about google's pagerank the old tricks basically don't work anymore

17:29 arrdem: one of my buddies demo'd a gtkvim extension that added a FB like button to every line...

17:29 hyPiRion: arrdem: where do i login with facebook

17:29 justin_smith: meta tags are used to generate the preview on the search page (or on social sites where the link is shared)

17:29 hyPiRion: hah.

17:29 justin_smith: xemdetia: they are in a red-queen race with the "optimizers"

17:30 gzmask: guys, it doesn't need to over-rank clojuredoc. it just need to be on first page. I don't think it's that hard

17:30 arrdem: when I google "clojure documentation" Grimoire is the last thing on the first page..

17:30 but that's from my IP and my google account

17:30 grumble grumble social search

17:31 arohner: argg!! I'm chasing down an AOT bug all fricken day, only to find out 'lein clean' doesn't clean *everything*

17:31 noonian: yeah, its last for me too but i just visited it

17:32 justin_smith: arohner: wat

17:32 gzmask: yeah, but I used "clojure docs" or "clojure document"

17:32 arohner: justin_smith: clean only cleans your current profile

17:32 arrdem: clearly I need to write grimoire.js... a javascript plugin that recognizes #'<namespace>/<symbol> notation in blogposts and rewrites them to Grimoire links...

17:32 arohner: which is a problem when you do things like 'lein clean; lein uberjar'

17:34 PigDude: NullPointerException clojure.lang.Numbers.ops (Numbers.java:961)

17:34 hm ...

17:34 I think my error forgot its trace

17:34 justin_smith: PigDude: (pst)

17:35 PigDude: got it, thanks justin_smith !

17:36 arohner: is there a way to get leiningen to call 'shutdown-agents?

17:36 certain tasks hang around for a minute after they should have finished

17:40 anyone remember the name of the project to run multiple clojure versions in the same JVM, using classloaders or something?

17:41 TimMc: arohner: I thought it deleted target.

17:42 arohner: TimMc: I'm using :target-path "target/%s/", that might affect things

17:43 TimMc: hmm

17:43 Unpleasantly good point.

17:44 xeqi: arohner: alembic

17:44 ?

17:44 or classlojure

17:48 arohner: xeqi: yeah, classlojure is what I was thinking of, thanks

18:01 eskatrem: Hi, I have trouble running something with a side-effect in a let

18:01 this: (let [x "bbbb"] (for [id (range 1 10)] (save-message :fr id x))) works fine

18:02 justin_smith: for is lazy, if anything is after that, it won't run

18:02 eskatrem: but that: (let [x "bbbb"] (for [id (range 1 10)] (save-message :fr id x)) 5) fails

18:02 justin_smith: see my above

18:02 you probably want to replace for with doseq

18:02 same syntax, but it is for side effects

18:02 eskatrem: I can try, but my for works when the "let" doesn't return anything

18:03 justin_smith: let always returns something

18:03 noonian: in the first version, the let returns the seq returned by the for form

18:03 eskatrem: yes, doseq works!

18:03 noonian: in the second, nothing was ever realizing the lazy-seq returned by for so the side effects don't happen

18:04 justin_smith: we need a #clojure faq: parenthesis, do you have to many? laziness: are you trying to use a lazy form for side effects?

18:06 eskatrem: by the way, do I need to put a do inside a let if I want to run a side effect?

18:06 justin_smith: not at all

18:06 let contains an implicit do

18:06 it is not in any way lazy

18:06 noonian: nope, it has an implicit do, but you don't need do for side effects either, it just lets you execute more than one expression at once

18:06 eskatrem: that's what I suspected, but I still left my "do" for some reason

18:06 justin_smith: noonian: better to say, you only need do when there are side effects

18:07 (imho)

18:07 noonian: justin_smith: huh? but do is not relevant to having side effects is it?

18:07 amalloy: i don't understand noonian's claim at all

18:07 eskatrem: what else other than a side effect can you do with "do"?

18:07 justin_smith: right, but what scenario outside having side effects would call for a do form?

18:07 amalloy: hum a nice little tune, eskatrem

18:08 eskatrem: amalloy: that would be a side effect

18:08 amalloy: do do do dooo do do do doo

18:08 justin_smith: I was thinking "do, a deer, a side effecting deer"

18:08 but I got nothing for re

18:08 eskatrem: (do (sing "do do do") nil)

18:08 noonian: justin_smith: i guess your right, but the semantics of do don't have to do with side effects so i find it confusing saying that you only need it for side effects

18:08 amalloy: you can't think of a re verse for clojure?

18:09 justin_smith: lol

18:09 well, when you put it that way

18:09 noonian: you can always generate a bunch of intermediate garbage with do!

18:09 amalloy: noonian: the semantics of do have everything to do with side effects. it is the only thing you can use it for

18:09 noonian: ,(doc do)

18:09 clojurebot: I don't understand.

18:09 noonian: /facepalm

18:10 amalloy: "evaluate these two expressions and give me the value of the second" is meaningless unless the first expression has side effects

18:11 noonian: ,(do [1 2 3] [1 2 3] [1 2 3])

18:11 clojurebot: [1 2 3]

18:11 noonian: i mean, that is valid clojure because of the semantics of do, i agree it doesn't accomplish anything but has nothing to do with lazyness or side effects

18:13 justin_smith: noonian: the only difference between (do [1 2 3] [1 2 3] [1 2 3]) and [1 2 3] is the side effect of heap usage

18:13 and stack usage too, I guess

18:14 noonian: justin_smith: yeah i agree you can call generating unused garbage a side effects, i'm just expressing that that isn't how i *think* about do and what it does and therefore a statement like 'you only need do for side effects' would confuse me more than help me if i were just learning the language

18:16 justin_smith: but that is emphatically a situation where, unless for some bizarre reason you wanted to create some heap / stack churn, you don't need do

18:17 noonian: yes, totally correct it is unneeded

18:17 amalloy: justin_smith: i generally create extra garbage as a way to punish my computer when a program i wrote doesn't work despite being obviously correct

18:17 noonian: lol

18:17 justin_smith: heh

18:17 noonian: but the jvm loves ephemeral garbage!

18:18 eskatrem: "when a program I wrote doesnt work despite being obviously correct"... and that's my problem just now :(

18:19 justin_smith: amalloy: heap usage of pal, vs the random map creating arrays and then grabbing an element from the last one http://imgur.com/a/7hKoQ

18:21 noonian: whats pal?

18:22 justin_smith: a very bad version of the lazy seq of all palindrom numbers algorithm for a 4clojure problem

18:23 noonian: ah, cool

18:23 justin_smith: http://imgur.com/a/xifNf updated to also show the time after the heap blowup crash

18:23 noonian: here is said bad implementation https://www.refheap.com/90364

18:23 I'll owe you a beer if you can tell me why exactly it uses so much heap

18:24 we know so far that it creates too many short lists

18:24 (that somehow get leaked? I guess)

18:25 amalloy: justin_smith: is line 36-42 just a weird implementation of "merge two sorted lists"?

18:26 justin_smith: amalloy: yeah, actually

18:26 I assume you have a much nicer implementation of that?

18:27 amalloy: well, not shorter, but imo nicer. also a bit more lazy, and works for N lists: https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L259

18:29 justin_smith: nice

18:30 also, regarding your suggestion about using a vector and rseq, that significantly altered the heap usage for the better (but it looks like that wasn't the only problem there)

18:30 gzmask: better way to convert str to float than read-string ?

18:31 because the string is coming from user input field

18:31 justin_smith: ,(Float/valueOf "1.0")

18:31 clojurebot: 1.0

18:31 justin_smith: ,(Float/valueOf "NaN")

18:31 clojurebot: NaN

18:32 gzmask: ,(Float "1.0")

18:32 justin_smith: ,(conj '(:batman) (repeat 8 Double/NaN))

18:32 clojurebot: #<RuntimeException java.lang.RuntimeException: Expecting var, but Float is mapped to class java.lang.Float>

18:32 ((NaN NaN NaN NaN NaN ...) :batman)

18:32 justin_smith: err

18:33 gzmask: Float is a class, you want the method Float/valueOf

18:33 corecode: hi

18:33 justin_smith: or Double/valueOf (but you said float, so I gave you that)

18:33 corecode: is there a way to make the reader parse symbols like "100n"?

18:34 justin_smith: ,100N

18:34 clojurebot: 100N

18:34 justin_smith: is that good enough?

18:34 corecode: why didn't it work

18:34 gzmask: yea, I was looking at http://grimoire.arrdem.com/1.6.0/clojure.core/float/

18:34 corecode: -_-

18:34 gzmask: good enough, thanks

18:34 justin_smith: corecode: 100N != 100n

18:34 corecode: aha!

18:34 what's going on there

18:34 justin_smith: the reader is case sensetive

18:34 corecode: no, i'd need n

18:35 for exponents

18:35 so N is actually something special

18:35 justin_smith: what kind of notation uses n for exponents?

18:35 ,(type 100N)

18:35 clojurebot: clojure.lang.BigInt

18:35 corecode: engineering notation

18:36 m u n p f, k M G T, etc.

18:36 this is for an external DSL

18:36 justin_smith: maybe you want to use java.util.Scanner in that case

18:37 corecode: i don't really want to write my own parser

18:37 justin_smith: Scanner is not a parser

18:37 you basically just tell it "expect a number, followed by n"

18:37 corecode: how do i integrate that into the reader then?

18:37 justin_smith: don't

18:37 the reader isn't what you want here

18:37 corecode: well that won't be useful then

18:38 justin_smith: get a string from stdin, and then use a Scanner on it

18:38 corecode: yes, i want to write something like

18:38 (add-connect c7 (C 100n) (1 (nrf vdd)) (2 (gnd)))

18:38 justin_smith: clojure is not designed to be an extensible-reader language in that way

18:39 corecode: well that is unfortunate :/

18:40 justin_smith: you could use something like {:v 100 :u :n} to stand for 100n, but we don't do custom reading like that

18:40 you can create reader macros, but I think they all have to start with #

18:42 dbasch: I have a collection of strings and want to group them into collections where the total added length of each collection is no more than N chars (as close as possible). Can’t think of a good name for that function

18:43 or if it exists somewhere so I don’t have to write it

18:43 amalloy: dbasch: you need to retain the order of the collection, across chunks, or you just want to throw them all into a big bag?

18:43 dbasch: amalloy: ideally retain the order, but it’s not fundamental

18:44 noonian: justin_smith: what are you using to profile the heap usage?

18:44 justin_smith: noonian: jvisualvm, comes with the jdk

18:44 amalloy: should be doable with https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L193 and a not-very-complex predicate or two, dbasch

18:44 justin_smith: noonian: it's pretty useful, but not perfect UI wise

18:44 dbasch: thanks amalloy

18:45 amalloy: (glue conj [] (constantly true) #(> (apply + (map count %)) N) strings)

18:46 noonian: justin_smith: thanks

18:47 TEttinger: corecode, there are hacks to enable reader macros but they are strongly discouraged because no one would know how to read them...

18:47 and there are reader literals, which are a bit different and allow stuff like DateTime s getting literals to construct them

18:48 dbasch: amalloy: what’s the canonical flatland/useful artifact to include in a project?

18:48 justin_smith: TEttinger: so #"regex" and #{:set} are reader literals, rather than reader-macros?

18:48 technomancy: se.u/ful

18:48 amalloy: dbasch: [org.flatland/useful "0.11.1"]

18:48 dbasch: thanks

18:51 amalloy: i love glue. it's a generalization of a lot of different sequence operations, but still specific enough to be a good starting point

18:54 noonian: justin_smith: and you aren't looking for a different impl right? just want to know why that blows up?

18:55 you don't seem to be using palindromic? in the version you pasted

18:55 justin_smith: noonian: right, it's an exercise and I am using it to challenge myself :)

18:56 noonian: the interesting thing is the bizarre heap usage, and my curiosity is where the leak is (because something is holding onto data the code doesn't think is available)

18:57 noonian: justin_smith: yeah, i've probably lost my evening to playing with visualvm now hehe

18:57 justin_smith: sometimes it is a decent way to find a bug

18:57 danneu: it's not fully clear to me when to use threads vs go-blocks. if i have a websocket server that takes from websocket-chan in a loop, i'd want want that loop in a `thread` block so that i can do IO things like query the db in my handler, right?

18:58 (thread (loop [] (handle-msg (<!! websocket-channel)) (recur)))

18:59 justin_smith: amalloy: http://i.imgur.com/3SmLvpa.png comparison of a run with list/reverse vs. vector/rseq - the vec version gets a lot more done before blowing up

18:59 (same bug is present, clearly)

19:17 my version of lazy sort, only sorts ascending: (defn lazy-sort [& ls] (let [ls (sort-by first (remove empty? ls))] (cons (ffirst ls) (lazy-seq (apply lazy-sort (rest (first ls)) (rest ls))))))

19:22 amalloy: isn't that the same awful sort-lots-of-times thing you ended up benchmarking the other day?

19:23 justin_smith: haha, close to it, but it worked nicely for short sequences, which is the use case here

19:23 mearnsh: amalloy: isn't the default "nil"? :) https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L196

19:24 tuft: trying to use core.logic for a simple game AI. not sure if i'm doing it succinctly, though. this just tries to pick the player with the highest strength card so far https://www.refheap.com/eeece8afd36ffe87143527f74

19:24 amalloy: mearnsh: indeed. no idea why it says false. i don't even remember a version where false was being used

19:25 mearnsh: amalloy: i'm afraid git doesn't lie https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L196

19:26 amalloy: huh? why did you send me the same link again?

19:26 mearnsh: sorry! https://github.com/flatland/useful/commit/b2cf682723467d2da7f51402a5752aedfdf42f84

19:26 half asleep here

19:26 amalloy: yeah, i'm not surprised to learn it was me

19:26 mearnsh: :)

19:29 eskatrem: I have this function here: http://pastebin.com/a6ttFr9h

19:29 noonian: tuft: i might start off with just relations and a call to run*. I don't know enough about core.logic to know what the pldb stuff does i'm afraid.

19:29 eskatrem: when it's run (with the proper input, the function save-message fails, while it works fine when I call it separately - with the same inputs

19:30 noonian: eskatrem: how does save-message fail?

19:31 mearnsh: eskatrem: can you give an example input

19:32 eskatrem: noonian: well, save message if a function to write something in a mongodb database, and it doesnt write anything

19:32 noonian: eskatrem: ok, but it doesn't throw an error?

19:33 eskatrem: nope

19:33 amalloy: so justin_smith, i ran into something unrelated but also weird, when playing around with replacing (Math/pow 10 n) with a compile-time lookup table for all the "reasonable" powers of n: https://www.refheap.com/2c8f40e710f8e2784811d5c09

19:34 eskatrem: also, if I add some print statements inside save-message, they are properly shown

19:34 amalloy: no matter how large i make the lookup table, it always fails on any input larger than eight

19:34 justin_smith: interesting

19:34 amalloy: &(apply * (repeat 32 2))

19:34 lazybot: ⇒ 4294967296

19:35 noonian: eskatrem: can we see the code for save-message

19:35 amalloy: conceivably related to this, actually? some kind of int/long wraparound on the values that somehow messes up the keys?

19:35 justin_smith: amalloy: wat

19:36 that is weird

19:36 amalloy: justin_smith: the behavior, or my speculation?

19:36 justin_smith: the behavior

19:36 amalloy: justin_smith: whoa, the disassembly is weird too

19:36 it just...doesn't include the clause for 9 in the switch statement at all

19:37 has cases for 0-8, and then a default cause which is to throw an exception

19:37 eskatrem: noonian: there: http://pastebin.com/jUjYJmNu

19:38 amalloy: but...if i type that same case statement into the repl myself instead of macroexpanding it, it works

19:38 justin_smith: amalloy: yeah, that code is simple enough, I don't see where something that messed up could be hiding

19:38 amalloy: bug in macrolet...?

19:38 eskatrem: I know it's a bit messy, but I can't figure out why the mongo update is not happening

19:39 amalloy: yes, looks like it must be a macrolet issue. if i use defmacro instead it works

19:41 justin_smith: it's a day for finding weird bugs I guess

19:41 amalloy: hmmmmm, turns out that macrolet expands into a case* instead of a case. i guess it recursively macroexpands itself, and doesn't do it quite right

19:44 tuft: noonian: ah ok, thanks

19:44 noonian: i couldn't find an examples of relations being used outside of pldb

19:44 s/an/any/

19:45 amalloy: aha, i bet the issue is that case embeds a sorted-map in your source code, and that doesn't round-trip through macrolet

19:45 yeah. c.t.macro/expand-all has a cond clause like (map? exp (into {} (map expand-all exp)))

19:46 noonian: tuft: have you read through https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer yet?

19:47 eskatrem: what's the command to wait some time in clojure?

19:47 sleep or something?

19:47 noonian: i ended up getting the reasoned schemer when dabling with core.logic, but i would definitely start trying to understand membero and then try to imlement something simple like that yourself

19:47 eskatrem: (Thread/sleep 1000) sleeps for 1 sec (its java's sleep)

19:48 TEttinger: eskatrem, yeah Thread/sleep but that won't work in clojurescript because there's no java Thread on javascript

19:48 eskatrem: thanks!

19:48 noonian: eskatrem: is $set just a typo in your paste? should be :set?

19:48 amalloy: okay, cool. if i replace (into {} ...) with (into (empty exp) ...) in c.t.macro, it works as expected

19:49 TEttinger: stuff like overtone's at-at lib may be handy in the long run, eskatrem

19:49 eskatrem: noonian: no, I wrote $set on purtpose

19:49 noonian: and you define it earlier?

19:49 eskatrem: from here: http://clojuremongodb.info/articles/updating.html#using_set_operator

19:49 amalloy: well, it probably wants to be {:$set ...}

19:50 eskatrem: I defined my $set here: [monger.operators :refer :all]

19:50 amalloy: ugh, they def the operators as clojure values

19:50 and then expect you to refer them all

19:50 i mean, i dunno, i guess that avoids accidentally writing {:$sset ...}, but it just feels weird

19:51 eskatrem: I was just thinking, my code does: (doseq [message messages-list] (save-message ...)), could I be running into an asynchronicity issue? (like, clojure tries to send all the messages to mongo without waiting for the previous ones to be saved

19:52 noonian: eskatrem: try using {:_id id} instead of {:id id}

19:52 i just think monger isn't finding any documents that match the conditions so it's not updating

19:52 in the examples it is using :_id

19:53 eskatrem: noonian: I tried with _id instead of id, but I ran into some problem because I couldnt convert id into an ObjectId, os id is something I manage manually myself

19:53 no, the documents are there, because if I run (save-message ...) with the same inputs on the repl, it works fine

19:53 noonian: eskatrem: i believe mongodb uses an _id json field to store the document id's

19:55 eskatrem: noonian: you are right but somehow I couldnt manage to import the java class ObjectId

19:56 noonian: eskatrem: hmm, you mean monger couldn't import it? why do you need the ObjectId class?

19:57 eskatrem: because the _id from mongo is of a special class

19:58 I don't remember the details because I did that 2 months ago, but basically I wanted to identify the fields by _id, somehow couldnt and create my own id's instead

19:58 noonian: so if all you change is :id to :_id in your code do you get an error?

19:59 eskatrem: sorry, I cant test that now because somehow my mongdb crashed - it has been the second time today so I suspect it's something with the clojure code

20:00 and I am so stupid I don't know how to start without rebooting my pc (it's 2am here)

20:00 noonian: huh

20:01 sorry man, idk whats going on

20:02 eskatrem: noonian: no problem, I am going to bed and try tomorrow, thanks for having a look

20:02 noonian: np, good luck

20:02 in my experience all good ideas come to you in the shower anyway

20:06 mearnsh: *hammock

20:11 amalloy: glue is so neat. thanks

20:11 amalloy: you're welcome. speaking of, dbasch, did it end up solving your problem?

20:12 dbasch: amalloy: yes, I was about to compare the performance of that and a one-off I wrote

20:13 amalloy: you can definitely get better performance doing it by hand, of course. save the work of re-counting strings over and over

20:18 TEttinger: what is glue, amalloy?

20:18 is it part of flatland/useful ?

20:18 amalloy: it's what they make out of racehorses past their prime

20:18 yes

20:19 https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L193 - i suggested '(glue conj [] (constantly true) #(> (apply + (map count %)) N) strings) as a solution to dbasch's problem of "split a collection of strings into sub-collections each of which is smaller than N characters"

20:21 by the way, dbasch, what do you plan to do if one single string is larger than the size limit? glue would put that into a collection of its own, which seems like the most obvious choice, but you might want to do something more drastic

20:21 dbasch: amalloy: throw exception

20:48 iamjarvo: i am trying to install cider for emacs and i am getting this error 'Package `queue-0.1.1' is unavailable'

20:48 justin_smith: iamjarvo: do you have elpa?

20:49 this is the issue https://github.com/milkypostman/melpa/issues/2005

20:49 amalloy: man, i thought clojure.tools.macro was pretty thorough, but looking through it today i found another bug: it doesn't expand macros inside of set literals

20:50 iamjarvo: justin_smith thanks!

20:51 justin_smith: amalloy: after changing palindrome significantly, no more explosion in mem usage - just sustained usage (and long CPU spin) - now to try to actually solve the exercise

20:51 amalloy: what does the changed version look like?

20:52 justin_smith: much simpler https://www.refheap.com/90372

20:52 I just made a lazy seq of powers of ten, and map across that and the input sequence

20:54 amalloy: justin_smith: PS reversible should just use recur

20:54 justin_smith: oh, of course :)

20:55 amalloy: and (if (seq acc) acc [0]) is okay, but you're missing a chance to use some cool functions: (or (not-empty acc) [0])

20:55 justin_smith: ahh

20:55 amalloy: #(* % %2) is just a lame *

20:55 justin_smith: d'oh, I knew that one

20:56 hell, that's the sort of thing I usually point out

20:56 but I keep forgetting not-empty exists

20:57 amalloy: there's a lot of repetition in the main body, as well: (let [inputs (map breakdown (range))] (drop-while #(< % n) (cons 0 (apply lazy-sort (for [odd [true false]] (rest (map #(palindrome odd %) inputs)))))))

21:00 iamjarvo: justin_smith silly question. where can i find the package.el

21:00 justin_smith: iamjarvo: it comes with newer versions of emacs

21:00 what is your emacs version?

21:00 iamjarvo: 24.3

21:01 justin_smith: yeah, you already have package.el, you just need to make sure your package repositories are configured right

21:04 iamjarvo: justin_smith awesome. but how do i get to it?

21:05 justin_smith: to run it? M-x package-list-packages

21:06 I think there is also some boilerplate you need in your config file

21:47 Jabberz: For compojure, in a route definition, e.g. (GET "/blah" ...), what's the best approach for pulling out both request parameters and session data? It looks like if you need session data, you don't destructure in the route definition, rather past the request map to the handler function to pull out request params + session info

21:54 kyun: Hi everybody

21:55 dbasch: amalloy_: my crappy solution was two orders of magnitude slower than what you pasted

22:09 kyun: Could clojure has the var look like @ARGV in perl?

22:10 xeqi: Jabberz: I've been used something like `(GET "/blah" {:keys [session params]} (let [{:keys [...]} params] (handle-get ...)))`

22:10 justin_smith: kyun: if you have a -main function, it will get the command line args

22:12 mkw: Could anyone help me with using Amazonica to drive DynamoDB, specifically update-items?

22:13 kyun: justin_smith: -main ? No main?

22:14 justin_smith: kyun: when you use :gen-class to make an ns runnable, methods are translated from -method

22:14 Jabberz: xeqi: ah yeah that is more work then I want to do inside the route definition

22:14 justin_smith: kyun: and as far as I know, to make your own class be the executed one, you need :gen-class

22:15 kyun: I just to want run as script~

22:16 amalloy: hahaha that's excellent, dbasch

22:17 justin_smith: kyun: https://github.com/kumarshantanu/lein-exec lein-exec helps with that, but I still think you need a -main function in your primary ns in order to get the command line args

22:17 dbasch: amalloy: see anything obviously wrong with this? https://www.refheap.com/90378

22:17 justin_smith: kyun: clojure is pretty disappointing for scripting by the way. The startup is very slow.

22:18 dbasch: (besides the fact that I didn’t bother with laziness)

22:19 amalloy: dbasch: aside from not being lazy it looks reasonable. you made sure to benchmark a doall of my solution, i imagine. dunno why it's faster; i can't help but imagine it would be slower

22:19 kyun: Thanks for your lib:-)

22:20 justin_smith:

22:20 amalloy: as an aside, you say "didn't bother with laziness", but i think a lazy solution is actually easier to write

22:20 dbasch: amalloy: I hadn’t doall’ed, that was it

22:21 with doall it takes twice as long

22:21 kyun: And I see someone use C++ as script~so haha

22:22 dbasch: amalloy: the first thing that came to my mind was a loop and an accumulator, I didn’t consider another possibility

22:22 justin_smith: kyun: C++ will start up much faster than Clojure

22:24 kyun: And it's complete time...

22:24 dbasch: amalloy: also I was trying to replace this code by someone else, which is really fast but broken (not sure why) https://www.refheap.com/90380

22:24 justin_smith: kyun: compile time should be about comparable between the two

22:24 amalloy: dbasch: since you're playing around with useful already, have you looked at flatland.useful.seq/lazy-loop?

22:24 dbasch: amalloy: noticed it but haven’t looked at it

22:28 kyun: Clojure can use many java lib

22:28 amalloy: dbasch: errrrr, broken because it doesn't have an argument vector?

22:28 dbasch: amalloy: my bad, bad paste

22:29 amalloy: https://www.refheap.com/90381

22:30 amalloy: dbasch: i think it mis-handles the terminating condition at the end of the list

22:30 it recurs with string-pieces even when that might be empty, and then doesn't do an empty? check before calling .length

23:47 untrue: is this the right place to ask questions about ring?

23:48 Jaood: your precious?

23:48 ,ask

23:48 clojurebot: #<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ask in this context, compiling:(NO_SOURCE_PATH:0:0)>

23:48 Jaood: -ask

23:49 .ask

23:49 justin_smith: seems lazybot is on strike again

23:49 ~ask

23:49 clojurebot: The Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.

23:49 justin_smith: oh, there we bo

23:49 Jaood: :)

23:49 untrue: can i use an input stream (i.e. one from clojure.java.io/input-stream) as the :body in a response?

23:50 i've seen it in use in stack overflow answers, but it doesn't seem to work how i'm using it, and i can't find any documentation.

23:50 justin_smith: yes, that should work - do you have an example of what you have tried?

23:51 untrue: am i right to think it'd be the case even if it was a remote url?

23:52 justin_smith: it would work, but a redirect would be more efficient

23:52 untrue: i know, but this (ultimately) grab more than one URL and concatenate them

23:52 will ultimately, even

Logging service provided by n01se.net