#clojure logs

2012-09-20

00:00amalloyokay. i don't think i'm determined enough to churn through the conversation enough to catch up. so i'm out!
00:00Sgeotomoj, what operations are specific to your monad?
00:00tomojbut if m m a is uninhabited, then in a sense I can't violate the monad laws, can I?
00:00SgeoLet's call one such operation tomoj-op :: m a -> ?
00:01tomojit's Future from Reactive
00:01SgeoBy the left identity, return some-m-a >>= tomoj-op should be the same as tomoj-op some-m-a
00:01SgeoBut return some-m-a is an m m a
00:03tomojone example of (m a -> m a) might be `postpone`
00:03tomojso (return 5 >>= postpone) and (postpone 5) ?
00:04SgeoShould be the same, yeah. But what if 5 is another future?
00:04SgeoInstead of 5
00:04tomojwell, postpone takes a time too, so say waitASec = (postpone 1000)
00:04SgeoWait, I'm confused
00:04SgeoYou're calling 5 an m a?
00:04tomojno
00:05tomojpostpone has type (a -> m a) and (m a -> m a)
00:05tomojer, waitASec does I mean
00:05tomojso, in a sense, yes
00:06tomojactually I once considered extending the monad's protocol to default, which is essentially what my satisfies? checks do...
00:06tomojor one of them anyway
00:07Sgeotomoj, what if you want to use the (a -> m a) version on an m a
00:07SgeoAs in, want to use a (m a -> m m a) form of postpone
00:07tomojwell, you can't
00:07tomojI'm trying to think of a reason to want that
00:08SgeoMaybe you're transmitting futures on the network somehow
00:08SgeoAnd thus, to receive a future, you have a future representing the future that will be received
00:09tomojguess I should try to determine whether Reactive ever makes interesting use of a (Future (Future a))
00:10SgeoOr whether a user might?
00:10tomojyeah
00:11tomojbut once you have the (Future (Future a)), what are you going to do with it besides get a out (while respecting the monad morphism)
00:12tomojfor e.g. an ajax call, I just provide a means to create a Future AjaxResponse from a description of the call to make
00:13SgeoYou might want to postpone the inner future, or something?
00:16tomojpostponing the inner future and then joining gives you the same thing as joining and then postponing
00:27SgeoMaybe if monads were taught in terms of join rather than in terms of bind, this would be a non-issue.
00:40tomojSgeo: shall I take that to mean you think it non-obvious that I'll have do a big refactor to undo this horrible mistake? :)
00:41tomojshouldn't really be that hard even if I have to do it, I think
00:41SgeoI think not supporting m m a might be a mistake, but that doesn't mean that your multi-type operator is bad. Although I guess I don't know if it's implementable properly.
00:43tomojthanks for the feedback. I'll stick with the weirdness but keep the auto-joining out of the core protocol impls, so that at worst later I'll have to remove the auto-join, add an operator of types (a -> m a), (m a -> m a), (m m a -> m a), etc, and go stick that in one of my macros
00:45SgeoHmm, ok
00:45tomojactually
00:46tomojdoing that would cause inconvenience for people who want m m a, since they can't use any function defined by that macro
00:47yankovso hard to get feedback on my data structure server. if you guys have a minute can you take a look https://groups.google.com/forum/?fromgroups=#!topic/clojure/Q9eAM7vqHpI
00:48yankovespecially I'm looking into where to start to achieve a high throughput, probably jboss betty wasn't the best choice
00:48yankov*netty
00:49SgeoI should try to find out what JBoss is at some point
00:49tomojis durability a non-goal?
00:50tomojfor the sorted set question, wouldn't a sorted-map of scores to vectors of values work?
00:51yankovtomoj: sorted-map - this is what I used, I'm just doubting about how performant it's gonna be when having huge number of elements. In Redis for sorted sets he used skip-list + hash table and everything is sorted after each write
00:52yankovah.. you saying to vector of values
00:53yankovtomoj: and yes, durability is a goal
00:53yankovor well, maybe it can be postponed
00:54yankovat least not important in the beginning
00:55tomojseems like a hard part
00:55tomojthough depending on your goals maybe you could just use avout?
00:55yankovavout? lemme google that :)
00:56tomojhttp://avout.io/
00:57amalloyredis's sorted sets are bizarre, in that they're not required to be unique. i never quite figured those out
00:57yankovamalloy: yeah, his naming is just a bit confusing. it's not really a set
00:57amalloymore like a priority map or a heap?
00:57yankovyea
00:58amalloythere's an implementation of that in clojure, which is surely better than a sorted map by value
00:58tomojif you were using avout the redis protocol would seem useful only for non-jvm interop
00:59yankovtomoj: I'm reading about it. Looks very interesting, but looks like it'd be helpful just when you need to distribute stuff across multiple machines?
00:59tomojand I guess jvms where you don't have to get the whole key into the client's memory?
01:00yankovamalloy: thanks, good idea, I'll take a look at priority map implementations
01:00tomojyankov: right, though it could also provide durability on a single-node zookeeper cluster
01:02yankovtomoj: what about performance? do you think it's realistic to have operation/per second close to the Redis on jvm? Like what could be a bottle-neck here
01:02tomojdunno
01:02yankovif I don't write anything to disk and just keep everything in memory
01:03yankovalright, gonna check out avout
01:03yankovsee how it works
01:03tomojwith avout I would be quite surprised if it were as fast as redis
01:04tomojif you don't want distributed consistency avout probably doesn't make much sense
01:05yankovhm. storm is pretty fast. they claim to have it tested with 1M messages per second. I wonder how it was achieved
02:16yankovI solved my performance problem with jboss betty.. Now benchmark shows results like for standard Redis. In case you guys wondering, I just had "prn" call in one place in code and of course was locking thread
02:16yankov*netty
02:20SgeoI should attempt to learn what JBoss is at some point
02:22hiredmanprn doesn't actually lock anything, but prn ultimately calls print-method which is a multimethod, and multimethods can end up with very bad contention over locks used internally in the multimethod implementation
02:23hiredmanhttp://dev.clojure.org/jira/browse/CLJ-988
02:25yankovhiredman: oh, interesting..
02:51augustlwhat's a good way to find the index of the first item matching some predicate in a vector?
02:51augustlgoing to replace that item with another one, perhaps there's an operation made specifically for that
02:54augustlcould probably use map for this
03:00tomojyankov: cool, you get redis speed for a big hashmap for example?
03:01yankovtomoj: haven't tested big hash maps yet, I'm using standard redis benchmarking tool for simple operations like get, set, incr, decr, etc
03:02yankovmine is even a bit faster for some reason
03:02yankovbut redis is single threaded and it uses some sort of home-made event library.. or maybe I'm just not testing it correctly :)
04:08kralnamaste
06:40babilenHi - I've been using autodoc for some time, but was wondering if there are any other good libraries to generate documentation. I ask because autodoc hasn't been committed to in the last 4 months and I am wondering if this is merely due to a sentiment of "operation complete" or if there are better libraries.
06:42algernonbabilen: marginalia & codex are both great
06:43babilenalgernon: I somehow don't really like marginalia and cod[o]x hasn't been committed to in almost 6 months ...
06:44babilenalgernon: But if those are still the only three libraries I'll stay with autodoc. Just wanted to make sure that I didn't miss anything important :)
06:44algernonbabilen: I see. I don't know of anything else, unfortunately :(
06:46babilenThat's ok. It's rather that "http://tomfaulhaber.github.com/autodoc/" hints at additional features (e.g. markdown support). When I was looking into documentation generation some time ago I just thought "Ah, well. autodoc seems to be what I want and lets see if there is something better in a couple of months"
06:47babilenalgernon: I've only looked at marginalia for a very brief amount of time and it seems to be rather geared towards users who want to "read" the entire source code from top to bottom. My needs are rather "I need to see a brief overview what a library offers with links to further documentation."
06:48babilenIn a way I am still waiting for something as powerful as Sphinx in the Python world. But meh ... I'm happy for now.
06:48babilen(and standard)
06:49algernonbabilen: I accomplish the overview with an empty, documentation-only namespace. and the further docs are the API docs with source on the right
06:50algernonor just generate two sets of docs: one overview, with little code (examples pretty much) and the whole stuff.
06:51babilenalgernon: I'll look into that! Do you, by chance, have a good example of that? Thanks a lot for the information :)
06:52algernonbabilen: http://algernon.github.com/balabit.logstore/ (with http://algernon.github.com/balabit.logstore/developer-api.html being the full docs)
06:52algernonbabilen: just don't look at the code, it's kinda crappy (my first clojure code longer than 100 lines)
06:56babilenalgernon: Don't worry -- I won't look :)
08:17coredhello
08:18coredlike 4 days ago somebody share a free book onine
08:18ludstoncored: Hello. What are you wearing?
08:18coredjeans
08:18coredand a t-shirt
08:18ewyxlol
08:18ludstonHawt.
08:18coredbut talking about the clojure book
08:18ewyxI need some help, but I'm getting stack overflow errors: https://gist.github.com/3755537 Weird thing is, if in the for loop I set ranges to 50, it works fine.
08:18coredis a free book and is more up to date than any other book
08:19coreddo you know which books was it or have some links of free clojure books?
08:19kryftIs there a free book online? (Not that I really need one, as I've already bought two or three, but I'm curious nonetheless)
08:20ludstonStack overflow means some recursion is happening that isn't being tail optimised.
08:21ewyxyeah that I get, however, I fail to see the recursive call I'm making :)
08:26coredanyone?
08:26clojurebotJust a heads up, you're more likely to get some help if you ask the question you really want the answer to, instead of "does anyone ..."
08:26tomojewyx: which language?
08:26coredhahaha this bot is smart
08:26ewyxtomku, clojure?
08:28ewyxThe gist is pretty much the most minimal version of my problem I could find.
08:28ewyxtomoj*
08:28ludstonewyx: You're only doing 81000000 operations
08:28tomojhmm, it seems wrong anyway?
08:29ewyxludston, I'm not saying it's not my fault. I'd just like to understand why.
08:29tomojyou can't (reduce (map + %1 %2) col col) even if it didn't stackoverflow
08:29tomojer, #(map + %1 %2) I mean
08:29tomoj(reduce #(map + %1 %2) col) also fails and is correct
08:30ludstontomoj: Can't you?
08:30ewyxi thought the first one is the initial value?
08:30tomoj&(reduce (partial mapv +) (for [x (range 1 100) y (range 1 100)] [x y]))
08:30ludstontomoj: I'm pretty sure you can
08:30lazybotExecution Timed Out!
08:31tomojyes, and the initial value here is a seq of pairs
08:31tomojyou can't do (+ pair num)
08:31tomoj(by "here" I mean in ewyx's gist)
08:32ewyxtomoj, but the values in col are pairs
08:32jsabeaudry,(+ (list 1 2) (list 3 4))
08:32clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>
08:32tomojindeed
08:33ludstontomoj: I see now.
08:33tomoj&(let [col (for [x (range 10) y (range 1 10)] [x y])] (reduce #(map + %1 %2) col col))
08:33lazybotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number
08:33tomojif you don't pass col twice, the initial value is the first pair, and it works
08:35ewyxtomoj, with larger numbers you'll still get a stackoverflow error though.
08:35tomojuse mapv
08:36tomojhere I can do 100x100 in 774ms
08:36tomojer, 1000x1000
08:37ewyxwith mapv? Ok thanks.
08:37tomojthe problem is that you're building up a huge mess of lazy seqs before realizing
08:37ewyxso those sequences take up the stack
08:37tomojconsider this ##(do (let [col (for [x (range 1000) y (range 1 1000)] [x y])] (reduce #(map + %1 %2) col)) nil)
08:38lazybotExecution Timed Out!
08:38tomojer, ##(do (let [col (for [x (range 100) y (range 1 100)] [x y])] (reduce #(map + %1 %2) col)) nil)
08:38lazybotExecution Timed Out!
08:38tomojwell, that should work fine, lazybot is just slow
08:38ewyxuh no,
08:38ewyxtry 50
08:39tomoj&(do (let [col (for [x (range 50) y (range 1 50)] [x y])] (reduce #(map + %1 %2) col)) nil)
08:39lazybot⇒ nil
08:39tomoj&(let [col (for [x (range 50) y (range 1 50)] [x y])] (reduce #(map + %1 %2) col))
08:39lazybotjava.lang.StackOverflowError
08:40tomojit's (map + (map + (map + (map + (map + (map + .....))))))
08:40tomojand they're all lazy
08:40tomojwhen the repl tries to print it, it tries to realize the first element
08:40ewyxaha!
08:40ludstonAnd since you're building a list of around 9000 of them
08:40tomojwhich immediately blows through them all and boom
08:41ewyxThanks! That explains a lot. I knew I lacked some knowledge of some internals.
08:41tomojmapv forces them into a vector at each step
08:42ewyxtomoj, ludston: thanks for the explanation. Appreciate it.
08:43tomoj(fn [[x1 y1] [x2 y2]] [(+ x1 y1) (+ x2 y2)]) seems to be faster
08:43ludstonewyx, tomoj, Thank YOU. I'm learning.
08:43tomojthan (partial mapv +)
08:43tomojwonder if there is a better way
08:44ewyxheh, I might end up doing that. But I'm glad to know where I went wrong.
08:57CheironHi, any one is using liberator rest toolkit?
09:30lpetitHello
09:31ludstonlpetit: Sad bag sag bad?
09:32lpetitludston: Hu?
10:10gfredericks#"[sb]a[gd]"
10:42clgv,(re-seq #"[sb]a[gd]" "Sad bag sag bad?")
10:42clojurebot("bag" "sag" "bad")
10:45no7hingsomebody seems bored ;)
10:52ohpauleezantares_: I think the thread is going rather well. Thoughts?
10:52antares_ohpauleez: given that clojre/core are dodging hard questions, it is
10:53antares_ohpauleez: I am working on clojurerabbitmq.info for the next week or two (porting existing guides for a Ruby client), then I will put something together that people can discuss
10:53scriptorhow many core contributors are in that thread, anyway?
10:53antares_we at least need to cover Leiningen, reference docs links and the list of up-to-date books in one place
10:53lpetitclgv: hello
10:53antares_scriptor: technically at least 3
10:54clgvlpetit: good evening.
10:54antares_scriptor: realistically, only one person who has real say responded (Stuart H.)
10:54lpetitclgv: issue wrt builder triggered inadequately is solved in my local branch. I expect to release it in the beta branch today
10:55ohpauleezantares_: But we're taking the first steps and I think we're pushing towards some real solutions in certain areas. I'm confident we'll solve all the issues
10:55antares_ohpauleez: in any case, thanks for posting it. Maybe someone will remember to discuss these issues at the conj. As for people like me who cannot attend the Conj, not much changes.
10:55antares_so we will have to build our own clojure.org, with up-to-date docs and open access on github
10:55ohpauleezantares_: I think we'll probably have another unsession where all the contributors get together and we hash out the issues
10:55clgvlpetit: great. :) I'll check it in my beta environment at home
10:56gfredericksantares_: ohpauleez what thread are you guys talking about?
10:56antares_gfredericks: https://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8
10:56no7hinghttps://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8
10:57ohpauleezgfredericks: Evolving the Clojure contribution process
10:57gfredericksthanks
10:57ohpauleeznp
11:00ohpauleezantares_: You're welcome, I was happy to post. Like I said, I'm more than happy to do what I can to make the process, community, language, and ecosystem better for everyone. Clojure is growing and with it, everything else has to grow. Just growing pains - and they're fixable
11:00antares_ohpauleez: but that's exactly what is wrong, only a tiny group of people who can be in person or work for Relevance have a say
11:01antares_ohpauleez: that's not how OSS works, regardless of how brilliant and/or opinionated Clojure design is
11:01ohpauleezantares_: At the language level, most languages are governed by a committee. Python, PyPy, Scala
11:01antares_but at least the doc site discussion can bring non-contributors in
11:02antares_ohpauleez: but you can join scala-internals or python-dev and have a say
11:02ohpauleezcontributions and access to contribute should be better- yes, definitely
11:02ohpauleezantares_: agreed
11:02antares_there are also processes like PEP/SIP and clearly doc teams are not bound by CAs, tight knit groups of people who work at Typesafe/Google, etc
11:03antares_I am not suggesting we all should design the language
11:03antares_but there is so much more to having language adoption grow than just language design
11:03ohpauleezantares_: And we have Clojure Design Pages - but you need a CA to get on the wiki - again, the root problem is evolving the CA process
11:04ohpauleezPEPs are hosted in one format, SIPs are Google Docs, and CDPs are wiki pages
11:04TimMc&(filter #(re-matches #"[sb]a[gd]" %) (let [abc (map char (range (int \a) (inc (int \z))))] (for [x abc y abc z abc] (str x y z))))
11:04lazybotExecution Timed Out!
11:04TimMc:-(
11:05ohpauleezantares_: I also agree with that, we need to evolve the ecosystem- I think that thread is the start of that, without a doubt
11:05ohpauleezNonetheless, I'm happy with the responses so far, and I appreciated all the input that has happened
11:11antares_ohpauleez: it reminds me similar discussions on ruby-core about moving to git and using PEP-like processes and taking care of ruby-lang.org. Honestly, they haven't gotten anywhere over at least 3 years.
11:12antares_ohpauleez: the reason comes down to the Japanese core team saying "we don't care, we want to work the way we are used to". And then the entire git-based ecosystem has to such it up. But I am not suggesting to discuss this, it won't help anything, I know.
11:12antares_ohpauleez: just saying that I am having exactly the same feeling as I had 2-3 years ago on ruby-core
11:13ohpauleezantares_: Yes, I've faced similar situations, even in projects where I was on the core team. Only once have I hit a situation that seemed so entrenched that almost every effort failed.
11:14ohpauleezI think this community is far too objective to let that happen
11:14ohpauleezwe let the data do the talking, and we encourage people to pick up something and run with it
11:14ohpauleezwhen people do that, results happen
11:14ohpauleezWe're in the process of doing that right now
11:19antares_ohpauleez: do you have any ideas about a name for this new doc repository?
11:19ohpauleezuvtc threw a repo up (it's empty right now)
11:20antares_ok, I haven't see it
11:20casionnew doc repository?
11:21ohpauleezthe link is in the thread. I figured we'd just ask him to me, you, who ever else to it and we'd start
11:21antares_casion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8
11:21ohpauleezI'll work on the logistics of getting it integrated
11:22ohpauleezAnd we can come up with a solution for ClojureDocs (iframe/new codebase)
11:27gtrakis there a generalized proguard config floating around for clojure projects?
11:27casionas a side-topic, I think clojure really could use a site with imperative->clojure examples
11:27casionrosetta code just doesn't cut it
11:27casionI've been discussing the idea with my wife and I've yet to come up with any good ideas for application of the concept though
11:29ohpauleezcasion: I was working on a book that did that: Here's a problem, here's some Python code, here's functional Python code, here's the Clojure code, let's walk through the clojure code
11:29ohpauleezthe end of each problem was some idiom
11:30antares_casion: you discuss clojure with your wife?
11:30casionohpauleez: I've been going through 'algorithms in C' and writing clojure versions of everything, and a c++ design patterns book
11:31casionmy problem is #1 I suck with anything to do with the web and #2 I still have imperative mindsent ingrained, so trying to write idiomatic clojure code after looking at a, to me beautiful, C version slows me down
11:31casionantares_: sure
11:32casionshe's not a programmer, but she has listened to me ramble about stuff for 12 years :) (and she watches a lot of infoq and related stuff)
11:34TimMcantares_: What, would you hide it from your spouse? :-P
11:34TimMcIt's not *all* that shameful to combine Lisp and the JVM.
11:34casionI think it's always good to try and discuss things with someone who may not fully understand the technical aspects
11:35casionthey tend to point out things you miss, or silly assumptions youv'e made, pretty quick
11:35TimMcRubber-ducking. :-)
11:35casionexcept with a duck that talks :)
11:35grettkenon-technical people usually have other perspectives that programmers lack, and that helps
11:35ohpauleezcasion: agree - 100%
11:35casionthough I wish my wife was a rubber duck sometimes ;)
11:36gtrakI totally made my non-programmer girlfriend watch rich hickey talks
11:36casionmy wife has watched nearly all of them on her own lol
11:36gtrakthe hammock one is pretty palatable to normal folks
11:37casionI still chuckle thinking about the firs time I turned on the tv and she left one of the talks on… I was very confused since I didn't remember watching it
11:38casionapparently she had looked through my books I had strewn about the coffee table and started reseasching stuff
11:38gtraknice
11:41gtraka functional romance is better than an imperative one... lazy evaluation, values... way better than mutation
11:41casionohpauleez: btw, do you think python is a good language to use for such examples? To me the oop-ness of python confuses the issue sometimes
11:42antares_JS is a great language for that
11:42casiongtrak: better concurrency too
11:42antares_python is not bad either
11:42casionyeah, I would think JS would be better...
11:42casionor at least C or pascal
11:42gtrakcasion, though more GC I suppose
11:42casionmaybe not pascal
11:42casiongtrak: a romance with automatic garbage collection sounds amazing
11:42ohpauleezPython and JS are my two favorite languages to migrate people in to lojure
11:42ohpauleezClojure
11:43antares_casion: I'm afraid people who come to clojure don't typically use C that much
11:43casionantares_: but simple C code is readable for most anyone I think
11:43gtrakantares_: java's not so far off from C really
11:43antares_casion: I am not sure, cool kids these days know some JS but no C at all
11:43AdeonI haven't used clojure at all yet
11:44AdeonI just came from Common Lisp and I'm reading up on it
11:44ohpauleezvars done correctly in JS look a lot like let blocks. Scoping in JS is done with Clojures. Python's generators make the case the laziness. A list-comprehension can be refactored into a map or a reduce call, and easily translated over to Clojure
11:44DaishimanHi everyone. I'm very new to Clojure, and I had a question on what would be the "lispiest" way to model database entities
11:44antares_higher order functions examples in JS will be natural
11:45antares_in C? probably not
11:45ohpauleezcasion: I agree that nice C code is extremely readable
11:45DaishimanFrom the docs that I've read, a record would be the most ideal thing, but I'm not quite sure.
11:45antares_Daishiman: start with a map
11:45Sgeoohpauleez, how do you translate list-comprehensions with multiple lists into maps and reduces?
11:45antares_Daishiman: then you can use records if you need to, they implement all the map interfaces anyway, so initially it will be a drop-in replacement in most cases
11:46SgeoI mean, you could do it with bind, which in Clojure could be apply concat I think
11:46casionwell, writing a C example of high order functions is going to assume a good knowledge of C for sure
11:46antares_Sgeo: clojure has list comprehensions, too
11:46ohpauleezDaishiman: As a rule of thumb, associative data structures (like maps) open up a lot of solutions. Wrapping that map in an atom will give you state/transaction support if you need it
11:46gtrakhigher order functions without GC is ... hard
11:47antares_Daishiman: note that all this is not "lispy", it is how Clojure approaches things. It has pretty important differences from traditional lisps.
11:47Daishiman@andates_ . Sounds good. I'm building a service and I would basically need a persistent in-memory data structure that queries and commits data to a DB, with a collection of records.
11:47ohpauleezSgeo: Nested map calls or zip two lists together
11:47Daishiman@antares_, sorry
11:47antares_Daishiman: maps should take you very far, possibly all the way there
11:47antares_Daishiman: what DB do you plan to use?
11:48Daishiman@antares_ PostgresSQL, I'm building a service that interacts with an existing Python app
11:48Daishiman@antares_ but I chose Postgres for this since it seems concurrency is much better handled
11:48Daishiman@antares_ err Clojure
11:48antares_Daishiman: ok, then clojure.java.jdbc should cover you (and you work with sequences and maps with it, more or less)
11:48casiongtrak: imo it's more so that you're going to end up relying on a clusterfuck of macros to have sensible HoFs in C
11:48casionwhich leads to unreadable nonsense code
11:48antares_Daishiman: postgres is a fantastic database, no doubt
11:49gtrakcasion: yea... probably better to just write a compiler at that point
11:49casionit's easier to just make your own object system and pass around 'objects' instead of trying to have actual HoFs
11:49casionand that is also a pain in C
11:49casionbut less so
11:50Daishiman@antares_ So for altering my supposed data structure (which should be a map of maps or ultimately a map of records), what should I research to make concurrent modifications? My use case is a couple hundred changes per second at most
11:50casionanyway, that at least gets you first-class functions for free sorta
11:51Daishiman@antares_ I don't mean to get you to do my homework for me, but there seems to be many different ways of handling concurrency and I'm not sure where to start
11:51antares_Daishiman: an atom should handle that, although it depends on the exact algorithm. You also can just use + store persistent data structures, without keeping an atom around.
11:52Daishiman@antares_ Are atoms are based on JVM concurrency primitives?
11:52antares_Daishiman: if you could explain what your app is doing (an overview) and how you modelled that so far, I think someone will give you a more or less specific solution to start with
11:52antares_Daishiman: yes, AtomicReferences
11:52antares_an atom is an AtomicReference + some nice functional things on top
11:54Daishiman@antares_ In essence, I'm loading some configuration and account data for Twitter users from a DV, then using the twitter API to poll accounts and send messages back to Twitter and making some web requests to my Python app, so I need to keep the user's data in memory, and after getting the data from polling Twitter, modify said records in memory and make some requests to the Python app.
11:55Daishiman@antares_ and I want to make several web requests concurrently
11:55Daishiman@antares_ I researched Python solutions for this and frankly they all leave something to be desired
11:56antares_Daishiman: ok, so I'd start with keeping your map of maps in an atom. The rest can be done via a JDK execution service (thread pool), clj-http also lets you configure its thread pool for requests.
11:56Daishiman@antares_ since I might be handling a couple hundred requests and I don't want to mess with the interpreter lock, and the requests are so short-lived that using processes is inefficient
11:57antares_Daishiman: so if an atom will offer good enough performance under ~200 concurrent updates contention, you should be set about doing everything else concurrently with very little effort. And JVM will use all your cores.
11:57Daishiman@antares_ sounds absolutely fantastic :-)
11:57ohpauleezDaishiman: for what it's worth. You can use processes-backed future pools in Python. I've had a lot of success with that.
11:57antares_Daishiman: concurrent HTTP requests won't be a problem at all. I have a service in production that does 700-800.
11:57antares_Daishiman: it's atom updates that I am thinking about
11:58gtrakatoms are FAST
11:58antares_Daishiman: but keep in mind that default clj-http connection manager settings are not set for 200 concurrent connections. More like 10-20.
11:58ohpauleezDaishiman: antares_ is right though. A map of maps (or a map of atoms), an atom, and futures in Clojure are more than enough to handle the situation you're describing
11:58Daishiman@antares_ I know perfectly well that it's *possible* in Python, but I'm thinking that since 90% of the work will be done in threads or similar concurrency models, I might as well use a language designed for that :)
11:58antares_Daishiman: don't hesitate ask questions about clj-http here, I can pull up some examples from my service that does a lot of concurrent HTTP requests
11:59antares_Daishiman: yeah, I would not use Ruby for such problem myself. Python probably has more or less the same story.
11:59no7hingDaishiman: if you ever grow out of clj-http, there's also aleph: https://github.com/ztellman/aleph/wiki/Consuming-and-broadcasting-a-Twitter-stream
11:59gtrak,(time (dotimes [x 10000] (inc x)))
11:59clojurebot"Elapsed time: 5.818557 msecs"
11:59gtrak(time (let [a (atom 0)] (dotimes [x 10000] (swap! a inc))))
11:59gtrak,(time (let [a (atom 0)] (dotimes [x 10000] (swap! a inc))))
11:59clojurebot"Elapsed time: 49.213928 msecs"
11:59antares_Daishiman: dakrone is the man behind clj-http ;)
12:00gtrakis 10k swaps in 45ms fast enough?
12:01antares_gtrak: well, it's not exactly the workload Daishiman will have but yes, sure :)
12:01Daishiman@antares_ @no7hing @ohpauleez @gtrak Thank you all for your answers. I can't begin to explain how helpful this is! I'll do some coding and I'll let you know how it goes
12:01ystael Is there an explanation anywhere of how to use ritz-nrepl debugger? It installs and starts perfectly well in my emacs, but, well, I have absolutely no idea what it does :)
12:01DaishimanAgain, thank you so much.
12:02gtrakclojurebot's pretty slow too, on my i5 laptop, it does 10k swaps in 2 ms
12:02ohpauleezDaishiman: You're totally welcome. Good luck!
12:02gtrakafter warmup
12:04hugodystael: try M-x nrepl-ritz-break-on-exception, and then (throw (Exception. "Hello"))
12:06hugodystael: http://common-lisp.net/project/slime/doc/html/Debugger.html for general usage of the stack traces
12:15pandeirois there a java/clj lib that will let me simply listen for incoming mail on a certain port and react?
12:16pandeiroi have never written any mail server stuff before and i am completely in the dark how to even start
12:17antares_pandeiro: nope, there are tools that transform mail into HTTP POST requests
12:18antares_pandeiro: there is also a pure Java mail server, it may have integration points: Apache James
12:19pandeiroantares_: right, what i want to do is something like a compojure handler but instead of an HTTP POST request, i want users to be able to send email to foo@bar
12:19pandeiroand treat the body as the POST data so-to-speak
12:20antares_pandeiro: I understand, take a look at astrotrain on github and Apache James. There is also a Python project that does what you want, not sure if it is still maintained.
12:21antares_pandeiro: http://lamsonproject.org/
12:21hiredman~subetha smtp
12:21clojurebotIt's greek to me.
12:21hiredman~google subetha smtp
12:21clojurebotFirst, out of 2430 results is:
12:21clojurebotsubethasmtp - SubEtha SMTP is an easy-to-use server-side SMTP ...
12:21clojurebothttp://code.google.com/p/subethasmtp/
12:22pandeiroantares_: hiredman: cheers
12:22antares_thanks hiredman, I did not know about that
12:26pandeirolooks like exactly what i am after; just gotta learn the API and make the wrapper :)
12:26pandeirostrange how enjoyable it is making clojure wrappers
12:29dnolenclojure.data ported to CLJS https://github.com/clojure/clojurescript/commit/77ef4f26e00149dfcfcb785cc1c59db82cd3d305
12:29dnolenthanks to tomoj
12:36antares_for Langohr (or just RabbitMQ) users, the first Langohr doc guide is ready: http://clojurerabbitmq.info/articles/getting_started.html
12:39technomancyI'm a big fan of rabbit, but its concepts can be pretty hairy, so it's great to see docs around it; thanks!
12:40uvtctechnomancy: Just a hare more fuzzy than hairy.
12:52antares_uvtc: hi
12:53uvtcOh, hi, antares_.
12:53uvtcWhat do you think of the prospects of this https://github.com/uvtc/clojure-docs-collection ?
12:53antares_technomancy: FWIW, one of the original rubyamqp.info guides is now up on rabbitmq.com: http://www.rabbitmq.com/tutorials/amqp-concepts.html. Plus, rubyamqp.info guides cover a lot of ground and I know .NET and Perl developers using them to look things up :)
12:54antares_uvtc: it needs a new name but I want to get it rolling soon
12:54uvtcohpauleez: ^^ (my previous comment)
12:54uvtcName ideas?
12:54technomancyantares_: sweet
12:55antares_yeah I am frankly out of good ideas myself. clojure-docsite is the best I can come up with right now.
12:55antares_technomancy: so, if you need to introduce someone to rabbitmq, rubyamqp.info can be helpful even to people who do not use ruby.
12:55ohpauleezdocument-clojure
12:55ohpauleezthe project name is the exact action
12:55uvtcI kinda like the name I previously came up with for a different doc project: the alcove
12:55antares_doclojure
12:55ohpauleezand the true need
12:56ohpauleezdoclojure works: In order to do clojure, you need the right docs
12:56ohpauleezdoc clojure - as before, the action
12:56uvtcErr....
12:56technomancybest-case scenario: clojuredocs becomes actively maintained, covers more than just clojure itself, and becomes doc.clojure.org
12:56antares_technomancy: well, sure
12:56ohpauleeztechnomancy: That's indeed part of the proposal
12:56antares_technomancy: but reference docs is a minor part of what makes a language well documented
12:56technomancybut yeah, probably unrealistic
12:57ohpauleezto hook a clojuredoc system into the build process
12:57antares_guides are more important for most expertise levels
12:57technomancyyeah, and it would have to grow a tutorial/long-form side as well as just reference
12:57ohpauleezagreed on all of these points
12:57technomancyabsolutely
12:57ohpauleezuvtc: How do you feel about doclojure?
12:57uvtctechnomancy: an updated clojuredocs.org could always have a static docs area where it could grab hold of the docs at clojure-docs-collection.
12:57clgvoh what does that mean: "leiningen-2.0.0-preview10-standalone.jar: inflateFully: Unexpected end of stream"?
12:57dakroneohpauleez: so the build process part can be done with https://github.com/dakrone/lein-clojuredocs for extraction
12:57antares_uvtc: so, I'd rename it to doclojure, add folks who are interested and start discussing what we can do in the short term
12:58uvtcohpauleez: I don't really like that name.
12:58antares_I think we should take a lot of ideas from docs.scala-lang.org for now
12:58dakronejust need something that takes the resulting json and does something with it
12:58antares_and absolutely must cover leiningen at least briefly
12:58ohpauleezantares_: Agreed, they seem to have it worked out pretty well
12:58ohpauleezdakrone: Thanks! That's super helpful
12:58antares_ohpauleez: I also know the person who leads their doc updates, kinda
12:59antares_but I doubt we should just take their repo and modify it
12:59dakronewebapp programming is not my strong point
12:59senethWhy this does not print anything to the output stream (map #(print (str % "\r\n")) '(1 2 3))? A normal (print "works") does print.
13:00TimMcWhat's happening with clojuredocs, anyway? Does the maintainer just not have enough time to maintain it, or interest, or what?
13:00hiredman~map
13:00clojurebotmap is slightly retarded
13:00hiredman~map
13:00clojurebotmap and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board
13:00hiredman~map
13:00clojurebotmap and the other sequence functions used to be lazy, but with the advent of chunked sequences, may or may not be lazy, consult your local ouija board
13:00hiredmanclojurebot: jerk
13:00clojurebotyou cut me deep, man.
13:00technomancydakrone: a lot of it is just static site generation though. less webapp programming and more "emitting HTML"
13:00antares_TimMc: we don't know. I think we need to find out that soon, too.
13:01antares_I doubt updating clojuredocs for 1.4 will be that hard
13:01dakroneTimMc: the true maintainer is MIA, I have privileges to the repos and databases
13:01TimMcseneth: Map is lazy. That may or may not do anything unless you realize the whole seq.
13:01antares_but we need to have access
13:01antares_oh, nice
13:01dakronetechnomancy: true, but in order to mimic example adding, would require that
13:01senethIs there any map fn that is eager
13:01antares_seneth: (doall (map …))
13:01TimMcseneth: doseq is probably what you want
13:02dakroneantares_: updating for 1.4 is actually very difficult with the way the database is lain out
13:02ohpauleezMy gameplan is to just move "ClojureDocs" - if we geta community of people interested in building up documentation, we should take care of a system like ClojureDocs
13:02ohpauleezand pull it under our umbrella
13:02antares_dakrone: hm, ok. Would you recommend to start from scratch?
13:02dakroneantares_: that's why I started work on an extractor to extract to json (lein-clojuredocs)
13:02ohpauleezor
13:02antares_dakrone: I see
13:02ohpauleezhelp the maintainer out and use iframes
13:03dakronewhat we actually need is something to import the json into
13:03antares_so, who wants to help with doclojure?
13:03antares_(I do)
13:03dakroneand then I can work on a migration tool to migrate the existing examples over from mysql -> whatever
13:03ohpauleezI'm hear to help out
13:03uvtcohpauleez: I see API reference docs as separate from long-form prose-style topical-guide docs. Clojuredocs covers the former.
13:03antares_people with CSS skills are super welcome
13:03ohpauleezuvtc: I do too, but embedding links to a system like that within long form would be nice
13:03dakroneuvtc: agreed, a more wiki-style page per fn is helpful
13:04technomancydakrone: the problem is not so much updating the DB as it is making schema support multiple versions, right?
13:04antares_dakrone: is mysql not working well? Riak sounds like a pretty good choice for such a site
13:04antares_uvtc: can you please add ohpauleez, dakrone, technomancy and myself to doclojure?
13:04technomancyfor the volume and traffic of a site like clojuredocs you could use pretty much any DB
13:04antares_I have some index page UI ideas that won't take long to implement
13:04dakroneantares_: mysql itself is fine, but the schema was not well planned
13:05antares_dakrone: I see. Maybe migrating to PG would be a good idea, to host it on heroku.
13:05dakroneantares_: well, the schema wasn't planned well for multiple clojure versions
13:05ohpauleezantares_: Since you have a working process and I assume build tools, do you mind taking the lead on that
13:05dakroneplus it was all ruby, so activerecord stuff
13:05uvtcOne thing I don't like about the name "doclojure" is that it doesn't roll off the tongue. Another is that it sounds a bit too similar to ".Net". Another is that it's not obvious that it hints at "do-clojure", but looks maybe like "doc-lojure".
13:05ohpauleezand then once we have the template and build piece in place, it's just writing, reviewing, etc
13:06ohpauleezdoc-clojure?
13:06technomancycould possibly use doc.clojure.net =)
13:06dakroneantares_: ohpauleez: uvtc: I don't mind maintaining the extractor and lein plugin for it (the lein-clojuredocs part)
13:06antares_ohpauleez: I can set up a clojurewerkz.org repo, if uvtc agrees we should start from our docslate
13:06dakronebut unfortunately as what's been shown, I don't have enough time to organize a rewrite
13:06uvtcantares_: what's your github username?
13:06antares_dakrone: we initially won't touch clojuredocs, although your help with it would be awesome
13:07antares_dakrone: I have something in mind that can be done in a week or less and will work much better than what we have today
13:07antares_uvtc: michaelklishin
13:07ohpauleezdakrone: I'd do a rewrite if you were able to answer some emails and questions as I went along. Or if you could give me the necessary domain knowledge
13:07uvtcantares_: oh, right, of course.
13:07dakronewould people be interested in #clojuredocs ?
13:07technomancyclojuredocs is valuable for brand recognition as much as for the existing implementation =)
13:07antares_dakrone: I am thinking about a separate maililng list
13:08ohpauleezalso, I agree with the above statement, clojuredocs is more than fine for now
13:08antares_is a separate mailing list a good idea?
13:08dakroneantares_: mailing lists are nice, but slow
13:08dakroneI was thinking both
13:08ohpauleezagreed, no need for a separate list
13:08antares_dakrone: oh, it's not mutually exclusive with #clojuredocs
13:08antares_but ok
13:08ohpauleeztraffic on Clojure related to our efforts is good for our efforts :)
13:08antares_true
13:09dakronejust somewhere to discuss actual implementation details though, would be nice
13:09antares_another question
13:09antares_We can use Clojure-based tools for doclojure or just go with Jekyll
13:09dakroneohpauleez: sure, I'm willing to skype/chat/whatever and help out wherever I can
13:09antares_I personally am totally happy with jekyll
13:09ohpauleezdakrone: Good point, I'm up for another IRC channel. re:help Thanks!
13:09antares_clojurewerkz.org is jekyll all the way, 10 sites or so
13:09ohpauleezthrow it to a vote
13:10antares_does clojurebot support voting yet :)
13:10ohpauleezI say jekyll is fine for now. I haven't used it, but if it can do what we need, let's roll with it. When we think something needs to be changed, we'll move onward
13:10technomancyI suspect starting with a fully-static site would let you get to something working much more quickly; then comments/examples can be added once something is working
13:10uvtcantares_: If you ask me, personally I prefer just .md files, rather than than the clojurewerkz docslate, for 2 reasons: (1) I prefer to write code snippets inline rather than using gists, and (2) I don't like how it calls chapters "guides". I think that terminology is confusing for the reader.
13:10antares_uvtc: docslate is .md files + basic tools to build them
13:11dakronewell I'm in #clojuredocs too if anyone would like to join and discuss things
13:11antares_and it can use embedded examples, well, with a bit of modification
13:11piskettiAre there any visual test runners or report generators for Clojure? I'd be grateful for links and tips
13:11danenania_Hi all, I want to love clojure, but can't get it running. When I "lein run" I'm getting a lot of long "No :main namespace specified in project.cl" for all my dependencies. Any ideas?
13:11piskettiIdeally with leiningen test plugin
13:11uvtcantares_: It seems like a pain to me as a writer to have to put in links to gists rather than just putting in the code right there.
13:12ohpauleez(thanks for adding my uvtc )
13:12dgrnbrgHello clojurians!
13:12antares_danenania_: you need to specify :main namespace in project.clj for lein run to know what to run. Clojure apps run on JVM and it needs to know what class to use for the entry point.
13:12antares_uvtc: I am not against that
13:12dgrnbrgI'm trying to fix some bugs in a lein plugin i'm working on, and I don't understand why, when I invoke the lein-midge task, the leiningen.core.injected namespace isn't injected into the child proces
13:13antares_uvtc: lets start with docslate and replace our gist plugin with inline code. Alex knows how to do it with files on the local FS (the other clojurewerkz core team member)
13:13danenania_anteres_: i see. is line supposed to supply a default one with "lein new" or do i always have to specify? github repos i clone also aren't running
13:14technomancydanenania_: most github projects are libraries that don't have a :main entry because it just wouldn't make sense
13:14antares_danenania_: I don't remember if lein new template in 1.x adds :main, I think in 2.0 it does not do that
13:14antares_danenania_: what repos are those? are they apps? maybe they are just libraries?
13:15antares_uvtc: what if I just modify docslate to do what you want?
13:15danenania_technomancy_: i see, but why do all these projects give the impression on their page that i just run a few lein commands and they're running?
13:15ohpauleezantares_: uvtc: - I like the idea of using inline code examples for these docs as well. Coming up with solid terms within the docslate unique to the project is important
13:15uvtcantares_: Given that the clojure-docs-collection contains "topical guides" as well as other types of docs, would it be possible to have docslate use the term "article" in place of "guide"? I think it's less confusing to readers.
13:15antares_uvtc: and we go from there? it is .md + a bit of HTML for the layout
13:15ohpauleezthen we can just use mkd files and build using the rest of the ecosystem
13:15antares_uvtc: it uses /article in the URLs
13:15danenania_antares_: clojurescript_one, async_noir_chat
13:15antares_uvtc: of course, we can use any URL scheme we want
13:15danenania_they are apps i believe
13:15danenania_not libs
13:16danenania_lein deps also doesn't work
13:16technomancydanenania_: clojurescript one is a bit crazy
13:16uvtcantares_: whether it's a topical guide, a tutorial, a cookbook recipe, an overview, or anything else, they're all articles, so I'm glad the url uses "article/".
13:16whitakerAnyone else watching the MongoDB 2.2. conference now? http://www.justin.tv/mongodb#/w/3834026336 (looking at using Clojure Monger at work)
13:16antares_danenania_: https://github.com/andrewvc/noir-async-chat has :main and if it does not work, it means the READMe is outdated
13:17antares_whitaker: I am not watching but I am the author of Monger so if you need help, let me know. Monger supported 2.2 before it was out :)
13:17antares_uvtc: so, the site structure is not dictated by docslate in any way
13:17whitakerantares_: super! much appreciated.
13:18antares_whitaker: that conf mentions monger somehow? I did not know
13:18danenania_techonomancy: i'm looking for a project that will show me an example of how to integrate clojure, clojurescript, and sockets... any suggestions?
13:18antares_uvtc: we just use the same structure for all of our sites and that's why docslate is set up a very specific way
13:18antares_danenania_: I have one but it's not OSS :(
13:18danenania_antares: "git clone git://github.com/andrewvc/noir-async-chat.git && cd noir-async-chat && lein run" yields the missing repo error
13:18whitakerantares_: not yet, I'm hoping to bring it up in a Q&A session
13:18antares_and it does not use CLJS, only websockets + Web app
13:18technomancydanenania_: never used clojurescript, sory
13:19antares_whitaker: ah, ok. 10gen folks know about Monger (well, at least some) and helped us with suggestions and promoting it
13:19danenania_antares_: at this point, i'd just be happy to get a new project running
13:19danenania_of any kind :/
13:20uvtcantares_: It's possible that there will be like-named articles under different directores. For example, tutorials/functional-programming.md, overview/functional-programming.md, topical-guides/functional-programming.md. So it would be nice if that translated to urls: articles/tutorials/functional-programming.html, articles/overviews/functional-...
13:20whitakerantares_: good to have that informal partnership
13:22danenania_technomancy_: any ideas on the maven repo not found stuff? i'm getting it on any project i try to run
13:23antares_danenania_: do you mind posting the exception to github?
13:24antares_danenania_: projects that are maintained usually have all the repos necessary in project.clj
13:24dgrnbrgI'm seeing in leiningen2 preview10 that the hooke injections aren't occurring. How can I determine what's going on?
13:24antares_danenania_: also, do you use lein2?
13:25antares_uvtc: you can have dir structure matching HTTP resources or not, it is all configurable
13:25antares_uvtc: can you please join #clojuredocs?
13:25danenania_antares_: will do. nope, i'm on 1.7.1
13:26danenania_https://gist.github.com/3757185
13:27technomancydgrnbrg: I think hooke is now only injected by tasks that use it
13:27technomancydgrnbrg: which is currently limited to test
13:27dgrnbrgtechnomancy: how can I force hooke to be injected?
13:28dgrnbrgI was relying on injected hookes for my code coverage plugin
13:28danenania_antares_: any of that make sense to you?
13:28hfaafb_is this the intended behavior of zipmap? https://gist.github.com/1e1801238e27ad809776
13:28technomancydgrnbrg: (update-in project [:injections] conj leiningen.core.project/hooke-injection) ; <- pass that to eval-in-project
13:29technomancyactually that won't work since hooke-injection is private
13:30technomancydgrnbrg: you'll probably want to construct your own injection form anyway in case leiningen changes
13:30danenania_antares_: looks like i'm getting the same error from "lein update"
13:30dgrnbrgtechnomancy: got it--i suppose I'll just copy lein's code for now
13:30danenania_what's the best way to completely clear out lein and start over? seems like mine is screwy
13:30antares_danenania_: do you have ~/.m2/settings.xml by any chance?
13:31TimMchfaafb_: Yes. Maps can't have duplicate keys.
13:31antares_danenania_: well, noir-async/noir-async cannot be found on clojars
13:31technomancydanenania_: according to that paste it looks like you can't reach clojars; probably a network issue
13:31danenania_technomancy_: i'm just on a normal home network...
13:31hfaafb_is there a zip... vector? :3c
13:32danenania_antares_: ~/.m2/settings.xml not found
13:32S11001001hfaafb_: map and vec
13:32technomancydanenania_: well, it's saying it can't reach clojars, so I don't think clearing out is going to help.
13:34danenania_technomancy_: i see... is that any other alternative to get going?
13:34S11001001hfaafb_: if you are haskellian, map is more like arbitrary liftAn on the ZipList applicative functor, than it is like functor map
13:34danenania_there*
13:34technomancynot really any alternative; if you can't reach clojars you can't do much
13:34`fogus|away,(map vector "there" "three")
13:34clojurebot([\t \t] [\h \h] [\e \r] [\r \e] [\e \e])
13:34hfaafb_woah coo
13:34hfaafb_l
13:35technomancydanenania_: better to upgrade to the latest lein2 though
13:36hfaafb_thanks
13:50technomancyheh; parsatron's namespace is the.parsatron
13:51CheironHi, i know but compojure has an irc but ... for compojure, how to have something like hot deploy? making changes to that take effect without the need to restart the web container?
13:52whitakerantares_: just experienced a bit of annoyance watching Dwight Merriman, CEO & Co-Founder of 10gen, in his talk "Concurrency Internals in 2.2," conflate concurrency & parallelism. Rather surprising.
13:53antares_whitaker: that's fine, some people just don't care about little details like that
13:53whitakerantares_: "little details…"
13:54antares_whitaker: compared to lock yielding improvements, the terminology is a small detail, for conference attendees anyway :)
13:54whitakerheh
13:55technomancygotta learn to walk before you can run?
13:55HodappI'm looking for the distinction online, but it seems like all the pages talk about 'concurrency' and 'parallelism' only in the context of a single computer, which I take issue with...
13:55pandeirotechnomancy: how can i ensure lein downloads the maven index?
13:55pandeiroi am doing lein search and it returns no results for anything i try
13:55technomancypandeiro: on the latest preview?
13:56antares_Hodapp: most developers simply don't have experience with distributed systems yet, at least parallel distributed processing
13:56pandeiro10?
13:56antares_pandeiro: 10 is the latest
13:56antares_technomancy: Y U NO IN #clojuredocs
13:56pandeiroi am using 10
13:56technomancypandeiro: yeah, typically it will ensure the index is up to date on every search. if you're not getting results it's more likely to be due to the query itself
13:57technomancypandeiro: currently only the artifact-id is searched, and even there the query analyzer is not the best. open issue for that here: https://github.com/technomancy/leiningen/issues/243
13:59whitakerHodapp: http://blip.tv/clojure/david-liebke-from-concurrency-to-parallelism-4663526
14:00ystaelhugod: so, the result of M-x nrepl-ritz-jack-in followed by M-x nrepl-ritz-break-on-exception followed by executing (throw (Exception. "hello")) in the repl is:
14:00ystaelnothing comes back in the repl, and the minibuffer says "nrepl-dbg-setup 1"
14:01Cheironi'm launching my compojure application with lein ring server but why changes to code isn't taking effect?
14:01antares_technomancy: I think most of mongodb users want to fly, immediately, without taking any classes, all the way to Neptune
14:01pandeirotechnomancy: but should `lein search clojure` return nothing?
14:01antares_technomancy: learning to walk is for old school folks
14:01danenania_technomancy_: lein 2 is working much better, thanks. only issue now is i'm getting "WARNING: You're currently running as root; probably by accident." when i run sudo lein commands. without sudo nothing works correctly. any idea how i should set LEIN_ROOT to remove this warning? sorry, need to work on my unix skills
14:02technomancypandeiro: hm; no that must be something else broken =\
14:02antares_danenania_: hm, you probably have used sudo once nad it has created ~/.lein as root or something
14:02technomancypandeiro: the search task had to be rewritten from scratch to work around breakage in the central indices, so it's not exactly mature code
14:03technomancyantares_: sounds about right re: walking =D
14:03pandeirotechnomancy: gotcha, np
14:04technomancypandeiro: happy to get some help on this if you have some cycles
14:06pandeirotechnomancy: i am starting at 0 myself with lucene and have never even looked at lein's source ::shame::
14:07pandeirobut i will at least clone the repo and try to see what it is doing... one of these days lein will have to stop being a black box right?
14:07pandeiro(for me, i mean)
14:08technomancypandeiro: unfortunately there's a black box inside a black box here since we can't use lucene directly but have to delegate to the maven-indexer library
14:08technomancysince they switched to a much more complicated system of sharded incremental indices that you have to merge client-side
14:11pandeirotechnomancy: not sure this is relevant at all but i always found npm's search pretty decent, which i think uses couchdb and possibly lucene
14:11pandeiroi realize rebuilding the index is probably not an option though
14:11technomancyyeah, our hands are tied here
14:11technomancystill, we can do a lot better with what we have
14:12technomancyit's all still lucene under the covers
14:12pandeiroso lein doesn't use clucy or anything?
14:12technomancyit used to
14:12technomancybut once they dropped the full indices we had to switch away since it doesn't work with the incremental indices
14:13Cheironhi guys, any fella used Liberator REST toolkit?
14:13Cheiron*uses
14:15thorbjornDXomg, I just used vimclojure's evaluate file command while looking at a previous software rev usinging fugitive's :Gdiff command, am I right to be excited about this?
14:26rbxbxthorbjornDX yes :)
14:30thorbjornDXrbxbx: :)
14:31thorbjornDXrbxbx: at the moment I'm unrolling a deeply nested perl loop into clojure functions, and I love being able to just look at seqs of closures (maps) instead of using print (Gdiff is just icing on the cake)
14:32naegrbxbx: you were wondering about a logic solution to conways, right?
14:38rbxbxnaeg that's correct, did you come up with one?
14:38naegrbxbx: I'm working on it. Having troubles with core.logic (and my mindset)
14:39rbxbxcool. I didn't take a stab at it at all :(
14:39rbxbxI did find a prolog first of hanoi though that probably wouldn't be too difficult to port :)
14:39naeghere's what I have so far: http://bpaste.net/show/RtdJO8GkdJAMVFxqMHCe/
14:39rbxbxprolog version* that is
14:40naegbut it's 1. not working 2. not finished (death by being overcrowded is missing)
14:40rbxbx'l is just a reference to core.logic?
14:40naegboth of the problems made me think whether my current model is a good idea at all and then i decided to stop working on it for now :P
14:41rbxbxhaha
14:41rbxbxWell at least you tried :)
14:41rbxbxBetter than I
14:41dnolennaeg: I took a look at your code - you're going into the dep end :)
14:41rbxbxThanks for sharing your results.
14:41naegoh yeah, the namespace is: (ns life (:require [clojure.core.logic :as l]))
14:41dnolennaeg: the 0.8.0 are not ready
14:41naegdnolen: "dep end"?
14:42dnolen"deep end" the 0.8.0 alphas are not ready, I would not use those to solve problems unless you're already very familiar with the last stable release 0.7.5
14:42naegdnolen: I tried it with 0.7.5 and had a similar issue with it...can't remember exactly though
14:43naegactually used 0.8alpha3 because of infd (wanted to use that instead of membero in neighbouro)
14:43naegand iirc 0.7.5 also doesn't have !=
14:44dnolennaeg: it does
14:44dnolennaeg: but it doesn't define distincto, which you can easily do yourself.
14:45naegoh so that was missing. yeah, either define it myself or use three !=
14:45naegI'm trying it on 0.7.5 again...
14:46dnolennaeg: in anycase, if you really want to understand how game of life might be done - find a solution in Prolog - figure out how to translate it to core.logic. If you port game of life from Prolog I think you'll find that your understanding of core.logic will be quite good.
14:46naegdnolen: I tend to try to come up with my own solution first before I search the web
14:52naegdnolen: now I remember the problem with 0.7.5. it seemed to ignore my !=
14:53naeghttp://bpaste.net/show/5PsT3YzyLOw1Lb3CpAYm/
14:56rbxbxNone of the prolog solutions I saw seemed particularly elegant.
15:01piskettiCan anyone point me to a visual test runner / report generator? What's I'm after is a better way to track the status of the tests than the textual output.
15:01piskettiIe. i'd like to have a green bar :)
15:01rbxbxpisketti what are you using for testing?
15:02piskettiI'm just running the test suite in leiningen
15:02piskettiIt's a noir project
15:02rbxbxwith just the basic clojure unit test library?
15:02piskettiyes
15:02piskettiat least for now
15:03piskettiI've been flirting with midje but currently just clojure.test
15:03piskettiI'm thinking something like the Jasmine specrunner for JavaScript
15:04rbxbxperhaps you could look at the formatter here http://formpluslogic.blogspot.com/2010/07/better-clojure-test-results-with-deview.html and use it to roll your own?
15:04piskettior your average junit plugin for your favourite IDE
15:04rbxbxIt seems like you'd just have to override the `report` function
15:04piskettihmmm, okay. I'll take a look
15:05piskettiThanks
15:05rbxbxYeah, unfortunately in this instance I'm not sure that you'll find an out of the box solution.
15:05rbxbxThough maybe counterclockwise or intellij do better reporting with clojure.test? I don't know.
15:05rbxbxCheers!
15:06piskettiok, well I was hoping that there was a solution but oh well
15:14muhooold hardware sucks. compile takes 3 seconds on linnode, 6 seconds on 2.33ghz core2duo 2gb ram, and 38 seconds on 1.6ghz atom w/1gb ram. that's a pretty steep curve
15:17muhoonetbook + java = nap time.
15:21gtrakmapv vs doall/dorun/doseq?
15:23brainproxyif any of you #clojure folks are in town early leading up to Strange Loop, you're more than welcome to join us tonight at the STLJS meetup
15:23brainproxyshould be a good time: lots of local devs, free food, a pub downstairs :)
15:26pandeiromuhoo: welcome to my world
15:26pandeiromuhoo: i hope you're not compiling cljs
15:28muhoopandeiro: hehehe, i have, and it was painful, but not at the moment
15:29muhoogtrak: laziness?
15:29gtrakmapv's also not lazy?
15:29dnolen_gtrak: how can mapv be lazy if you get a vector back?
15:30muhoo&(doc mapv)
15:30lazybot⇒ "([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); 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 ... https://www.refheap.com/paste/5175
15:30gtraki know it's not lazy
15:30gtrakI'm just wondering if it makes sense to use for side-effects, for composition and such
15:31gtrakfor instance, map/compose functions containing (is ..) for testing
15:33gtrakI'll show an example: https://gist.github.com/3757861
15:33muhoodoes mapv hold on to th head? i dunno.
15:33gtraksomething about it tells me it's gross, but it's cleaner than alternatives
15:35emezeskegtrak: If you really want side effects, why not use doseq?
15:35muhooo i see, test script. hmm. i use dorun/doseq when the results are being thrown away, makes it easy to look at the code and see.
15:35dnolen_muhoo: head holding only makes sense in the context of laziness
15:35uvtcStrings often act like seqs, for example,
15:36uvtc,(for [i "hello"] (str "-" i "-"))
15:36clojurebot("-h-" "-e-" "-l-" "-l-" "-o-")
15:36uvtcbut why not here:
15:36uvtc,(shuffle "hello")
15:36clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Collection>
15:37muhoo&(shuffle (seq "hello"))
15:37lazybot⇒ [\l \e \l \o \h]
15:37uvtcmuhoo: Yes, that worked for me, but I'd thought that the `seq` call shouldn't be necessary...
15:37gtrakemezeske: mapv, comp, partial... are very nice
15:38gtrakthat's the only reason, I just want something that looks like mapv but acts like doseq
15:38muhooso the only difference betwen mapv and map is that map returns a vector, and isn't lazy (though the docs don't say that)?
15:40muhoouvtc: interesting ##(mapv (partial str "-") "bar")
15:40lazybot⇒ ["-b" "-a" "-r"]
15:41emezeskegtrak: In the gist you posted, I don't really see any advantage to using those instead of doseq.
15:42emezeskegtrak: It seems like a kind of abuse of map, which is supposed to "map" from one domain to another
15:42emezeskegtrak: You're not using it to map anything
15:42uvtc,(for [c "bar"] (str "-" c))
15:42clojurebot("-b" "-a" "-r")
15:43gtrakyea, I suppose I could switch to doseq everywhere
15:44emezeskegtrak: There's no reason you couldn't make a "doeach" function that took arguments like map and doseq'ed them
15:44emezeskegtrak: If you like that notational style
15:44gtrakyea
15:44scriptoremezeske: can't you just think of the string as the original domain?
15:45emezeskescriptor: Huh?
15:45gtrakscriptor: I wasn't playing with strings, I think he was replying to my abuse of it for testing
15:45scriptorah
15:45emezeskescriptor: In that snippet, all the map call's return values are just thrown away
15:46emezeskescriptor: That's what I meant when I said it wasn't being used to map things
15:46scriptorah, sorry, I mixed up nicks
15:46muhooheh, domap maybe. has semantics of map but is really doseq and throws away results.
15:46emezeskescriptor: Oh, heh :)
15:46emezeskemuhoo: It shouldn't have map in the name if the result is thrown away.
15:47muhoogood point
15:47emezeskemuhoo: IMHO
15:47gtrakI guess doseq isn't so horrific :-)
15:47muhoounless you're going for golf.
15:48muhoo(map println "bar") is more concise than (doseq [s "bar"] (println s)), i guess
15:49gtrakyea, the advantage goes away if you define a function
15:50amalloymuhoo: but one of them does something and the other doesn't :P
15:50amalloy(dorun (map println "bar")) is about as long as the doseq
15:50gtrakjust use mapv :-)
15:50muhoomapv not map, ya
15:50gtrakhaha
15:50hiredmanI think we just had this argument in our work irc channel the other day
15:51jkkramerdoseq also signals to the reader that side effects are happening
15:51hiredmanor something close
15:51amalloyhiredman: in a language without curly braces, we have to find something stupid to wage wars over
15:51muhooindenting!
15:52amalloynope. global accord on that
15:52jkkramerlists vs vectors in :require
15:52muhoopackage naming is always a good one
15:52hiredmannah, everyone knows vectors are correct (except for cemerick)
15:52scriptorjkkramer: how does it signal the reader? *visually* you can tell that side effects are being used
15:52scriptorbut I don't think the clojure compiler does anything special, does it?
15:53cemerickhiredman: read the docstring, man! :-P
15:53scriptorthere's partials vs short-hand fns
15:53ystaelto -> or not to -> ?
15:53amalloyscriptor: you, the reader
15:53jkkramerscriptor: in most clojure coders' brains, doseq prompts the thought "side effects here!". mapv does not
15:53scriptorah, that reader
15:54cemerickamalloy: closing parens on their own line or not! :-D
15:54jkkramerah, yes, _a_ clojure reader, not _the_ clojure reader ;)
15:54pjstadigthe CA
15:54pjstadigboom!
15:54muhoothat'd be a fun talk for a conj: clojure flamewar bait. list all the annoying things people can argue about
15:55cemerickpjstadig: that already happened this week
15:55pjstadighas it been 3 and 1/2 weeks since the last CA discussion
15:55pjstadigdamn
15:55scriptorit was even on irc this morning
15:55cemerickUp to a rolling 10 hour cycle now, eh?
15:55gtrakguys I just hate that there's so much java in clojure
15:56emezeskeDoes talking about talking about the CA count as talking about the CA?
15:56gtraknot a proper lisp ;-)
15:56muhoohahahaha
15:56technomancyguys I realized that the fact that clojure code uses vectors and maps means that it's not homoiconic
15:57technomancybecause as you know the word "homoiconic" comes from the Latin "same as Common Lisp"
15:57pjstadigtechnomancy: good point
15:57Hodapptechnomancy: THAT'S GREEK YOU INSENSITIVE CLOD
15:57technomancyhahaha
15:57HodappGreek, as you know, was considered the language of the educated in Roman days.
15:58Hodappso Latin texts often pilfered from it freely.
15:58scriptorooh, but icon is from latin
15:58pjstadigtechnomancy: actually I thought Lisp came frome the Latin meaning "same as Common Lisp"
15:58gtrakI can't believe a lisp in 2008 doesn't have tail recursion...
15:58RaynesI can't believe you care.
15:58Hodappscriptor: It's Latin stolen from the Greek 'eikon' image, 'eikenai' to be like
15:58noidiis there an alternative to with-open to which I could provide my own close fn?
15:59gtrakRaynes: I don't actually :-), we were talking about flame war topics
15:59muhoomuch of roman culture was lifted from the greeks
15:59Raynesgtrak: I don't read backlog. I hop in and take things out of context. That's my thing.
15:59scriptorHodapp: okay, so now we're just totally ignoring PIE speakers?
15:59gtrakRaynes: haha, perfect for this discussion
16:00scriptorI'm picturing rich jumping on irc, seeing the discussion, and then switching to Scala
16:01amalloyi regret my decision to instigate this war
16:01gtrakthough now that I'm playing with MIT scheme, it is interesting to see the different of stuff like 'let'
16:01gtrakinteresting to see the different semantics* of...
16:01technomancynoidi: I think you can proxy Closeable
16:02amalloytechnomancy: s/proxy/reify?
16:02technomancyamalloy: well, I only _suspect_ you can reify Closeable. I'm nearly certain you can proxy it.
16:02amalloyi'm certain of both
16:02Hodapp"Is Scheme the one true Lisp? Tune in for the shocking result."
16:02technomancycool
16:03uvtcpjstadig: "insensitive clod!" ... nice, digging into the archives. :)
16:03technomancyamalloy: I did it back before reify existed.</hipster>
16:03Hodappuvtc: pffft, that was me
16:03amalloyman, if Closeable were an abstract class...it'd be clear evidence that sun didn't learn anything between 1.0 and 1.5
16:03cemericktechnomancy: I did it back when proxy was `instance`.</oldguy>
16:04uvtcHodapp: Ooof! I'm the insensitive clod!
16:04technomancyamalloy: and? =)
16:04noiditechnomancy, yeah, I know, but that's more work than just using try-finally by hand :P
16:04amalloytechnomancy: the collections library is good evidence that they actually did
16:04muhooisn't with-open just a try/catch/finally thing under the hood anyway?
16:05technomancymuhoo: yeah, but you might not control the code that calls with-open
16:05amalloyand also it's a bit fiddly to write by hand; you can easily make mistakes
16:11gtrak(defn doeach "Visually like map, only for side effects, returns the last item for convenience" [& args] (let [s (apply map args)] (loop [current (first s) remaining (rest s)] (if-not (seq remaining) current (recur (first remaining) (rest remaining))))))
16:12amalloyis...is there some reason you would reimplement 'last?
16:13gtrak...dammit :-)
16:14gtrakthat simplifies it
16:14Raynesamalloy is a pretty cool guy, eh makes people feel stupid all the time and doesn't afraid of anything.
16:15gtrakamalloy: because I never use last, I suppose
16:16gtrakbut it's true that every time I use loop-recur without some sort of side effect there's a better way to do it
16:16gtrakwhich is why I ask you people
16:16scriptorhmm, since map is lazy, the only thing that's actually forcing the side effects is last, right?
16:16gtrakyea
16:16amalloywhen you do it with a side effect there's a better way too - use dorun instead of writing domap :P
16:17HodappThe meme award goes to Raynes.
16:17gtrakdorun returns nil
16:17gtrakuselessly
16:17scriptorwould it be less idiomatic to just recur through the list manually and then return the last element?
16:18Raynesgtrak: That isn't always useless.
16:18gtrakyea.. it makes sense for dorun to not hold on to an object
16:18Raynes&(doc doall)
16:18lazybot⇒ "([coll] [n coll]); When lazy sequences are produced via functions that have side effects, any effects other than those needed to produce the first element in the seq do not occur until the seq is consumed. doall can be used to force any effects. Walks through t... https://www.refheap.com/paste/5176
16:19casionlazybot posts a new refheap paste everytime?
16:19casionor does it cache them?
16:20RaynesIt pastes every time.
16:20casionI guess you're free to abuse it however you want :P
16:20RaynesI… guess?
16:21gtraktime to privmsg lazybot
16:21RaynesIf that gets anyone's jollies off, who am I to judge.
16:21casionjust kidding, people in other channels whine about repeated pastes
16:21casionso I guess it was an inside joke completely unrelated to this channel
16:21TimMcRaynes: Deuplicating pastebin!
16:22RaynesIt could cache pastes, but anything side-effecty would blow that to hell.
16:22TimMcDo it.
16:22amalloy&(range 500000)
16:22amalloymuahahahahaha
16:22lazybot⇒ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...
16:22gtrakit didn't paste?
16:22RaynesBut I guess the whole point of clojail is to prevent side effects that would cause this sort of issue.
16:22amalloygtrak: refheap has a size limit
16:23gtrak&(last range)
16:23lazybotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$range
16:23Raynesinb4timeout
16:24grettkeDoes some kind Clojurist have a .emacs and a lein project for a newbie Clojurist to use to get up and running quickly using nREPL?
16:25casiongrettke: what OS are you using
16:25grettkecasion: Windows
16:26grettkecasion: I had been using inferior-lisp process before
16:26technomancyif you don't want to work on a project, you don't need one for an nrepl session
16:26casiongrettke: are oyu using nrepl.el?
16:28tos9Is lein itself supposed to take 5 seconds to start itself up? Just running `lein` takes 5 seconds to (slowly) print the usage info.
16:28casionif you install nrepl.el from marmalade, you should be able to just nrepl-jack-in and be going
16:28xeqitos9: it has to read all of the namespaces for tasks and plugins for that case
16:28thorbjornDXtos9: lein can be slow to start up, and I believe `lein help` is the slowest of all operations
16:28xeqiits a worst case there
16:29tos9A ha. I was asking because I assumed it was related to my question yesterday about `lein repl` being slow, but that sounds like it's not the case entirely then.
16:30grettkecasion: Yes, I got it from Marmalade repo
16:31grettketos9: I had done a maven clojure:repl with inferior lisp and that sure takes 5s to start lol
16:31tos9Ah I see some posts on the clojure ML for slow lein startup, guess I'd better read those.
16:31tos9grettke: Heh
16:32casiongrettke: and you have lein working and clojure-mode… can you just nrepl-jack-in?
16:32gtrakis it possible to have assertions in program code that only run during testing? For instance, I want to error when input to a web service receives unexpected inputs
16:33grettkecasion: I didn't set up lein yet, I see I also didn't define $SHELL
16:33xeqicemerick: thanks for tweeting about valip the other day, finding it useful for clojar's validations
16:33gtrakah, I guess clojure core assert checks the *assert* var
16:33tos9Making your code behave differently when under test is generally a bad idea
16:35casiongrettke: well I can't help there on windows, sorry
16:35casionhopefully someone else can
16:36grettkecasion: thanks still
16:36tos9Ah I see, I should read the README too apparently, and remember that slow startup is spinning up the JVM. So never mind that then.
16:37xeqigrettke: I remember seeing someone mentioning the $SHELL thing on windows w/ emacs, but I can't find where :/
16:37grettketos9: I was wondering if we could wrangle JRebel into a quick starting Clojure runtime/repl.
16:37grettkexeqi: something like, it is a common problem on Win?
16:45technomancygrettke: nothing is really common on Windows, not too few data points to perform reliable sampling
16:45biscarchAre comments used in autodoc?
16:46grettketechnomancy: Understood. I don't do it to be special; Windows is just what is used at work :).
16:47firesofmayhi what is the replacement for clojure.contrib.string/substring? function in clojure 1.4?
16:48amalloy$findfn "abcd" 0 2 "ab"
16:48lazybot[clojure.core/subs]
16:48rbxbxfiresofmay clojure.string/substring?
16:48grettkebless you guys for listning... it is pretty easy to set up on windows, just export SHELL=cmdproxy... Emacs just told me to that after I exported it as cmd. Nice!
16:48amalloywow, findfn really got way slower
16:48RaynesBut loads safer!1!
16:48rbxbxfiresofmay https://github.com/richhickey/clojure-contrib/blob/bacf49256673242bb7ce09b9f5983c27163e5bfc/src/main/clojure/clojure/contrib/string.clj#L351
16:48RaynesBlame xeqi for screwing anything I ever do up.
16:49firesofmayrbxbx, thanks checking it.
16:49firesofmayrbxbx, that's pointing to clojure/contrib. isn't that deprecated?
16:50amalloyfiresofmay: that is the worst advice he could have given you
16:50rbxbxdoh. internet.
16:50amalloyscroll up and see lazybot's answer to your question
16:50firesofmayamalloy, oh missed that. thanks.
16:50firesofmayamalloy, :)
16:50dansalmohow do I create a lein dependency for the newer clojure contribs like algo.generic? I see examples for older 1.2.1 monolithic contribs, but not the new ones shown here: http://dev.clojure.org/display/doc/Clojure+Contrib
16:50aperiodicfiresofmay: that's not what you want
16:51aperiodicyou want the predicate, right?
16:51firesofmayaperiodic, yeah actually. i want a substing? checking function.
16:51Raynes&(subs "abc" 3344 3555)
16:51lazybotjava.lang.StringIndexOutOfBoundsException: String index out of range: 3555
16:51Raynesamalloy: You're blind? I had no idea.
16:52rbxbxfiresofmay amalloy I realized it was deprecated and thought it had been moved into clojure.string which is what I thought I was linking to...
16:52rbxbxgoogle/reading comprehension failure
16:52rbxbxapologies :)
16:52firesofmayrbxbx, no probs. :)
16:53firesofmayamalloy, aperiodic so do we have a function for substring? checking?
16:53rbxbxwould re-find work?
16:53aperiodicfiresofmay: i think this is a case where one falls back to java.lang.String: (def substring? [needle hay] (> (.indexOf hay needle) -1))
16:56firesofmayrbxbx, it might but it returns a nil/value instead of false true. should work but substring? is really common function that I think we should have one one in core library.
16:57rbxbxThat may be so, but until that day I guess dipping into java or being slightly hacky are your choices.
16:57rbxbx:|
16:58firesofmayrbxbx, yeah i'll go with aperiodic's solution for now. thanks guys :)
16:58rbxbxsorry again for the misguidance earlier, cheers!
16:59jcromartieOK what's the state of the art in XML parsing in Clojure
17:00xeqiRaynes: ohh, is findfn "safe" now?
17:00Raynesxeqi: Not to you. Nothing is safe for you.
17:01konr_trabis clojure.contrib deprecated?
17:01gtrakdoes clojure.test.is happen to use 'assert' from core?
17:01firesofmaykonr_trab, yes
17:01gtrakin other words can I use it for things during testing that goes away when I'm not running in test-mode?
17:01firesofmaykonr_trab, http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
17:05juhu_chapaHello! I have several threads, all printing to *out*, is there a way to print lines atomically?
17:06RaynesUse a queue?
17:06RaynesAgents, perhaps?
17:06gtrakjuhu_chapa: locking?
17:07RaynesBut never listen to me when I say agents. I don't have a single piece of code that uses agents and know utterly nothing about them at a practical level.
17:07gtraklocking is abusing the call stack to implement a queue
17:07gtrakmight be alright
17:07hiredman,(doc locking)
17:07clojurebot"([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."
17:07RaynesI just said it in case it was the right answer so I could feel cool.
17:08grettkeDo you guys load Paredit in the nREPL interaction mode?
17:08juhu_chapaRaynes: I am using agents ;)
17:08gtrakmake a log function that locks on the var or something, then require everything to use it, that has the side effect of blocking calling functions, but it's quick and dirty
17:10juhu_chapagtrak: that approach is faster than using queues?
17:10gtrakfaster in the sense that I haven't used a queue before, it would take me longer to work out the details
17:10juhu_chapagtrak: i see.
17:11gtrakbut you can change it later without the calling code caring
17:11gtrakjuhu_chapa: why not just use clojure's logging functions? surely they can handle that
17:23juhu_chapagtrak: it worked with logging!
17:23gtrakyay
17:23gtrakit's almost as if someone else had a similar problem... xD
17:25juhu_chapagtrak: thank you!
17:32antagonHi guys! Anyone have any tips regarding how to TDD request building? I find it hard to test the correctness of my built queries...
17:33antagonnvm, wrong channel
17:37amalloyi'm kinda curious what channel he was aiming for now
17:37Frozenlo`Let's stalk him.
17:38FrozenlockIn cljs, is there a way to use 'set!' but in the current namespace?
17:38gtrakquick! lazybot, join all the channels
17:39Frozenlocklazybot, attack!
17:39tomojevery time you use set!, you are in the current namespace :P
17:39tomojI mean, what do you mean?
17:39FrozenlockI mean the problem I had yesterday. To solve it I had to prefix what I wanted to set with my namespace, like so: (set! cljscript-test.client.main/ObjectDrag.prototype.getDragElementPosition some-fn)
17:41FrozenlockI think it looks ugly. And knowing clojure, this shall not be :P
17:41tomojI still don't understand the allowable set! forms
17:42Frozenlockallowable?
17:42tomoj"allowed", I guess
17:42gtrakerr.. how do I get the stacktrace of a failing test assertion?
17:44FrozenlockI don't follow... is there another way to achieve the 'set!' effect?
17:44tomojFrozenlock: did you try (set! (.-getDragElementPosition (.-prototype ObjectDrag)) some-fn) ?
17:44FrozenlockI don't think I have, let me try that.
17:46Frozenlocktomoj: Can I kiss you?
17:47dnolen_tomoj: thanks for the clojure.data patch
17:48tomojthanks for getting it through
17:49tomojbtw, would you be interested in a patch which implements bound-fn without reifying vars (therefore no public get-thread-bindings etc), without changing the access perf for dynamics, but slowing binding down somewhat?
17:49tomojas sort of a stopgap
17:49tomojs/perf/code/
17:49dnolen_tomoj: what are you thinking of doing?
17:51tomojonly a vague idea so far, but basically keep around maps (or if necessary js-objs) of var names to functions that push/pop with set!
17:51tomojthen binding has to stick that state in so is slower
17:52tomojbut access is just the same
17:56dnolen_tomoj: ... something else to think about, since we're doing whole program optimization I wonder if the overhead could be eliminated entirely under any of the Closure compilation modes ...
17:56tomojoverhead of a stopgap or of reified vars?
17:58dnolen_tomoj: heh actually would require multiple passes - probably not a avenue worth pursuing yet.
17:58dnolen_tomoj: but yeah a simple solution for supporting bound-fn w/ reifying vars sounds interesting.
17:59dnolen_tomoj: I also don't think reifying vars is a bad idea but it would be nice to see some numbers on bblooms patch.
17:59dnolen_perf numbers.
18:00tomojI guess for something like that you create separate jsperf pages?
18:01dnolen_tomoj: or create two advance optimized scripts wrapped in a fn that export the benchmark fn. provide a single jsperf page linking to those.
18:02tomojaha
18:29thorbjornDXif I end up with a seq of seqs of seqs should I rethink something?
18:30thorbjornDXI guess that's not a very specific question :p
18:31Iceland_jackit really depends on the problem? if you're supposed to return a list of matrices and you model a matrix as a vector of vectors...
18:32thorbjornDXIceland_jack: yeah, I have to give my architecture some thought.
18:32aperiodicthorbjornDX: if you find yourself tempted to use flatten then yeah, you should rethink things
18:32Iceland_jack↑ what aperiodic said
18:33amalloyright, there's nothing wrong with a seq of seqs of seqs, or a map of maps of maps, or...
18:33thorbjornDXaperiodic: gotcha. I ended up with a list comprehension within another list comprehension, and that's where the trouble started
18:33amalloyso long as all the layers are there for a purpose
18:33thorbjornDXamalloy: they aren't in this case, since I"ll end up just mapping a single fn to the seqs
18:34aperiodicyou should throw a mapcat in there, then
18:34amalloythorbjornDX: then instead of (for [ys xs] (for [y ys] y)), you wanted (for [ys xs, y ys] y)
18:35thorbjornDXamalloy: I was thinking it would be something like that, but I have to do operations on 'x' to determine what 'y' is, I'm not sure if there are issues there
18:35thorbjornDXamalloy: give me a sec to type out an example
18:39thorbjornDX,(for [m '({:count 1} {:count 2} {:count 3}) iter (range (:count m))] [m iter])
18:39clojurebot([{:count 1} 0] [{:count 2} 0] [{:count 2} 1] [{:count 3} 0] [{:count 3} 1] ...)
18:40amalloyokay...
18:40thorbjornDXamalloy: I guess I can do that, I just need to add some more logic to my bindings for the list comprehensions. Let me know if anything looks funky there
18:40thorbjornDXamalloy: sorry for the toy example, it's pretty simplified
19:02thorbjornDXI have a follow-up question. When I'm doing a binding of a non-sequence in a list comprehension, is it normal to just shove it into a vector? (for [d someseq p [(:mykey d)]] ...)?
19:09aperiodicno. you should just bind it in a let that wraps your list comprehension
19:09aperiodicor, in this case, inside your list comprehension
19:10aperiodic(for [d ds] (let [p (:mykey d)] ...))
19:10thorbjornDXaperiodic: how do I get around having a second sequence within my list comp?
19:11aperiodicthorbjornDX: i don't follow
19:12thorbjornDXthis is sort of what I have now: (for [d ds r (range (d :r))] [d r])
19:13thorbjornDXaperiodic: I do this to avoid having to use map or for within the 'let' binding that you suggested
19:14aperiodicthorbjornDX: that seems fine. there are no superfluous vectors in your for bindings there
19:15tomojthorbjornDX: weird, I am working on an example almost exactly like that
19:15thorbjornDXtomoj: I think I'm just getting around using 'mapcat' by being smarter about my list comprehension
19:17thorbjornDXtomoj: for some reason it seems strange to use 'd' in the list comprehension vector itself
19:17tomojagree with aperiodic here, that is perfectly normal
19:17thorbjornDXaperiodic: I'm seeing clearly now, thanks for your feedback :)
19:18aperiodicthorbjornDX: no problem!
19:21amalloythorbjornDX: (for [d someseq :let [p (:mykey d)] ...] ...)
19:21tomojhmm, is this impossible? https://gist.github.com/64b2b23a303537f97015
19:21thorbjornDXamalloy: ah, is that the same as (for [d ds] (let [p (:mykey d)] ...) ?
19:22amalloyonly if you don't have further stuff in the for-binding
19:22aperiodicoh, neat
19:22thorbjornDXamalloy: okay, I'll put that one in my toolbelt
19:24amalloytomoj: i don't see why that would be impossible
19:25amalloybut i don't totally see what's going on either, so maybe it is
19:27tomojit seems like I have to pass something like (r/map #(get-in % [:range]) coll) to (r/mapcat (partial apply range))
19:27tomojbut then I can't tell how to assoc-in the results back into the original map
19:32tomojnot sure that operator is even very useful..
20:12ohpauleezDoes anyone know if it's possible for Ring's jetty adapter to read a conf file for Jetty?
20:12ohpauleezfor example, if I place it in `resources`
20:19Hodappwhat's a standard Clojure way to, given a sequence of things, grab every pair (i.e. items 1 and 2, 3 and 4, 5 and 6)?
20:20emezeskeHodapp: partition
20:21rbxbx,(partition 2 [1 2 3 4 5 6)
20:22clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>
20:22rbxbx,(partition 2 [1 2 3 4 5 6])
20:22clojurebot((1 2) (3 4) (5 6))
20:22Hodappthanks
20:26tomojdnolen: bbloom's patch no longer applies, unfortunately. it was before the analyzer/compiler split
20:30tomojsince I want bound-fn now I'll just try a stopgap and we can figure out if it's better than eification later. should I create a new ticket for the stopgap if I get it working, or wait for more info on CLJS-210?
20:33antagon,(+ 1 1)
20:34clojurebot2
21:13FrozenlockThat's weird... I always had the impression that doseq and for were the same thing (with 'for' able to do some fancy binding). Yet I have a function that works if I use doseq, but doesn't if I use for. Is there a fundamental difference that I missed?
21:13TimMclaziness?
21:13clojurebotlaziness is hard
21:14TimMcand for generates a result, whereas doseq does not
21:14SgeoFrozenlock, for won't actually do the side-effects
21:14SgeoUntil you try to get values out of its result
21:15Sgeo,(for [i (range 10] (prn i)) ; does nothing
21:15clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: ]>
21:15Sgeo,(for [i (range 10)] (prn i)) ; does nothing
21:15clojurebot(0
21:15clojurebot1
21:15clojurebot2
21:15clojurebot3
21:15clojurebot4
21:15clojurebot5
21:15SgeoUm
21:15tomoj:D
21:15clojurebot6
21:15clojurebot7
21:15clojurebot8
21:15clojurebot9
21:15clojurebotnil nil nil nil nil ...)
21:15Frozenlo`Nice :P
21:15metellusREPLs and bots can be misleading about laziness
21:15tomoj,(do (for [i (range 10)] (prn i)) nil)
21:15clojurebotnil
21:15Sgeo,((constantly 'beep) (for [i (range 10)] (prn i))) ; does nothing
21:15clojurebotbeep
21:16Sgeo,((constantly 'beep) (doseq [i (range 2)] (prn i))) ; does nothing
21:16clojurebot0
21:16clojurebot1
21:16clojurebotbeep
21:17SgeoUm, ignore that comment on the last one, I was ... er, lazy
21:17tomojdnolen: is it acceptable to make set! a macro and set!* a special?
21:17Hodappimmutability is messing with my head! or... is it more like withdrawal symptoms from mutability?
21:17tomojseems unlikely..
21:18amalloytomoj: probably not. if you did that with fn*, inventing a new fn**, code-walkers that macroexpand would break
21:20Frozenlo`I'm eager for the day I won't get stuck on a lazy problem. I've been bitten more than once by this...
21:21tomojoh, well, I guess I can just have the compiler emit extra stuff for set!
21:22tomojthat makes more sense anyway
21:23TimMcmetellus: That's not the only thing REPLs can be misleading about. I had to come in here and get amalloy to straighten me out about why putting an atom in itself seemed to blow up.
21:23TimMc(It turns out that when the REPL tries to print the atom, bad things happen.)
21:24TimMcMaybe I should change my REPL prompt to "namespace> print " to remind me.
21:26holohi
21:26holowhy can't i build some kind of maps comprehension?
21:27hololike {(if true {:d "do"})}
21:28holooh, of course, that returns just an element.. hehe, sorry guys
21:28TimMcholo: What are you trying to achieve?
21:29holoTimMc, i'm trying to return {:d "do"} as the final map doing an if inside {}
21:34TimMcTurn it inside out: (if true {:d "do"} {})
21:34hiredmanugh
21:34hiredmansigned bytes are the worst
21:35TimMcholo: or {:d (when true "do")} if nil is an acceptable value for :d.
21:36TimMchiredman: What have you run into?
21:38holoTimMc, yes it is acceptable, thanks. actually it's better for my use case. i really have to do it in a comprehensions way because there are more elements than that
21:39TimMcholo: If you're building up a map from a bunch of key/value pairs, try (into {} (for [...] [key-expr val-expr]))
21:41holoTimMc, thanks
22:38SgeoI'm going to try to get emacs working on a school computer and write a post detailing exactly what I did.
22:38jcromartieI think this is not too bad at all https://gist.github.com/da22fff78cdf344f6330
22:38jcromartiefor converting XML node structure into simpler data structures
22:38jcromartieexcuse the missing convenience functions
22:40jcromartieunfortunately it doesn't help to reverse the transform
22:49jcromartieAlthough this actually looks something close to reversible…
23:13danielglauser_From the Noir source does this extract the opts from the vector?
23:14danielglauser_(defn gen-handler [& [opts]] ...
23:19jkkramerdanielglauser_: that's a shortcut for an optional trailing argument. You could also use multiple argument lists: (defn gen-handler ([] (gen-handler {})) ([opts] …))
23:22danielglauser_jkkramer: Thanks
23:27loliveiracould somebody please indicate an good tutorial about macros?
23:27muhoo&(map Integer/parseInt ["99" "12" "1"])
23:27lazybotjava.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer
23:27muhoo&(map #(Integer/parseInt %) ["99" "12" "1"])
23:27lazybot⇒ (99 12 1)
23:27muhoowat?
23:27clojurebotFor Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888
23:32TimMcclojurebot: Very clever.
23:32clojurebotPardon?
23:32TimMcmuhoo: u mad?
23:32muhooTimMc: no, just confused.
23:33Raynesmuhoo: That is a java method, not a function.
23:33TimMcJava methods have to be in the call position.
23:33RaynesWhen you do Integer/parseInt, Clojure is trying to look up a field in the Integer class.
23:33RaynesThat's why everybody wraps Java method calls passed to higher order functions in an anonymous function.
23:33muhoooh, ok. thanks.
23:36shaunxcodeare there any decent tutorials/articles written on how to structure/normalize schemas for datomic?