#clojure logs

2013-08-27

00:00technomancywait, *that's* the letrec email?
00:00hiredmanyes
00:00hiredmanso called because out of no where "we need letrec"
00:01technomancyclojurebot: letrec?
00:01clojurebotPardon?
00:01technomancyclojurebot: letrec is <reply>"we need letrec" - Joe Armstrong (http://erlang.org/pipermail/erlang-questions/2011-May/058768.html)
00:01clojurebotRoger.
00:01seangrov`dnolen: Ok, think I got it... https://github.com/sgrove/clojurescript/commit/6eb9abbd685dbf0a6e0f6f048ac3bd5c840da97a
00:02seangrov`bbloom: I like your idea about splitting patches up, I'll try to towards that
00:03bbloomseangrov`: i view a good pull request as having having one or more clear, clean incremental steps, that tell a story about how a change impacts the program. thinking about that locally is helpful to my development process too. I often rebase patches as i work to make them small & clean & clear, so I understand what I've actually accomplished & how
00:05seangrov`Just did my first interactive rebase ever... always more to learn, it seems
00:05seangrov`It'll probably be like emacs though, very much worth it once I've figure it out
00:06dnolentbaldridge: doesn't seem any slower, maybe even a bit faster?
00:11tbaldridgednolen: well that's good to hear. I don't think it's possible that it's faster, but I'm glad it's not slower
00:12dnolentbaldridge: definitely not slower at any of the benchmarks I was using before.
00:12dnolenseangrov`: this looks good, let's get a patch on the ticket and I will give it a try locally
00:13tbaldridgednolen: btw, on your "make no promises" post, sometimes the hit just goes bonkers and I get 100k msgs in ~50ms
00:13tbaldridge*the jit
00:14dnolentbaldridge: I suspect this is related some how to GC. Clicking on their of the two makes performance degrade after the first few runs.
00:14dnolens/their/either
00:14tbaldridgednolen: interesting
00:15dnolentbaldridge: but yeah I've seen ~50ms runtimes for core.async
00:16seangrov`dnolen: Sounds good, running the tests one last time to make sure I didn't break anything with the rebase, then I'll submit the patch and head home
00:18seangrov`Attach it to this? http://dev.clojure.org/jira/browse/CLJS-497
00:18dnolentbaldridge: we should probably look a bit more closely at GC behavior as you've suggested.
00:19tbaldridgednolen: any good suggestions for GC profilers for JS? Chrome Tools seemed a bit limited
00:20dnolenseangrov`: hrm, no let's make a new ticket, but please ref it from CLJS-497
00:21dnolenseangrov`: also ref 381
00:22dnolentbaldridge: you might want to try Chrome Canary, they have some extra tools I think.
00:26seangrov`dnolen: Alright, I think this is good to go: http://dev.clojure.org/jira/browse/CLJS-576
00:26dnolentbaldridge: yeah you can heap snapshots in Canary
00:26seangrov`Time to head out now
00:26dnolenseangrov`: excellent, many many thanks!
00:39dnolentbaldridge: yeah it does appear that core.async things are lingering around ... more investigation needed
00:40tbaldridgednolen: agreed, and I can't get chrome to parse the snapshot without dieing
00:40dnolentbaldridge: yeah pick a smaller N :) I'm testing w/ size 1000 on my blog.
00:41tbaldridgednolen: although, come to think of it, we're probably running into GC on the channels in your blog post
00:44dnolentbaldridge: it looks like the main issue is the tasks array in dispatch ns
00:45dnolentbaldridge: many things are getting retained because of that
00:45tbaldridgeah yeah, I didn't do the thing that cleans out the ring buffers.
00:45tbaldridgeone sec
00:47dnolentbaldridge: aha! :)
00:47dnolentbaldridge: I was wondering length was zero :) but I forgot that it was a ring buffer not an array.
00:47tbaldridgednolen: yeah, that commit should do it: https://github.com/clojure/core.async/commit/99e9155958491e632397f9b3dbdede84a419bee3
00:56tbaldridgednolen: so I'm still seeing a lot of GC work after that commit, but I just realized it's only on the first invocation of the tests. The task queue has to resize as it runs out of room, at some point it will be large enough and we won't resize it again.
00:59dnolentbaldridge: that makes sense, I was more concerned about stuff lingering around
01:07dnolentbaldridge: ok I'm no longer seeing the retains through tasks here
01:07tbaldridgenice
01:31callenfutile: hi!
01:31futilecallen: hi
01:41futilecallen: you sounded excited
01:43futilecallen: is there something exciting?
01:43callenfutile: I'm working on something pretty
01:43futileoh? can i see?
01:44callenif there's one thing I always thought Rubyists got right, it was putting spit-shine on something before shipping it. I'm making something that riffs off a detail of Rails.
01:44callenNot yet. I can ping you when I ship it.
01:44futileok
01:44futilecallen: I'm also working on something pretty right now.
01:45callenoh?
01:46callenHere's an anti-pattern, I end up making fake projects to test/mock libraries I'm working on far too often.
01:46callenI'm waiting for the day to come when I've made so many fake test projects that I don't have to make any new ones anymore.
01:46futileyeah, this: https://www.dropbox.com/s/msyq0nwfzhvbhjq/Screen%20Shot%202013-08-27%20at%2012.24.05%20AM.png
01:47futile(because I'm not happy with iTunes lately)
01:47callenI don't use music stored on local drive anymore, for the most part.
01:47callenit's all CD-ROMS and streaming music for me now.
01:47futilenobody does but me
01:47callenpartly out of a desire to not pirate music.
01:47futileeveryone uses spotify or pandora
01:48futileso i suppose ill be the only user of this app.
01:48callendon't focus on having users, just on scratching an itch.
01:48futilebut it's gonna be a damn good app even still.
01:48callengetting other people to use your thing is about ego, not utility.
01:48futileactually scratch that. it already is. im officially announcing 1.0
01:49futilecallen: btw are you talking about when you're actually working on the lib itself, you have to add tests to it?
01:49futilecallen: otherwise no comprendo
01:51callenI don't consider writing tests to be sufficient
01:51callenI do functional/integration testing with mock projects in addition to unit tests.
01:52callenI'm a bit fascist about automation and testing.
01:52callenanyway, I'm griping about having to write mock projects.
01:52futilecallen: hmm. I can kind of relate, since I've given up on large-scale unit testing and focus much more on integration testing at the highest scale.
01:53callenyeah that's partly why I do it.
01:53futilecallen: but I've never had a project that required me to write mock projects. I guess depends on the project.
01:53callenI really just want to exercise the whole thing in expected patterns
01:53callennot nit-pick at specific bits.
01:53futileLeiningen probably would need mock projects
01:53futileRight. No need going at implementation details.
01:54futileAt work we have an entire test suite that's largely useless at testing reliability of anything, and makes it really hard to change anything, because it entirely tests implementation.
01:54futileI think working on Zephyros taught me a lot about where abstraction lines should be, which would be useful for testing (except Zephyros has no tests).
01:55callenI think unit tests can be valuable, but they have to be written well and specify expectations that are meaningful.
01:57futile(expect = 2 (+ 1 1))
01:57futilei see that a lot
01:57futilewell not really.
01:58futilecallen: what kind of project is this?
01:59callenjust a logging thing.
01:59futileoh like lazybot?
02:00callennot at all, but there's a related project there on my to-do list.
02:01futilecool
02:01futilei think my next project is a project management tool :)
02:01futileive written a window manager and a music player. language and text editor are too ambitions. project management tool is just the right size.
02:01futile*ambitious
02:02callenwhat in the mother fuck?
02:02calleneither I bumped into a Leiningen bug, or after years of usage I've forgotten how to write a :dependencies vector.
02:02ddellacostacallen: ?
02:02futilemost likely the latter
02:03futilehi ddellacosta
02:03ddellacostafutile: howdy there.
02:03callenI nuked my ~/.m2, I'll report the error if this doesn't fix it.
02:03ddellacostahow goes it?
02:03callenand upgraded lein.
02:04futileddellacosta: swell, thee?
02:04ddellacostacallen: yeah, if you're still having trouble after that post a refheap or something
02:04ddellacostafutile: not too bad, not too bad. Think I'm finally over jetlag, which makes me happy.
02:04callenI'm staring at the clojars page for my dependency, I know I'm not totally crazy.
02:04callenadlfknggrshklmryltmkfg
02:04futileddellacosta: woohoo. i hope the cause of the jetlag was worthwhile?
02:04futilecallen: could it be that you're tired and need a break?
02:05ddellacostafutile: well, you know, gotta visit the motherland once in a while, I suppose. ;-)
02:05futilecallen: sometimes i find that something doesnt make sense until doing something else for 30 mins (or 10 days, depending on the thing).
02:05futileddellacosta: where's that?
02:05callenwho's up for fixing my stupid? https://www.refheap.com/18052
02:05ddellacostafutile: motherland = U.S. I live in Japan.
02:06ddellacostacallen: looking now
02:06futileoh cool
02:06callenhttps://github.com/kevinjqiu/lumiere/blob/master/src/lumiere/lumiere.clj
02:06callen^^ it's right bloody there.
02:06callenRetrieving lumiere/lumiere/1.0.0-SNAPSHOT/lumiere-1.0.0-20120301.024351-1.jar from clojars
02:06callenI saw it download!
02:06futilehmm
02:07callenhere I'll look inside the jar.
02:07ddellacostacallen: ah, hurm
02:07callenthere's a lumiere.clj inside the lumiere 1.0.0-SNAPSHOT jar.
02:07callen...but the ns is lumiere, not lumiere.lumiere
02:07ddellacostathe frack
02:07futilemy dumb guess is it's a double-word problem
02:07callenI might kill this man for writing a misleading README.
02:07futilelumiere vs lumiere/lumiere
02:07futileive seen that a lot
02:08callennot slash. dot.
02:08futileoh, looks like you figured it out already.
02:08callenthat worked.
02:08futilei was talking about dirs
02:08ddellacostawhat worked?
02:08callenI am going to send a PR stuffed with the fury of a thousand african hornets.
02:08callenddellacosta: I ripped open the jar and checked the NS
02:08callenNS decl didn't match documentation, dude's careless.
02:08callenbrb, sending nastygram via github
02:08ddellacostaoh
02:08ddellacostahaha
02:08futilecallen: you catch more flies with honey than with vinegar
02:09ddellacostafutile is right, I shouldn't be encouraging this behavior
02:09callenfutile: I describe my actions in hostile/violent terms for your amusement, I know how to get what I want - being nice.
02:09futilecallen: try being extra nice about it, even though that seems backwards right now. tomorrow you'll be glad for it
02:09callenI'm very patient and pleasant on github. I only came close to slipping once, and that was with the homebrew people.
02:09futilecallen: oh. well thats misleading.
02:09callenBut they're territorial cunts.
02:09callenfuck them.
02:09callentook 15 days of volleyball to get a simple community-approved change implemented.
02:10futileddellacosta: also i wrote a clojure port for https://github.com/sdegutis/zephyros
02:10ddellacostacallen: I recall something about installing clojure via home-brew, you and Raynes were onto something weren't you?
02:10futile*client
02:10callenddellacosta: shit's gone yo. We nuked it.
02:10callenthey finally merged the PR.
02:10futilethe fact that this project has > 500 stars makes me feel like maybe im not incompetent.
02:10callenif your homebrew is up to date and you try to install Clojure with it, it'll smack you in the face and tell you to use Leiningen.
02:10ddellacostacallen: gotcha, that's good
02:10callenfutile: that's pretty impressive. you were clearly touching on something people care about :)
02:10ddellacostafutile: that's pretty cool
02:11callenddellacosta: doing god's work and all that. Raynes and I were both tired of the derps rolling in with problems specific to not using Leiningen.
02:11ddellacostaI'll give it a shot one of these days, when I'm not being so lazy
02:11futilecallen: window management in mac os x just isnt as good as it is in linux
02:11ddellacostacallen: good stuff, definitely. Should actually help folks in a concrete way
02:11callenhttps://github.com/kevinjqiu/lumiere/pull/2
02:11patchworkIf I have a separate thread running, how do I route *stdin* to it?
02:11callenfutile: I know that. I'm an XMonad user.
02:12ddellacostafutile: I gotta admit, I'm not nearly as motivated by it as I used to be (but to echo callen, the 500+ stars on the project shows a lot of folks are)
02:12futile(inc callen)
02:12lazybot⇒ 8
02:12callenfutile: I still use Macs though. dat hardware.
02:12patchworkIt does not seem to be accepting my input
02:12callenpatchwork: any thread should have the option of reading from System.in
02:12ddellacostacallen: nice.
02:13futileddellacosta: i started getting optimistic about using it when i stopped looking at it as a full-fledged "take control of everything and ill do things your way" type of app, but more of an augmentation to my normal workflow with slight, modular additions
02:13futilewhen i took that approach, it wasnt that scary.
02:13callenI hack on a Thinkpad running Linux and use a Mac at work and sometimes at home.
02:13futileor overwhelming/tedious/etc
02:13seangrov`ddellacosta: You going to make it out California way this time around?
02:13ddellacostafutile: that sounds like the right way to do it to me
02:13callenfutile: can't make everything on a Mac work inside of that model anyway.
02:13futilecallen: i tried so hard to get arch linux running smoothly on my mbp
02:13ddellacostaseangrov`: I already got back to Nippon man…sorry! ;-(
02:13callenddellacosta: yeah you need to stop by California. I need to get you a few rounds. :)
02:14seangrov`Ah, well, no worries
02:14futilecallen: but it was so hard to get Just Right™
02:14callenfutile: s'not worth it.
02:14callenyep.
02:14futileespecially a retina
02:14futile*my
02:14ddellacostaseangrov`: but, this was a total east coast thing, my wife's family came and met mine for the first time.
02:14seangrov`You have some clojure friends in the bay when you come back next time ;)
02:14seangrov`Very nice, that's a fun experience
02:14patchworkcallen: Hmm… how do I trigger that? This is the first time I've messed with (Thread. #(..)) in clojure
02:14patchworkprobably I am doing this wrong
02:14ddellacostaseangrov`: Excellent, very excited by that. Cali is next up, in the next 6 months I'm hoping.
02:14callennow to write deep, deep evil with alter-var-root
02:15callenpatchwork: you shouldn't be using raw threads geenrally.
02:15futileoh, like hyperion
02:15callengenerally*
02:15patchworkcallen: I suspected as much
02:15callenfutile: I'm testing a Clojure + Datomic project at work. Pretty excited. It'll be the first thing running Clojure at my company.
02:15futilefinally got the boss's approval for "a spike" to see if its better/faster/etc
02:15futilecallen: woo
02:16patchworkcallen: I have a thing in a (loop [..] …) I want to run in the background… but have it accept stdin and write to stdout. What is the right way to do that in clojure?
02:16callenthere's no "approval" process. We're like an organized form of anarchy at my company so each person is given full control over their scope of influence.
02:16futilecallen: what company?
02:16callengiven that, all it took was selling the project owner on Clojure + Datomic, and he was already sold on Datomic (he's a hacker, not PM type)
02:17callenfutile: genetics company
02:17futilei applied at relevance and was politely rejected
02:17futilecallen: sounds scary
02:17futilecallen: i'd envy that level of control, if it were possible
02:17patchworkcallen: genetics… bioinformatics? sequencing? bioengineering?
02:18patchworkI am way into cell biology
02:18patchworkmake a bunch of models of chemotaxis etc
02:18callenpatchwork: we do sequencing and bioinformatics. It's genetic sequencing applied to specific medicine.
02:18futilebtw objc's ARC is really cool and i bet Java/Clojure could benefit from something like it
02:18callenI'm not a bioinformaticist. I'm a software generalist and product guy that is obsessed with databases and backend.
02:19callentruth be told, I'm a failed-startup refugee (CTO) that found a nice company populated with cool people :)
02:19patchworkcallen: pretty cool domain nonetheless
02:19arubincallen: Not related to the ThoughtWorks project using Clojure for cancer drug matching, is it?
02:19patchworkthough in a way backend is backend I suppose
02:19callenfutile: I'm actually a huge fan of ref-counting GC and scoped pointers.
02:20callenpatchwork: you'd be surprised how little I need to know about the bio parts to be useful.
02:20futilecallen: you know that ARC is compile-time "GC" right?
02:20patchworkYeah, data is data
02:20callenarubin: no, we're all internal. Datomic + Clojure was an internal decision. They were already curious about Datomic, I used that as leverage to get them to try out Clojure. They've been plagued with problems related to Python so it seemed a good alternative to try out.
02:20callenfutile: obj-c's implementation is. ref-counting is generally runtime.
02:21callenRust's implementation is compile-time for the various pointer types.
02:21patchworkAha! well if they are using python then you have a lot of improvement to provide
02:21callenbut anything that escapes to GC is runtime.
02:21callenpatchwork: it's a bio company - Python ghetto extraordinaire.
02:21futilecallen: well objc had ref-counting before ARC, and it was pretty terrible. but ARC made it basically act like free GC at compile-time only
02:21patchworkI increased our system by an order of magnitude by switching to clojure from python
02:21patchworknot to mention concurrency
02:21callenpatchwork: increased...performance? not sure what you mean here.
02:21patchworkcallen: Right : ) performance
02:22callenfutile: a lot of obj-c is weird though, don't use it as a reference for how things like ref-counting behave in general.
02:22futilecallen: oh
02:22patchworkIncreased its general awesomeness as well
02:22patchworkdecreased the codebase
02:22callenpatchwork: our scaling problems don't yet center around software, it's more around complexity management and production.
02:22futilecallen: isn't objc's refcounting model simple and good?
02:23patchworkcallen: I bet. Lot's of data shunting back and forth I imagine
02:23futilebesides the manual-labor aspect of it
02:23patchworkOur system was dog slow
02:23patchwork(well, once it got to a certain size of use)
02:24futilepatchwork: wait, so you went from clojure to python, and that decreased the size and improved performance?
02:24futilepatchwork: that sounds backwards.
02:24patchworkfutile: other way
02:24futileoh nice
02:24patchworkpython—> clojure
02:24futileyay
02:24callenpatchwork: so much fucking data comes out of those sequencers. it's ridiculous.
02:24patchworkYeah, remarkable improvement actually
02:24futileim pretty sold on clojure being the new ruby/python
02:25callenpatchwork: part of it is a social thing, I'd really like to get the Gospel of Immutability into the heads of everybody writing code at my company.
02:25patchworkfutile: The only deal is it's not good for scripts!
02:25callenit's a little hard to make those lessons stick in a language like Python.
02:25callenit's easier in languages like Java where you can make the whole class immutable and enforce it.
02:25patchworkcallen: People have to burn themselves with concurrency to really understand why it matters
02:25patchworkThen it is like a godsend
02:26futilepatchwork: that doesnt feel true for me
02:26futilepatchwork: i love clojure's immutability only because its so much easier to reason about and write composable functions than it was in mutable-land (ruby/python)
02:27patchworkfutile: I feel that is more just functional programming… but I guess clojure enforces that by being immutable
02:27patchworkYou CAN'T modify your map inside the function, so you figure out a different way to do it!
02:27futilewell ignoring functional programming, the fact that everything i receive and pass around is immutable, that makes it so much easier to know what the code im writing is going to do
02:28futilei guess its called referential transparency
02:28futileits scary that rich was on the fence about immutability for a long time before he settled on it
02:28patchworkfutile: That is functional programming. Always returning the same thing when given the same args and not changing any args that are passed in
02:28futileimagine mutable clojure!
02:28futilepatchwork: FP has too many definitions
02:28patchworkfutile: Well there are atoms and refs : )
02:28patchworkfutile: Ah. That is my definition
02:29callenAre you sure he was on the fence? And Rich did a lot to make mutability easy/safe/efficient.
02:29patchworkThe mathy one
02:29futilecallen: i read him say so in something recently
02:29futilesome old interview or something
02:29patchworkYeah if anything clojure provides sane ways to mutate stuff, rather than it just being the default implicit operation
02:29patchworkYou have to WANT to mutate something, and be explicit about it
02:30futilei know a guy who knows a guy
02:31patchworkThese guys, always saying stuff
02:32futilepatchwork: you dont by any chance listen to music via local files do you?
02:32patchworkfutile: I listen to all kinds
02:32futilepatchwork: most people listen to spotify or pandora, i figured i was the only one who listens to music files on my actual harddrive
02:33futile(née sdd)
02:33futileer, (i mean sdd)
02:33futilepatchwork: you on a mac?
02:33patchworkfutile: yep
02:33futilePM me if you wanna try this app: https://www.dropbox.com/s/msyq0nwfzhvbhjq/Screen%20Shot%202013-08-27%20at%2012.24.05%20AM.png
02:33futileand if you dont, i wont take offense.
02:34patchworkIs it yours?
02:34futileyep
02:34futilebeen writing it in secret a couple weeks now
02:34futileim too unhappy with itunes lately.
02:34patchworkone of the best things to listen to on the internet: http://www.park.nl/park_cms/public/index.php?thisarticle=118
02:34patchworkI listened to it for 3 months straight one time
02:34futilewhoa
02:34callenis there a variation on (time (...)) that returns the msecs as a number?
02:34calleninstead of kicking it to the output.
02:35callenI'm trying to avoid writing a manual dilly.
02:35futiledilly, is that what they're called then?
02:35callenoh, with-out-str.
02:36futilebut then you have to parse it, no?
02:36futilewell if the goal is to avoid stdout then that works
02:36callenyes, and it dumps the result, which is unacceptable.
02:36callenManual it is.
02:40futilewelp, as soon as the new app icon comes in the email, ill call the app 1.0 and move on in life :)
02:40futile(for 5 minutes until i discover a bug and release an emergency 1.0.1)
02:41patchworkfutile: You have it up somewhere? on github?
02:42futileyep patchwork. one sec
02:42patchworkOkay, what is the best way to put an infinite (loop […] …) in its own thread and have it accept stdin and stdout?
02:42patchworkin clojure?
02:43patchworkI should know this, somehow it hasn't come up before
02:45callenwelp. I've misunderstood c.j.j again. time to go plundering.
02:49futilepatchwork: https://github.com/sdegutis/bahamut
02:49futileoops hold on, link broken
02:49futilefixed.
02:53futilepatchwork: ive used a (future) containing (while true...)
02:54futilepatchwork: in the clojure client for zephyros, granted it was reading from a tcp socket not stdin, but it should work still
02:54ambroseb_can I find the default dispatch value for some multimethod programatically?
02:56futileambroseb_: you mean get it as a callable fn?
02:56ambroseb_I want (multimethod-default mm-var) => :default
02:57futileoh. i dunno.
02:57ambroseb_probably need to call the MultiFn directly.
02:58ambroseb_well defaultDispatchVal on MultiFn is public, which is promising.
03:03callenhttp://i.imgur.com/gLV7nmt.png
03:03callenhow's that look for a SQL query logging library output?
03:04callenfutile: ^^
03:04callenddellacosta: ^^
03:04futilecallen: fancy
03:04callenit's real too. that's actually hooking into c.j.j :)
03:04callenalter-var-root ftwwwwww
03:04futilewhoa
03:04TEttingerhow big is the DB?
03:05ddellacostacallen: sorry, what are you asking me to evaluate? The 100 ms? Pretty snappy
03:05callenTEttinger: don't bike-shed my sqlite database or I will plonk you with a smelly fish.
03:05futilecallen: does your hack depend on implementation details? :P
03:05callenddellacosta: ...no! I'm writing a SQL query logging library.
03:05ddellacostacallen: oh, haha, sorry. Looks nice. :-)
03:05TEttingercallen, it is purdy
03:06futilecallen: so, you just plug in your lib, and this gets output automatically to stdout?
03:06callenfutile: (decorate!) -> boom magic.
03:06futilenice
03:06callenyeah baby. >:D
03:06ddellacostacallen: you gotta give me a pass, I was deep within test mock building meditation mode
03:06callenI'm all about the evil hacks.
03:06callenddellacosta: oh, sorry for disrupting :(
03:06ddellacostacallen: no, not at all! If I didn't want to look, I wouldn't. ;-)
03:07ddellacostain fact, I'm having trouble figuring out why some namespace changes aren't getting picked up…
03:09callenhrm. I really do not like trawling c.j.j
03:09futilewoot, 0.9 is official.
03:09futilecan a project ever officially be "done"?
03:09callenfutile: yeah. happens all the time to Clojure libs.
03:09futileim tired of getting new feature requests. id like my other project to just be done, and everyone be happy with that.
03:10futilecallen: ah that makes sense then, libs vs apps
03:10futileapps cant ever just be done, but libs usually are.
03:10ddellacostacallen: yeah, c.j.j has some…messy bits, methinks
03:10futileddellacosta: why are you in japan?
03:10futilethat seems kind afar
03:10futile*kinda far
03:11ddellacostafutile: long story, but short version is: wanted to experience living in another country and liked Japan. Then went off the deep end and married a Japanese woman. Not that I'm complaining. :-)
03:11futileheh
03:11callenddellacosta: it also has a million and one entrypoints for queries.
03:12callenthat all get dispatched independently to the JDBC layer
03:12callenso I've gotta override, decorate, time, and log multiple vars
03:12callenall with different argument patterns and destructuring
03:12futilescary
03:12futilecallen: does your lib work with datomic?
03:12futile;)
03:12callenI'm going to end the night writing murder on the walls in blood.
03:12ddellacostacallen: you mean, all the different ways you can insert and update and whatnot? yeah, I've taken to using it my own special way, using my own special conventions. But I can imagine trying to intercept stuff could be messy.
03:12callenfutile: it could, but there's probably not much point.
03:13futilecallen: why are you going to write a group of crows on the walls?
03:13callenddellacosta: the problem is the interception, yeah.
03:13callenddellacosta: there's no universal query executor fn as far as I can tell.
03:13callenor if there is, the bastard is *buried*
03:14ddellacostacallen: based on my periodic cursory delvings into that codebase, that is my understanding as well.
03:14Raynescallen: Goodness, callen. God's work? :p
03:14callenRaynes: why not?
03:15RaynesToo bad we couldn't stop the clojurescript formula.
03:15ddellacostafutile: dork. ;-)
03:15callenRaynes: speaking of god's work: http://i.imgur.com/gLV7nmt.png
03:15ddellacostaRaynes: they have a CLJS formula too!? wtf
03:15callenRaynes: pretty query logging lib :)
03:15RaynesWhy the homebrew folks want to shit on our lawn immediately after picking up the turds they left behind before.
03:15RaynesEludes me.
03:15callenddellacosta: dude. we fought that battle and lost it so we could win the war.
03:15RaynesDavid Nolen and Chas Emerick both contributed "wat no"s to that discussion and they still did it.
03:15Raynes:(
03:16ddellacostalame
03:16ddellacostabut, not totally surprising
03:16ddellacostabut lame
03:16callentwo weeks of battling those bastards. *shakes head*
03:17callenRaynes: is pretty, da?
03:17RaynesYes, I am pretty.
03:17futilehomebrew ftw
03:17callenRaynes: no mah lib :(
03:17patchworkfutile: Looks like a labor of love
03:18futilepatchwork: oh?
03:18futilepatchwork: i take it you tried it then
03:18futilepatchwork: also, is that the polite way of saying "this is not my style but obviously you like it"? :P
03:19callenomg this library is organized like a graph theoretic pathological case of connected nodes
03:19callenWTF IS GOING ON
03:19futilehhaha
03:19patchworkfutile: No, I recognize when a project is made because you want it specifically that way
03:21ddellacostawtf, I can see vars in my namespace, and I have two tests defined w/deftest, but clojure.test keeps tell me "Ran 0 tests containing 0 assertions"
03:21callenlook at this: https://github.com/clojure/java.jdbc/blob/master/src/main/clojure/clojure/java/jdbc.clj#L709-L735
03:21callenjust look at it.
03:22callenwhy are update and insert using totally different functions?
03:22callenthere's no rhyme or reason to this, this is like a nihilist's trap for snaring programmers.
03:22ddellacostacallen: well, update seems nice enough to me
03:22callenddellacosta: and if everything used execute! like update! does, we wouldn't have a problem :|
03:22futilepatchwork: yeah im just tired of the Mac's "look and feel" changing every hour.
03:22futileplus i dont even like the way it looks or feels
03:23futile(if thats what you mean)
03:23ddellacostacallen: yeah, it's funny, 'cause my own personal convention w/c.j.j is to use c.j.j.s helpers with everything, and either query or execute! to actually run stuff
03:23ddellacostahelpers = dsl
03:24callenddellacosta: that's a really good idea, but I can't expect all my users to be that wise wrt design.
03:24ddellacostacallen: yeah. :-(
03:25callenI basically need every single test case in c.j.j to generate a pretty-pretty log line
03:25callenI left my booze at work. I've made a huge mistake.
03:25callenoh yeesh, it's midnight already. I'll wrap this up tomorrow.
03:25futilemidnight?
03:25futile2pm here
03:25callenI am not defeated...merely resting.
03:25futilecallen: Ha
03:25futilefamous last words
03:26futilecallen: do what ive done: stay up finishing it until 9am
03:26futileand then take a 30 min nap
03:26callenfutile: I work for a living and I'm officially moving out of my apartment in the morning.
03:26callenso...no.
03:26futileoh, where to?
03:26callenMV -> SF
03:26callenlike all young men my age end up doing.
03:27futilesigh
03:27futileSF is gonna get overpopulated one of these days
03:28callenit already is. the rent is horrendous.
03:28ddellacostaseriously, why is clojure.test/run-tests not picking up my tests, but they are obviously loaded into my repl, and I can run them individually? I have never seen this ever
03:28callenlike 3500 for a single bedroom apartment in SOMA
03:28callenddellacosta: typical lein repl?
03:28ddellacostacallen: yah
03:29ddellacostaI feel like I'm going nuts
03:29callenddellacosta: have you done a (use 'ns :reload-all) ?
03:29ddellacostaI mean, I went so far as to restart my repl
03:29callen(use '[clojure.tools.namespace.repl :only (refresh)])
03:29callenoh shit.
03:29callenyou restarted your repl and it didn't pick up the tests?
03:29ddellacostacallen: I was using c.t.n.r, but my project is not clean enough, and it was barfing from weird java memory errors
03:29futileddellacosta: accidental test selectors?
03:29futileoh
03:30ddellacostacallen: no, it didn't. really freaking weird, right?
03:30ddellacostafutile: what do you mean?
03:30callen...yeah.
03:30futiledunno
03:30callenanyway, I need to go to bed. bye all :)
03:30futilebye
03:30ddellacostacallen: sleep well! good luck with the move. ;-)
03:30futileddellacosta: its probably accidental test selectors
03:30ddellacostafutile: sorry, what does "test selector" mean?
03:30futileddellacosta: dunno
03:30futileddellacosta: er, i mean, its a leiningen feature
03:30ddellacostawhat
03:31futileddellacosta: it filters out your tests or somethign
03:31ddellacostaah, hrm
03:31futilesounds like it could be related.
03:31futilecheck your project.clj for them
03:31futilemaybe someone else put it there and you didnt know the feature existed so it silently did its job too well
03:31futilemaybe.
03:32ddellacostafutile: well, I'll check into it, but it seems very strange
03:32futilek
03:32ddellacostafutile: and I think it's more likely I did something stupid, haha
03:32futileright.
03:32futileselect isnt broken.
03:33futilehttp://pragmatictips.com/26
03:33ddellacostanever saw that, cool
03:33ddellacostayeah, exactly, that.
03:37futilewhat's a good freenode channel for asking advice on web ui libs?
03:38RaynesJavascript specific?
03:38futileI suppose everything compiles down to or uses JS.
03:38futileBut yeah, I mean dynamic widgets.
03:38futilemaybe jquery, maybe cappuccino.. dunno yet
03:39RaynesYou could possibly ask in a Javascript channel, but stackoverflow might be a better choice.
03:39futilehmm, cant do SO
03:39futilethanks
03:40amalloycan't ask on SO? whyever not?
03:40RaynesI imagine because his question doesn't have a clear answer.
03:40RaynesSO will bite your head off if there is more than one definitive answer for a question.
03:41futileamalloy: never mind
03:43ddellacostaahhaha I am so stupid, I wrote a fixture that never ran the function that was getting passed into it
03:43ddellacostathat's why. d'oh
03:43futile:)
03:43futilehowd you solve it ddellacosta? binary search?
03:43ddellacostatimes like these I wish I was pairing. ;-/
03:44ddellacostagood 'ole comment out and then uncomment until it breaks
03:44ddellacostaI suppose that is a form of binary search
03:44futileim not good at pairing. its always slower for me, not faster.
03:44ddellacostafutile: I find it is really person-specific for me. I've had horrible pairing experiences and excellent pairing experiences.
03:45futileddellacosta: hmm
03:45ddellacostait's not easy though. TDD comes naturally to me, pairing does not. If we're comparing agile/extreme programming practices.
03:46ddellacostabut pairing is definitely excellent for this kind of situation: I just burned half an hour futzing about when someone else probably would have spotted it right away.
03:46futileddellacosta: ive found that most of the time ive paired, my pair gets way too focused on unimportant details, which slows us down.. and we never get around to discussing the high-level important details because he/she usually thinks too implementation-specific
03:47ddellacostafutile: if that is happening consistently, then you need to be pro-active about making it a point of discussion yourself. The thing about pairing is that each pair has to take complete responsibility for any issues that arise, or else it doesn't work.
03:47ddellacostafutile: which is why it's so hard--pairing is really a psychological challenge for many of us.
03:48ddellacostaI know it has been for me at times!
03:48futileyeah
03:49futilewelp, time to go back to the building with broken windows and pretend like im making things better instead of worse
03:49ddellacostafutile: good luck. ;-)
03:51futilethis is a good read http://www.codinghorror.com/blog/2005/06/the-broken-window-theory.html
04:18patchworkHow do I pass an arg to a lein task? So: lein trampoline cljsbuild repl-listen :repl-listen-port 44444
04:18patchworkThat doesn't work
04:18patchworkeven though that is an option to the repl-listen task
04:18patchwork(according to the code)
04:52AWizzArdHello RegExperts. I have (re-seq #"\W(aa|bb|cc|xx|yy|zz)" " aa or bb/cc"), and this matches all the words I want to find, aa, bb and cc. However, I want to make sure that those words are not part of another word (i.e. substrings).
04:53AWizzArdSo, to protect it from finding ccc as a word I add ($|\W) at the end: (re-seq #"\W(aa|bb|cc|xx|yy|zz)($|\W)" " aa or bb/cc")
04:54AWizzArdUnfortunately now cc does not get detected anymore, because of the \W. There is no non-alphanumeric char after cc.
04:54AWizzArdThe regexp engine seems to not try the $ instead, which follows the cc. Any ideas how I could make it match the cc at the end, without matching cc when it is a substring?
04:55mpenet,(re-seq #"\baa\b|\bcc\b" "aaasdf aa bb asdf sdfbbb cc ccsdf")
04:55clojurebot("aa" "cc")
04:57mpenethmm doesn't work with the / example of yours, depending on if you want to include or exclude it, not sure
05:00AWizzArdThe example is indeed the correct input. In my example above I want to detect words such as aa, bb, cc and so on, but only if on their left/right side is no alphanumeric char. The beginning and end of string are also fine.
05:02amalloyAWizzArd: don't use \W for this
05:02amalloythe ($|\W) at the end of bb is consuming the / character, and so there's no \W for cc to start with
05:02amalloywhat you want is \b, a zero-width assertion
05:04AWizzArdI will try that.
05:08AWizzArdmpenet and amalloy: good idea, the \b is working nicely.
05:10mpenetany core.async developer present atm?
05:16ddellacostampenet: what do want to ask?
05:17ddellacostahow do I apply and to a collection of boolean values?
05:18ddellacostaah, google to the rescue
05:18ddellacostahttp://stackoverflow.com/questions/2891707/reduce-or-apply-using-logical-functions-in-clojure
05:18Apage43ddellacosta: Use every?.
05:19mpenetddellacosta: about the current restrictions with the use of nil on channels: if there is an obvious reason for it's current status, if that's in discussion, and if it's the case what are the alternatives
05:20mpenetddellacosta: more context here: https://groups.google.com/forum/#!topic/clojure/pF9FEP7b77U
05:20ddellacostampenet: ah, yeah, saw that, which means you know as much as I do. Sorry. :-(
05:23ddellacostaIs this the way to do this? ,(every? identity '(false true false false))
05:23ddellacosta,(every? identity '(false true false false))
05:23clojurebotfalse
05:23ddellacostanot sure what that second arg should be
05:23Apage43yup
05:23Apage43identity works if you're just testing that the whole collection is truthy
05:24Apage43,(every? identity [true 1 "whee" :bucket])
05:24clojurebottrue
05:24ddellacostaApage43: yeah, that's it. What I wanted to do at first was (apply and [true false true false]) essentially.
05:45silasdavisin laser I'm trying to compose a base template defined with defdocument with other bits of transformed html
05:46silasdavisthe defdocument takes some arguments so I can insert things that way, but in another place I wanted to transform the output of the defdocument by threading it into another document form
05:46silasdavisbut to make this work it seems like I'd have to parse the original document as a string first, which seems wrong
05:47silasdavisi think I'm probably working at the wrong level - I tried playing with fragments, but also had errors using those as input to the document function. Does anyone know how I should be doing this?
05:58NeedMoreDesuDo you know that you can suddenly have stack overflow using chuncked lists?
05:59NeedMoreDesuI concatenated them many times randomly. Since it's lazy, it gives the result. But when you try to do something with it...
05:59amalloyNeedMoreDesu: well, chunkiness isn't relevant, it's the laziness
06:01NeedMoreDesuWhy it is written that way you can have SO?
06:02NeedMoreDesuhttp://ideone.com/5EzIkJ
06:05amalloyhttp://stackoverflow.com/questions/2946764/recursive-function-causing-a-stack-overflow
06:10_dwhello. anyone here to clarify why (= bytearray1 bytearray2) always returns false? I thought it'd compare by content, not by identity. am I mistaken?
06:11NeedMoreDesuThanks, that solves the riddle.
06:11hyPiRion_dw: Because it's a java array. Clojure runs .equal on the objects unless they are primitives/arrays, in which case they return true if they are identical
06:13hyPiRion,(import 'java.util.Arrays)
06:13clojurebotjava.util.Arrays
06:13francis_wolkeHas anyone done anything with lein-droid recently? I'm running into some undocumented issues while following along with the tutorial.
06:13hyPiRion,(Arrays/equals ^bytes (into-array Byte/TYPE [1 2 3]) (into-array Byte/TYPE [1 2 3]))
06:13clojurebottrue
06:13_dwthanks, hyPiRion. anything more "idiomatic" than (= (vec b1) (vec b2)?
06:13hyPiRion^ _dw that's the most efficient one
06:13_dwthanks!
06:14hyPiRionIf you can get rid of arrays in the first place that'd be more idiomatic, but of course there are cases when that's impossible :)
06:14hyPiRionJust note the type hint, ^bytes.
06:14_dwI could cast them to vectors, should I prefer that?
06:15hyPiRionWell, it's certainly easier, and if performance is not an issue, sure thing
06:15_dwI see
06:16noidiTo clarify hyPiRion's answer, `=` treats arrays just like other objects. It's Java's definition of `.equals` for arrays as an identity comparison that's causing the confusion.
06:16silasdavisRaynes, how should I go about composing fragments in laser?
06:16noidihttp://stackoverflow.com/questions/8777257/equals-vs-arrays-equals-in-java
06:17noidihere's what `=` uses for comparisons https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/Util.java#L24
06:18_dwWasn't really aware it isn't a built-in type
06:18_dwThis makes sense
06:41ro_stis it possible to give individual multimethod implementations their own doc strings? if so, how?
06:42ambrosebsro_st: no, I just use comments.
06:42ro_stok, thanks!
06:45squidzseangrov`: yesterday I asked about a problem I had translating some javascript into function clojurescript. Do you have time to help me?
06:47squidzseangrov`: here was the link http://jsfiddle.net/N4E5c/3/ where the first javascript function there is rather iterative and I can't think of how to translate it to functional clojure(script)
06:58murtaza52Hi can anyone help me understand what is the utility of go blocks without channels
06:58murtaza52I mean what is different in placing a piece of code in a go block, then outside it.
07:02grandy_Hi all,
07:03grandy_I am new to clojure and unable to resolve this : http://pastebin.com/VCTeCBQv
07:07ambrosebsgrandy_: what happens without the macro?
07:07ambrosebsthere is nothing wrong with the macro
07:08grandy_I mean this is a dummy macro i was trying to test..
07:08grandy_in REPL seems to work fine
07:09grandy_trying to understand the concept
07:09ambrosebsright, it's something else that's throwing the exception.
07:10ambrosebscan you show more code?
07:59noncomis here anyone who tried clojuring with JMonkeyEngine3 ?
08:08noncomis there a way in clojurescript to pass a js function as a value? for example, can i store something like '.moveToTop in a map like (def m {:a '.moveToTop}) and then do ((:a m) someJsObject) ?
08:08noncomi had no fortune with that yet
08:10scgilardiyou could try (def m {:a #(.moveToTop %)})
08:22dark4eg_Hello
08:23dark4eg_Please help me. (s/replace "a b a" #"a|b" {"a" "1" "b" "2"}), #"a|b" - wtf? #"a|b" - сan I generate this structure programmatically?
08:25jkkramerdark4eg_: that would be a regular expression. see the re-pattern function
08:28dark4eg_jkkramer: thx. I have a list of keys map, i get to generate re-expression. where to dig?)
08:30jkkramerdark4eg_: the functions re-pattern, keys, clojure.string/join,java.util.regex.Pattern/quote may all come in handy
08:33dark4eg_jkkramer: thx
10:22andrewmcveigh|woDid someone write a cljs port of clj-time yet? Can't find one on google.
10:25rkneufeldThat'll be an interesting one.
10:25stuartsierraYeah since clj-time is a thin wrapper around JODA-Time.
10:25rkneufeldMy thought exactly. It'll be …fun, imitating an entire API.
10:25andrewmcveigh|woYeah, sure... I suppose I didn't really mean a "port"
10:26rkneufeldSomething cross-platform would be great though
10:26stuartsierraYeah, an actual pure-Clojure port of JODA
10:26andrewmcveigh|woI think I heard some talk about doing it the other week/month. Now I could use it.
10:27rkneufeldThat'd be a fun little project. If it isn't done by the time I'm done the Cookbook maybe I'll dig in there.
10:32andrewmcveigh|woDoesn't seem like too much work to immitate clj-time API. Joda-Time on the other hand, not sure I'd like to bark up that tree!
10:33Anderkentrkneufeld: I don't think 'little' is the right adjective
10:33stuartsierraNot sure how you could do one without the other.
10:34Anderkentthat depends on whether you just want clj-time/now, or all of it
10:34glosoliwhere can I find some sort of Clojure convention/idiomatic ways of doing things like accessing elements in map and so on
10:35rkneufeldAnderkent: that's all perspective. Working on the Cookbook is going to take the better part of a year. A few weeks of Friday time, evenings and weekends is "little" in comparison ;)
10:35`cbpglosoli: joy of clojure
10:36andrewmcveigh|woWell, of course I only need a few bits of clj-time now, but it's not the first time I wish I had it in cljs.
10:36`cbpglosoli: or just read some opensource :P
10:36Anderkentglosoli: the clojure koans, maybe? https://github.com/functional-koans/clojure-koans
10:36Anderkentdisclaimer: i haven't tried it
10:37stuartsierraglosoli: http://dev.clojure.org/display/community/Library+Coding+Standards
10:37rkneufeldandrewmcveigh: Another option is to develop a similar sets of API that are not drop-in equivalent to clj-time. Base the JS version off of something like http://momentjs.com/ and base the Clojure version on …X
10:37glosolithanks ! :)
10:37Anderkentalso, accessing stuff in map is `get-in`, just in case you want this particular answer not reading material
10:38floatbothIs there an easy way to buffer a lazy-seq? I have something like (map parse (line-seq lines)) and I want to store the parsed lines into Redis. To speed up Redis I/O, I want to use pipelining, but I don't want to pipeline the whole seq, I want to repeatedly take some items and send them
10:38glosoliAnderkent :The dev clojure links states it is keyword-first syntax to access items in object
10:38rplacarkneufeld: dove into the pedestal tutorial yesterday (and continuing today). Really nice work. Thanks!
10:38Anderkentwrapping them in functions that abstract the map (i.e. (defn get-user-metadata [state user] (get-in state [:user user :private :metadata])) ) a bonus :)
10:38glosolihmm interesting
10:38rkneufeldrplaca: that's all Brenton–I'm just the caretaker for that chunk of work ;)
10:38Anderkentglosoli: ah. Depends if it's a nested structure or basic modification. I think if it's the basic access that you ask about the clojure cheatsheet might be useful
10:38rkneufeldrplaca: But I'll pass it along
10:39Anderkentglosoli: http://clojure.org/cheatsheet
10:39rplacarkneufeld: well to both of you then. please do pass it on to Brenton.
10:39glosolihmm I have this one, I just found odd when someone told me that keyword-first syntax is idiomatic way of accessing items in maps, but seems they were right
10:39rplacahoping to have some cool stuff to show you by conj time
10:40Anderkentglosoli: it usually is because it's shorter than (get map :keyword).
10:40stuartsierraglosoli: Keyword-first is idiomatic when you know, at the time of writing the code, what the keys are (e.g. a structured data type).
10:41w|tthanks
10:42`cbpit also prevents null pointer exceptions :P
10:42glosoliAnderkent: what I was used to doing was (obj :keyword).. but now I realise that's wrong
10:42andrewmcveigh|workneufeld: Well, I think I'll implement what I need now, and see how deep that takes me ;-)
10:44AWizzArdIn my profiles.clj I added the dep [org.clojure/core.typed "0.1.24"]. Now a “lein deps” gives me => java.util.zip.ZipException: error in opening zip file. Ideas?
10:45squidzwhats the easiest way to test clojruescript
10:45coventryHave you tried removing that jar from ~/.m2 so that lein will download it again?
10:46rkneufeldsquidz: IMO, code that is both valid Clojure and ClojureScript. Though that excludes an platform specific interop, to which I don't have a good answer.
10:46AWizzArdI removed the .jar from my ~/.m2 and tried it again. I also removed it from my local Artifactory.
10:47AnderkentAWizzArd: lein1 or lein2?
10:47AWizzArdlein2
10:47Anderkentlast time I saw this message was someone using lein1 on a lein2 project.clj
10:47Anderkenthm.
10:47squidzhm, yeah unfortunately my code has some js interop so i'm not sure what the easiest way to test it would be
10:48stuartsierrasquidz: cemerick ported clojure.test to ClojureScript, I think
10:48AnderkentAWizzArd: can you post the full stack trace somewhere? (refheap/gist)
10:49Anderkentalso your profile/project file, if you can.
10:49coventryMaybe one of the other jars core.typed pulls in is corrupted. I would test this by moving ~/.m2 out of the way temporarily to do lein deps from a fresh start.
10:49ambroseb_ls
10:49lazybotboot data home media mnt opt src tmp usr var
10:49ambroseb_whoops. FWIW 0.1.24 seems to work for me.
10:50ambroseb_but i didn't clear my full .m2, just that jar.
10:50stuartsierrahaha
10:50Anderkentambroseb_: I do that all the time too. Shame on ubuntu on not deriving window focus from where I'm looking
10:51ambroseb_:)
10:52`cbpxmonad clearly does that
10:52`cbpin less than 1k lines of code~!
10:52AnderkentI blame Unity.
10:53AWizzArdKilled my .m2 dir, now it seems to work.
10:53AWizzArdMust have been some corruption in there.
10:53AWizzArdThx
10:53coventryNo worries.
11:09squidzls -la
11:09lazybotbin dev mnt root sbin src srv swap tmp usr var
11:10coventryAny suggestions for a good java-for-clojure-programmers resource? Maybe something less focused on java the language, more about aspects of its internals, data structures and libraries which are useful in a clojure context?
11:11glosolicoventry: Like more about Core of Java and JVM
11:11glosoli?
11:14coventryNot exactly. For instance, I'm looking for somewhere I would learn that that java collections are weakly typed, characters are two bytes and "lein repl" starts java with optimization options which confuse criterium.
11:15glosolicoventry: hmm I would like such thing too
11:16glosolicoventry: I have tried reading Core Java books, got through Volume I, was booring
11:18gvickerscoventry: yea that would be very useful
11:22Anderkentcoventry: not as far as I know, unfortunately
11:23coventryI might take a look at _Well-Grounded Java Developer_. It mentions polyglotism in the subtitle, and has a section on clojure, at least.
11:25rurumateIs it just me, or is something wrong with destructuring?
11:25Anderkentprobably both
11:25rurumate(let [{a :a b :b :as m :or {a "a0" b "b0"}} {}] m) returns {}
11:26rurumate(let [{a :a b :b :as m :or {a "a0" b "b0"}} {}] a) returns "a0"
11:26stuartsierracoventry: The original Sun Java Tutorials are good, in my opinion.
11:26rurumateseems inconsistent..
11:26coventryThanks, stuartsierra.
11:27Anderkentrurumate: the :as form simply binds the original form to a new name
11:27rurumateAnderkent: so the :or has no effect on it?
11:28AnderkentNothing in the destructuring form has any effect on it.
11:28rurumateAnderkent: grok
11:28Anderkentit's not 'construct these bindings and put them in a map as X', it's 'take original form, name it X, then destructure it'
11:30AnderkentIs there a more intuitive way of removing nils from a collection than (keep identity ...) ?
11:31llasramAnderkent: (remove nil? ...) ?
11:31`cbp(remove nil?)
11:31hyPiRionheh
11:32llasramJinx!
11:32seangrov`squidz: Still around and looking for help?
11:32seangrov`I thought dnolen had given you some advice on it
11:32hyPiRionhrm
11:32hyPiRion,(keep identity [1 2 true false nil :quux])
11:32clojurebot(1 2 true false :quux)
11:33seangrov`Do you have a pre-existing cljs project I can fork and experiment with?
11:33hyPiRionoh, I thought it was the other way around. Serves me right
11:33AnderkenthyPiRion: keep only discards nils, it's not filter :)
11:34Anderkentor was that the 'other way around' bit? My bad.
11:34seangrov`Keep:"Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included."
11:34seangrov`,(doc keep)
11:34clojurebot"([f coll]); Returns a lazy sequence of the non-nil results of (f item). Note, this means false return values will be included. f must be free of side-effects."
11:34seangrov`botsnack
11:34hyPiRionAnderkent: yeah, I thought it just discarded false. I just forgot *what* it discarded
11:34seangrov`~botsnack
11:34clojurebotbotsnack is newline
11:34seangrov`Alright, no botsnack
11:35hyPiRion~botsnack
11:35clojurebotbotsnack is scoobysnack
11:35hyPiRionclojurebot: stupid
11:35clojurebotExcuse me?
11:35llasramAww
11:35llasramPoor clojurebot
11:35`cbpclojurebot: botsnack
11:35clojurebotbotsnack is forget botsnack
11:37w|tclojurebot, botsnack
11:37clojurebotbotsnack is scoobysnack
11:38hyPiRionpoor boy, he's gone mental
11:40squidzsquidz: yeah I still need help. I may have not seen what dnolen said
11:40squidzhere is the link again http://jsfiddle.net/N4E5c/3/
11:41squidzseangrov`: i meant that to you and not to me of course
11:41seangrov`What does it do from a high-level?
11:41seangrov`And you said you were using the strokes library, is your project on github so I don't have to setup a dummy project locally?
11:45squidzfrom a high level that function manipulates an array of maps so that that there are even numbers of maps for given fields
11:45squidzit shouldnt depend on strokes, I just need to somehow manipulate the data assuming it is not a javascript array of objects but instead a clojure array of maps
11:46squidzseangrov`: the exmple of the data is in the link i posted
11:47squidzthe two commented entries in the data should be created by a clojure function. That function will instead fill in default values, or in our case the :value field in the map should be set to zero
11:50seangrov`Ok
11:56TimMcclojurebot, forget botsnack |is| forget botsnack
11:56clojurebotI forgot that botsnack is forget botsnack
11:56TimMcclojurebot, forget botsnack |is| newline
11:56clojurebotI forgot that botsnack is newline
11:58seangrov`squidz: Seems like this could be a much nicer example to work with
12:00squidzseangrov`: what example?
12:00seangrov`The example you gave, it's unclear where the interpolated data comes from
12:01squidzyeah that example isn't from me
12:01seangrov`Well, you're the one asking for help :P
12:02seangrov`How is the interpolated data calculated?
12:02squidzyeah soembody else had the problem in javascript and I have the problem in cljourescript. That is supposed to be the solution but I don't really see how I can translate that first javascript function to clojurescript
12:02squidzthe value will always be zero
12:02squidzand there should be an equal number of dates for each group
12:02coventryWhere are you stuck with the translation?
12:02seangrov`You said the two commented out rows should be added: //{key:'Group2',value:12,date:'04/23/12'},
12:03squidzno the values should be zero, sorry
12:03squidzjust the dates should remain so that there are equal numbers of dates for each group
12:03seangrov`I see, ok
12:04seangrov`Should there be an equal number of dates, or should there be the same dates for every group?
12:05squidzall groups should have the same dates
12:05seangrov`Alright, that's not too bad
12:06squidzso if grp1 has two dates and grp2 two has one date, it is assumed that the one date is shared, and an adittional entry should be made for grp2 so that they again have the same dates
12:06squidz*an additional map should be made for grp1
12:06seangrov`Sure, btu if Group1 has two dates, and Group2 has two dates, and neither of them are the same, then they should both end up with 4
12:07squidzyes exactly
12:07squidzso that the maximum coverage of dates is provided
12:16seangrov`squidz: https://www.refheap.com/18069
12:17seangrov`Example output: https://www.refheap.com/18070
12:19gfredericksclojure.core/realized? with lazy seqs is kind of misleading
12:19seangrov`Seems to do the trick
12:19gfredericksto n00bs at least
12:21dnolensquidz: I solved this yesteday http://gist.github.com/swannodette/6355478
12:22dnolensquidz: I'm not sure if dates will fall in the middle requiring padding around, I noticed that each pad entry must have a different day.
12:22dnolensquidz: anyways I think this version is way easier to understand than the JS you posted yesterday ;)
12:22seangrov`Yeah, that js is crazy
12:24squidzdnolen: oh sorry I didn't see your reply I may have left the office right before you sent it
12:25dnolensquidz: i didn't send it since you weren't around
12:25squidzoh okay I see well thank you both for your help. I really wanted a clear idea on how I could do it in clojurescript and thanks to yall I have two good examples. That should be more than enough for me. Thank you both
12:26squidzwhen I saw that javascript my head was spinning for some reason. it was very iterative
12:27squidzthanks
12:30dnolensquidz: my head was spinning too
12:31jtoyare there size limitations with atoms?I am adding integers to an atom vector and it does with OOM when I only have 2k items on it,
12:34jtoyor is this the wrong user case for an atom? Im just using it as a queue
12:35amacdougallCurious about this as well. In Joy of Clojure, they implemented a queue using Agents — is that the standard technique?
12:36seangrov`,(count (let [queue (atom [])] (dotimes [n 3000] (swap! queue conj n)) queue))
12:36clojurebot#<UnsupportedOperationException java.lang.UnsupportedOperationException: count not supported on this type: Atom>
12:36seangrov`,(count @(let [queue (atom [])] (dotimes [n 3000] (swap! queue conj n)) queue))
12:36clojurebot3000
12:38opqdonutamacdougall: I guess standard would be to use a vector atom
12:40Anderkentopqdonut: you cannot safely pop from a vector atom
12:40Anderkentamacdougall: yes, agents are pretty much a perfect fit for a shared queue
12:42jtoyso use agent instead of atom for a queue? is that correct?
12:42Anderkentjtoy: how many threads are you running? if a lot, you might have many of them trying to update the same atom at the same time and thus keeping size-of-vector * number of threads in memory
12:42jtoyAnderkent: I have not changed any threads sizes, everything is default currently
12:43Anderkentjtoy: as in you're feeding it data from a single thread?
12:43Anderkentthat shouldn't happen, are you sure it's not something else eating your memories?
12:43jtoyAnderkent: yes, i am feeding in data from the repl, just testing my code
12:43jtoyim sure,
12:43noncomdoes anyone know, when requiring a namespace, does clojure look for the (ns) macro in the file's text, or does it simply try to execute the code inside the text file?
12:43Anderkentjtoy: ah. The repl keeps history for you, which possibly references objects that would otherwise be GCd?
12:44jtoyAnderkent: my code is this: (def users-queue (atom [])) ; (defn add-to-users-queue! [id] (reset! users-queue (conj @users-queue id))) ; then i call add-to-users-queue! ~ 3k times
12:44jtoyAnderkent: I tried on a brand new repl
12:44`cbpthere should be a when-seq-let macro :P
12:44Anderkentjtoy: as to your agents question, if you need pop then you can't use atoms - there's no way to do a 'read, modify, save' loop and extract a value from the middle of it unless you maually do a compare-and-set! loop
12:45seangrov`jtoy: Why reset! and not swap! ?
12:45jtoythis was the pop! i wrote: https://www.refheap.com/18071 didnt get to test it yet
12:45Anderkentjtoy: you can either use agents, if you don't mind being asynchronous, or refs and transactions
12:46jtoyseangrov`: i just started using agents, im still learnign the proper way
12:47Anderkentjtoy: both your functions are not thread safe. If something else modifies the queue inb etween your @queue and (reset!), you will overwrite that information
12:47Anderkentjtoy: also your code works for me: https://www.refheap.com/18073
12:48coventryYes it works for me, too. Was thinking to run it on clojurebot, but didn't want to risk crashing him. :-)
12:48jtoyAnderkent: mine dies at 2016 every time :)
12:49Anderkentcan you paste the repl output exactly? and are you possibly running some weird jvm options? (-xMx=2m :P)
12:49opqdonutAnderkent: do you mean that I can't both pop and return the popped element? yeah that's a problem.
12:50Anderkentopqdonut: yes, exactly. It's not a 'problem', it's a dealbreaker for a queue :P
12:50technomancyhugod: would it be crazy for criterium to try to check for tiered compilation and warn if it's off?
12:51jtoyI think i see why
12:51hugodtechnomancy: probably a good idea - should be simple enough to detect
12:52jtoyi changed for to doseq for inserting the ids
12:52llasramIf you want a concurrent, non-persistent queue, just use the task-appropriate java.util.concurrent queue
12:52llasramThat's what the Clojure standard library does itself
12:53jtoyllasram: how is it non persistent? arent all the clojure queues non persistent?
12:53`cbpclojure.lang.PersistentQueue is persistent
12:53llasramRight. I mean if you don't need the queue to be persistent
12:54llasramIf you're just pushing items on and popping them off in some sort of producer/consumer model, the j.u.c queues are the way to go
12:55AnderkentI think it was more of a 'how would I go about doing this in clojure' question than a 'how do I get this problem solved' question
12:56jtoyso if I want to have a system where ids get added to different queues and consumers at certain time run jobs (based on some logic) what queue mechansim should I use? I dont really care if they are persistent
12:56AnderkentI mean sure j.u.c queues will probably do it, but that doesn't help one familiarize themselves with clojures concurrency primitives
12:57llasramAnderkent: Yeah, but you should use the right tool for the job. Clojure in part doesn't have things which duplicate what's in j.u.c because that stuff is already rock solid and awesome
12:57Anderkentjtoy: agent per consumer, +1 agent as a dispatching exchange that does the 'which consumer should handle this' logic then sends the message to consumers work queue
12:59llasramMy vote is only use agents when the value of the agent itself is meaningful. agent == state + queue of updates to perform against it
13:00llasramIf you just need a the queue part and there isn't meaningful state attached to the queue, then I think it's best to just use a queue
13:00opqdonutAnderkent: btw atoms work if you cheat a bit: https://gist.github.com/opqdonut/6355918
13:01opqdonutobviously retaining a reference to the element that was just popped is a slight problem, but it works
13:01jtoyI dont have state in the queue, but the consumer can only work at certain times so it needs to check whether it can run before pulling data from the queue
13:01Anderkentopqdonut: yeah, but that is generally messy
13:01Anderkentjtoy: oh, then agents arent what you want - the control is inverted for them: you're told when you have work, you don't poll for it
13:01Anderkentseems you just want refs and transactions
13:02opqdonuton a related note, ArrayBlockingQueue is fine for a quick hack
13:02clj_newb_2345is there a standard way to do keyword arguments for funciotions in clojure1.5.0, or is it still a bunch of ahcks from contrib?
13:02jtoyfor the scheduling part is there recommended library? I was about to use quartz, but looking through the docs, it seems more complicated then i need
13:02amacdougallThere's a way of destructuring that parses kwargs, right?
13:02Anderkentllasram: the problem with using j.u.c is that it might be fine if you just need a queue, but as soon as your state is larger than that, say you have a map in an atom where one of the keys is your work queue you get in so much trouble
13:02Anderkentjtoy: at-at looked fine when I browsed through it
13:03llasramAnderkent: Sure. Use the right tool for the job
13:03jtoyAnderkent: so then use atoms or juc? I try to stay away from java heavy stuff since I've never really programmer java before clojure
13:03Anderkentjtoy: neither. Use refs and (dosync) blocks.
13:03ToBeReplacedclj_newb_2345: see https://github.com/ToBeReplaced/mapply maybe
13:04jtoyok
13:05jtoythanks all
13:05Anderkent... except that these don't like being nested, so there's another possible problem.
13:05Anderkent(or rather, the nesting semantics are what you want 90% of the time, but when they aren't you can't do anything about it)
13:08Anderkentjtoy: just don't use knit for scheduling, it leaks threadpools like mad.
13:08ambroseb_amacdougall: it's the same syntax, but after &
13:11Anderkentamacdougall: so basically ([a b c & {:keys [key with-default] :or {with-default :foo}}] ), if an example makes it easier
13:12Anderkent(forgot the defn)
13:15clj_newb_2345clojure has number? -- does clojure not have "bool?" ?
13:15clj_newb_2345i'm looking for a function that's basicallly like #(= (type %) java.lang.Boolean)
13:17stuartsierraclj_newb_2345: (instance? Boolean foo) is all there is
13:17kohkaneclj_newb_2345: there are the true? and false? predicates
13:17technomancy#{true false}
13:18anildigitalmy map key has vector having string values.. now want to return the key of the map .. if values contain one of the string
13:18anildigitalhow to do this in clojure
13:18stuartsierratechnomancy: (#{true false} false) will return false
13:18clj_newb_2345staurtsierra, kohkane: noted, thanks
13:18bbloomstuartsierra: i have defn boolean? in a non-trivial number of programs :-)
13:18technomancystuartsierra: heh; true
13:18clj_newb_2345technomancy : thanks-- ; staurtsierra: thanks++;
13:18stuartsierra:)
13:19technomancyclj_newb_2345: you misspelled inc and dec
13:19technomancyclj_newb_2345: how long are you going to keep that nick anyway? =)
13:19bbloom(++ technomancy)
13:19clj_newb_2345technomancy: until I understand core.async, pedestal, and core.match
13:20pjstadig(1+ technomancy)
13:20technomancyoh you.
13:20bbloom(swap! technomancy update-in :karma inc)
13:20bbloomdammit, i mean:
13:20stuartsierraheh
13:20bbloom(swap! technomancy update-in [:karma] inc)
13:20technomancy(incf bbloom)
13:20stuartsierraThose damn brackets. Gets me every time.
13:21bbloomstuartsierra: dur. shoulda used assoc
13:21justin_smith,(contains? #{true false} false)
13:21clojurebottrue
13:21muhoo(inc dec)
13:21lazybot⇒ 1
13:22bbloomer my brain isn't working. not associ, update-in is what i want. why don't we have an update function w/o the -in part again?
13:22stuartsierrabbloom: Because.
13:22TimMcbbloom: ITYM (swap! karma update-in ["technomancy"] inc)
13:22bbloomTimMc: and now we see that data encapsulation is sometimes a good thing :-P
13:23bbloomi wish it were 10X easier to create custom map types
13:23TimMcI don't think it's a good idea to have technomancy as a var.
13:23bbloomb/c i'd totally make a karma map w/ reverse indexes :-P
13:24bbloomtechnomancy: surely technomancy gets so much karma we can justify the special case
13:24bbloomer that was for TimMc, you guys get the idea
13:26AnderkentTimMc: (alter-var-root #'technomancy (constantly some-other-guy)) - identity theft at its prime
13:27hyPiRionNow just wait until he's collected by the garbage man
13:40anildigitalThis should have print "Win" right https://gist.github.com/anildigital/a7e1c8683a2605c638a5
13:41rasmustoanildigital: careful with contains?, it doesn't do what you think it does
13:41anildigitalrasmusto: any alternative to contains?
13:42rasmustoanildigital: I'd use a set, but there might be another way
13:42Anderkentanildigital: make your vector a set and then query that: (cond ((set v) "WATCH OUT!") :won)
13:43Anderkentalternatively
13:43Anderkent(cond (some #{"WATCH OUT!"} v))
13:43Anderkentmight be cheaper if your vector is really long
13:44Anderkentanildigital: also see http://stackoverflow.com/questions/3249334/test-whether-a-list-contains-a-specific-value-in-clojure for the answer and explanation of what contains? does
13:49jtoyI know this is horrible, but if i have an an atom vector, why does this return the same item instead 100 different items? (map (fn [x] (pop-users-queue!)) (take 100 (range)))
13:50jtoyim interested to understand why it doent work
13:50rasmustoanildigital: long story short, contains? checks for existence of a key, in the case of a vector, its looking for indices that exist
13:50anildigitalrasmusto: got it
13:52anildigitaluser> (for [[k v] things] (cond ((set v) "WATCH OUT!") k))
13:52anildigital(nil "Woah, chill out!" nil nil)
13:52anildigitalhow to make it return just result .. woah .. one
13:54llasramjtoy: hard to say w/o seeing the implementation of `pop-users-queue!`
13:55jtoyllasram: https://www.refheap.com/18076 I tested it by running pop-users-queue! a couple of times and got different ids everytime myself
13:55anildigitalhttps://gist.github.com/anildigital/33c8b4d18c277e76b394 should return string.. but is returning nil
13:55anildigitalhow to make clojure return the matched result
13:55anildigitalinstead of returning all the results
13:56llasramjtoy: First off, if you're going to use an atom, use `swap!`, not `reset!`
13:57kohkaneanildigital: doseq returns nil irrespective of result
13:57rasmustoanildigital: you want it to return just "Woah, chill out!"?
13:57anildigitalrasmusto: yes
13:57jtoyllasram: but swap! returns the value swapped in?
13:57llasramjtoy: Second, using pop w/ a vector means this would be a stack, not a queue
13:57anildigitalrasmusto: i changed doseq to false but no much help
13:58saolsenare there any pubsub abstractions build on core.async yet that work in clojurescript?
13:58rasmustoanildigital: I'd recommend for instead of doseq, followed by a (first (filter (complement nil?) res))
13:58llasramjtoy: And... Yeah, actually. So you use `first` to get an item out of the vector, then use `pop`, which drops the last item (not the first)
13:58llasramThat's why you're getting the same item every time
14:00glosoliis there some way in vim-fireplace to keep the Command Line for entering clojure code for evaluation always on (that cqc thing)?
14:00llasramBut fundamentally, this implementation doesn't even begin to be concurrency safe. You need check-and-set semantics, which you can only do with `swap!` -- not with `deref`+`swap!` and definitely not with `deref`+`reset!`
14:01llasramjtoy: If this is all you're trying to do, then you definitely just want a j.u.c queue
14:02jtoyyes, that is all i need
14:02jtoylooing up how to do that
14:03llasramjtoy: Look at the implementation of clojure.core/seque
14:03llasramIt's a clojure.core function which uses a j.u.c LinkedBlockingQueue
14:05jtoythx
14:05llasramWell, it's a bit funky. I'm not sure it shows off best practices. But at least it is an example
14:06jtoyllasram: is there a more idiomatic way to write this? (map (fn [x] (pop-users-queue!)) (take 100 (range)))
14:07rasmustoglosoli: it uses vim's command-line window, and I don't know that theres a way to make that "stick"
14:07llasramjtoy: (repeatedly 100 pop-users-queue!)
14:07glosolirasmusto: eeeh ;/ damn all the editors
14:08jtoycool, never saw repeatedly
14:08rasmustoglosoli: for persistant stuff like that, I just make a bunch of namespaces that I drop into .gitignore
14:08glosolirasmusto: emacs broke me lol, I can stand it and now can't go back to VIm that easy ;/
14:09rasmustoglosoli: are you just missing the emacs integrated repl?
14:09glosolirasmusto: yeah
14:09rasmustoglosoli: understood
14:10glosolirasmusto: But while in Emacs I am missing decent Nerd Tree
14:10rasmustoglosoli: Nerd Tree is far from the killer feature of vim, you should stay with emacs IMO :)
14:11rasmustoglosoli: I like using some sort of fuzzy file/workspace search instead of actually browsing through file trees
14:12glosolirasmusto: Hmm same here, dunno, I just thought about a need of something like proper nerd tree in Emacs and kept on killing myself with the idea, though I would barely use it for sure
14:12cgagnerdtree is definitely one of the things that keeps me from bothering with emacs
14:12glosoliyou made me sad again lol
14:12cgagthat plus the editing
14:13glosoliediting ?
14:13rasmustocgag: evil-mode, and uninstall nerd-tree from you vim plugins, makes it easier to switch
14:13anildigitalanyone on exercism? want to nitpick my solution http://exercism.io/submissions/521ce6cd97552d2d96000059
14:14cgagjust the general lack of modal editing / the crazy key chords, evil isn't bad, but i haven't really felt any significant motivation to switch since I got kind of comfortable with fireplace
14:14cgagthe lack of a real repl is kind of annoying though
14:14glosolicgag: that's why I can't go back to vim lol
14:14cgagthe problem with evil is you have to write vim-like bindings for all the plugins
14:14rasmustocgag: I agree (with you fireplace point). I think multi-repl stuff could be useful in emacs
14:15glosolirasmusto: hmm can't you do that already ?
14:15rasmustoglosoli: er, I meant that its something that's lacking in vim, and it would be a +1 for emacs
14:16glosolirasmusto: I am not sure if there is multi nrepl coz I never tired myself, though I somehow concluded to it being that way
14:17seancorfieldnrepl.el supports multiple repl sessions
14:18seancorfieldi often have a local repl running and then at least one more repl into another process
14:20glosoliseancorfield: hmm sounds interesting
14:37noncomdoes anyone have experience clojuring with JMonkeyEngine3?
14:50seangrov`Wow, as far as I can tell my clojure app isn't doing anything, and yet it's consuming ~750% cpu
14:50nDuffseangrov`: ...well, if you have a reproducer...
14:50seangrov`I started it via nrepl-jack-in - any way to peek at what the hell it's doing to consume all the cpus?
14:50nDuffseangrov`: generally, btw, you'll want to use the same profiling tools you'd use for Java.
14:51seangrov`nDuff: It's likely that I've done something in the repl, I'm just not clear on what it would have been
14:52noncomtry visualvm?
14:53seangrov`noncom: Thanks, I'll look it up
15:20pandeirowhat is the difference between using ring's wrap-sessions with and without the middleware.session.cookie/cookie-store fn?
15:24kohkanepandeiro: Session information is usually stored locally and retrieved with the ring-session cookie key
15:25kohkanepanderio: If you specify the cookie-store then it's stored encrypted in a cookie on the users browser
15:25pandeirokohkane: 'locally' in this case means on the server?
15:26kohkanepandeiro: Yes
15:26pandeirokohkane: okay but even w/o cookie-store, a session cookie is saved on the browser. so the difference is encryption?
15:27kohkanepandeiro: There is only a ring-session key thats stored on the users browser that indexes session information map
15:27kohkanepandeiro: With cookie-store the entire session map is stored on the users browser but its encrypted so that the user cant access it
15:28callenhttp://inchingforward.blogspot.com/2013/08/adventures-in-luminus.html
15:29pandeirokohkane: ah so if i store arbitrary keys/vals in the response's :session, they will be present in the browser, but encrypted
15:30kohkanepandeiro: If you use cookie-store, yes. Otherwise, it'll be stored on the server in a map with the ring-session cookie of the users browser as the key
15:32pandeirokohkane: ok so does using cookie store make it harder for someone to spoof a cookie from a different user's browser session? or not really, if they just copy it over verbatim?
15:35kohkanepandeiro: I'm NOT really sure, but I guess both methods have equal risk because if someone can just copy your ring-session cookie, they can copy your entire cookie store
15:35pandeiroright.. i am trying to understand the utility of cookie-store: it's basically a persistence mechanism, not a security one
15:35pandeirokohkane: thanks for the explanations
15:36Apage43pandeiro: the purpose of cookie store is to store the data in the browser, rather than on the server
15:36Apage43yeah
15:36pandeiroto combat cookie spoofing, something like nonces...
15:37Apage43if you're worried about eavesdroppers you should probably just be using SSL
15:39pandeiroApage43: yeah actually i am using a third party service via oauth for the 'serious' parts... i am just trying to accelerate the oauth workflow as much as possible by caching the access tokens (wisely)
15:39kohkanepandeiro: cool
15:42seangrov`Is it not possible to use (comment ) and put arbitrary (non-valid clojure) text in?
15:42tauntaunDoes clojure have a web framework as fully featured as Python's Django?
15:42seangrov`(comment Steps: 1. So this 2. Do that)
15:42seangrov`,(comment Steps: 1. So this 2. Do that)
15:42clojurebot#<RuntimeException java.lang.RuntimeException: Invalid token: Steps:>
15:42seangrov`Ok, well, I guess that explains it
15:43bbloomseangrov`: comment is just a macro, it's not special
15:43amalloyseangrove: comment is just a macro; it has to be able to read the input form
15:43bbloomtry (source comment)
15:43TimMcseangrov`: If you are careful about what you write, sure! https://gist.github.com/samn/5843422
15:43TimMcNotice that he doesn't use a wide variety of punctuation.
15:44bbloomlol that seems like a terrible plan
15:44amalloyyeah, if you never misbalance parens, use semicolons, or try to talk about things like: lists, you're fine
15:44TimMcAnd forget about using the normal range of emoticons. :-(
15:45amalloywell okay, but we're looking for arguments *against* this plan
15:45TimMcseangrov`: Using #_ "blah blah blah" is generally superior.
15:46amalloyTimMc: c'mon, just put ;s in front of every line. it's not like editors make that hard
15:46TimMcNo, everything must be data!
15:46futilewelp
15:47TimMcWrite everything in parse trees.
15:47bbloomhttp://www.haskell.org/haskellwiki/Literate_programming
15:47pandeirokeywordize every word
15:47bbloomwho doesn't want their program inside a latex program?
15:49stuartsierraAnd another 2 programs to separate the code from the latex.
15:49bbloomor you can just write one program that does both at the same time & then write two more programs that call the first one and throw out half of the data
15:50callenseancorfield: Is there a universal function somewhere in c.j.j through which all queries/inserts/etc pass through?
15:54TimMc&#{(println "of") do (do :z/h283r (println "order")) (do :b121 (println "out"))} <-- example I made a while ago
15:54lazybot⇒ out of order nil
15:54phiatis there a better place to ask a noobish question? (list comprehensions/permutations/recur)
15:54phiathttps://gist.github.com/phiat/532c72d7c88725b3fa3b
15:54dnolenphiat: all noob questions allowed just ask
15:55futileWhat's c.j.j.?
15:55amalloyphiat: that's a pretty good implementation
15:55phiati don't understand how (disj (set things) head) works
15:55amalloythe (do) inside the for is unnecessary, and (= 1 (count things)) should be (not (next things))
15:56phiati took this fn from kyle burton's blog
15:56TimMcfutile: Probably clojure.java.jdbc
15:56futileoh
15:56futilethanks
15:56phiatthanks
15:57amalloyactually, i take it back, it's not really that good because it's building O(N^2) sets of average size N/2 for no particular reason
15:57squidz³how can I best change multiple map values given a vector of new values for example given the vector [5 5] update the values 1 and two. [{:value 1} {:value 2}]} -> (5 5) :-- [{:value 5} {:value 5}]
15:57amalloyanyway, phiat, (disj (set things) head) means: "build a set out of all the things, and remove head from it"
15:58phiatthanks amalloy, i'm not super interested in optimization, just learning how it does its magic
15:58amalloywell, it's not really *right* either, because it fails on lists with any duplicate elements
15:58phiattrue, suppose that is given
15:59bjatauntaun: essentially no. It has libraries that get you there. But it's much more akin to using Flask than Django
15:59squidzi'm trying to modify a nested map so I may be asking the wrong question. the map looks like this: {:key 'a :values [{:value 1} {:value 2}]} 5 5 => {:key 'a :values [{:value 5} {:value 5}]}, where the second map is what i'm going for
16:00squidzgiven a vector of new vals to associtate, here [5 5]
16:01tauntaunbja: thanks
16:03Apage43,(let [m {:key :whatever :values []} new-vals [5 5]] (assoc-in m [:values] (mapv (partial hash-map :value) new-vals)))
16:03clojurebot{:key :whatever, :values [{:value 5} {:value 5}]}
16:03Apage43er, no need for assoc-in there
16:03seancorfieldcallen: no, no universal function... do-prepared-stmt is close i think
16:04Apage43just (assoc m :values …) since its only one key dee
16:05squidzthanks ill give it a try
16:06lyn_,(doc mapv)
16:06clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & ...]); Returns a vector 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."
16:06Apage43like map, not lazy, returns a vector
16:06squidzworks like a charm thanks
16:07lyn_nice, been bitten by maps laziness
16:07squidznever used mapv before, looks likve it could have save me some troubles if I would have had it in mind
16:14callenseancorfield: interdasting. I tried that, didn't get very far. Also couldn't extract the SQL because things were already buried in helper fns.
16:14callenseancorfield: in order to write a nice SQL query logging library, am I just going to have to play fn whack-a-mole with c.j.j or what?
16:14hugodtechnomancy: do you have a good link with an explanation of lein's use of TieredStopAtLevel?
16:14callenplease tell me I have a better option than that - but if I don't, is there a list of the fns I should wrap in order to catch all queries/actions against the database?
16:19astevehow can I get more of the stack trace from a lein compile error?
16:19asteveI'm getting a "Don't know how to create ISeq from: clojure.lang.Keyword" error but I don't know where to look in the file for the call
16:20hyPiRionasteve: Is that during compile time or runtime? In either case, you should get a line number
16:20astevehyPiRion: compile time
16:21hyPiRionThen it's because a keywords is used where a seq/vector is expected
16:21hyPiRion,(let :keyword what)
16:21clojurebot#<IllegalArgumentException java.lang.IllegalArgumentException: let requires a vector for its binding in sandbox:>
16:21hyPiRionlike that, just somewhere else apparently
16:23phiatamolloy: I'm still not wrapping my head '(no pun) around how the (disj (set things) head) returns anything but the head, seeing that head is bound to things...
16:23phiathttps://gist.github.com/phiat/532c72d7c88725b3fa3b
16:25TimMcWhat would be the consequences of replacing all deref calls in a dosync block with ensure calls?
16:25callenTimMc: sounds like a good opportunity to do some ?!SCIENCE!?
16:26TimMcI don't think the experiemtnal method is particularly appropriate for studying concurrency correctness. :-P
16:26phiatamalloy: I'm still not wrapping my head '(no pun) around how the (disj (set things) head) returns anything but the head, seeing that head is bound to things...
16:26TimMcIt seems to me that any time you deref a ref in a dosync, you *probably* want to ensure it somewhere in the dosync as well.
16:28TimMcBasically, I'm wondering if anyone can come up with a countering use-case.
16:28technomancyhugod: I don't think there's a good link; it was just something I heard jruby had a lot of success using
16:28technomancymaybe https://weblogs.java.net/blog/forax/archive/2010/09/04/tiered-compilation
16:29phiatI'm trying to get a basic fn to return permutations on a set. doesnt need to be efficient, nor account for duplicates
16:29futileyou guys are way smarter than me
16:29futileand im very glad for that
16:30phiatwithout the entire math.combinatronics...
16:30stuartsierraTimMc: There are lots of cases where you may want to read multiple refs in the same transaction, consistently, but you don't care if they have changed by the end of the transaction.
16:30amalloyphiat: head isn't bound to things, it's bound to each successive item in things, in a loop
16:30noncomfutile: yes, sometimes i read this irc and feel sooo glad for that...
16:30callentechnomancy: that's pretty impressive. :)
16:30noncompure happiness i say
16:31technomancycallen: eh?
16:31callennoncom: until you're on the sharp end of amalloy's idiot stick, sure.
16:31futilenoncom: http://bit.ly/1dkKyXm
16:31callentechnomancy: tiered compilation
16:32amalloycallen: you're accusing me of being hostile?
16:32callentechnomancy: nifty stuff, I didn't know it existed beyond seeing it in some Leiningen stuff.
16:32technomancyoh, it's an OK link, but it doesn't discuss the StopAtLevel aspect specifically
16:32callenamalloy: not really accusing, just gently prodding you :)
16:32hyPiRionamalloy: I thought that was a compliment
16:32technomancycallen: beware the -X[...] args
16:32noncomfutile: haha, both.
16:32technomancycallen: have you tried my ocaml code yet?
16:32futileSo after my project management tool, my next project is gonna be an IDE for Clojure in Clojure.
16:33callentechnomancy: grenchman?
16:33technomancycallen: aye
16:33callennot yet, I need to.
16:33noncomfutile: what was your project management tool? i missed that..
16:33callenin fact, I have use for it right now.
16:34phiatamalloy: thanks! lightbulb!
16:34technomancycallen: let me know what you think if you do
16:34futilenoncom: Oh just that I plan to write a tool that replaces the dilapidated one we're using for work.
16:34callentechnomancy: opam is nifty. OPAM is just from the last couple years right?
16:35squidzfutile: how would it be different than the IDEs out right now? Would the clojure in clojure change anything?
16:35noncomfutile: i see... and what about the ide? are you gonna go in steps of clooj?
16:35technomancycallen: maybe even just year, singular
16:35callentechnomancy: I wonder why people suddenly cared. Very grateful for it anyway.
16:35technomancycallen: sponsored by Jane Street, it sounds like
16:35callenmaybe they had a good year :)
16:36technomancyheh
16:36technomancycallen: if you do get a chance to look at the codebase itself I'd be interested in hearing thoughts from someone who knows what decent OCaml looks like
16:37technomancyso far I'm in the single-digits of days of experience
16:37callenI am far from an authority on that.
16:37technomancydouble-digits at least? =)
16:37callenI was just a refugee that used it for awhile before and after Haskell.
16:38callento write utilities, mostly.
16:39callenwell at least Minsky's finally doubling down on the community.
16:41ToxicFrogMinsky?
16:42callenToxicFrog: Jane Street (founder?), OCaml luminary/advocate.
16:43callenToxicFrog: OCaml is basically type systems and FP done right and pleasantly so. Nifty language for producing binaries.
16:44ToxicFrogAah.
16:47futilesquidz: It would do all the things I want it to.
16:48futilesquidz: I admit that's kind of vague. But if I had doubted this intuition before, I wouldn't have come up with Zephyros or Bahamut. And I'm super glad I did both.
16:48futilesquidz: (see https://github.com/sdegutis/zephyros and https://github.com/sdegutis/bahamut)
16:48futilenoncom: probably not.
16:48squidzApage43: the example you gave me works when the maps only contain one key but when there are others it overwrites everything. {:value 1} -> {:value 5}, but {:value 1 :date 1} -> {:value 5} so the second key and val are ignored
16:49Apage43Ah
16:49futilesquidz: also I think Clojure is the best language for it because of all the available Clojure libraries for inspecting/manipulating Clojure projects.
16:50Apage43I didn't understand what you were trying to do
16:50squidzfutile: your github link is broken
16:50futilesquidz: the second one? Your irc client might just be including the closing-parenthesis.
16:51noncomfutile: nice things zephyros and bahamut! although i am a windows user, i see they are cool. and also you listen to tool music, that ensures you making cool software
16:51s4muelmaynard++
16:51futilenoncom: haha. well I normally would argue against that measurement, but heck I'll take what credibility I can get.
16:51s4muelrather (inc maynard) here.
16:51squidzApage43: do you know if there is a way to do it when my maps are structured like that?
16:51noncomehehe :)
16:51noncom(inc maynard)
16:51lazybot⇒ 1
16:52noncom$seen maynard
16:52lazybotI have never seen maynard.
16:52noncom:(
16:52futilelazybot: you should, he's a great singer
16:52noncombad for you bot
16:52squidzfutile: ah i pasted them both as one url, didnt realize that it is two
16:52futilesquidz: heh
16:52Apage43Squidz I'd use reduce and assoc-in
16:52noncomso an idea about a cool ide sounds cool
16:52noncomactually i think that ides are stuck in past
16:53TimMcstuartsierra: The situations you're thinking of, do they also involve writing to another ref? If all you're doing is reading refs, then sure, you never need ensure.
16:53futileMost IDEs seem to have features I don't want and lack features I want.
16:53noncomwhat you think about emacs?
16:53noncomwhat does not suit you with it?
16:54futileI've been using emacs for a few months in Clojure. It's lacking in some areas.
16:54stuartsierraTimMc: Sure, say you want to read two related counters to update a third which will be used for analytics or UI display or something.
16:54Apage43(reduce (fn [m idx] (assoc-in [:values idx] (v idx))) m (range (count v)))
16:54squidzfutile: have you seen deuce? https://github.com/hraberg/deuce
16:54noncomi dont use emacs, but ppl say it is 100% customizable (and i agree from what i know). what is intersting is that you find it somewhat limiting
16:54Apage43Where m is your map and v is the vector of values
16:54futileSure, it's open source and I could fix the problems by trying to fix other people's code. But I've learned to discern when a rewrite is in order or not, and in emacs's case it is.
16:55squidzApage43: let me give it a try
16:55Apage43Typing on phone so i haven't tested that
16:55squidzApage43: ill try it out for you
16:55futilesquidz: I looked briefly at it and emulating emacs is not the right goal. Emacs was written in the 80s when things were much different, and has not evolved as gracefully as it should have.
16:56astevehow can I get a full stack trace at compile time?
16:56asteveI would like this piece: " ... 26 more"
16:56futileGranted, many people here will disagree. Just like many people use Slate instead of Zephyros. But many people have moved from Slate to Zephyros. So I have confidence now that I know what I'm saying.
16:56stuartsierraasteve: You're not really missing anything. those are just duplicated stack frames in the "caused by" chain of the exception.
16:57mgaarefutile: what in particular do you want to see in emacs
16:57hyPiRionproper concurrency for a start
16:57astevestuartsierra: ok how can I narrow down where in my file is causing this exception "Don't know how to create ISeq from: clojure.lang.Keyword" ?
16:57futilemgaare: well for one thing, ido-mode will omit results when I type "viewcode" but show them if I type "view/code" even though I have fuzzy matching on. That's a pretty detrimental bug.
16:57stuartsierraasteve: Look at the file. :)
16:57squidzthe reason I like emacs is because you only have to learn emacs and you have a pretty good IDE for pretty much any language
16:58Apage43Squidz there should be a m after assoc-in
16:58noncomfutile: that is very good. i know that feeling and its base. one thing i can say: keep pushing, i hope to see it someday..
16:58astevestuartsierra: it is quite massive, I actually commented out two blocks of code that involved keyword and the exception was still thrown
16:58stuartsierraasteve: Sorry, nothing to be done but keep narrowing it down.
16:59squidzApage43: right ill add it in
16:59TimMcstuartsierra: Ah, I see -- you may be computing a lagging view.
16:59TimMcThanks, that's helpful.
16:59stuartsierraYou're welcome.
17:00stuartsierraThere are probably better examples I haven't thought of.
17:00squidzApage43: it works! awesome thanks
17:00Apage43Neat!
17:01futiletechnomancy: you didn't add chicken scheme to the mix in your comparison, do you have thoughts on it?
17:01technomancyfutile: eh?
17:01technomancyyou mean my blog post?
17:01futileyea
17:01technomancyI did actually include chicken scheme?
17:02futileoops.
17:02futiletechnomancy: sorry for the noise
17:02technomancyheh; np
17:06squidzApage43: oh wait, no it doesnt, the dates still arent there
17:06astevewhat json dep do you guys use?
17:08technomancycheshire!
17:08stuartsierraAll of them, transitively!
17:10asteveinteresting
17:11astevestuartsierra: it appears you write json.clj for clojure/data.json
17:11stuartsierraasteve: Yes, I wrote and, to my everlasting regret, maintain data.json.
17:11dakronestuartsierra: hah
17:12dakronewhy regret?
17:12astevestuartsierra: well, I'm getting "Don't know how to create ISeq from: clojure.lang.Keyword" while using data.json
17:12stuartsierradata.json is like the beautiful child who grows up into an angry, surly teenager who wrecks your car.
17:12technomancyactually I still use clj-json; I find it gives a warmer, more vibrant sound
17:12llasram(inc technomancy)
17:12lazybot⇒ 72
17:13stuartsierraasteve: can you be more specific? "Using" covers a lot of ground. :)
17:13dnolenstuartsierra: fwiw, I don't have any problems w/ data.json at the moment
17:13stuartsierradnolen: You're the first. ;)
17:13futilestuartsierra: what's wrong with data.json?
17:13hyPiRionfutile: the fact that he has to maintain it, I suppose?
17:13futilehyPiRion: but is that all?
17:13stuartsierraJSON parsers are the ultimate bike shed project. They're simple enough that anybody can write one, so everybody has ideas about how to do it.
17:13astevestuartsierra: right, http://pastie.org/8275157
17:14technomancyfutile: getting yelled at by michael kishlin maybe?
17:14futilestuartsierra: seems like the easiest route would be to delegate the internal work to clj-json
17:14futilethat's what I'd do if I had to write a json parser today
17:15futilejust delegate to clj-json or data.json
17:15futileI mean, if I had to parse some json
17:15futile.
17:15ztellmanbrb writing two dozen paper-thin wrappers around other popular clojure libraries
17:15stuartsierraLike Cheshire delegates to a Java library.
17:16astevestuartsierra: I see mention of :key-fn in the docs and I wasn't sure if that's required
17:16stuartsierraztellman: :)
17:16stuartsierraasteve: So what's the issue, exactly? Compile-time exception? Run-time exception?
17:16futileztellman: yes, that was the joke.
17:16astevestuartsierra: compile time
17:16futile:/
17:17stuartsierraasteve: If it's a compile-time error it almost certainly has nothing to do with data.json.
17:17ztellmanfutile: s/joke/brilliant idea/g
17:18futilequick someone slap me with a dose of humility
17:20astevehmm
17:20astevefighting clojure stack traces and exceptions is hell
17:21pbostromhttps://www.refheap.com/18077 Part 1: I want to execute some side effects inside of a dosync block, this is how I would do it right? Part 2: Is it dumb to use an agent to store a closure like this, and should I use some more appropriate data structure?
17:21stuartsierraasteve: That code snippet compiles fine for me, with appropriate (ns … (:require …))
17:22astevestuartsierra: ya, I guess that's good news
17:22futileHey guys, what would be a better route for IPC? To communicate over a single socket, or to spin up a process per request/response and talk via its stdin/stdout?
17:22asteve(:require (clojure.data.json :as json)), looks kosher?
17:22squidzApage43: I figured out that we need to add the path like [:values idx :value] and then it works
17:22stuartsierraasteve: No. (ns … (:require [clojure.data.json :as json]))
17:23stuartsierraA "libspec" must be a vector.
17:23hyPiRion"must"
17:24astevestuartsierra: is this a change from 1.3?
17:24stuartsierraasteve: No, it was always that way.
17:25stuartsierraLists are for prefixes.
17:26lyn_pbostrom that code looks odd to me. why do you need agents if all you're doing is side effects?
17:27pbostromlyn_: inside of a dosync block, I also want to alter the ref under certain conditions
17:28pbostromlyn_: dosync block would retry side effects if I don't use an agent
17:28astevestuartsierra: thanks for the assistance
17:28stuartsierraasteve: You're welcome.
17:28astevehas http://richhickey.github.io/clojure-contrib/generic.math-functions-api.html been replaced by something in 1.5.1?
17:29stuartsierraasteve: That's an out-of-date URL.
17:29stuartsierraclojure.github.io has latest API docs
17:30callentechnomancy: why not cheshire?
17:30astevehmm, where has log gone?
17:31lyn_pbostrom ah, cool technique then!
17:31technomancycallen: too mainstream
17:31stuartsierraha
17:32schmirhmmm. I'm using a wrapper around tika and it's working fine when used via lein repl/lein run. but if I build an uberjar, I cannot extract text anymore. that is the extracted text is always the empty string. what could be the cause for that behaviour?
17:32technomancyhttp://wondermark.com/262/
17:32pbostromlyn_: admittedly, it looks odd to me too, just confirming this is considered a best practice for this kinda thing
17:32lyn_pbostrom are you sure none of the side effects will be retried?
17:36stuartsierraasteve: You may also want to refer to http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
17:36astevestuartsierra: I'm currently upgrading from 1.2 to 1.5.1, that is very useful thanks
17:37pbostromlyn_: I've read that in various Clojure books I believe, but it doesn't appear to be in the docstrings for agent, send, or dosync
17:38brehauttechnomancy: that wondermark is amazing
17:38technomancybrehaut: some of the early ones are hit-or-miss, but that one is solid
17:38callentechnomancy: anybody that was an Aerosmith fan back in the day knows that pain.
17:40brehauttechnomancy: this early hit-or-miss nature may be why i didnt think i enjoyed wondermark
17:41callenstuartsierra: I like how we're still suffering from clojure.contrib
17:41technomancywe are?
17:42callentechnomancy: or at least the slow-pokes are :)
17:42stuartsierracallen: You like it because you didn't have to manage Maven+Hudson.
17:43callenhttp://i.imgflip.com/38uac.jpg
17:43Bronsalol
17:43stuartsierraWe need one of those FAQ bots like they have in #bash.
17:44callenwe kinda have that.
17:44callenyou can teach the bots things.
17:44callenjust teach it what contrib is.
17:44stuartsierraclojurebot: contrib
17:44clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:45callenskip the teaching part. it already knows.
17:45stuartsierraFine, but link is now http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
17:45stuartsierra(There's a link at the old location)
17:45callenI forgot the syntax for teaching the bot :)
17:45hyPiRionclojurebot: forget contrib
17:45stuartsierrame too
17:45clojurebotIt's greek to me.
17:45hyPiRionhrm
17:45callenclojurebot: contrib
17:45clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:45callenhyPiRion: gg
17:46hyPiRioncallen: yeah, I know. I forgot the syntax for making the bot forget
17:46brehautonly hiredman remembers
17:46bruceadamsclojurebot: help
17:46clojurebotNobody can help with "X doesn't work". Please provide context: what you did, what you hoped would happen, and what happened instead. A stack trace is especially helpful, if applicable.
17:46stuartsierrahah
17:46hyPiRionclojurebot: how do I make you forget stuff?
17:46clojurebotGabh mo leithscéal?
17:46brehautbruceadams: the only documentation for clojurebot's syntax is the fn-parse rules
17:47stuartsierraIt's more fun to just shout at the bot.
17:48pjstadigclojurebot: forget contrib |is|<reply>Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:48clojurebotI forgot that contrib is <reply>Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:48pjstadig~contrib
17:48clojurebotPardon?
17:48brehaut(inc pjstadig)
17:48lazybot⇒ 5
17:48pjstadigclojurebot: contrib is <reply>Monolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
17:48clojurebotRoger.
17:48pjstadig~contrib
17:48clojurebotMonolithic clojure.contrib has been split up in favor of smaller, actually-maintained libs. Transition notes here: http://dev.clojure.org/display/community/Where+Did+Clojure.Contrib+Go
17:49callenpjstadig: thank you...
17:49pjstadignp
17:49callenpjstadig: how do you take advantage of the reply markup to aim it at somebody?
17:49callen~contrib pjstadig
17:49clojurebotTitim gan éirí ort.
17:49pjstadigoh i don't know if that's possible
17:49pjstadighiredman would have to answer that one
17:50callenballs. Aiming is nice for getting somebody's attention sometimes.
17:50callenpjstadig: thanks for helping out :)
17:50pjstadigi think you can use <name> or something but i don't know if the factoids can take parameters
17:50pjstadigi think <name> might be the person addressing clojurebot
17:51brehautpjstadig: isnt it the thing that suppresses 'X is' at the start ?
17:51brehautoh wait ignore me
17:51pjstadigbrehaut: yeah that's what <reply> does
17:51hiredman#who
17:51hiredmanclojurebot: whoami is <reply>#who
17:51clojurebotYou don't have to tell me twice.
17:51hiredman~whoami
17:51clojurebothiredman
17:51dnolenseangrov`: have you verified that the keyword optimization doesn't mess w/ incremental compilation?
17:52futileWhat's the best way to execute a shell task in Clojure?
17:52ozzloyhttp://hl7api.sourceforge.net/v24/apidocs/index.html shows the class ADT_A01, but i get a class not found exception with this code: https://www.refheap.com/18081 am i doing imports wrong?
17:53rasmustofutile: http://clojuredocs.org/clojure_core/clojure.java.shell/sh
17:53futilerasmusto: Is it safe to execute that in a background thread (maybe multiple in parallel)?
17:54ozzloyalso, where does lein put the downloaded jar? i want to try to compile the java version of this: http://hl7api.sourceforge.net/xref/ca/uhn/hl7v2/examples/CreateAMessage.html
17:54callentechnomancy: well grenchman is installed but I'm only on 2.3.2 and haven't installed from git master in ages.
17:54rasmustofutile: I use it with pmap, so probably :)
17:54callenback to looking at the code.
17:54futilerasmusto: yay :)
17:54technomancycallen: yeah, found a really stupid lein bug like two days after 2.3.2 came out
17:58hyPiRioncallen: `git clone leiningen; cd leiningen/leiningen-core; lein bootstrap; cd ..; ln -s $PWD/bin/lein ~/bin/lein-master`
17:59technomancyhub clone technomancy/leiningen
18:00callenhub is so nice *_*
18:00squidzwhen using clojure i am getting a lot of results like '([1 2]) when I actually want [1 2]. I suppose it may have something to do with laziness? I can use first to get the result inside the list, but this seems like a hack. is there a better way to do it?
18:00callenhyPiRion: thanks :)
18:01technomancysquidz: you can destructure it out
18:01rasmustosquidz: it could be how you're generating the result, do you have an example?
18:02justin_smithsounds like you are using sequence operations on individual elements
18:02squidz am getting the results from a reduce
18:02aaelonysimple question here… what's the best way to convert a date string like "2013-08-01" to milliseconds from epoch? I'm looking at clj-time.coerce/from-string but the docs are unclear
18:02aaelonyhttp://clj-time.github.io/clj-time/doc/clj-time.coerce.html#var-from-string
18:02callentechnomancy: welp. that's faster.
18:02justin_smithsquidz: the function called inside reduce has full control of the output of reduce
18:03technomancycallen: tried :eval-in :nrepl?
18:03callentechnomancy: about to
18:03callenaaelony: first, are you using 0.6.0?
18:03technomancyyou will squee with joy
18:03aaelonyi think so
18:03squidzthe result of reduce is a map which i want to combine with another map. So I am using (vector m1 m2) is then returning ([m1 m2])
18:03callenaaelony: well double check your project.clj, because the advice I'm about to give you is based on the new clj-time API
18:04callenaaelony: when you say epoch, did it come from an interval or a bare date?
18:04aaelonysorry, it's [clj-time "0.5.1"]
18:04aaelonybut I can change that
18:04justin_smithsquidz: why the hell is vector returning a vector inside a list? that makes zero sense
18:04callenaaelony: you probably want to upgrade and fix any deprecated code.
18:05aaelonycallen: I just want something that incanter knows how to use as a time series
18:05squidzjustin_smith: yeah then I console.log that vector out together with prn-str
18:05aaelonycallen: that's fine, but I need a simple example
18:05callenaaelony: interval or bare date?
18:05justin_smithsquidz: if you want a map out of reduce, use (into {} (reduce ...))
18:05callenaaelony: interval is (in-millis ...)
18:06justin_smithsquidz: it could be you are making a map with only one entry
18:06aaelonycallen: Input is a string like so: "2013-08-01" and output would be the value in milliseconds from epoch
18:06aaelonycallen: no interval
18:06callenokay. pretty sure that exists, uno momento.
18:06callenaaelony: my brains are a little scrambled because I refactored the API and epoch/unix millis was some of the stuff I changed.
18:06callenaaelony: but that's also why using the latest version is relevant.
18:07callenbecause some of the epoch stuff didn't exist before my PR
18:07aaelonycallen: cool… i see.
18:07justin_smithsquidz: err... wait, you can make a reduce return a map, if for some reason a seq of entries is more convenient, then use the into trick above instead
18:07aaelonycallen: basically something that would do this (http://jakemccrary.com/blog/2010/02/21/plotting-time-series-data-with-incanter/) in a currently appropriate way
18:07squidzjustin_smith: here is my code https://www.refheap.com/18083
18:08aaelonycallen: is there still a to-ms function
18:08squidzthe bottom of that function is what is supposed to return the vector
18:08justin_smithsquidz: ,(reduce (fn [m [k v]] (assoc m k v)) {} (partition 2 (range 8)))
18:08callenaaelony: you probably want to-long, it converts the object to the number of milliseconds since unix epoch from the date object provided.
18:08justin_smith,(reduce (fn [m [k v]] (assoc m k v)) {} (partition 2 (range 8)))
18:08clojurebot{6 7, 4 5, 2 3, 0 1}
18:09jzelinskiethat's a nice bot
18:09callenaaelony: user=> (coerce/to-long (time/now))
18:09callen1377639995556
18:10aaelonycallen: perfect! thanks :)
18:10aaelonycallen: (timec/to-long "2013-08-01") ==> 1375315200000
18:11justin_smith,(.getTime (java.util.Date.))
18:11clojurebot1377640105272
18:11callenaaelony: excellent. cheers :)
18:11justin_smithless libs
18:11callenjustin_smith: the reason for clj-time is the protocols handle auto-projecting across type relationships for various possible inputs.
18:12aaelonyjustin_smith: that doesn't work with a date string though
18:12callenjustin_smith: that's the automagic that turns his string into what he needs.
18:12aaelonyjustin_smith: e.g. (.getTime "2013-08-01") fails
18:12callenjustin_smith: normally I'd agree with you, but look more carefully at the example. :)
18:12aaelonycallen, justin_smith: big thanks nevertheless. What's a good way to provide these examples to the API docs?
18:13callenaaelony: sorry, provide these examples?
18:13aaelony(I know I'll forget and need to look it up in the future)
18:13callenaaelony: do you want to contribute to clj-time's documentation or do you mean something else?
18:13aaelonycallen: (timec/to-long "2013-08-01") ==> 1375315200000
18:13callenaaelony: right, but I'm asking you where you want it to live.
18:13callenI can find a home for it if you want.
18:14aaelonycallen: ah, well google founjd me this… http://clj-time.github.io/clj-time/doc/clj-time.coerce.html#var-from-string so maybe there?
18:14callenaaelony: nuh uh, that's auto generated. I'll put it in the readme, I know where it should go.
18:14aaelonycallen: sweet
18:14aaelonycallen: thanks again
18:16justin_smithsquidz: double check that you are actually binding super to a hashmap and not a vector?
18:17justin_smithsquidz: style wise, I suggest more functions, that are small, and simple, and easy to verify as being correct in a repl or unit test
18:17squidzyeah i thought the same about more smaller functions, thanks for the tips
18:17callentechnomancy: keeps closing the socket and dying on me :(
18:21technomancycallen: which socket?
18:22technomancygrench->lein or lein->project?
18:30dobry-denSo Github recognizes CoffeeScript but considers ClojureScript to be JavaScript. :(
18:31dobry-denCruel world
18:32futileaww
18:32dnolendobry-den: hmm really?
18:32futiledobry-den: to be fair, its actually just javascript files and clojure files
18:32futile:)
18:33dnolendobry-den: in what context are you talking about? GitHub has identified .cljs for a while now. Though I think they just lump with Clojure. ClojureScript repo says 97% Clojure.
18:38cgagif you check in your compiled javascript it's probably giving your project credit for 20k lines of javascript
18:40futileIf I spin up an external process via clojure.java.shell/sh, write to it, read to it, and shut it down, about a dozen times per second, is that going to be slow? Would it be significantly slower than opening up a unix socket and sending/receiving the same amount of messages on the same socket in the same time frame?
18:43ucbwhat sql library do you recommend? I've only looked at clojureql so far
18:43justin_smithin swank repl buffers in emacs, hitting tab inside a string would path-complete filenames - how hard would it be to make nrepl do this? is it just an option I need to turn on?
18:43TakeVOne has to define a protocol in order to give a deftype functions, right? You can't just define functions that aren't in a protocol you specify?
18:45callenI need an alfred plugin that lets me quickly bring up github repos.
18:46callenaaelony: https://github.com/clj-time/clj-time#clj-timecoerce
18:48callenfeck it, alias.
18:48callener, function.
18:57dobry-dendnolen: you're right. interestingly despite removing my .js build file, it still reported Javascript 99.6% for days until just now when I made an 'update README' commit
18:57dobry-dennow it reflects Clojure 99.6%
18:58`cbpmmm why does (round (/ 5 3)) return a BigInt in clojure.numeric-tower
18:59dobry-dendnolen: man, i ended up getting my app to a working state using your core.async snippet as inspiration (the start/stop/scrub app). this is great
19:00`cbpdoes anyone have non-nuts round lying around? =P
19:03`cbpoh ##(type (.numerator (/ 5 3)))
19:03lazybot⇒ java.math.BigInteger
19:03`cbpwell..
19:03hyPiRionthat's not what round does though
19:04`cbphyPiRion: round does (quote (.numerator..) (.denominator..))
19:04hyPiRionquot, yeah.
19:04`cbphyPiRion: I mean thats what floor and round uses floor
19:04`cbpyeah quot =P
19:05hyPiRionah, right
19:05`cbpthat's what floor does*
19:07callentechnomancy: Exception in thread "nREPL-worker-0" java.net.SocketException: Socket closed
19:07callenoh you know what, it was closing after that exception before, but it seems to be okay now.
19:07callenweird.
19:11hyPiRioncallen: That's probably technomancy/leiningen#1288. I suspect it is because REPLy/Leiningen thinks the connection is still open.
19:11lazybotlein repl crashes whenever shut down -- https://github.com/technomancy/leiningen/issues/1288 is open
19:13ozzloyin case anyone was wondering, hapi is broken into several libs and i didn't include all the ones necessary for the thing i tried earlier
19:13ozzloyoh woops, i'm in scroll back
19:17technomancycallen: there are still several nasty edge cases and ways to get it wedged
19:18technomancybut it sounds like restarting fixed it?
19:18callentechnomancy: aye, it did.
19:18technomancycools
19:18callentechnomancy: I'm working on something that does involve doing `lein run` over and over, so this came at a good time.
19:19callensomething even faster would be cooler still, but that's my fault for relying on :main to test this library.
19:19technomancycallen: cool; so you won't be bitten by the stdin issues
19:19callenI should just move to tests so it's instantaneous.
19:19callentechnomancy: nah this is just my SQL logging library.
19:19callenI just run queries and see colored output, that's all.
19:19technomancycallen: re: "something faster" is that orthogonal to Leiningen/Grenchman?
19:20callenaye, it'd mean moving from :main to writing tests and using (refresh) and (run-tests) in a REPL.
19:20technomancyI mean, with :eval-in :nrepl, does the tooling introduce any overhead still?
19:21callenI see - grench eval '(:status (my.web/app {:uri "/"}))' - what do you mean by :eval-in :nrepl?
19:21hyPiRioncallen: that's :eval-in :nrepl.
19:22technomancycallen: by default `grench eval ...` will skip starting a new lein jvm, but it will start a project JVM
19:22technomancyyou can set :eval-in :nrepl to jump straight from lein's resident JVM to a running project JVM
19:22callensadly I have to go to a meeting, I'll tinker with it after I get settled in my airbnb room tonight.
19:23technomancyk
19:33aaelonycallen: that's awesome, thanks :)
19:44mihneadbhi, I'm having trouble with some big collections, out of heap. I'm not handling them correctly
19:45mihneadbhttps://www.refheap.com/18087
19:45mihneadb(basically I want to walk a directory structure and download some many files)
19:45mihneadbcould someone please help me with the looping part?
19:45amalloymihneadb: don't def a top-level var to hold a lazy sequence. keep it locally-bound only
19:46mihneadbamalloy: could you also tell me why, please?
19:46amalloybecause it can't get GCed ever, if you hold a pointer to the start of it: you threaten to reuse the sequence
19:47mihneadbaha
19:47mihneadbbut in my case that is not the problem, right?
19:47amalloynow here, it doesn't look like inbound-dirs is very large, so that's probably not a problem
19:47amalloyit's just the only thing that leapt out at me as a memory issue
19:47mihneadbah, ok
19:47mihneadbamalloy: problem is the space is pretty big
19:47mihneadbI mean.. the search space
19:48mihneadbbut doseq does not retain the head of the seq, so I'm confused
19:48mihneadbany ideas?
19:49amalloyyou're holding a single file all in memory at once; if any one file is very large that would be a problem
19:49mihneadbamalloy: you mean when I'm saving it to disk?
19:49amalloyyes
19:49amalloyotherwise, nothing jumps out at me and i'm afraid i don't have time to look harder
19:49konr`How can I catch assertions that fail?
19:50mihneadbamalloy: ok, thanks. it downloads a few files just fine it seems
19:50mihneadbso it shouldn't be that
19:50mihneadbamalloy: fwiw it seems to have crashed at the 2nd step of the inner doseq
19:51konr`... (catch Throwable e ...
19:52brehautmihneadb: minor style thing, and maybe i am mistaken, but i think your two doseq's can be flattened into one. more minor style thing: aliasing str to join is a bit gross. a typical 'join (such as the one in clojure.string) function has different semantics to str
19:53mihneadbbrehaut: thanks, I had no idea
19:53mihneadbbrehaut: how could I do the two doseqs in just one?
19:53brehaut(doseq [as foos b as] (do-whatever b))
19:53seangrov`dnolen: No, I'm pretty unclear on how incremental compilation works (I've never had it work for me in a year of using cljs fulltime), but from my understanding it should work
19:53mihneadbbrehaut: thanks!
19:54mihneadbthis kind of is my first real clojure program.. so any hint helps
19:54brehaut,(for [a [[1 2 3] [4 5 6]] b a] (inc b))
19:54clojurebot(2 3 4 5 6 ...)
19:54seangrov`We write out a contants_table.js to a file (in the specified :outputdir), and that file will only change if there's a new constant added to the table, which should only be for new keywords if the incremental compilation is run in the same continual process
19:55mihneadbbrehaut: but in my case I have to call a function
19:55brehaut,(for [a (range 3) b (range a)] b)
19:55clojurebot(0 0 1)
19:55brehautha
19:56mihneadbnice
19:56mihneadbthanks
19:56mihneadbbrehaut: any idea what's causing my memory problem?
19:56brehauti think amalloy's guess is the most likely
19:57mihneadbbrehaut: size of the file?
19:57brehautsucking everything into a byte-array and then spitting that out is not really the best way to go about it
19:57mihneadbbrehaut: it downloads the stuff in the first encountered folder fine, it crashes when it reaches the 2nd. if I only have one file in memory at a time, this doesn't seem to be the problem
19:57mihneadbnevertheless, how should I go about that download?
19:58brehautwell, its the middle of my work day, so i dont really have time to go and spelunke your program
19:59srrubyI'm using gvim. I like to often re-indent the file using gg=G However it is very slow. Any ideas how to speed it up?
19:59mihneadbbrehaut: ok, thanks for the doseq tips
20:02dnolenseangrov`: basically the constant table should always be emitted, I'll verify
20:03seangrov`That may be the problem I was getting, it was complaining that there was no .repl/constants_table.js every now and then (though working most of the time)
20:06coventryCould someone please tell me the right way to say "(seq dm)" in this macro? <https://www.refheap.com/18088&gt; I'm not sure I understand the error message, either. What's with the map wrapping 'dispatch' in '{:instance dispatch}'?
20:08amalloycoventry: you can't write this macro this way. it's depending on the "runtime" value of dispatch, but generating code at compile time
20:08amalloyie, defdispatch only sees the symbol 'dispatch, not a map with the keys 1 and 2
20:09amalloy(defdispatch foo {1 :foo 2 :bar}) would work fine
20:10coventryOh, I need the dreaded double backtick?
20:11coventryThank you.
20:11amalloywhat. on
20:11amalloyno
20:11seangrov`hah
20:11amalloyyou simply cannot write a macro that takes your input and produces your desired output
20:12amalloy(modulo the use of eval, which is evil and not a good solution)
20:13mihneadbamalloy: I set -Xmx1g and it 'works', but it's definitely hogging memory, its memory usage is just increasing. one file won't be larger than ~1 MB, and it is my impression that I'm holding only one in memory at a time
20:13coventryThanks, I will think about it some more.
20:15seangrov`coventry: If the dispatch won't change at runtime, you can just pass it directly to your macro
20:15seangrov`e.g. (defdispatch foo {1 :foo 2 :bar})
20:16amalloyseangrov`: sure, but that's not really much better than just writing (defn foo [x] (case 1 :foo 2 :bar nil))
20:16amalloyi'd prefer the latter, personally
20:17seangrov`amalloy: Never miss a chance to use macros
20:18callenAxis of Eval
20:18callenOver-reliance on eval is the sign of a weak mind.
20:18ddellacostaI want to set the log level for a 3rd party Java lib (which uses log4j/slf4j), on the level of granularity of "just my tests," and not sure how to go about it--is there a simple programmatic way to do this? </java moron>
20:19ddellacostawould rather avoid properties files, but if that is best practice even for Clojure will do it.
20:21ddellacostawow, I just killed the conversation on #clojure with that one.
20:22Raynesddellacosta: Just give up and use properties files.
20:22callenddellacosta: hrm. good question. Most Clojure libraries/apps I've seen use properties files in their resources to add a filter for any logline not coming from your tests
20:23callenddellacosta: and then the log handler in the tests has a special prefix or something.
20:23RaynesIf you try to make Java logging libraries do what you want, you're going to end up bloody and naked in the fetal position in the corner of a dark room.
20:23callenddellacosta: that's more speaking to a pattern than defining what I think is truly an optimal solution though. If you find something better, speak up.
20:23callenalso, Raynes is right.
20:23ddellacostaRaynes, callen: yah, I may be resigned to that. Honestly not sure the best way to handle it. Any experiences with clj-logging-config?
20:23ddellacostaRaynes: heh
20:24callenhaven't used that lib, let me know how it goes >:)
20:24ddellacostaalrighty then, there but for the grace of god go I
20:33coventryamalloy, seangrov`: Are compile-time evals a bad choice for this kind of thing, too?
20:35ddellacostathat's hilarious--I added the clj-logging-config lib, ran set-logger! in my test setup, and now it's added logging messages telling me it is setting the log level, but doesn't seem to be making anything else quieter. *sigh*
20:40callenddellacosta: if you look at the code for clj-logging-config, you might at least get an idea of the intent behind how it *should* work and how you might be able to reproduce what you want manually.
20:41ddellacostacallen: yes, you're absolutely right, I'm being lazy because this is not what I should be spending time on. I have to make the choice as to whether to really dig into it and learn how it works, or skip this for now and suffer through the noise. Choices, choices
20:42callenddellacosta: I understand the desire to skip past the bits that don't directly contribute to the actual goal, but sometimes wiping the slate clean and reapproaching with an open zen mind and a desire to learn takes less time than thrashing.
20:42callenmodulo yak shaving :)
20:43ddellacostacallen: haha. Yep, all true and good points.
20:43callenddellacosta: and I meant it when I said I wanted to hear how it went, because this is something I've bumped into but side-stepped before. There may come a day when I cannot judo my way past the problem and anything you learn could be valuable.
20:43callenI'm working a logging library right now, although it doesn't currently touch any Java infrastructure.
20:44ddellacostacallen: alright, now you're giving me work to do! ;-)
20:44callenI just want to know how your problem resolves in the end, that's all.
20:44ddellacostacallen: seriously though, I've been putting this off for a while, so point taken and I think I'll dig into it. Here we go, will report back!
20:52mihneadbwhat's the 'idiomatic' way to download a file via http?
20:52mihneadbI found multiple ways on SO :s
20:57technomancymihneadb: if you can, use slurp
20:58technomancyotherwise maybe a line-seq on clojure.java.io/reader
20:58technomancyotherwise clj-http
20:58mihneadbtechnomancy: would slurp work ok with binary files too?
20:58technomancyoh, no.
20:58mihneadbtechnomancy: I'm trying to write a scraper that downloads some logs that are gzipped text files
20:59mihneadbI'm having memory trouble
20:59mihneadb(tried with clj-http)
20:59technomancyclojure.io.java/input-stream might work though
20:59mihneadbtechnomancy: I don't find how to use it in the docs
20:59technomancyif it's memory trouble then you need to just stream it lazily
21:00mihneadbtechnomancy: so the files themselves are no bigger than 1MB from what I've seen, but I think my program is 'leaking'
21:00mihneadbtechnomancy: https://www.refheap.com/18089
21:01callenpeople in here that make private vars, please raise your hands.
21:01callenin libraries.
21:01technomancycallen: obvs?
21:02callentechnomancy: I want them to raise their hands so I can cut them off.
21:02callenkeep 'em high people.
21:02callenI'm side-stepping it in the usual way, but I'm still mad.
21:02technomancyyeah, being able to change implementation details without breaking all your downstream consumers is such a waste of time
21:03technomancypeople should just get used to the fact that software changes, you know?
21:03coventrycallen: How do you sidestep it? I am running into that problem.
21:03callentechnomancy: fair point, but I'm already deep in alter-var-root land.
21:03callenimplementation details are sort of the point in my case :)
21:03technomancywell, at least you won't be surprised when a new version breaks your code then
21:04callentechnomancy: again, sorta expected.
21:04callentechnomancy: it's a SQL logging library, nothing I can do about it. tracking c.j.j is the point.
21:04callenI'll have version lists with their corresponding c.j.j/korma versions in the README
21:07muhooi generally run away screaming from things that are opinionatedly stateful.
21:07mihneadbtechnomancy: can I open the URL as inputstream and then use io/copy to download it to a local file?
21:07technomancymihneadb: yeah, that should work
21:07technomancyshould be buffered
21:07technomancyjust be sure to use with-open
21:08callenmuhoo: it's not about state, it's just that there's no way to write a SQL logging library without deeply integrating it into the library you're logging.
21:08mihneadbtechnomancy: with-open just for the input stream, for the output I can pass in (io/file my-path) to copy, right?
21:08callenmuhoo: and it's not "stateful", the alter-var-root is for run-once decoration of behavior AOP style, not for ongoing stateful mutation.
21:09callenit's not my fault Clojure hasn't figured out how to do metaobject protocol stuff yet.
21:09callenthere were established patterns for this in Common Lisp, here in the land of clj, I have to hack it up with alter-var-root.
21:09callenwhen somebody has an alternative, I'd love to hear it.
21:10mihneadbtechnomancy: like https://www.refheap.com/18090
21:10mihneadb?
21:14swarthyIs it possible to set 'let' bindings around multiple arity function definitions?
21:14hyPiRionswarthy: sure thing
21:14hyPiRionnot different arities though, but the function itself
21:14swarthyI see, I have a var that I would like in all the arities within the function. I must be trying to do something wrong, I'll try something else.
21:16hyPiRionwell, (let [val :the-val] (defn foo [a b] (str val a b))) should work fine
21:16swarthyIs that considered in bad taste? I'm fairly new to clojure.
21:18`cbpclosures are never bad taste
21:22hyPiRionrelatively. One can do (def ^:private val :the-val) before the defn instead to achieve the same result (except it'll be visible for all other functions in the namespace too)
21:22swarthyI see, thanks for you input hyPiRion.
21:22swarthyyour*
21:22hyPiRionnp
21:22justin_smithat least in cl, function definitions inside let are the normal way to make private data, especially if multiple definitions need that same binding but others should not see it
21:22justin_smithbut I tend to see suspicion about def / defn that is not at the top level in clojure (maybe just because it is so often misused by people just starting)
21:22swarthyjustin_smith: could you elaborate on that last point?
21:22`cbp`you could do (def f (let '
21:22`cbp`oops
21:22justin_smithswarthy: people use def inside a function because they don't know how to use let for example
21:22`cbp`(def f (let [..] (fn ..)))
21:23justin_smithbut defining something inside a let is pretty much the oposite
21:23callen`cbp`: well, "never". Don't say that. I'll take it as a challenge to be an asshole and do something monstrous.
21:23callenBut closures are often in good taste :)
21:23swarthyjustin_smith: excellent thank you.
21:23justin_smithone issue is that if the let has side effects, you then have side effects at load time
21:23justin_smithso really you need something like (defn init [] (let [] ... (defn ...))) or else loading the file is not idempotent
21:24justin_smithunless you are certain nothing inside the let has side effects
21:24justin_smiththat case of course calls for calling (init) before using the namespace
21:24justin_smithnon-idempotent namespace load is evil
21:25futilethe jvm doesn't fit into the unix philosophy of things that play well-ish together
21:25justin_smithunix is just designed with everything implementing the same protocol
21:25swarthyjustin_smith: you have kind of lost me lol.
21:25swarthyjustin_smith: on that last part
21:25callenjustin_smith: don't...don't use the words unix and design in the same sentence.
21:25justin_smithhah
21:25callenjustin_smith: it's misleading and sets people up for disappointment.
21:26callenit grew like a tumor.
21:26callenI say that despite rather liking unix, but lets be honest.
21:26justin_smithswarthy: regarding why non-idempotent namespace load is evil?
21:26swarthyyeah, or rather how to avoid it.
21:27justin_smithwhen loading a namespace has side effects, you get weird bugs, it is almost guaranteed
21:27swarthywhat kind of side effect would be common
21:27swarthyagain, I'm very new to clj and java
21:27justin_smithany code that is affected by the order it is evaluated and not just the content of its arguments should be explicitly called in an init function of some sort
21:27justin_smithso if you are setting the contents of an atom
21:28justin_smithor updating it
21:28justin_smithor creating a file
21:28justin_smithor reading it
21:28justin_smithetc.
21:28swarthyOkay, what about the case where the ns has a 'top level' function that reads a file but only after being called and with some args, not bound with a def, etc?
21:28justin_smithdefonce helps with that as well
21:28swarthyis that still a smell
21:29justin_smithswarthy: that is fine, you just don't want code outside a function that has side effects that happen at load time
21:30justin_smithbut someone who has been burnt by those bugs before will slow down and look twice at top level forms that are not definitions
21:30swarthyI see thank you, very educational.
21:30justin_smithso that can affect readability
21:32justin_smithnp, I'm just someone who made mistakes so knows what not to do now
21:32justin_smith(and dealt with others' mistakes, etc.)
21:34mihneadbwhat's the best way to parallelize a doseq expression?
21:34callenswarthy: maintaining idempotent namespace loading is advisable in Python too.
21:35callenswarthy: this isn't just specific to Clojure.
21:35coventryHmm, the twelth google result for "point lein to source-code for a library" was "Let me google that for you".
21:35callencoventry: ouch.
21:35swarthyI see thank you callen.
21:36coventrycallen: I'm not hurt, personally. :-)
21:38TimMcmihneadb: So this would be a case where the bulk of the work is in the body of the doseq, not in the sequence generation itself? (Otherwise it definitely can't be parallelized in the general case.)
21:38mihneadbTimMc: yes, I want to run the body in parallel
21:38mihneadbI'm thinking of switching to pmap
21:38mihneadb+ dorun
21:38mihneadbTimMc: would something else be better?
21:38TimMcpmap is apparently trouble
21:39mihneadb:) why?
21:39TimMcI'm not sure, it's just the common wisdom of the channel.
21:39TimMcI don't do much with performance-sensitive concurrency, so I haven't listened too closely.
21:40cgagpmap's worked ok for me in the past
21:40mihneadbI see
21:40mihneadbI'm basically trying to donwload a bunch of logs and I figure I can download independent folders in parallel
21:41cgagmaybe this is a use case for core.async?
21:41mihneadbcgag: does core.async spin off different threads?
21:41cgagcreate a bunch of go-blocks putting results in a channel?
21:42mihneadbI'll have to read about it
21:42mihneadbthanks!
21:42mihneadb(for the record pmap seems to work)
21:42TimMcI haven't seen anything useful in a quick search of http://clojure-log.n01se.net/, let's try the bot:
21:42TimMc~pmap
21:42clojurebotpmap is not what you want
21:42cgagyeah the go blocks are basically realy light weight threads as i understand it, multiplexed onto a smaller thread pool
21:43mihneadbcgag: nice, thanks
21:43TimMcI don't know why I thought that would be useful. :-P
21:43mihneadbI'll definitely check it out
21:43mihneadbclojurebot: ++
21:43clojurebotExcuse me?
21:44cgagmihneadb: i'm just throwing this out there, i don't really know for sure
21:44mihneadbright
21:45mihneadbthanks anyway :) might be what I need
21:45TimMcFrom 3 years ago: "amalloy: rplevy: the main issue is that pmap needs to be given a smallish number of large tasks in order to be useful, because it spawns a thread for each task"
21:45TimMcThat may no longer be true, though. Perhaps it uses threadpools.
21:46cgagi was pretty confident it does use a thread pool
21:46cgagof #cores + 2
21:46futileAnyone wanna help me come up with a really simple-to-use-from-the-client-side IPC technique?
21:47TimMcfutile: Well, first you generate a WSDL, and then...
21:47futileahhhh!!!
21:47futileruunnnn!!!!
21:47futileoh sorry
21:47TimMcOh, wrong channel. I thought I was in #lovecraftian-horrors-for-programmers
21:47futile:D
21:48eggheadfutile: you could use the zeromq async thingy for ~inter process communication~
21:49eggheadhttps://github.com/lynaghk/zmq-async if all you really need is for two processes to pass messages between one another that looks like a fun way to do it
21:49eggheads/two//
21:50TimMcmihneadb: So yeah, it looks like pmap is reasonable if each task is relatively heavyweight.
21:50mihneadbTimMc: I see
21:50mihneadbthanks
21:50mihneadbI read that it used thread pools as well
21:51cgagwould it be a terrible idea to just create a ton of futures?
21:51mihneadbI don't know
21:52davertronI'm running into an issue with :advanced compilation with clojurescript: I'm using google maps, so I pass a function as a callback to its event handling. The event object that gets passed to the function has a LatLng property with lat() and lng() method calls, but these method calls get munged by the advanced compilation. How do I tell the closure compiler not to munge these?
21:53TimMccgag: Then you'd have to do all the coordination yourself. :-P
21:53TimMcmihneadb: The source agrees.
21:53mihneadb:)
21:55TimMcWait... it *does* call future.
21:55cgagwhat coordination? just spawn them all and map deref over them
21:55dobry-dendavertron: i can't answer your question but i'd look here: http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html and https://github.com/emezeske/lein-cljsbuild/blob/master/sample.project.clj
21:55TimMccgag: I don't think that gets you parallelization.
21:56callenSQL query logging library. Do I print arguments as well as the queries, or just the queries?
21:57cgagit would, i'm just not sure if it would create an absurd number of threads
21:58cgagcreating a bunch of go-blocks feels right, but i'm not sure how you wait on them all to finish though
21:58cgagalso i guess it wouldn't work if you need to get the results in a specific order
21:58callencgag: by waiting on them to finish sending things through channels and then close the channels?
21:59davertrondobry-den: Thanks, I've read that first link and i'm using an extern, but unfortunately this is a callback that receives an object with specific methods on it, so there's no way to declare that object in the extern (that I know of). The sample.project.clj doesn't really provide anything beyond what I'm currently doing
21:59callencgag: I'm pretty sure coordinating things with core.async centers around channels.
21:59TimMccgag: Ah, so you're thinking (map deref (doall (map spawn-future xs))) ?
22:00cgagi imagined having one channel that each block would push its result into
22:00cgagTimMc: yeah
22:00cgagTimMc: it feels like a bad idea but i'm not sure why or if it actually is
22:01TimMcIt would suck for a large (count xs).
22:01cgagdoesn't it use a thread pool though?
22:01TimMcI thought that future used a thread pool, but the doc doesn't mention that...
22:02mihneadbTimMc: I'll bother you with one more question
22:02mihneadbI'm having trouble with lein uberjar
22:02mihneadbas in.. I get java.lang.NoClassDefFoundError when I try to run the jar
22:02TimMcYou need some AOT up in there.
22:02mihneadbI did add (:gen-class :main true) to the core ns
22:02mihneadbTimMc: ahead of time? what?
22:03TimMcJust a (:gen-class) is fine, but yeah, you need to tell lein to compile that ns Ahead Of Time as well.
22:03eggheadare you guys implementing pmap
22:03mihneadbTimMc: how do I do that/
22:03TimMcSo that's :aot [my.core.ns] in your project map.
22:03mihneadboh
22:03mihneadbok
22:03mihneadbty
22:04TimMcThat will AOT all your namespaces transitively, so I wrote lein-otf if you want to restrict it to a little stub loader class.
22:04mihneadbTimMc: thanks. seems to have worked
22:04mihneadbit's enough for my current knowledge/reqs
22:04TimMc(Useful if you need to avoid AOT for some reason.)
22:07mihneadbTimMc: ok, all works. Would you mind taking a look and offering some style suggestions maybe?
22:08`cbp`i use (->> coll (map #(future..)) (doall) (map deref) (doall)) so much i feel there should be a macro for it or something :P
22:08TimMcI can't tonight, but someone else may be able to if you put it up on a pastebin (refheap or gist are preferred.)
22:10`cbpfutures use the same threadpool as agents
22:11mihneadbTimMc: ok, thanks
22:11mihneadbstyle advice welcome - https://www.refheap.com/18091
22:21TimMcdevn: ITYM "JAJJ".
22:21devncompass is so nice for writing cross-browser CSS
22:21devnreally wish the ruby dep wasn't necessary
22:27dnolenseangrov`: tweaking your patch, there's a lot of related stuff that needs fixing, and the changes are bad for the REPL, needs be addressed. Still thanks for laying down the ground work this is the easy stuff.
22:31callen`cbp: write the macro, then submit a PR to flatland/useful.
22:40seangrov`Uhg, the dreaded Caused by: java.lang.RuntimeException: Unmatched delimiter: )
22:40seangrov`But in which file...
22:41amalloyseangrov`: look higher in the stacktrace
22:41amalloythe exception message includes the file/line it was reading, think
22:42seangrov`Ah, yes, the file, but not the line
22:42seangrov`But that's enough for now, I suppose
22:42seangrov`I feel like it should be somewhat possible for the cljs compiler to give a hint about the location
22:42amalloyoh, the cljs compiler
22:43amalloyperhaps that's why you don't get a line number; i'm reasonably sure the clj-jvm compiler includes it for mismatched delimiers
22:44`cbpI wonder which branch should i use, theres no readme or contribute :P
22:45`cbpdevelop i guess
22:45dnolenseangrov`: we can fix this now - tools.reader can do this
22:45dnolenseangrov`: if tools.reader tells us where reading failed we should print it
22:45seangrov`dnolen: That's what I was thinking
22:46seangrov`I can look into doing that, should be a few lines or less of change, right?
22:48amalloy`cbp: i don't want that macro anyway; useful already has too many bad functions for walking through collections on multiple threads
22:49`cbpaw =P
22:49`cbptime to start compiling my own utils lib
22:50amalloyan activity i encourage, although i gather some people frown on it
22:51`cbpwhat do they have against it?
22:52amalloywell, https://groups.google.com/forum/#!topic/clojure/WuS31RSiz_A is one stance
23:20Aciowhere can i find the valid function name characters?
23:21dnolenOK breaking ClojureScript change around keywords - http://github.com/clojure/clojurescript/commit/2e8b32aa28399c69500e511377b1841a6679c9f2
23:21dnolenthat cleans up a lot of messes that have lying around for 2 years
23:21dnolenplease test this branch
23:21dnolenseangrov` and others
23:23dnolenit does seem to work lein cljsbuild just fine, I'll have to save performance testing and similar things for tomorrow.
23:23bbloomdnolen: oh boy oh boy oh boy :-)
23:23bbloomdnolen: sooo close to composite constants too!
23:23dnolenbbloom: very, just a few more tweaks
23:57seangrov`dnolen: Will check tonight or tomorrow
23:59bbloomhow evil is it on the JVM to dynamically create lots of types at runtime?
23:59bbloomi know this is a question that will make you say "wtf do you want to do that for?"
23:59Raynesbbloom: wtf do you want to do that for?
23:59bbloom*sigh*