#clojure log - Jul 20 2010

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

0:05 Bahman: Hi all!

0:08 cais2002: is this the correct and latest way to refer to clj-apache-http in leiningen? [com.twinql.clojure/clj-apache-http "2.0.2"]

0:09 how do I link this to the source, e.g., is it the one on github? http://github.com/rnewman/clj-apache-http

0:11 Apage43: aleph is cool but has anyone done stuff with the client parts or the rest of netty in general?

0:31 tomoj: Apage43: http://github.com/neotyk/ahc-clj

0:31 dunno if it's any good

0:31 Apage43: just found it

0:32 looks like it's abstracted even higher

0:32 will be trying it out

0:34 mostly i needed something i could point at a continuous http feed that wouldn't require keeping a thread around

0:34 tomoj: the clojure looks pretty ugly so I'm skeptical

0:34 Apage43: http.agent was sort of working, but i couldn't use a second http.agent from inside another one's handler, it would just block.

0:35 if the handler waited for another agent to do anything, anyway

0:36 I might just write something that only does what i need though, becuase ahc-clj is like, 5 levels of abstraction away from nio and that just feels clunky

0:47 cais2002: what's the difference between `~'abc and using abc directly in a macro definition?

0:49 KirinDave: cais2002: Try typing `~'abc and `abc on the repl.

0:51 cais2002: You can use ~'sym to capture variables.

1:29 konr: Is there another way to connect some arbitrary function to slots in QT besides proxying a function?

2:55 LauJensen: Good morning all

2:56 konr: Hello

2:58 cobol_expert: good evening

2:58 what types of config files are normally used in clojure projects?

2:59 xml or just clojure lists

3:00 or maybe no particular preference

3:06 LauJensen: cobol_expert: Ive seen a little bit of everything, though not a lot of xml. Regular configs where var=value\newline are supremely easy to parse, as are clojure datastructures

3:06 cobol_expert: okay, I'll stick with clojure lists

3:07 i think that's what emacs does with lisp

3:09 tomoj: project.clj is a good example I suppose

3:14 LauJensen: tomoj: Too much work a simple config

3:14 A normal var=value, #comment file can be slurped in a single expression

3:14 cobol_expert: I would, but I need some structure

3:14 LauJensen: like?

3:15 cobol_expert: like xml

3:15 actually, in clojure, it'll be a tree of structs

3:15 LauJensen: {:settings {:x 5 :y 10}}

3:15 vs

3:16 # settings

3:16 x=5

3:16 y=10

3:16 cobol_expert: first one

3:17 LauJensen: still very easy to parse, using a combination of read-string and slurp I suppose

3:17 Raynes: cobol_expert: I typically use a file containing a Clojure map for my configuration. I wrote a small library for that, even. http://github.com/Raynes/clj-config as far as I know, sexpbot is the only real project using it, so I can't promise awesomeness. Might be useful for you though.

3:17 cobol_expert: yeah, i don't think xml is the way to go

3:18 tomoj: LauJensen: you're right, project.clj is a terrible example

3:18 cobol_expert: thanks Raynes, i'll take a look

3:20 Raynes: cobol_expert: The idea is that the configuration is just Clojure data-structures. clj-config just abstracts over the reading and writing of those files and data structures, and then you can use the normal Clojure sequence functions for working with the configuration.

3:20 Clojure maps are liek teh awesomest configuration format. :)

3:20 Goodnight, friends. <3

3:21 LauJensen: Goodnight old buddy

3:40 dpritchett: Is there a solid install guide for vimclojure 2.2 snapshot? I see that Meikel prefers gradle and doesn't want to handhold folks with the install but if there's anyone else who's willing that would help a lot. I'd be happy to reblog the advice for others, too.

3:44 Apage43: dpritchett: if you figure this out that'd be awesome

3:44 i have been trying to beat vimclojure into submission for a while now

3:45 when it's working i really love it but i haven't gotten it into a working state on my mac yet

3:45 dpritchett: I'm trying with leiningen and ubuntu, not much luck since I started with 2.2

3:46 Apage43: i always get the could not determine namespace error

3:47 through lein or not

3:50 dpritchett: I see some guy claims to have fixed it with a patch to the jar here http://groups.google.com/group/vimclojure/browse_thread/thread/a717b33d63178abd/03cfd155ef4990e4

3:50 I'm trying to reproduce that but I don't really know how to point to his new jar yet

3:50 I'm messing around in /libs though

4:07 hm.. I've gotten to the point where I can invoke a repl with :call vimclojure#StartRepl()

4:07 but my localleader (i.e. \sr) isn't responding

4:12 cais2002: ,`~'abc

4:12 clojurebot: abc

4:12 cais2002: ,`abc

4:12 clojurebot: sandbox/abc

4:15 raek: ,::hello/foo

4:15 clojurebot: :hello-from-raek/foo

4:17 tomoj: oh?

4:17 ,::hello/foo

4:17 clojurebot: :hello-from-raek/foo

4:17 tomoj: you find a security hole?

4:37 bsteuber: anyone using lein-javac with leiningen 1.2 ?

4:38 cais2002: ,::hihi/foo

4:38 clojurebot: Invalid token: ::hihi/foo

4:38 raek: ,(ns add-alias-to-black-list)

4:38 clojurebot: nil

4:39 raek: ,(alias 'todo 'add-alias-to-black-list)

4:39 clojurebot: nil

4:39 raek: ,::todo/x

4:39 clojurebot: :add-alias-to-black-list/x

4:39 raek: side effects!

5:17 bartj: how do I revert back to a particular version of a CouchDB document ?

5:22 tomoj: wrong channel

5:25 bartj: tomoj, sorry wrong window!

6:02 Licenser: Good Morning

6:10 AWizzArd: I have (def x 'clojure.java.io) and would like to call (x/reader "my/file") - how can I do this?

6:12 tomoj: you can't

6:12 but you could do ((ns-resolve x 'reader) "my/file")

6:12 AWizzArd: yes, ns-resolve is it

6:13 good

6:14 Licenser: Cant you require with As?

6:18 AWizzArd: Licenser: I don't know what is inside x

6:19 I only know that the ns named by x will contain a specific symbol

6:21 Licenser: Ah okay

6:21 You cacn make a macro for that ;)

6:22 I think I get what you want, having a ns passed to a function and then using this ns as a root for some code in it right?

6:27 This is a classic: college in a telco 'I'm not sure who is responsible for the odor'

6:27 AWizzArd: I want a web server that, depending on which site it is running (locally in my dev environment, at a customer, etc), requires a NS containing the right fns and routes.

6:36 hoeck: AWizzard: just require the correct namespace at app startup-time?

6:38 Licenser: I think that won't work with cmpilation

6:49 AWizzArd: hoeck: only later, after the config file has been loaded I will know the namespace.

6:49 So, the app is already partially running.

6:50 Anyway, now I've got a working solution, via ns-resolve.

6:51 hoeck: but you could still decide (after the initial config loading stage) which namespace to require

6:54 Licenser: Ns intern and ns something else work too and quite well

6:54 I used them for a stupid template engine

7:12 AWizzArd: hoeck: yes, I load the config and then decide which NS I want to require. And this then happens.

7:12 And in this NS I access a specific var then, and can start the server.

7:54 Joreji: Hey guys, is it possible to establish a new binding for a variable from a different namespace using a macro?

7:55 I have a function in namespace B, which uses a globally defined variable. I want to rebind that variable within namespace A.

8:07 cemerick: Joreji: see binding

8:09 Joreji: But, what are you doing, exactly? It sounds like you're using vars as variables (which is decidedly wrong).

8:14 Joreji: cemerick: I have a (def *some-function* (fn [] (throw. (Exception. "Not inside context")))) which binds a function inside ns B. Futhermore I have a macro inside ns B which binds *some-function* using: (binding [*some-function* (fn [] the-context)]). Now I want to use the macro inside ns A in order to establish the context and bind *some-function* to return the context. However, that does not work (I get the initial function, not the ...

8:14 ... newly bound one).

8:16 cemerick: Joreji: binding does not change the root value of the var -- the bound value is only effective within the lexical scope of the binding form, and thread-local.

8:17 Joreji: Yes, which is why I use a macro which expands into code which 1.) establishes the new binding for *some-function* and 2.) calls the body of the macro within the (binding [...]) form

8:18 From what I understand, within the (binding) body the new binding should be bound, no?

8:18 cemerick: yes

8:18 Joreji: if you can paste code, that'd be helpful

8:25 Joreji: cemerick: I've already tried a simplified example, but there it works. There must be something wrong with my code I fear.

8:26 cemerick: If I can nail it down, I'll come back - thanks for the help anyway :)

8:37 cemerick: Figured it out. The binding body returned a lazy sequence. Once that was evaluated inside the repl, the old binding was established. A doall did the trick.

8:37 cemerick: Joreji: yup, that'll happen ;-)

8:50 Is it expected that getting an iterator from a lazy seq will force the seq? That doesn't seem right at all.

8:54 unfo-: nope, doesn't sound right, since you could loop an infinite seq

8:54 s/loop/iterate/

8:54 sexpbot: nope, doesn't sound right, since you could iterate an infinite seq

8:55 cemerick: unfo-: except...

8:55 ,(.iterator (for [x (range 5)] (do (println x) x)))

8:55 clojurebot: #<SeqIterator clojure.lang.SeqIterator@93c2>

8:55 0 1 2 3 4

8:56 unfo-: do note that the REPL and actual clj code sometimes act differently

8:56 because the REPL wants to print stuff for you

8:56 cemerick: unfo-: The same thing happens if I simply def the iterator.

8:56 unfo-: for example when I once DID want a lazy list iterated and I tried it in REPL it worked - but in my clj prog it didn't

8:57 but my clojure-fu is not strong enough to tell you what's going wrong with that line :)

8:57 i've not done any in 6 months or so

9:05 cemerick: it actually has nothing to do with .iterator

9:05 ,(-> (for [x (range 5)] (do (println x) x)) seq boolean)

9:05 clojurebot: true

9:05 0 1 2 3 4

9:08 tomoj: huh

9:08 as soon as you call seq, the whole thing is forced?

9:08 that doesn't seem right either...

9:08 cemerick: no, something's very wrong

9:08 tomoj: ohhh

9:08 wait a minute

9:08 aha

9:08 cemerick: do tell :-)

9:08 tomoj: try (-> (for [x (range 100)] (do (println x) x)) seq boolean)

9:09 and note where it stops

9:09 cemerick: ah, the chunking

9:09 hrm

9:10 that's a bit of a problem though, insofar as I'm attempting to use for to lazily load data from disk :-)

9:11 tomoj: won't for defer to the chunkiness of whatever's in the binding form?

9:12 ,(-> (for [x (take 100 (iterate inc 0))] (do (println x) x)) seq boolean)

9:12 clojurebot: true

9:12 0

9:13 cemerick: tomoj: Good catch. http://blog.fogus.me/2010/01/22/de-chunkifying-sequences-in-clojure/ for more.

9:21 tomoj: a gnarly way to force one-at-a-time:

9:21 ,(-> (for [x (->> [1 2 3] (map list) (apply concat))] (do (println x) x)) seq boolean)

9:21 clojurebot: true

9:21 1

9:36 Chousuke: cemerick: would that work with just mapcat? :)

10:04 saml: does clojure come with http library?

10:04 cemerick: Chousuke: definitely -- that was mostly the result of a little flailing around. :-/

10:43 nDuff: saml, not sure about "come with", but there are lots of 3rd-party frameworks available; see for instance Compojure and Ring, both listed at http://clojure.org/libraries

11:26 yesudeep: Does leiningen work with msys on Windows?

11:28 Also, I'd appreciate if one of the operators told me why my nickname yesudeep` is banned in here.

11:30 cemerick: yesudeep: we don't have an op here, unfortunately. The owner of the channel has been awol for a while, and IIRC, the admins haven't responded helpfully to making rhickey (or someone!) owner.

11:35 maravillas: yesudeep: i haven't been able to get lein working in msys...msys is missing the dirtools util

11:35 which the lein script references

11:35 Chousuke: yesudeep: it might not be banned; you just need to be identified to be able to chat here

11:36 yesudeep: ah

11:36 Chousuke: yesudeep: unfortunately irc clients don't differentiate between banning and registration-requirements :/

11:38 defn: cemerick: really? ive had good experiences with the ops

11:38 cemerick: defn: I've not been involved in that, but that's what I remember hearing.

11:38 defn: well it would make sense they weren't receptive

11:39 because jcowan was online 12 hours ago

11:39 :)

11:39 cemerick: um, who? ;-)

11:39 defn: the channel owner

11:41 * cemerick has zero knowledge with IRC, outside of using it dumbly.

11:41 cemerick: s/with/of

11:44 defn: cemerick: keep it that way. it's a waste of time :)

11:46 http://pages.cs.wisc.edu/~remzi/Classes/537/Fall2009/Projects/ -- which of these would be the most fun to port/redo in clojure?

11:46 obviously rolling your own malloc is kind of out of the picture

11:48 arkh: is it bad form to bind a symbol to itself in a loop? Trumped up example follows:

11:49 (def x 10)

11:49 (loop [y 0, x x]

11:49 (if (zero? x)

11:49 y

11:49 (recur (+ 1 y) (dec x))))

11:49 defn: yeah that doesnt look right

11:49 arkh: I appreciate your honesty : )

11:50 defn: :)

11:50 tomoj: I think I've done that before

11:50 defn: yeah but it's a bit ugly

11:50 there are better ways of going about it

11:50 cemerick: arkh: that's fine IMO, especially if x is semantically the same

11:51 arkh: though do use a pastebin next time :-)

11:51 defn: it's fine, but ugly

11:51 IMHO

11:51 tomoj: what's a better way? come up with a new name for the loop var?

11:51 cemerick: defn: you'd name a new binding just to avoid quashing an old one?

11:52 defn: yeah i guess i would

11:52 :\

11:52 tomoj: I guess the shadowing could be confusing in some places

11:52 arkh: what I want to do is take a list of things and create a new list of those things in random order. I grab a random element from the list, append to the new list, and take two subvec of the old list to rebind to that

11:52 will do pastebin next time

11:54 i.e., take two subvec's with the randomly chosen element excluded, thereby removing it from further use

11:54 * arkh hopes lists contain "elements"

11:55 defn: http://dosync.posterous.com/clojure-nodejs-and-why-messaging-can-be-lame

11:55 could someone explain to me why in his code he didn't use a ref around the atom?

11:55 tomoj: arkh: and then what, recur?

11:56 oh, I think I see

11:56 arkh: tomoj: yes, then recur. Each time one element is removed until nothing remains of the old list and the new list has elements appended in random order

11:57 cemerick: defn: Why would he need a ref around the atom?

11:57 tomoj: wouldn't you have to concat the two subvecs?

11:57 defn: cemerick: cemerick oh god sorry

11:58 im crazy

11:58 * defn chugs some coffee

12:01 arkh: tomoj: I am using concat with the two subvecs - (doall (concat (subvec iplist 0 r) (subvec iplist (inc r) (count iplist))))

12:01 tomoj: cool

12:01 arkh: tomoj: with 'r' being that randomly chosen element

12:02 tomoj: (let [r (rand-int (count iplist))] ... )

12:02 tomoj: what's the doall for?

12:03 arkh: concat produces a lazy sequence (I think) and I need to whole thing to happen

12:03 raek: I wish things like this happened where I lived http://strangeloop2010.com/speakers

12:04 tomoj: why do you need the whole thing to happen, though?

12:04 arkh: so that recur can provide the entire list back to the loop for the next iteration

12:05 it's possible I have that wrong ... still debugging and, more importantly, still learning clojure

12:05 raek: I second that :/

12:06 raek: almost every talk is about something I have a deep interest in

12:06 even the klein bottle guy will be there!

12:08 tomoj: arkh: once you get it working, try removing the doall

12:08 I bet you don't need it

12:08 lazy is good :)

12:13 AWizzArd: Any Ant expert here who knows 'zipgroupfileset' pretty good? I have a folder containing five .jar files and a few .txt files. I say excludes="*.txt" and it works pretty good. It unpacks the contents of the .jar into my own one.

12:13 But how can I exclude files that are *inside* those 5 jars that I want to überjar into my jar?

12:15 Licenser: hmm has anyone played with swing here?

12:17 arkh: tomoj: will do/try - thanks

12:29 cemerick: Licenser: played, used, loved, hated, and saddened by, yes.

12:29 Licenser: cemerick: because I've some issues with the REPL, it makes the swing app locking untill I press return a dozent times, and some output isn't printed either. Did you encounter similar problems?

12:30 cemerick: Licenser: which app, which REPL, etc?

12:30 Licenser: my app, and the slime/swank repl of emacs

12:31 cemerick: can't help there -- sounds like you're running REPL stuff on the event thread though

12:31 Licenser: I know you can#t see output in the usual one but only in the inferior lisp buffer but even there it didn't help

12:31 *nods* okay

12:32 but thanks cemerick

12:32 cemerick: FWIW :-)

12:32 any kind of UI hanging is always the execution of non-UI-related stuff on the event thread.

12:33 Licenser: heh

12:56 slyrus: huh. I didn't think this was going to be the case at first, but an immutable approach to a graph library really makes a lot of sense. a functional approach really simplifies some code.

12:57 tomoj: how'd you do it?

12:57 slyrus: (defn remove-connected-component [g start] (let [neighbors (neighbors g start)] (reduce remove-connected-component (remove-node g start) neighbors)))

12:57 tomoj: I once tried translating that paper on inductive graphs into clojure but failed

12:58 slyrus: tomoj: thanks for that pointer. i'll check it out.

12:59 tomoj: http://github.com/slyrus/shortcut if you want to check it out. very much both a work in progress and a learning-clojure exercise for me, but it's been fun.

13:00 cemerick: slyrus: you've seen c.c.graph?

13:00 slyrus: cemerick: directed graphs only

13:00 cemerick: Far from complete, but it's a damn nice start

13:00 sure

13:17 slyrus: oh, that's nice. with a simple closure for :neighbors I can map c.c.graph on top of my graph stuff.

13:22 cemerick: yeah, c.c.graph is pretty nice. I just didn't understand what to do with it when I first started this project. hrm...

13:26 defn: how do i include the 1.2.0 beta in leiningen?

13:26 1.2.0-beta1?

13:28 is the hamiltonian cycle directed?

13:28 hmm

13:32 rjevans: Yeah, I use 1.2.0-beta1 in my project.clj

13:32 defn: k thanks

13:39 cemerick: slyrus: yeah, it's a generalized model AFAIU

13:41 Plouj: so what does dynamic typing mean in clojure as it compares to the typing in Jav?

13:41 Java*

13:42 chouser: Plouj: in Java you have to declare the type of every local, every function argument, every function return value.

13:43 in clojure you aren't required to declare any of those -- they're discovered, if needed, at runtime.

13:46 cemerick: gah, not being able to reliably load classes with the "same" name, just different cases, is quite the irritant when you're generating function names and AOT'ing the results.

14:04 rubydiamond: Should I buy Kindle DX?

14:06 nDuff: I'm reasonably happy with mine, and its PDF reader is great for Manning's MEAPs (ie. Joy of Clojure). The only complaint I have is lack of ePub support; if you want to have the most available choice in terms of from whom you buy your ebooks, that's a showstopper.

14:14 * cemerick only now noticed the hn and proggit threads re: haskell, etc.

14:14 AWizzArd: Little challenge here. I compiled a project into a folder build/ and when I do java -cp "build/;100-jars" my.namespace.server then it works fine. Then I put all .class and .clj files I have in build into a .jar file. I can still run it with -cp "my.jar;100-other-jars" my.namespace.server

14:15 cemerick: I don't think I have enough juice to do it, but I hope my tweet isn't what kicked those off. :-(

14:15 AWizzArd: But, when I now remove my.jar from the cp and do java -cp "100-jars" -jar my.jar then it tells me that it can not find my.namespace.server

14:15 Any ideas? There *is* an entry in the Manifest.

14:15 hiredman: -jar and -cp cannot be used together

14:16 java helpfully doesn't print an error messsage when you try to use both

14:18 AWizzArd: wow

14:20 hiredman: so if I want to run it from a jar I better put *everything* I need inside that?

14:21 hiredman: you can specify a classpath in the jar's manifest somehow

14:22 you can also use -cp and like you did at first

14:25 defn: is there a way to (import org.foo.*)

14:26 chouser: defn: no

14:36 AWizzArd: hiredman: okay, thanks for this tip. I would have continued forever to try to include more jars on the CP, while also specifying the -jar option. Now I build an überjar and that works fine. *thumbs up*

15:09 raek: i'm curious about this Aleph lib

15:09 anyone here using it?

15:10 Licenser: not me sadly

15:11 cemerick: I'm afraid I don't grok what's so awesome about node.js, aleph, et al. :-/

15:13 Licenser: cemerick: I don't know aobut node.js, didn't found it that awsome but aleph is written in clojure :P

15:15 kotarak: ... which is a huge selling point.

15:16 raek: so, what makes Aleph stand out? it is aynchronous?

15:17 (respond!) ?

15:17 Licenser: raek: it's written in clojure

15:17 kotarak: clojurebot: written in clojure is a huge selling point

15:17 clojurebot: You don't have to tell me twice.

15:17 cemerick: raek: it's like node.js, but has a sane language and access to a huge set of libraries

15:17 * fogus rewrote a 200-line Java proxy that he wrote last year with ~25 lines of Javascript and node.js

15:17 Licenser: sorry I really don't know much about it, I like the idea of a lightwight multi thread webserver thingy for clojure apps since you can likely do nice things with it when it comes to sering many paralell reuqests

15:17 cemerick: I'm just not a web guy fundamentally. Eventing and such through port 80 today doesn't excite me like it did over any other random port when I was fiddling with sockets for the first time. But, have fun if it's your bag. :-)

15:18 * cemerick sounds old

15:18 Licenser: cemerick: perhaps you are? ^^

15:18 cemerick: gah!! :-P

15:19 "Back in the late 90's, we used to wire up network services the good old fashioned way, sonny boy!" Oy.

15:20 hiredman: the old fashion way to wire things up is with wire

15:20 cemerick: token ring, fer shure.

15:20 raek: I've done a project in compojure 0.3.x previously and I'm thinking about looking into the alternatives that have emerged

15:20 kotarak: At least the metaphor was intacrt.

15:21 raek: I mean, there seems to be a lot of ring-like web servers: compojure, aleph, moustache, etc

15:21 (please correct me if I'm missing anything)

15:22 chouser: compojure and moustache are built on top of ring

15:22 raek: ok, so ring is not only a spec for what the request and respond maps should look like?

15:22 kotarak: Are there alternatives to autodoc, which are easier to set up?

15:23 raek: is it the case that ring-based web frameworks are built on servlets and aleph not?

15:27 cemerick: The servlet 3.0 spec provides for eventing IIRC. Ring-based apps don't *need* to be deployed as servlets, but that's certainly the easiest path.

15:29 timcharper: Any counterclockwise users here?

15:31 I'm trying to test it out on a project, but it seems that you can only import maven projects?

15:31 We're using leiningen to manage dependencies, not maven

15:31 cemerick: only intellij has any support for lein AFAIK

15:33 timcharper: Why can't I just open an existing closure project? I don't understand why this is an impediment :-(

15:34 ^closure^Clojure

15:35 cemerick: timcharper: There's no such thing as a "clojure project", independent of the various development environments.

15:36 You can try opening the project in question from the lein-generated pom. Last I knew, that generated pom wasn't sufficient for building the project in question though (only used for deploying to clojars?)

15:37 Otherwise, ccw and enclojure are both good environments, and both eclipse and netbeans have good maven support.

15:46 timcharper: trying the lein generated pom wrote, thank you :-)

15:46 route

15:49 jfields: is there anyway to do this? (update-in {:x [1 2 3 4]} [:x] -> last vector)

15:50 the best I could come up with was: (update-in {:x [1 2 3 4]} [:x] -> last vector)

15:50 but, I'd prefer to do it without an anonymous function if possible.

15:50 sorry user=> (update-in {:x [1 2 3 4]} [:x] #(-> % last vector))

15:50 {:x [4]}

15:50 is the best I could come up with.

15:51 kotarak: ,(update-in {:x [1 2 3 4]} [:x] (comp vector peek))

15:51 clojurebot: {:x [4]}

15:52 jfields: cool, thanks

15:52 kotarak: jfields: although this is only marginally different to #(-> % peek vector)

15:53 jfields: kotarak, cool, thanks.

15:53 I prefer the comp solution. I was trying to use it without the parens, and my value was the fn returned by comp :)

16:02 hiredman: ,((comp (partial apply update-in) reverse list) (comp vector peek) [:x] {:x [1 2 3 4]})

16:02 clojurebot: {:x [4]}

16:03 hiredman: ,((comp (partial apply update-in (comp vector peek)) reverse list) [:x] {:x [1 2 3 4]})

16:03 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap

16:03 hiredman: bleh

16:03 Chousuke: pointlessness strikes again

16:03 hiredman: ,((partial (comp (partial apply update-in) reverse list) (comp vector peek)) [:x] {:x [1 2 3 4]})

16:03 clojurebot: {:x [4]}

16:04 cemerick: Chousuke: it actually saved me in a big way this morning. I think I've finally come to see the zen between point-free and #().

16:04 Chousuke: heh

16:05 if there's more than one comp or partial involved, I tend to use #() or fn.

16:43 TakeV: What is the purpose of the binding aspect in Conjure?

16:43 anars: does anyone know whether the clojure clr project is a "long term" project, or just a hobby project run by some loyal devs? :)

16:46 arkh: TakeV: it might be safe to say that it's usually for lexically scoped storage

16:46 TakeV: arkh: I'm not exactly sure what you mean by "lexically scoped storage".

16:48 arkh: TakeV: it's the ability to associate something with a symbol but only have that association exist within a "block" of code, or only as the arguments of a function

16:48 * TakeV nods

16:49 TakeV: So, not global storage then.

16:49 arkh: TakeV: clojure doesn't have 'variables' like an imperative language, so binding also helps keep things functional

16:49 TakeV: global storage is achieved with def

16:50 TakeV: when you want to bind something globally, use def. When you want to bind something locally, there are other ways one can and should perform the binding

16:50 TakeV: Like let?

16:50 arkh: TakeV: yes. Also loop, for, etc.

16:51 TakeV: let is a special form used by other macros like loop, for and others

16:51 * TakeV nods

16:52 TakeV: I think I'm a bit confused about how the Conjure system works. User input and requests are handled by the controller, which can affect the model and the view. So where does the binding part come in?

16:56 hiredman: binding aspect?

16:56 arkh: TakeV: the MVC model doesn't map to Clojure well (afaik ... I'm not a clojure expert). Think of what you want to do as a function. It'll take input and return the last form evaluated. A form is the smallest chunk of code that can be evaluated by clojure. Getting back to the 'function', bindings allow you to temporarily assign values to symbols or return them if it's the last form evaluated.

16:57 god I hope I didn't mangle that too poorly

16:57 hiredman: binding is some what overloaded so it helps to be specific, binding is what let does lexically, but confusingly clojure has a `binding` macro that does binding dynamically

16:57 and conjure may have it's own thing that it calls "binding"

17:11 arkh: Is there a good way to bail out of execution early? Something like a System.exit(0) ? I'm running code from a .clj file and want to do this for testing purposes ... and I don't know how to add/remove comments en masse with my editor

17:12 arohner: arkh: you can always call System.exit directly

17:12 (System/exit 0)

17:13 rhudson: anars: As I understand it, the big push in Clojure 1.3 will be "Clojure-in-Clojure" -- rewriting a lot of the Java implementation in Clojure

17:13 Until that's done, i suspect there won't be a lot of work on CLR or other target hosts

17:15 arkh: arohner: thank you

17:23 scode: What's an idiomatic way to get a BigInteger from a Ratio?

17:23 bigIntegerValue in 1.2, but that's specific to Ratio I believe.

17:23 I ended up writing a (to-bigint) that special-cased Ratio, which doesn't feel very nice.

17:24 chouser: ,(bigint 5/3)

17:24 clojurebot: 1

17:24 chouser: ,(bigint 6/3)

17:24 clojurebot: 2

17:24 chouser: like that?

17:24 scode: chouser: No, it gets truncated.

17:24 Ah

17:25 Sorry, not on master/1.2.

17:25 But on 1.1

17:25 chouser: it appears to call .bigIntegerValue when it's a ratio

17:25 ah

17:25 scode: But bigint sounds nice; I'll chalk 1.1 behavior up to a bug. :)

17:25 Thanks.

17:26 raek: is autopromotion still in use in 1.2?

17:26 scode: The fix seems to be committed as 8e916164ca3a57e5ce924ed153fe435356f8d4a0

17:28 (and the bug was http://www.assembla.com/spaces/clojure/tickets/290)

17:31 Raynes: ,(clojure-version)

17:31 clojurebot: "1.2.0-master-SNAPSHOT"

17:32 Raynes: -> (bigint 6/3)

17:32 sexpbot: => 2

17:53 neotyk: clojurebot: seen zahardzhan

17:53 clojurebot: no, I have not seen zahardzhan

18:41 jacortinas: hello

18:41 quick question for anyone

18:42 if the reader macro "^" for metadata is deprecated

18:42 what's the syntax now for declaring metadata on a function using defn?

18:45 lozh: ^ is the new syntax #^ was the old

18:45 raek: ,(doc defn)

18:45 clojurebot: "([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"

18:46 raek: you can also specify metadata with that attr-map

18:46 (defn foo "Does neat stuff" {:some "metadata"} [x y] (+ x y))

18:47 but as lozh said, you can still use ^ syntax

18:48 (defn ^{:some "metadata"} foo ...

18:48 the difference is that the former is evaluated during run-time and the latter during read-time

19:28 bortreb: could you guys help out a clojure newbie? I want to see if my code is idomitically correct and also if you think this function is even usefull http://gist.github.com/483772

19:29 I'm thinking about calling it mix. it's for combining algorithms that have complicated and different fun-time properties

19:29 it runs all the functions in separate threads, and then returns the "fastest" result

19:29 s/fun-time/run-time

19:30 raek: :)

19:32 I usually write (ns #^{:doc "docstring", :author "Author"} namespace ...) as (ns namespace "docstring" {:author "Author"} ...)

19:33 (makes indentation more pretty)

19:33 bortreb: oh cool I didn't know that you could do that1

19:34 raek: futures are faster to create than threads since futures uses a thread-pool

19:35 i.e. lesser start-up cost

19:35 bortreb: ah so my explicit thread version is rather niave then

19:36 but it still seems so sad to use an entire therad to just check whether the atom has changed :(

19:37 raek: creating threads that way can still be useful

19:38 is there any special reason you keep ::void in var?

19:40 bortreb: heh, no I could just put ::void directly in the atom

19:40 for some reason I thought you couldn't do that which is silly

19:40 raek: one can also create sentinel objects with (Object.)

19:41 (namespaced keywords are perfectly fine too)

19:42 * raek plays around with Aleph

19:44 bortreb: Aleph the game engine?

19:47 raek: nohttp://github.com/ztellman/aleph

19:47 s/nohttp/http/

19:47 sexpbot: http://github.com/ztellman/aleph

19:48 raek: there seems to be a lot of software projects called aleph

19:48 lancepantz: does that come from somewhere?

19:48 raek: and also a programming language

19:48 the name?

19:49 talios: Aleph looks cool.

19:49 * talios wishes he had time to play with aleph, more clojure, more other fun things, and less work.

19:50 Apage43: aleph is cool but i'm waiting for a more useful async client library.

19:50 raek: it's the first letter of the phoenician alphabet, the ancestor of the amaric, arabic, hebrew and greek alphabtes

19:50 bortreb: aleph is a name for the tansfinite cardinal numbers; that's all I've ever heard it used for

19:51 raek: aleph <-> alpha, beth <-> beta, gimel <-> gamma, etcs

19:51 lancepantz: hmm

19:51 bortreb: like aleph-one is a "bigger" infinity than all the natural numbers, for example

19:52 talios: Apage43: tried http://clojars.org/ahc-clj - built ontop of the ning async client library?

19:52 raek: I like the concept of "bigger" infinities...

19:52 talios: Apage43: http://github.com/neotyk/ahc-clj

19:56 bortreb: is there a way to remove jars you've uploaded to clojars that were mistakes or is this impossible?

19:57 lancepantz: bortreb: i don't think so, let me know if you figure that out

20:29 tomoj: can you refer to the generated class in an ns which uses gen-class?

20:30 e.g. to construct an instance in -main

20:43 oh, seems you can if you :name it

21:03 akhudek: hey everyone, I have a code pattern for which I *think* maybe monads would be the correct solution

21:03 however, the solution is not obvious to me

21:03 I put an example here http://pastebin.com/eTGPD6vw

21:04 essentially, I want to carry forward a state in the first arguement and first return value

21:04 and otherwise have it behave like a let

21:04 is this a macro job or would some clever monad work?

21:18 mikem: akhudek: it almost looks like you could just use -> or ->> except you have two return values from the first two functions

21:19 akhudek: yeah, that's the problem, those need to behave as in a normal let since they are often used later down the chain

21:19 I'm trying to figure out if some combination of state-m and state-t might do it

22:37 Raynes: That's weird. In Leiningen, when I do :dependencies [[org.clojure/clojure "[1.1.0,)"]], which should be an open-ended version range, it always tries to grab clojure-contrib-master-SNAPSHOT

22:38 talios: clojure-contrib? weird.

22:38 * talios must look at leiningen sometime.

22:40 Raynes: I mean, org.clojure/clojure-contrib

22:40 I'm doing 30 things at once. :p

22:42 talios: I guess for some reasons "master" evals to being newer than 1.1.0 - the master in their kinda sucks.

22:42 its like a classifer for the classifier

22:42 actualy, the classifier is after the version. hrm

22:43 Raynes: talios: I'd understand that if the -master-SNAPSHOT version actually existed, but apparently it doesn't.

22:43 It's trying to grab something that doesn't exist, even though I didn't tell it to do so.

22:43 talios: I think it -used- to. I remember using -master sometime ago from one of the build boxes

22:43 maybe its in your local repo

22:44 Raynes: If it is, wouldn't it succeed in grabbing it?

22:44 talios: it might be in the metadata, but no jar?

22:46 Raynes: I hate maven. ;(

22:46 talios: but maven is all goodness :)

22:46 (that being said, we always feature maven-pain-of-the-week on the podcast) heh

22:47 Raynes: Luckily, it doesn't look like we need version ranges.

22:47 If you use the normal "soft" version requirement, but the project that uses the library requires a different version of the same thing, that version is preferred.

22:47 I just noticed that.

22:49 * Raynes proceeds to eliminate version ranges from clj-sandbox and stupiddb.

22:52 mmarczyk: Raynes: for some reason http://build.clojure.org/snapshots/org/clojure/clojure-contrib/maven-metadata.xml includes 1.2.0-master-SNAPSHOT

22:53 Raynes: mmarczyk: I still hate maven for being weird. :p

22:53 mmarczyk: a bug in the build box setup I guess...

22:53 :-)

22:53 talios: that release USED to exist.

22:54 mmarczyk: talios: oh? never noticed

22:54 talios: Raynes: aww don't hate on the maven, clojure-maven-plugin is all goodness, apart from the XML bloatedness

22:54 cemerick: talios: how goes it, Mark? :-)

22:54 mmarczyk: anyway, since it's not available on the repo, it shouldn't be mentioned in the metadata

22:54 talios: hey cemerick - goes good.

22:54 Raynes: talios: I see you've thoroughly drunk cemerick's kool-aid.

22:55 cemerick: lol

22:55 Raynes: talios is *my* dealer, no the other way 'round!

22:55 ;-)

22:55 Raynes: I only have taste buds for Leiningen.

22:55 <3

22:56 cemerick: I'm just a zealot for tools that get the job done for me and are generally applicable. *shrug*

22:56 talios: I was surprised to hear the gradle love on the last 'cast.

22:57 Raynes: I'm a zealot for tools that don't require I touch XML. :D

22:59 Maybe once that polyglot maven crap is done baking. Maybe.

22:59 cemerick: Fair enough. If your requirements were different, you'd probably think otherwise. :-)

23:00 Raynes: Maybe, but they aren't.

23:00 cemerick: Same here; if I had simpler needs across the board, I'd probably be all over lein.

23:00 Raynes: I've never had to build anything in such a complex way that I had to use almighty xml. :p

23:00 But I haven't really done much building either.

23:00 All my projects look the same.

23:04 tomoj: talios: all goodness?

23:05 ok, I guess I agree

23:08 Raynes: mmarczyk: Somebody might need to file a bug for that or something. It's pretty bad. You can't have an open-ended version range on contrib because of that. I'd do it, but I don't have a CA (or a printer, or anywhere to go to print it anytime soon) ._.

23:10 mmarczyk: Raynes: I'm thinking that perhaps lein shouldn't include build.clojure.org/snapshots in default-repos

23:10 talios: Raynes: polyglot maven hasn't really moved in a few months. all my clojure code was rewritten ( now leiningen compat I believe )

23:10 Raynes: mmarczyk: That would suck.

23:10 talios: tomoj: all goodness. all good. Apart from staff resigning prior to our uber new release, which hopefully will be out soon.

23:11 tomoj: hurray

23:11 mmarczyk: Raynes: but anyway, you're right about somebody needing to file a bug report -- care to do it? :-)

23:11 talios: then we can start on our git migration, and hack up the codebase again

23:11 Raynes: I wasn't sure if one could file an issue without being a contributor.

23:11 I need to do this on the assembla page, right?

23:12 tomoj: you have to have a CA to work on leiningen?

23:12 mmarczyk: you don't need a CA to create a ticket on Assembla

23:12 but I'd just send this to the ggroup

23:12 Raynes: tomoj: This isn't a Leiningen bug.

23:12 mmarczyk: Alright.

23:12 mmarczyk: Which one?

23:12 tomoj: oh, I see

23:12 mmarczyk: Clojure

23:12 speaking of CAs, mine seems to be stuck... somewhere since about a month :-(

23:13 talios: isn't not even a "clojure" bug - but a build server/admin issue

23:13 Raynes: mmarczyk: At least you had a chance to sign one. :p

23:13 So, how about that Haskell thread in the group.

23:14 For a moment, I thought I was in comp.lang.lisp

23:15 cemerick: Not a bright spot. :-(

23:15 mmarczyk: Raynes: not sure if you can sign a contract yet, you mean...?

23:16 Raynes: mmarczyk: No. I don't own a printer, and I live in the middle of nowhere.

23:16 :p

23:16 I can't even *print* a CA right now, much less sign it. ;p

23:16 mmarczyk: Raynes: oh... want a couple of blank copies then? :-)

23:16 Raynes: Indeed.

23:17 mmarczyk: if you drop me an e-mail with an address, I'll mail you some :-)

23:17 I'd find it hilarious to do that

23:18 seeing as it's halfway around the world :-)

23:18 Raynes: That would be awesome.

23:18 How much would that cost you? :o

23:19 Lajla: mmarczyk, I would disagree by the way.

23:19 About your idea of vectors.

23:19 Raynes: mmarczyk: Toss me an email address to send it to, when you get a chance.

23:19 Lajla: [(+ 1 2) (+ 1 3)] is what it is.

23:19 A vector containing two lists.

23:20 But aparently the evaluation of a vector as datum in clojure produces a vector of its evaluated members.

23:20 mmarczyk: Raynes: I don't remember the exact amount from the time I sent in the CA myself, but I'm pretty sure it didn't exceed the cost of a latte ;-)

23:21 Raynes: I wish I had a latte. :<

23:21 Send me one of those too.

23:21 mmarczyk: :-)

23:22 Lajla: mmarczyk, you cannot ignore me, I have your legs.

23:23 mefesto: Lajla: if you want an unevaluated vector, use a quote

23:23 Lajla: mefesto, that is not of which I spoke.

23:23 mefesto: ,'[(+ 1 2) (+ 1 3)]

23:23 clojurebot: [(+ 1 2) (+ 1 3)]

23:23 mmarczyk: Raynes: hopefully I've just sent you a message with an e-mail address :-)

23:23 Lajla: I mean, mmarczyk said that the [ x ...] notation repraesented a different thing than the ( x ... ) analogue

23:24 Raynes: mmarczyk: Indeed.

23:24 Lajla: mefesto, I have crossed oceans of time to be with you.

23:25 "You already admitted to loving Titanic, which makes you a brave man secure in your heterosexuality, but calls into question your overall cinematic credentials."

Logging service provided by n01se.net