#clojure logs

2014-09-17

00:01xeqiwell, 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
00:01xeqipossibly memory-store + extra map from req-key to (Object.) to lock on
00:02kyunWould slurp return the lazy string?
00:02xeqithough I wouldn't bother unless this was a hard requirement for your system
00:02xeqimmitchel_: ^
00:02mmitchel_xeqi: i see what you mean
00:03mmitchel_hmm
00:04mmitchel_yeah, it is a requirement unfortunately
00:07xeqiif 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
00:08xeqior the one from the request and the one in the response, then apply the diff over the one in the store
00:09justin_smithis this something a transaction would help with?
00:09xeqibut that sounds like it might not work well for somethings like flash
00:11TEttingerkyun, slurp is not lazy
00:12TEttingerthere are functions that can lazily read from a file as a stream, though
00:13kyunThanks, and I think if it is lazy that will more easy to use.
00:15mmitchel_xeqi: ok thanks for your help! will think more about this.
00:15mmitchel_justin_smith: you mean the problem i've asked for help on?
00:15mmitchel_i wondered about a transaction too
00:17justin_smithyou want a clean transaction semantics, such that a deletion does not get undone by some other concurrent event, right?
00:18mmitchel_justin_smith: exactly
00:20justin_smithso, the changes have to be ordered
00:22justin_smithwould retrying with an atom work, as long as the other operations respected a deleted session and did not recreate it?
00:23mmitchel_yeah i think so
00:24justin_smithyou 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
00:25mmitchel_yes using an atom already
00:26justin_smiththe 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)
00:32mmitchel_justin_smith: thinking... :)
00:35mmitchel_justin_smith: you said "wrap your updating functions" -- you mean the update function used in the swap! ?
00:35justin_smithyeah, anything touching that atom
00:35mmitchel_ok
00:35justin_smithor maybe this would be a good place to use a validator function
00:36justin_smithI guess you would need to switch to a ref for that
00:38mdeboard[IND]Are there any project templates out there for lcojurescript including om?
00:41sdfgsdfgDoes anyone understand this notation for the usage of the seesaw timer : (timer f & {:keys [start? initial-value], :or {start? true}, :as opts})
00:41justin_smithsdfgsdfg: that's parameter destructuring
00:42sdfgsdfgdo you know where I can find this notation explained or see examples?
00:42justin_smithsadly, destructure lacks a doc string - here's an intro http://blog.jayfields.com/2010/07/clojure-destructuring.html
00:42justin_smiththe destructuring in let / loop / fn / defn all work the same
00:42sdfgsdfgtyvm will take a look
01:29ncthom91hi 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?
01:30justin_smith(apply dissoc m ks)
01:30justin_smith,(apply dissoc {;a 0 :b 1 :c 2} [:a :b])
01:30clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
01:30justin_smitherr
01:31justin_smith,(apply dissoc {:a 0 :b 1 :c 2} [:a :b])
01:31clojurebot{:c 2}
01:31ncthom91awesome, thanks!
01:41ncthom91hmm... 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?
01:41justin_smithyou can't, looping recursion does not work that way
01:42ncthom91justin_smith what's the alternative?
01:44ncthom91i could move hte loop outside of the go block?
01:44ncthom91and then recurse at the end of the loop
01:46justin_smithgo blocks return immediately, if you put one inside a loop, you are just creating multiple blocks
01:46justin_smiththe alternative (the right way to do it) is to use channels to communicate with the code inside the go block
01:51raspasovNickname is already in use.
01:51raspasovoops
02:04vmarcinkohi, 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...
02:04vmarcinkoso the dsl looks like
02:04vmarcinko[:and [:somefn1 arg1 arg2] [:somefn2 arg1 arg2]]
02:05vmarcinkoany suggestion how to implement hti smost easily - using clojure.walk or zippers ort?
02:05vmarcinkonever done something similar so...
02:06ddellacostavmarcinko: check out https://github.com/akhudek/zip-visit
02:07vmarcinkook, thanx...
02:08ddellacostavmarcinko: 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
02:09vmarcinkoah, great...
02:09vmarcinkodidnt know about hat second thing
02:10ddellacostavmarcinko: clojure.zip makes this pretty easy
02:10ddellacostaespecially w/zip-visit
02:33kyunOh, leiningen need jvm 1.7
03:07akurilinDoes anybody know what exactly happens with Ring when it receives more than the :max-threads concurrent requests set at server start?
03:07akurilinBy default it's 50
03:07akurilindoes is drop HTTP requests, does it queue them up somehow?
03:08akurilinI should actually find a tool that will test htat for me :)
03:14akurilinActually I just ran ab against it, definitely doesn't drop anything. Cool stuff
03:15mercwithamouthtest
03:42kyunIt seem that alias clj='java -cp clojure-1.6.0/clojure-1.6.0.jar clojure.main' is a easy way.
03:43hyPiRionkyun: lein works fine with 1.6, but is a bit iffy with very old 1.6 versions
03:44hyPiRionhttps://github.com/technomancy/leiningen/blob/stable/doc/FAQ.md and search for TieredStopAtLevel to find a workaround if that's your issue
03:45kyunVersion is 1.6.0_29-b11
03:45hyPiRionshould be sufficient – what is the issue you're having?
03:48kyunThank you
03:54papachanhow i can convert a nested hashmap to string?
03:55hyPiRion,(pr-str {:foo {:bar :baz}})
03:56clojurebot"{:foo {:bar :baz}}"
03:56hyPiRionpapachan: Is that what you want? ^
03:56papachanbut if i want {"a" {:value "b"}} to "a=b"
04:16TEttingerpapachan: ##(let [m {"a" {:value "b"}}] (str (key m) (apply str (vals (val m))))
04:16TEttingerpapachan: ##(let [m {"a" {:value "b"}}] (str (key m) (apply str (vals (val m)))))
04:16lazybotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to java.util.Map$Entry
04:17TEttingerpapachan: ##(let [m {"a" {:value "b"}}] (reduce (fn [[k v]] (str k (apply str (vals v))))))
04:17lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: core$reduce
04:17TEttingerpapachan: ##(let [m {"a" {:value "b"}}] (reduce (fn [[k v]] (str k (apply str (vals v)))) m))
04:17lazybot⇒ ["a" {:value "b"}]
04:17TEttingergaaaah
04:17papachanTEttinger ?
04:18TEttingersorry, trying to solve the a=b thing
04:18TEttingerI will privmsg the bot
04:18mercwithamouthdoes the clojure for the brave ebook have more chapters than the web version?
04:19clgvTEttinger: your reduce function is missing the second param
04:19papachanTEttinger i am trying to pr-str with replace :p not the best solution
04:19clgvTEttinger:what is your exact goal?
04:19papachanclgv having "a=b"
04:19TEttinger##(let [m {"a" {:value "b"}}] (reduce (fn [s [k v]] (str k "=" (apply str (vals v)))) "" m))
04:19lazybot⇒ "a=b"
04:19papachanyuuu
04:19papachanso fast
04:19clgvah
04:20clgvTEttinger: you know about `reduce-kv` as well, right?
04:20TEttingerno
04:20clgvthen you do now ;)
04:20TEttingerI mostly just use reduce like this
04:20TEttinger(doc reduce-kv)
04:20clojurebot"([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."
04:20clgv##(let [m {"a" {:value "b"}}] (reduce-kv (fn [s k, v] (str k "=" (apply str (vals v)))) "" m))
04:20lazybot⇒ "a=b"
04:21clgvmore efficient and no destructuring needed
04:21TEttingerso it's the same with less destructuring?
04:21clgvyeah
04:21TEttingerhuh
04:21papachanTEttinger is this (reduce (fn [s [k v]] (str k "=" (apply str (vals v)))) "" m)
04:21clgvand if I remember correctly without creating intermediate sequences
04:22TEttingerpapachan, might be better with (reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m)
04:22zotis 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)
04:22zot(i mean outside of generating an uberjar, btw)
04:23TEttinger,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] ((reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m))
04:23clojurebot#<RuntimeException java.lang.RuntimeException: EOF while reading>
04:23TEttinger,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] (reduce-kv (fn [s k v] (str k "=" (apply str (vals v)))) "" m))
04:23clojurebot"a=b"
04:23papachantrying to concat
04:23papachanm hash map can be several
04:24TEttinger,(let [m {"a" {:value "b"} "foo" {:value "bar"}}] (reduce-kv (fn [s k v] (str s ", " k "=" (apply str (vals v)))) "" m))
04:24clojurebot", foo=bar, a=b"
04:24clgv,(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))
04:24clojurebot"foo=bar, a=b"
04:25clgv%15held01%$
04:25clgvlol
04:25papachancool
04:25TEttinger%15held01%$ ?
04:25TEttingerleet speek?
04:26suvashcan somebody help me with cider-clojure-emacs issue on the #clojure-emacs channel ?
04:27suvashtoo less people there, hence asking here.
04:37papachansuvash ?
04:40mpenetanyone 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
04:46TEttingermpenet, on windows, linux, mac, what>
04:46TEttingerwindows may have issues with utf-8 flags in general
04:47mpenetlinux
04:48mpenetwe pass -Dfile.encoding=UTF-8 to java, LC_* are correctly set, somehow the jvm set everything as "ANSI_X3.4-1968"
04:48mpenetex: "file.encoding" "ANSI_X3.4-1968",
04:48mpenet
04:50suvashpapachan: i replied you on #clojure-emacs
06:12CookedGryphontest.check - how do I generate a float in a range nicely?
06:30kevin_What is the equation of metadata.getDirectory(ExifSubIFDDirectory.class) in clojure? I'm using https://code.google.com/p/metadata-extractor/wiki/GettingStarted
06:31hyPiRionCookedGryphon: if you're okay with the upper and lower bounds being integers:
06:31hyPiRion(gen/bind (gen/tuple (gen/choose lower upper) gen/pos-int) (fn [[i v]] (+ (double i) (double (/ v)))))
06:31hyPiRionor something along those lines
06:32CookedGryphonhyPiRion: I've done it really rather nicely, one sec I'll gist it
06:32hyPiRionoh, pos-int should be s-pos-int
06:32hyPiRionah, cool
06:32CookedGryphonhttps://gist.github.com/AdamClements/f53cbce895e470d1935c
06:33CookedGryphonso 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
06:33CookedGryphonand then the in-range one does the same just by multiplying up the values from the 0.0 to 1.0 one
06:35clgvCookedGryphon: 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
06:36CookedGryphonSure, no problem. I have a CA already
06:37vt240Does 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...
06:38agarmanit has completion for static methods.
06:39vt240but not instance methods?
06:39agarmanno
06:40agarmaninside Intellij+Cursive or Emacs+Cider, there is more complete completion
06:40vt240what if I want to see the instance methods?
06:40vt240(clojure/reflect/reflect foo)
06:40vt240?
06:41cflemingagarman: Don't recent versions of nREPL do this via clojure-complete?
06:41vt240uh, clojure.reflect/reflect
06:41agarman,(doseq [x (.getMethods (type ""))] (prn (.getName x)))
06:41clojurebot"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"...
06:41cflemingagarman: I'm not sure since I always use Cursive, but I thought so.
06:42agarmancfleming: it may be available from nREPL, but the command line REPL doesn't seem to do any tab completion of instance methods.
06:44agarmanwith iterm, I use it's autocompletion but have to prime it with (doseq [x (.getMethods (type ""))] (prn (symbol (str "." (.getName x)))))
06:44vt240Should I try Cursive then?
06:44agarmandefinitely
06:44vt240I assumed that emacs + cider was the way to go
06:44agarmanor counterclockwise
06:45agarmanor emacs + cider if you don't mind learning emacs
06:45agarmancounterclockwise + eclipse is good too
06:45agarmanthere's a VIM plugin for clojure that one of the guys here uses
06:45vt240cool
06:47vt240cider uses nrepl, doesn't it
06:47CookedGryphonclgv: Can I just link the gist? Or should I attach a patch/source file?
06:47vt240yeah, it does, I just scrolled up
06:47vt240I'm more of an emacs person than vim
06:48agarmanvt240: all of 'em use nREPL
06:50agarmanvt240: if you don't have emacs setup, you should look at emacs-live, it's a good starting point for clojure dev
06:51vt240agarman: I'm using emacs-live actually :)
06:51vt240it does have tab-completion for static methods, just not sure it has for instance methods
06:53agarmanit is strange with instance methods
06:53clgvCookedGryphon: you should attach a patch file
06:53vt240agarman: strange how?
06:53clgvCookedGryphon: and even better test cases to test your new impl
06:53clojurebotPardon?
06:54agarmanvt240: I've still not figured out when instance methods come up and when they don't
06:54vt240agarman: I haven't been able to make them come up at all :/
06:54vt240seems they might exist though https://raw.githubusercontent.com/purcell/ac-nrepl/master/ac-nrepl.el
06:57agarmanvt240: actually they come up now, but it brings up a ton of methods from a ton of types
06:58vt240you mean all the parent classes up to Object?
06:58cflemingagarman: Yeah, you can't make it any better than that without type inference.
06:58cflemingagarman: And even that is only if the instance object is already present after the thing you're completing.
06:58vt240I'm in a repl, and the symbol has a value
06:58agarmancfleming: yeah it's better than before
06:59agarmanlooks like it's showing all methods for instances that have been imported in the nREPL
07:00cflemingagarman: 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>)
07:00cflemingagarman: Yeah, it can't do much more than that.
07:00agarmancfleming: that will make 7 people using cursive here very happy
07:01cflemingagarman: Nice :-)
07:01vt240that's a cool feature. I'll try to implement in emacs :p
07:01cflemingThat should hopefully come close to Java's ability to discover APIs through completion.
07:02agarmancfleming: are you the author of cursive
07:02cflemingagarman: Yup
07:03cflemingagarman: Now's the moment to tell me your complaints :-)
07:03agarmancfleming: no, not at all, it's made life so much easier for the folks coming from the Java dev world
07:04cflemingagarman: Awesome, glad to hear it
07:05agarmancfleming: 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.
07:05agarmancfleming: though you're doing a good job of countering my opinion :-p
07:06cflemingagarman: Hehe, I guess it remains to be seen if Cursive will be $100 better than emacs!
07:06cflemingagarman: Cursive works with IntelliJ community edition too
07:07agarmanI can't use that for work
07:07cflemingAh, ok - do you need the enterprise features?
07:07agarmanwe released our first open source project last week, but most of our development is closed
07:08cflemingThat's ok, you can use the community edition for closed source development.
07:08cflemingThere's no restrictions on that, it just doesn't have the enterprise features.
07:09agarmancfleming: the java projects here require a couple of the features, but I use eclipse whenever I work with those projects
07:10cflemingagarman: Ok. Generally the community edition will work with any project, you just won't get the additional support.
07:10cflemingagarman: I'd argue that even without the support IntelliJ is better than Eclipse, but that's just me :-)
07:11agarmanI agree that it's better than Eclipse, just the gap is much narrower than it was a few years ago
07:11cflemingYeah, that's probably true in terms of functionality.
07:12cflemingI'm not a fan of the Eclipse UI.
07:12cflemingBut things like Mylyn are pretty awesome, and have no decent alternative for IntelliJ
07:12agarmancfleming: yeah I'm not much into any UI...first thing I do in any app is disable all the noisy menus and buttons
07:13agarmancfleming: if intellij could go all text panes ala emacs, I'd be game for using it
07:13agarmanmore often
07:13cflemingagarman: Yeah, I actually have a doc page on how to do that for Cursive users
07:13cflemingYou can get it pretty minimal.
07:13agarmancfleming: link please?
07:14cfleminghttps://cursiveclojure.com/userguide/ui.html
07:15agarmancfleming: that looks awesome
07:16cflemingagarman: Cool - you can configure the UI pretty much however you like.
07:19agarmancfleming: http://i.imgur.com/OJn3Jmy.png is how my emacs layout looks
07:19cflemingagarman: Sure, you can do that, or pretty close to it.
07:19agarmancfleming: I use emacs --daemon as well, which I'd sorely miss in other IDEs
07:20cflemingagarman: What does that do?
07:20agarmancfleming: emacs starts up when I boot, every instance of emacs attaches to a single emacs copy
07:20agarmancfleming: if I close an emacs client, I can reopen without losing my work
07:21cflemingagarman: Ok, since IntelliJ autosaves, you shouldn't ever lose work.
07:22agarmanhttp://www.emacswiki.org/emacs/EmacsAsDaemon
07:23agarmannvm, that's not the link I was looking for
07:23agarmanhttps://www.gnu.org/software/emacs/manual/html_node/emacs/Emacs-Server.html
07:23agarmanthat's it
07:23cflemingAh, ok
07:24agarmanbasically, starting a new instance of emacs is instantaneous
07:24cflemingIntelliJ/Cursive aren't so good as general editors of single text files - they're very project-based.
07:24cflemingThere'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.
07:25agarmanno doubt, emacs without cider, clojure-mode et al isn't very good for working on projects
07:26agarmancfleming: currently only time I use eclipse (or intellij if I switch) is when I need a break point or to work on java code
07:26agarmancfleming: again, thank you
07:27cflemingagarman: No worries!
08:21visofhi
08:21agarmanhi
08:21visofclojure deps lib, is installed from ~/.m2/repository , can i change this path?
08:21visofi'm trying to package my app as rpm
08:22visofso i need to package it with its deps
08:22agarmancan you do uberjar?
08:23visofagarman: to get a jar file with app + deps and use and deploy this jar?
08:23agarmanyeah
08:24agarmanwe uberjar our apps for simple deployment to our servers.
08:25agarmanif you're using leiningen 'lein help uberjar'
08:26visofagarman: thank you very much, i maybe use lein ring uberwar and deploy in tomcat
08:26agarmanalso look at where the word uberjar comes up in https://github.com/technomancy/leiningen/blob/stable/sample.project.clj
08:27agarmanvisof: kk, :-)
08:39CookedGryphonclgv: Ticket submitted TCHECK-43, I made some improvements and added tests
08:43zamaterianvisof, take care that it uberwar doesn't include dev dependencies in the war files
08:52clgvCookedGryphon: awesome :)
09:11visofi 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?
09:12visofi have checked the logs i got 404
09:19wjlroevisof, I think it depends on the Context Path you mount the app in in tomcat, not 100% sure
09:25zamaterianvisof, 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
09:31visofzamaterian: 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
09:43zamaterianvisof, try adding a echo route like this http://pastebin.com/XAE5Xh19
09:45visofzamaterian: to my routes?
09:47zamaterianI normally add a regex context to my routes, to avoid renaming the war file. http://pastebin.com/KnXDS5zZ
09:47zamaterianvisof, yes to your routes it echos the request back as a string response.
09:50visofzamaterian: i'm trying to do this
09:55zamaterianvisof, if you have problems hitting hte echo route just change context/path to '*'
10:08SagiCZ1hi.. anybody uses regexpal.com ? how do i turn on multiline matching? and how do i do that in clojure?
10:16jeffterrellSagiCZ1: I think you can say ?m at the beginning of your regex.
10:17jeffterrellAs in, #"?mpattern"
10:17SagiCZ1jeffterrell: thanks.. and in regexpal its the "dot matches all" option
10:24alex____1hi
10:26SagiCZ1is there an easy way to dump a whole text file into string? something like FileUtils.fileToString()
10:27tobikSagiCZ1: (slurp filename)
10:27SagiCZ1tobik: that sure was easy, no need for fancy buffered readers, thank you
10:53visofhi
10:54visofi need to make sure has type of [[]] and not [] , how can i do this?
10:55visofneed to make sure my method got argument of type of [[]] and not [] or [[[]]]
10:55visofwhat is the best way to do this?
10:56schmirvisof: most probably you shouldn't do that
10:57visofschmir: why?
10:57visofschmir: what alternatives?
10:58schmirvisof: just let it fail at runtime
10:58schmirwhy do you think you have to do that?
11:01schmiryou 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:01cbpvisof: you can use a precondition
11:06SagiCZ1is there a clojure way to do this?
11:06SagiCZ1,(.contains "Hello" "ll")
11:06clojurebottrue
11:06cbpis that not clojure?
11:07SagiCZ1it is but it uses String method..
11:07SagiCZ1i thought i should rather use clojure.string
11:07clgvSagiCZ1: that is the idiomatic clojure way
11:08clgvSagiCZ1: you could use regexps but that'd be overkill
11:08hyPiRionyeah, that's idiomatic
11:08hyPiRion,((comp boolean re-find) #"ll" "Hello") ; not so idiomatic
11:08clojurebottrue
11:08SagiCZ1alright, thanks :)
11:08xemdetiaSagiCZ1, If anything the way you presented is incredibly easy to understand
11:11oskarth_Is anyone familiar with something like pg's code-tree (https://news.ycombinator.com/item?id=32766) for Clojure?
11:11SagiCZ1xemdetia: 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:12clgvhyPiRion: that re-find is idiomatic but pretty complex for the task to solve ;)
11:12clgvhyPiRion: you should have left out the (comp boolean ..) though ;)
11:13SagiCZ1stupid 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:14hyPiRionclgv: why should I? Usually you'd do (def re-contains? (comp boolean re-find))
11:14SagiCZ1,(->> 3 #(println %))
11:14clojurebot#<sandbox$eval74$fn__75 sandbox$eval74$fn__75@1c6de20>
11:14hyPiRion,'(->> 3 #(println %)) ; this is what the ->> macro sees
11:14clojurebot(->> 3 (fn* [p1__100#] (println p1__100#)))
11:15SagiCZ1so it would put the 3 at the end of the (fn..) list ?
11:15hyPiRionyes
11:16hyPiRionYou can wrap it in a set of parens again if you want to call the anonymous function, but it's not very readable.
11:17SagiCZ1ok thanks..
11:19clgvhyPiRion: since `re-find` returns nil or something truthy - so no need for `boolean`
11:21SagiCZ1is 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:22rweirhow did you end up wanting to evaluate java source code?
11:22hyPiRionclgv: Yeah, I might be in minority wanting my stuff to be actual true and false values.
11:24SagiCZ1rweir: my college wrote a LOT of sql scripts into strings in our source file and i need to pull them to external files
11:24rweiryowzer
11:24SagiCZ1i guess i could filter out the comments and + signs using some clever regexes.. but evaluating would be more bug proof
11:25arohnerso I found something amusing, that might explain the clojure.tools.logging + AOT issues:
11:25arohnerlein do clean, compile clojure.tools.logging clojure.tools.logging
11:25arohnerthat reliably crashes for me, and I don't know why
11:26agarmanSagiCZ1: lein no.disassemble let's you disassemble in the REPL
11:26SagiCZ1agarman: do i want to disassemble the code?
11:26clgvSagiCZ1: only you know ;)
11:27hyPiRionSagiCZ1: that's hard to solve without a java parser and a constant folder
11:27SagiCZ1i already managed to pull the strings out
11:27SagiCZ1its always String sql = "some horrible string"
11:27hyPiRionalright, and it never contains variable names, just strings?
11:28SagiCZ1hyPiRion: just strings and comments
11:28xemdetiasome people just enjoy the pain
11:28SagiCZ1(multi-line strings)
11:28agarmanSagiCZ1: is there any logic around the strings that's important?
11:28hyPiRionIt's probably regexable.
11:29SagiCZ1hyPiRion: 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:29SagiCZ1agarman: yes.. our whole business logic of the app
11:29xemdetiais there just a way to take a class file and have it emit string constants
11:30xemdetiamaybe that would be faster
11:30SagiCZ1xemdetia: is there?
11:30xemdetiaI have no idea
11:30xemdetiaI just am suggesting it in case it helped someone else
11:32clgvdecompiler can extract string constants ;)
11:32xemdetiaThat's true
11:33SagiCZ1clgv: which one?
11:34clgvSagiCZ1: any decompiler
11:34SagiCZ1but wait.. since java has such a common syntax with javascript.. maybe i could use some javascript eval
11:37SagiCZ1but how would i invoke javascript from clojure
11:37xemdetiaSagiCZ1, you say you have your Strings pulled out
11:37xemdetiahow do you have that
11:37xemdetiadid you just do a regex pulling out String to first ;?
11:37xemdetiaor something?
11:38SagiCZ1xemdetia: yes regex
11:38SagiCZ1xemdetia: pulled the methods first, then located the sql variable
11:39xemdetiawhat's stopping you from stripping the leading String varname =, capturing only the "'s and replacing the ';' with a ','
11:39xemdetiathen slapping that big mother in a big ol string array
11:39SagiCZ1xemdetia: nothing that actually sounds like a great idea
11:39xemdetiaString stuff = { "sql1","sql2"+"moresql", "blah" };
11:40xemdetiathen java evals your strings
11:40xemdetiaand you dump to a file
11:40SagiCZ1why did i forget about the little fact that the strings actually have to be in quotes
11:40xemdetiaand ride off into the sunset
11:40SagiCZ1thanks mate!
11:40xemdetianp
11:40SagiCZ1(inc xemdetia)
11:40lazybot⇒ 1
11:44daniel_(inc lazybot)
11:44lazybot⇒ 30
11:44daniel_(inc daniel_)
11:44lazybotYou can't adjust your own karma.
11:44agarman(dec daniel_)
11:44lazybot⇒ -1
11:44agarman:-p
11:44xemdetiaThat should be default behaviour
11:44xemdetia'what are you even doing'
11:50SagiCZ1lel
11:50SagiCZ1is there a character literal for space?
11:50justin_smith ,\space
11:50gzmask\space I think
11:50clojurebot\space
11:50justin_smith,(first " ")
11:50clojurebot\space
11:51SagiCZ1thank you very much
11:51justin_smith,((juxt first identity) " the final frontier")
11:51clojurebot[\space " the final frontier"]
11:52TimMc>_<
11:52opqdonut:D
12:09SagiCZ1maybe 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:09SagiCZ1,(re-find #"<.+>" "hello <Type> 123")
12:09clojurebot"<Type>"
12:10SagiCZ1can the re-find return only what i want? "Type" ?
12:10cbpyou wanna use parens to capture a group
12:10SagiCZ1re-groups maybe
12:11SagiCZ1,(re-groups #"<(.+)>" "hello <Type> 123")
12:11clojurebot#<ArityException clojure.lang.ArityException: Wrong number of args (2) passed to: core/re-groups>
12:11justin_smith,(re-find #"<(.+)>" "hello <Type> 123")
12:11clojurebot["<Type>" "Type"]
12:11SagiCZ1justin_smith: why did it return both?
12:11justin_smiththat's what re-find does
12:11noonian,(doc re-find)
12:11clojurebot"([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:11justin_smithmatch, followed by the groups
12:12SagiCZ1justin_smith: thanks
12:17mpis there a way to define "clojure 1.7.0-latest" in lein's dependencies (for dev purposes of course, not to be released)
12:17mpor "clojure 1.7.* including alphas and betas"
12:18noonianmp: you can build your own lein and point the lein script to use it
12:19nooniansorry, 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:19mpI meant in project.clj of my project, as used by lein
12:20noonianwell, 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:21nooniane.g. this is the first entry in the :dependencies vector of my project: [org.clojure/clojure "1.7.0-alpha2"]
12:28mdeboardarrdem: Are you at StrangeLoop?
12:29gzmaskthe clojure-unity team?
13:21stompyjis anyone here using kafka consumers via clj-kafka?
13:30agarmanstompyj: we were using it for awhile
13:30stompyjagarman: why did you stop? (if you don’t mind me asking)
13:30stompyjI can’t get the consumer portion of the example code to work… its bizarre
13:32agarmanstompyj: we may be using it again, I'd have to check
13:32agarmanstompyj: we stopped because they didn't support consuming from whitelists
13:33stompyjcool, no worries, its probably not worth the effort on your end, I’ll keep digging
13:33stompyjahh ok
13:33agarmanstompyj: but looks like my pull request was merged in, so folks may have switched back to clj-kafka
13:34stompyjare 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:36agarmanusing 0.8.1.1
13:36agarmanand zk 3.4.6
13:38stompyjdang, and clj-kafka works
13:38stompyjinteresting
13:38stompyjok, danke
13:38agarmanstompyj: btw, we're only using clj-kafka as a roll-up for zk & kafka deps atm
13:39stompyjaha
13:39stompyjok
13:39agarmanAFAICT still doesn't support multiple topics on a single consumer
13:40stompyjyeah, it seems very thin as a client lib
13:41agarmanyeah, we decided we didn't want to fork it and are just using our own thin wrapper around the scala lib
13:42agarmanhttps://github.com/nubank/clj-kafka looks to be the most updated fork
13:42stompyjthis 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:42stompyjyeah, I downloaded that recently, and will try that soon
13:42stompyjthanks
13:42agarmankk, :-)
13:43stompyjI would have thought that clojure+kafka would have been a more widely used combo
13:43agarmanwe use kafka for event sourcing and logging
13:46SegFaultAXagarman: Would you mind talking a little more about that pipeline? That's a use case we're currently investigating as well.
13:47agarmanSegFaultAX: for how we use Kafka?
13:50SegFaultAXagarman: As it pertains to event sourcing specifically.
13:51stompyjSegFaultAX: we’re in the beginning stages, but we’re embracing this idea of “universal logging”
13:52stompyjcurrently 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:52stompyjwe’re attempting to take all of those different tributaries and turn them into a river of events
13:52stompyjeverything goes into kafka, and coming out, whoever is interested in a particular event can take action
13:53SegFaultAXOne thing we're struggling with is determining a good structure for each record that works across multiple services in different languages.
13:53SegFaultAXWhich keys are required, which are optional, how to make the record/message/event structure extensible in a meaningful way.
13:54stompyjyeah, that will be our step #2
13:54stompyjright now just moving each existing stream into it’s own topic will solve a huge part of our issue
13:54stompyjbut then the next step is how to we come up with a common schema
13:54SegFaultAXIn 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:54stompyjchanged thought in mid-sentence there, sry
13:56SegFaultAXEveryone who writes about message oriented architectures or CQRS or event sourcing never seems to actually describe the events/messages themselves.
13:56stompyjhaha, 100% agreed
13:56stompyj I wonder about that
13:56stompyjwhenever I ask people directly, I get handwavey answers
13:56stompyjI think it’s still being sussed out by most people
13:56SegFaultAXIt's always some hand-wavy crap like "just send a message when a user makes a payment"
13:57stompyjwe decided to use a pretty basic structured format to start, and we archive everything on s3
13:57stompyjwith the idea that, as we figure things out, we should be able to replay events
13:57stompyjand transform them into whatever schema we decide on
13:58stompyjthere is one good book on it, but it’s a MEAP
13:58stompyjone sec
13:58SegFaultAXFurthermore, not every message is generated in the context of processing an HTTP request. So your schema needs to handle those cases as well.
13:58stompyjhttp://manning.com/dean/
13:58stompyjthis one is not bad, but it’s not complete
13:59stompyjthe author runs a consultancy on top of a product they wrote, and they have some interestign schema ideas in there
13:59stompyjhe actually criticized transit in a very light way, because of it’s lack of schema
13:59stompyjon the HN comments of the official announcement
14:00stompyjI’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:02SegFaultAXtechnomancy: Ping.
14:04SegFaultAXtechnomancy: 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:10technomancySegFaultAX: in a meeting ATM. I haven't written about it, but Mark Mcgranaghan's Conj talk is a good start
14:11justin_smithamalloy_: 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:12justin_smithI would use the input seq directly to avoid holding the head, but here it is input to two different sequences
14:12justin_smith(also, of course, I am open to suggestions from all, just thought he would likely know if anyone did)
14:16hyPiRion,(let [orig (range) incr (map inc orig) decr (map dec orig)] [incr decr])
14:16clojurebot[(1 2 3 4 5 ...) (-1 0 1 2 3 ...)]
14:16hyPiRionjustin_smith: like that? ^
14:16justin_smithhyPiRion: the problem is that holds onto the head of orig
14:17justin_smithwhat if I wrapped each of the results in a (drop 100000000)
14:17dbaschjustin_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:17hyPiRionjustin_smith: Then the head is probably GCed
14:17justin_smithhyPiRion: oh, if it is than of course no worries
14:17stompyjSegFaultAX: 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:18justin_smithhyPiRion: because that is effectively what I am doing already, I just looked at the code and thought that would be a leak
14:18stompyjthx for the hekp
14:19hyPiRionjustin_smith: It'll leak if you're still inside the let, but not outside of it
14:19justin_smithdbasch: that would have the right semantics, but wouldn't it be messy to implement?
14:19hyPiRionso uh
14:20justin_smithhyPiRion: OK, yeah, the elements are taken outside the let block, so all is good there
14:20hyPiRionalright, then it doesn't retain the head of orig
14:20justin_smithhyPiRion: 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:21hyPiRionparallel as in pmap or something like that?
14:22justin_smithas in generated in parallel from the same input, not threaded
14:22justin_smith(the generation is a bit nonlinear, so the sorting has to come after the generation of the two parts)
14:22arrdemmdeboard: I wish :P
14:24hyPiRionwell, two lazy seqs generated from another lazy seq wouldn't retain the head from the original at least
14:24justin_smithcool
14:50stompyjtechnomancy: have you guys announced the successor to pulse?
14:54technomancystompyj: sort of ... http://r.32k.io/l2met-introduction
14:54stompyjthx
14:54technomancystompyj: unfortunately in production we're actually using librato's private fork, which is very divergent
14:55technomancyactually the "history" section there is pretty good
14:56amalloyhyPiRion: 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:56stompyjtechnomancy: interesting. what was the motivation to go to Go instead of clojure?
14:56amalloyas 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:57SegFaultAXtechnomancy: Oh, my mistake. :) Even still, do you have any thoughts on the topic (when you have a free moment)
14:57justin_smithamalloy: thanks, glad to know it works that way
15:06technomancystompyj: it was just written by a different engineer
15:06stompyjtechnomancy: fair enough. :)
15:07technomancystompyj: no idea why google go was chosen in particular; I can't see the appeal personally
15:08stompyjyeah, I just watched Mark’s talk, and I agree with his point, that clojure seems like a very natural choice for event streams
15:08amalloyjustin_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:09stompyjGo (given the little I’ve used it) doesn’t seem to be anywhere near as natural a fit
15:09technomancystompyj: upstream of l2met it's largely erlang, which in this case is an even better fit
15:09stompyjaha! that makes more sense, I looked at the github repo and saw 95% Go
15:10technomancystompyj: https://github.com/heroku/logplex
15:10technomancy^ my day job
15:10stompyjcool 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:11stompyjahhh very cool
15:11stompyjtechnomancy: do you guys still use much clojure @ heroku these days?
15:13technomancystompyj: there are a couple of small codebases, nothing under active development.
15:14stompyjtechnomancy: interesting. sorry to keep bugging you, last question, do you keep supporting leiningen because you dig clojure outside of work?
15:17stompyjtechnomancy: are you going to be at clojure/conj?
15:18technomancystompyj: 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:20stompyjaha, ok! thanks!
15:22mmeixnernewbie-test
15:32irctcHi, I'm getting a java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IFn
15:33irctcbut ,being new to clojure, I don
15:33irctc''t have any idea why
15:33irctchttp://codepaste.net/fi6t4n
15:33irctchere is the code
15:33irctc(jornada *equipos 4) behaves as expected
15:34irctcbut (jornada *equipos* 1) returns the exception
15:34SegFaultAXirctc: Can you share the full trace with us as well?
15:34irctcjava.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:34irctcthis?
15:34SegFaultAXNot in the channel please. :)
15:34clojurebotthis is a better one i think: https://github.com/michaelklishin/neocons
15:34irctcoh sorry
15:34justin_smithirctc: ((nth (robin equipos) (- jornada 1)))
15:34justin_smiththat is likely your problem, too many parens
15:35justin_smith,((nth '(0 1 2) 1))
15:35clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
15:35irctcoh
15:35irctcyes
15:35irctcthank you
15:35justin_smithI suggest a clojure book - parens don't work like they do in most other languages
15:35TheMonarcwhich version of eclipse should i install, if i want to write some clojure?
15:35TheMonarchttp://www.eclipse.org/downloads/?osType=linux
15:36SegFaultAXTheMonarc: The one spelled "IntelliJ"
15:37irctcis clojure programming any good?
15:37irctcalso, is the rest of the code somewhat idiomatic clojure?
15:37TheMonarcseriously, which version
15:38justin_smithamalloy: hyPiRion: if the tail is not held onto, why would this blow the heap for a large n? https://www.refheap.com/90363
15:38justin_smith(it does, btw)
15:38TheMonarcwait
15:38TheMonarcso intellij is better for clojure?
15:39technomancyTheMonarc: the counterclockwise site probably has advice for what to download
15:39TheMonarci'm coming from windows/.NET dev environment
15:40justin_smithTheMonarc: for eclipse I would say the standard version, or the "for java developers" version
15:40justin_smithTheMonarc: from what I have heard, if you have the cash intellij plus cursive is better (but they are not free)
15:40amalloyjustin_smith: you're returning an arbitrarily large sequence for arbitrarily large n
15:40TheMonarcoh, i'm def. sticking with free stuff for now
15:41amalloyso 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:41justin_smithamalloy: it's lazy and it leads with a drop-while, I am calling it as (first (f (* 111111111 111111111)))
15:41justin_smithno printing whatsoever
15:41TimMcTheMonarc: Other options include emacs and vim, if you have familiarity with those.
15:42cflemingjustin_smith: Currently Cursive is free (in beta) and it works with the free and OSS IntelliJ community edition.
15:42justin_smithcfleming: oh, cool, good to know
15:42cflemingjustin_smith: Cursive will probably be free for at least another couple of months.
15:42Rayneslol someone is going to charge for Cursive?
15:43cflemingRaynes: yup
15:44amalloyi would try running it myself, but you have not included the definitions of breakdown or palindrome.
15:44justin_smithamalloy: 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:45justin_smithamalloy: https://www.refheap.com/90364 this is the whole thing, kind of ugly, but correct for smaller inputs
15:45justin_smithmore than kind of ugly - very ugly actually
15:48amalloyjustin_smith: you intend for palindromic? to not be used at all?
15:49justin_smithamalloy: sorry, it is partially complete, and currently unused
15:49justin_smithinstead of detecting palindromes, it is generating them
15:50dbaschI 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:50stompyjcfleming: but since cursive isn’t a jetbrains project, there’s no incentive to purchase a intellij license right?
15:51stompyjcommunity intellij + cursive
15:51amalloyjustin_smith: so what is an input that should blow the heap?
15:51justin_smith(if bound to pals) -> (first (pals (* 111111111 111111111)))
15:51justin_smithit takes a while, but it does it
15:52justin_smithI 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:53SegFaultAXjustin_smith, TheMonarc: IntelliJ has a community edition which is free.
16:02technomancyleiningen 1.x got removed from apt-get
16:03technomancy(which is a good thing)
16:06Gurkenmaster,(which is a good thing)
16:06clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: which in this context, compiling:(NO_SOURCE_PATH:0:0)>
16:06gzmaskwhy people still using lein 1.x is beyond my understanding
16:06Gurkenmaster:(
16:06amalloyhmmmmm. 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:06SegFaultAXBeacuse of Reasons (tm)
16:07amalloyoh, and in breakdown
16:07justin_smithamalloy: weird - shouldn't those be collected?
16:07gzmaskReason #1, laziness (not clojure laziness)
16:08justin_smithamalloy: 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:11amalloyright, i don't really get what's going on yet
16:18technomancygzmask: because it was in apt-get =)
16:19justin_smithamalloy: 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:19amalloyjustin_smith: i mean, i've disassembled the function sample itself, and it very definitely does not hold onto any of: inputs/odd/even
16:20amalloyit sets those to null before it calls iterate/map
16:20amalloyand the heap seems full of teeny tiny lists, length like 3 or 4
16:20amalloywhich seems like those in palindrome
16:21justin_smithwell, used by palindrome, produced by breakdown
16:22amalloyno, they both produce small lists
16:22amalloypalindrome calls reverse
16:22justin_smithahh, the reverse, right
16:22amalloy(which, by the way, you could just use vectors and rseq, instead of lists and reverse)
16:22justin_smithindeed
16:32insamniaci really need to make use of http://mmamath.com
16:33justin_smithinsamniac: your username leads me to believe you may be from the Boston area
16:33insamniacnah, it's just my name is sam
16:34insamniacand it was my aol username when i was 15 because i was oh so clever
16:34AimHereWouldn't an insamniac be someone who can't Sam?
16:35insamniacI don't think it works that way
16:35insamniacUnless there's an analogous word that makes your theory make sense.
16:36amalloyinsamniac: well, insomniac. the "somn" root means sleep
16:36amalloyeg, somnolent
16:36insamniacSo I can't salmon
16:37insamniacman i thought he was gonna beat rashad. they certainly had different career trajectories after that!
16:37AimHereFair 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:37arrdemAimHere: leaping upstream is nearly impossible with jira anyway..
16:43amalloyman, i dunno what is going on with your function, justin_smith
16:44amalloychunking 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:45justin_smithOK, thanks, I am also looking into this with a profiler
16:48justin_smith(first (drop (* 111111111 111111111) (let [r (map (fn [_] (int-array 1000)) (range)) s (map first r)] s)))
16:48justin_smiththe above made a virgin repl jump from ~250m used heap to ~2.5 gig used heap, very quickly
16:49justin_smithand the spikes are jumping from around 2.5g to around 250m, and back again, as the function runs
16:50nooniani like my repls more experienced
16:51technomancy(inc arrdem)
16:51lazybot⇒ 36
16:51insamniacholy crap, i just now realized that i posted that link above in #clojure, rather than the mma channel
16:51justin_smithhttp://i.imgur.com/ueiNTdg.png screenshot
16:52justin_smithinsamniac: I just figured it was some kind of math pun that would be tied back to clojure
16:52hoangelosanyone here use the jclouds api in clojure? I'm getting a totally cryptic error when I run the blockstore function.
16:53noonianhoangelos: i've only use pallet which abstracts over jclouds
16:53stompyjinsamniac: hahahahaha AMAZING
16:53stompyj(inc insamniac)
16:53lazybot⇒ 2
16:53noonianbut i think you can definitely have problems if your versions of jclouds and jclouds providers etc. doesn't match up
16:53stompyjthat makes two people who like clojure and MMA
16:54noonianlol, i assumed rashad was some dev :P
16:55insamniachaha
16:55hoangelosnoonian: I get this error when I try to call blobstore function: http://pastebin.com/QSB2pPYS
16:55insamniacoh yeah that comment was completely out of context
16:56hoangelosMy args are "aws-s3" as the provider, next the access key, and then the secret key.
16:56hoangelosThe access key and secret key are correct.
16:57stompyjOne time I heard that Karo Parysian is better then Anderson Silva because Ryo Chonan beat Silva, but lost to Parysian
16:57stompyjserious MMA Math going on there
16:57justin_smithyeah, you could do some fun stuff with graph algorithms
16:58hoangelosnoonian: 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:58cflemingstompyj: It's not required, right, unless you need the Ultimate edition features.
16:58hoangelosI used the dependencies from https://github.com/jclouds/jclouds-examples/blob/master/blobstore-clojure/project.clj have a different version of clojure though.
16:59cflemingstompyj: They would most likely be the web support, and maybe the node.js stuff if you're doing cljs.
16:59amalloyjustin_smith: have you tried replacing (range) with (iterate inc 0), to see if chunking is relevant?
16:59cflemingstompyj: 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:00cflemingstompyj: But right, for a lot of use cases the community edition is fine.
17:00justin_smithamalloy: good call. Each test is kind of slow (I guess I could reduce my default max heap for this...)
17:00stompyjcfleming: 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:01cflemingstompyj: Right, that would be another thing that an IntelliJ license would solve.
17:01cflemingstompyj: 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:02cflemingstompy: 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:04noonianhoangelos: i might try using jclouds-all instead of jclouds-allblobstore
17:04stompyjcfleming: 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:04nooniani remember having to throw deps in there until my error messages changed and then play detective to figure out what I actually needed
17:05gzmaskclojuredoc is down. what is that nice new clojure online doc site's name?
17:05cfleminggzmask: Grimoire
17:05gzmaskthanks !
17:05nooniangzmask: http://clojure-doc.org/ maybe?
17:05stompyjdoes anyone know how fast conj tickets are going?
17:06arrdemoh shit clojuredocs.org is down
17:06insamniacstompyj: is this in san francisco?
17:06cflemingMaybe they're updating to their new version?
17:06gzmaskthey should ... it's getting outdated
17:06noonianarrdem: woah, grimoire is sweet!
17:06arrdemnoonian: <3
17:06stompyjinsamniac: this clojure/conj is in Washington DC
17:08stompyjinsamniac: the MMA Math was in Boston
17:08cflemingIt's clojure/west that's on the west coast - it was in SF this year.
17:09stompyjinsamniac: also, what mma IRC channel exists
17:11devirranyone know of a good tutorial to deploy a clojurescript app with intel xdk to android?
17:11noonianwhen is the conj? i have family in d.c.
17:11insamniac#MMA-TV on efnet
17:11noonianstompyj: lol
17:11insamniacstompyj: a bunch of savages in there.
17:11stompyjI’d expect nothing eless
17:12insamniacstompyj: I think it's actually the community for a streaming site, but i never bothered to check.
17:12stompyjI’m going to go in there and say that the Weidman got lucky twice
17:12insamniachah
17:13insamniaccan't keep the weidman down
17:18gzmaskarrdem: girmoire need some serious SEO. I googled "clojure document" and it's not on first page
17:20noonianinstructions for obtaining documentation is included in the documentation
17:20arrdemgzmask: the issue is in lack of inbound links and clojuredocs hugepagerank score. not much I can do about either.
17:20arrdemgzmask: known issue tho...
17:21insamniacstompyj: Oh, figures I'm moving from the east coast to the west and then the conj is coming to DC.
17:23arrdemgzmask: https://github.com/clojure-grimoire/grimoire/issues/57 if you have suggestions
17:24gzmaskarrdem: I agree on having a "clojure-grimoire.org" instead of the sub domain right now
17:24gzmaskgoogle probably will rank a sub domain differently
17:25mbriggshey 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:26gzmaskarrdem: and probably submit your google sitemap if you haven't. add some keyword meta tags to your html too
17:27xemdetiaI thought meta tags were basically ignored at this poiint
17:27deadghost^
17:27gzmask<title>Clojure Cheat Sheet (Clojure 1.3 - 1.6, sheet v16)</title> This isn't a particularly SEO friendly title too
17:28arrdemit's all pretty much voodo anyway...
17:28arrdem:/
17:28deadghostclearly add a pinterest and social media buttons
17:28deadghost2. ???
17:28lazybotdeadghost: How could that be wrong?
17:28arrdemdeadghost: off with your head
17:28deadghost3. rank!
17:29xemdetiafrom the last tech talks I watched about google's pagerank the old tricks basically don't work anymore
17:29arrdemone of my buddies demo'd a gtkvim extension that added a FB like button to every line...
17:29hyPiRionarrdem: where do i login with facebook
17:29justin_smithmeta tags are used to generate the preview on the search page (or on social sites where the link is shared)
17:29hyPiRionhah.
17:29justin_smithxemdetia: they are in a red-queen race with the "optimizers"
17:30gzmaskguys, 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:30arrdemwhen I google "clojure documentation" Grimoire is the last thing on the first page..
17:30arrdembut that's from my IP and my google account
17:30arrdemgrumble grumble social search
17:31arohnerargg!! I'm chasing down an AOT bug all fricken day, only to find out 'lein clean' doesn't clean *everything*
17:31noonianyeah, its last for me too but i just visited it
17:32justin_smitharohner: wat
17:32gzmaskyeah, but I used "clojure docs" or "clojure document"
17:32arohnerjustin_smith: clean only cleans your current profile
17:32arrdemclearly I need to write grimoire.js... a javascript plugin that recognizes #'<namespace>/<symbol> notation in blogposts and rewrites them to Grimoire links...
17:32arohnerwhich is a problem when you do things like 'lein clean; lein uberjar'
17:34PigDudeNullPointerException clojure.lang.Numbers.ops (Numbers.java:961)
17:34PigDudehm ...
17:34PigDudeI think my error forgot its trace
17:34justin_smithPigDude: (pst)
17:35PigDudegot it, thanks justin_smith !
17:36arohneris there a way to get leiningen to call 'shutdown-agents?
17:36arohnercertain tasks hang around for a minute after they should have finished
17:40arohneranyone remember the name of the project to run multiple clojure versions in the same JVM, using classloaders or something?
17:41TimMcarohner: I thought it deleted target.
17:42arohnerTimMc: I'm using :target-path "target/%s/", that might affect things
17:43TimMchmm
17:43TimMcUnpleasantly good point.
17:44xeqiarohner: alembic
17:44xeqi?
17:44xeqior classlojure
17:48arohnerxeqi: yeah, classlojure is what I was thinking of, thanks
18:01eskatremHi, I have trouble running something with a side-effect in a let
18:01eskatremthis: (let [x "bbbb"] (for [id (range 1 10)] (save-message :fr id x))) works fine
18:02justin_smithfor is lazy, if anything is after that, it won't run
18:02eskatrembut that: (let [x "bbbb"] (for [id (range 1 10)] (save-message :fr id x)) 5) fails
18:02justin_smithsee my above
18:02justin_smithyou probably want to replace for with doseq
18:02justin_smithsame syntax, but it is for side effects
18:02eskatremI can try, but my for works when the "let" doesn't return anything
18:03justin_smithlet always returns something
18:03noonianin the first version, the let returns the seq returned by the for form
18:03eskatremyes, doseq works!
18:03noonianin the second, nothing was ever realizing the lazy-seq returned by for so the side effects don't happen
18:04justin_smithwe need a #clojure faq: parenthesis, do you have to many? laziness: are you trying to use a lazy form for side effects?
18:06eskatremby the way, do I need to put a do inside a let if I want to run a side effect?
18:06justin_smithnot at all
18:06justin_smithlet contains an implicit do
18:06justin_smithit is not in any way lazy
18:06nooniannope, 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:06eskatremthat's what I suspected, but I still left my "do" for some reason
18:06justin_smithnoonian: better to say, you only need do when there are side effects
18:07justin_smith(imho)
18:07noonianjustin_smith: huh? but do is not relevant to having side effects is it?
18:07amalloyi don't understand noonian's claim at all
18:07eskatremwhat else other than a side effect can you do with "do"?
18:07justin_smithright, but what scenario outside having side effects would call for a do form?
18:07amalloyhum a nice little tune, eskatrem
18:08eskatremamalloy: that would be a side effect
18:08amalloydo do do dooo do do do doo
18:08justin_smithI was thinking "do, a deer, a side effecting deer"
18:08justin_smithbut I got nothing for re
18:08eskatrem(do (sing "do do do") nil)
18:08noonianjustin_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:08amalloyyou can't think of a re verse for clojure?
18:09justin_smithlol
18:09justin_smithwell, when you put it that way
18:09noonianyou can always generate a bunch of intermediate garbage with do!
18:09amalloynoonian: the semantics of do have everything to do with side effects. it is the only thing you can use it for
18:09noonian,(doc do)
18:09clojurebotI don't understand.
18:09noonian /facepalm
18:10amalloy"evaluate these two expressions and give me the value of the second" is meaningless unless the first expression has side effects
18:11noonian,(do [1 2 3] [1 2 3] [1 2 3])
18:11clojurebot[1 2 3]
18:11nooniani 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:13justin_smithnoonian: 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:13justin_smithand stack usage too, I guess
18:14noonianjustin_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:16justin_smithbut 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:17noonianyes, totally correct it is unneeded
18:17amalloyjustin_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:17noonianlol
18:17justin_smithheh
18:17noonianbut the jvm loves ephemeral garbage!
18:18eskatrem"when a program I wrote doesnt work despite being obviously correct"... and that's my problem just now :(
18:19justin_smithamalloy: 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:21noonianwhats pal?
18:22justin_smitha very bad version of the lazy seq of all palindrom numbers algorithm for a 4clojure problem
18:23noonianah, cool
18:23justin_smithhttp://imgur.com/a/xifNf updated to also show the time after the heap blowup crash
18:23justin_smithnoonian: here is said bad implementation https://www.refheap.com/90364
18:23justin_smithI'll owe you a beer if you can tell me why exactly it uses so much heap
18:24justin_smithwe know so far that it creates too many short lists
18:24justin_smith(that somehow get leaked? I guess)
18:25amalloyjustin_smith: is line 36-42 just a weird implementation of "merge two sorted lists"?
18:26justin_smithamalloy: yeah, actually
18:26justin_smithI assume you have a much nicer implementation of that?
18:27amalloywell, 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:29justin_smithnice
18:30justin_smithalso, 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:30gzmaskbetter way to convert str to float than read-string ?
18:31gzmaskbecause the string is coming from user input field
18:31justin_smith,(Float/valueOf "1.0")
18:31clojurebot1.0
18:31justin_smith,(Float/valueOf "NaN")
18:31clojurebotNaN
18:32gzmask,(Float "1.0")
18:32justin_smith,(conj '(:batman) (repeat 8 Double/NaN))
18:32clojurebot#<RuntimeException java.lang.RuntimeException: Expecting var, but Float is mapped to class java.lang.Float>
18:32clojurebot((NaN NaN NaN NaN NaN ...) :batman)
18:32justin_smitherr
18:33justin_smithgzmask: Float is a class, you want the method Float/valueOf
18:33corecodehi
18:33justin_smithor Double/valueOf (but you said float, so I gave you that)
18:33corecodeis there a way to make the reader parse symbols like "100n"?
18:34justin_smith,100N
18:34clojurebot100N
18:34justin_smithis that good enough?
18:34corecodewhy didn't it work
18:34gzmaskyea, I was looking at http://grimoire.arrdem.com/1.6.0/clojure.core/float/
18:34corecode-_-
18:34gzmaskgood enough, thanks
18:34justin_smithcorecode: 100N != 100n
18:34corecodeaha!
18:34corecodewhat's going on there
18:34justin_smiththe reader is case sensetive
18:34corecodeno, i'd need n
18:35corecodefor exponents
18:35corecodeso N is actually something special
18:35justin_smithwhat kind of notation uses n for exponents?
18:35justin_smith,(type 100N)
18:35clojurebotclojure.lang.BigInt
18:35corecodeengineering notation
18:36corecodem u n p f, k M G T, etc.
18:36corecodethis is for an external DSL
18:36justin_smithmaybe you want to use java.util.Scanner in that case
18:37corecodei don't really want to write my own parser
18:37justin_smithScanner is not a parser
18:37justin_smithyou basically just tell it "expect a number, followed by n"
18:37corecodehow do i integrate that into the reader then?
18:37justin_smithdon't
18:37justin_smiththe reader isn't what you want here
18:37corecodewell that won't be useful then
18:38justin_smithget a string from stdin, and then use a Scanner on it
18:38corecodeyes, i want to write something like
18:38corecode(add-connect c7 (C 100n) (1 (nrf vdd)) (2 (gnd)))
18:38justin_smithclojure is not designed to be an extensible-reader language in that way
18:39corecodewell that is unfortunate :/
18:40justin_smithyou could use something like {:v 100 :u :n} to stand for 100n, but we don't do custom reading like that
18:40justin_smithyou can create reader macros, but I think they all have to start with #
18:42dbaschI 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:43dbaschor if it exists somewhere so I don’t have to write it
18:43amalloydbasch: you need to retain the order of the collection, across chunks, or you just want to throw them all into a big bag?
18:43dbaschamalloy: ideally retain the order, but it’s not fundamental
18:44noonianjustin_smith: what are you using to profile the heap usage?
18:44justin_smithnoonian: jvisualvm, comes with the jdk
18:44amalloyshould 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:44justin_smithnoonian: it's pretty useful, but not perfect UI wise
18:44dbaschthanks amalloy
18:45amalloy(glue conj [] (constantly true) #(> (apply + (map count %)) N) strings)
18:46noonianjustin_smith: thanks
18:47TEttingercorecode, there are hacks to enable reader macros but they are strongly discouraged because no one would know how to read them...
18:47TEttingerand there are reader literals, which are a bit different and allow stuff like DateTime s getting literals to construct them
18:48dbaschamalloy: what’s the canonical flatland/useful artifact to include in a project?
18:48justin_smithTEttinger: so #"regex" and #{:set} are reader literals, rather than reader-macros?
18:48technomancyse.u/ful
18:48amalloydbasch: [org.flatland/useful "0.11.1"]
18:48dbaschthanks
18:51amalloyi love glue. it's a generalization of a lot of different sequence operations, but still specific enough to be a good starting point
18:54noonianjustin_smith: and you aren't looking for a different impl right? just want to know why that blows up?
18:55noonianyou don't seem to be using palindromic? in the version you pasted
18:55justin_smithnoonian: right, it's an exercise and I am using it to challenge myself :)
18:56justin_smithnoonian: 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:57noonianjustin_smith: yeah, i've probably lost my evening to playing with visualvm now hehe
18:57justin_smithsometimes it is a decent way to find a bug
18:57danneuit'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:58danneu(thread (loop [] (handle-msg (<!! websocket-channel)) (recur)))
18:59justin_smithamalloy: 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:59justin_smith(same bug is present, clearly)
19:17justin_smithmy 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:22amalloyisn't that the same awful sort-lots-of-times thing you ended up benchmarking the other day?
19:23justin_smithhaha, close to it, but it worked nicely for short sequences, which is the use case here
19:23mearnshamalloy: isn't the default "nil"? :) https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L196
19:24tufttrying 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:24amalloymearnsh: indeed. no idea why it says false. i don't even remember a version where false was being used
19:25mearnshamalloy: i'm afraid git doesn't lie https://github.com/flatland/useful/blob/develop/src/flatland/useful/seq.clj#L196
19:26amalloyhuh? why did you send me the same link again?
19:26mearnshsorry! https://github.com/flatland/useful/commit/b2cf682723467d2da7f51402a5752aedfdf42f84
19:26mearnshhalf asleep here
19:26amalloyyeah, i'm not surprised to learn it was me
19:26mearnsh:)
19:29eskatremI have this function here: http://pastebin.com/a6ttFr9h
19:29nooniantuft: 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:29eskatremwhen 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:30noonianeskatrem: how does save-message fail?
19:31mearnsheskatrem: can you give an example input
19:32eskatremnoonian: well, save message if a function to write something in a mongodb database, and it doesnt write anything
19:32noonianeskatrem: ok, but it doesn't throw an error?
19:33eskatremnope
19:33amalloyso 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:34eskatremalso, if I add some print statements inside save-message, they are properly shown
19:34amalloyno matter how large i make the lookup table, it always fails on any input larger than eight
19:34justin_smithinteresting
19:34amalloy&(apply * (repeat 32 2))
19:34lazybot⇒ 4294967296
19:35noonianeskatrem: can we see the code for save-message
19:35amalloyconceivably related to this, actually? some kind of int/long wraparound on the values that somehow messes up the keys?
19:35justin_smithamalloy: wat
19:36justin_smiththat is weird
19:36amalloyjustin_smith: the behavior, or my speculation?
19:36justin_smiththe behavior
19:36amalloyjustin_smith: whoa, the disassembly is weird too
19:36amalloyit just...doesn't include the clause for 9 in the switch statement at all
19:37amalloyhas cases for 0-8, and then a default cause which is to throw an exception
19:37eskatremnoonian: there: http://pastebin.com/jUjYJmNu
19:38amalloybut...if i type that same case statement into the repl myself instead of macroexpanding it, it works
19:38justin_smithamalloy: yeah, that code is simple enough, I don't see where something that messed up could be hiding
19:38amalloybug in macrolet...?
19:38eskatremI know it's a bit messy, but I can't figure out why the mongo update is not happening
19:39amalloyyes, looks like it must be a macrolet issue. if i use defmacro instead it works
19:41justin_smithit's a day for finding weird bugs I guess
19:41amalloyhmmmmm, 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:44tuftnoonian: ah ok, thanks
19:44tuftnoonian: i couldn't find an examples of relations being used outside of pldb
19:44tufts/an/any/
19:45amalloyaha, i bet the issue is that case embeds a sorted-map in your source code, and that doesn't round-trip through macrolet
19:45amalloyyeah. c.t.macro/expand-all has a cond clause like (map? exp (into {} (map expand-all exp)))
19:46nooniantuft: have you read through https://github.com/clojure/core.logic/wiki/A-Core.logic-Primer yet?
19:47eskatremwhat's the command to wait some time in clojure?
19:47eskatremsleep or something?
19:47nooniani 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:47noonianeskatrem: (Thread/sleep 1000) sleeps for 1 sec (its java's sleep)
19:48TEttingereskatrem, yeah Thread/sleep but that won't work in clojurescript because there's no java Thread on javascript
19:48eskatremthanks!
19:48noonianeskatrem: is $set just a typo in your paste? should be :set?
19:48amalloyokay, cool. if i replace (into {} ...) with (into (empty exp) ...) in c.t.macro, it works as expected
19:49TEttingerstuff like overtone's at-at lib may be handy in the long run, eskatrem
19:49eskatremnoonian: no, I wrote $set on purtpose
19:49noonianand you define it earlier?
19:49eskatremfrom here: http://clojuremongodb.info/articles/updating.html#using_set_operator
19:49amalloywell, it probably wants to be {:$set ...}
19:50eskatremI defined my $set here: [monger.operators :refer :all]
19:50amalloyugh, they def the operators as clojure values
19:50amalloyand then expect you to refer them all
19:50amalloyi mean, i dunno, i guess that avoids accidentally writing {:$sset ...}, but it just feels weird
19:51eskatremI 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:52noonianeskatrem: try using {:_id id} instead of {:id id}
19:52nooniani just think monger isn't finding any documents that match the conditions so it's not updating
19:52noonianin the examples it is using :_id
19:53eskatremnoonian: 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:53eskatremno, the documents are there, because if I run (save-message ...) with the same inputs on the repl, it works fine
19:53noonianeskatrem: i believe mongodb uses an _id json field to store the document id's
19:55eskatremnoonian: you are right but somehow I couldnt manage to import the java class ObjectId
19:56noonianeskatrem: hmm, you mean monger couldn't import it? why do you need the ObjectId class?
19:57eskatrembecause the _id from mongo is of a special class
19:58eskatremI 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:58noonianso if all you change is :id to :_id in your code do you get an error?
19:59eskatremsorry, 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:00eskatremand I am so stupid I don't know how to start without rebooting my pc (it's 2am here)
20:00noonianhuh
20:01nooniansorry man, idk whats going on
20:02eskatremnoonian: no problem, I am going to bed and try tomorrow, thanks for having a look
20:02nooniannp, good luck
20:02noonianin my experience all good ideas come to you in the shower anyway
20:06mearnsh*hammock
20:11mearnshamalloy: glue is so neat. thanks
20:11amalloyyou're welcome. speaking of, dbasch, did it end up solving your problem?
20:12dbaschamalloy: yes, I was about to compare the performance of that and a one-off I wrote
20:13amalloyyou can definitely get better performance doing it by hand, of course. save the work of re-counting strings over and over
20:18TEttingerwhat is glue, amalloy?
20:18TEttingeris it part of flatland/useful ?
20:18amalloyit's what they make out of racehorses past their prime
20:18amalloyyes
20:19amalloyhttps://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:21amalloyby 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:21dbaschamalloy: throw exception
20:48iamjarvoi am trying to install cider for emacs and i am getting this error 'Package `queue-0.1.1' is unavailable'
20:48justin_smithiamjarvo: do you have elpa?
20:49justin_smiththis is the issue https://github.com/milkypostman/melpa/issues/2005
20:49amalloyman, 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:50iamjarvojustin_smith thanks!
20:51justin_smithamalloy: 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:51amalloywhat does the changed version look like?
20:52justin_smithmuch simpler https://www.refheap.com/90372
20:52justin_smithI just made a lazy seq of powers of ten, and map across that and the input sequence
20:54amalloyjustin_smith: PS reversible should just use recur
20:54justin_smithoh, of course :)
20:55amalloyand (if (seq acc) acc [0]) is okay, but you're missing a chance to use some cool functions: (or (not-empty acc) [0])
20:55justin_smithahh
20:55amalloy#(* % %2) is just a lame *
20:55justin_smithd'oh, I knew that one
20:56justin_smithhell, that's the sort of thing I usually point out
20:56justin_smithbut I keep forgetting not-empty exists
20:57amalloythere'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:00iamjarvojustin_smith silly question. where can i find the package.el
21:00justin_smithiamjarvo: it comes with newer versions of emacs
21:00justin_smithwhat is your emacs version?
21:00iamjarvo24.3
21:01justin_smithyeah, you already have package.el, you just need to make sure your package repositories are configured right
21:04iamjarvojustin_smith awesome. but how do i get to it?
21:05justin_smithto run it? M-x package-list-packages
21:06justin_smithI think there is also some boilerplate you need in your config file
21:47JabberzFor 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:54kyunHi everybody
21:55dbaschamalloy_: my crappy solution was two orders of magnitude slower than what you pasted
22:09kyunCould clojure has the var look like @ARGV in perl?
22:10xeqiJabberz: I've been used something like `(GET "/blah" {:keys [session params]} (let [{:keys [...]} params] (handle-get ...)))`
22:10justin_smithkyun: if you have a -main function, it will get the command line args
22:12mkwCould anyone help me with using Amazonica to drive DynamoDB, specifically update-items?
22:13kyunjustin_smith: -main ? No main?
22:14justin_smithkyun: when you use :gen-class to make an ns runnable, methods are translated from -method
22:14Jabberzxeqi: ah yeah that is more work then I want to do inside the route definition
22:14justin_smithkyun: and as far as I know, to make your own class be the executed one, you need :gen-class
22:15kyunI just to want run as script~
22:16amalloyhahaha that's excellent, dbasch
22:17justin_smithkyun: 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:17dbaschamalloy: see anything obviously wrong with this? https://www.refheap.com/90378
22:17justin_smithkyun: clojure is pretty disappointing for scripting by the way. The startup is very slow.
22:18dbasch(besides the fact that I didn’t bother with laziness)
22:19amalloydbasch: 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:19kyunThanks for your lib:-)
22:20kyunjustin_smith:
22:20amalloyas an aside, you say "didn't bother with laziness", but i think a lazy solution is actually easier to write
22:20dbaschamalloy: I hadn’t doall’ed, that was it
22:21dbaschwith doall it takes twice as long
22:21kyunAnd I see someone use C++ as script~so haha
22:22dbaschamalloy: the first thing that came to my mind was a loop and an accumulator, I didn’t consider another possibility
22:22justin_smithkyun: C++ will start up much faster than Clojure
22:24kyunAnd it's complete time...
22:24dbaschamalloy: 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:24justin_smithkyun: compile time should be about comparable between the two
22:24amalloydbasch: since you're playing around with useful already, have you looked at flatland.useful.seq/lazy-loop?
22:24dbaschamalloy: noticed it but haven’t looked at it
22:28kyunClojure can use many java lib
22:28amalloydbasch: errrrr, broken because it doesn't have an argument vector?
22:28dbaschamalloy: my bad, bad paste
22:29dbaschamalloy: https://www.refheap.com/90381
22:30amalloydbasch: i think it mis-handles the terminating condition at the end of the list
22:30amalloyit recurs with string-pieces even when that might be empty, and then doesn't do an empty? check before calling .length
23:47untrueis this the right place to ask questions about ring?
23:48Jaoodyour precious?
23:48Jaood,ask
23:48clojurebot#<CompilerException java.lang.RuntimeException: Unable to resolve symbol: ask in this context, compiling:(NO_SOURCE_PATH:0:0)>
23:48Jaood-ask
23:49Jaood.ask
23:49justin_smithseems lazybot is on strike again
23:49justin_smith~ask
23:49clojurebotThe Ask To Ask protocol wastes more bandwidth than any version of the Ask protocol, so just ask your question.
23:49justin_smithoh, there we bo
23:49Jaood:)
23:49untruecan i use an input stream (i.e. one from clojure.java.io/input-stream) as the :body in a response?
23:50untruei'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:50justin_smithyes, that should work - do you have an example of what you have tried?
23:51untrueam i right to think it'd be the case even if it was a remote url?
23:52justin_smithit would work, but a redirect would be more efficient
23:52untruei know, but this (ultimately) grab more than one URL and concatenate them
23:52untruewill ultimately, even