#clojure log - Jun 19 2011

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

0:02 stirfoo: how do you document a defrecord? I'm assuming it's (defrecord ^{:doc "foo"} foo [x]) which evaluates OK, but how to I access that docstring?

0:05 hiredman: seancorfield: in my mind it would start with a walk through of the compiler, what it does, what it supports, how it supports it, then the datastructures, then the reader

0:06 possible some kind of dive into the reference types following the compiler, the stm, agents, how they interact, are implemented, etc

0:07 * hiredman should write up the table of contents and see if he can get someone to write it

0:07 hiredman: 1.3.4 Vars, what the hell?

0:08 seancorfield__: https://gist.github.com/1033748

0:12 seancorfield__: thanx... reading...

0:14 hiredman: so, not a book about the language so much as the machinery behind it?

0:15 hiredman: the implementation

0:19 I am serious, why vars? common lisp doesn't have vars by default (symbols actually provide storage), neither does scheme, or ml or haskell, so why? and the book would critique the choice of using vars and their implementation

0:20 possibly for 1.3 some examination of the method of binding conveyence, and pitfalls of the same

0:29 seancorfield__: who would your audience be for such a book? just curious

0:30 hiredman: seancorfield__: me

0:30 technomancy: dear apache ant: http://www.poojee.co.uk/images/2010/02/i_wish_i_could_hate_you_to_death_01.jpg

0:32 man you don't even have to visit that link; the url says it all

0:32 hiredman: seancorfield__: and of course I think all clojure programmers should read such a book

0:32 davekong: technomancy: I was a little disapointed when I did :(

0:32 technomancy: davekong: sorry I guess?

0:33 60% of the links I paste are from webcomics

0:33 fair warning

0:33 hiredman: http://cdn.someecards.com/someecards/usercards/1299543184590_8002436.png

0:33 davekong: that's better

0:34 hiredman: pa is generally not what you would call understated

0:35 hugod: technomancy: switch to aether

0:35 technomancy: hugod: I'll get to it

0:36 there's just one more stupid thing I have to do in 1.6

0:36 buggered thing simply does not have a way to turn off its logging output

0:37 .removeBuildListener: no-op. .setMessageOutputLevel: no-op

0:37 davekong: is this better? it has blood: http://www.penny-arcade.com/comic/2007/4/9/

0:38 basically you can set :local-repo-classpath true in project.clj, which is awesome

0:39 since it just doesn't bother creating lib/ at all, it just constructs the classpath straight out of .m2

0:39 hugod: the aether home page is out of date, this works for me with aether 1.11 https://gist.github.com/1033762

0:39 technomancy: which you could argue it should have done all along; whatever. hysterical reasons.

0:39 davekong: technomancy: yea

0:39 technomancy: but "lein classpath" will give you all this crap about Downloading: janino/janino/2.5.15/janino-2.5.15.jar from central blah blah blah even though all you want it to do is output the classpath

0:40 hugod: switching is in the cards for the next version. but I just want to get 1.6 out the door soon. =\

0:40 hugod: :)

0:43 technomancy: I think I may just have to tag it with a warning =(

0:44 I do not want to spend another minute digging through ant's source

0:44 especially when its docs are wrong

0:57 carllerche: I've been messing with clojure, class loaders, and hot deploying (new to this), it seems that clojure defaults to the "Compiler"'s class loader (not sure exactly what that is), does that mean that it isn't possible to create a classloader in clojure to load other clojure jars?

0:59 hiredman: carllerche: the compiler uses the classloader that is held in the LOADER field (which in turn holds a var, and the var holds the classloader) of the Compiler class

0:59 carllerche: it is possible and very easy to do if you are loading clojure source files, more complicated if loading jvm bytecode

0:59 carllerche: hiredman: Hmm, i missed the loader, it seemed to me that it went straight to compiler...

1:00 hiredman: huh?

1:00 that doesn't make sense

1:00 anyway this is what I do in clojurebot to load plugins https://github.com/hiredman/clojurebot/blob/master/src/clojurebot/plugin.clj

1:00 carllerche: hiredman: sorry, i was just reading the clojure source wrong :P

1:02 hiredman: ah, that seems simple enough... does clojure care about the current thread context class loader?

1:03 hiredman: carllerche: it depends, there are some vars you can set but it is all a rather tangled mess

1:04 carllerche: hiredman: So, I believe that the answer is yes, but just in case, unloading clojure code by disposing of classloaders is a sane thing to do?

1:05 hiredman: no

1:05 unloading is not really possible

1:05 carllerche: why not? does clojure keep global references to stuff?

1:05 hiredman: and I am unsure what you mean by "disposing of classloaders"

1:05 carllerche: just losing the reference to it and have the GC clean it up

1:06 hiredman: I don't believe that is sane

1:06 carllerche: hmm... it works w/ java and at least jruby :-/ (w/ some caveats)

1:07 hiredman: carllerche: no doubt there are some caveats

1:07 carllerche: i'll play around with it.... I think that as long as I don't import crazy libraries, it should work...

1:08 I'm building a simple proxy on top of netty and would like to deploy new code w/o having to reboot the JVM process

1:26 seancorfield__: carllerche: one thing to watch out for is running out of permgen if you keep loading new classes

1:26 carllerche: seancorfield__: in theory, the GC should clean up classes if the classloader gets GCed

1:27 seancorfield__: if you really want a long-lived process, you will have to manage classloaders directly and ensure you throw them away (unreference them)

1:27 hiredman: it is, in fact, the reverse

1:27 classloaders only get gc'ed if the classes it loaded have been gc'ed

1:27 seancorfield__: if a class is referenced, the classloader tha... yes, what hiredman said

1:27 hiredman: since all classes hold a reference to their classloader

1:28 seancorfield__: you need to ensure that every class loaded by a classloader is no longer referenced

1:28 carllerche: true...

1:28 seancorfield__: for the railo project, we hit that exact problem

1:29 carllerche: seancorfield__: I'm trying to write a simple tool that loads a jar in a URLClassLoader and when the jar changes, discards it and starts a new one passing some state between them (netty channels)

1:30 I know there are a few libraries that cause trouble w/ holding on to references

1:30 seancorfield__: that will require that no instances to any loaded classes still exist too

1:31 carllerche: seancorfield__: yeah... I think it should be possible

1:33 worst case scenario, i can just increase permgen and do a full JVM restart 1/10th of the time

1:34 seancorfield__: like everyone else using java :)

1:34 carllerche: heh

1:34 i'm still fairly new to the JVM in general

1:34 hiredman: you can also just avoid the whole classloader mess by reloading clojure code using load-file or require + :reload-all etc

1:35 carllerche: hiredman: how would you reload clojure code in a production system?

1:36 seancorfield__: how does clojure handle that internally? i mean, it must have a class loader associated with all the compled clojure code?

1:36 carllerche: hiredman: would you not build a jar and watch the files individually and reload them?

1:36 hiredman: 4.3.5 What Is With All This DynamicClassloader Thing Clojure Uses

1:37 carllerche: watch?

1:37 seancorfield__: if you keep reloading clojure code, it will keep compiling new classes and eventually it'll hit the same problem - and run out of permgen?

1:37 hiredman: seancorfield__: the old classes will loose references and get gc'ed eventually

1:37 carllerche: hiredman: dunno, some script that watches last modified times on the file :P

1:37 hiredman: generally the roots in clojure are vars, reloading clojure code will result in the vars holding on to different objects

1:37 seancorfield__: hiredman: probably more likely in a functional system than an oo one i guess...

1:38 hiredman: carllerche: doesn't need to be a jar

1:39 you could do it something very like the code I linked above, which uses a url classloader, but you could use any kind of custom loader

1:39 seancorfield__: hiredman: good point re: vars... yes, that would resolve most hanging references

1:39 carllerche: hmm, interesting. I'll play around with that. Thanks for the tip

1:40 seancorfield__: biab... netbook needs a reboot to fix flaky network

1:41 u35tpus: good morning, is it right place to ask whether I had to expect from lein to include all libs into uberjar? The thing is my very simple web app crashs with Base64 class not found on startup whereas I expected it to have all libs inside jar

1:41 I even included directive :keep-non-project-classes (set to true) inside project.clj

1:41 hiredman: which Base64?

1:42 u35tpus: org.apache.commons.codec.binary.Base64

1:42 hiredman: and you have commons codec in your project.clj?

1:42 and you have it imported in the namespace you are using it?

1:42 u35tpus: its implicitly called from ring.util.codec$loading__4414__auto__.invoke

1:43 I use ring and ring implicitly uses Base64

1:43 it all works from repl

1:43 hiredman: are you sure? have you restarted your repl recently?

1:44 u35tpus: yes, it works from repl, also I tried to update lein to 1.6.0-snapshot

1:44 it also didin;t help

1:45 from repl it really works - I tried to access web server , it shows hello workd page

1:45 when I look inside uberjar created - should I expect to see Base64.class there?

1:46 hiredman: are you sure you are deploying the uberjar?

1:46 yes

1:47 u35tpus: I guess so - I use the following command line java -jar feed-1.0.0-SNAPSHOT-standalone.jar

1:47 seancorfield__: back... hopefully with a more stable network connection :)

1:47 u35tpus: I presume standalone.jar is that uberjar

1:47 and it really has a lot of code inside including my sample code and ring libs but no Base64 there...

1:48 although Base64 is present in lib/dev/commons-codec-1.4.jar

1:49 which was resolved by lein successfully from project.clj and is loaded gracefully in "lein repl"

1:49 hiredman: are you using all the correct buts of ring?

1:49 the latest release?

1:50 u35tpus: good tip...

1:50 [ring/ring-core "0.2.5"]

1:50 [ring/ring-devel "0.2.5"]

1:50 [ring/ring-jetty-adapter "0.2.5"]

1:50 seancorfield__: if you need Base64 in the finished app, shouldn't it be a primary dependency, not a dev-dependency?

1:50 hiredman: lib/dev/ is for dev dependencies which don't go in the uberjar, so either ring is not declaring the dependency correctly or …

1:50 seancorfield__: ring is 0.3.8 now?

1:50 u35tpus: potentially I am using old ring (that version was from some old tutorial I was looking into)

1:53 ok, now trying newer ring, thanks...

1:53 hiredman: speaking of ring, I was trying to play around with client side certificates for auth, and the run-jetty from the jetty adapter doesn't let me set the required bits on the jetty connector to do it, so I wrote https://github.com/hiredman/ring-jetty--adapter/blob/master/src/ring/adapter/jetty+.clj which is kind of neat, using reflection to turn the options map into calls to setters, makes it possible to use all the available opt

1:53 (I think it's kind of cool)

1:58 u35tpus: super! what really helped is moving from dev-dependencies into dependencies. Many thanks!

1:59 seancorfield__: yay :)

2:19 jonasen: Feedback request: https://github.com/jonase/mlx/wiki/A4

2:22 hiredman: the use of floating point is unfortunate, but wow

3:43 halfprogrammer: technomancy, Followed instructions in your video and I was able to set up a new emacs/clojure configuration in under 15 mins. Great work!

3:45 seancorfield__: hmm, i had eclipse/ccw up and running in under five minutes :)

3:47 halfprogrammer: I still think eclipse or some other IDE is the way to go for someone totally new clojure/emacs

3:47 seancorfield__: it's really about what you already use

3:47 halfprogrammer: seancorfield, but I can chat in #clojure from emacs, but u can't. he he

3:47 yup

3:48 seancorfield__: i've been using eclipse for years... for groovy, scala... cfml... and now clojure

3:48 halfprogrammer: emacs is an operating system :)

3:49 for irc i use colloquy on mac, and konversation on ubuntu

3:49 halfprogrammer: The general complaint is eclipse is memory hungry. Does it really use so much memory?

3:49 seancorfield__: no, not really

3:50 i use it on a tiny netbook quite happily

3:50 halfprogrammer: eclipse on a netbook, that's fantastic

3:51 seancorfield__: i run eclipse, tomcat, mysql and a bunch of other processes on my little netbook

3:52 halfprogrammer: If your netbook had tiny eyes, you could see tears in them

3:53 seancorfield__: i present from it too, running live demos :) i love my system76 starling!

3:56 halfprogrammer: I use a E6510, a giant monkey; you could do weight-lifting with it. also spits out very hot air

3:56 :(

3:58 seancorfield__: ok, bedtime... 'nite

6:06 bsod1: hi, I just installed counterclockwise for eclipse but having some problems

6:06 when I run my .clj file, it always starts a new repl instead of using the old repl, do you know why?

6:17 can anyone help me?

6:19 how can I disable rainbow parens in counterclockwise?

6:30 raek: bsod1: vagely recall that you use the right click menu to send stuff for evaluation ("run" seems to be to start an entierly new repl)

6:31 bsod1: raek: thanks, and do you know how can I disable rainbow parens?

6:31 raek: I'm not a counterclockwise user, so I don't know much of the workflow...

6:31 bsod1: sorry, no idea :-)

6:32 bsod1: you may have better luck asking the same question after some hours when it is day the US

6:33 bsod1: raek: ok, thanks

6:39 clgv: bsod1: you can set a shortcut for "Load file in REPL" or maybe it's already set. I have it on CTRL+ALT+S

6:40 bsod1: why would you want to disable rainbow parens?

6:40 bsod1: clgv: yeah I found it, it's already set, thanks

6:40 clgv: they look horrible

6:40 clgv: bsod1: but they are really usefull when you forgot a paren somewhere

6:41 bsod1: clgv: eclipse already intents my code according to open parens

6:42 clgv: bsod1: that doesnt help in all cases. but it's personal taste I guess. if you dont find anything in the options you probably cant turn it off...

6:43 bsod1: clgv: the problem is, there isn't any options about rainbow parens

6:43 clgv: there arent that much accessible options, so you should find it out pretty fast

6:48 bsod1: so are you all using emacs?

7:08 Useful-: Hey folks. Under what condition does Clojure's STM retry the transaction? If I have two threads associating a value to a map, does a transaction retry after *any* change to the map, or only if they changed the same key?

7:08 And is there any recommended place to teach me about this stuff? :)

7:11 raek: Useful-: actually, you can't change maps at all. what you do is to have a map wrapped in a ref: (def r (ref {:a 1, :b 2}))

7:12 assoc returns a _new_ map and the old one remains as it is

7:12 a ref just points to the current value

7:12 and it is the refs that you can change in a transaction

7:12 Useful-: Ok, so any change is considered a conflict, since it's a whole new map?

7:13 raek: yes

7:13 if you need to change different parts independently, you can wrap the changing parts in refs individually

7:13 you use reference primitives to model stuff that changes

7:14 (also, I think there is some kind of mechanism that favors long transaction)

7:14 Useful-: this article is really good: http://java.ociweb.com/mark/stm/article.html

7:15 Useful-: Cool, thanks.

7:15 raek: Useful-: there's also this classic: http://blip.tv/clojure/clojure-concurrency-819147

7:18 Useful-: Looks good -- I'll devour the two. I assume the basics haven't changed since 2008: Is there anything big I should be aware of that's changed since the talk was filmed?

7:21 raek: maybe that rest can return something empty that is not nil

7:21 Useful-: this article explains how it works now very well: http://kotka.de/blog/2011/06/On_types.html

7:45 shtutgart: Hello! I need to find all identical elements in two arrays, and it takes a lot of time. I've tried to parallelize it in the following way: first vector is splitted in some chunks, and comparison function that searches elements in the second vector is runned for every chunk

7:46 bsteuber: shtutgart: maybe turning one of them into a set makes it faster

7:46 shtutgart: I've experimented with chunk size, but perfomance remains neraly the same (or even becomes worst)

7:47 bsteuber: haven't thought about it, thanks! let me test it...

7:47 bsteuber: or is ordering or how often an element is there important?

7:48 but using a set should be O(m+n)

7:48 at least roughly

7:49 shtutgart: no, i think i can ignore frequency of occurrences

7:49 but how can I make it parallel?

7:51 Useful-: After creating the set, you can divide the work of the comparisons. Choose the smaller array as the set.

7:54 It depends on the size of the array as to whether it's worth it.

8:03 shtutgart: Useful-: I've cast both vectors to the sets and it increased perfomance by ~25%. Arrays can be pretty big (up to 500k elements)

8:05 bsod1: java -cp clojure.har clojure.main --help gives me Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main, can anyone help me?

8:05 bsteuber: shtutgart: the second set makes no sense I think

8:05 because one of it has to be processed in order anyways

8:06 bsod1: try clojure.jar :)

8:06 shtutgart: bsteuber: hm, I'm using clojure.set/intersection to find identical elements

8:06 bsteuber: ah

8:07 bsod1: bsteuber: hehe thanks, I'm trying to install stank-clojure via lein, but when I run lein plugin install swank-clojure 1.3.1 I get same exception Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main

8:07 raek: bsod1: if you use lein, you shouldn't need to call java directly

8:08 phooey: posta såsen sen!https://github.com/technomancy/swank-clojure

8:08 bsod1: raek: I'm not calling anything, I just run a command from swank-clojure's github page, but didn't work for me

8:08 raek: which command?

8:10 bsod1: raek: lein plugin install swank-clojure 1.3.1

8:10 bsteuber: shtutgart: instead of intersection, (filter (into #{} shorter-array) bigger-array) should also work

8:10 but not sure which is faster

8:11 raek: bsod1: which leiningen version do you have?

8:11 bsod1: raek: latest

8:12 raek: weird

8:13 the-kenny: Btw.: Great work on latest swank-clojure. I *love* M-x clojure-jack-in

8:13 s/swank-clojure/clojure-mode/

8:13 sexpbot: <the> Btw.: Great work on latest clojure-mode. I *love* M-x clojure-jack-in

8:13 raek: bsod1: could the clojure.jar file be corrupt or something?

8:13 bsod1: raek: first time I run this command, it was downloading something but I had to cancel it

8:13 bsteuber: the-kenny: I love the cdt support :)

8:14 raek: bsod1: ok, one way could be to remove your .m2 directory and then run lein self-install

8:14 bsod1: raek: already tried it

8:14 raek: wait wait, something happened

8:15 raek: great, I installed swank-clojure

8:15 now must figure out how to use SLIME for clojure

8:16 raek: bsod1: check the docs for github.com/technomancy/clojure-mode or the video at http://technomancy.us/149

8:16 the-kenny: Just run M-x clojure-jack-in on a leiningen project :)

8:16 raek: all you need to do from the emacs side is to install clojure-mode.el. the matching version of slime for swank-clojure is bundled with swank-clojure

8:17 bsod1: raek: I alredy did it, now I'm trying to setup SLIME for clojure

8:18 raek: bsod1: just use M-x clojure-jack-in

8:18 the-kenny: raek: I'd recommend not to bother with that. Just start with M-x clojure-jack-in. It'll do everything for you

8:18 (It will use a bundler version of slime, you don't need to install anything)

8:19 and it doesn't fight with other slime installations

8:22 bsod1: raek: I get "repl unexpectedly closed" error(or something like that), is it because of my SLIME version?

8:23 lisp connection closed unexpectedly: connection closed by remote peer

8:24 raek: bsod1: if you have installed slime with your OS package system (e.g. apt-get), that can cause trobles

8:27 the-kenny: also make sure to have *only* swank-clojure 1.3.1 in your CLASSPATH

8:27 (check lib/ and lib/dev/)

8:27 That was a problem in one of my project: Lazytest included swank-clojure 1.2.1 or so. That broke M-x clojure-jack-in

8:31 shtutgart: bsteuber: yeah, i've tried that too, it's a little faster with one set

8:36 raek: what was the key for displaying the message of a failing test line clojure-test-mode again?

8:38 * shtutgart uses midje-mode

8:54 bsod1: SLIME and normal buffer indents same code differenet, do you know why=

8:54 ?*

9:24 when I try to run code with C-c C-c, I get No such namespace exception, can anyone help me?

9:28 halfprogrammer: Did you set the correct namespace in the REPL?

9:33 bsod1: halfprogrammer: I have no idea, how can I do that

9:34 raek: bsod1: the code and its surrounding would help...

9:35 ,(foo/bar 1 2 3)

9:35 clojurebot: java.lang.Exception: No such namespace: foo

9:35 halfprogrammer: bsod1: as raek suggested could you please paste your snippet somewhere?

9:35 raek: so the question is what is your "foo"

9:36 and what do you have in your ns form?

9:36 bsod1: halfprogrammer: it's just hello word program

9:36 the-kenny: Is there a way to add custom jars to lein deps *without* having them in my local repository? I want to have everything which isn't available with lein deps etc. bundled in my git project

9:36 bsod1: halfprogrammer: there's no source code, just (str "hello world")

9:37 halfprogrammer: ,(println "hello world")

9:37 clojurebot: hello world

9:37 halfprogrammer: bsod1: You would have declared a namespace for the file right

9:38 raek: bsod1: so the file only contains that line? that's really odd...

9:38 halfprogrammer: bsod1: in emacs, copy paste that namespace declaration in the slime-repl buffer

9:38 bsod1: I hope you have declared a namespace

9:41 shtutgart: bsod1: also, you can hit C-x C-e if if you just wnat to execute current line

9:41 bsod1: I get up 5 hours ago, starting learning clojure, but I couldn't setup emacs + slime + whatever yet... goddammit

9:41 whatever...

9:43 halfprogrammer: bsod1: that's okay. It's a one time thing for anybody.

9:45 bsod1: http://halfprogrammer.wordpress.com/2011/06/19/setting-up-emacs-clojure-and-swank-in-15-minutes/

9:45 bsod1: Wrote a reminder to myself reg. how to setup clojure dev environment in ubuntu.

9:46 see if it ^ is of use to you.

9:46 raek: halfprogrammer: no need to copy and paste. just eval the ns form (with C-c C-c or C-M-x) and then emacs knows the namespace of that file (and subsequent evals in that file will happen in the right namespace)

9:47 bsod1: the problems you have sound very strange. first, what happens if you enter (str "hello world") in the repl?

9:47 bsod1: raek: it prints the string

9:47 raek: halfprogrammer: and then C-c M-p can be used to do the equivalent to (in-ns 'the-ns)

9:48 bsod1: and when you have the same line in a file (where clojure-mode is active) and press C-c C-c it throws an exception?

9:48 halfprogrammer: raek: that is strange, if i do it in my setup i get "no such namespace" exception :(

9:48 bsod1: raek: yes

9:49 raek: halfprogrammer: the C-c M-p? it requires the namespace to exist first. I usually start with evaluating the whole file with C-c C-k and the do the C-c M-p

9:49 halfprogrammer: raek: no. I am talking abt doing a C-c C-c on namespace declaration.

9:50 raek: halfprogrammer: hrm. it doesn't do that for me

9:51 halfprogrammer: raek: interesting

9:51 mrBliss: halfprogrammer: try C-x C-e after the last paren of the ns declaration

9:51 halfprogrammer: raek: I dint know abt C-c M-p. thx for the tip

9:52 raek: C-c C-c and C-M-x are both equivalent to doing C-x C-e after the last paren of the top level paren pair surrounding the point

9:52 halfprogrammer: mrBliss: raek, If i do a C-c C-k on the file and at some point after that if i do C-c C-c things are working okay

9:53 raek: halfprogrammer: ah, I get the same behaviour...

9:53 halfprogrammer: but C-M-x does not have the problem

9:53 even for a previosly non-loaded file

9:54 halfprogrammer: oh. That would be useful. I am having to copy paste the namespace name every single time. Thx again :)

9:56 the-kenny: Whoa, C-x M-p was the combination. Thank you!

9:56 I forgot the key combination some days ago :)

9:58 * raek tends to check https://github.com/technomancy/swank-clojure every now and then

9:59 raek: it has a good list for these commands

11:10 * gfrlog likes the fogus/rhickey interview

11:45 gfrlog: do pre/post constraints still exist?

11:45 ah yes, nevermind

11:45 wrong syntax

11:49 Are constraints not well-regarded? Somehow I've hardly heard anything about them at all.

11:50 pdk: they're covered in tjoc

11:50 if anything it's probably since they could use a bit more flexibility

11:51 gfrlog: pdk: what sort of flexibility?

11:51 pdk: it logical and's all of the pre/postconditions so you don't get very fine grained control if you want only some of them to be true

11:51 or to change the behavior depending on other factors

11:51 gfrlog: I would figure that being able to use arbitrary functions would give you all the flexibility you need

11:53 pdk: there's that much

11:54 gfrlog: Well. I think I will start using them.

12:41 duck1123: in 1.3, what do I need to do if I need to convert my literal to an int? (class (int 5)) says it's still a long

12:41 ,(class (int 5))

12:41 clojurebot: java.lang.Integer

12:42 bsteuber: ,(Integer. 5)

12:42 clojurebot: 5

12:43 bsteuber: ,(class (Integer. 5))

12:43 clojurebot: java.lang.Integer

12:43 bsteuber: that sucks

12:43 but I think there's no better way

12:43 if you really need ints for java-interop

12:43 duck1123: ok. (class (Integer/parseInt "5")) is also long

12:43 raek: duck1123: if you need to convert it to an int for java interop (i.e. a method accepts a primitive int) just use 'int'

12:44 duck1123: yeah, this is for java interop, otherwise I wouldn't care

12:44 bsteuber: I think boxing is the only way

12:44 raek: when you call class on the result, it is boxed into a Long again, since all boxed integers are boxed the same

12:44 duck1123: raek: int wasn't working for me in 1.3, that's why I asked

12:45 raek: duck1123: well, it works if the receiver accepts primitives

12:45 bsteuber: raek: I think you're wrong

12:46 lucian: java does auto-unboxing since 1.5

12:46 duck1123: There may be something up with the java method I'm trying to call

12:46 raek: this is unrelated auto-boxing

12:46 bsteuber: exactly, that's why using (Integer. 5) will do the job

12:47 it will get passed to java boxed and unboxed on the java side

12:47 without clojure's evil to-long-conversion kicking in

12:48 raek: my point is that (.method-that-accepts-primitive-int obj (int some-number)) should not box the number

12:48 bsteuber: it shouldn't but it does

12:48 so maybe worth a ticket

12:49 duck1123: bah, the method I'm trying to call isn't public. That explains a lot of things. I was going down the wrong path

12:49 bsteuber: I'm afraid the same will happen with a public one

12:52 duck1123: are there any good libraries for cryptography in clojure?

12:52 something that'll make the java libraries a little easier

12:59 pdk: doesn't contrib have a crypt library

13:01 raek: hrm, these primitive things are a bit weird

13:01 made a method with overloaded int and long args

13:02 clojure calls the int version both when calling (.foo f (int 1)) and (.foo f (long 1))

13:02 bsteuber: 1.3?

13:02 raek: yup

13:02 alpha8

13:03 bsteuber: my last test was with 6 or so, so maybe it changed

13:03 but there I couldn't call the int methods without boxing

13:04 raek: (.foo f 1) also calles the (primitive) int version

13:05 bsteuber: so maybe they did a fix and now it's the other way :)

13:06 I'll try this, too...

13:16 raek: you're right, something must have changed

13:16 and I guess the two-overload-version is just too much

13:17 maybe that's worth a ticket

13:19 duck1123: so which alpha did you use for your int/long tests?

13:40 duck1123: alpha7

13:41 we're up to 8 now, right?

14:59 jhickner: will java's file locks work correctly from clojure?

15:06 void_: hi there

15:06 in compojure ...

15:06 (GET "/foo" [] (println request))

15:06 how do I get the request

15:06 this doesn't work

15:10 ok so adding {request :request} helps

15:10 but request is nil

15:12 ohhh I recall now

15:12 it's (GET "/foo" [] request ...)

15:39 raek: void_: https://github.com/weavejester/compojure/wiki/Destructuring-Syntax

16:37 gfrlog: I think the pre-post-constraint syntax is unfortunate

17:53 Useful-: Anyone know where the slides are for Rich's concurrency talk? Blip doesn't have them anymore: http://blip.tv/file/812787

17:54 Unless I've overlooked them on that page

18:14 void_: hey guys

18:15 so I installed emacs on mac (from http://emacsformacosx.com/) ... I installed starter kit, then installe clojure-mode package. Now when I restart, clojure-mode is not there, and I can't install it, because it's not in package list anymore

18:23 sritchie: void_: is it at the bottom, now, listed in red?

18:23 void_: sritchie: oh, yeah

18:23 sritchie: void_: success!

18:23 void_: it worked at first

18:23 not after restart though

18:23 so I saw syntax hilighting if I opened clj file before restarting, but not after

18:23 sritchie: you mean it's not showing up in red, or it's not loading for clojure files?

18:24 void_: it's showing up in red, but it's like it's not there

18:24 when I do M-x, type cloj and press tab, nothing autocompletes for example

18:24 sritchie: I wonder if you have a .emacs file that's in the way of your .emacs.d directory

18:24 ~/.emacs

18:24 clojurebot: Excuse me?

18:25 void_: this is in emacs

18:25 (add-to-list 'load-path "~/.emacs.d/")

18:25 (require 'package)

18:25 (add-to-list 'package-archives

18:25 '("marmalade" . "http://marmalade-repo.org/packages/&quot;))

18:25 and yay, moving that file works!

18:26 sritchie: (package-initialize)

18:26 (require 'starter-kit-elpa)

18:26 do you have those two?

18:26 void_: no

18:26 sritchie: https://gist.github.com/1034850

18:26 try lines 5 through 10, and see if the problem's solved

18:27 void_: ohhh it works now :)

18:27 thanks for the link

18:27 sritchie: no problem

18:27 emacs and paredit mode are great, you'll have fun

18:29 tomoj: +1

18:32 devn: hello all

18:33 paredit and swank are really the big selling points for me with emacs, but the more I see other people's setups the more I begin to think I spend too much of my time fiddling with BS in emacs

18:33 * devn stops stoking the editor fire right there

18:36 justinko: devn: "other people's setups" < - please elaborate

18:42 devn: justinko: I see people who are incredibly productive who have setups that are not emacs, not configured to within an inch of their life, without a color theme, without pretty much everything ive grown accustomed to

18:43 and they trounce me in terms of productivity, so I wonder if most of the time I've spent has been for naught

18:43 justinko: what do they use if not emacs?

18:44 devn: they could write in notepad. the editor is just something that generally gets in their way.

18:44 terminal + any editor seems to work for them.

18:45 justinko: also, yes, the editor is very rarely the bottle-neck for productive output

18:45 devn: *nod*

18:46 I mean, I value the stuff Emacs can do, but I think we spend too much time as programmers tinkering with our editor instead of writing code

18:46 I didn't used to think that, but lately it seems obvious

18:46 justinko: I used Vim for 2 weeks, then switched back to Textmate. The level of "text surgery" that you can perform is just ridiculous IMO

18:47 "5j" <- to move down 5 lines, wtf

18:47 why do you need that level of precision?

18:48 devn: I understand why people like it. You can do small miracles, but I also watch people who haven't spent 10 years with an editor accidentally hit a key in command mode and delete half of their file.

18:48 and I understand the precision -- it's nice to be able to make a quick macro, for instance.

18:48 Sometimes it's almost a requirement.

18:49 but you can do that with some fancy command line magic, too

18:49 sed, awk, etc.

18:52 * devn shrugs

18:54 justinko: devn: we'll see how long clojure with textmate will take me, if I start getting frustrated, I'll give emacs a try

18:54 devn: emacs doesn't have modal/multi-window editing, right?

18:58 devn: clojure with textmate isnt bad IIRC -- I think someone rolled out some decent support for it

18:58 I mean, it has syntax hilighting and I think it lets you send stuff to the REPL, what more do you need?

18:59 justinko: you can have modal editing in emacs if you want, but it's not a defautl

18:59 default*

19:00 justinko: devn: exactly, currently I don't need any more than that.

19:34 Lajla: Chousuke, I think than and and or can be usde as control structures

20:54 gtrak`: you guys ever consider using clojure for the view layer in a web app?

20:57 Useful-: Yep. There's a few libraries out there for producing markup / css

20:58 gtrak`: also, does it know how to cache results of pure functions? it seems this would be a great fit

20:59 Useful-: Enlive or Hiccup are probably the two most popular HTML/Templating libraries

20:59 This is an overview of the most common clojure web stack components: http://brehaut.net/blog/2011/ring_introduction

21:04 gtrak`: neato

23:33 fbru02: hi all, stupid question, most of the stuff i use is either on clojars or in source code inside a given project, if i want to include a own jar inside a project i just do uberjar with the dependencies of that separate project and add it to my current project, any drawbacks on this aproach?

23:34 sritchie: fbru02: one other way would be to run "lein install" in the directory of the project you want to include, and the just add a line to project.clj like usual

23:35 scottj: is uberjar necessary?

23:37 tomoj: jars uberjars on classpath aren't on the classpath, are they?

23:37 s/^jars/jars in/

Logging service provided by n01se.net