#clojure logs

2015-03-09

00:00Jabberzso is friend deprecated now in favor of buddy?
00:00justin_smiththey are from different authors
00:00justin_smithI am sure more people are using friend
02:07irctc__what do * functions mean typically?
03:35michaelr`justin_smith: are you here?
03:44nicferrierfantastically frustratedd with all the clojure xml parsers out there.
03:45nicferrierwhat would you expect to get from this? "<a><div>blah</div></a>" ? I'd expect (a (div "blah"))
03:45nicferrierbut I'm getting (a)(div "blah")
03:46michaelr`nicferrier: I used xml vtd clojure wrapper when I needed to work with XML.
03:46nicferriermichaelr`: ptr?
03:48michaelr`nicferrier: try this maybe https://github.com/diamondap/clj-vtd-xml
03:49michaelr`nicferrier: here is another one https://github.com/mudge/riveted
03:54nicferrierwell. I'll try it.
03:55nicferrierin some sense what tagsoup is doing might be considered correct. but not in any sense I am familiar with.
03:58michaelr`yes, the example you've pasted looks strange
03:59nicferrierhey ho, I'll give yours a go.
04:00michaelr`heh ok
04:52BeeCeeMhello
05:02whodidthishow do i write natural_number(0). natural_number(s(X)) :- natural_number(X). in core.logic. wondering how to do the compound term destructuring
05:09nicferriermichaelr`: does vtd parse non-well formed? eg: html5?
05:35kungiWhy do I get an error concerning an uneven number of forms in this map? https://gist.github.com/Kungi/a3d4b342fef1acbd9b87
05:38kungiHmm ok it's the quotes
05:39kungiThe single quotes
05:39noncomwhodidthis: there is a topical chat for core.logic, afaik, called #minikanren
05:40noncomi think getting an ansewr is more probable there
05:53noncomi am using core.async, and i have a go block inside a function that gets called by a java thread on a regular basis. should this somehow cause problems with core.async?
05:57clgvnoncom: you'll have to be more specific. did you experience strange behaviour already?
06:37mercwithamouthhalp! so i added the buddy library to my project....my server will not start up for some reason. https://www.refheap.com/98220
06:46mercwithamouthi'm assuming it's complaining about line 18 https://github.com/funcool/buddy-auth/blob/master/src/clojure/buddy/auth.clj
06:52engblomDo you know about any set of programming exercises made for Clojure? I am not asking for a generic set of excersises like Project Euler & Co.
06:54mercwithamouthclojurekoans
06:54mercwithamouthahh.. a java inconsistency issue
06:55ro_stengblom: 4clojure.com
06:55wagjoengblom: 4clojure.com
06:55engblomBesides clojure-koans. Those were nice as first introduction but I want a bit more advanced stuff.
06:56mercwithamouthahh i'm good ={
06:56mercwithamouthpersonal project time?
06:56engblomro_st, wagjo: Thanks, there I found a list of exercises
06:56mercwithamouthif you want more advanced than why not euler?
06:57mercwithamouthyou said thats what you didnt want but....past clojurekoans if you don't want to do euler/math stuff.....i'd think the next step is just to find a project
06:58ro_stdoing pure algo stuff like 4clojure is great, but the rubber meets the road when you need to do Real stuff like manage user data and organise code
06:58ro_st4clojure is just not going to give you that
06:59engblommercwithamouth: I liked the clojure-koans, but they do not help you in forming basic algorithms in a logic order. You just add something simple inside of a ready written line. Project Euler is not made for clojure, so you might quickly need advanced stuff from the beginning. It is not neccessary a logical order.
07:01clgvmercwithamouth: sounds like an AOT issue
07:02noncomclgv: i get lots of these: https://www.refheap.com/98222
07:03clgvnoncom: awesome. no idea about that
07:03noncomclgv: the essential part is that the "async-dispatch-#" is ever increasing, and the error is in ioc_macros
07:03noncomheh :)
07:04clgvnoncom: I'd build a minimal viable gist and file an issue
07:04noncomyeah, i will try to reproduce it first.. within a minimal case.. i know, it is hard to tell from the current point
07:05mercwithamouthwhere do you all find various white papers related to computer science?
07:06mercwithamouthare there like any sites dedicated or that give a list of popular/interesting papers?
07:06clgvmercwithamouth: google scholar
07:06mercwithamouthgoogle scholar. gotcha =P
07:06clgvah not like that ;)
07:06mercwithamouthsweet
07:06mercwithamouthlol are you sure? =)
07:07clgvmercwithamouth: otherwise the usual publishers: ACM, IEEE, Springer, Elsevier, ...
07:07clgvmercwithamouth: sure about what?
07:08mercwithamouthi have no idea...it's 7am...i've been up for 26 hours and i'm loopy
07:12clgvmercwithamouth: another alternative - search through the recent conferences about the topics you are interested
07:14mercwithamouthclgv: not a bad idea. i just hear guys... nolen, etc that mention various papers in their talks so i figured they're something to look over oppossed to just books and articles
07:15devllI am messing up execution order in my code. anyone could have look at my code?
07:15devllhttp://pastebin.com/BHaeSQFv
07:16devllI am doing a batch insert ,but the (println "batch done") is execute before the loop is done.
07:18clgvdevil: or maybe your loop is done early as you think ;)
07:18clgv*earlier
07:19devllthere are many duplicated errors which are throwed later.
07:19ro_styou're starting a new thread in each catch, devll. is that intended?
07:19clgvdevll: yeah those futures might execute after the loop
07:19devllI know this.
07:20devllhmm.
07:20devllso loop should have been executed ?
07:20clgvdevll: btw do you know `if-let`?
07:20devllyes.
07:20devllthanks for bringing up.
07:20clgvsaves you the duplicate computation ;)
07:21devllI am inserting like 5000 links
07:23devllI guess I am operating on a remote repl.
07:23devllthis was the reason.
07:33wei_is there a packaged version of bootstrap.js for use in clojurescript?
07:35ro_stwww.webjars.org https://github.com/webjars/bootstrap
07:35ro_styes
07:35wei_perfect, thank you
07:37dnolenwei_: ro_st: with the caveat that doesn't ship externs far as I can tell
07:38ro_sti checked cljsjs, no bootstrap there
07:38martinklepschro_st: there's an issue for it
07:39wei_ah, not having to deal with externs was my main reason for doing this
07:40martinklepschfeel free to +1 it
07:40martinklepsch(there's also a link to externs in that issue)
07:42wei_i see, thanks
07:42wei_btw, would this work as well? https://github.com/luxbock/bootstrap-cljs
07:42wei_or this one: https://github.com/elaatifi/packages/tree/react-bootstrap/react-bootstrap
07:45ro_stwei_: are you using Om?
07:45wei_reagent
07:45wei_but anyways, React
07:45ro_sthttps://github.com/racehub/om-bootstrap
08:24justin_smith$mail mercwithamouth I would try requiring the ns from buddy that defines that exception before requiring the namespace that imports the exception.
08:24lazybotMessage saved.
09:36dysfuni'm having a little difficulty understanding why my tests are failing. i'm using with-redefs to assert that a function is being called. i'm using midje https://www.refheap.com/98229
09:37justin_smithdysfun: that with-redefs changes the arity of the function, right?
09:37justin_smithwon't that function complain if it gets an arg?
09:37dysfunaha
09:38dysfunyes, it's changing the arity
09:38dysfunthanks
09:38justin_smithconstantly might help
09:38justin_smithor maybe not...
09:38justin_smithalso, consider using delay or promise instead of an atom if all you do is test whether a specific change has occurred
09:39dysfunhrm, it still failed
09:39dysfunyeah, a promise should be better
09:39clgvyou are testing whether debug logging was triggered? O_o
09:40justin_smithdysfun: also, is timbre/debug a function or a macro?
09:40clgvvery likely a macro
09:40justin_smiththat would mess with with-redefs, I would guess
09:40clgvat least the same functionality in tools.logging is a macro
09:40dysfunugh
09:41clgvdysfun: you should not test that at all, afaik
09:41justin_smithclgv: since the point of the thing is to do logging, that seems an OK thing to test (another option would be to override *out* and test that what you expect, or something like it, is written)
09:41clgvjustin_smith: is that really something you want to test?
09:42dysfuni've hoisted it out into another function so i can override it. thanks for the pointers
09:42clgvdysfun: with the disadvantages going along with that
09:43clgvdysfun: usually it would report the correct location in the stacktrace, I assume
09:43dysfunwell, it's not properly tested now, because i've had to write code that i can't test heh
09:43clgvbut probably not that import for the middleware
09:43dysfunthat the middleware actually performs the designated function seems like a useful thing to test
09:44clgvbut now you are only testing if some concrete function is called, which is clearly an implementation detail
09:45clgve.g. if you change from "debug" to "trace" your test will fail ;)
09:45dysfuntests are designed to exercise code. i don't mind coupling my tests to my code
09:45dysfunyes, that's intended too
09:46clgvshould work then
10:00engblomWow! Why have I never stumbled upon (recur) without (loop) before? I did not know it is possible. This will make the code more easy to read
10:01engblomI thought loop and recur had to be used together.
10:01alcazoidwhat will it do without loop?
10:01engblomalcazoid: http://rosettacode.org/wiki/Greatest_common_divisor#Clojure
10:02alcazoidhm
10:02engblomalcazoid: It is self-explaining there
10:02alcazoidyes
10:02alcazoidneed to google tail call optimization
10:03alcazoidha
10:03alcazoidthat's quite cool
10:03alcazoidi actually had a question about recursion depth limits due to stack size on my mind
10:05justin_smithwell, with recur, there is no depth limit
10:05mavbozoalcazoid: it's one of clojure special forms http://clojure.org/special_forms#Special%20Forms--%28recur%20exprs*%29
10:06mavbozothe recursion point can be function or loop
10:07alcazoidthanks guys, i'm only starting learning clojure
10:07engblomSomebody should chance the documentation to say tell the recursion point can be function or loop: http://clojuredocs.org/clojure.core/recur
10:08engblomWhile I love clojure more for each day that goes, the documentation for clojure is among the worst I have seen. You really have to dig for information and find examples.
10:10dysfungoogle is quite good for that
10:11dvdthi all, i have an issue with records that is really perplexing me. is this the right avenue to ask for help?
10:11engblomI know... but a bit better documentation by (doc what-ever) would be great
10:11justin_smithdvdt: definitely
10:12dvdtok great. my question is do you guys know of a situation where something like this can occur?
10:12dvdtuser=> (defrecord MyRecord []) user.MyRecord user=> (instance? MyRecord (->MyRecord)) false user=> (instance? MyRecord (MyRecord.)) true
10:12justin_smithdvdt: if you have evaluated the defrecord form more than once
10:12justin_smithdvdt: classic reloading problem
10:13justin_smithyou can end up with two MyRecord classes, that are not in fact the same class
10:13dvdtjustin_smith: hm ok thanks! i'll put some debug statements in my code to check that out
10:13dysfuni get this one using reloaded workflow a lot :/
10:14clgvengblom: I'd argue that this example (recur) is explained in the available books in depth
10:16justin_smithdvdt: usually the source of the issue is you have instances of a record that were created before MyRecord was redefined
10:16daniel`never heard complaints over the docs before
10:16daniel`can't say i agree that they are the worst i have seen
10:16justin_smithdvdt: if reloading the definition of MyRecord also involves redefining any used instances in scope, that should avoid the error
10:17clgvdaniel`: you have to listen more ;)
10:17daniel`i try clgv but can't hear everything
10:18mavbozolacks of example in official docs compared to, say, PHP
10:18clgvbut there is information that certainly does not fit into docstrings
10:18clgvbut a lot of that is covered in the books
10:18dysfunmavbozo: most of the php manual's utility is the comments though. also the worst of the web is on there mixed on
10:18clgvmavbozo: well PHP needs it for all the weird exceptions :P
10:19dysfunclgv: you mean "unexpected token T_PAAMAYIM_NEKUDOTAYIM' isn't self-documenting? ;)
10:21alcazoid> a lot of that is covered in the books
10:21alcazoidi hate reading books on programming, i like to dive in
10:21clgvdysfun: I didnt mean exceptions as in "java exceptions" but as in 1+"" = 1 (dont know if that's a real one ;) )
10:21mavbozowe have clojuredocs.org, which is not official, but like PHP's, has examples and comments
10:21alcazoidis clojure's documentation that bad?
10:22clgvalcazoid: well then you might never grasp some of the general concepts since they cant be documented in docstrings :P
10:22dysfunclgv: oh it's full of crap like that. my particular favourite is that you have to use '@' (suppress warnings) in order to check the return value without filling the error log ;)
10:22mavbozoalcazoid: clojuredocs.org is good
10:22mavbozoalcazoid: also the books
10:23clgvalcazoid: no, you can work with it and there are additional resources as clojuredocs.org and clojure-doc.org
10:24alcazoidclgv: mavbozo i read Clojure for the Brave and True atm and it's good. but generally i don't have enough attention span for Big Books on Programming, so i prefer to try to do smth and google/SO a lot
10:24dysfunalso if there's a particular thing you want to know about, asking in here is a good way to learn
10:25alcazoiddysfun: thanks
10:25justin_smithalso, once you learn a few tricks, Clojure is very friendly to exploratory programming, where you use the facilities of the language itself to learn the language.
10:25justin_smith,(clojure.repl/apropos "!")
10:25clojurebot(clojure.core/alter-meta! clojure.core/assoc! clojure.core/compare-and-set! clojure.core/conj! clojure.core/disj! ...)
10:26dvdtjustin_smith: ok well the issue i'm having is i'm trying to dispatch a multimethod off of MyRecordA vs MyRecordB. my defmethods are all in the same namespace as my defprotocols, so shouldn't that mean they get redefined together?
10:27clgv$findfn inc [1 2 3] [2 3 4]
10:27lazybot[]
10:27clgv$findfn 5 2 2
10:27lazybot[clojure.core/primitives-classnames clojure.core/dosync clojure.core/merge-with clojure.core/min clojure.core/quot clojure.core/when clojure.core/default-data-readers clojure.core/char-name-string clojure.core/*data-readers* clojure.core/*clojure-version* clojure.cor... https://www.refheap.com/98231
10:27justin_smithdvdt: no, defmethod is defonce
10:28justin_smithyou need to do (def my-multimethod nil) before reloading
10:28justin_smithor else the multimethod will not be re-evaluated
10:28clgvwhat? $findfn seems broken
10:28clgv$findfn 7 3 2
10:28alcazoidi'm mostly processing data with python nowadays, trying algorythms on data etc etc. are there any machine learning or statistical models libraries for clojure?
10:28lazybot[clojure.core/quot clojure.core/unchecked-divide-int]
10:28clgvah ok ;)
10:31justin_smithclgv: I think there are a lot of functions in clojure that are really hash maps or vectors, where (f a b) returns b because of get
10:31justin_smith,(= (get get get get) get)
10:31clojurebottrue
10:32clgvjustin_smith: yeah guessed so, hence the input change ;)
10:32justin_smiths/I think//
10:37dvdtjustin_smith: I tried your suggestion of (def my-multimethod nil) to reload my multimethod and it seems like I am on the right track. thanks!
10:38justin_smithdvdt: np
10:55michaelr`justin_smith: hi
10:55michaelr`justin_smith: i remember you've said once that you work with big data style stuff, is that right?
10:56TEttingerbig but fits in memory, I think he said
10:56jack0Hi!
10:56michaelr`hehe
10:56TEttingerhey jack0
10:56michaelr`sorry, i read it as big butt fits in memory..
10:57michaelr`i need some architectural advice in that field
10:57jack0Are there any gsoc mentors here?
10:57justin_smithmichaelr`: no, I don't personally do big data so much
10:57justin_smithI beleive I mentioned it as something I knew of people doing in clojure
10:58michaelr`justin_smith: right. for some reason I remembered it was you.. :)
10:59justin_smithI am sure some of the big data folks hang out here (may or may not be around right now, the ones I know of specifically are West coast, and it is early morning on a Monday right now)
10:59justin_smithWest coast US, that is
11:00justin_smithmichaelr`: regardless, it can't hurt to ask your question, someone may know the answer even if they don't consider themselves a "big data expert"
11:00michaelr`justin_smith: exactly :)
11:04michaelr`so the story is about ads, when a user sees an ad, an event is collected then in the next five minutes subsequent events are collected as the user continues to hang on that page or whatever. all of these events come with the same id, and they are supposed to be merged into one event which then goes to kafka and later uploaded in batches to s3.
11:05agarmanall events for a given id end up in same partition of kafka?
11:05michaelr`the question is, what would be the most straightforward/simple/elegant approach to implement that first part where events should be collected for 5 minutes and then merged. subsequent events with the same id after 5 minutes should be ignored.
11:06michaelr`agarman: it could be, i'm designing the system..
11:07michaelr`i gathered that to combine these events some kind of state is needed.. was thinking in the direction of cassandra
11:08michaelr`but really, I want hear what other people might suggest..
11:08agarmanis it fixed 5 minute windows or do they vary? e.g. 11:00 to 11:04:59, 11:05 to 11:09:59 OR starting now 11:08:37 to 11:12:38?
11:09michaelr`the five minutes are counted from the moment the first event with that id arrives..
11:10michaelr`agarman: the second one
11:10justin_smithmichaelr`: sounds like something you could do with a promise or delay, a test if said promise or delay is realized, and a future that sleeps and then delivers to said promise or delay. Even better if instead of a future you can use core.async / go block
11:11justin_smithso the accumulator would check if the "done" delay is delivered, and accumulate if not
11:11justin_smithand the deliverer would sleep for 5 minutes, and then deliver to that delay
11:11justin_smith*force that delay
11:12justin_smiththat's the most elegant way I can think of doing it at least. Especially since you may want to add other conditions that cancel the accumulation, and it's easy enough to have other code force a delay.
11:14michaelr`justin_smith: i'm not sure that i would like to write custom software to do all that. this thing should work at scale - think millions of events at the same..
11:14jack0How do I invoke map or set?
11:14justin_smithyeah, definitely don't want millions of futures
11:14justin_smithjack0: by calling them
11:14justin_smith,({:a 0} :a)
11:14clojurebot0
11:15justin_smithunless you have some nonstandard definition of invoke?
11:16justin_smithmichaelr`: yeah, clearly I am out of my depth on that one
11:20michaelr`justin_smith: thanks :)
11:24justin_smithfor admitting I can't help? Any time, I guess :)
11:25ddellacostamichaelr`: this is not necessarily the right thing for the job but it reminds me of how riemann (http://riemann.io/) works. Maybe just taking a look at that could provoke some inspiration, or lead you down the right path by looking at other systems which work similarly (stream processing)...?
11:26michaelr`justin_smith: for being always willing to help of course..
11:26michaelr`ddellacosta: ok, i'll check riemann thanks
11:26ddellacostamichaelr`: "...a stock Riemann config on commodity x86 hardware can handle *millions* of events per second at sub-ms latencies..." etc.
11:27ddellacostamichaelr`: yeah, hope that helps
11:27agarmandon't use Reimann for any data that you can't lose. It does a best effort to process a stream but by-design it will drop messages
11:28jack0What are the arguments that map can take?
11:28justin_smith,(doc map)
11:28clojurebot"([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments. Returns a transducer when no coll...
11:28justin_smithjack0: the first one ([f]) is only available in version 1.7
11:29justin_smith,(map +)
11:29clojurebot#<core$map$fn__4507 clojure.core$map$fn__4507@2cae49a9>
11:29justin_smith,(map + [1])
11:29clojurebot(1)
11:29justin_smith,(map + [1] [3])
11:29clojurebot(4)
11:29justin_smith,(map + [1] [3] [5])
11:29clojurebot(9)
11:29justin_smithetc.
11:30justin_smithjack0: or did you mean a hash-map?
11:31jack0Hash-Map
11:31justin_smith,(doc get)
11:31clojurebot"([map key] [map key not-found]); Returns the value mapped to key, not-found or nil if key not present."
11:31justin_smitha hash-map as a function ends up calling get
11:31justin_smith,({:a 0} :b)
11:31clojurebotnil
11:32justin_smith,({:a 0} :b :nothing)
11:32clojurebot:nothing
12:17dnolenhttps://github.com/clojure/clojurescript/wiki/Quick-Start
12:17dnolenliterally *everyone* that uses ClojureScript should run through this, it doesn't matter what you use cljsbuild/boot etc. ^
12:22engblomIs it possible to do the naive implementation of fibonacci with double recursion without blowing the stack? I would want to really test the strength of (memoize).
12:24gfredericksyou can do that with vars
12:24gfredericks,(defn fib [n] (if (< n 2) n (+ (fib (dec n)) (fib (- n 2)))))
12:24clojurebot#'sandbox/fib
12:24gfredericks,(fib 5)
12:24clojurebot5
12:24gfredericks,(fib 10)
12:24clojurebot55
12:25gfredericks,(alter-var-root #'fib memoize)
12:25clojurebot#<core$memoize$fn__5435 clojure.core$memoize$fn__5435@63cea432>
12:25gfredericks,(fib 20)
12:25clojurebot6765
12:25gfredericks,(fib 30)
12:25clojurebot832040
12:25gfredericks,(fib 200N)
12:25clojurebot#<ArithmeticException java.lang.ArithmeticException: integer overflow>
12:25gfredericksgotta tweak the fib to make it use big numbers but otherwise that should work
12:26engblom,(defn fib [n] (if (< n 2) n (+' (fib (dec n)) (fib (- n 2)))))
12:26clojurebot#'sandbox/fib
12:26gfredericksactually I'm not sure why it doesn't already work
12:26engblom,(fib 200N)
12:26clojurebotExecution Timed Out
12:26engblom,(alter-var-root #'fib memoize)
12:26clojurebot#<core$memoize$fn__5435 clojure.core$memoize$fn__5435@14cd9cc8>
12:27engblom,(fib 200N)
12:27clojurebot280571172992510140037611932413038677189525N
12:27gfredericksdoes anybody know why my original one doesn't work?
12:27gfredericksooo
12:28gfredericksbecause it had already been memoized with longs
12:28gfredericksso if you call it first with a bigint then it should work
12:28gfrederickssneaky :)
12:28engblomI added +
12:28engblomI added +'
12:28engblomTo automatically promote
12:28gfredericksright but mine doesn't need that as long as you only call it with bignums
12:28gfredericksthe problem was I had called it previously with longs and that's what went into the memoization map
12:30chouserwow. I'm still not getting it, gfredericks.
12:30{blake}dnolen: Where does build.clj go? What directory?
12:31gfrederickschouser: you see why it works okay when not memoized?
12:31engblomStill we get stack overflow even with memoize. Clojure seem to not allow double recur. recur only works with tail
12:31engblom(fib 1000)
12:31gfrederickschouser: because if you call it with a bigint you get bigints all the way down?
12:31engblom,(fib 1000)
12:31clojurebot43466557686937456435688527675040625802564660517371780402481729089536555417949051890403879840079255169295922593080322634775209689623239873322471161642996440906533187938298969649928516003704476137795166849228875N
12:31chousergfredericks: autopromotion by +
12:31gfrederickschouser: I'm talking about my original one that uses +, thus not autopromoting
12:32engblomI blowed the stack with (fib 1000) in my own computer
12:32gfredericksbut if you use bigints up front it can work
12:32clgvengblom: you ouldnt want to use the implementation with exponential runtime anyway ;)
12:32engblomclgv: Nope, but it is interesting to see what Clojure can do. So far I have not seen any programming language handle this naive implementation well
12:32gfredericksengblom: memoize also affects stack usage, so calling it with smaller values first makes it less stackful
12:32chouserah ... I'm confusing autopromotion with coercion to the bigger type
12:33dnolen{blake}: in the current directory, tutorial clarified
12:34gfrederickschouser: still confused about something or all better?
12:34{blake}dnolen: So, the project root.
12:34dnolen{blake}: yep
12:34chousergfredericks: I think I've got it.
12:35{blake}dnolen: I booted under windows this morning. When I do the java -cp cljs...etc. I get "Could not find or load main class clojure.main."
12:35dnolen{blake}: you're truncating your java command, what did you actually type
12:36dnolen{blake}: there maybe Windows issues, these will have to get sorted out later
12:36dnolen{blake}: but I do want to see JIRA tickets for anything anyone encounters on windows
12:36amalloyC:\> java -jar whatever c'mon pls just run my code you know how it goes
12:37gfredericksC:\> is a weird smiley
12:37{blake}dnolen: Well, up till this point it was okay. Windows' mkdir doesn't need the -p and Windows doesn't come with a touch.
12:37{blake}dnolen: I copied in "java -cp cljs.jar:src clojure.main build.clj"
12:37amalloygfredericks: it's been so long since i saw a windows shell prompt. i probably put the \ in the wrong place
12:37justin_smithgfredericks: jaunty clown hat
12:37gfrederickshey I don't know what it looks like either
12:37dnolen{blake}: yeah dunno, I use `lein uberjar clojure.main` to build cljs.jar, anyways write it up in JIRA, thanks.
12:38{blake}gfredericks: lol...you guys are like..."That brothel in town is a disgrace." "Yeah, especially the wallpaper."
12:38{blake}dnolen: OK.
12:38dnolen{blake}: for the `mkdir` bits, happy for people write out the alternative commands for Windows
12:38dnolenthe wiki is community editable
12:39{blake}dnolen: Cool.
13:11timvisheranyone feel like helping me debug a s3 private wagon issue?
13:11timvisheri'm failing to download a -SNAPSHOT jar that i've been able to download successfully before
13:11timvisheri can view the directory using awscli
13:11timvisherthere are in fact jars there
13:12timvisheri have my LEIN_USERNAME and LEIN_PASSPHRASE set up, matching the aws creds (id, secret key)
13:52amalloyso i'm writing this server, composed of some number of component pieces; each component has a shutdown function, to be called when it's time to stop. of course i can easily have the server compose together all these shutdown functions into one "stop everything"
13:52amalloybut what i'm stuck on is, suppose one of the services is broken, and i want to let it stop the whole server. how do i manage the mutual recursion between these? i don't have the composed "stop everything" function until all components are started, so i can't pass it to their constructors
13:54justin_smithamalloy: what about a "meta server" which reduces over all servers to get the "stop server" callbacks, and then calls all of them and returns via reduced if one of them fails?
13:55amalloymy current plan is to give each sub-service a (promise), and then deliver the shutdown-all function to that promise once i have it
13:55amalloytying the knot haskell-style, but it seems gross
13:56justin_smithand that doesn't handle the case where you know you have to shut it all down before they are all started
13:57timvisheri get 403s when trying to retrieve the pom and the jar
13:57amalloyi don't understand your meta-server suggestion at all, justin_smith
13:58justin_smithamalloy: the idea is that if you had a sequence of services to start, you can reduce over it to get a sequence of "stop server" callbacks (if each returned one when started)
13:59justin_smithamalloy: then, as soon as one returned an invalid value, it could call all the stop-server callbacks it collected so far, and then exit via reduced, not starting the rest
13:59justin_smithamalloy: there's a good chance I made some assumption about your setup in all this that does not hold
14:00amalloyjustin_smith: my question is not about what to do if one of the services fails to start at all (although that's probably something i also need to work on), but about when, after all services start successfully, one of them later breaks somehow and decides to shut down
14:02justin_smithamalloy: oh, right. A promise would work for that, but I was definitely answering a different question than the one you asked (perhaps I got sidetracked with my own quesiton: what about the corner case where you need to shut down but the promise is not delivered because they aren't even all started yet?)
14:02amalloyright. a valid concern
14:02amalloyi think i'm okay in that regard because i'm giving each service its own thread, so they can afford to block on the promise
14:03amalloybut it all seems sloppy and lame
14:03justin_smithyeah, I am sure there is an elegant way to do this
14:03amalloyi have been pondering whether core.async helps
14:03amalloysince this seems like a communication problem
14:04justin_smithtimvisher: are the perms shown by the aws cli tools the same on those artifacts as the others?
14:05mgaareamalloy: if you're broadly using the model of stuart sierra's components, the "system" component could pass all the subcomponents a shutdown function that has an async channel that system listens to and shuts down all the components
14:06amalloyyeah, that's the core.async solution i am thinking about. it seems basically the same as sending them a promise, though; a single-use one-way channel is basically just a promise
14:07justin_smithamalloy: makes sense, core.async is about more cleanly representing callbacks
14:07justin_smithand that promise is a callback
14:08justin_smithanother option is to pass (delay :quit) to each one, and have them test if it is realized and exit if/when
14:09justin_smithbut that requires explicitly checking in a loop, which may not work for the service logic
14:28puredangerfyi, there will be a promise-chan in next core.async release http://dev.clojure.org/jira/browse/ASYNC-103
14:29Bronsapuredanger: saw your mail re: tools.reader of a couple of days ago -- no worries
14:29puredangerand (presuming this ticket gets done), all channels will be derefable http://dev.clojure.org/jira/browse/ASYNC-102
14:29puredangerBronsa: good. I released a new version with that :)
14:31Bronsapuredanger: cool, thanks!
14:35timvisherwhat can make a -SNAPSHOT dependency behave like a normal dependency?
14:35timvisher`lein deps :tree` is trying to retrieve the `x.x.x-SNAPSHOT.pom` from the s3 bucket
14:36amalloytimvisher: that probably depends on what you mean by "behave like a normal dependency"
14:36timvisherwhich i don't think is a thing for SNAPSHOT deps
14:36timvisherother `-SNAPSHOT` deps are being pulled down fine
14:36timvisherthere's no typeo afaict
14:36timvishertypo*
14:37timvisherother devs here are able to use this version of this project and pull down that dependency fine
14:37timvisherand i'm able to switch to a slightly different version of that dep `x.x.(inc x)-SNAPSHOT` and have it be retrieved fine
14:38timvisherit seems to not understand that this particular `x.x.x-SNAPSHOT` is in fact a snapshot
14:38timvisheris there cacheing somewhere?
14:39amalloysnapshots have pom files
14:40timvisheramalloy: but they don't get retrieved as `x.x.x-SNAPSHOT.pom`
14:40amalloyyou seem to have reached an erroneous conclusion about what is wrong, and are trying to debug perfectly normal behavior (fetching pom files) instead of the real problem
14:40timvishermaven has to pull the metadata and then select the latest jar from it
14:40timvisheramalloy: i'd be really happy if that were the case :)
14:40amalloywhat? of course they do. check your ~/.m2/repo for some snapshot versions; they all have foo-a.b.c-SNAPSHOT.pom
14:40puredangersnapshots are only pulled once per day by default
14:40timvisheramalloy: none of ours do
14:41timvisherwell, let me check :)
14:41amalloyif that were the case none of your snapshots would work at all
14:41timvisherpuredanger: iut, but if they're not in the local repo then they'll be pulled always, right?
14:41puredangeryes, should be
14:42puredangeryou might check lein pom, then mvn dependency:tree
14:43puredangersometimes maven gives better error messages in lein for stuff like this
14:43timvisheramalloy: i only see `snapshots/project/x.x.x-SNAPSHOT/maven-metadata.xml etc` and `snapshots/project/x.x.x-SNAPSHOT/project.x.x.x-SNAPSHOT.timestamp.pom`
14:43timvisherpuredanger: yep. tried that
14:43timvisherin this instance it was having the same problem
14:44timvisherwhat _has_ solved the problem now is `rm -rf ~/.m2`
14:44timvisherbut wat?
14:44puredangerand then maven has the -U to force update of snapshots
14:44timvisheramalloy: is that different than what you see? that was how i understood snapshots to work
14:44timvisherxml for the selection, and then timestamped jars for the actual dep resolution
14:44amalloypuredanger: lein has the same flag available: lein -U deps
14:44puredangercool, couldn't remember
14:45timvisher`-U` is good to know about :)
14:45amalloy(or, really, lein -U whatever)
14:45timvisheri'm not sure why we're depending on this SNAPSHOT anyway but i still am completely confused as to what could've been causing the dependency to fail
14:45puredangerprob also worth mentioning the savings time change
14:46timvishergiven that i thought SNAPSHOT was all a dependency needed to be 'marked' as a snapshot dep
14:46timvisherdoes lein have a debug mode or something where it can spit out all of the actual intermediary steps it takes to look up the dependency?
14:46timvisheror maven for that matter
14:46puredangermvn -X
14:46timvisheri.e. it pulling the xml and then selecting the timestamp jar?
14:46timvisherpuredanger: thanks
14:47puredangerwith lein I think you can set DEBUG to something in your env first?
14:48puredangeryeah, env var: ;; DEBUG - increased verbosity
14:49dnolen{blake}: btw you have Java 8 installed right? re: cljs.jar troubles
15:05timvisherpuredanger, amalloy: ok. here's what i think was happening. i think the snapshot initially failed to be retrieved because of something (probably misconfigured environment). it was then cached as unavailable in `.maven-metadata` and so it wasn't even trying to hit the network
15:07puredangerthe best one is when a repo throws an html error page and that gets saved as a jar file in your repo
15:07puredangerthat's super awesome
15:09timvisherpuredanger: futuretech
15:11justin_smithpuredanger: oh man, once I tried to work from a cafe, and a whole tree of deps got downloaded, and all were the "sign in to use the internet" splash page for that cafe
15:11justin_smiththat was fun to debug
15:11amalloyi think i remember that
15:11puredangeroh yeah, I've never spent whole days on that or anything
15:11justin_smithhaha
15:11justin_smithamalloy: yeah, I think you helped me figure that one out
15:16timvishermaven :)
15:24{blake}dnolen: I think so. Let me check in a few.
15:26dnolen{blake}: k let me know I verified it work on OS X & Unbuntu w/ Java 8
15:34christaHi. Im still learning clojure, and was thinking about the idiomatic way to map/reduce over a vector of maps, heres what i have atm. https://www.refheap.com/98238
15:35christais there a better way?
15:36{blake}christa: You could just directly use "sums".
15:37gfrederickschrista: (->> sums (map :a) (reduce +))
15:37gfredericksnote that in the code you have there the arg to `candidates` is being ignored
15:37johnmendoncachrista: instead of (fn [coll] (coll :a)), I believe you can just say :a
15:38christawow that terse
15:38christas
15:38christathnx
15:39{blake}christa: Like, "(reduce #(+ % (:a %2) 0 sums)".
15:39pjstadigpuredanger: do you know if/when CLJ-1561 will get applied?
15:40justin_smith(apply + (map :a sums))
15:40justin_smithlikely the best golfing of that one ^
15:41christaHeh, ill try to balance readability with golfing
15:41justin_smithchrista: by "best" I was including readability
15:41christaterse, but still readable
15:41justin_smithor trying to, at least
15:42puredangerpjstadig: I assume the next time Stu looks at stuff to apply
15:43puredangerI'm not actually sure how he managed to apply every other but missed that one :)
15:43justin_smithchrista: for example, I don't see (fn [coll] (coll :a)) as more readable then :a
15:44justin_smithgiven the knowledge that keywords act as a function that does lookup
15:45{blake}dnolen: I get why specifying ":main" in build.clj allows us not have to include main.js in our HTML, but why does ":main" impact whether we have to specify "goog/base.js" in our HTML?
15:46dnolen{blake}: the Quick Start suggests examining out/main.js
15:46{blake}dnolen: No, I see that it's in there. I just don't get what it is about ":main" that says, "Yes, put that google closure in there."
15:47{blake}dnolen: Get my meaning? Specifying ":main" in you build means you don't have to specify main in your HTML. Cool.
15:47{blake}dnolen: But why also does it mean you don't have to specify goog base?
15:48dnolen{blake}: ah right, that's just the nice to have bit
15:48{blake}dnolen: OK, cool. Is there ever occasion you wouldn't need goog base?
15:49dnolenyou always need goog/base.js :main just loads it for you
15:49dnolenit's requirement everywhere, regardless of Rhino, Nashorn, Node.js, or browser
15:49christajustin_smith: just :a def is better, i didnt know you can refrence the key without the collection
15:50{blake}dnolen: Cool, thanks.
15:58clojure-newbhi guys, trying to generate some code to replace a ‘def’ in my program, but the code generated does not work in my program… the basics are at : https://www.refheap.com/98240 any ideas ?
16:00gfredericks,(Object.)
16:00clojurebot#<Object java.lang.Object@4ac9dd40>
16:00clojure-newbsorry… fixed version at : https://www.refheap.com/98241
16:01justin_smithclojure-newb: why do you use strings in the first version, and numbers in the second?
16:03clojure-newbjustin_smith: it ends up operated over by a (str) function later anyway
16:04justin_smithclojure-newb: ##(Integer. 1)
16:04lazybot⇒ 1
16:04justin_smithso what's the error you get?
16:05clojure-newbmy program code works fine with the ‘def’ version
16:05justin_smithalso, you might as well use (mapv ...) instead of (into [] (map ...))
16:05clojure-newbroutes through the vector datastructure fine…
16:05clojure-newboh, I’ll look into mapv, nice
16:05piranhaanybody using pedestal here? Is it possible to strip trailing slash from incoming request so that it'll match my route instead of returning 404? Can't figure if I can do that with interceptors
16:05clojure-newbbut the output from the function bersion is all garbled and the program won’t work with it
16:06clojure-newbgarbled = like #<myunit$something-fn_item$fn__372
16:06justin_smith"garbled" and "won't work" aren't much to work with
16:07clojure-newb[[#<myunit$something-fn_item$fn__372 …]]
16:07justin_smithoh, well the rirst one should have done that too
16:07clojure-newbinstead of [[#(something= 1) …]]
16:07justin_smith#() never prints readably
16:08justin_smithdecision should print just as "garbled"
16:08clojure-newboh
16:08clojure-newbI see
16:08justin_smith,#()
16:08clojurebot#<sandbox$eval49$fn__50 sandbox$eval49$fn__50@1d842dd1>
16:08clojure-newbits fine literal in the code as a def, but println will garble it
16:08Bronsajustin_smith: well, it actually does since 5 hours ago
16:08justin_smithBronsa: woah!
16:08Bronsajustin_smith: as does everything actually
16:09gfrederickshiredman: how often does clojurebot pull code from master?
16:09Bronsajustin_smith: user=> #()
16:09Bronsawell
16:09Bronsauser=> #()
16:09Bronsadamn
16:09Bronsahttp://sprunge.us/JBFj there
16:09justin_smithfascinating
16:09Bronsalinux clipboards are weird
16:09justin_smithindeed
16:10clojure-newbso all this was a red herring and something else is up with what I am trying to do
16:10justin_smithclojure-newb: I think so. Are you intending to build up a bunch of functions of 0 arguments that don't get called?
16:10clojure-newbI’m basically trying to generate a vector of vectors
16:10justin_smithyeah, both the function and the top level def do that
16:11justin_smithand each sub vector contains two elements, each is a function of two arguments
16:11justin_smithnone of the functions get called
16:11clojure-newbwondering why only the former is working (top level def)
16:11clojure-newbyes they get called later
16:11justin_smithI still have no idea what you mean by "working", because the defn will produce a vector of vectors
16:11justin_smithas written there at least
16:11SegFaultAXIs there a hipchat bridge for clojurebot?
16:11justin_smithas long as you call it with an arg that gets ignored
16:12Bronsaso in 1.7 "don't know how to create ISeq from clojure.core$map .." is the new ArityException and "No reader function for tag object" is the new "Unreadable form" :P
16:12justin_smithhaha
16:12justin_smithfun
16:16hiredmanyou forgot about can't cast to future
16:16hiredmanoh
16:17hiredmannm
16:17SegFaultAXhiredman: If I hypothetically wanted to add a hipchat adapter/bridge to clojurebot, where would you suggest I start?
16:17SegFaultAX(Assuming such a thing does not already exist)
16:20hiredmanthat is an excellent question
16:21hiredmanclojurebot uses this crazy https://github.com/hiredman/conduit-irc library for irc, one way to make it work with hipchat would be to hack that library up to speak to hipchat instead of irc
16:21gfredericksSegFaultAX: have you seen the hiprepl lib?
16:21SegFaultAXgfredericks: Googling...
16:21gfredericksmaybe it's more an app than a lib
16:22gfredericks/tailrecursion/hiprepl I think
16:22SegFaultAXhiredman: Ideally clojurebot doesn't care about the medium it's using, right? You just give it an adapter that fits a protocol (or set of protocols)
16:22hiredmanideally
16:23SegFaultAXgfredericks: Wow, that's awesome!
16:23hiredmanat one time it was more like that, it is less like that now, and I don't spend a lot of time working on it now
16:25gfredericksSegFaultAX: I put a branch somewhere that makes the messages dispatch easier to extend
16:25hiredmanideally, what I think clojurebot should be is a message bus with a state machine for every user hanging off of it, but it definitely doesn't look like that now, and I dunno if it ever will
16:25gfrederickshave a customized version at work that reimplements a bunch of the clojurebot stuff
16:25gfrederickswhich is mildly saddening
16:26SegFaultAXgfredericks: Well I think I have most of the feature through another bot already (hubot)
16:26SegFaultAXI'm currently only interested in the eval portion.
16:26gfredericksoh yeah and that's already there
16:26SegFaultAXI know nothing about JVM jails other than it's really hard black magic.
16:27SegFaultAXHow has your experience been with hiprepl?
16:28gfredericksit's a tiny codebase so easy enough to hack
16:28gfredericksI wrote a bash script that reboots it every 6 hours or so just in case
16:28SegFaultAXI guess I'm more asking about clojail-related stuff.
16:28SegFaultAXCan I trust that it's *reasonably* sane?
16:28gfrederickswhat are you worried about?
16:29gfredericksare you making it public?
16:29SegFaultAXNope, it's a company thing.
16:29gfredericksor just having to trust hipchat?
16:30SegFaultAXDon't care about hipchat. I guess if I just put the bot on an instance I don't care about, it doesn't matter.
16:34gfredericksyeah I run it on a dev box
16:41aperiodicSegFaultAX: if you're interested this is how have clojure evaluation in our hubot fork: https://github.com/puppetlabs/kerminator/blob/master/files/scripts/clojure.coffee
16:48jarjar_primehi :)
16:48jarjar_primeanyone able to help me this... i'm getting
16:48jarjar_primeCompilerException java.lang.NullPointerException, compiling:(clojure/core/async.clj:1105:8)
16:49jarjar_prime(:require [clojure.core.async :as async :refer [go]])
16:51jarjar_primeit works in the repl
16:54creeseI'm compiling an uberjar to run in a remove environment. When I run it, I get a java.io.FileNotFoundExecption when it tries to load from "resources/"
16:55creeseHow can this be reconciled?
16:56gfrederickscreese: are you using clojure.java.io/resource?
16:56aperiodiccreese: you need to get the path to the resource using clojure.java.io/resource
16:56aperiodicand it shouldn't start with "resources/"
16:57aperiodicif you have `foo.html` in your resources, you'll want to call (clojure.java.io/resource "foo.html")
16:57gfredericks,(Object.)
16:57clojurebot#<Object java.lang.Object@3920c2e4>
16:57gfredericksI'm waiting to see the new #object "..." printing
16:57creeseaperiodic: it works in my local environment
16:58aperiodiccreese: yeah, because the file "resources/foo.html" exists there. it doesn't when you're running from an uberjar; there are only the resources on the classpath, then
17:00creeseaperiodic: actually, that's what I do
17:00creeseaperiodic: (load-config (clojure.java.io/resource "config.edn"))
17:18puredangergfredericks: user=> (java.net.ServerSocket.) ;; #object[java.net.ServerSocket "ServerSocket[unbound]"]
17:19cflemingpuredanger: The new REPL looks very interesting
17:19puredangercfleming: thought you might be interested :)
17:19cflemingpuredanger: How will data exchange work? Say I want to use it for implementing completion in Cursive, is there some framing in the protocol or something like that?
17:20cflemingpuredanger: How would I match requests to responses?
17:20cflemingpuredanger: Yes, no doubt :)
17:20puredangercfleming: no, they're streams so write, then read
17:21cflemingpuredanger: In my experience, that's difficult to use for tooling
17:21cflemingpuredanger: You end up having to parse streams, which is surprisingly tricky.
17:22cflemingpuredanger: Given that the server process is presumably asynchronous and might be writing output too
17:22cflemingpuredanger: Or is the intention that tools create a separate tooling connection?
17:22puredangeryes
17:23puredangereach socket connection is a separate repl stack with dedicated input/output
17:24cflemingpuredanger: Ok. We're still parsing stdout in order to find out which namespace a current repl is in, though, sounds like.
17:24puredanger*ns*
17:24puredangerright?
17:24cflemingSay I have a user connection, and a tooling connection, for a particular REPL session
17:25cflemingFor the user connection, the user sends commands, and what I don't want to do is to have to parse what gets sent back
17:25cflemingSince the remote process is async etc
17:26puredangerwhy not use the reader?
17:26cflemingI can use the tooling connection for completion etc, but to get the current ns of the user connection, I'd have to attempt to parse stdout on that connection, right?
17:26puredangeroh I think I see what you're saying
17:27cflemingThe reader doesn't work well in the streaming model. The whole point of not having a req/resp is that they're not 1-1
17:28gfrederickscfleming: you don't use nrepl for this?
17:28puredangerbtw, if you could drop these comments on the mailing list thread or the jira that would be helpful for rich to see
17:28cflemingpuredanger: Sure, I will
17:28cfleminggfredericks: Yeah, I do. But I'm going to have to support this new style REPL too for those that don't want nREPL.
17:29gfredericksyeah?
17:29gfrederickswhat are reasons people have for not wanting nrepl?
17:29cfleminggfredericks: https://gist.github.com/levand/b1012bb7bdb5fcc6486f
17:30gfrederickshmm
17:30cfleminggfredericks: Plus the datomic guys had a lot of problems with load-file, I'm not sure why - I don't know if they were sending very large files or what
17:31hiredman(why the heck would you use load-file?)
17:31gfredericksthere was a crazy bug with middleware ordering until recently, could have caused any manner of problems
17:31hiredmanload-file reads and executes
17:31cflemingI suspect there's some middle ground there, which IMO should be a simple framing protocol, because I think REPL interactions are fundamentally req/resp - I don't agree with Rich that they're fundamentally a streaming interaction
17:32Bronsagah, I really don't like this new #object printing
17:32cfleminggfredericks: Maybe, but I think that the argument is often that nREPL is overly complicated, and I don't think anyone likes middleware very much.
17:32cfleminghiredman: When I want to load a file?
17:32cfleminghiredman: You need some way to do that.
17:33hiredmanI must have missined some context
17:33amalloyBronsa: how does it work? what's wrong with it?
17:33cfleminghiredman: require doesn't work over remote connections
17:33hiredmancfleming: sure
17:33Bronsaamalloy: http://sprunge.us/MRJP
17:34hiredmancfleming: I suspect the streaming interaction part is because of *out* and *err*
17:34gfrederickscfleming: nrepl + cursive isn't much more complex process-wise than new-raw-clojure-thing+cursive though
17:34amalloyBronsa: and what's wrong with that?
17:34puredangerBronsa: interested in feedback, don't think it's necessarily final
17:35puredangerone that thing could still be changed (imo) is to make the new tagged-literal thing from read conditionals the default reader
17:35Bronsapuredanger: amalloy I understand why it's technically a better representation than #<..> but my eyes find it too noisy to parse as rapidly as the unreadable one
17:35cfleminghiredman: Sure, but you can stream out and err while having forms and values be req/resp
17:35amalloyBronsa: that sounds like just a matter of practice though
17:35amalloythe current one is not so great either, you've just seen it a lot
17:35cfleminggfredericks: If you take middleware out of the equation, I agree. Unfortunately I'm not the one you have to convince :)
17:36puredangeryeah, there's too many parens too ;)
17:36Bronsaamalloy: you're probably right, yes
17:36nicferrierhas anyone had problems with the latest httpkit?
17:36nicferriermy servers won't start with a rather strange arity error.
17:36brkpnthow can i change the value of variable like (setf x *something*)
17:37Bronsaone advantage of the new "unreadable" printing is that you won't get `>` as the return value plus an "unable to resolve symbol" excecption
17:37puredangercfleming: Rich will take your feedback seriously and sooner better
17:37cflemingpuredanger: sure, is the JIRA the best place?
17:37Bronsaone disadvantage is that "no reader tag implemented for object" is not as direct as "unreadable form" imho
17:37gfrederickscfleming: roger
17:38amalloybrkpnt: most clojure values are immutable. you can't just setf stuff, you have to think functionally
17:38puredangercfleming: either jira or mailing list
17:38puredangerBronsa: well that's where the default reader would help right?
17:38Bronsapuredanger: yup
17:38puredangerit would actually be read into a TaggedLiteral that had a tag and value
17:38cfleminggfredericks: I have other problems with nREPL - I think it tries to be too general. Trying to make it extensible is a mistake IMO.
17:39gfrederickscfleming: extensible which way?
17:39cfleminggfredericks: Although that's more or less the middleware argument in another form.
17:39gfredericksmiddlewares in particular?
17:39gfredericksmiddlewares are super difficult to develop; I've done things I'm not sure how I would do otherwise though
17:39cfleminggfredericks: Right, it seems like nREPL should execute forms, and perhaps load files, and not much more.
17:40gfredericksin particular github.com/gfredericks/debug-repl/
17:40Bronsapuredanger: uh, not sure i like that. might delay errors and hide the cause (even though I hardly if ever, see unreadable form exceptions other than in bad repl interactions)
17:41gfrederickspuredanger: Bronsa: could also read by throwing "unreadable form" or so
17:41cfleminggfredericks: what about that requires middleware? Couldn't you just load the code like normal when the REPL starts?
17:41gfrederickscfleming: um oh man it's complicated
17:41gfrederickscfleming: I'm not even sure what you mean actually
17:41cfleminggfredericks: That's what I do with Cursive - it saves all the middleware/IDE version problems that Cider suffers from
17:42cfleminggfredericks: From the readme, I'm not sure why that lib has to be middleware
17:42gfrederickscfleming: this is a special way to insert the repl in the middle of a function, with all the locals etc.
17:42Bronsapuredanger: i.e. (def x (map inc #<..>)) would return fine and complain about "taggedliteral cannot be cast to ISeq" or something among the line once x gets realized, and don't see the originating bad form either
17:43gfrederickscfleming: the thread executing the break! call just stops and waits for eval msgs, and the middleware diverts eval messages to that waiting thread
17:43gfredericksif you know of a simpler way to get that or similar behavior I would love to rewrite it :)
17:43cfleminggfredericks: I see. Yeah, that's pretty much impossible without something like that.
17:44gfredericksphew
17:44pw4everhi, if I have several Clojure sexp forms in a text file, how can read them one by one using something like clojure.core/read or clojure.edn/read?
17:44gfredericksone thing I thought of is it could start up another nrepl server...which would be...great.
17:44pw4everread appears to only read the first form from a PushbackReader
17:45gfredericksyou can keep calling read, no?
17:46pw4ever@gfredericks wouldn't that keep on reading the first one? let me try using doseq
17:47gfredericksuse repeatedly
17:48amalloypw4ever: (let [reader (...)] (take 4 (repeatedly #(read reader))))
17:48amalloywhere of course you can do fancier stuff to get rid of the 4 literal
17:49pw4ever@amalloy thanks for the code snippet; I will give it a try
17:53pw4everamalloy: indeed, "read" read subsequent forms (I thought it would only read the first one given the immutable pattern of Clojure data structs); one thing: reader requires "java.io.PushbackReader." and io/reader returns a BuferedReader
17:53puredangerBronsa: no idea where that PAM change came from btw :)
17:53pw4everso needs a (java.io.PushbackReader. (reader ..))
17:53amalloymhm
17:56Bronsapuredanger: just don't talk to Rich about git add -p so I can keep hoping on seeing unrealated fixes in feature commits :P
17:57puredangerheh
18:06{blake}dnolen: I'm running Java version 1.8.0_25 when I get that "Error: Could not find or load main class clojure.main."
18:06dnolen{blake}: hrm ok, I have no good way to test Windows sadly
18:06{blake}dnolen: I did the quick-start under Mint 17.1, meanwhile. It's really helpful.
18:06dnolen{blake}: k cool
18:07pw4ever`for the record, loop/recur of "edn/read" works for me as follows: (let [r (->> the-file io/resource io/reader (#(java.io.PushbackReader. %)))] (loop [l (edn/read {:eof nil} r)] (when l (println l) (recur (edn/read {:eof nil} r)))))
18:07pw4ever`the {:eof nil} in edn/read prevents EOF RuntimeException of being thrown
18:07{blake}dnolen: So, java is looking for clojure.main, which you have in the cljs.jar, but for whatever reason, java under Windows isn't finding that in the jar?
18:08dnolen{blake}: seems like, the AOTed JAR is produced via `lein uberjar clojure.main`
18:08amalloypw4ever`: instead of that loop/recur, you can just write (take-while identity (repeatedly #(edn/read {:eof nil} r)))
18:08amalloynote that both of these versions stop when they read a nil or false
18:09pw4ever`thanks @amalloy, that's definitely a more functional way to write it
18:09{blake}dnolen: From the Clojurescript root dir? So if I git cloned this: https://github.com/clojure/clojurescript and did the "lein uperjar clojure.main", I'd get the same cljs.jar?
18:12dnolen{blake}: that's right
18:13dnolen{blake}: script/uberjar
18:13dnolenis what you want to run
18:14the_dankocfleming greetings! do you have any links you may be able to point me to about how to add java to a standard lein clojure project in cursive?
18:14the_dankocfleming i mean to java source files. to make it a mixed project.
18:16cfleminggfredericks: I think I'd use a debugger in that case, to be honest
18:17the_dankocfleming ok i just found this https://github.com/technomancy/leiningen/blob/master/doc/MIXED_PROJECTS.md
18:19imanc_so I have map that has {:x someval, :y somewal} and want to do : if x < 0: x = scr_width; if x > scr_width: x = 0; if y < 0: y = scr_height; if y > scr_height: y = 0.
18:19imanc_is there a way to cleanly do that without a load of nested if-lets or assocs, etc.?
18:22amalloyimanc_: write a function that takes in the current x and scr-width, and returns a new x. you can reuse that same function for manipulating y
18:22amalloythen (-> m (wrap :x width) (wrap :y height))
18:23imanc_amalloy: that's perfect. Thanks!
18:23Mercwithamouthwith ragtime when creating new migration files i notice the format is year/month/date..then there are additional numbers. is there any logic to those extras?
18:24Mercwithamouthi'm surprised they don't allow lein ragtime new 'table-name'
18:39cflemingthe_danko: Sorry, I have to go, but that's what you need, right
18:39the_dankocfleming thanks!
18:40the_dankocfleming have a good whatever time of day it is over there
18:40cflemingthe_danko: Just about lunchtime :)
18:50amalloyjustin_smith: note that in the last example of http://stackoverflow.com/a/28944449/625403, you should strictly speaking quote the x you're let-binding: (list 'let ['x (list 'quote x)] ...)
18:50amalloyyour version only works for values which self-evaluate
18:51justin_smithamalloy: yes, see the comments
18:51justin_smithI should edit it
18:52amalloyjustin_smith: i don't see a resolution in the comments. neither version will really work with (Object.), or at least not portably, but my version fixes the issue with, eg, (range 5)
18:53amalloys/portably/within the vague spec of "things rich says you're supposed to be allowed to do"/
18:53justin_smithyeah, I didn't mean it was resolved in comments, more that it was something actively being discussed
18:54justin_smithI should probably take out the whole "construct a let statement" part and just say "can't be done in any sane manner"
18:54amalloyperhaps so. still, i wanted to make sure you saw why your version has problems when x is (range 5) - you're double-evaluating x, basically
18:56fegiHi everybody... Is anyone here sucessfully working as a clojure programmer? How did you get to that point? I'm very curious, as that seems like something I'd want to do.
18:57justin_smithfegi: I knew a guy who snuck some clojure into his company's web stack and they were like "OK cool let's hire another Clojure guy then" but I don't think that's very generalizable.
18:59justin_smithamalloy: thanks for the heads up, definitely an oversight on my part
19:01{blake}dnolen: I don't know if this is helpful but I get a "The Main-Class specified does not exist within the jar" when I uberjar.
19:02dnolen{blake}: not particularly helpful as it doesn't tell me what I need to fix :)
19:02dnolenand yes I get that too
19:04fegijustin_smith: that's good to hear :-). I was hanging out with a friend who works at amazon, and they are considering clojurescipt as an alternative for componentising(?) their web stuff.
19:05{blake}dnolen: Oh, okay. So that's not news. =P
19:05justin_smithfegi: also, if you hang out here and follow the mailing list (google group), stuff comes up occasionally
19:09dnolen{blake}: yeah I think Windows fix will have to come in a later release, held off on this one long enough
19:11{blake}dnolen: Yeah, I wouldn't hold anything up for it. I'll try on some other machines to see if it's just something funky about this Win7 installation.
19:25gfrederickscfleming: yeah a general debugger is definitely a better goal; do you know of any that are not editor-specific?
19:31justin_smithgfredericks: if you want to do things in pure jvm terms, there is jdb, which the emacs gdb tooling (gud) can use iirc.
19:31justin_smithI wouldn't expect anything user friendly, but I have solved weird bugs that way
19:32justin_smithgfredericks: there is also schmetterling which can show you the context where a stack trace occured, and show locals (but unlike jdb does not do step debugging)
19:34gfredericksso similar to debug-repl
19:34justin_smithyeah, inspired by debug-repl actually
19:34gfredericksthe original one I imagine
19:34justin_smithyeah, we wanted something that wasn't editor specific
19:35gfredericksdoes jdb let you run code? just skimmed the docs
19:35justin_smithgfredericks: yeah, but it's all gonna be in jvm terms
19:35gfredericksdebug-repl isn't editor-specific; mine isn't certainly
19:35justin_smithso it accepts a java-like syntax
19:36gfredericksit's just nrepl, which is how cfleming & I got on this topic
19:36justin_smithgfredericks: right, what I meant is that was why we started with debug-repl
19:36gfredericksohgotcha
19:41eben_I need some help with midje and datomic…
19:43dnolenhttps://groups.google.com/forum/#!msg/clojurescript/fdT3f1HxJzM/rCbi7L1AI24J
19:45nullptr(inc dnolen)
19:45lazybot⇒ 21
19:54@rhickeyping cfleming
19:54@rhickeycfleming: ping
20:05crazydiamondHi. Is there any full-automatic kind of SQL library? I.e. one able to create databases and tables, as well as migrations. Seems that Korma lacks that features http://ylamaki.com/blog/2013/06/30/rediscover-the-beauty-of-programming-with-clojure-and-korma/ this guy is doing it manually there
20:11{blake}crazydiamond: I don't think so. You do have access to straight SQL, of course.
20:12crazydiamondyep. I see Korma is doing two things at time - i.e. isolates us from SQL (different dialects), but also adds level of abstraction
20:13crazydiamondmay be it would be useful to have rather two separate libraries
20:21gfrederickshoneysql is the normal approach for generating sql
20:21justin_smithcrazydiamond: I see exactly one function that is different for different sql backends in the korma codebase
20:23crazydiamondjustin_smith, so, sqlite3/postgres etc helpers are different?
20:23justin_smithno, it has a mysql version that is optional.
20:24justin_smithit's one function that exists for mysql
20:24crazydiamondah
20:24justin_smithfor "count"
20:24justin_smithcrazydiamond: https://github.com/korma/Korma/blob/master/src/korma/sql/fns.clj#L45
20:24justin_smithreading the codebase, that is the only db specific thing I can find
20:25crazydiamondI remember... about 6 years ago I was exploring PHPMyAdmin and there was sth like "about 1000 rows"
20:25crazydiamondi.e. approximate count
20:25crazydiamondnot exact one
20:25crazydiamondit was so when using certain storage
20:26justin_smithoh, and a few things starting here https://github.com/korma/Korma/blob/master/src/korma/db.clj#L90
20:26justin_smithfor defining the db spec per-backend specific
20:27crazydiamondaha
20:28justin_smithso maybe just enough to abstract out to it's own "sql adaptor" lib
21:02wenshanHi all, I'm trying to solve a coding challenge in Clojure (The Frequency, given a set of values, determine the frequency of the signal https://www.codeeval.com/browse/168/). I think I'll need to implement something like Matlab's polyfit first? Any idea?
21:04amalloyi think you need to have some kind of idea what algorithm you will want to use, before you can ask useful questions about clojure
21:05amalloypolyfit looks for polynomials anyway, so it would be a very bad fit for a trigonometric function like a sine wave even if it were easy to implement
21:27wenshanamalloy: thank you, I'm not sure what algorithm I should use. I tried to calculate the difference between each value, e.g. [2 2 4 5 4 2 2 4 5] => [0 2 1 -1 -2 0 2 1], then count the number of values between two peaks (negative -> positive), but it doesn't work well due to the noises. Any pointer?
21:27justin_smithwenshan: how about average distance between peaks, you have multiple cycles to work with
21:28justin_smithand over enough cycles the noise will be less and less of a factor
21:29justin_smithalso, of course, you can interpolate the "real peak" between the sample points via curve fitting
21:29justin_smithbut that gets more complex
21:32wenshanjustin_smith: average distance is the approach I'm taking, but I don't know how to pick the peak from a list of differences like (this is calculated from the first sample input): (2 1 2 2 0 3 0 0 1 -1 1 -1 1 -1 -2 0 -3 0 -2 -3 -1 -3 -3 -2 -2 -2 0 -4 -2 -2 ...)
21:33justin_smithclearly the peaks are where you go from positive to negative in the difference list
21:33justin_smithand visa versa
21:34justin_smiththe zeroes are mostly the noise (though you can expect zeroes near the peaks too)
21:35wenshanyou can see that there are 3 positive to negative in (1 -1 1 -1 1 -1)
21:36justin_smithyes, that's also noise - I would look for eg - a traversal of ~5 in 5 samples followed by a traversal of ~-5 in the next 5
21:37justin_smithyou may find it useful to measure groups of 5 samples to get a "smoothed" view
21:40justin_smith,(map #(/ (apply + %) 5.0) (partition 5 1 [2 1 2 2 0 3 0 0 1 -1 1 -1 1 -1 -2 0 -3 0 -2 -3 -1 -3 -3 -2 -2 -2 0 -4 -2 -2]))
21:40clojurebot(1.4 1.6 1.4 1.0 0.8 ...)
21:40justin_smithanyway, the pattern is smoother that way, but the cycle length is unchanged (just phase shifted, which does not change the frequency at all)
21:42wenshanjustin_smith: good idea, thanks a lot :)
21:43justin_smithanother option is take various possible partitionings, and sum over their modulus, and keep the one that is largest
21:43justin_smitheg try taking groups of 50, and summing every 0 item, every 1, etc.
21:44justin_smiththen see if the magnitudes are larger than groups of 40
21:44justin_smithor if they are larger than groups of 60
21:44justin_smithremember the frequency must be a multiple of 10, and the grouping with the highest peak magnitudes in the sum, is the correct frequency
21:45justin_smiththe measurement would be (max sum value) - (min sum value) across the overlapped partitions
21:46justin_smithI hope that was coherent enough, I think I worded it poorly
21:47celwellCan't seem to (System/exit 0) when in 'lein ring server'. Getting "Not matching method: exit"
21:47celwellAny ideas?
21:47justin_smiththat's bizarre
21:48justin_smithwhat's your jvm version?
21:50celwellOh, I think I fixed it. It looks like it was because it was in a thread macro so it was adding an extra, unwanted, argument.
21:50justin_smithyeah, that would do it
21:58justin_smithwenshan: so I was talking about something like this, where 20 would be a parameter, and the whole thing would have to be normalized ##(apply (juxt max min) (apply map + (partition 20 [2 1 2 2 0 3 0 0 1 -1 1 -1 1 -1 -2 0 -3 0 -2 -3 -1 -3 -3 -2 -2 -2 0 -4 -2 -2])))
21:58lazybot⇒ [3 -3]
22:00justin_smithactually, the normaliation could just be multiplying each number by n (when splitting into groups of n), but that seems wrong? easy enough to test I guess
22:40benzaphello, I was wondering how i could pull in this particular github project into clojure? https://github.com/mrniko/netty-socketio
22:41benzapi'm assuming it's hosted somewhere
22:41benzapdo I pull in information from the pom.xml file?
22:42benzapscratch that
22:42benzap... I want a socket.io client
22:42mgaarebenzap: might try this dependency atom: [com.corundumstudio.socketio/netty-socketio "1.7.7"]
22:42benzapso something like this https://github.com/nkzawa/socket.io-client.java
22:43benzapmgaare: ah ok
22:43benzapso it's [groupId/artifactId "modelVersion"] ?
22:43benzapin the pom.xml file?
22:43mgaareyea
22:43mgaaretypically
22:47benzapthanks mgaare, that did the trick
23:00benzapSo i'm having a hard time figuring out how to import the library now
23:00benzapgiven this pom file https://github.com/nkzawa/socket.io-client.java/blob/master/pom.xml
23:00benzapi've tried (import com.github.nkzawa.socket.io-client)
23:01mgaarebenzap: you need to import specific classes
23:01justin_smithbenzap: you have to specify a class to import
23:01justin_smithyou can't just import a package
23:01benzapjustin_smith: yeah, I just tried (import com.github.nkzawa.socket.io-client.IO)
23:02benzapdo I have the right idea though?
23:02justin_smithyeah
23:02justin_smithfor that form you need a quote
23:02justin_smithbut with (:import ...) in the ns form you don't need to quote it
23:03benzapah ok
23:03justin_smithimport also accepts a list form if you need multiple classes from one package (com.whatever Foo Bar Baz)
23:04benzapturns out it was (import 'com.github.nkzawa.socketio.client.IO)
23:04justin_smithit's better to use :import in the ns form
23:04justin_smithunless you have some reason to use top level import
23:04benzapjustin_smith: thanks, i'll probably end up using that
23:04benzapno no, I was just trying it in the repl
23:05justin_smithand you don't need the ' in that case
23:05justin_smithright
23:27wenshanjustin_smith: just came back from lunch nap, thanks a lot.
23:30wei_why does the cljsjs/jquery package version (1.9.0-0) not match its extern version (1.9.1)? https://github.com/cljsjs/packages/blob/master/jquery/resources/cljsjs/common/jquery.ext.js
23:31wenshanjustin_smith: applied (map #(/ (apply + %) 5.0) (partition 5 1 [...]) on the first sample input, it seems the positive to negative noises have been reduced to a point where the distances between peaks can be easily calculated
23:34wenshannow I need to write some clojure to count the sign changes
23:36wei_for cljs, what’s a good way to set *print-fn* to nop in production?
23:42benzapso i'm having an issue accessing a public static interface Foo which is in a com.Bar namespace
23:44benzapso for example (import 'com.Bar), where the Bar class has methods taht refer to an internal public static interface called Foo
23:44benzapi've tried (reify Bar.Foo ...), or (reify Bar.Foo ...)
23:44benzap*(reify Bar/Foo)
23:46justin_smithbenzap: Bar$FOO
23:47justin_smitherr, Bar$Foo
23:47justin_smithalso, you need to import Bar$Foo separately
23:47justin_smithbecause on a vm level it isn't really part of Bar
23:48benzapinteresting
23:49benzapyeah, that did the trick, thanks
23:49benzaponly problem is varargs, how do I structure my reified function?
23:49justin_smithvarargs are just an array
23:49benzaphmm
23:50benzapoh woops, I forgot 'this'
23:50benzapyeah, that's it
23:50clojurebotCool story bro.
23:50benzapthank you clojurebot
23:51benzapalso justin_smith, thanks for the help
23:51justin_smithnp
23:51benzapmaybe i'll contribute back by wrapping this socket.io library into a nifty clojure library
23:51benzap(to the best of my abilities)