#clojure log - Oct 06 2010

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

0:00 tomoj: and similarly for b, c

0:00 ztellman: oh, yeah

0:00 (channel) is unidrectional

0:00 (channel-pair) returns two halves

0:00 the channels given you by a connection handler is not unidirectional

0:01 are not*

0:05 tomoj: I see

0:05 so you pass the second halves of clients to connection-handler

0:06 err

0:11 yeah I see

0:11 thanks

0:47 defn: scottj: that was my guess at a solution

0:52 tomoj: is there a reason to write in two threads instead of having the two threads tell a third to write?

0:56 freakazoid: use a lock?

1:30 defn: tomoj: im not sure he either a.) thought of doing that already, or b.) is not allowed by the very rules of the assignment

1:32 tomoj: ah

1:33 defn: tomoj: wouldn't you prefer to use Clojure's coordination mechanisms, though?

1:36 tomoj: like what?

1:36 locking ?

2:50 defn: tomoj: coordinated changes

2:51 tomoj: where is the lock?

2:59 LauJensen: Good morning

3:00 defn: morning Lau

3:00 Are you going to clojure-conj?

3:01 lypanov: morning all.

3:02 carkh: defn : for threads, i would use an agent to control the reading/writing, and have my two threads communicating with it

3:03 defn : for processes there is java.nio.channels.FileLock I guess

3:04 LauJensen: defn: Im sorry to say that Im not :(

3:46 tobiasraeder: hi

3:49 LauJensen: hi

3:51 esj: Salut LauJensen !

3:52 LauJensen: Salut salut mon Edmund !

3:54 esj: oh oh... he knows my name. I'm in trouble now.

3:54 tobiasraeder: Morning to the two of you :)

3:55 esj: and you tobiasraeder

3:56 tobiasraeder: does any of you fine people know a good example on the gen-class macro with using the state?

4:01 i think i found something now

4:04 tomoj: abstract classes can extend concrete classes?!

4:04 tobiasraeder: might actually be

4:04 can you use the gen-class macro only inside a ns declaration with :gen-class and not on its own like gen-interface?

4:07 tomoj: you can use it on its own too

4:08 sempah: hello, I am just checking refs/stm out. If i define a struct (defstruct account :owner :balance), how can I alter the balance in a function?

4:09 have something like this: (dosync (alter - @(from-account :balance) amount)))

4:09 raek: sempah: structs implement the same interface as maps, so you can use 'assoc'

4:10 alter takes a function, that when called with the old value shoul return the new value

4:10 (dosync from-account update-in [:balance] amount)

4:11 tobiasraeder: if i can use gen-class alone, can it be used in the repl to just create a class like gen-interface (and then importing it)? or does it have to be compiled at startup?

4:11 raek: new-value = (update-in old-value [:balance] amount)

4:11 sempah: thx, i will check this

4:11 raek: tobiasraeder: I think it is a no-op, unless you do AOT

4:11 tobiasraeder: mhm

4:12 raek: sempah: sorry. (dosync from-account update-in [:balance] #(- % amount))

4:12 sempah: merci

4:12 raek: the previous example was some weird blend of update-in and assoc-in

4:13 ,(doc update-in)

4:13 clojurebot: "([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."

4:13 raek: ah

4:13 (dosync from-account update-in [:balance] - amount), even

4:13 now i gotta go. good luck!

4:15 sempah: bye

4:18 LauJensen: Has somebody written a nice log4j wrapper ?

4:24 scottj: beyond c.c.logging?

4:28 LauJensen: scottj: Im asking if something like that exists, otherwise c.c.logging will have to do

4:29 tobiasraeder: does anyone know why gen-and-load-class is commented out currently?

4:30 scottj: LauJensen: you know log4j is one of the backends for c.c.logging right?

4:30 LauJensen: scottj: I imagined that it was yea

4:54 sempah: hmm I dont get it

4:55 (dosync (ref-set from-account (assoc @from-account :balance amount)))

4:55 now the new balance will be set

4:55 but how can I do something like balance - amount

5:02 LauJensen: ,(let [account (ref {:amount 100})] (dosync (alter account update-in [:amount] - 10)) @account)

5:02 clojurebot: {:amount 90}

5:02 LauJensen: final deref is just for show

5:04 sempah: this works

5:04 muchas gracias ;)

5:05 LauJensen: no problemo muchachos

5:05 jjido: is ^ a shortcut for (with-meta)?

5:06 hiredman: no

5:07 ,(meta ^{:foo true} (conj () 1))

5:07 clojurebot: nil

5:07 hiredman: ,(meta (with-meta (conj () 1) {:foo true}))

5:07 clojurebot: {:foo true}

5:07 LauJensen: And in 1.3 ^keyword is {:keyword true}

5:07 ^:keyword, sorry

5:09 Chousuke: ^ attaches metadata at read-time

5:09 with-meta at runtime

5:17 jjido: hiredman: LauJensen Chousuke: thanks

5:19 LauJensen: Looking at disclojure.org this morning, I think Gosling just earned himself another Clojure vs Java - Smackdown blogpost :)

5:19 Chousuke: :P

5:24 jjido: ,(let [a 2 b 'a] ~b)

5:24 clojurebot: java.lang.IllegalStateException: Var clojure.core/unquote is unbound.

5:27 esj: i wonder if we could email him a bag of parentheses ? Seems like something thinkgeek.com should stock.

5:28 jjido: ,(let [a 2 b (delay a)] @b)

5:28 clojurebot: 2

5:28 LauJensen: esj: Or maybe a copy of "Programming for beginners", since he hasn't learned to look past the superficial yet, seems like a pretty 101 topic

5:29 esj: eish !

5:29 jjido: ,(let [b (delay a)] (let [a 2] @b))

5:29 clojurebot: java.lang.Exception: Unable to resolve symbol: a in this context

5:30 jjido: Mmh, what is the magic formula?

5:31 LauJensen: jjido: You had it right in the 2nd try, but I dont think you understand delay

5:32 jjido: LauJensen: I don't need delay

5:32 LauJensen: then the trick is to stop using it :)

5:32 jjido: LauJensen: I need a symbol that I can resolve later

5:33 ,(let [a 2 b 'a] (eval b))

5:33 clojurebot: DENIED

5:33 defn: naughty eval

5:33 esj: a delay is that, and a promise is related usually for multitheraded. (warning - I am a beginner so prone to error)

5:34 i think the reason your v2 code doesn't work is that a is not in lexical scope when b is defined so it gets no further

5:34 defn: esj that's actually a neat idea -- code magnets -- with real code

5:34 has it been done already?

5:34 ...probably...

5:34 esj: defn: ooooh it would be great for clojure, so few keywords !

5:35 LauJensen: jjido: (defmacro cheat [] `~'a) (let [a 5] (cheat))

5:35 defn: it would be fun to build gigantic functions using all of the functions only once

5:35 or try to

5:36 esj: jjido: you're not looking for declare are you ?

5:36 jjido: esj: no I need it in a variable

5:36 ,(defmacro cheat [] `~'a) (let [a 5] (cheat))

5:36 clojurebot: DENIED

5:37 LauJensen: jjido: you need to run that locally, we dont get to play with defmacro here

5:37 jjido: LauJensen: (eval) works

5:37 LauJensen: not here

5:37 jjido: in my program

5:40 that gives me 'a: (defmacro cheat [x] `~x) (let [a 5 b 'a] (cheat b))

5:41 ok I need to keep `~'

5:41 works as well.

5:42 er, doesn't.

5:43 LauJensen: I will use eval :)

5:43 LauJensen: eval?

5:43 clojurebot: eval is DENIED

5:43 LauJensen: eval?

5:43 clojurebot: eval is DENIED

5:43 LauJensen: oh, usually clojurebot says something funny

5:49 defn: is there any bad blood between cake and lein? It seems like a merging of the two would be beneficial to all.

5:49 LauJensen: defn: There are disagreements which cannot be resolved, so use cake

5:50 defn: Granted they are interoperable for the most part-- I guess I just think about merb and rails in the ruby community and how it was a good thing to merge instead of splinter.

5:50 lypanov: merging is silly.

5:50 and thats a bad example, the merb lead is insane.

5:50 defn: Fork when forking is necessary.

5:50 lypanov: (ly good)

5:51 are you some sort of communist?

5:51 defn: Don't when the net benefits are < net gain.

5:51 lypanov: (i always wanted to say that)

5:51 defn: I'm an Umehricun

5:51 lypanov: yeah, communist then. :)

5:52 defn: Build tool debate is lame.

5:52 LauJensen: eh?

5:52 The build tool debate has so far produced 2 great Clojure build tools

5:53 defn: Your perception of how I was using "debate" is different than I meant.

5:54 Some people are quite vocal about which build tool ought to be used. The debate is not the code that has been produced as a result of disagreement over how the build story should go.

5:54 LauJensen: The major disagreement was the dependency based task model which cake uses. Phil didn't see a need for it

5:54 defn: But I suppose those two things are intertwined.

5:55 LauJensen: would you mind expanding -- when you say dep based task model I'm not sure exactly what you mean.

5:55 LauJensen: sec

5:55 defn: As in -- it has support for (deftask ...), whereas lein doesn't?

5:55 sandGorgon: is cake written in ruby ?

5:55 defn: sandGorgon: I'm so glad you mentioned that.

5:55 LauJensen: http://github.com/ninjudd/cake - Read the tasks section and the advanced tasks section

5:55 sandGorgon: No, it has a small (and getting smaller) Ruby bootstrap, which makes it completely crossplatform, where lein is mostly unix since it uses bash instead

5:56 defn: I was thinking about this earlier -- people's aversion to the fact that something is written in Ruby (not that it is.)

5:56 LauJensen: (and .bat on Windows)

5:56 sandGorgon: defn, huh ? I was looking at the docs just now - i'm a bit confused

5:56 LauJensen: I gotta say I hate Ruby, but I love Ruby for small things like this. It gave cake exactly what it needed, a piggy back distrubtion on top of gems

5:56 sandGorgon: LauJensen, ah...

5:56 defn: What I wanted to say is that I think when a project like cake is started in a relatively fresh language like Clojure

5:56 lypanov: LauJensen: and really nice install.

5:56 defn: it spawns people who will take up the cause

5:57 lypanov: s/and/with/

5:57 sexpbot: <lypanov> LauJensen: with really nice install.

5:57 defn: and turn the ruby into clojure

5:57 things like cake where there is ruby inspires community to rise up and port the ruby ideas to clojure

5:57 lypanov: i personally think competition always helps.

5:57 open source does what it needs to do.

5:58 people merge when merging is what people want to do.

5:58 defn: as long as it's /healthy/ competition

5:58 lypanov: forcing or coercing removes the point.

5:58 all competition is inherently annoying to someone.

5:58 be it due to fragmentation or loss or either side.

5:58 doesn't mean its bad though. still produces better things than not

5:59 both projects are still too young to really talk about it in this way anyway.

6:00 (disclaimer, i was involved early on in a competitor to rubygems, and still hate many things about gems, the things that plague it still today in fact)

6:00 defn: rvm is a way of fixing rubygems

6:00 thank god for gemsets

6:00 also -- one annoyance that has hurt my soul forever...

6:01 tomoj: LauJensen: why would you need a piggyback distribution on top of gems?

6:01 defn: gem search foo returns local results by default -- the majority of searching people do is remote, so with gems you need to gem search -r foo

6:01 gem list foo should return a local list of gems matching foo

6:01 not search...

6:01 LauJensen: tomoj: Well you need to piggyback something or write it from scratch

6:02 tomoj: I guess lein did have to write it from scratch

6:02 and it isn't pretti

6:02 lypanov: defn: for me its the lack of good distribution integration that hurts it most.

6:02 defn: lypanov: ya i needed to do some weird wrangling on ubuntu to make certain gems behave

6:02 tomoj: that is not so good for lein either

6:02 defn: that's not right.

6:02 LauJensen: tomoj: lein doesnt have it

6:03 sandGorgon: what are the "disagreements" between lein and cake ?

6:03 tomoj: lein has the shell script you run to self-install

6:03 defn: persistent jvm, tasks built in

6:03 LauJensen: tomoj: exactly, and it doesnt work on Windows, hence the gems

6:03 tomoj: which is 169 lines long

6:03 well, there's a .bat file there

6:03 defn: cake has more features than lein

6:03 tomoj: it doesn't work?

6:03 defn: that's the debate

6:03 tomoj: (also, who cares? :P)

6:03 LauJensen: tomoj: Ive not heard anybody who has got it working yet

6:03 I care

6:04 tomoj: the readme suggests it can be done

6:04 "On Windows most users can 1. Download the Windows distribution lein-win32.zip 2. Unzip in a folder of choice. 3. Include the "lein" directory in PATH."

6:04 LauJensen: The difference are 1) Cake is cross-platform, lein isnt, 2) Cake has a persistent VM, lein doesnt 3) Cake has a dependency based task system, lein has plugins, 4) Cake does not try to tell you how to name your projects, lein does. 5) Cake is Ivy based, lein is Maven based

6:05 tomoj: ouch

6:05 I can have cake/ivy using maven's dependency model?

6:06 LauJensen: Yep

6:06 mrBliss: I use Leiningen on Windows (Cygwin). I only had to modify a couple of lines in the bash script.

6:06 tomoj: does cake do that by default?

6:06 hmm, that is pretty interesting

6:07 it's a rubygem, so I could install it easily with chef, and easily run it during deploys or as a service

6:07 LauJensen: Maven => Ivy brings Cakes dependencies down from 27 to 7 jars

6:07 tomoj: and I can hook it up to my nexus repo?

6:08 hiredman: you run your build tool when doiing a deploy?

6:10 tomoj: yeah

6:18 rrc7cz: are off topic discussions okay here?

6:19 LauJensen: rrc7cz: On slow days we sorta accept it, but there's #clojure-casual for chit/chat

6:19 hiredman has a zero tolerance policy on everything though :(

6:19 rrc7cz: LauJensen: it's IT/archetecture related, not directly Clojure

6:19 aha

6:19 LauJensen: shoot

6:22 rrc7cz: I said: shoot

6:22 :)

6:22 rrc7cz: we have a hairy problem with no clear answer, and we can't seem to reach any conclusion or plan. We have lots of data, lots of apps, and multiple (distributed geographically) development teams. You have the typical legacy app problem found in most internal IT depts: mish mashed chaos for app integration. Some apps directly access other's dbs, some file system integration is used (copy to shared dir or FTP to shared dir), some primative

6:22 web services, some RMI, the whole bit. Some of us - myself included - have been pushing for asynchronous messaging + local read-only data caches to be used for the majority of integration moving forward.

6:25 others would like to see a "giant app". By this I mean: if you have 4 apps that all require access to largely the same data, perhaps they should be combined into a single, larger app. Multiple teams would work on this app using branches, CI, libraries, etc. to try and still segment/modularize their work as much as possible, but the final deployable artifact would be a single application. Now there are pros and cons to both

6:25 approaches. The distributed messaging pro is that apps/functionality are largely decoupled: one app goes down but others stay up since they have their local read-only caches of the data. The con is that it's more complex and you could have data sync issues, though we'd be using JTA to mitigate this as much as possible. The Pro of "giant app" is you have no data sync issues, but you have let's say.. development issues. Vastly different

6:25 features and teams and customers all on this one codebase, scheduling, sychronizing, some technical issues like library versions, etc.

6:26 sorry, didn't mean to flood the channel, just trying to explain it clearly

6:28 of course there are many more pros/cons to both approaches, but I think you'd know them

6:28 esj: loose decoupling and modularisation seem to me to be most important

6:29 rrc7cz: and there are various bits of middle ground I didn't mention: multiple WARs but packaged in a single EAR, or using sync web service calls instead of async messaging, thereby solving the data sync/duplication of a local read-only cache, but more tightly coupling the apps so one "source" failure takes down all consumers

6:29 esj: lots of teams seem to rave about async msg queues

6:30 sandGorgon: how would you build a async msg system on clojure - aleph ? ring ?

6:30 jjido: is there a better way to do (letfn [(foo ([a] (foo a 0)) ([a b] (+ a b)))] foo)?

6:30 rrc7cz: esj: that's what most of us were pushing for. The main argument against it comes from management because there is a _clear_ technical overhead to it (JMS infrastructure, JTA, etc), while the overhead of "giant app" I feel is harder to perceive; it's mostly in "soft" areas like coordinating teams, customer requests, PM, etc

6:31 esj: I should say, that's what most *developers* were pushing for. Ops + management is taking more of the other side. For operations it's clear: JMS + many smaller apps is much more work, infrastructure, and overhead for them

6:31 esj: in most cases its easier to get a technical thing correct than a soft/managerial thing because you can define and control is clearly

6:32 rrc7cz: sandGorgon: our implementation would look like ActiveMQ as the JMS message broker + Java apps using Spring Integration to wrap JMS w/JTA

6:32 hiredman: ouch, I don't think I've ever heard anything good about activemq

6:32 rrc7cz: sandGorgon: I recently pushed (hard) for Clojure to be approved as a dev language here, but the best I was able to do was Scala. The reasons were 100% personel related (where can I hire Clojure devs, etc)

6:32 esj: rrc7cz: not rabbitmq ?

6:33 tomoj: I lucked out and happened to get a new boss who loves clojure :)

6:34 rrc7cz: hiredman, esj: we selected ActiveMQ because it appeared to have the largest number of adapters (we also need to support .Net, some other weird stuff), it had enough books/consulting available to back up an "enterprise" (barf at the name, but..) and so on

6:34 hiredman: rrc7cz: you can buy copies of http://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683 for everyone

6:34 rrc7cz: hiredman: I have it and read it. It's actually what started my push for async messaging

6:35 * esj is reading it currently

6:36 sandGorgon: hiredman, what I was about to say. the inventors of OpenAMQ are getting behind zeromq and the Stomp protocol (rather than JMS)

6:36 rrc7cz: hiredman: there seems to be general agreement that in a world with no schedule and unlimited resources, async messages - where it's applicable - is the absolute best way to do things. Of course when we talk about JMS infrastructure, local data caches, JMS adapters, etc. the additional cost is clear. We know "giant app" has additional costs too, but as I said they are less clear and hence less painful to discuss

6:36 esj: rrc7cz: another stick to beat them with is testing. Small pieces are significantly easier.

6:36 rrc7cz: although you have the extra layer....

6:37 hiredman: rrc7cz: what you described, multiple teams, multiple projects, seems like the ideal case for the flexible approach of async messaging

6:37 tomoj: jjido: (fn ([a] a) ([a b] (+ a b)))

6:37 rrc7cz: I should also say that very little async messaging has been deployed so far, and what is there was coded against the JMS API. What I mean to say is that we could still swap out message brokers if we wanted to, but that isn't our main problem. Our main problem is the larger picture of which model to use and when. Right now we understand we're going to use both models, but how do you select one of ther other?

6:38 sandGorgon: rrc7cz, if u dont mind my asking - what is the use case ? trading desks, company-internal messaging systems ?

6:38 bmh: Does anyone have recommendations for clojure parser generators?

6:38 jjido: tomoj: that was just an example LOL. I don't want code duplication between the body for both arities

6:38 rrc7cz: esj: we thought about the testing argument. To some degree "giant app" isn't any worse; you can still write plenty of unit and integration tests for your code. The place where we DID argue testing is: one team can bring down the entire app. One team blowing out the heap affects everyone. As such we agreed that QA was a much higher priority in the "giant app" model

6:39 jjido: is there a better way to do (letfn [(foo ([a] (foo a 0)) ([a b] (do-something-complicated-with a b)))] foo)?

6:40 tomoj: (fn foo ([a] (foo a 0)) ([a b] (+ a b)))

6:40 hiredman: uh, well, "integration" still means it is a giant app, the components of which use a particular communication style that allows for maximum flexibility

6:40 qa is still very important

6:41 rrc7cz: hiredman: most of us agree that it's ideal, but in some of the projects it's not as clear. Obviously it's a gradient. There is a point where combining apps makes some sense. Our pain is not having a clear idea of how to decide/what factors to use. Right now we're just thinking "when an app is pullilng A LOT of data from system X, maybe it should be part of system X". But what is "a lot" of data? How much is too much?

6:41 hiredman: I don't see how that follows at all

6:42 rrc7cz: sandGorgon: Salesforce apps + custom legacy CRM + document publishing/workflow systems + Product management systems + user (internal & external) systems + data analysis and tracking systems + public website + product distribution

6:42 esj: hiredman: on the money. with a monolithic giant system its up to you to define the interconnects. you'll fail.

6:42 sandGorgon: ahh.....

6:42 rrc7cz: sandGorgon: and about 100 more I won't bother mentioning, inlcluding a bunch of desktop VBA/.Net tools used by 1000+ ppl

6:42 hiredman: rrc7cz: data sources are just data sources, they are not the app

6:43 rrc7cz: hiredman: that's true about "integration". I think the "giant app" side is thinking "how can we get this project done the fastest with the least resources and the least infrastructure" while the async msg side is thinking "how can we build the most robust solution"

6:44 hiredman: not sure what doesn't follow

6:44 hiredman: about the interconnects: there is an argument that "giant app" will detect contract breaks at compile time, while distributed systems will detect it at run time

6:45 hireman: to expand on the point, integration in a giant app is one module directly invoking (method invoke) the api of another module. if that api changes, you see that at compile time

6:46 hiredman: with async msg, you have to manage a contract through something like an XML Schema or something, whose changes might not be apparently as quickly to the other parties in the contract

6:46 hiredman: which makes changing modules very difficult

6:47 a schema is pretty heavy weight, really you just want be sending maps with some agreed upon keys

6:50 rrc7cz: hiredman: if you said, "I don't see how that follows at all" regarding the existance of a gradient, think of this: you have a user management system. Now you want to add biographies to the users. You probably wouldn't build a "User Biography" app, because the overhead wouldn't make sense. That Bio app would probably be pulling every single user field from the User Management app. You'd basically be making a heavyweight UI. You'd instead

6:50 just add the functionality to the existing User Management "getting more giant" app. So there is a lot of gray area in deciding. "how much data" feels like one gague. "how related is the functionality" seems like another gague. But it's not clear cut

6:55 hiredman: uh

6:56 that is a change to you datastorage (to store the bios) and a change to your ui to display them

6:56 rrc7cz: yes, that's right

6:57 hiredman: if your ui and your datastorage are so intertwined as all that then you have already lost

6:57 rrc7cz: I don't understand at all.

6:58 this was an example: you want to expand the data model of a user. The example was: where do you put that extra functionality

7:01 hiredman: the ui parts go in the ui, the storage parts going in storage, connected by your message bus

7:02 rrc7cz: so you're recommending (in this example) that the UI and the storage logic (repository/dao/orm/whatever) are separated by a message bus? That doesn't seem to make sense

7:02 the UI would have to cache the entire user data model locally just to display it

7:02 unless you're talking about sync service bus or something

7:03 in that case it does make sense

7:03 hiredman: rrc7cz: why would it have to cache the entire user data model?

7:04 rrc7cz: hiredman: because when the UI needs to display a user it needs that user's data model. If it connects to the storage system via a sync service of some sort, it can invoke the Get method and have the model immediately (or over the wire at delay) and we're fine

7:04 hiredman: but we're talking mostly about using async messaging. Which means you'd either need to cache the user data locally when you get a "hey a new user was added to the storage system" message

7:05 OR you'd have to use the async messaging system in a sync way (which it does support) by sending a "get me user X" message, then waiting for the reply

7:05 hiredman: you can easily do callbacks across a message queue

7:05 rrc7cz: but in that second case, you're not really using async messaging; if the storage system goes down, so does your UI. This also doesn't work in some cases where the data model is huge and you need performance. In those cases you have to have it locally.

7:06 hiredman: absolutely, but then you're using async messaging in name only. What you're really doing is making a sync call

7:06 hiredman: tomato tomato

7:07 so you are saying your dataset is too large for messages

7:08 rrc7cz: hiredman: in almost all cases, not at all, but the point is using a callback = sync service call = tight coupling which means it's really no different then using some web service or RMI

7:08 hiredman: it different

7:08 it is

7:08 rrc7cz: how?

7:08 clojurebot: with style and grace

7:09 rrc7cz: you make the invocation and callback handler async, sure, but you don't address the coupling problem: when system X goes down, so does system Y

7:10 hiredman: but the ui logically depends on storage, if storage goes down, how would the ui continue to display information?

7:10 you can cache data

7:10 rrc7cz: well in this storage/ui example I wouldn't use async messaging at all. I'd use sync calls for that very reason

7:11 hiredman: but if you use a message queue and keep your ui decoupled from storage, dropping a cache in between is easy

7:11 rrc7cz: but think about systems that aren't split into those horizonal tiers like this UI/storage example. Think of a User System and a Content system that need to talk

7:11 carkh: bmh: i've been successfull using joshuas choi parser library at http://github.com/joshua-choi/fnparse

7:12 bmh: carkh: I had a look at that, I wouldn't have minded more documentation

7:13 carkh: bmh : there is a sample jsion parser which is a great start for understanding the beast

7:13 hiredman: rrc7cz: it really sounds to me like you are stuck on this idea of all Noun realated functionality living in a single place

7:15 rrc7cz: hiredman: maybe. I feel like we're stuck between a more robust, but more expensive solution and a simpler, but more fragile solution. And clear answers only live on the peripheries

7:17 hiredman: on one extreme you have User System supports First Name. Add Last Name. Okay it's clear, just add it to the existing User System. On the other extreme you have Public Website needs some data from the Accouting System. You wouldn't propose combining them. You'd just pull the data somehow. In between these extremes lives a lot of gray, and it's sometimes hard to navigate.

7:43 jjido: tomoj: (belated) thanks that is much better than letfn!

8:04 LauJensen: Does anybody have a simple yet up to date example of using c.c.logging with log4j ?

8:15 esj: i've got a working setup....

8:15 LauJensen: it uses maven though :P

8:16 LauJensen: link?

8:16 clojurebot: your link is dead

8:17 esj: LauJensen: no link just local code

8:18 it was just a case of get the deps, put the log4j config file in the right place (use c.c.logging) and (warn "blah blah blah")

8:18 probably you want to do something more complex

8:19 i just have the logs going to socket on a remote server

8:19 LauJensen: Basically I need to know how c.c.logging interfaces with log4j. Is there are config file you must initialize?

8:20 cemerick: LauJensen: have you tried it? It just works.

8:20 LauJensen: no

8:20 esj: yeah, you need the config in resources

8:20 or I guess anywhere is the class path

8:20 cemerick: write yourself a simple log4j.properties, done

8:20 esj: a comprehensive example is : http://www.johnmunsch.com/projects/Presentations/docs/Log4J/log.properties

8:21 cemerick: jeez

8:21 kitchen sink, more like :-)

8:21 SocketAdapter? :-P

8:21 esj: that's what I'm using....

8:21 cemerick: is that a mistake ?

8:21 cemerick: esj: not if if you need it

8:22 I can't say I've ever logged over sockets

8:22 logged to couchdb, but not sockets :-)

8:22 esj: cemerick: well, I like to have a big screen on the wall with the log from all the systems displayed on it.

8:22 cemerick: nifty

8:22 All I've got is an iPad :-)

8:23 esj: that's much more impressive actually

8:23 LauJensen: thx

8:23 cemerick: oh?

8:24 esj: well, smaller is harder.

8:25 you have to remember to look at it :) A flashing red bar on the wall is easy, thus less impressive.

8:27 i use the app chainsaw (not great) for watching the logs. If you try apt-cache search for it in ubuntu all it gives you is perl..... :P

8:27 cemerick: Adding a red flash and an ominous-sounding alarm when things went sideways was a big improvement for the monitoring app :-)

8:27 esj: cemerick: the darth vader theme ?

8:28 cemerick: Hrm, I wasn't so clever.

8:28 I don't quite remember where I got the audio. It's not anything notable.

8:48 LauJensen: cemerick: You can probably make sense of the new contrib build - Whats the artifact I need for c.c.logging ?

8:48 chouser: maybe org.clojure.contrib:logging:jar:1.3.0-SNAPSHOT ?

8:49 cemerick: I've not used anything in the 1.3.0 contrib at all.

8:49 but chouser's suggestion seems reasonable.

8:49 LauJensen: k

8:49 Guess 1.3 is still a little too bleeding

8:50 cemerick: plenty of people are using it

8:51 LauJensen: By plenty you mean stuartsierra? :)

8:51 cemerick: everything should be considered bleeding until it's got an RC label on it IMO

8:51 kryft: Mmm, I can't wait getting started with clojure. (I just got Joy of Clojure yesterday.)

8:52 cemerick: LauJensen: nah, at least a dozen mentions of using 1.3.0 stuffs in here the past week

8:52 chouser: cemerick: have you settled on a tool for your presentation slides?

8:52 cemerick: ok, maybe not 'plenty'.

8:52 kryft: By the way, what kind of performance can one general expect compared to, say, C++?

8:52 esj: kryft: you're in for a treat.

8:52 kryft: s/general/in general

8:52 esj: :)

8:53 cemerick: chouser: I was never actually considering using anything other than powerpoint.

8:53 chouser: cemerick: oh, I misunderstood your question?

8:54 cemerick: chouser: I think so. I was having a little fun w/ people writing code for such things. :-)

8:54 "How do I rotate this text?" "Oh, there's a jquery plugin for that."

8:55 back to the minimalistic hacker ethos, I guess

8:55 chouser: oh, I didn't see those.

8:55 I'm having a blast with it. Best slide-creating experience I've ever had.

8:56 cemerick: that's a fabricated set of quotes.

8:56 I could see using 280slides, but I'm not sure why I would.

8:57 kryft: chouser: A blast with what?

8:57 chouser: kryft: http://github.com/schacon/showoff

8:58 cemerick: "How do I add an image?" "Put your image in this directory over here, refer to it in your markdown, and then refresh your browser."

8:58 * cemerick facepalms

8:58 cemerick: OK, I'll shut up now.

8:59 kryft: chouser: Ah. :) Looks fun indeed.

9:01 chouser: I'm using embedded SVGs for charts and such. I can have one open in inkscape and have much more powerful tools than any presentation program I've ever seen. Then to see my changes in the preso is almost instantaneous: save the svg, reload in the browser.

9:10 esj: well that's all well and good but you'll have to sim your own BSOD.

9:10 worthless

9:13 chouser: cemerick: how do you include a syntax-colored source snippet on a slide in powerpoint?

9:14 cemerick: chouser: I've never worried about syntax coloring in slides

9:15 * chouser smiles sweetly

9:16 cemerick: gosh, I hope that and svg support are the only benefits :-P

9:16 This is going to degrade into the same track as the typical LaTeX v. everything else discussion.

9:20 chouser: Nah, we can leave it right here, each of us quitely and smugly self-assured that we each have a better presentation tool than the other.

9:21 cemerick: hrm, "better" is always a dodge. Everything is "better" than everything else, for someone.

9:22 chouser: which is how we can both be right

9:22 and smug

9:23 * cemerick needs to work on the 'smug' part

9:23 cemerick: I've beat a lot of it out of myself, but it crops up again sometimes.

9:29 kryft: Are there any nice presentation tools that allow you to use LaTeX for embedding math?

9:29 chouser: I get too defensive too easily. I need to keep working on internalizing that when I say "foo is really nice" and someone else says "you only think so because you're dumb" that they don't mean it personally.

9:30 kryft: I can't tell you're serious or if you're just trolling cemerick.

9:31 kryft: chouser: Haha! I'm serious - sorry if my question was sufficiently stupid that it made you wonder. ;)

9:32 abrenk: kryft: LaTeX using beamer class -> PDF -> using impressive (ex keyjnote) to display

9:32 LauJensen: kryft: Muse for Emacs

9:32 chouser: kryft: not at all, but I'm scared to answer. If you prefer latex to markdown, I bet it wouldn't be hard to tweak something like showoff to do it.

9:33 kryft: So far I've used latex-beamer for anything math-heavy, but frankly I'd prefer something a bit more wysiwyg for making slides.

9:33 chouser: essentially convert your latex source to a live presentation on-the-fly when the browser loads it.

9:34 clicking reload shows you the up-to-date version of the slide you were already looking at.

9:34 cemerick: chouser: oftentimes, they *do* mean it personally, which is a condition that is good to be able to detect and ignore as well.

9:34 chouser: cemerick: :-)

9:35 kryft: chouser: Heh, I hadn't even heard of markdown until you mentioned it. :P

9:36 chouser: kryft: my opinion-framework about document source formats is in complete shambles at the moment, so I have nothing to say about markdown except that it exists.

9:37 kryft: chouser: Heh, fair enough.

9:37 chouser: oh, and we used it sorta to right a book.

9:37 write

9:37 kryft: JoC?

9:37 s450r1`: heh

9:37 chouser: kryft: yeah

9:38 kryft: chouser: Ah. I've only started reading it, but I don't expect to see a lot of equations. :)

9:38 chouser: :-) no

10:14 shoover__: chouser: I can't believe you haven't moved over to split-screen emacs presentations yet

10:15 But I guess if you must have fancy graphics...

10:18 chouser: :-)

10:18 but surely emacs and org-mode support graphics...

10:19 shoover__: only if you export to pdf, or html, but that diminishes the value of the live REPL

10:22 LauJensen: shoover__: You can have images in a regular buffer

10:23 shoover__: ok, sorry, I have to exlain this joke. Chouser once attended a little presentation I did for .NET developers, in which I displayed a simple outline in emacs and just typed in a REPL on the bottom half of the screen. An old VS developer was like, "What is this device?"

10:23 LauJensen: hehe

10:23 shoover__: LauJensen: ok, send the commands over to Chouser

10:24 chouser: not today. today I'm all about maven and eclipse

10:24 LauJensen: shoover__: When it comes to tools, Chouser and cemerick are those akward uncles that we just accept because of their lovable nature

10:24 shoover__: hee hee

10:25 chouser: "you only think so because you're dumb"

10:25 shoover__: now they're using each other's words against us

10:26 chouser: heh

10:27 * shoover ponders a family gathering with chouser and cemerick in place of his uncles

10:31 LauJensen: Whats the practical differences between RollingFileAppender and FileAppender?

10:31 chouser: I'm not too sure but I think RollingFileAppender extends FileAppender to backup the log files when they reach a certain size.

10:32 drewr: LauJensen: I think it's just rotation

10:32 LauJensen: k

10:32 shoover: LauJensen: you can roll by size or age, but practically it just makes it easier to open in a text editor if it would otherwise by dozens of MB

10:32 chouser: You can set the maximum size that the output file is allowed to reach before being rolled over to backup

10:32 LauJensen: I thought both did that actually but I must be wrong

10:33 chouser: and also how many backup files are kept before the oldest is erased.

10:34 LauJensen: I just want a flat file to tail -f, if I put this https://gist.github.com/a7de1a2b43a229f229df in my resources/ shouldn't that be enough to get started?

10:34 chouser: For example, the value "10KB" will be interpreted as 10240. setQWForFiles protected

10:34 oops, pasted too much that time, sorry.

10:41 LauJensen: Where in the .war file are you guys putting log4j.properties?

10:49 cemerick: ?

10:51 hugod: LauJensen: mine ends up in WEB-INF/classes/log4j.properties

10:51 LauJensen: hugod: using a maven trick ?

10:52 hugod: I have it in src/main/resources, which is declared as a resource directory in the pom

10:53 LauJensen: ok

10:55 ztellman: is 1.3 supposed to play nicely with jars compiled by 1.2?

11:00 LauJensen: ztellman: I think yes, with anything thats not AOTed. However 1.3 does mess with a few things like the = operator

11:00 ztellman: LauJensen: I have a counter-example (bug?)

11:01 LauJensen: Whats causing the problem?

11:01 ztellman: trying to use aleph-core, which doesn't use AOT but was turned into a jar with 1.2

11:02 opening a 1.3.0-alpha1 repl with it causes the exception "NoSuchMethodError clojure.lang.KeywordLookupSite.<init>(ILclojure/lang/Keyword;)V"

11:03 creating a jar for aleph-core with 1.3.0-alpha1 makes the problem go away

11:03 LauJensen: Well. Lookups are also different in 1.3, so theres a possible breakage. In 1.2 keywords of longs / ints wouldnt match, they do now. Could be related

11:03 ztellman: an intentional breakage?

11:03 LauJensen: A necessary one

11:03 So yea

11:03 ztellman: ok, fair enough

11:04 LauJensen: ,(assoc {(long 1) 2} 1 5)

11:04 clojurebot: {1 5, 1 2}

11:04 LauJensen: That has become fixed now, thanks to .equals being strict about types

11:09 abrenk: ztellman: "turned into a jar with 1.2" if there are only .clj files in the jar the clojure version shouldn't matter

11:09 ztellman: abrenk: that's what I thought

11:09 abrenk: ztellman: NoSuchMethodError can only occur with class files

11:10 and there are class files in the aleph-core jar

11:10 ztellman: hmm

11:10 abrenk: are you sure there's no AOT involved?

11:10 * abrenk just took a look at aleph-core 0.6.0-SNAPSHOT.

11:10 ztellman: oh, I changed the :main setting in my project.clj

11:10 abrenk: I guess, you just pushed that to clojars?

11:11 ztellman: I wanted to set the default namespace in the repl

11:11 that probably has some AOT consequences, doesn't it

11:12 abrenk: I guess so.

11:12 ztellman: leiningen sample.project.clj confirms

11:12 abrenk: otherwise there wouldn't be a main method

11:12 ztellman: ok, thanks

11:12 I thought that was a weird problem to have

11:13 chouser: In ecplise with CCW, I tried importing clojure itself as a maven project. That looks ok, but when I turn on clojure support for that project the src directory disappears from the package explorer pain

11:13 er, pane, though I guess either is accurate

11:13 LauJensen: ztellman: main is AOT compiled to make jars executable they must have a gen-classed main/-main

11:14 ztellman: LauJensen: I just wanted the repl to start up with the main namespace loaded

11:14 I guess I should just have a start script specified

11:14 LauJensen: ztellman: k, dunno how to do that, ask ninjudd :)

11:18 abrenk: chouser: clojure as a maven project? but it doesn't really use maven, does it?

11:18 chouser: it has a pom.xml. I guess I was hoping that was enough

11:18 I clearly don't really know what I'm doing. :-)

11:18 abrenk: chouser: not really, the source paths etc. are neither the maven standard nor specified in pom.xml

11:19 chouser: oh

11:19 How would I go about opening clojure properly then, in eclipse?

11:19 abrenk: so the pom.xml really is just to put into the repository

11:19 you cannot build clojure using maven

11:19 just import a simple java project i guess

11:20 chouser: I don't want to build it, just open it. But eclipse is a mystery to me

11:21 abrenk: chouser: create a new java project and then select from existing source

11:23 chouser: maybe new java project from existing ant buildfile works

11:24 chouser: abrenk: thanks, I'll try those

11:26 abrenk: chouser: don't try "from existing ant buildfile" - just tried it, looks weird

11:26 chouser: ok

11:33 AWizzArd: I've just studied gvec.clj and came to the conclusion, that I can't find out what the primitive type of (vector-of :short) is. That is, it does not expose this information through a function call, such as (.getPrimitiveType (vector-of :short)) ==> :short

11:33 (class (first (conj (vector-of :short) 0))) would be an option though

11:40 LauJensen: For all tomcat users, dont trust this information: http://tomcat.apache.org/tomcat-5.5-doc/logging.html#log4j - I just wasted a couple of hours not realizing that this will void any servlets own logging configs

11:40 Bahman: Hi all!

11:41 esj: LauJensen: I think RollingFileAppender 'rolls the logs' ie, puts an upper limit on log size

11:44 chouser: AWizzArd: not a bad solution, as long as it doesn't decide to give an error when the wrong type of item is conj'ed.

11:44 AWizzArd: You might consider using peek instead of first

11:45 AWizzArd: chouser: yes, or nth 0

11:45 good point

11:46 chouser: right, something that doesn't have to create a seq

11:46 AWizzArd: kotarak benchmarked first vs nth for vectors, and (for me) surprisingly first runs 10x as long as nth.

11:50 chouser: closer to 4 or 5 times slower for me, but yeah.

11:51 hiredman: first creates a seq from the vector first

11:51 chouser: so true

11:53 creating a java project of my existing clojure source dir still doesn't include the src dir in the Package Explorer pain

11:54 * chouser tries again

11:59 abrenk: how come you're messing around with eclipse?

12:02 chouser: oh, I dunno. Because I want a featureful dev environment I can extend using Clojure

12:02 which doesn't describe vim or emacs.

12:03 abrenk: creating a new java project a selecting the existing clojure automatically adds src/jvm as a java source folder

12:04 s/a sel/and sel/

12:04 sexpbot: <abrenk> creating a new java project and selecting the existing clojure automatically adds src/jvm as a java source folder

12:05 chouser: ok, I've got that now. it at least allows linking around within the java sources.

12:07 abrenk: chouser: then in the project's properties add src/clojure to the java build path as a source folder

12:07 chouser: ah, cool

12:07 thanks!

12:10 abrenk: chouser: and if there were any jars built by ant around when you created the project you might want to remove them from the libraries tab

12:21 LauJensen: http://logging.apache.org/log4j/1.2/faq.html#a3.5

12:22 LauJensen: log4j has its complications in a container context with differenct classloaders

12:22 LauJensen: abrenk: So I learned

12:22 But you'd think they would mention it on a "logging 101" page

12:23 abrenk: there are articles about that dating back to 2003...

12:23 LauJensen: abrenk: But you started at the 101 page right? right...

12:23 abrenk: ...so I guess they just expect everyone to know that know.

12:24 that's why they developed slf4j. to get rid of all the problems of commons-logging and log4j

12:24 technomancy: only in Java-land are there more logging adapters than actual logging implementations...

12:24 abrenk: LauJensen: I learned about those problems the hard way, too. So please don't be offended by my 2003 comment!

12:25 LauJensen: Thats why I love my own blog - I can mess things up, and blog about them, and never forget :)

12:25 abrenk: Im not offended. I just dont benefit from knowing that its written elsewhere, when my problem is with the introduction :) In a bit it'll by on my blog as well

12:25 a bit = the time it takes tomoj to make a screencast

12:45 chouser: so this is definitely better in some ways than what I was doing before.

12:45 Any chance of jumping from a java method used in a .clj file to it's definition in a .java file?

12:45 ecplise/ccw still

12:46 LauJensen: sure you just press M-.... oh, in eclipse. dunno

12:49 chouser: LauJensen: emacs can find the correct definition for a polymorphic method call?

12:51 I mean, if my cursor is on the word seq in ((Seqable) coll).seq(), it can take me to Seqable.java's seq def, not any of the other dozens of .java files that define a seq method?

12:51 abrenk: chouser: in java files it's f3, but in clojure files that does not work

12:52 chouser: abrenk: yeah, I was using it in the .java files -- works quite nicely.

12:53 clojure being dynamically typed could be essentially undecidable in a lot of cases, but it'd be nice if it worked when it could -- static method calls for example.

12:55 * klang played Clojure-bingo at JAOO/GOTO; the last few days ..

12:56 abrenk: chouser: I guess lpetit wouldn't mind you implementing that

12:57 chouser: I might not mind implementing that, if I can do so in Clojure. plenty to learn first though

12:58 dnolen: klang: cool, many people interested in Clojure there?

13:00 klang: dnolen: the rules of clojure-bingo are: you get a point every time Clojure is mentioned in an otherwise unrelated talk .. at almost all the talks I attended points were given ;-)

13:01 dnolen: klang: nice! :D but I meant more like among attendees

13:02 klang: dnolen: I tink the talks specifically about Clojure was well attended (full to the max), so yes, I would say so.

13:03 dnolen: klang: did you see rhickey's talk? how was that?

13:04 klang: dnolen: very good .. shedding a bit of light on the thought behind the STM

13:05 dnolen: .. or more .. the folly of expecting participation of places, when you want to act upon them.

13:11 shoover: klang: as opposed to actors?

13:13 klang: shoover: no. I don't think so.

13:20 ninjudd: alexyk: figured out how to get paren matching in cake repl. just add 'set blink-matching-paren on' to ~/.inputrc

13:20 alexyk: ninjudd: or .editrc? remember I'm on Mac with libedit

13:21 ninjudd: alexyk: i thought you recompiled ruby to use readline

13:21 alexyk: are you using the built in apple ruby?

13:21 alexyk: ninjudd: not yet, in fact using the built-in and editrc is respected

13:22 I do have MacPorts so a ruby from there should work too, I'm sure

13:22 ninjudd: alexyk: yeah, i'm using REE from homebrew. not sure how to do paren matching in libedit

13:24 alexyk: ninjudd: I have a more serious question about protobuf performance. This func was loading a 600 MB tokyo cabinet OK of int maps, chokes on 1.6 GB of double maps: http://gist.github.com/613717

13:26 it fills the whole 30 GB JVM with compressed oops

13:26 ninjudd: can you gist to .proto file?

13:26 alexyk: the fun part is, I wrote the cabinet easily from same JVM!

13:27 added

13:28 the top level data is a map string -> daily doubles, which is a map int->double

13:29 so I can write with pmap and creating protobufs, but I can't read back -- something's exploding in protobuf creation perhaps

13:29 ninjudd: alexyk: you're saying int -> int is fast, but int -> double is slow?

13:30 alexyk: ninjudd: yep. Also writing is reasonably fast, reading just hangs for the same cabinet

13:30 ninjudd: alexyk: do you still have the problem if you remove [(map) = true]?

13:30 alexyk: ninjudd: what will happen then? I thought I need it for the maps to serialize properly?

13:31 ninjudd: alexyk: just remove it and do a read test to see if that is the problem

13:31 alexyk: you may want to play with the tc bnum too

13:31 alexyk: ninjudd: with the same data?

13:32 meaning read back what I created already with [(map...]?

13:32 ninjudd: alexyk: yes

13:32 alexyk: kk

13:33 ninjudd: alexyk: you likely need to increase the bnum though, the default isn't very big

13:34 alexyk: ninjudd: how do we do comments in protos?

13:35 ninjudd: alexyk: //

13:37 alexyk: thx... didn't know about bnum, will have to play

13:38 ninjudd: btw, one issue might have been a cake JVM hung in GC -- it didn't go away and cake kill all failed to stop it, as did cake stop, restart, etc.

13:39 bartj: is there a blog which picks insightful conversations from Clojure IRC logs ?

13:40 LauJensen: bartj: No, but its a good idea

13:40 How about at small web interface where you just picked start datetime -> stop datetime and then it blogged? :)

13:41 bartj: LauJensen, since I am learning so much here...I thought it would be nice thing

13:41 alexyk: bartj: grep chouser|rhickey will do :)

13:42 LauJensen: alexyk: thats definitely a start :)

13:43 alexyk: LauJensen: |LauJensen too of course :)

13:43 LauJensen: haha, nice try

13:44 chouser: the log page already supports start/end times, though the up/down arrows code goes a bit wonkey

13:44 should add list of nicks to filter on, per cemerick's suggestion the other day.

13:44 alexyk: detecting what's a conversation is big research, not to mention insightfulness

13:45 LauJensen: alexyk: I think there's at least one guy in here who could do it

13:45 bartj: alexyk, I have been thinking about that for a while too :)

13:45 LauJensen: AWizzArd: What do you think?

13:45 alexyk: I know folks who got grants to detect IRC conversations

13:46 bartj: alexyk, omg

13:46 LauJensen: alexyk: Just to detect a conversation? I could do that in 50 lines of code :)

13:46 or 2000 in Scala if you like

13:46 alexyk: LauJensen: try it when I don't mention you :)

13:47 LauJensen: Scala will crawl out of Skagerrak and devour you one night

13:47 :)

13:47 LauJensen: alexyk: Skagerrak? It tried, I bitchslapped it with parentheses, or didnt you see that blogpost? :) Oh wait, that was Python

13:47 alexyk: it moonglights as a sea monster and is not amused at being made fun of by clojurers

13:48 LauJensen: "Clojurians"

13:48 AWizzArd: LauJensen: one sec, just came back home from work

13:48 bartj: LauJensen, what is this skagerrak you talk about ?

13:49 LauJensen: bartj: Its a place in the north of jutland, not far from where I grew up. Actually I partly grew up there

13:49 alexyk: http://en.wikipedia.org/wiki/Skagerrak

13:49 AWizzArd: LauJensen: ah, I see what you mean. I can't say anything about it, especially not in public. It's more targetted at you :)

13:50 LauJensen: AWizzArd: Fine :)

13:51 bartj: ok

13:52 * alexyk is proud of his Denmark associations

13:52 LauJensen: alexyk: Which are?

13:53 alexyk: that Skagerrak and Kattegat came to mind right away! From like 8th grade :)

13:53 LauJensen: Nice

13:54 You're not in 9th grade now by any chance? :)

13:54 alexyk: LauJensen: in about 36th by now :)

13:55 not to mention the Battle of Jutland, of course, where teh British navy was so soundly trounced

13:55 LauJensen: hehe, Denmark has a pretty bad track record when it comes to fighting. I think I think we're probably the first in the world

13:56 And as Chouser reminded me, our country is invaded right now and we're just playing WWII all over again, doing nothing :)

13:56 kryft: alexyk: Hi again, Alexy. What kind of performance can I expect from clojure for numerics? (I got the impression yesterday that you have some experience in this area)

13:57 alexyk: ninjudd: well JVM quickly eats up all its memory :( I don't know if bnum should help, but I'll try

13:57 klang: Vi bringer hilsner til Peter, Hanne, Anders, Birgitte, Liv, Olaf, ..

13:57 alexyk: kryft: I'm pretty nonnumeric yet, but from the infer/incanter I see they use Colt which is fairly strong-ish :)

13:57 LauJensen: kryft: You can expect exactly the same performance as Java in version 1.3. You can pass and return primitives

13:58 bartj: I am looking at the clojure logs

13:58 alexyk: klang: aren't you a Scala guy?

13:58 * alexyk alexyk's MacBook whispers it has 6 minutes of battery left

13:58 kryft: LauJensen: Hmm, and how far is Java from (say) C these days?

13:58 LauJensen: kryft: As fast, soon faster according to Cliff Clicks talk last night

13:58 klang: alexyk: no, I'm pretty hooked on Clojure ..

13:59 kryft: LauJensen: Ok, great. :)

13:59 alexyk: klang: OK, I'm mixing some tweets probably :)

14:00 kryft: Even if clojure were as slow as matlab, I'd still want to use it, but if I can get performance fairly close to C, there's no reason not to use it for everything. ♥

14:00 klang: alexyk: I was not fast enough to get 'klang' on twitter :-(

14:00 LauJensen: kryft: thats certainly true

14:00 alexyk: kryft: well OCaml and Haskell still beet it by a factor of about 2 in my huge benchmark to be published this month

14:00 LauJensen: Actually Im planning a blogpost about fast numerics coming up soon

14:01 alexyk: Im guessing your not using primitives then ?

14:01 alexyk: LauJensen: not numerically, datastructures and iterations

14:01 LauJensen: Ok, look forward to seeing and debunking it

14:01 alexyk: LauJensen: absolutely

14:01 kryft: :)

14:02 alexyk: LauJensen: if I raise $$$ for Conj, I hope to show it then if given an opportunity

14:02 KirinDave: technomancy: Hey, quick emacs question. do you know why slime-mode might refuse to fire when hooked into a clj buffer?

14:02 LauJensen: I actually did a blogpost where Clojure eventually outperformed Haskell on something like fibonacci or something similar, man did I get flooded with emails from Haskaloonies flaming me about not using the correct compiler switched etc etc

14:02 alexyk: it is the largest program ever in Haskell in terms of memory usage and overflown its GC

14:02 kryft: alexyk: Even if that were the case, a factor of 2 is not too bad. :)

14:02 alexyk: Clojure is OK memory-wise :)

14:02 LauJensen: wow

14:02 KirinDave: technomancy: I have this thing where slime-mode doesn't understand namespaces and stuff, and it really messes with my completion. Slowly driving me mad.

14:03 tomoj: KirinDave: any metadata at all in the ns?

14:03 KirinDave: tomoj: No

14:03 tomoj: found it it's not just docstrings that break it

14:03 shoot

14:03 KirinDave: Even naive (ns namespace) lines don't register. It still says [Clojure user] in the modeline.

14:04 technomancy: KirinDave: I've only ever heard of that happening with weird metadata being added to the ns

14:04 but ns detection uses a regex, so it's not the greatest mechanism

14:05 KirinDave: technomancy: I am basically at a loss. I don't understand what I have to do to fix this. I'm using new swank, only elpa, and nothing fancy in my config.

14:05 technomancy: But it means completion in buffers is broken, etc.

14:05 LauJensen: KirinDave: By completion you dont mean dabbrev-expand then?

14:06 technomancy: KirinDave: if you want to debug you can look into the clojure-find-package namespace and see what it returns

14:06 KirinDave: LauJensen: I mean slime-complete-symbol

14:06 technomancy: sorry, the clojure-find-package defun (in elisp)

14:07 KirinDave: technomancy: It seems to understand that it should be the right package.

14:07 LauJensen: KirinDave: ah ok

14:07 technomancy: KirinDave: and slime-find-buffer-package-function is set to that function?

14:08 KirinDave: technomancy: I'll check

14:08 * technomancy suspects some CL-specific slime config left somewhere

14:13 bobo_: LauJensen: the urls in your atom feed seems wrong

14:13 LauJensen: bobo_: Yea I've had some trouble with the feed today

14:14 bobo_: i liked your 404 anyway :-)

14:15 KirinDave: technomancy: http://cl.ly/2hXm

14:15 LauJensen: Thanks -On the upside I get to show it off until I find time to fix this

14:18 technomancy: KirinDave: it should be different inside a clojure-mode buffer

14:18 mvid: is there a way to have leiningen pull the latest stable version?

14:18 technomancy: mvid: yes, using version ranges, but it's usually a bad idea

14:19 KirinDave: technomancy: I M-: and type in that function name while in a clojure buffer and it comes up the same.

14:19 mvid: technomancy why is it a bad idea?

14:20 technomancy: KirinDave: there's your problem; that should be getting set by clojure-mode near the bottom

14:20 oops; gotta jet

14:25 * KirinDave sighs.

14:25 KirinDave: Now I've made it even worse

14:35 So i can get clojure-mode to assert itself if I run clojure-mode-enable-slime-for-open-buffers

14:35 But before I run that, it won't do anything

14:45 raek: KirinDave: quick question, do you use auto-complete?

14:45 KirinDave: raek: No.

14:45 I mean, I use complete-symbol

14:45 (or I used to)

14:45 it's sorta working now.

14:46 raek: http://github.com/purcell/ac-slime caused some problems for me (the namespace-file association didn't work)

14:50 cemerick: uncles?

14:50 chouser: I think we should show up to the conj wearing those "old guys rule" tshirts

14:50 chouser: heh

14:56 LauJensen: oh hi chas :)

14:56 hv: What is the current solution for the jvm slow startup problem? Is nailgun still the only solution?

14:57 LauJensen: hv: in which setting?

14:57 hv: LauJensen: which setting has a better solution?

14:58 LauJensen: hv: For building applications, for running them, for development?

14:58 hv: (since you asked about the setting I interpreted that there is a setting that has a better solution)

14:58 running, and also probably development

14:59 arkh: if I have a (defrecord R [one two]) and (let [r R. (1 2)] ... ), is it more common to refer to 'r' as (:one r) or (r :one) ?

14:59 LauJensen: Ok, for a desktop program you can use the switch -client, then the jvm starts in about 1 second. Though using a different optimizer

14:59 hv: For development, just use swank

14:59 arkh: er .. should be (let [r (R. 1 2)] ... )

15:00 defn: Anyone here check out George Jahad's CDT?

15:00 hv: LauJensen: I often use swank, but sometimes I need to run programs outside emacs.

15:00 defn: Wow.

15:00 LauJensen: arkh: (:one r) unless you implement invoke for your record. keywords are functions, your record is not a function taking a keyword

15:00 defn: I checked out his screencast

15:01 hv: I dont follow... outside of Emacs?

15:01 arkh: LauJensen: thank you

15:01 defn: LauJensen: pretty impressive stuff.

15:01 LauJensen: defn: extremely much so, yea

15:02 defn: a fancy (dbg ...) macro is nice, but wow -- showing you the java source and everything... pretty amazing.

15:02 * defn needs to start over from scratch with his Clojure emacs config and roll things like testing and CDT into a nice little package

15:02 LauJensen: yea, and evaluating individual lines of java, just wow

15:02 defn: team up with mrBliss

15:02 hv: LauJensen: what is the swank equivalent of "stuff | java -cp '...' clojure.main your-script/main | other stuff"

15:03 LauJensen: hv: dunno

15:03 defn: LauJensen: link?

15:03 LauJensen: defn: link to mrBliss ?

15:03 defn: he's the guy who wrote this: http://github.com/mrBliss/dotfiles/blob/master/.emacs.d/clojure.el

15:03 defn: mrBliss: oh I didn't see you there -- do you have a github repo for what you're working on?

15:03 LauJensen: He's lurking in here atm

15:03 defn: ty LauJensen

15:03 LauJensen: defn: Im like, soo much ahead of you

15:04 :)

15:04 defn: :D

15:04 mrBliss: what Lau posted is all I got

15:04 hv: umm, what is CDT?

15:04 Raynes: Clojure Debugging Toolkit

15:04 Or something similar.

15:04 defn: mrBliss: Let's start a google doc and link to gists/dotfile repos that have ideas we could role up into a single clojure.el

15:05 maybe have some options from clojure.el to turn on and off lein functionality, toggle testing frameworks, etc.

15:05 mrBliss: defn: good idea

15:05 LauJensen: defn: ehm, try cake

15:05 defn: LauJensen: I use cake

15:06 that was why i suggested turning on and off lein, toggles and such -- it'd be nice to say "I use lein -- integrate things." or "I use cake -- make it work."

15:06 mrBliss: I'm not that proficient in Elisp, I'm just good at scavenging other people's dotfiles ;-)

15:06 but a standard clojure.el for beginners (and advanced) users is a good idea

15:06 defn: mrBliss: same here -- but it's not too hard to learn. I just hate the regexen.

15:07 mrBliss: true that

15:07 LauJensen: double true

15:07 defn: I think that's a song...

15:07 LauJensen: Raynes: You've been very absent the last days havent you ? Started sleeping at night again ?

15:07 defn: true that. // (double true)

15:08 * hv looks into his clojure.el ..., hmmmm

15:09 defn: mrBliss: http://gist.github.com/613890 -- that's a mess I made while adding things to technomancy's starter-kit

15:10 http://gist.github.com/337280 is worth a peek

15:11 mrBliss: I remember having those commented out lines (L43 etc) in my clojure.el for months. I removed them because I heard somewhere that fuzzy matching doesn't come with slime from ELPA

15:11 jashmenn: if im defining a method in extend-type can i / how do access 'super' ?

15:11 hv: btw, is there an easy way to eval clojure code in arbitrary emacs buffers?

15:11 mrBliss: defn: a good start would be figuring out what each line/form exactly does, so we can purge the redundant crap

15:13 defn: mrBliss: to me a nice clojure.el includes the ability to have CDT running, a swank connection for your project, and possibly a continuous integration-style test framework like lazytest

15:13 so you can say M-x start-lazytest, M-x start-cdt

15:13 or something like that

15:14 hiredman: you might want to checkout http://github.com/technomancy/durendal too

15:15 mrBliss: I saw the CDT screencast and honestly, I don't see what's so special about it. (I was a bit distracted while watching)

15:15 hiredman: was thinking of using durendal too

15:15 defn: hiredman: beautiful

15:15 technomancy: double beautiful

15:15 mrBliss: I have durendal-dim-sldb-font-lock in my clojure.el but I see no effect

15:15 alexyk: ninjudd: would bnum help with GC overhead anyhow?

15:16 _rata_: what's CDT?

15:16 LauJensen: _rata_: scroll up 25 lines or so :)

15:16 _rata_: ok

15:17 * alexyk exercised restraint instead of saying Central Daytime-savings Time

15:17 ninjudd: alexyk: tokyocabinet does not get garbage collected. it is in C

15:18 alexyk: ninjudd: exactly, so what I think is filling up JVM upon read is either its JNI or protobuf :)

15:18 * mrBliss just moved his OS X dock from the bottom to the left and has trouble adjusting

15:18 ninjudd: alexyk: you have the same problem without [(map) = true]?

15:18 alexyk: ninjudd: seems so

15:21 Raynes: LauJensen: I've been sleeping at night, yes, but that isn't why I've been inactive. I've just been busy for the past couple of days.

15:23 * cemerick contemplates putting together a patch to improve using Clojure from Java

15:23 Raynes: Like today. Doctor's appointment. This particular doctor is never in a hurry, so I'm sure to not be back until around 10pm.

15:24 hv: cemerick: what are the improvements?

15:25 hiredman: ((IFn)RT.var("some", "fn")).invoke();

15:28 cemerick: hv: little stuff: there should be an RT.var or Var.find that takes a single string; an IFn wrapper should be available that catches Exceptions and rethrows unchecked ones; there are other small things that I can't remember at the moment

15:29 hv: yeah, I agree

15:30 cemerick: oh, there should be an RT.require

15:30 chouser: how about a Clojure class for Java-facing static methods to live in?

15:30 cemerick: aside from RT, you mean?

15:31 so people don't have to wade through *everything* ;-)

15:31 chouser: hm, would that unecessarily bifercating things? I dunno, just brainstorming.

15:31 cemerick: no, I think that's a great idea

15:31 mrBliss: defn: I'll start rebuilding my clojure.el (adding function by function from my current clojure.el) and I'll try to document each setting.

15:32 chouser: Clojure.require(), Clojure.evalString("(...)")

15:32 defn: mrBliss: Want me to make a github repo?

15:32 chouser: maybe it's actually a seperate lib

15:32 cemerick: nah, I want that everywhere

15:32 mrBliss: defn: as soon as we have something tangible

15:32 cemerick: it's just a cleaner delegate for RT

15:33 *with javadocs*! :-P

15:34 defn: so there is lazytest, clojure.test, and ive seen a couple others -- failing to remember them now...

15:34 duck1123: circumspec

15:34 defn: no one has touched that since April unfortunately

15:35 Conducta is another I guess

15:35 testing frameworks are the new irc bot

15:36 mrBliss: defn: Conducta is even older (Jan 2009)

15:36 defn: http://github.com/marick/Midje

15:37 mrBliss: I've seen a screencast about Midje's emacs mode

15:37 defn: does it do continuous testing?

15:37 TeXnomancy: if you're already in Emacs, continuous testing is easy with an after-save-hook

15:37 doesn't need to be supported by the test lib

15:38 mrBliss: defn: don't know, haven't looked into it yet, still on my todo list (TeXnomancy: good to know, thanks)

15:38 defn: TeXnomancy: right, but having a nice easy way to turn it on for multiple testing frameworks would be nice OOTB

15:39 TeXnomancy: what was that plugin that played harmonic tones if your tests passed?

15:39 jjido: is there a (forget) function for the interactive prompt?

15:40 antares_: technomancy: hey

15:40 cemerick: chouser, bv: http://www.assembla.com/spaces/clojure/tickets/452

15:41 defn: that's too bad -- I can't seem to find it anywhere now...

15:41 cemerick: er, hv ^^

15:41 defn: someone created an awesome little lein plugin that would play dissonant notes for the number of failed tests

15:41 * cemerick might be getting old enough to need glasses, even :-P

15:42 defn: an audio feedback look

15:42 loop

15:43 MayDaniel_: defn: lein-play ?

15:43 defn: MayDaniel_: no this was more interesting

15:44 if your tests passed it would play (midi i think) a nice consonant chord

15:44 if your tests failed it was become dissonant

15:44 but it changed depending on the number of passes/fails

15:44 it was really smart and interesting

15:44 alas I can't find it on github anymore

15:50 found it! http://github.com/bgruber/lazytest-listen

15:51 mrBliss: defn: gotta go now, but I'll certainly continue working on clojure.el :-)

15:52 defn: mrBliss: pm me just to remind me

15:52 mrBliss: will do

15:53 bye for now

15:53 defn: ciao

16:12 _rata_: is there any way in clojure to develop a GUI that can be compiled (without modifications or with small ones) to be a web page (RIA) and a traditional GUI? is anything like that in any programming language indeed?

16:12 jjido: I used (def x (with-meta ... {:type (var myclass)})) ... @(type x), now I have a new class created by a function. Can I use {:type (var (somefunc 1 2 3))}? What else?

16:13 bobo_: _rata_: i think that was one of the goals with javafx

16:14 hiredman: jjido: no you don't

16:14 _rata_: bobo_, and does it do a good job work?

16:14 s/work//

16:14 sexpbot: <_rata_> bobo_, and does it do a good job ?

16:15 _rata_: hahahaaha... thanks sexpbot

16:15 bobo_: _rata_: well... havent seen any real example. and javafxscript is canceld to be replaced with a java api that doesnt exist yet :-)

16:15 jjido: hiredman: ref then?

16:16 hiredman: jjido: what about it?

16:16 bobo_: _rata_: but if you write a very thin gui and abstract away everything. the result will be alot nicer for not that much more work, fi you wirte a separate gui for web and thick

16:16 jjido: I used (def x (with-meta ... {:type (var myclass)})) ... @(type x), now I have a new class created by a function. Can I use {:type (ref (somefunc 1 2 3))}?

16:16 hiredman: no you don't

16:17 jjido: mmh, why?

16:17 hiredman: why what?

16:19 raek: jjido: can you show some example of how this is used?

16:19 jjido: raek: I need to cook up something a little simpler, one minute

16:20 raek: I can see that you are attempting to do some kind of custom type tagging system

16:20 hiredman: the are at least two things wrong with what you said, so your simple case will undoubtably have more things wrong with it, I suggest you spend more time reading docs

16:21 bobo_: http://gist.github.com/613998 is that possible to make it work? ie appending id to the key for the selector?

16:25 dnolen: ,(keyword (str "div#" "foo"))

16:25 clojurebot: :div#foo

16:25 dnolen: bobo: ^

16:25 ,[(keyword (str "div#" "foo"))]

16:25 clojurebot: [:div#foo]

16:26 dnolen: ,(let [id "foo"] [(keyword (str "div#" id))])

16:26 clojurebot: [:div#foo]

16:28 dnolen: jjido: yeah you're going to have to explain what you're doing. ah-hoc typing maps via metadata and Java classes don't have much in common.

16:31 bobo_: dnolen: awesome thanks

16:34 jjido: so it starts like that http://gist.github.com/614023

16:38 chouser: jjido: what are you trying to accomplish?

16:38 jjido: chouser: that is some code I use to translate my own language into Clojure code

16:38 I mean, to represent my own language?

16:41 chouser: it looks like you're trying to devise your own method distpatch mechanism, but I don't understand how you want it to behave.

16:43 jjido: updated the gist. Yes I have my own dispatch. The names ending in "Class" represent classes with class fields and methods.

16:45 chouser: what are you trying to do?

16:47 what is the :type metadata value supposed to represent?

16:47 raek: one piece of advice: clojure tend to keep as much as possible unconflated with types. for example: hierarchies, dynamic dispatch (multimethods), objects holding data are ordinary maps, rather than one class for each "thing" that data can be about...

16:48 now to the point: it is not necessary to use records for normal data representation

16:49 I think very many (of not most) Clojure programs can be written entierly without records

16:50 if they don't implement any protocols, they aren't much more that maps

16:51 </rant-by-guy-that-got-into-clojure-before-1.2>

16:51 :-)

16:52 chouser: heh

16:52 tomoj: don't they get faster access times?

16:52 (not to suggest we should turn all our maps into records for that reason...)

16:53 TeXnomancy: I don't think they get faster access times, just that they save a bit of memory by storing the keyset once

16:53 if you've got loads of em

16:57 jjido: I used to implement protocols, but I had to remove them

16:58 either they did not relate well to what I wanted to define or they were not flexible enough

16:58 fliebel: TeXnomancy: So isn;t that the same thing as structs?

16:58 tomoj: what's the thing where a literal keyword access is optimized somehow? for all maps?

16:59 jjido: the program I posted doesn't work, don't know what I do different

16:59 TeXnomancy: fliebel: it's the same speed improvement, yes. modulo protocols I think they are very similar

16:59 that is to say: protocols are what make records interesting

16:59 chouser: lookup by keyword on a record can be as much as 30x faster than lookup on a small array-map

17:00 raek: records are stored in a more compact manner, since the fields are real instance variables of the resulting class

17:00 chouser: BUT don't even begin to think about that until your concepts are proven, such as by having code that works

17:02 dnolen: jjido: that seems overly complicated, and it's still not clear what the 'point' is.

17:03 jjido: and by that I just mean, what are you trying to accomplish

17:05 tomoj: dnolen: "Since Aleph conforms to Ring, you could just use Compojure's routing library." that works for routing synchronous requests, but what about async? I mean, the channel won't thread through moustache's app handlers

17:06 jjido: dnolen: I want to use my own type definitions, my own dispatch and be able to manipulate said type by "overriding methods" (which translates into replacing the function associated with a keyword in the type)

17:06 dnolen: tomoj: I think Brenton Ashworth is discussing that very thing on the Aleph ML

17:06 tomoj: plus I would talk to ztellman about that anyway ;)

17:06 jjido: purely for educational purposes?

17:07 jjido: dnolen: no, that's my first implementation of my language.

17:07 dnolen: jjido: ah you want to implement a language on top of Clojure?

17:08 jjido: dnolen: yes

17:12 dnolen: jjido: you're going to have to familiarize yrself some more with deftype/defrecord and ad-hoc typing first off. and then decide if the approach you're taking is the right one, to me it seems overly convoluted.

17:14 jjido: I would first use those technique in an idiomatic way and see how they would actually fit in whatever framework yr trying to build. I've never seen any try to combine ad-hoc typing, defrecord, vars, and maros in the way you've combined them in yr gist.

17:14 s/any/anyone

17:16 jjido: dnolen: when I tried using protocols I found that multimethods cause name clashes

17:16 then I found that there is no (letrecord) or (letprotocol)

17:17 raek: temporary types?

17:17 jjido: raek yes

17:18 raek: I can't recall that I have seen that in any language... (if you don't count private types)

17:18 chouser: why aren't you just using maps of functions?

17:18 jjido: my example was supposed to show a temporary type

17:18 dnolen: jiddo: hmm, what did trying protocols have to do with multimethods?

17:18 jjido: chouser: I am close to that

17:19 amalloy: speaking of protocols, is there a protocol or a multimethod for arithmetic? eg a Numberable protocol for custom types, or a multimethod for + [type1, type2]?

17:19 chouser: amalloy: nope

17:19 jjido: dnolen: when you implement a protocol, you use the multimethod mechanism to select the appropriate function body

17:20 well it looks that way

17:20 chouser: amalloy: But you can have your own + in any namespace you want

17:20 dnolen: jjido: not true at all

17:20 raek: amalloy: there is this, though: http://clojure.github.com/clojure-contrib/generic.arithmetic-api.html

17:20 dnolen: jjido: protocols and multimethods are conceptually related, but not in usage at all.

17:21 raek: "alternate" arithmetic fns, that are extendable

17:21 jjido: dnolen: ok I jumped to conclusions.

17:23 raek: you can do an awful lot of things with only maps and functions...

17:24 dnolen: jjido: multimethod are a generic dispatch mechanism, you can provide you're own dispatcher.

17:25 jjido: dnolen: I am not sure I understand what you're saying, but it sounds interesting

17:25 lancepantz: lol

17:26 amalloy: thanks raek. i don't have a need to do this in any real code atm, i'm just trying to see how close to a built-in type i could make complex numbers, for rosettacode

17:27 dnolen: jjido: you can provide your own dispatch fn. that means you can dispatch on whatever you want, type, length, whether something conforms to a protocol, wether an argument is divisible by 3, etc.

17:28 arkh: are there times, other than closures, when memory is not 'guaranteed' to be freed by moving out of something's lexical scope?

17:30 cemerick: holding onto the head of a realized lazy seq can certainly lead to more allocation than one expects

17:31 amalloy: arkh: dynamic bindings, right?

17:31 ,(doc with-bindings)

17:31 clojurebot: "([binding-map & body]); Takes a map of Var/value pairs. Installs for the given Vars the associated values as thread-local bindings. The executes body. Pops the installed bindings after body was evaluated. Returns the value of body."

17:31 arkh: amalloy: yes, with (let) in my case

17:32 amalloy: oh ...

17:32 amalloy: arkh: but let is lexical, not dynamic. my point is that dynamic bindings extend beyond lexical scope, or are sorta orthogonal to it, depending how you think about it

17:33 arkh: amalloy: ok, that makes sense

17:33 I'm doing some java interop and because I'm not doing any of the above, I should probably look at my use of Java for the memory leak I'm seeing

17:43 jjido: ,(doc def-multi)

17:43 clojurebot: It's greek to me.

17:43 jjido: ,(doc defmulti)

17:43 clojurebot: "([name docstring? attr-map? dispatch-fn & options]); Creates a new multimethod with the associated dispatch function. The docstring and attribute-map are optional. Options are key-value pairs and may be one of: :default the default dispatch value, defaults to :default :hierarchy the isa? hierarchy to use for dispatching defaults to the global hierarchy"

17:43 plathrop: The clojurebot makes me happy

17:43 jjido: lol

17:45 My gist now runs, I fixed it http://gist.github.com/614023 . I may find another way of doing it but for now it seems ok.

17:58 Can a macro insert a newline character in the code? I have trouble with line numbers for errors

18:01 raek: jjido: macros don't work on text

18:02 jjido: raek: all right, this one does postwalk-replace

18:04 amalloy: clojurebot: botsnack

18:04 clojurebot: thanks; that was delicious. (nom nom nom)

18:04 amalloy: plathrop-away: ^^

18:06 jjido: clojurebot: botbed

18:06 clojurebot: Titim gan éirí ort.

18:06 jjido: mmh, I tried.

19:05 konr: Is there an http client that can handle sessions and cookies, like cURL does?

19:06 AWizzArd: Is there a foo that does (foo keyword? [[1] [2] [3] :x 1 :y 2]) ==> (([1] [2] [3]) (:x 1 :y 2))? I thought about something like 'split-at-first'

19:07 Splitting a sequence into two as soon an element with specific properties is found?

19:22 tomoj: ,(split-with (complement keyword?) [[1] [2] [3] :x 1 :y 2])

19:22 clojurebot: [([1] [2] [3]) (:x 1 :y 2)]

19:26 AWizzArd: yes, that seems good

19:29 tomoj: good idea

19:29 amalloy: AWizzArd: partition-by also works, depending on what behavior you want

19:30 ,(partition-by keyword? [[1] [2] [3] :x 1 :y 2])

19:30 clojurebot: (([1] [2] [3]) (:x) (1) (:y) (2))

19:30 amalloy: oh nm, i see that's not the behavior you want :P

19:33 AWizzArd: amalloy: yes, partition-by is what I used first (let [[f & xs] (partition-by …), map (apply hash-map (apply concat xs))] (calculate-something-with f) (be-happy-with map))

22:01 scottj: ,(mapcat (fn [[a b]] (vector (inc a) b)) (partition 2 [1 2 3 4]))

22:01 clojurebot: (2 2 4 4)

22:02 scottj: Is there a shorter version of that, where inc would be any one arg fn?

22:05 tomoj: hmm

22:05 ,(map #(if (even? %2) (inc %1) %1) [1 2 3 4] (range))

22:05 clojurebot: (2 2 4 4)

22:05 tomoj: bit shorter

22:06 scottj: ,(map-indexed #(if (odd? %1) %2 (inc %2)) [1 2 3 4])

22:06 tomoj: ,(map-indexed #(if (even? %1) (inc %2) %2) [1 2 3 4])

22:06 clojurebot: (2 2 4 4)

22:06 (2 2 4 4)

22:06 tomoj: :)

22:07 scottj: thanks

22:55 duck1123: What do I need to do if I want to import a class named Object?

22:56 is there a way to exclude importing classes in java.lang.*

23:02 tomoj: why the hell did someone make a class named Object?

23:02 try (ns-unmap *ns* 'Object)

23:03 or you could refer to it fully qualified

23:03 (def NotObject foo.bar.Object)

23:03 duck1123: that seemed to do it

23:03 tomoj: wonder if you can do (NotObject.) after that

23:04 nope, you can't

23:04 duck1123: doesn't seem like it

23:52 _rata__: how do I change the indentation for a form in emacs? (I'm using swank-clojure)

23:52 I'd like the (complex [] ...) macro from fnparse library to be indented like let

Logging service provided by n01se.net