#clojure log - Feb 16 2012

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

0:13 aphyr: Having a spot of trouble with lein-autodoc; does anyone know why it might complain "Could not initialize class <my-namespace-here>__init", and then generates a skeleton doc page without any functions?

0:13 https://refheap.com/paste/765

0:22 TimMc: tmciver: This is probably the ugliest code I have written yet: https://github.com/baznex/imports/blob/defproxy/src/org/baznex/imports.clj#L169 (invokePrim still doesn't get called...)

0:24 Raynes: TimMc: Stop doing that.

0:24 TimMc: ;.;

0:24 Look, after midnight is the best time to write macros that implement IFn.

0:24 Raynes: What do you guys *do* at those meetings?

0:24 TimMc: Any other time of day I would stab myself in the eye with a fork.

0:25 Raynes: Take hallucinogens and write macros? I dunno.

0:27 tmciver: TimMc: that code make *me* want to stab myself in the eye with a fork.

0:27 aphyr: I like the hardcoded 21 and 20.

0:27 TimMc: What are *you* still doing awake?

0:27 aphyr: Check out clojure/lang/IFn.java

0:27 tmciver: This is the best time to read macros.

0:28 aphyr: TimMc: ...............

0:28 Raynes: It's in your best interest to not read Clojure's Java source.

0:28 aphyr: Let me guess, JIT?

0:28 Scriptor: I've done it, it's not too bad

0:29 just...its indentation and style for braces

0:29 TimMc: aphyr: I really don't know.

0:29 aphyr: I like how scrolling through that file quickly gives a neat sort of spiral effect on the interface names

0:30 TimMc: aphyr: It's not fun debugging the macro output for this code...

0:30 https://refheap.com/paste/766

0:30 Raynes: I don't think that white is bright enough.

0:31 If the expansion isn't burned into my retina while I sleep tonight, it isn't bright enough.

0:31 aphyr: argh. I feel like everyone on the internet has *hit* this autodoc issue but nobody wrote down the answer...

0:32 Raynes: aphyr: There is no particular autodoc issues. It's just autodoc itself.

0:32 :p

0:32 I'm a fan of codox these days, myself.

0:32 TimMc: tmciver: The IFn subinterface name-building was still wrong. >_<

0:32 I finally wrote another test for it.

0:32 * aphyr looks into codox

0:33 aphyr: "Could not initialize class" is... shockingly uninformative

0:33 Do I have to AOT compile all my classes or something?

0:35 TimMc: tmciver: Another problem... for nullary methods that return a long or double, we should actually have both an invoke and an invokePrim.

0:35 * TimMc eyes a fork, or forks an eye, or something

0:36 tmciver: TimMc: ha!

0:36 TimMc: I am basically going insane over here. <3 SCM, it enables this with low risk.

0:36 tmciver: I'm not going to try to decipher this tonight. That's some bad-ass kung-fu.

0:37 TimMc: tmciver: It also doesn't work.

0:37 So.... there's that, too.

0:37 tmciver: that's minor.

0:37 ;)

0:37 Packing it in; see you tomorrow.

0:37 TimMc: If I'm wearing an eyepatch, you'll know why. See you.

1:38 mdh: is it possible for a macro that is shared between clojurescript and clojure to detect the macro expansion envrionment so that it may exhibit different behavior on client and server?

1:46 ibdknox: mdh: if it's different, why wouldn't you write two different macros?

1:47 mdh: because the parameters are common to both

1:47 ibdknox: so?

1:47 mdh: they represent data that i do not want duplicated

2:19 ibdknox: thx, agree - dual macro definitions single point of use is the way.

2:37 newster: Hi guys. I'm trying to figure out how to sort a vector and get back not the original values but the original positions (1-based or 0-based indices) of the sorted values. e.g. in R: sort(c(5,3,4),index.return=TRUE)$ix gives me [2 3 1], becaue the smallest value was the 2nd one, and so forth. How would I do that in clojure?

2:53 testing1234ok: testing

2:54 I'm in an emacs repl right now entering these commands manually woot for sexpressions

2:56 newster: :-)

2:57 raek: newster: one way is to pair up the values with their indices, sort them, and then keep just the indices: (map second (sort-by first (map vector v (range))))

2:57 newster: raek: ah, okay. I'll try that. Thank you.

2:58 testing1234ok: 2+2 == 4

2:58 tylergillies: heh (write irc (str "privmsg #clojure : 2+2 == " (+ 2 2)))

2:59 slime is a decent irc client

3:02 so im sitting in bed and my wife says, and this is literal "you're bothering me, go on your computer and write some Lisp"

3:04 newster: raek: thanks! that works very nicely.

3:04 raek: np

3:06 newster: tg: she's a keeper that one. :-)

3:09 tylergillies: i noticed that emacs doesn't display line numbers defaultly, do most people program with them off?

3:10 raek: tylergillies: you mean in stacktraces?

3:10 tylergillies: i mean in margin

3:10 next to code

3:10 raek: ah

3:11 I program with them off (the current line number is displayed at the bottom of the screen anyway)

3:11 and you can jump to a certain line with M-g g

3:14 tylergillies: raek: thnx

3:18 Fossi: tylergillies: i have them on

3:19 basically everybody's emacs config is hugely different ;)

3:19 testing1234ok: {:exit 0, :out " 3:23 up 3 days, 1:29, 3 users, load averages: 1.36 1.13 1.19\n", :err ""}

4:53 hba: hi, i'm getting "Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core/main__init.class or leiningen/core/main.clj on classpath" with LEIN_VERSION="2.0.0-SNAPSHOT", any idea?

6:21 webusnix: can i parse html in clojure ?

6:22 vijaykiran: webusnix: enlive can "scrape" html - buth what do you want to do ?

6:23 webusnix: <vijaykiran> i want get all <p></p> values from web page

6:24 vijaykiran: take a look at https://github.com/swannodette/enlive-tutorial

6:24 I think that has what you want to do - especially the scraping part

6:31 raek: weavejester: yes. (select (html-resource (URL. "http://...")) [:p])

6:32 vijaykiran: webusnix: ^^

6:33 raek: eh, wrong nick... sorry!

6:54 bOR_: Wrestling a bit with continuously printing an incoming string into an emacs swank repl. When evaluting the following expression, it works (and keeps working as telnet sends new text), but it puts spaces in between every char.

6:54 (println (take 10000 (remove #{\return} (map char (take-while #(not= % -1) (repeatedly #(.read (.getInputStream avendar))))))))

6:54 this next one doesn't put in the spaces, but also doesn't continue printing out as telnet sends new input.

6:54 (print (apply str (take 10000 (remove #{\return} (map char (take-while #(not= % -1) (repeatedly #(.read (.getInputStream avendar)))))))))

6:55 not sure how I can get the behaviour of the first with the spacing of the second.

6:55 (first time working with an incoming buffer :-)

6:56 (goal is to be able to mud from within an emacs-swank repl ;-)

7:08 hmm. might try with slurp

7:44 pyr: cd

8:12 tylergillies: anyone know how to access (doc foo) in clojure-swank repl when namespace isn't user?

8:13 vijaykiran: did you (use 'clojure.repl) ?

8:16 tylergillies: nope

8:16 i used M-x clojure-jack-in

8:16 then C-c M-p

8:17 raek: tylergillies: you need to use the clojure.repl from each namespace where you want to access doc

8:17 vijaykiran: I'm not sure if clojure.repl is included by default, I use lein swank and slime connect - and always do a (use 'clojure.repl) to get the doc

8:18 raek: tylergillies: ...or you use the C-c C-d C-d command in emacs

8:24 tylergillies: raek: thanks

8:25 oh cool c-c c-d c-d is handy

9:05 dbushenko: hi all!

9:06 I've got a noir project, when I run it like "lein noir run" -- all goes ok. But when I run the uberjar-ed app on the webhosting, the routes become broken

9:06 how to fix that?

9:16 mdeboard: dbushenko: You might try #noir :)

9:16 dbushenko: ok :-)

9:16 mdeboard: (Think it's pretty much all the same people though)

9:17 cemerick: Less of a chance for a question to be missed in noise, though.

9:22 dbushenko: how do you guys deploy your webapps?

9:23 bOR_: not doing webapps. mainly using clojure for individual-based simulation models :-).

9:24 dbushenko: ok, but may be anyone does

9:24 ?

9:25 mdeboard: cemerick: Do you know of any Clojure projects focused on Mahout & Lucene together?

9:25 cemerick: mdeboard: sorry, no; I'm very behind on the Lucene world.

9:27 dbushenko: heroku is very popular recently; otherwise, any .war-based deployment option (e.g. Elastic Beanstalk, Cloudbees, automating things using pallet/puppet/chef on a compute note from EC2/rackspace/linode/etc) will work.

9:27 dbushenko: yes, but I can't get it running when I bundle it either in jar or war

9:29 cemerick: well, webapps are never deployed as jars

9:30 dbushenko: use lein-ring's war task if you want a war, and follow its documentation for setting that up

9:30 or, use lein-beanstalk to deploy to elastic beanstalk

9:30 dbushenko: trying to make a war, but it can't find my servlet...

9:37 pcavs: What's the proper way to create a map of resources that gets reused for every thread in a web service? I was thinking just doing (def my-resource-map (ref {})) and then manipulating that with dosync, but I'm not sure if that will create a new ref for every thread, or will each thread refer to the same ref?

9:41 jcrossley3: dbushenko: immutant is another deployment option, and doesn't require a war: http://immutant.org/news/2011/11/08/deploying-an-application/

9:53 babilen: Hello. I am trying to implement a lazy version of a function that splits a given sequence at a subsequence. http://paste.debian.net/156484/ is what I have so far (based on suggestions by TimMc), but it does not seem to be as lazy as it could be. I do not quite understand why I see the behaviour I am seeing and would be grateful for any comments or criticism of that approach.

10:52 tdrgabi1: haven't used clojure in a while. is clojars still the place to go for packages?

10:55 TimMc: tdrgabi1: Yep.

10:57 aniero: i hear clojurescript is the new hotness

10:57 i've written my share of web apps with jquery callback soup, and experienced the vast improvements that client-side MVC with backbone, ember, etc. bring... is there a place I can learn how to write well-structured client-side code with cljs?

10:58 TimMc: babilen: At a glance, partition-by is being more eager than you want/

11:05 ,(let [a (atom []), res (partition-by #(do (swap! a conj %) (zero? (mod % 5))) (iterate inc 0)), forced (doall (take 3 res))] [forced @a])

11:06 clojurebot: [((0) (1 2 3 4) (5)) [0 1 1 2 3 ...]]

11:06 TimMc: ugh, clojurebot -- you are terrible

11:07 &(let [a (atom []), res (partition-by #(do (swap! a conj %) (zero? (mod % 5))) (iterate inc 0)), forced (doall (take 3 res))] [forced @a])

11:07 lazybot: ⇒ [((0) (1 2 3 4) (5)) [0 1 1 2 3 4 5 5 6]]

11:07 TimMc: babilen: You need to use something that *knows* that each delimiter is only one token long. partition-by doesn't know that!

11:09 dnlcttr: aniero: i haven't been able to get clojurescript one to do anything

11:09 aniero: ha!

11:09 dnlcttr: it just hangs

11:10 aniero: it looks like clojurescript one uses the google closure library pretty heavily

11:11 dnlcttr: have you tried it out yet?

11:11 aniero: no, just looked at the code

11:12 dnlcttr: hmm. well, they have some bootstrap instructions, but as far as i can tell, they don't work

11:12 https://github.com/brentonashworth/one/wiki/Getting-started

11:12 i've tested it on mac and linux both

11:13 if you end up trying it, i'd be curious to know what you find

11:13 clgv: I tested clojure script one a few weeks ago and it worked pretty well.

11:13 aniero: is it considered a good example of how to write clojurescript?

11:14 clgv: I dont know.

11:14 dnlcttr: i haven't looked much past the getting-started pages, but from what i understand it is a bunch of examples to help you get started

11:14 clgv: I was just curious to see a clojurescript example

11:14 dnlcttr: clgv: did you use the getting-started instructions at the link above? or something else?

11:14 tdrgabi1: if we use slime and clojure-jack-in, when we add a new dep and run "lein deps", what do I need to run in slime to load that dependency?

11:15 raek: tdrgabi1: the simplest way is to restart slime

11:15 clgv: dnlcttr: yeah

11:16 raek: run clojure-jack-in again

11:16 tdrgabi1: raek: will try

11:16 raek: you might need to kill the *Swank* buffer

11:17 clgv: what is the slow part of reflection? looking up the method in the class? if so, I could improve performance by caching the method

11:22 `fogus: Clojure-centric interview with William Byrd: http://clojure.com/blog/2012/02/16/take5-william-byrd.html

11:23 TimMc: clgv: Well, there's 1) inspecting the args, and 2) looking up methods. Maybe that's all done in one step with Class/getMethod(String, Class[])

11:23 Hinting allows that to be done at compile time.

11:24 (when it is ambiguous)

11:24 clgv: TimMc: I could keep a ref to that method to boost performance. type hinting is not possible

11:24 TimMc: Methods aren't objects.

11:25 You can have java.lang.Method objects, but Method/invoke might be expensive, not sure.

11:26 ivan: how do I fix this? http://paste.lisp.org/display/127806 doseq causes: Can only recur from tail position

11:26 clgv: TimMc: yeah, that was what I was aiming at.

11:26 babilen: TimMc: Ok, I'll implement something along the lines of partition-by with that knowledge and try that. I don't quite understand why my code isn't working though. Thanks a lot for you suggestions. (I like this approach and the code feels more natural)

11:27 TimMc: babilen: partition-by is trying to figure out when the segment where sentinal? returns true ends.

11:28 Actually, that's another bug in your code. (split [1 2] [1 2 1 2 1 2]) should return [[] [] [] []] but probably doesn't.

11:28 babilen: TimMc: Ah, ok. I'll investigate that too. Ta!

11:30 TimMc: ,(.isVarArgs (.getMethod String "format" (into-array Class [String (class (to-array []))]))) ;; whoa, we *can* detect varargs methods!

11:30 clojurebot: true

11:48 clgv: TimMc: keeping a ref to the method is a 2times speed up

11:48 TimMc: I wish they would have used a common interface

11:48 TimMc: wow

11:49 common interface?

11:50 clgv: TimMc: yeah the java management stuff has operating system dependent implementations and they forgot to add " getProcessCpuTime" to the interface of the bean

12:17 maio: when I have BufferedImage can I use spit to save it into file?

12:20 hiredman: maio: no

12:24 TimMc: maio: spit is for writing strings

12:30 maio: BufferedImage is raw raster data; image files are binary compression formats.

12:30 s/are/use/

12:32 maio: ok thanks. I managed to use javax.imageio.ImageIO class to save it

12:35 clj_newb: how do I, from clojure, inehrit from the Exception class? I want to throw exceptions that contain more than just a String

12:36 TimMc: clj_newb: Use the slingshot lib

12:36 clj_newb: Is there no other way?

12:36 I prefer to use things I understand

12:36 rather than pile library upon library

12:36 TimMc: You don't like abstractions?

12:36 clj_newb: I don't like black magic.

12:36 TimMc: There's not much magic behind slingshot.

12:38 You'll basically be reimplementing slingshot if you extend Exception to carry a payload, without the benefit of slingshot's existing features.

12:38 clj_newb: hmm, ExceptionInfo.java does the one part you can't do in clojure land?

12:38 this library looks readble

12:38 I will use it.

12:39 TimMc: thanks for pointing it out

12:40 TimMc: You may actually look into contributing to slingshot -- it's still a bit barebones in some ways.

12:40 (Not sure who maintains it, though.)

12:42 clj_newb: in theory, can slingshot be implemented without a *.java file through the use of gen-class ?

12:44 is there a way to check if a java objects supports a .foo() ?

12:48 TimMc: clj_newb: Sure, use the java.lang.reflect API.

12:48 * technomancy waves at aniero

13:04 aniero: technomancy: ohai!

13:26 technomancy: aniero: cljs is still pretty rough around the edges unfortunately =\

13:26 kind of a rough place to get started with clojure

13:33 aniero: technomancy: so it seems. was hoping to do a web app as a Real Actual Project, but the cljs side of things is really unclear

13:33 technomancy: aniero: clojurescript feels like clojure did when I started in 2008

13:33 though admittedly I haven't gotten a chance to try lein-cljsbuild yet

13:34 aniero: hmm, in on the ground floor then. i'm not sure how to design a lisp application at all, much less do the things i want to do in the browser

13:34 what i *dont* want to do is go back to jquery callback soup, that's where things like backbone's event bindings have really, really helped with managing complexity

13:36 i'll see if i can find anyone doing data binding / event handling type stuff with swing. seems that should be analagous

13:45 TimMc: mmm, soup

13:46 I don't mind it too much.

13:47 * TimMc tends to write continuation-passing JS

13:52 Raynes: aniero: I like callback soup. Especially with a little salt.

13:59 TimMc: not sugar?

14:00 yazirian: salting is more cryptographically secure

14:00 amalloy: Raynes likes his soup like he likes his IRC conversations: spicy

14:01 yazirian: salted alphabet soup only spells words for the intended eater

14:02 emezeske: Does alphabet soup have parens? That's what I want in mine

14:03 yazirian: add some elbow macaroni

14:03 ibdknox: puns - the lowest form of high humor :p

14:04 emezeske: yazirian: :)

14:06 technomancy: so my understanding was that hygenic macros are simply about avoiding accidental variable capture... but if that were true then the idea of hygenic macros in Clojure would be silly, because accidental variable capture is not an actual problem people have.

14:06 so... what am I missing?

14:06 arohner: technomancy: accidental variable capture is not an issue because of ~ and #

14:06 technomancy: i.e. you're not seeing the pain because rich already solved it

14:06 jweiss: seems like atoms/refs don't help when the data in contention is in a remote service. just need a plain lock on my end to represent it?

14:07 technomancy: arohner: that's what I thought

14:07 but this Byrd interview makes it seem like Clojure needs hygenic macros, and people seem to be nodding and agreeing

14:07 makes it seem like he thinks Clojure needs them, rather

14:08 arohner: technomancy: in scheme and CL, symbols in macros don't default to resolving to vars, so the problem is significantly worse

14:08 link?

14:08 technomancy: http://clojure.com/blog/2012/02/16/take5-william-byrd.html

14:08 * emezeske has never once accidentally captured a variable in a macro.

14:08 technomancy: emezeske: happens all the time in elisp =(

14:08 emezeske: technomancy: yuck!

14:09 arohner: technomancy: AFAIK, there's exactly one implementation of hygienic macros in scheme, and nobody understands it, they just keep copying it around

14:10 technomancy: one of the boston clojure groups had this epic scheme troll presenting for an agonizing 40 minutes on his port of syntax-rules to Clojure and how awful Clojure is, but at least it's kind of like Scheme.

14:10 TimMc: technomancy: Haha, was that Alec?

14:11 * arohner wouldn't be more productive or have fewer bugs with a more 'powerful' macro system

14:11 tmciver: Ha! I liked that guy! He was entertaining.

14:11 technomancy: TimMc: the akamai guy; i forget his name

14:11 tmciver: He's they guy who wanted to fight anyone who didn't agree with him.

14:11 TimMc: Friend of mine. I think that no matter what language meetup you invited him to, he would bitch about the language in great detail and at great length.

14:12 amalloy: isn't rplevy at akamai? i don't think he ported syntax-rules, though

14:12 jweiss: i'm glad other people don't understand syntax-rules either, makes me feel better

14:12 TimMc: amalloy: I don't think he's at Akamai any more? Maybe he is.

14:12 tmciver: No, he's not.

14:13 Raynes: "Not quite, because Clojure's macro system appears to me to be a kludge, trying to patch up Common Lisp's defmacro without going all the way to real hygienic macros."

14:13 technomancy: would have been less agonizing if I had grabbed dinner before the meeting

14:13 redinger: You mean robert Levy?

14:13 Raynes: technomancy: ^ KILL IT WITH FIRE

14:13 TimMc: Last time I saw Alex he tried to convince me to rewrite all my stuff in Racket.

14:13 Raynes: redinger: Howdy. Don't often see you around these parts.

14:13 amalloy: technomancy: i think syntax-rules is supposed to be more declarative than defmacro (pattern-matching kinda stuff), and have a better understanding/control of the lexical environment than just manipulating symbols

14:13 redinger: Raynes: Oh, I'm always around... :)

14:13 TimMc: redinger: No, Robert isn't the one who gave the "talk".

14:14 humasect: CinC

14:14 TimMc: syntax-rules is deep, intuitive magic.

14:14 redinger: Now I'm curious who gave the talk after that description

14:14 TimMc: redinger: Alec Heller

14:14 redinger: Ah, okay

14:14 TimMc: curmudgeon extraordinaire

14:15 technomancy: "the zenspider of clojure"

14:15 TimMc: ?

14:15 $google zenspider

14:15 lazybot: [zenspider.com by ryan davis] http://www.rubyholic.com/

14:15 amalloy: babilen: i don't think what you want from split-at-subseq is possible in clojure. you can't be both immutable and lazy and get that behavior

14:16 Raynes: "Will Clojure become as popular as Ruby or Python? Probably not."

14:16 Jesus. This interview is depressing.

14:16 technomancy: This interview. Depressing.

14:16 I liked Friedman better. He was mostly quiet and had a nice hat. :|

14:17 TimMc: amalloy: I think it is doable. Maybe we have different ideas of what is desired?

14:17 amalloy: he wants a lazy sequence of lazy partitions

14:18 right?

14:18 TimMc: yep

14:18 I think that can be done, with certain limitations.

14:19 amalloy: i don't think so. how can he produce even a single element of the second partition without knowing/forcing every element of the first?

14:19 TimMc: He can't.

14:19 But the latest partition can always be lazy.

14:20 amalloy: no. suppose you got a reference to the latest, lazy partition, okay, and traversed ten elements of it

14:20 TimMc: Big limitation, still a high utility.

14:20 amalloy: now you stop, and ask for the next partition

14:21 TimMc: Yes, the latest becomes fully realized, and the next is lazy.

14:21 amalloy: hm, maybe it's possible. you finish forcing the previous partition at that point? that may work

14:21 TimMc: In fact, I think he almost has it.

14:21 amalloy: hm. but there's a cost associated with that - you can't handle infinite sequences anymore

14:22 TimMc: Well, you're not gonna have a finite partition after n infinite partition.

14:22 amalloy: because now in order to be able to give you partition N, the function has to keep a reference to the head of partition N-1 in order to doall it

14:22 so what. it has to hold onto the head whether it's infinite or not, just in case it turns out to be finite

14:24 TimMc: amalloy: Did you see the implementation plan I gave babilen?

14:24 amalloy: i'm not sure. the conversation seems to be spread out over time and i probably missed it

14:24 Raynes: amalloy: Get your Ocarina.

14:26 TimMc: amalloy: 1) prefix? 2) a lazy-seq fn to replace subsequences with a sentinal object 3) a fn to lazily partition at sentinals

14:27 This makes sense in my head, although 3) is the fuzziest.

14:30 amalloy: i dunno. i think you're using step (2) to transform the problem into a different space where it seems less hard but is in fact equally hard

14:31 but i'm not so confident of that, i suppose. we'll see what babilen turns up with

14:31 bartek1: hello

14:32 how easily get submap of map with specified keys?

14:32 ibdknox: Raynes: I think it's a fair statement. I doubt Clojure will be of Ruby or Python level usage

14:32 bartek1: is there function?

14:32 technomancy: bartek1: try select-keys

14:32 Raynes: ibdknox: I didn't say it wasn't fair. I said it was depressing.

14:32 ibdknox: truth

14:32 Raynes: ibdknox: Those statements are the kind of statements that make everyone wonder "Well, why am I even bothering then?"

14:32 bartek1: perfect, thank you :)

14:33 technomancy: Raynes: so you can have an unfair advantage

14:33 Raynes: In the worst case, it could spark a bunch of mailing list threads quoting him and asking that question.

14:33 ibdknox: I'm with technomancy on this one

14:33 technomancy: Let's all run off and implement viaweb. =)

14:33 ibdknox: :D

14:35 jweiss: i'm in that spot now, competing against python (and winning) but have to convince people that i'm winning. not that easy, yet.

14:35 when the python project fails to catch up as they promised, then i'll have an easier time

14:52 i have a multithreaded clojure client for a remote service. i have a fn that checks for existence of a remote entity, and if not there, creates it. Obviously not thread safe, the remote service gets unhappy because two of my threads ttry to create at the same time. i could use (locking ... ) but what do i lock? the important value here is a string, which may be the same string but not the same object. converting to keyword might

14:52 force them to be the same object. is that reliable?

14:54 hiredman: jweiss: I generally lock the functions var

14:55 jweiss: hiredman: ok, that would be a little too zealous. I'm creating a remote X within a remote Y. I just need to lock the Y.

14:55 raek: jweiss: perhaps you could lock the result of (.intern the-string) if you only want threads to wait for each other if their strings are equal

14:55 jweiss: raek: yep that's what i want. i'll look into that. thanks

14:57 ,(identical? (.intern "asdf") (.intern (apply str (reverse "fdsa"))))

14:57 puredanger: generally locking on interned strings is considered bad form in Java (because you collide with anyone else that locks on the same obj)

14:57 clojurebot: #<Exception java.lang.Exception: SANBOX DENIED>

14:57 jweiss: bah

14:58 puredanger: what would you recommend instead?

14:58 puredanger: why not defonce an object to lock against?

14:59 or create an explicit ReentrantLock instance and .lock/.unlock it

14:59 jweiss: puredanger: hadn't used defonce before, that looks like it would work

15:00 although i sort of have the same problem, i want threads with equal values of a certain string to use the same lock

15:02 puredanger: jweiss: so you're effectively lock-striping?

15:02 jweiss: puredanger: i'm not sure what that is :)

15:02 i want to lock an object that's really in a remote service

15:02 puredanger: jweiss: you could also leverage refs for this w/ensure I think and be more-clojure-y

15:02 jweiss: just by the name of it

15:03 puredanger: jweiss: so you really want a map with string keys and a lock object as val

15:03 jweiss: puredanger: that sounds right

15:03 puredanger: jweiss: but you have the issue of not wanting to race on creating the object

15:04 jweiss: you could use ConcurrentHashMap.putIfAbsent for that

15:04 jweiss: wow did not expect this to be so complex

15:05 aren't keywords always the same object?

15:05 thought of (locking (keyword myparent-obj) ... )

15:06 puredanger: jweiss: this is actually a common (and commonly done wrong) problem when using explicit locks :)

15:06 keywords are identical (based internally on string interning)

15:06 jweiss: yeah, none of clojure's concurrency tools really help here, i can't have it retrying, i'll still end up making the remote service unhappy

15:09 puredanger: jweiss: if I was in Java, I'd probably use CHM and putIfAbsent - you have be careful to understand it's return value though and use it correctly

15:12 jweiss: puredanger: ok, thanks

15:23 TimMc: amalloy: I implemented (1) and (2) really quickly, but I'm actually kind of stuck on (3).

15:23 amalloy: (1) and (2): https://refheap.com/paste/769

15:23 amalloy: ah, you're giving me a perfect opportunity to use the wit i swallowed last time: that's because (3) is the impossible part

15:24 TimMc: grrr

15:25 I think it can be done with clever use of sentinals.

15:26 some kind of 2-phase lazy-seq

15:30 Raynes: TimMc: Hahahaha. I was wondering what you had to do in order to justify signing into a browserid powered site, so I checked the email you signed up with. Nice work.

15:30 TimMc: I don't remember, what username did I use?

15:30 Raynes: track-browserid

15:31 Well, your username is timmc.

15:31 TimMc: Oh, yeah -- that's standard.

15:31 Raynes: I do that too though.

15:31 TimMc: I have a set of prefixes I use for signing up for commercial and other services.

15:31 Raynes: I use a random email on sites I'm not comfortable with.

15:31 * arohner wants all clojure values to be serializable

15:32 TimMc: Having a catchall turns outto be a slightly bad idea, but if you restrict yourself to a pattern-matchable subset of addresses, you're golden.

15:38 wei_: is there a take-while with state? for example, I want to take flip a coin until I see both heads and tails

15:39 (take-until-heads-and-tails '(1 1 0 1 1 1 1 1 1 0 0 1 0 1 0)) -> (1 1 0)

15:39 Raynes: amalloy: ^ Isn't there a 4clojure problem devoted to this

15:40 TimMc: wei_: You could do something with map vec s (drop 1 s)

15:40 or something like that

15:40 amalloy: i think there is, yeah

15:40 $google 4clojure global take-while

15:40 lazybot: [114. Global take-while - 4Clojure] http://www.4clojure.com/problem/114

15:40 Raynes: amalloy: Go steal a solution from the db and give it to wei.

15:40 wei_: haha

15:40 thanks :)

15:40 tmciver: (first (partition-by identity s))

15:41 nope, that doesn't do it.

15:42 Raynes: You get a little trophy for trying.

15:42 tmciver: Thanks Raynes, that means a lot to me.

15:43 TimMc: wei_: Oh wait, you want context potentially all the way back to the head of the seq?

15:44 wei_: yes, if I were to solve this imperatively, I would keep a list of unique values i've seen, that way I don't need to remember the entire seq

15:44 tmciver: (let [ [f s] (partition-by identity s)] (concat f s)) ;; ugly

15:55 TimMc: loop recur :-)

16:01 amalloy: https://refheap.com/paste/769 seems to work, haven't checked laziness yet

16:04 Raynes: What the...

16:04 recur isn't detected as a builtin… Man, what was Georg even thinking when he wrote that lexer.

16:05 * Raynes makes a note to send yet another pull request.

16:12 TimMc: amalloy: Just checked, it is lazy in the latest partition (eager by one element.)

16:22 technomancy: anyone want a Leiningen sticker?

16:23 redinger: technomancy: Is there a catch to get it? :)

16:24 technomancy: you have to have a patch submission accepted

16:24 but I have a really easy one

16:26 beffbernard: Quick question.. defn.. overloading.. how do you call yourself?

16:26 redinger: I knew it! If I had the time today I would

16:28 raek: beffbernard: (defn f ([] (f 1)) ([x] ...))

16:28 tmciver: beffbernard: you can provide multiple implementations of a function of differing arities. You can call out to a different implementation from one of those.

16:29 beffbernard: okie dokie

16:29 thanks

16:30 tmciver: beffbernard: http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20%28[params*%20]%20exprs*%29+%29

16:38 TimMc: beffbernard: You can recur to the same arity, or recurse to a different one.

16:47 pcavs: What's the proper way to use a ref, if I'm trying to use it as a shared map of resources, like a resource pool? I'm thinking just (def my-resource-pool (ref {})) then in a dosync populate it, read from it, etc. But I'm wondering if that (def ..) creates multiple refs (looks like it will..) So what's the proper way to do this?

16:48 hiredman: pcavs: only if you load/run the code multiple times

16:50 pcavs: hiredman: ahh, but what if this is a web service?

16:50 hiredman: what about it?

16:50 pcavs: Like what's the proper way to do this in a noir app, or ring app, or w/e.

16:51 hiredman: oh, well don't use the code reloading features noir comes with

16:51 weavejester: Or perhaps use defonce

16:51 hiredman: (which should only be for developement anyway)

16:51 ring won't reload code by itsself

16:52 ibdknox: pcavs: if you're in dev mode changes will cause it to reload. Simple solution is to defonce

16:53 hiredman: it's only in dev mode :)

16:53 hiredman: ibdknox: sure

16:53 pcavs: okay cool, in clojure do all top level definitions in a namespace get loaded/executed whenever that namespace is loaded?

16:54 (I would assume so, but just getting my noob questions out of the way now)

16:54 weavejester: As far as I'm aware

16:54 defonce is there to get around the issue of reloading

16:54 Usually used to atoms or refs

17:00 zxcxzc1: im getting an error when i use my function in the repl, but the error message doesnt tell me the line. i got the function into the repl via load-file. but it just says "(NO_SOURCE_FILE:30)"

17:00 how i get the line number of the error?

17:00 brehaut: dont use load-file?

17:01 Somelauw: brehaut: nope

17:02 hiredman: actually load-file should give you a file name

17:02 zxcxzc1: so i have to set up a namespace first and then use use?

17:02 hiredman: zxcxzc1: are you sure the exception is originating from code loaded via load-file?

17:03 the class names in the stacktrace are also useful

17:03 zxcxzc1: im calling a function i loaded via load-file

17:03 "ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn user/eval53"

17:04 hiredman: the function are trying to call is actually a number

17:04 just type in the name of the "function" without calling it

17:05 the exception is coming from code you typed at the repl

17:06 zxcxzc1: i ripped this bit out and tested it individually: "((fn [list n] (conj (drop-last list) (last list))) (1 2 3) 2)" (it's been a while since i programmed in clojure. i probably screwed it all but, i just wanted to get proper error messages for now. i mean at least line numbers ;))

17:06 hiredman: (1 2 3)

17:06 ,(1 2 3)

17:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

17:06 zxcxzc1: i had originalle defined the function in the repl. i dunno if load-file "overwrote" that old definition. i tried using "ns-undef" and then reloading the file to make sure... not that im sure

17:07 oh man

17:07 thanks...

17:15 TimMc: babilen: https://refheap.com/paste/769 (the last bit needs cleanup, though)

17:18 amalloy: TimMc: fwiw, stylistically i hate seeing (let [splitter (fn splitter ...)] (splitter ...)). it just seems simpler to write ((fn splitter ...) ...)

17:19 but i see it done all the time, so i guess i'm in the vocal minority

17:19 TimMc: You're just bitter.

17:20 Actually, it's a big enough fn that I don't want to do that.

17:20 has it's own docs and everything

17:20 *its, dammit

17:20 hiredman: amalloy: letfn!!!

17:22 mrevil: is for lazy?

17:22 TimMc: yup

17:22 mrevil: TY

17:23 TimMc: babilen: Oops, might not work perfectly yet...

17:24 amalloy: err...what point are you making, hiredman? replacing the let with a letfn has only slightly less repetition. and in TimMc's case, when there's an open let already, i'd prefer let to letfn

17:24 TimMc: mrevil: Check it for yourself: ##((constantly :no-op) (for [x (range)] x))

17:24 lazybot: ⇒ :no-op

17:25 hiredman: amalloy: my point is a) letfn is great b) and thats it

17:25 amalloy: haha okay

17:26 TimMc: hiredman is loony for letfn

17:26 hiredman: I strongly prefer letfn to leting fns

17:26 tmciver: TimMc: how does your example prove that for is lazy? Isn't that just a demonstration of constantly?

17:27 technomancy: hiredman: I have a harder time scanning them

17:27 hiredman: technomancy: ok

17:27 technomancy: my eyes are immediately drawn to (defn, (fn, and #(), but letfn doesn't have a visual HAY GUISE FUNCTION HERE marker

17:27 hiredman: technomancy: hardly objective

17:27 technomancy: I like letfn in principle though

17:28 hiredman: letfn communicates intent

17:28 technomancy: I think as long as the function bodies aren't long it helps

17:28 hiredman: and if theory would make it easier for the compile to optimize easier then the general let case (but it doesn't)

17:28 technomancy: when you have a (my-thingy opening ten lines away from the top of the (letfn form it's worse

17:29 hiredman: :)

17:29 technomancy: freaking theory, amirite?

17:29 tmciver: TimMc: nvm, I think I see.

17:30 Borkdude: I have a Clojure project in Eclipse/CCW. I try to compile a .clj file that has a ns with :gen-class in it. But somehow Eclipse (Java) says: NoClassDefFoundError, wrong name: core/Hello

17:30 emezeske: hiredman: I did not know about letfn. I like that way better than let ... (fn [] ...

17:30 hiredman: I had (have?) I branch that takes tagged letfns and turns them into static methods, the idea being the compile should be apple to scan the code and do that for letfns tagged or not if the function isn't used as a value

17:30 Borkdude: the file hello.clj is in a package called core and the namespace is called core.hello, the name of the class is core.Hello

17:30 technomancy: ok, actually my complaint is that in nearly everywhere else in clojure, seeing (x ...) means that x is being called.

17:31 I don't feel comfortable breaking that rule

17:31 hiredman: (defn … ([] ...))

17:31 amalloy: (defn + ([x] x) ...)

17:31 hiredman: etc

17:31 technomancy: that's not a symbol in the first position though

17:32 Borkdude: am I missing something?

17:32 amalloy: so? ((juxt inc dec) 1) doesn't have a symbol in the first position and it is a call

17:32 hiredman: not having a symbol in the first position is kind of the point of lisp-1

17:32 technomancy: amalloy: (( functions as a very clear indicator that something higher-order is going on

17:33 hiredman: the point is you don't have to have a symbol in the first position to be a call, which is different

17:33 amalloy: there's also the fairly-gross-imo requirement to use ( on symbols in ns. stuff like (ns foo (:import (javax.swing JFrame JPanel)))

17:34 technomancy: the whole ns macro is gross though

17:34 it doesn't interfere with scanning issues because it's always in the same place

17:35 Borkdude: cemerick: do you have a clue what I'm doing wrong?

17:38 uvtc: Hi #clojure. Do the namespaces listed on the left-hand-side of http://clojure.github.com/clojure/index.html constitute the "standard library" that comes with Clojure OOTB?

17:38 amalloy: i think that's about right, uvtc

17:39 uvtc: (aside from clojure.core, which is available without needing to be `require`d)

17:39 amalloy, Thanks.

17:39 Raynes: TimMc: So, I've decided to change the signup stuff to ask for your phone number, address, and date of birth as well. I'm considering asking for a social security number. How do you feel about these changes?

17:39 uvtc: Is there a way from the repl to get a listing of those namespaces?

17:40 hiredman: uvtc: you can get a list of loaded namespaces

17:41 newb_cl: Hi

17:41 uvtc: hiredman: that would be useful too. How would one do that?

17:41 hiredman: it's pretty intuitive

17:42 try and see if you can figure it out

17:43 newb_cl: if I want to pass the result of a function call (lets say (defn a [n m] (prn "a")) (defn b [s]) (defn c [] (b (a "a" "b")),?

17:43 uvtc: hiredman, `(loaded-libs)`

17:43 hiredman: nope

17:44 uvtc: hiredman, My autocomplete suggests `loaded-namespaces`, but that fails for me.

17:45 hiredman, (my repl autocomplete)

17:45 newb_cl: it says CCE string to ifn

17:46 bsteuber: is there any changelog for clojurescript?

17:47 uvtc: hiredman, nevermind --- I think the autocomplete learned that other prospective fn name from a past attempt at trying it.

17:49 dnolen: bsteuber: no, but there probably should be

17:55 ibdknox: dnolen: +1 for a change log

17:56 TimMc: Raynes: Come at me bro.

17:56 ibdknox: lol

17:56 the more invasive the signup process the better

17:57 TimMc: I've decided to back up all my data to refheap pastes.

17:59 amalloy: good news, TimMc, all your data is already associated with your refheap login

18:00 * Raynes sells it all

18:01 uvtc: I see that (in Clojure 1.3.0) src/clj/clojure/string.clj has a nice namespace doc string, but I'm not able to access it via the repl. I'm trying `(require 'clojure.string)` then `(doc clojure.string)`.

18:02 I get: "ClassNotFoundException clojure.string java.net.URLClassLoader$1.run (URLClassLoader.java:217)"

18:02 Is there a way to view that docstring from within the repl?

18:05 TimMc: Welp, I've achieved a 10-20x speedup in the query time for this demo. Time to go home!

18:08 uvtc: I suppose it's just easiest to look at the source.

18:18 Is it standard convention for all the contrib module namespaces to be prefixed with "clojure." -- just like the ones that come standard with Clojure itself_?

18:18 s/namespaces/namespace names/

18:19 Raynes: Yes.

18:19 uvtc: Raynes, Great. Thanks.

18:21 TimMc: uvtc: Yes, and then they are referred to casually without that prefix.

18:21 amalloy: Admit that it wasn't impossible!

18:22 uvtc: TimMc: Ah, thanks.

18:22 amalloy: TimMc: you still haven't *really* done it because at most one sub-partition can be lazy at a time

18:22 TimMc: pfff

18:23 I agree on *that*.

18:23 amalloy: feel free to address hatemail to /dev/null

18:23 TimMc: amalloy@example.org

18:26 uvtc: Hm. Looking at the github pages for a number of contrib modules, their src dirs contain src/main/clojure/clojure . Why does "clojure" appear twice? I see this with algo.generic, algo.monads, core.cache, ... data.xml, etc. Why is that?

18:26 hiredman: it's a mavenism

18:26 contrib and clojure are built with maven

18:26 just about everything else uses lein

18:27 TimMc: uvtc: clojure.core isn't very idiomatic of clojure projects. :-)

18:27 same with most of contrib

18:27 uvtc: hiredman: Ah, thanks.

18:28 TimMc: ha. :)

18:31 ferd: I need to invoke a few external commands from Clojure. There's clojure.java.shell, contrib.shell and contrib.shell-out. What's the story here?

18:31 technomancy: ferd: the contrib ones are deprecated

18:31 ibdknox: ferd: clojure.java.shell

18:31 Raynes: ferd: clojure.java.shell is the good one.

18:31 ferd: If it doesn't do everything you need, check out https://github.com/Raynes/conch

18:31 ferd: thanks! Hey Raynes, I saw your conch too

18:31 yes

18:32 I like it's power... but it lacks simpler syntax for when all I need is to get a String (or lines seq)

18:32 thanks!

18:32 Raynes: Right, those cases are what clojure.java.shell is designed for. If you just need the output as a string when the process has terminated.

18:32 I wrote conch for the sole purpose of streaming output and input.

18:33 I definitely support the use of clojure.java.shell if your needs are within its limitations.

18:33 (And they usually are)

18:33 ferd: yep, that was my understanding

18:34 FYI: there's an example in http://clojure.org/libs that uses contrib.shell-out... would be nice to change it

18:34 technomancy: we should get a lazybot trigger to warn people about how clojure.org is always outdated. =(

18:34 ferd: a detail... but one of the top google search for "clojure shell out" landed me there

18:34 Raynes: technomancy: Hahaha, indeed.

18:35 technomancy: sad but true

18:51 brehaut: ferd: google sends you to what is popularly linked, not what is true

18:53 ferd: brehaut: ??? I know... but how can you tell that the example on clojure.org is not "true" ?

18:53 Raynes: You can ask us.

18:53 :p

18:54 brehaut: clojure.org takes the identity and value model of clojure seriously. the documentation is a consistent and correct snapshot of clojure at a given point in time

18:56 AimHere: ,(clojure.java.shell/sh "pwd")

18:56 clojurebot: #<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.java.shell>

18:58 Raynes: That wouldn't work anyways.

18:59 technomancy: brehaut: nice

18:59 step 1: travel in time back to 2009. step 2: documentation is correct.

18:59 ibdknox: lol

18:59 AimHere: I'm not convinced the clojure documentation is even mutable

18:59 Raynes: &(range 1000)

18:59 lazybot: ⇒ (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 ... https://refheap.com/paste/771

19:00 brehaut: AimHere: it doesnt need to be; clojure.org just needs to be a reference

19:04 wei_: i want to get 5 different random sequences. but this gives me 5 identical random sequences

19:04 (repeat 5

19:04 (let [flips (repeatedly #(rand-int 2))]

19:04 (take 5 flips)))

19:04 what gives?

19:06 emezeske: wei_: I think you might want 'repeatedly instead of 'repeat

19:14 wei_: awesome! thanks.

19:26 TimMc: brehaut: They forgot to declare the clojure.org var :dynamic.

19:27 brehaut: lol

19:28 technomancy: oh snap!

19:35 jweiss: i find that in one of my leiningen projects, 'lein deps' spends an awfully long time deleting files recursively. like 45 seconds. find . | wc -l = 446 so it's not that many files even if it's trying to delete them all.

19:36 223 of those files are in .git :)

19:37 technomancy: jweiss: try :local-repo-classpath true

19:37 ibdknox: technomancy: I wonder if that's what's causing my thing too

19:38 jweiss: technomancy: but there's only like 45 files in lib/

19:38 ibdknox: what does :local-repo-classpath do?

19:38 jweiss: are you on a mac?

19:38 jweiss: ibdknox: no, linux

19:38 ibdknox: hm

19:38 jweiss: and my other projects don't take a long time

19:39 just this one

19:39 wonder if it's because i'm using checkouts?

19:39 ibdknox: does it chew through your CPU?

19:39 jweiss: i can try unlinking

19:39 ibdknox: no, seems to be io bound

19:39 ibdknox: k

19:39 different then :)

19:39 jweiss: well, not even that, it's just pretty much idle

19:40 if i immediately rerun, it runs fast

19:41 http://fpaste.org/3nJb/ <- thread dump of main

19:41 seems to be gc'ing

19:43 hm, there is an explicit call to gc.

19:43 that don't seem right. esp since it's to help windows users :)

19:43 perezd: so, I am sure that this question gets asked constantly, how does one deploy a leinigen-based clojure project as a server-side ?

19:43 hiredman: that is weird

19:43 perezd: I wanted to use heroku, but they don't support persistent TCP

19:43 do I need an app server?

19:43 Tomcat? something

19:43 dgrnbrg: What is IHashEq used for in Clojure?

19:43 perezd: really uninformed person here

19:43 dgrnbrg: Is it used instead of hashCode()?

19:44 ibdknox: perezd: what are you currently using?

19:44 perezd: ibdknox: starting my first project

19:44 i have nothing yet

19:44 just leinigen project

19:44 and 1 failing test :)

19:44 hiredman: perezd: depends, I just use jetty-runner for little http apps

19:44 ibdknox: perezd: what kind of app are you trying to create?

19:44 perezd: basically a websocket server

19:44 using aleph

19:45 ibdknox: perezd: then you have everything you need :)

19:45 aleph runs a server (netty)

19:45 perezd: right, but I mean…how do I do this.

19:45 how do I deploy

19:45 I can't assume I just run lein run on a server

19:45 that sounds bad

19:45 do I make a war file?

19:45 lol

19:45 I don't know

19:45 I've never deployed JVM

19:46 learning!

19:46 ibdknox: perezd: lein run will work just fine

19:46 perezd: is that really a good idea?

19:46 ibdknox: lein trampoline run might be better

19:46 why not?

19:46 perezd: well for one, the tutorial advised against it

19:46 technomancy: yeah, if you use "lein trampoline run" and set LEIN_NO_DEV then the overhead of leiningen is basically just at process boot time

19:46 oh crap, does it?

19:46 ibdknox: technomancy: :p

19:46 technomancy: perezd: that's probably from before lein trampoline was implemented

19:46 perezd: "may be tempting to deploy by just checking out your project and using "lein run" on production servers. However, unless you take steps to freeze all the dependencies before deploying, it could be easy to end up with unrepeatable deployments."

19:47 what does trampoline do?

19:47 technomancy: it causes there to be only a single JVM resident

19:47 ibdknox: perezd: webnoir.org, sqlkorma.com, readyforzero.com, and a host of other things I've written all just use that, so I think it's ok ;)

19:47 perezd: thats sounds important

19:47 okay good then :)

19:47 just making sure

19:47 I know things like Tomcat exist

19:48 emezeske: technomancy: Am I correct in believing that trampoline is going away in lein 2?

19:48 perezd: so I figured I should make sure I don't need that

19:48 technomancy: perezd: yeah, the issue of repeatability is important. I recommend fetching your deps during a CI run and deploying a tarball you can use with lein run

19:48 emezeske: no, that's not true

19:48 emezeske: originally I wasn't sure if it would make it into the preview release

19:48 perezd: okay, so lein run is okay if you've got a plan for freezing deps

19:48 emezeske: technomancy: Ah, okay, maybe that's what I was thinking

19:48 technomancy: but then while looking into how much work it would be I realized it was easy

19:48 amalloy: nobody could ever throw away a trampoline. they're so fun

19:48 emezeske: technomancy: I'm working on some REPL stuff for lein-cljsbuild, which currently has to be trampolined

19:49 technomancy: Will it still need that in lein 2?

19:49 technomancy: emezeske: depends why you need the trampoline =)

19:49 is it for access to *in*?

19:49 emezeske: technomancy: Yeah

19:49 perezd: one does not simply throw away a trampoline

19:49 technomancy: emezeske: might be able to make it work with an in-process subclassloader

19:49 emezeske: technomancy: Hmm, even in lein 1.x?

19:49 technomancy: emezeske: no, in 2

19:50 hiredman: or build an uberjar on a ci server and just run it

19:50 emezeske: technomancy: One thing i was thinking: could there be some way for a plugin to say "always run this action in a trampoline"?

19:50 technomancy: hiredman: yup, also perfectly reasonable

19:50 perezd: okay, let me ask this:

19:50 technomancy: emezeske: yeah! you can do that in lein2

19:50 it's the best

19:50 perezd: are there any obvious DON'Ts I should watch out for

19:50 technomancy: you can partially apply aliases

19:50 hiredman: don't deploy from git

19:50 * technomancy is unreasonably excited about this feature

19:50 technomancy: don't check jar files into git

19:51 emezeske: technomancy: That's great. I just *know* people (including me) will just type "lein cljsbuild repl..." instead of "lein trampoline cljsbuild repl..."

19:51 technomancy: perezd: the leiningen wiki has a page on "Repeatability"; definitely worth a read IMHO

19:51 TimMc: ~repeatability

19:51 clojurebot: repeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability

19:51 TimMc: BAM

19:51 technomancy: aha; thanks =)

19:51 TimMc: technomancy: ^ you should bookmark that or something ;-)

19:51 perezd: excellent, i am gonna go through that

19:51 so another question

19:51 https://github.com/clojure-clutch/clutch

19:51 is this seen as the defacto CouchDB?

19:52 library

19:54 brehaut: perezd: yes, its very good

19:54 perezd: okay cool. I'm hoping to interact with couchdb, my fav db

19:54 brehaut: (and the view server is optional)

19:54 perezd: yeah, I figured

19:54 its a neat idea tho

19:54 javascript/spidermonkey is fast enough if you throw parallelism into the mix :)

19:55 brehaut: a neater idea: http://cemerick.com/2011/10/11/writing-couchdb-views-using-clojurescript/

19:55 clutch's view server isnt really about speed; its more about expressiveness

19:55 perezd: unfortunately, I care about speed there more :)

19:55 cemerick appears to be the guy I should stalk for clojure+couchdb

20:00 jweiss: finally found and bound slime-repl-previous-matching-input. feel like i just stopped hitting myself in the head with a hammer.

20:01 perezd: any recommended tutorials for swank/slime ?

20:01 jweiss: perezd: have you checked out the github swank-clojure page?

20:01 perezd: not yet

20:02 just getting started

20:02 brehaut: perezd: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs

20:02 jweiss: helpful for getting it running, has some keyboard shortcuts listed there

20:02 perezd: nice

20:02 excellent, thank you

20:02 technomancy: don't trust anything but the readme for swank

20:02 so much bad info out there

20:03 perezd: ok

20:03 good to know

20:03 technomancy: clojurebot: swank?

20:03 clojurebot: swank is try the readme. seriously.

20:03 technomancy: clojurebot: forget swank |is| try the readme. seriously.

20:03 clojurebot: I forgot that swank is try the readme. seriously.

20:03 technomancy: clojurebot: swank is trust the readme and the readme only. all others will lead you astray.

20:03 clojurebot: Ik begrijp

20:04 brehaut: im pretty sure the getting started with textmate page is wrong. it should be filled with mean spirited laughter

20:04 technomancy: yeah, does confluence support html5 yet?

20:05 brehaut: technomancy: http://i.imgur.com/2Kq6Y.jpg

20:06 technomancy: nice!

20:06 brehaut: via @romanandreg

20:07 chemp: how can clojure read my .class files in the current directory? it's not working by default

20:08 anyone?

20:08 clojurebot: #<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>

20:09 technomancy: chemp: that's possible but extremely awkward, you should get your dependencies from maven repositories

20:10 hiredman: technomancy: well, come on, it's not that hard

20:10 chemp: technomancy, uh I'm pretty new to java and clojure. I just want to be able to accesses classes I've written in java from closure

20:10 hiredman: actually, at all hard really

20:10 technomancy: yeah, but I don't feel like explaining it =\

20:10 chemp: as easily as possible

20:11 technomancy: chemp: the normal approach is to use the lein javac task to compile your .java source into the classes/ dir

20:11 hiredman: chemp: a. figure out how to load your classes in java b. clojure is largely the same

20:12 chemp: hiredman, well, I know how to import classes

20:12 hiredman: importing is not what I meant

20:12 chemp: hiredman, do i just put my .class files in a dir classes/ ?

20:12 hiredman: anywhere on the classpath

20:16 chemp: hiredman, why doesn't clojure look for classes in my current directory, isn't that in the classpath?

20:16 hiredman: did you put it on the classpath?

20:17 chemp: isn't it there by default?

20:17 brehaut: no

20:17 chemp: then how does java find files?

20:17 hiredman: there is no default classpath

20:17 chemp: ok

20:18 so do i just do a CLASSPATH=. ; export CLASSPATH ?

20:18 hiredman: -cp

20:18 anyway, google it, the internet has lots of people explaining the classpath

20:20 perezd: so, if I am doing a server-side aleph project with lein, do I still want to make the core.clj file with a -main ?

20:27 technomancy: perezd: yeah, I think so

20:27 perezd: k cool

20:28 so emacs is pretty cool

20:28 technomancy: it's true

20:28 brehaut: emacs may be cool, but nothing about it is pretty

20:29 perezd: using prelude with it makes it kinda pretty

20:29 https://github.com/bbatsov/emacs-prelude

20:29 technomancy: brehaut: I don't know what you're talking about; inconsolata is great.

20:29 TcepsAFK: I've found that color-theme helps ^_^

20:29 brehaut: technomancy: the complete lack of negative space for frames annoys me greatly

20:29 frames? windows?

20:30 i think i mean windows

20:30 perezd: so just got this after a lien run: https://gist.github.com/d117399de5f8bef560f4

20:30 this looks bad

20:30 technomancy: brehaut: do you have the fringe turned off?

20:30 brehaut: technomancy: at the moment i have whatever the defaults are for e24 and the starter kit

20:30 technomancy: theres a small 1 character wide verticle gutter on either side of each window

20:32 technomancy: experiementation indicates that i have the fringes on

20:32 technomancy: mine's like 5px

20:32 not really a complete lack of negative space

20:32 perezd: any ideas on my gist exception?

20:33 brehaut: technomancy: well, mine gets full of line wrapping sigels (thanks again, django templates)

20:33 technomancy: about 10px here

20:34 seancorfield: perezd: you're using old contrib with clojure 1.3

20:34 what's in your project.clj? (gist?)

20:34 perezd: seancorfield:

20:34 https://gist.github.com/a8f0d54a18ae1cd4cbea

20:35 seancorfield: hmm, aleph 0.2.0 isn't compatible with clojure 1.3...?

20:35 perezd: hmm appears to not be...

20:35 upon inspection of its project.clj

20:36 xeqi: perezd: https://github.com/ztellman/aleph/issues/34

20:36 theres a bug report with the same error

20:36 perezd: nice

20:36 xeqi: but it links to a closed 1.3 compat issue

20:36 so I would have thought it fixed

20:36 perezd: there is a branch for 1.3

20:36 apparently

20:36 seancorfield: change the aleph version to 0.2.1-alpha2-SNAPSHOT and run lein deps

20:37 perezd: okay, I'll give that a go

20:38 seancorfield: that seems to bring in tools.logging and data.json which are new contrib

20:39 perezd: excellent, thanks!

20:39 I'll report back if it messes up

20:39 so far so good

20:39 seancorfield: i'm on a crusade to get everyone using 1.3 instead of 1.2 :)

20:40 perezd: i want to subscribe to your newsletter

20:40 seancorfield: lol

20:40 perezd: yay aleph works!

20:40 just got my ZOMG world

20:42 http://www.ostinelli.net/a-comparison-between-misultin-mochiweb-cowboy-nodejs-and-tornadoweb/

20:42 someone should do this to clojure/aleph

20:43 can't say the results shock me

20:47 just ran the test on my laptop, 90.2 conns a second

20:47 avg time 6.8 ms

20:47 5000 requests, 5000 replies, 55 seconds

20:47 pretty nice actually

20:47 got a few of these in the logs: java.lang.Exception: Cannot read from a drained channel.

20:55 TimMc: seancorfield: How do you feel about maintaining backwards compat with 1.2 (where trivial)?

20:55 I sometimes feel like being a bastard and not even testing with 1.2.

20:55 technomancy: there's not gonna be an excuse when lein2 rolls around

20:56 TimMc: Nice.

20:56 technomancy: https://gist.github.com/1846759

20:56 TimMc: Oh, you mean :profiles.

20:57 technomancy: yeah, that's dakrone's usage of multi-version testing in clj-http

20:57 I heart it so.

20:58 TimMc: Nice prompt, dakrone.

21:01 perezd: ugh, I have this exact problem: https://gist.github.com/1450202

21:01 anyone know whats up?

21:12 seancorfield: TimMc: all the libraries i work on work with Clojure 1.2 and 1.3

21:12 sometimes that's hard tho'...

21:21 perezd: i've been looking thru the lamina / potemkin source for a t that's not declared but i don't see it...

21:22 you might need to clone aleph and / or lamina and run lein install to put a snapshot into your local maven repo... :)

21:23 TimMc: It's probably something sneaky, like a string being destructured.

21:23 seancorfield: oh that won't help, aleph is squarely clojure 1.2 in that repo

21:24 TimMc: Try macro-expanding lamina/enqueue

21:25 seancorfield: you could try the clj-1.3 branch i guess

21:26 TimMc: &[#_ #_ #_ 1 2 3 4 5]

21:26 lazybot: ⇒ [4 5]

21:26 TimMc: #_ nests!

21:27 brehaut: i wonder how many third party readers implement that behavior correctly

21:27 TimMc: I think it is the natural interpretation.

21:28 brehaut: TimMc: i'm pretty sure my syntax highlighters reader would stumble on that

21:28 though in an actual reader it might not be a problem

21:29 (i need to preserve a lot more crap)

21:30 seancorfield: ok, if you clone ztellman/aleph, then git checkout clj-1.3, then lein install, then go back to your other project and do lein deps again, it should run

21:31 perezd: i just got it running with your hello world core.clj that way

21:31 so the JAR on clojars.org is just out of date

22:30 brehaut: bah django's templates make a hash of dynamic and lexical scoping

22:39 georgek: hi, I'm pretty new to Java, can anyone explain why this javadoc http://javasourcecode.org/html/open-source/commons-net/commons-net-3.0.1/org/apache/commons/net/telnet/package-summary.html has more classes listed than this javadoc, http://commons.apache.org/net/api-3.0.1/index.html

22:44 xeqi: georgek: the javasourcecode.org includes non-public classes and test classes

22:46 georgek: ahh, perfect, thanks

Logging service provided by n01se.net