#clojure log - Sep 20 2012

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

0:00 amalloy: okay. i don't think i'm determined enough to churn through the conversation enough to catch up. so i'm out!

0:00 Sgeo: tomoj, what operations are specific to your monad?

0:00 tomoj: but if m m a is uninhabited, then in a sense I can't violate the monad laws, can I?

0:00 Sgeo: Let's call one such operation tomoj-op :: m a -> ?

0:01 tomoj: it's Future from Reactive

0:01 Sgeo: By the left identity, return some-m-a >>= tomoj-op should be the same as tomoj-op some-m-a

0:01 But return some-m-a is an m m a

0:03 tomoj: one example of (m a -> m a) might be `postpone`

0:03 so (return 5 >>= postpone) and (postpone 5) ?

0:04 Sgeo: Should be the same, yeah. But what if 5 is another future?

0:04 Instead of 5

0:04 tomoj: well, postpone takes a time too, so say waitASec = (postpone 1000)

0:04 Sgeo: Wait, I'm confused

0:04 You're calling 5 an m a?

0:04 tomoj: no

0:05 postpone has type (a -> m a) and (m a -> m a)

0:05 er, waitASec does I mean

0:05 so, in a sense, yes

0:06 actually I once considered extending the monad's protocol to default, which is essentially what my satisfies? checks do...

0:06 or one of them anyway

0:07 Sgeo: tomoj, what if you want to use the (a -> m a) version on an m a

0:07 As in, want to use a (m a -> m m a) form of postpone

0:07 tomoj: well, you can't

0:07 I'm trying to think of a reason to want that

0:08 Sgeo: Maybe you're transmitting futures on the network somehow

0:08 And thus, to receive a future, you have a future representing the future that will be received

0:09 tomoj: guess I should try to determine whether Reactive ever makes interesting use of a (Future (Future a))

0:10 Sgeo: Or whether a user might?

0:10 tomoj: yeah

0:11 but once you have the (Future (Future a)), what are you going to do with it besides get a out (while respecting the monad morphism)

0:12 for e.g. an ajax call, I just provide a means to create a Future AjaxResponse from a description of the call to make

0:13 Sgeo: You might want to postpone the inner future, or something?

0:16 tomoj: postponing the inner future and then joining gives you the same thing as joining and then postponing

0:27 Sgeo: Maybe if monads were taught in terms of join rather than in terms of bind, this would be a non-issue.

0:40 tomoj: Sgeo: shall I take that to mean you think it non-obvious that I'll have do a big refactor to undo this horrible mistake? :)

0:41 shouldn't really be that hard even if I have to do it, I think

0:41 Sgeo: I 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.

0:43 tomoj: thanks 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

0:45 Sgeo: Hmm, ok

0:45 tomoj: actually

0:46 doing that would cause inconvenience for people who want m m a, since they can't use any function defined by that macro

0:47 yankov: so 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

0:48 especially I'm looking into where to start to achieve a high throughput, probably jboss betty wasn't the best choice

0:48 *netty

0:49 Sgeo: I should try to find out what JBoss is at some point

0:49 tomoj: is durability a non-goal?

0:50 for the sorted set question, wouldn't a sorted-map of scores to vectors of values work?

0:51 yankov: tomoj: 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

0:52 ah.. you saying to vector of values

0:53 tomoj: and yes, durability is a goal

0:53 or well, maybe it can be postponed

0:54 at least not important in the beginning

0:55 tomoj: seems like a hard part

0:55 though depending on your goals maybe you could just use avout?

0:55 yankov: avout? lemme google that :)

0:56 tomoj: http://avout.io/

0:57 amalloy: redis's sorted sets are bizarre, in that they're not required to be unique. i never quite figured those out

0:57 yankov: amalloy: yeah, his naming is just a bit confusing. it's not really a set

0:57 amalloy: more like a priority map or a heap?

0:57 yankov: yea

0:58 amalloy: there's an implementation of that in clojure, which is surely better than a sorted map by value

0:58 tomoj: if you were using avout the redis protocol would seem useful only for non-jvm interop

0:59 yankov: tomoj: 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?

0:59 tomoj: and I guess jvms where you don't have to get the whole key into the client's memory?

1:00 yankov: amalloy: thanks, good idea, I'll take a look at priority map implementations

1:00 tomoj: yankov: right, though it could also provide durability on a single-node zookeeper cluster

1:02 yankov: tomoj: 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

1:02 tomoj: dunno

1:02 yankov: if I don't write anything to disk and just keep everything in memory

1:03 alright, gonna check out avout

1:03 see how it works

1:03 tomoj: with avout I would be quite surprised if it were as fast as redis

1:04 if you don't want distributed consistency avout probably doesn't make much sense

1:05 yankov: hm. storm is pretty fast. they claim to have it tested with 1M messages per second. I wonder how it was achieved

2:16 I 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

2:16 *netty

2:20 Sgeo: I should attempt to learn what JBoss is at some point

2:22 hiredman: prn 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

2:23 http://dev.clojure.org/jira/browse/CLJ-988

2:25 yankov: hiredman: oh, interesting..

2:51 augustl: what's a good way to find the index of the first item matching some predicate in a vector?

2:51 going to replace that item with another one, perhaps there's an operation made specifically for that

2:54 could probably use map for this

3:00 tomoj: yankov: cool, you get redis speed for a big hashmap for example?

3:01 yankov: tomoj: haven't tested big hash maps yet, I'm using standard redis benchmarking tool for simple operations like get, set, incr, decr, etc

3:02 mine is even a bit faster for some reason

3:02 but redis is single threaded and it uses some sort of home-made event library.. or maybe I'm just not testing it correctly :)

4:08 kral: namaste

6:40 babilen: Hi - 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.

6:42 algernon: babilen: marginalia & codex are both great

6:43 babilen: algernon: I somehow don't really like marginalia and cod[o]x hasn't been committed to in almost 6 months ...

6:44 algernon: 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 :)

6:44 algernon: babilen: I see. I don't know of anything else, unfortunately :(

6:44 * algernon is very happy with marginalia O:)

6:46 babilen: That'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"

6:47 algernon: 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."

6:48 In a way I am still waiting for something as powerful as Sphinx in the Python world. But meh ... I'm happy for now.

6:48 (and standard)

6:49 algernon: babilen: I accomplish the overview with an empty, documentation-only namespace. and the further docs are the API docs with source on the right

6:50 or just generate two sets of docs: one overview, with little code (examples pretty much) and the whole stuff.

6:51 babilen: algernon: I'll look into that! Do you, by chance, have a good example of that? Thanks a lot for the information :)

6:52 algernon: babilen: http://algernon.github.com/balabit.logstore/ (with http://algernon.github.com/balabit.logstore/developer-api.html being the full docs)

6:52 babilen: just don't look at the code, it's kinda crappy (my first clojure code longer than 100 lines)

6:56 babilen: algernon: Don't worry -- I won't look :)

8:17 cored: hello

8:18 like 4 days ago somebody share a free book onine

8:18 ludston: cored: Hello. What are you wearing?

8:18 cored: jeans

8:18 and a t-shirt

8:18 ewyx: lol

8:18 ludston: Hawt.

8:18 cored: but talking about the clojure book

8:18 ewyx: I 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.

8:18 cored: is a free book and is more up to date than any other book

8:19 do you know which books was it or have some links of free clojure books?

8:19 kryft: Is there a free book online? (Not that I really need one, as I've already bought two or three, but I'm curious nonetheless)

8:20 ludston: Stack overflow means some recursion is happening that isn't being tail optimised.

8:21 ewyx: yeah that I get, however, I fail to see the recursive call I'm making :)

8:26 cored: anyone?

8:26 clojurebot: Just 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 ..."

8:26 tomoj: ewyx: which language?

8:26 cored: hahaha this bot is smart

8:26 ewyx: tomku, clojure?

8:28 The gist is pretty much the most minimal version of my problem I could find.

8:28 tomoj*

8:28 ludston: ewyx: You're only doing 81000000 operations

8:28 tomoj: hmm, it seems wrong anyway?

8:29 ewyx: ludston, I'm not saying it's not my fault. I'd just like to understand why.

8:29 tomoj: you can't (reduce (map + %1 %2) col col) even if it didn't stackoverflow

8:29 er, #(map + %1 %2) I mean

8:29 (reduce #(map + %1 %2) col) also fails and is correct

8:30 ludston: tomoj: Can't you?

8:30 ewyx: i thought the first one is the initial value?

8:30 tomoj: &(reduce (partial mapv +) (for [x (range 1 100) y (range 1 100)] [x y]))

8:30 ludston: tomoj: I'm pretty sure you can

8:30 lazybot: Execution Timed Out!

8:31 tomoj: yes, and the initial value here is a seq of pairs

8:31 you can't do (+ pair num)

8:31 (by "here" I mean in ewyx's gist)

8:32 ewyx: tomoj, but the values in col are pairs

8:32 jsabeaudry: ,(+ (list 1 2) (list 3 4))

8:32 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to java.lang.Number>

8:32 tomoj: indeed

8:33 ludston: tomoj: I see now.

8:33 tomoj: &(let [col (for [x (range 10) y (range 1 10)] [x y])] (reduce #(map + %1 %2) col col))

8:33 lazybot: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to java.lang.Number

8:33 tomoj: if you don't pass col twice, the initial value is the first pair, and it works

8:35 ewyx: tomoj, with larger numbers you'll still get a stackoverflow error though.

8:35 tomoj: use mapv

8:36 here I can do 100x100 in 774ms

8:36 er, 1000x1000

8:37 ewyx: with mapv? Ok thanks.

8:37 tomoj: the problem is that you're building up a huge mess of lazy seqs before realizing

8:37 ewyx: so those sequences take up the stack

8:37 tomoj: consider this ##(do (let [col (for [x (range 1000) y (range 1 1000)] [x y])] (reduce #(map + %1 %2) col)) nil)

8:38 lazybot: Execution Timed Out!

8:38 tomoj: er, ##(do (let [col (for [x (range 100) y (range 1 100)] [x y])] (reduce #(map + %1 %2) col)) nil)

8:38 lazybot: Execution Timed Out!

8:38 tomoj: well, that should work fine, lazybot is just slow

8:38 ewyx: uh no,

8:38 try 50

8:39 tomoj: &(do (let [col (for [x (range 50) y (range 1 50)] [x y])] (reduce #(map + %1 %2) col)) nil)

8:39 lazybot: ⇒ nil

8:39 tomoj: &(let [col (for [x (range 50) y (range 1 50)] [x y])] (reduce #(map + %1 %2) col))

8:39 lazybot: java.lang.StackOverflowError

8:40 tomoj: it's (map + (map + (map + (map + (map + (map + .....))))))

8:40 and they're all lazy

8:40 when the repl tries to print it, it tries to realize the first element

8:40 ewyx: aha!

8:40 ludston: And since you're building a list of around 9000 of them

8:40 tomoj: which immediately blows through them all and boom

8:41 ewyx: Thanks! That explains a lot. I knew I lacked some knowledge of some internals.

8:41 tomoj: mapv forces them into a vector at each step

8:42 ewyx: tomoj, ludston: thanks for the explanation. Appreciate it.

8:43 tomoj: (fn [[x1 y1] [x2 y2]] [(+ x1 y1) (+ x2 y2)]) seems to be faster

8:43 ludston: ewyx, tomoj, Thank YOU. I'm learning.

8:43 tomoj: than (partial mapv +)

8:43 wonder if there is a better way

8:44 ewyx: heh, I might end up doing that. But I'm glad to know where I went wrong.

8:57 Cheiron: Hi, any one is using liberator rest toolkit?

9:30 lpetit: Hello

9:31 ludston: lpetit: Sad bag sag bad?

9:32 lpetit: ludston: Hu?

10:10 gfredericks: #"[sb]a[gd]"

10:42 clgv: ,(re-seq #"[sb]a[gd]" "Sad bag sag bad?")

10:42 clojurebot: ("bag" "sag" "bad")

10:45 no7hing: somebody seems bored ;)

10:52 ohpauleez: antares_: I think the thread is going rather well. Thoughts?

10:52 antares_: ohpauleez: given that clojre/core are dodging hard questions, it is

10:53 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:53 scriptor: how many core contributors are in that thread, anyway?

10:53 antares_: we at least need to cover Leiningen, reference docs links and the list of up-to-date books in one place

10:53 lpetit: clgv: hello

10:53 antares_: scriptor: technically at least 3

10:54 clgv: lpetit: good evening.

10:54 antares_: scriptor: realistically, only one person who has real say responded (Stuart H.)

10:54 lpetit: clgv: issue wrt builder triggered inadequately is solved in my local branch. I expect to release it in the beta branch today

10:55 ohpauleez: antares_: 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:55 antares_: 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:55 so we will have to build our own clojure.org, with up-to-date docs and open access on github

10:55 ohpauleez: antares_: I think we'll probably have another unsession where all the contributors get together and we hash out the issues

10:55 clgv: lpetit: great. :) I'll check it in my beta environment at home

10:56 gfredericks: antares_: ohpauleez what thread are you guys talking about?

10:56 antares_: gfredericks: https://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8

10:56 no7hing: https://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8

10:57 ohpauleez: gfredericks: Evolving the Clojure contribution process

10:57 gfredericks: thanks

10:57 ohpauleez: np

11:00 antares_: 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:00 antares_: 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:01 ohpauleez: that's not how OSS works, regardless of how brilliant and/or opinionated Clojure design is

11:01 ohpauleez: antares_: At the language level, most languages are governed by a committee. Python, PyPy, Scala

11:01 antares_: but at least the doc site discussion can bring non-contributors in

11:02 ohpauleez: but you can join scala-internals or python-dev and have a say

11:02 ohpauleez: contributions and access to contribute should be better- yes, definitely

11:02 antares_: agreed

11:02 antares_: 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:03 I am not suggesting we all should design the language

11:03 but there is so much more to having language adoption grow than just language design

11:03 ohpauleez: antares_: 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:04 PEPs are hosted in one format, SIPs are Google Docs, and CDPs are wiki pages

11:04 TimMc: &(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:04 lazybot: Execution Timed Out!

11:04 TimMc: :-(

11:05 ohpauleez: antares_: I also agree with that, we need to evolve the ecosystem- I think that thread is the start of that, without a doubt

11:05 Nonetheless, I'm happy with the responses so far, and I appreciated all the input that has happened

11:11 antares_: 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:12 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:12 ohpauleez: just saying that I am having exactly the same feeling as I had 2-3 years ago on ruby-core

11:13 ohpauleez: antares_: 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:14 I think this community is far too objective to let that happen

11:14 we let the data do the talking, and we encourage people to pick up something and run with it

11:14 when people do that, results happen

11:14 We're in the process of doing that right now

11:19 antares_: ohpauleez: do you have any ideas about a name for this new doc repository?

11:19 ohpauleez: uvtc threw a repo up (it's empty right now)

11:20 antares_: ok, I haven't see it

11:20 casion: new doc repository?

11:21 ohpauleez: the 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:21 antares_: casion: https://groups.google.com/forum/?fromgroups=#!topic/clojure/GnfAK6beMN8

11:21 ohpauleez: I'll work on the logistics of getting it integrated

11:22 And we can come up with a solution for ClojureDocs (iframe/new codebase)

11:27 gtrak: is there a generalized proguard config floating around for clojure projects?

11:27 casion: as a side-topic, I think clojure really could use a site with imperative->clojure examples

11:27 rosetta code just doesn't cut it

11:27 I'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:29 ohpauleez: casion: 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:29 the end of each problem was some idiom

11:30 antares_: casion: you discuss clojure with your wife?

11:30 casion: ohpauleez: I've been going through 'algorithms in C' and writing clojure versions of everything, and a c++ design patterns book

11:31 my 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:31 antares_: sure

11:32 she'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:34 TimMc: antares_: What, would you hide it from your spouse? :-P

11:34 It's not *all* that shameful to combine Lisp and the JVM.

11:34 casion: I think it's always good to try and discuss things with someone who may not fully understand the technical aspects

11:35 they tend to point out things you miss, or silly assumptions youv'e made, pretty quick

11:35 TimMc: Rubber-ducking. :-)

11:35 casion: except with a duck that talks :)

11:35 grettke: non-technical people usually have other perspectives that programmers lack, and that helps

11:35 ohpauleez: casion: agree - 100%

11:35 casion: though I wish my wife was a rubber duck sometimes ;)

11:36 gtrak: I totally made my non-programmer girlfriend watch rich hickey talks

11:36 casion: my wife has watched nearly all of them on her own lol

11:36 gtrak: the hammock one is pretty palatable to normal folks

11:37 casion: I 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:38 apparently she had looked through my books I had strewn about the coffee table and started reseasching stuff

11:38 gtrak: nice

11:41 a functional romance is better than an imperative one... lazy evaluation, values... way better than mutation

11:41 casion: ohpauleez: 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:42 antares_: JS is a great language for that

11:42 casion: gtrak: better concurrency too

11:42 antares_: python is not bad either

11:42 casion: yeah, I would think JS would be better...

11:42 or at least C or pascal

11:42 gtrak: casion, though more GC I suppose

11:42 casion: maybe not pascal

11:42 gtrak: a romance with automatic garbage collection sounds amazing

11:42 ohpauleez: Python and JS are my two favorite languages to migrate people in to lojure

11:42 Clojure

11:43 antares_: casion: I'm afraid people who come to clojure don't typically use C that much

11:43 casion: antares_: but simple C code is readable for most anyone I think

11:43 * Hodapp uses C.

11:43 gtrak: antares_: java's not so far off from C really

11:43 * algernon came to Clojure from C too

11:43 * casion also came from C

11:43 antares_: casion: I am not sure, cool kids these days know some JS but no C at all

11:43 Adeon: I haven't used clojure at all yet

11:44 * gtrak did C -> C++ -> java -> python -> clojure

11:44 Adeon: I just came from Common Lisp and I'm reading up on it

11:44 ohpauleez: vars 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:44 Daishiman: Hi everyone. I'm very new to Clojure, and I had a question on what would be the "lispiest" way to model database entities

11:44 antares_: higher order functions examples in JS will be natural

11:45 in C? probably not

11:45 ohpauleez: casion: I agree that nice C code is extremely readable

11:45 Daishiman: From the docs that I've read, a record would be the most ideal thing, but I'm not quite sure.

11:45 antares_: Daishiman: start with a map

11:45 Sgeo: ohpauleez, how do you translate list-comprehensions with multiple lists into maps and reduces?

11:45 antares_: 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:46 Sgeo: I mean, you could do it with bind, which in Clojure could be apply concat I think

11:46 casion: well, writing a C example of high order functions is going to assume a good knowledge of C for sure

11:46 antares_: Sgeo: clojure has list comprehensions, too

11:46 ohpauleez: Daishiman: 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:46 gtrak: higher order functions without GC is ... hard

11:47 antares_: Daishiman: note that all this is not "lispy", it is how Clojure approaches things. It has pretty important differences from traditional lisps.

11:47 Daishiman: @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:47 ohpauleez: Sgeo: Nested map calls or zip two lists together

11:47 Daishiman: @antares_, sorry

11:47 antares_: Daishiman: maps should take you very far, possibly all the way there

11:47 Daishiman: what DB do you plan to use?

11:48 Daishiman: @antares_ PostgresSQL, I'm building a service that interacts with an existing Python app

11:48 @antares_ but I chose Postgres for this since it seems concurrency is much better handled

11:48 @antares_ err Clojure

11:48 antares_: Daishiman: ok, then clojure.java.jdbc should cover you (and you work with sequences and maps with it, more or less)

11:48 casion: gtrak: 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:48 which leads to unreadable nonsense code

11:48 antares_: Daishiman: postgres is a fantastic database, no doubt

11:49 gtrak: casion: yea... probably better to just write a compiler at that point

11:49 casion: it's easier to just make your own object system and pass around 'objects' instead of trying to have actual HoFs

11:49 and that is also a pain in C

11:49 but less so

11:50 Daishiman: @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:50 casion: anyway, that at least gets you first-class functions for free sorta

11:51 Daishiman: @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:51 antares_: 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:52 Daishiman: @antares_ Are atoms are based on JVM concurrency primitives?

11:52 antares_: 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:52 Daishiman: yes, AtomicReferences

11:52 an atom is an AtomicReference + some nice functional things on top

11:54 Daishiman: @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:55 @antares_ and I want to make several web requests concurrently

11:55 @antares_ I researched Python solutions for this and frankly they all leave something to be desired

11:56 antares_: 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:56 Daishiman: @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:57 antares_: 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:57 Daishiman: @antares_ sounds absolutely fantastic :-)

11:57 ohpauleez: Daishiman: for what it's worth. You can use processes-backed future pools in Python. I've had a lot of success with that.

11:57 antares_: Daishiman: concurrent HTTP requests won't be a problem at all. I have a service in production that does 700-800.

11:57 Daishiman: it's atom updates that I am thinking about

11:58 gtrak: atoms are FAST

11:58 antares_: Daishiman: but keep in mind that default clj-http connection manager settings are not set for 200 concurrent connections. More like 10-20.

11:58 ohpauleez: Daishiman: 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:58 Daishiman: @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:58 antares_: 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:59 Daishiman: yeah, I would not use Ruby for such problem myself. Python probably has more or less the same story.

11:59 no7hing: Daishiman: 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:59 * dakrone should do some kind of "how are you using clj-http" survey

11:59 gtrak: ,(time (dotimes [x 10000] (inc x)))

11:59 clojurebot: "Elapsed time: 5.818557 msecs"

11:59 gtrak: (time (let [a (atom 0)] (dotimes [x 10000] (swap! a inc))))

11:59 ,(time (let [a (atom 0)] (dotimes [x 10000] (swap! a inc))))

11:59 clojurebot: "Elapsed time: 49.213928 msecs"

11:59 antares_: Daishiman: dakrone is the man behind clj-http ;)

12:00 gtrak: is 10k swaps in 45ms fast enough?

12:01 antares_: gtrak: well, it's not exactly the workload Daishiman will have but yes, sure :)

12:01 Daishiman: @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:01 ystael: 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:01 Daishiman: Again, thank you so much.

12:02 gtrak: clojurebot's pretty slow too, on my i5 laptop, it does 10k swaps in 2 ms

12:02 ohpauleez: Daishiman: You're totally welcome. Good luck!

12:02 gtrak: after warmup

12:04 hugod: ystael: try M-x nrepl-ritz-break-on-exception, and then (throw (Exception. "Hello"))

12:06 ystael: http://common-lisp.net/project/slime/doc/html/Debugger.html for general usage of the stack traces

12:15 pandeiro: is there a java/clj lib that will let me simply listen for incoming mail on a certain port and react?

12:16 i have never written any mail server stuff before and i am completely in the dark how to even start

12:17 antares_: pandeiro: nope, there are tools that transform mail into HTTP POST requests

12:18 pandeiro: there is also a pure Java mail server, it may have integration points: Apache James

12:19 pandeiro: antares_: 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:19 and treat the body as the POST data so-to-speak

12:20 antares_: 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:21 pandeiro: http://lamsonproject.org/

12:21 hiredman: ~subetha smtp

12:21 clojurebot: It's greek to me.

12:21 hiredman: ~google subetha smtp

12:21 clojurebot: First, out of 2430 results is:

12:21 subethasmtp - SubEtha SMTP is an easy-to-use server-side SMTP ...

12:21 http://code.google.com/p/subethasmtp/

12:22 pandeiro: antares_: hiredman: cheers

12:22 antares_: thanks hiredman, I did not know about that

12:26 pandeiro: looks like exactly what i am after; just gotta learn the API and make the wrapper :)

12:26 strange how enjoyable it is making clojure wrappers

12:29 dnolen: clojure.data ported to CLJS https://github.com/clojure/clojurescript/commit/77ef4f26e00149dfcfcb785cc1c59db82cd3d305

12:29 thanks to tomoj

12:36 antares_: for Langohr (or just RabbitMQ) users, the first Langohr doc guide is ready: http://clojurerabbitmq.info/articles/getting_started.html

12:39 technomancy: I'm a big fan of rabbit, but its concepts can be pretty hairy, so it's great to see docs around it; thanks!

12:40 uvtc: technomancy: Just a hare more fuzzy than hairy.

12:40 * technomancy winces a bit

12:52 antares_: uvtc: hi

12:53 uvtc: Oh, hi, antares_.

12:53 What do you think of the prospects of this https://github.com/uvtc/clojure-docs-collection ?

12:53 antares_: 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:54 uvtc: it needs a new name but I want to get it rolling soon

12:54 uvtc: ohpauleez: ^^ (my previous comment)

12:54 Name ideas?

12:54 technomancy: antares_: sweet

12:55 antares_: yeah I am frankly out of good ideas myself. clojure-docsite is the best I can come up with right now.

12:55 technomancy: so, if you need to introduce someone to rabbitmq, rubyamqp.info can be helpful even to people who do not use ruby.

12:55 ohpauleez: document-clojure

12:55 the project name is the exact action

12:55 uvtc: I kinda like the name I previously came up with for a different doc project: the alcove

12:55 antares_: doclojure

12:55 ohpauleez: and the true need

12:56 doclojure works: In order to do clojure, you need the right docs

12:56 doc clojure - as before, the action

12:56 uvtc: Err....

12:56 technomancy: best-case scenario: clojuredocs becomes actively maintained, covers more than just clojure itself, and becomes doc.clojure.org

12:56 antares_: technomancy: well, sure

12:56 ohpauleez: technomancy: That's indeed part of the proposal

12:56 antares_: technomancy: but reference docs is a minor part of what makes a language well documented

12:56 technomancy: but yeah, probably unrealistic

12:57 ohpauleez: to hook a clojuredoc system into the build process

12:57 antares_: guides are more important for most expertise levels

12:57 technomancy: yeah, and it would have to grow a tutorial/long-form side as well as just reference

12:57 ohpauleez: agreed on all of these points

12:57 technomancy: absolutely

12:57 ohpauleez: uvtc: How do you feel about doclojure?

12:57 uvtc: technomancy: an updated clojuredocs.org could always have a static docs area where it could grab hold of the docs at clojure-docs-collection.

12:57 clgv: oh what does that mean: "leiningen-2.0.0-preview10-standalone.jar: inflateFully: Unexpected end of stream"?

12:57 dakrone: ohpauleez: so the build process part can be done with https://github.com/dakrone/lein-clojuredocs for extraction

12:57 antares_: 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:58 uvtc: ohpauleez: I don't really like that name.

12:58 antares_: I think we should take a lot of ideas from docs.scala-lang.org for now

12:58 dakrone: just need something that takes the resulting json and does something with it

12:58 antares_: and absolutely must cover leiningen at least briefly

12:58 ohpauleez: antares_: Agreed, they seem to have it worked out pretty well

12:58 dakrone: Thanks! That's super helpful

12:58 antares_: ohpauleez: I also know the person who leads their doc updates, kinda

12:59 but I doubt we should just take their repo and modify it

12:59 dakrone: webapp programming is not my strong point

12:59 seneth: Why this does not print anything to the output stream (map #(print (str % "\r\n")) '(1 2 3))? A normal (print "works") does print.

13:00 TimMc: What's happening with clojuredocs, anyway? Does the maintainer just not have enough time to maintain it, or interest, or what?

13:00 hiredman: ~map

13:00 clojurebot: map is slightly retarded

13:00 hiredman: ~map

13:00 clojurebot: map 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:00 hiredman: ~map

13:00 clojurebot: map 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:00 hiredman: clojurebot: jerk

13:00 clojurebot: you cut me deep, man.

13:00 technomancy: dakrone: a lot of it is just static site generation though. less webapp programming and more "emitting HTML"

13:00 antares_: TimMc: we don't know. I think we need to find out that soon, too.

13:01 I doubt updating clojuredocs for 1.4 will be that hard

13:01 dakrone: TimMc: the true maintainer is MIA, I have privileges to the repos and databases

13:01 TimMc: seneth: Map is lazy. That may or may not do anything unless you realize the whole seq.

13:01 antares_: but we need to have access

13:01 oh, nice

13:01 dakrone: technomancy: true, but in order to mimic example adding, would require that

13:01 seneth: Is there any map fn that is eager

13:01 antares_: seneth: (doall (map …))

13:01 TimMc: seneth: doseq is probably what you want

13:02 dakrone: antares_: updating for 1.4 is actually very difficult with the way the database is lain out

13:02 ohpauleez: My 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:02 and pull it under our umbrella

13:02 antares_: dakrone: hm, ok. Would you recommend to start from scratch?

13:02 dakrone: antares_: that's why I started work on an extractor to extract to json (lein-clojuredocs)

13:02 ohpauleez: or

13:02 antares_: dakrone: I see

13:02 ohpauleez: help the maintainer out and use iframes

13:03 dakrone: what we actually need is something to import the json into

13:03 antares_: so, who wants to help with doclojure?

13:03 (I do)

13:03 dakrone: and then I can work on a migration tool to migrate the existing examples over from mysql -> whatever

13:03 ohpauleez: I'm hear to help out

13:03 uvtc: ohpauleez: I see API reference docs as separate from long-form prose-style topical-guide docs. Clojuredocs covers the former.

13:03 antares_: people with CSS skills are super welcome

13:03 ohpauleez: uvtc: I do too, but embedding links to a system like that within long form would be nice

13:03 dakrone: uvtc: agreed, a more wiki-style page per fn is helpful

13:04 technomancy: dakrone: the problem is not so much updating the DB as it is making schema support multiple versions, right?

13:04 antares_: dakrone: is mysql not working well? Riak sounds like a pretty good choice for such a site

13:04 uvtc: can you please add ohpauleez, dakrone, technomancy and myself to doclojure?

13:04 technomancy: for the volume and traffic of a site like clojuredocs you could use pretty much any DB

13:04 antares_: I have some index page UI ideas that won't take long to implement

13:04 dakrone: antares_: mysql itself is fine, but the schema was not well planned

13:05 antares_: dakrone: I see. Maybe migrating to PG would be a good idea, to host it on heroku.

13:05 dakrone: antares_: well, the schema wasn't planned well for multiple clojure versions

13:05 ohpauleez: antares_: Since you have a working process and I assume build tools, do you mind taking the lead on that

13:05 dakrone: plus it was all ruby, so activerecord stuff

13:05 uvtc: One 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:05 ohpauleez: and then once we have the template and build piece in place, it's just writing, reviewing, etc

13:06 doc-clojure?

13:06 technomancy: could possibly use doc.clojure.net =)

13:06 dakrone: antares_: ohpauleez: uvtc: I don't mind maintaining the extractor and lein plugin for it (the lein-clojuredocs part)

13:06 antares_: ohpauleez: I can set up a clojurewerkz.org repo, if uvtc agrees we should start from our docslate

13:06 dakrone: but unfortunately as what's been shown, I don't have enough time to organize a rewrite

13:06 uvtc: antares_: what's your github username?

13:06 antares_: dakrone: we initially won't touch clojuredocs, although your help with it would be awesome

13:07 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:07 uvtc: michaelklishin

13:07 ohpauleez: dakrone: 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:07 uvtc: antares_: oh, right, of course.

13:07 dakrone: would people be interested in #clojuredocs ?

13:07 technomancy: clojuredocs is valuable for brand recognition as much as for the existing implementation =)

13:07 antares_: dakrone: I am thinking about a separate maililng list

13:08 ohpauleez: also, I agree with the above statement, clojuredocs is more than fine for now

13:08 antares_: is a separate mailing list a good idea?

13:08 dakrone: antares_: mailing lists are nice, but slow

13:08 I was thinking both

13:08 ohpauleez: agreed, no need for a separate list

13:08 antares_: dakrone: oh, it's not mutually exclusive with #clojuredocs

13:08 but ok

13:08 ohpauleez: traffic on Clojure related to our efforts is good for our efforts :)

13:08 antares_: true

13:09 dakrone: just somewhere to discuss actual implementation details though, would be nice

13:09 antares_: another question

13:09 We can use Clojure-based tools for doclojure or just go with Jekyll

13:09 dakrone: ohpauleez: sure, I'm willing to skype/chat/whatever and help out wherever I can

13:09 antares_: I personally am totally happy with jekyll

13:09 ohpauleez: dakrone: Good point, I'm up for another IRC channel. re:help Thanks!

13:09 antares_: clojurewerkz.org is jekyll all the way, 10 sites or so

13:09 ohpauleez: throw it to a vote

13:10 antares_: does clojurebot support voting yet :)

13:10 ohpauleez: I 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:10 technomancy: I 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:10 uvtc: antares_: 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:10 antares_: uvtc: docslate is .md files + basic tools to build them

13:11 dakrone: well I'm in #clojuredocs too if anyone would like to join and discuss things

13:11 antares_: and it can use embedded examples, well, with a bit of modification

13:11 pisketti: Are there any visual test runners or report generators for Clojure? I'd be grateful for links and tips

13:11 danenania_: 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:11 pisketti: Ideally with leiningen test plugin

13:11 uvtc: antares_: 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:12 ohpauleez: (thanks for adding my uvtc )

13:12 dgrnbrg: Hello clojurians!

13:12 antares_: 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:12 uvtc: I am not against that

13:12 dgrnbrg: I'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:13 antares_: 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:13 danenania_: 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:14 technomancy: danenania_: most github projects are libraries that don't have a :main entry because it just wouldn't make sense

13:14 antares_: 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:14 danenania_: what repos are those? are they apps? maybe they are just libraries?

13:15 uvtc: what if I just modify docslate to do what you want?

13:15 danenania_: 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:15 ohpauleez: antares_: 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:15 uvtc: antares_: 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:15 antares_: uvtc: and we go from there? it is .md + a bit of HTML for the layout

13:15 ohpauleez: then we can just use mkd files and build using the rest of the ecosystem

13:15 antares_: uvtc: it uses /article in the URLs

13:15 danenania_: antares_: clojurescript_one, async_noir_chat

13:15 antares_: uvtc: of course, we can use any URL scheme we want

13:15 danenania_: they are apps i believe

13:15 not libs

13:16 lein deps also doesn't work

13:16 technomancy: danenania_: clojurescript one is a bit crazy

13:16 uvtc: antares_: 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:16 whitaker: Anyone else watching the MongoDB 2.2. conference now? http://www.justin.tv/mongodb#/w/3834026336 (looking at using Clojure Monger at work)

13:16 antares_: danenania_: https://github.com/andrewvc/noir-async-chat has :main and if it does not work, it means the READMe is outdated

13:17 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:17 uvtc: so, the site structure is not dictated by docslate in any way

13:17 whitaker: antares_: super! much appreciated.

13:18 antares_: whitaker: that conf mentions monger somehow? I did not know

13:18 danenania_: techonomancy: i'm looking for a project that will show me an example of how to integrate clojure, clojurescript, and sockets... any suggestions?

13:18 antares_: 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:18 danenania_: I have one but it's not OSS :(

13:18 danenania_: antares: "git clone git://github.com/andrewvc/noir-async-chat.git && cd noir-async-chat && lein run" yields the missing repo error

13:18 whitaker: antares_: not yet, I'm hoping to bring it up in a Q&A session

13:18 antares_: and it does not use CLJS, only websockets + Web app

13:18 technomancy: danenania_: never used clojurescript, sory

13:19 antares_: whitaker: ah, ok. 10gen folks know about Monger (well, at least some) and helped us with suggestions and promoting it

13:19 danenania_: antares_: at this point, i'd just be happy to get a new project running

13:19 of any kind :/

13:20 uvtc: antares_: 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:20 whitaker: antares_: good to have that informal partnership

13:22 danenania_: technomancy_: any ideas on the maven repo not found stuff? i'm getting it on any project i try to run

13:23 antares_: danenania_: do you mind posting the exception to github?

13:24 danenania_: projects that are maintained usually have all the repos necessary in project.clj

13:24 dgrnbrg: I'm seeing in leiningen2 preview10 that the hooke injections aren't occurring. How can I determine what's going on?

13:24 antares_: danenania_: also, do you use lein2?

13:25 uvtc: you can have dir structure matching HTTP resources or not, it is all configurable

13:25 uvtc: can you please join #clojuredocs?

13:25 danenania_: antares_: will do. nope, i'm on 1.7.1

13:26 https://gist.github.com/3757185

13:27 technomancy: dgrnbrg: I think hooke is now only injected by tasks that use it

13:27 dgrnbrg: which is currently limited to test

13:27 dgrnbrg: technomancy: how can I force hooke to be injected?

13:28 I was relying on injected hookes for my code coverage plugin

13:28 danenania_: antares_: any of that make sense to you?

13:28 hfaafb_: is this the intended behavior of zipmap? https://gist.github.com/1e1801238e27ad809776

13:28 technomancy: dgrnbrg: (update-in project [:injections] conj leiningen.core.project/hooke-injection) ; <- pass that to eval-in-project

13:29 actually that won't work since hooke-injection is private

13:30 dgrnbrg: you'll probably want to construct your own injection form anyway in case leiningen changes

13:30 danenania_: antares_: looks like i'm getting the same error from "lein update"

13:30 dgrnbrg: technomancy: got it--i suppose I'll just copy lein's code for now

13:30 danenania_: what's the best way to completely clear out lein and start over? seems like mine is screwy

13:30 antares_: danenania_: do you have ~/.m2/settings.xml by any chance?

13:31 TimMc: hfaafb_: Yes. Maps can't have duplicate keys.

13:31 antares_: danenania_: well, noir-async/noir-async cannot be found on clojars

13:31 technomancy: danenania_: according to that paste it looks like you can't reach clojars; probably a network issue

13:31 danenania_: technomancy_: i'm just on a normal home network...

13:31 hfaafb_: is there a zip... vector? :3c

13:32 danenania_: antares_: ~/.m2/settings.xml not found

13:32 S11001001: hfaafb_: map and vec

13:32 technomancy: danenania_: well, it's saying it can't reach clojars, so I don't think clearing out is going to help.

13:34 danenania_: technomancy_: i see... is that any other alternative to get going?

13:34 S11001001: hfaafb_: if you are haskellian, map is more like arbitrary liftAn on the ZipList applicative functor, than it is like functor map

13:34 danenania_: there*

13:34 technomancy: not really any alternative; if you can't reach clojars you can't do much

13:34 `fogus|away: ,(map vector "there" "three")

13:34 clojurebot: ([\t \t] [\h \h] [\e \r] [\r \e] [\e \e])

13:34 hfaafb_: woah coo

13:34 l

13:35 technomancy: danenania_: better to upgrade to the latest lein2 though

13:36 hfaafb_: thanks

13:50 technomancy: heh; parsatron's namespace is the.parsatron

13:51 Cheiron: Hi, 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:52 whitaker: antares_: 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:53 antares_: whitaker: that's fine, some people just don't care about little details like that

13:53 whitaker: antares_: "little details…"

13:54 antares_: whitaker: compared to lock yielding improvements, the terminology is a small detail, for conference attendees anyway :)

13:54 whitaker: heh

13:55 technomancy: gotta learn to walk before you can run?

13:55 Hodapp: I'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:55 pandeiro: technomancy: how can i ensure lein downloads the maven index?

13:55 i am doing lein search and it returns no results for anything i try

13:55 technomancy: pandeiro: on the latest preview?

13:56 antares_: Hodapp: most developers simply don't have experience with distributed systems yet, at least parallel distributed processing

13:56 pandeiro: 10?

13:56 antares_: pandeiro: 10 is the latest

13:56 technomancy: Y U NO IN #clojuredocs

13:56 pandeiro: i am using 10

13:56 technomancy: pandeiro: 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:57 pandeiro: 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:59 whitaker: Hodapp: http://blip.tv/clojure/david-liebke-from-concurrency-to-parallelism-4663526

14:00 ystael: hugod: 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:00 nothing comes back in the repl, and the minibuffer says "nrepl-dbg-setup 1"

14:01 Cheiron: i'm launching my compojure application with lein ring server but why changes to code isn't taking effect?

14:01 antares_: technomancy: I think most of mongodb users want to fly, immediately, without taking any classes, all the way to Neptune

14:01 pandeiro: technomancy: but should `lein search clojure` return nothing?

14:01 antares_: technomancy: learning to walk is for old school folks

14:01 danenania_: 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:02 technomancy: pandeiro: hm; no that must be something else broken =\

14:02 antares_: danenania_: hm, you probably have used sudo once nad it has created ~/.lein as root or something

14:02 technomancy: pandeiro: 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:03 antares_: sounds about right re: walking =D

14:03 pandeiro: technomancy: gotcha, np

14:04 technomancy: pandeiro: happy to get some help on this if you have some cycles

14:06 pandeiro: technomancy: i am starting at 0 myself with lucene and have never even looked at lein's source ::shame::

14:07 but 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:07 (for me, i mean)

14:08 technomancy: pandeiro: 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:08 since they switched to a much more complicated system of sharded incremental indices that you have to merge client-side

14:11 pandeiro: technomancy: 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:11 i realize rebuilding the index is probably not an option though

14:11 technomancy: yeah, our hands are tied here

14:11 still, we can do a lot better with what we have

14:12 it's all still lucene under the covers

14:12 pandeiro: so lein doesn't use clucy or anything?

14:12 technomancy: it used to

14:12 but once they dropped the full indices we had to switch away since it doesn't work with the incremental indices

14:13 Cheiron: hi guys, any fella used Liberator REST toolkit?

14:13 *uses

14:15 thorbjornDX: omg, 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:26 rbxbx: thorbjornDX yes :)

14:30 thorbjornDX: rbxbx: :)

14:31 rbxbx: 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:32 naeg: rbxbx: you were wondering about a logic solution to conways, right?

14:38 rbxbx: naeg that's correct, did you come up with one?

14:38 naeg: rbxbx: I'm working on it. Having troubles with core.logic (and my mindset)

14:39 rbxbx: cool. I didn't take a stab at it at all :(

14:39 I did find a prolog first of hanoi though that probably wouldn't be too difficult to port :)

14:39 naeg: here's what I have so far: http://bpaste.net/show/RtdJO8GkdJAMVFxqMHCe/

14:39 rbxbx: prolog version* that is

14:40 naeg: but it's 1. not working 2. not finished (death by being overcrowded is missing)

14:40 rbxbx: 'l is just a reference to core.logic?

14:40 naeg: both 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:41 rbxbx: haha

14:41 Well at least you tried :)

14:41 Better than I

14:41 dnolen: naeg: I took a look at your code - you're going into the dep end :)

14:41 rbxbx: Thanks for sharing your results.

14:41 naeg: oh yeah, the namespace is: (ns life (:require [clojure.core.logic :as l]))

14:41 dnolen: naeg: the 0.8.0 are not ready

14:41 naeg: dnolen: "dep end"?

14:42 dnolen: "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:42 naeg: dnolen: I tried it with 0.7.5 and had a similar issue with it...can't remember exactly though

14:43 actually used 0.8alpha3 because of infd (wanted to use that instead of membero in neighbouro)

14:43 and iirc 0.7.5 also doesn't have !=

14:44 dnolen: naeg: it does

14:44 naeg: but it doesn't define distincto, which you can easily do yourself.

14:45 naeg: oh so that was missing. yeah, either define it myself or use three !=

14:45 I'm trying it on 0.7.5 again...

14:46 dnolen: naeg: 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:46 naeg: dnolen: I tend to try to come up with my own solution first before I search the web

14:52 dnolen: now I remember the problem with 0.7.5. it seemed to ignore my !=

14:53 http://bpaste.net/show/5PsT3YzyLOw1Lb3CpAYm/

14:56 rbxbx: None of the prolog solutions I saw seemed particularly elegant.

15:01 pisketti: Can 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:01 Ie. i'd like to have a green bar :)

15:01 rbxbx: pisketti what are you using for testing?

15:02 pisketti: I'm just running the test suite in leiningen

15:02 It's a noir project

15:02 rbxbx: with just the basic clojure unit test library?

15:02 pisketti: yes

15:02 at least for now

15:03 I've been flirting with midje but currently just clojure.test

15:03 I'm thinking something like the Jasmine specrunner for JavaScript

15:04 rbxbx: perhaps 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:04 pisketti: or your average junit plugin for your favourite IDE

15:04 rbxbx: It seems like you'd just have to override the `report` function

15:04 pisketti: hmmm, okay. I'll take a look

15:05 Thanks

15:05 rbxbx: Yeah, unfortunately in this instance I'm not sure that you'll find an out of the box solution.

15:05 Though maybe counterclockwise or intellij do better reporting with clojure.test? I don't know.

15:05 Cheers!

15:06 pisketti: ok, well I was hoping that there was a solution but oh well

15:14 muhoo: old 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:17 netbook + java = nap time.

15:21 gtrak: mapv vs doall/dorun/doseq?

15:23 brainproxy: if 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:23 should be a good time: lots of local devs, free food, a pub downstairs :)

15:26 pandeiro: muhoo: welcome to my world

15:26 muhoo: i hope you're not compiling cljs

15:28 muhoo: pandeiro: hehehe, i have, and it was painful, but not at the moment

15:29 gtrak: laziness?

15:29 gtrak: mapv's also not lazy?

15:29 dnolen_: gtrak: how can mapv be lazy if you get a vector back?

15:30 muhoo: &(doc mapv)

15:30 lazybot: ⇒ "([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:30 gtrak: i know it's not lazy

15:30 I'm just wondering if it makes sense to use for side-effects, for composition and such

15:31 for instance, map/compose functions containing (is ..) for testing

15:33 I'll show an example: https://gist.github.com/3757861

15:33 muhoo: does mapv hold on to th head? i dunno.

15:33 gtrak: something about it tells me it's gross, but it's cleaner than alternatives

15:35 emezeske: gtrak: If you really want side effects, why not use doseq?

15:35 muhoo: o 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:35 dnolen_: muhoo: head holding only makes sense in the context of laziness

15:35 uvtc: Strings often act like seqs, for example,

15:36 ,(for [i "hello"] (str "-" i "-"))

15:36 clojurebot: ("-h-" "-e-" "-l-" "-l-" "-o-")

15:36 uvtc: but why not here:

15:36 ,(shuffle "hello")

15:36 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Collection>

15:37 muhoo: &(shuffle (seq "hello"))

15:37 lazybot: ⇒ [\l \e \l \o \h]

15:37 uvtc: muhoo: Yes, that worked for me, but I'd thought that the `seq` call shouldn't be necessary...

15:37 gtrak: emezeske: mapv, comp, partial... are very nice

15:38 that's the only reason, I just want something that looks like mapv but acts like doseq

15:38 muhoo: so 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:40 uvtc: interesting ##(mapv (partial str "-") "bar")

15:40 lazybot: ⇒ ["-b" "-a" "-r"]

15:41 emezeske: gtrak: In the gist you posted, I don't really see any advantage to using those instead of doseq.

15:42 gtrak: It seems like a kind of abuse of map, which is supposed to "map" from one domain to another

15:42 gtrak: You're not using it to map anything

15:42 uvtc: ,(for [c "bar"] (str "-" c))

15:42 clojurebot: ("-b" "-a" "-r")

15:43 gtrak: yea, I suppose I could switch to doseq everywhere

15:44 emezeske: gtrak: There's no reason you couldn't make a "doeach" function that took arguments like map and doseq'ed them

15:44 gtrak: If you like that notational style

15:44 gtrak: yea

15:44 scriptor: emezeske: can't you just think of the string as the original domain?

15:45 emezeske: scriptor: Huh?

15:45 gtrak: scriptor: I wasn't playing with strings, I think he was replying to my abuse of it for testing

15:45 scriptor: ah

15:45 emezeske: scriptor: In that snippet, all the map call's return values are just thrown away

15:46 scriptor: That's what I meant when I said it wasn't being used to map things

15:46 scriptor: ah, sorry, I mixed up nicks

15:46 muhoo: heh, domap maybe. has semantics of map but is really doseq and throws away results.

15:46 emezeske: scriptor: Oh, heh :)

15:46 muhoo: It shouldn't have map in the name if the result is thrown away.

15:47 muhoo: good point

15:47 emezeske: muhoo: IMHO

15:47 gtrak: I guess doseq isn't so horrific :-)

15:47 muhoo: unless you're going for golf.

15:48 (map println "bar") is more concise than (doseq [s "bar"] (println s)), i guess

15:49 gtrak: yea, the advantage goes away if you define a function

15:50 amalloy: muhoo: but one of them does something and the other doesn't :P

15:50 (dorun (map println "bar")) is about as long as the doseq

15:50 gtrak: just use mapv :-)

15:50 muhoo: mapv not map, ya

15:50 gtrak: haha

15:50 hiredman: I think we just had this argument in our work irc channel the other day

15:51 jkkramer: doseq also signals to the reader that side effects are happening

15:51 hiredman: or something close

15:51 amalloy: hiredman: in a language without curly braces, we have to find something stupid to wage wars over

15:51 muhoo: indenting!

15:52 amalloy: nope. global accord on that

15:52 jkkramer: lists vs vectors in :require

15:52 muhoo: package naming is always a good one

15:52 hiredman: nah, everyone knows vectors are correct (except for cemerick)

15:52 scriptor: jkkramer: how does it signal the reader? *visually* you can tell that side effects are being used

15:52 but I don't think the clojure compiler does anything special, does it?

15:52 * emezeske isnt' in accord with the global indentation plan.

15:53 cemerick: hiredman: read the docstring, man! :-P

15:53 scriptor: there's partials vs short-hand fns

15:53 ystael: to -> or not to -> ?

15:53 amalloy: scriptor: you, the reader

15:53 jkkramer: scriptor: in most clojure coders' brains, doseq prompts the thought "side effects here!". mapv does not

15:53 scriptor: ah, that reader

15:54 cemerick: amalloy: closing parens on their own line or not! :-D

15:54 jkkramer: ah, yes, _a_ clojure reader, not _the_ clojure reader ;)

15:54 pjstadig: the CA

15:54 boom!

15:54 muhoo: that'd be a fun talk for a conj: clojure flamewar bait. list all the annoying things people can argue about

15:55 cemerick: pjstadig: that already happened this week

15:55 pjstadig: has it been 3 and 1/2 weeks since the last CA discussion

15:55 damn

15:55 scriptor: it was even on irc this morning

15:55 cemerick: Up to a rolling 10 hour cycle now, eh?

15:55 gtrak: guys I just hate that there's so much java in clojure

15:56 emezeske: Does talking about talking about the CA count as talking about the CA?

15:56 gtrak: not a proper lisp ;-)

15:56 muhoo: hahahaha

15:56 technomancy: guys I realized that the fact that clojure code uses vectors and maps means that it's not homoiconic

15:57 because as you know the word "homoiconic" comes from the Latin "same as Common Lisp"

15:57 pjstadig: technomancy: good point

15:57 Hodapp: technomancy: THAT'S GREEK YOU INSENSITIVE CLOD

15:57 technomancy: hahaha

15:57 Hodapp: Greek, as you know, was considered the language of the educated in Roman days.

15:58 so Latin texts often pilfered from it freely.

15:58 scriptor: ooh, but icon is from latin

15:58 pjstadig: technomancy: actually I thought Lisp came frome the Latin meaning "same as Common Lisp"

15:58 gtrak: I can't believe a lisp in 2008 doesn't have tail recursion...

15:58 Raynes: I can't believe you care.

15:58 Hodapp: scriptor: It's Latin stolen from the Greek 'eikon' image, 'eikenai' to be like

15:58 noidi: is there an alternative to with-open to which I could provide my own close fn?

15:59 gtrak: Raynes: I don't actually :-), we were talking about flame war topics

15:59 muhoo: much of roman culture was lifted from the greeks

15:59 Raynes: gtrak: I don't read backlog. I hop in and take things out of context. That's my thing.

15:59 scriptor: Hodapp: okay, so now we're just totally ignoring PIE speakers?

15:59 * muhoo shouts "what have the greeks ever done for us?" in latin

15:59 gtrak: Raynes: haha, perfect for this discussion

16:00 scriptor: I'm picturing rich jumping on irc, seeing the discussion, and then switching to Scala

16:01 amalloy: i regret my decision to instigate this war

16:01 gtrak: though now that I'm playing with MIT scheme, it is interesting to see the different of stuff like 'let'

16:01 interesting to see the different semantics* of...

16:01 technomancy: noidi: I think you can proxy Closeable

16:02 amalloy: technomancy: s/proxy/reify?

16:02 technomancy: amalloy: well, I only _suspect_ you can reify Closeable. I'm nearly certain you can proxy it.

16:02 amalloy: i'm certain of both

16:02 Hodapp: "Is Scheme the one true Lisp? Tune in for the shocking result."

16:02 technomancy: cool

16:03 uvtc: pjstadig: "insensitive clod!" ... nice, digging into the archives. :)

16:03 technomancy: amalloy: I did it back before reify existed.</hipster>

16:03 Hodapp: uvtc: pffft, that was me

16:03 amalloy: man, if Closeable were an abstract class...it'd be clear evidence that sun didn't learn anything between 1.0 and 1.5

16:03 cemerick: technomancy: I did it back when proxy was `instance`.</oldguy>

16:04 uvtc: Hodapp: Ooof! I'm the insensitive clod!

16:04 technomancy: amalloy: and? =)

16:04 noidi: technomancy, yeah, I know, but that's more work than just using try-finally by hand :P

16:04 amalloy: technomancy: the collections library is good evidence that they actually did

16:04 muhoo: isn't with-open just a try/catch/finally thing under the hood anyway?

16:05 technomancy: muhoo: yeah, but you might not control the code that calls with-open

16:05 amalloy: and also it's a bit fiddly to write by hand; you can easily make mistakes

16:11 gtrak: (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:12 amalloy: is...is there some reason you would reimplement 'last?

16:13 gtrak: ...dammit :-)

16:14 that simplifies it

16:14 Raynes: amalloy is a pretty cool guy, eh makes people feel stupid all the time and doesn't afraid of anything.

16:15 gtrak: amalloy: because I never use last, I suppose

16:16 but 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:16 which is why I ask you people

16:16 scriptor: hmm, since map is lazy, the only thing that's actually forcing the side effects is last, right?

16:16 gtrak: yea

16:16 amalloy: when you do it with a side effect there's a better way too - use dorun instead of writing domap :P

16:17 Hodapp: The meme award goes to Raynes.

16:17 gtrak: dorun returns nil

16:17 uselessly

16:17 scriptor: would it be less idiomatic to just recur through the list manually and then return the last element?

16:18 Raynes: gtrak: That isn't always useless.

16:18 gtrak: yea.. it makes sense for dorun to not hold on to an object

16:18 Raynes: &(doc doall)

16:18 lazybot: ⇒ "([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:19 casion: lazybot posts a new refheap paste everytime?

16:19 or does it cache them?

16:20 Raynes: It pastes every time.

16:20 casion: I guess you're free to abuse it however you want :P

16:20 Raynes: I… guess?

16:21 gtrak: time to privmsg lazybot

16:21 Raynes: If that gets anyone's jollies off, who am I to judge.

16:21 casion: just kidding, people in other channels whine about repeated pastes

16:21 so I guess it was an inside joke completely unrelated to this channel

16:21 * casion sneaks out the door

16:21 TimMc: Raynes: Deuplicating pastebin!

16:22 Raynes: It could cache pastes, but anything side-effecty would blow that to hell.

16:22 TimMc: Do it.

16:22 amalloy: &(range 500000)

16:22 muahahahahaha

16:22 lazybot: ⇒ (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:22 gtrak: it didn't paste?

16:22 Raynes: But I guess the whole point of clojail is to prevent side effects that would cause this sort of issue.

16:22 amalloy: gtrak: refheap has a size limit

16:23 gtrak: &(last range)

16:23 lazybot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.core$range

16:23 Raynes: inb4timeout

16:24 grettke: Does 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:25 casion: grettke: what OS are you using

16:25 grettke: casion: Windows

16:26 casion: I had been using inferior-lisp process before

16:26 technomancy: if you don't want to work on a project, you don't need one for an nrepl session

16:26 casion: grettke: are oyu using nrepl.el?

16:28 tos9: Is lein itself supposed to take 5 seconds to start itself up? Just running `lein` takes 5 seconds to (slowly) print the usage info.

16:28 casion: if you install nrepl.el from marmalade, you should be able to just nrepl-jack-in and be going

16:28 xeqi: tos9: it has to read all of the namespaces for tasks and plugins for that case

16:28 thorbjornDX: tos9: lein can be slow to start up, and I believe `lein help` is the slowest of all operations

16:28 xeqi: its a worst case there

16:29 tos9: A 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:30 grettke: casion: Yes, I got it from Marmalade repo

16:31 tos9: I had done a maven clojure:repl with inferior lisp and that sure takes 5s to start lol

16:31 tos9: Ah I see some posts on the clojure ML for slow lein startup, guess I'd better read those.

16:31 grettke: Heh

16:32 casion: grettke: and you have lein working and clojure-mode… can you just nrepl-jack-in?

16:32 gtrak: is 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:33 grettke: casion: I didn't set up lein yet, I see I also didn't define $SHELL

16:33 xeqi: cemerick: thanks for tweeting about valip the other day, finding it useful for clojar's validations

16:33 gtrak: ah, I guess clojure core assert checks the *assert* var

16:33 tos9: Making your code behave differently when under test is generally a bad idea

16:35 casion: grettke: well I can't help there on windows, sorry

16:35 hopefully someone else can

16:36 grettke: casion: thanks still

16:36 tos9: Ah 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:37 xeqi: grettke: I remember seeing someone mentioning the $SHELL thing on windows w/ emacs, but I can't find where :/

16:37 grettke: tos9: I was wondering if we could wrangle JRebel into a quick starting Clojure runtime/repl.

16:37 xeqi: something like, it is a common problem on Win?

16:45 technomancy: grettke: nothing is really common on Windows, not too few data points to perform reliable sampling

16:45 biscarch: Are comments used in autodoc?

16:46 grettke: technomancy: Understood. I don't do it to be special; Windows is just what is used at work :).

16:47 firesofmay: hi what is the replacement for clojure.contrib.string/substring? function in clojure 1.4?

16:48 amalloy: $findfn "abcd" 0 2 "ab"

16:48 lazybot: [clojure.core/subs]

16:48 rbxbx: firesofmay clojure.string/substring?

16:48 grettke: bless 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:48 amalloy: wow, findfn really got way slower

16:48 Raynes: But loads safer!1!

16:48 rbxbx: firesofmay https://github.com/richhickey/clojure-contrib/blob/bacf49256673242bb7ce09b9f5983c27163e5bfc/src/main/clojure/clojure/contrib/string.clj#L351

16:48 Raynes: Blame xeqi for screwing anything I ever do up.

16:49 firesofmay: rbxbx, thanks checking it.

16:49 rbxbx, that's pointing to clojure/contrib. isn't that deprecated?

16:50 amalloy: firesofmay: that is the worst advice he could have given you

16:50 rbxbx: doh. internet.

16:50 amalloy: scroll up and see lazybot's answer to your question

16:50 firesofmay: amalloy, oh missed that. thanks.

16:50 amalloy, :)

16:50 dansalmo: how 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:50 aperiodic: firesofmay: that's not what you want

16:51 you want the predicate, right?

16:51 firesofmay: aperiodic, yeah actually. i want a substing? checking function.

16:51 Raynes: &(subs "abc" 3344 3555)

16:51 lazybot: java.lang.StringIndexOutOfBoundsException: String index out of range: 3555

16:51 Raynes: amalloy: You're blind? I had no idea.

16:52 rbxbx: firesofmay 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:52 google/reading comprehension failure

16:52 apologies :)

16:52 firesofmay: rbxbx, no probs. :)

16:53 amalloy, aperiodic so do we have a function for substring? checking?

16:53 rbxbx: would re-find work?

16:53 aperiodic: firesofmay: i think this is a case where one falls back to java.lang.String: (def substring? [needle hay] (> (.indexOf hay needle) -1))

16:56 firesofmay: rbxbx, 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:57 rbxbx: That may be so, but until that day I guess dipping into java or being slightly hacky are your choices.

16:57 :|

16:58 firesofmay: rbxbx, yeah i'll go with aperiodic's solution for now. thanks guys :)

16:58 rbxbx: sorry again for the misguidance earlier, cheers!

16:59 jcromartie: OK what's the state of the art in XML parsing in Clojure

17:00 xeqi: Raynes: ohh, is findfn "safe" now?

17:00 Raynes: xeqi: Not to you. Nothing is safe for you.

17:01 konr_trab: is clojure.contrib deprecated?

17:01 gtrak: does clojure.test.is happen to use 'assert' from core?

17:01 firesofmay: konr_trab, yes

17:01 gtrak: in other words can I use it for things during testing that goes away when I'm not running in test-mode?

17:01 firesofmay: konr_trab, http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

17:05 juhu_chapa: Hello! I have several threads, all printing to *out*, is there a way to print lines atomically?

17:06 Raynes: Use a queue?

17:06 Agents, perhaps?

17:06 gtrak: juhu_chapa: locking?

17:07 Raynes: But 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:07 gtrak: locking is abusing the call stack to implement a queue

17:07 might be alright

17:07 hiredman: ,(doc locking)

17:07 clojurebot: "([x & body]); Executes exprs in an implicit do, while holding the monitor of x. Will release the monitor of x in all circumstances."

17:07 Raynes: I just said it in case it was the right answer so I could feel cool.

17:08 grettke: Do you guys load Paredit in the nREPL interaction mode?

17:08 juhu_chapa: Raynes: I am using agents ;)

17:08 gtrak: make 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:10 juhu_chapa: gtrak: that approach is faster than using queues?

17:10 gtrak: faster in the sense that I haven't used a queue before, it would take me longer to work out the details

17:10 juhu_chapa: gtrak: i see.

17:11 gtrak: but you can change it later without the calling code caring

17:11 juhu_chapa: why not just use clojure's logging functions? surely they can handle that

17:23 juhu_chapa: gtrak: it worked with logging!

17:23 gtrak: yay

17:23 it's almost as if someone else had a similar problem... xD

17:25 juhu_chapa: gtrak: thank you!

17:32 antagon: Hi guys! Anyone have any tips regarding how to TDD request building? I find it hard to test the correctness of my built queries...

17:33 nvm, wrong channel

17:37 amalloy: i'm kinda curious what channel he was aiming for now

17:37 Frozenlo`: Let's stalk him.

17:38 Frozenlock: In cljs, is there a way to use 'set!' but in the current namespace?

17:38 gtrak: quick! lazybot, join all the channels

17:39 Frozenlock: lazybot, attack!

17:39 tomoj: every time you use set!, you are in the current namespace :P

17:39 I mean, what do you mean?

17:39 Frozenlock: I 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:41 I think it looks ugly. And knowing clojure, this shall not be :P

17:41 tomoj: I still don't understand the allowable set! forms

17:42 Frozenlock: allowable?

17:42 tomoj: "allowed", I guess

17:42 gtrak: err.. how do I get the stacktrace of a failing test assertion?

17:44 Frozenlock: I don't follow... is there another way to achieve the 'set!' effect?

17:44 tomoj: Frozenlock: did you try (set! (.-getDragElementPosition (.-prototype ObjectDrag)) some-fn) ?

17:44 Frozenlock: I don't think I have, let me try that.

17:46 tomoj: Can I kiss you?

17:47 * Frozenlock kisses passionately tomoj

17:47 dnolen_: tomoj: thanks for the clojure.data patch

17:48 tomoj: thanks for getting it through

17:49 btw, 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:49 as sort of a stopgap

17:49 s/perf/code/

17:49 dnolen_: tomoj: what are you thinking of doing?

17:51 tomoj: only 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:51 then binding has to stick that state in so is slower

17:52 but access is just the same

17:56 dnolen_: 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:56 tomoj: overhead of a stopgap or of reified vars?

17:58 dnolen_: tomoj: heh actually would require multiple passes - probably not a avenue worth pursuing yet.

17:58 tomoj: but yeah a simple solution for supporting bound-fn w/ reifying vars sounds interesting.

17:59 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:59 perf numbers.

18:00 tomoj: I guess for something like that you create separate jsperf pages?

18:01 dnolen_: 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:02 tomoj: aha

18:29 thorbjornDX: if I end up with a seq of seqs of seqs should I rethink something?

18:30 I guess that's not a very specific question :p

18:31 Iceland_jack: it 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:32 thorbjornDX: Iceland_jack: yeah, I have to give my architecture some thought.

18:32 aperiodic: thorbjornDX: if you find yourself tempted to use flatten then yeah, you should rethink things

18:32 Iceland_jack: ↑ what aperiodic said

18:33 amalloy: right, there's nothing wrong with a seq of seqs of seqs, or a map of maps of maps, or...

18:33 thorbjornDX: aperiodic: gotcha. I ended up with a list comprehension within another list comprehension, and that's where the trouble started

18:33 amalloy: so long as all the layers are there for a purpose

18:33 thorbjornDX: amalloy: they aren't in this case, since I"ll end up just mapping a single fn to the seqs

18:34 aperiodic: you should throw a mapcat in there, then

18:34 amalloy: thorbjornDX: then instead of (for [ys xs] (for [y ys] y)), you wanted (for [ys xs, y ys] y)

18:35 thorbjornDX: amalloy: 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:35 amalloy: give me a sec to type out an example

18:39 ,(for [m '({:count 1} {:count 2} {:count 3}) iter (range (:count m))] [m iter])

18:39 clojurebot: ([{:count 1} 0] [{:count 2} 0] [{:count 2} 1] [{:count 3} 0] [{:count 3} 1] ...)

18:40 amalloy: okay...

18:40 thorbjornDX: amalloy: 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:40 amalloy: sorry for the toy example, it's pretty simplified

19:02 I 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:09 aperiodic: no. you should just bind it in a let that wraps your list comprehension

19:09 or, in this case, inside your list comprehension

19:10 (for [d ds] (let [p (:mykey d)] ...))

19:10 thorbjornDX: aperiodic: how do I get around having a second sequence within my list comp?

19:11 aperiodic: thorbjornDX: i don't follow

19:12 thorbjornDX: this is sort of what I have now: (for [d ds r (range (d :r))] [d r])

19:13 aperiodic: I do this to avoid having to use map or for within the 'let' binding that you suggested

19:14 aperiodic: thorbjornDX: that seems fine. there are no superfluous vectors in your for bindings there

19:15 tomoj: thorbjornDX: weird, I am working on an example almost exactly like that

19:15 thorbjornDX: tomoj: I think I'm just getting around using 'mapcat' by being smarter about my list comprehension

19:17 tomoj: for some reason it seems strange to use 'd' in the list comprehension vector itself

19:17 tomoj: agree with aperiodic here, that is perfectly normal

19:17 thorbjornDX: aperiodic: I'm seeing clearly now, thanks for your feedback :)

19:18 aperiodic: thorbjornDX: no problem!

19:21 amalloy: thorbjornDX: (for [d someseq :let [p (:mykey d)] ...] ...)

19:21 tomoj: hmm, is this impossible? https://gist.github.com/64b2b23a303537f97015

19:21 thorbjornDX: amalloy: ah, is that the same as (for [d ds] (let [p (:mykey d)] ...) ?

19:22 amalloy: only if you don't have further stuff in the for-binding

19:22 aperiodic: oh, neat

19:22 thorbjornDX: amalloy: okay, I'll put that one in my toolbelt

19:24 amalloy: tomoj: i don't see why that would be impossible

19:25 but i don't totally see what's going on either, so maybe it is

19:27 tomoj: it seems like I have to pass something like (r/map #(get-in % [:range]) coll) to (r/mapcat (partial apply range))

19:27 but then I can't tell how to assoc-in the results back into the original map

19:32 not sure that operator is even very useful..

20:12 ohpauleez: Does anyone know if it's possible for Ring's jetty adapter to read a conf file for Jetty?

20:12 for example, if I place it in `resources`

20:19 Hodapp: what'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:20 emezeske: Hodapp: partition

20:21 rbxbx: ,(partition 2 [1 2 3 4 5 6)

20:22 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: )>

20:22 rbxbx: ,(partition 2 [1 2 3 4 5 6])

20:22 clojurebot: ((1 2) (3 4) (5 6))

20:22 Hodapp: thanks

20:26 tomoj: dnolen: bbloom's patch no longer applies, unfortunately. it was before the analyzer/compiler split

20:30 since 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:33 antagon: ,(+ 1 1)

20:34 clojurebot: 2

21:13 Frozenlock: That'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:13 TimMc: laziness?

21:13 clojurebot: laziness is hard

21:14 TimMc: and for generates a result, whereas doseq does not

21:14 Sgeo: Frozenlock, for won't actually do the side-effects

21:14 Until you try to get values out of its result

21:15 ,(for [i (range 10] (prn i)) ; does nothing

21:15 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unmatched delimiter: ]>

21:15 Sgeo: ,(for [i (range 10)] (prn i)) ; does nothing

21:15 clojurebot: (0

21:15 1

21:15 2

21:15 3

21:15 4

21:15 5

21:15 Sgeo: Um

21:15 tomoj: :D

21:15 clojurebot: 6

21:15 7

21:15 8

21:15 9

21:15 nil nil nil nil nil ...)

21:15 Frozenlo`: Nice :P

21:15 metellus: REPLs and bots can be misleading about laziness

21:15 tomoj: ,(do (for [i (range 10)] (prn i)) nil)

21:15 clojurebot: nil

21:15 Sgeo: ,((constantly 'beep) (for [i (range 10)] (prn i))) ; does nothing

21:15 clojurebot: beep

21:16 Sgeo: ,((constantly 'beep) (doseq [i (range 2)] (prn i))) ; does nothing

21:16 clojurebot: 0

21:16 1

21:16 beep

21:17 Sgeo: Um, ignore that comment on the last one, I was ... er, lazy

21:17 tomoj: dnolen: is it acceptable to make set! a macro and set!* a special?

21:17 Hodapp: immutability is messing with my head! or... is it more like withdrawal symptoms from mutability?

21:17 tomoj: seems unlikely..

21:18 amalloy: tomoj: probably not. if you did that with fn*, inventing a new fn**, code-walkers that macroexpand would break

21:20 Frozenlo`: 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:21 tomoj: oh, well, I guess I can just have the compiler emit extra stuff for set!

21:22 that makes more sense anyway

21:23 TimMc: metellus: 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:23 (It turns out that when the REPL tries to print the atom, bad things happen.)

21:24 Maybe I should change my REPL prompt to "namespace> print " to remind me.

21:26 holo: hi

21:26 why can't i build some kind of maps comprehension?

21:27 like {(if true {:d "do"})}

21:28 oh, of course, that returns just an element.. hehe, sorry guys

21:28 * Hodapp gestures to the chair in the corner

21:28 TimMc: holo: What are you trying to achieve?

21:29 holo: TimMc, i'm trying to return {:d "do"} as the final map doing an if inside {}

21:34 TimMc: Turn it inside out: (if true {:d "do"} {})

21:34 hiredman: ugh

21:34 signed bytes are the worst

21:35 TimMc: holo: or {:d (when true "do")} if nil is an acceptable value for :d.

21:36 hiredman: What have you run into?

21:38 holo: TimMc, 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:39 TimMc: holo: If you're building up a map from a bunch of key/value pairs, try (into {} (for [...] [key-expr val-expr]))

21:41 holo: TimMc, thanks

22:38 Sgeo: I'm going to try to get emacs working on a school computer and write a post detailing exactly what I did.

22:38 jcromartie: I think this is not too bad at all https://gist.github.com/da22fff78cdf344f6330

22:38 for converting XML node structure into simpler data structures

22:38 excuse the missing convenience functions

22:40 unfortunately it doesn't help to reverse the transform

22:49 Although this actually looks something close to reversible…

23:13 danielglauser_: From the Noir source does this extract the opts from the vector?

23:14 (defn gen-handler [& [opts]] ...

23:19 jkkramer: danielglauser_: that's a shortcut for an optional trailing argument. You could also use multiple argument lists: (defn gen-handler ([] (gen-handler {})) ([opts] …))

23:22 danielglauser_: jkkramer: Thanks

23:27 loliveira: could somebody please indicate an good tutorial about macros?

23:27 muhoo: &(map Integer/parseInt ["99" "12" "1"])

23:27 lazybot: java.lang.RuntimeException: Unable to find static field: parseInt in class java.lang.Integer

23:27 muhoo: &(map #(Integer/parseInt %) ["99" "12" "1"])

23:27 lazybot: ⇒ (99 12 1)

23:27 muhoo: wat?

23:27 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

23:32 TimMc: clojurebot: Very clever.

23:32 clojurebot: Pardon?

23:32 TimMc: muhoo: u mad?

23:32 muhoo: TimMc: no, just confused.

23:33 Raynes: muhoo: That is a java method, not a function.

23:33 TimMc: Java methods have to be in the call position.

23:33 Raynes: When you do Integer/parseInt, Clojure is trying to look up a field in the Integer class.

23:33 That's why everybody wraps Java method calls passed to higher order functions in an anonymous function.

23:33 muhoo: oh, ok. thanks.

23:36 shaunxcode: are there any decent tutorials/articles written on how to structure/normalize schemas for datomic?

Logging service provided by n01se.net