#clojure logs

2012-02-16

00:13aphyrHaving 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?
00:13aphyrhttps://refheap.com/paste/765
00:22TimMctmciver: 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...)
00:24RaynesTimMc: Stop doing that.
00:24TimMc;.;
00:24TimMcLook, after midnight is the best time to write macros that implement IFn.
00:24RaynesWhat do you guys *do* at those meetings?
00:24TimMcAny other time of day I would stab myself in the eye with a fork.
00:25TimMcRaynes: Take hallucinogens and write macros? I dunno.
00:27tmciverTimMc: that code make *me* want to stab myself in the eye with a fork.
00:27aphyrI like the hardcoded 21 and 20.
00:27TimMcWhat are *you* still doing awake?
00:27TimMcaphyr: Check out clojure/lang/IFn.java
00:27tmciverThis is the best time to read macros.
00:28aphyrTimMc: ...............
00:28RaynesIt's in your best interest to not read Clojure's Java source.
00:28aphyrLet me guess, JIT?
00:28ScriptorI've done it, it's not too bad
00:29Scriptorjust...its indentation and style for braces
00:29TimMcaphyr: I really don't know.
00:29aphyrI like how scrolling through that file quickly gives a neat sort of spiral effect on the interface names
00:30TimMcaphyr: It's not fun debugging the macro output for this code...
00:30TimMchttps://refheap.com/paste/766
00:30RaynesI don't think that white is bright enough.
00:31RaynesIf the expansion isn't burned into my retina while I sleep tonight, it isn't bright enough.
00:31aphyrargh. I feel like everyone on the internet has *hit* this autodoc issue but nobody wrote down the answer...
00:32Raynesaphyr: There is no particular autodoc issues. It's just autodoc itself.
00:32Raynes:p
00:32RaynesI'm a fan of codox these days, myself.
00:32TimMctmciver: The IFn subinterface name-building was still wrong. >_<
00:32TimMcI finally wrote another test for it.
00:33aphyr"Could not initialize class" is... shockingly uninformative
00:33aphyrDo I have to AOT compile all my classes or something?
00:35TimMctmciver: Another problem... for nullary methods that return a long or double, we should actually have both an invoke and an invokePrim.
00:36tmciverTimMc: ha!
00:36TimMcI am basically going insane over here. <3 SCM, it enables this with low risk.
00:36tmciverI'm not going to try to decipher this tonight. That's some bad-ass kung-fu.
00:37TimMctmciver: It also doesn't work.
00:37TimMcSo.... there's that, too.
00:37tmciverthat's minor.
00:37tmciver;)
00:37tmciverPacking it in; see you tomorrow.
00:37TimMcIf I'm wearing an eyepatch, you'll know why. See you.
01:38mdhis 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?
01:46ibdknoxmdh: if it's different, why wouldn't you write two different macros?
01:47mdhbecause the parameters are common to both
01:47ibdknoxso?
01:47mdhthey represent data that i do not want duplicated
02:19mdhibdknox: thx, agree - dual macro definitions single point of use is the way.
02:37newsterHi 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?
02:53testing1234oktesting
02:54testing1234okI'm in an emacs repl right now entering these commands manually woot for sexpressions
02:56newster:-)
02:57raeknewster: 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))))
02:57newsterraek: ah, okay. I'll try that. Thank you.
02:58testing1234ok 2+2 == 4
02:58tylergilliesheh (write irc (str "privmsg #clojure : 2+2 == " (+ 2 2)))
02:59tylergilliesslime is a decent irc client
03:02tylergilliesso im sitting in bed and my wife says, and this is literal "you're bothering me, go on your computer and write some Lisp"
03:04newsterraek: thanks! that works very nicely.
03:04raeknp
03:06newstertg: she's a keeper that one. :-)
03:09tylergilliesi noticed that emacs doesn't display line numbers defaultly, do most people program with them off?
03:10raektylergillies: you mean in stacktraces?
03:10tylergilliesi mean in margin
03:10tylergilliesnext to code
03:10raekah
03:11raekI program with them off (the current line number is displayed at the bottom of the screen anyway)
03:11raekand you can jump to a certain line with M-g g
03:14tylergilliesraek: thnx
03:18Fossitylergillies: i have them on
03:19Fossibasically everybody's emacs config is hugely different ;)
03:19testing1234ok{:exit 0, :out " 3:23 up 3 days, 1:29, 3 users, load averages: 1.36 1.13 1.19\n", :err ""}
04:53hbahi, 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?
06:21webusnixcan i parse html in clojure ?
06:22vijaykiranwebusnix: enlive can "scrape" html - buth what do you want to do ?
06:23webusnix<vijaykiran> i want get all <p></p> values from web page
06:24vijaykirantake a look at https://github.com/swannodette/enlive-tutorial
06:24vijaykiranI think that has what you want to do - especially the scraping part
06:31raekweavejester: yes. (select (html-resource (URL. "http://...&quot;)) [:p])
06:32vijaykiranwebusnix: ^^
06:33raekeh, wrong nick... sorry!
06:54bOR_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.
06:54bOR_(println (take 10000 (remove #{\return} (map char (take-while #(not= % -1) (repeatedly #(.read (.getInputStream avendar))))))))
06:54bOR_this next one doesn't put in the spaces, but also doesn't continue printing out as telnet sends new input.
06:54bOR_(print (apply str (take 10000 (remove #{\return} (map char (take-while #(not= % -1) (repeatedly #(.read (.getInputStream avendar)))))))))
06:55bOR_not sure how I can get the behaviour of the first with the spacing of the second.
06:55bOR_(first time working with an incoming buffer :-)
06:56bOR_(goal is to be able to mud from within an emacs-swank repl ;-)
07:08bOR_hmm. might try with slurp
07:44pyrcd
08:12tylergilliesanyone know how to access (doc foo) in clojure-swank repl when namespace isn't user?
08:13vijaykirandid you (use 'clojure.repl) ?
08:16tylergilliesnope
08:16tylergilliesi used M-x clojure-jack-in
08:16tylergilliesthen C-c M-p
08:17raektylergillies: you need to use the clojure.repl from each namespace where you want to access doc
08:17vijaykiranI'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
08:18raektylergillies: ...or you use the C-c C-d C-d command in emacs
08:24tylergilliesraek: thanks
08:25tylergilliesoh cool c-c c-d c-d is handy
09:05dbushenkohi all!
09:06dbushenkoI'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
09:06dbushenkohow to fix that?
09:16mdeboarddbushenko: You might try #noir :)
09:16dbushenkook :-)
09:16mdeboard(Think it's pretty much all the same people though)
09:17cemerickLess of a chance for a question to be missed in noise, though.
09:22dbushenkohow do you guys deploy your webapps?
09:23bOR_not doing webapps. mainly using clojure for individual-based simulation models :-).
09:24dbushenkook, but may be anyone does
09:24dbushenko?
09:25mdeboardcemerick: Do you know of any Clojure projects focused on Mahout & Lucene together?
09:25cemerickmdeboard: sorry, no; I'm very behind on the Lucene world.
09:27cemerickdbushenko: 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.
09:27dbushenkoyes, but I can't get it running when I bundle it either in jar or war
09:29cemerickwell, webapps are never deployed as jars
09:30cemerickdbushenko: use lein-ring's war task if you want a war, and follow its documentation for setting that up
09:30cemerickor, use lein-beanstalk to deploy to elastic beanstalk
09:30dbushenkotrying to make a war, but it can't find my servlet...
09:37pcavsWhat'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?
09:41jcrossley3dbushenko: immutant is another deployment option, and doesn't require a war: http://immutant.org/news/2011/11/08/deploying-an-application/
09:53babilenHello. 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:52tdrgabi1haven't used clojure in a while. is clojars still the place to go for packages?
10:55TimMctdrgabi1: Yep.
10:57anieroi hear clojurescript is the new hotness
10:57anieroi'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:58TimMcbabilen: At a glance, partition-by is being more eager than you want/
11:05TimMc,(let [a (atom []), res (partition-by #(do (swap! a conj %) (zero? (mod % 5))) (iterate inc 0)), forced (doall (take 3 res))] [forced @a])
11:06clojurebot[((0) (1 2 3 4) (5)) [0 1 1 2 3 ...]]
11:06TimMcugh, clojurebot -- you are terrible
11:07TimMc&(let [a (atom []), res (partition-by #(do (swap! a conj %) (zero? (mod % 5))) (iterate inc 0)), forced (doall (take 3 res))] [forced @a])
11:07lazybot⇒ [((0) (1 2 3 4) (5)) [0 1 1 2 3 4 5 5 6]]
11:07TimMcbabilen: You need to use something that *knows* that each delimiter is only one token long. partition-by doesn't know that!
11:09dnlcttraniero: i haven't been able to get clojurescript one to do anything
11:09anieroha!
11:09dnlcttrit just hangs
11:10anieroit looks like clojurescript one uses the google closure library pretty heavily
11:11dnlcttrhave you tried it out yet?
11:11anierono, just looked at the code
11:12dnlcttrhmm. well, they have some bootstrap instructions, but as far as i can tell, they don't work
11:12dnlcttrhttps://github.com/brentonashworth/one/wiki/Getting-started
11:12dnlcttri've tested it on mac and linux both
11:13dnlcttrif you end up trying it, i'd be curious to know what you find
11:13clgvI tested clojure script one a few weeks ago and it worked pretty well.
11:13anierois it considered a good example of how to write clojurescript?
11:14clgvI dont know.
11:14dnlcttri 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:14clgvI was just curious to see a clojurescript example
11:14dnlcttrclgv: did you use the getting-started instructions at the link above? or something else?
11:14tdrgabi1if 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:15raektdrgabi1: the simplest way is to restart slime
11:15clgvdnlcttr: yeah
11:16raekrun clojure-jack-in again
11:16tdrgabi1raek: will try
11:16raekyou might need to kill the *Swank* buffer
11:17clgvwhat 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`fogusClojure-centric interview with William Byrd: http://clojure.com/blog/2012/02/16/take5-william-byrd.html
11:23TimMcclgv: 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:23TimMcHinting allows that to be done at compile time.
11:24TimMc(when it is ambiguous)
11:24clgvTimMc: I could keep a ref to that method to boost performance. type hinting is not possible
11:24TimMcMethods aren't objects.
11:25TimMcYou can have java.lang.Method objects, but Method/invoke might be expensive, not sure.
11:26ivanhow do I fix this? http://paste.lisp.org/display/127806 doseq causes: Can only recur from tail position
11:26clgvTimMc: yeah, that was what I was aiming at.
11:26babilenTimMc: 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:27TimMcbabilen: partition-by is trying to figure out when the segment where sentinal? returns true ends.
11:28TimMcActually, that's another bug in your code. (split [1 2] [1 2 1 2 1 2]) should return [[] [] [] []] but probably doesn't.
11:28babilenTimMc: Ah, ok. I'll investigate that too. Ta!
11:30TimMc,(.isVarArgs (.getMethod String "format" (into-array Class [String (class (to-array []))]))) ;; whoa, we *can* detect varargs methods!
11:30clojurebottrue
11:48clgvTimMc: keeping a ref to the method is a 2times speed up
11:48clgvTimMc: I wish they would have used a common interface
11:48TimMcwow
11:49TimMccommon interface?
11:50clgvTimMc: yeah the java management stuff has operating system dependent implementations and they forgot to add " getProcessCpuTime" to the interface of the bean
12:17maiowhen I have BufferedImage can I use spit to save it into file?
12:20hiredmanmaio: no
12:24TimMcmaio: spit is for writing strings
12:30TimMcmaio: BufferedImage is raw raster data; image files are binary compression formats.
12:30TimMcs/are/use/
12:32maiook thanks. I managed to use javax.imageio.ImageIO class to save it
12:35clj_newbhow do I, from clojure, inehrit from the Exception class? I want to throw exceptions that contain more than just a String
12:36TimMcclj_newb: Use the slingshot lib
12:36clj_newbIs there no other way?
12:36clj_newbI prefer to use things I understand
12:36clj_newbrather than pile library upon library
12:36TimMcYou don't like abstractions?
12:36clj_newbI don't like black magic.
12:36TimMcThere's not much magic behind slingshot.
12:38TimMcYou'll basically be reimplementing slingshot if you extend Exception to carry a payload, without the benefit of slingshot's existing features.
12:38clj_newbhmm, ExceptionInfo.java does the one part you can't do in clojure land?
12:38clj_newbthis library looks readble
12:38clj_newbI will use it.
12:39clj_newbTimMc: thanks for pointing it out
12:40TimMcYou may actually look into contributing to slingshot -- it's still a bit barebones in some ways.
12:40TimMc(Not sure who maintains it, though.)
12:42clj_newbin theory, can slingshot be implemented without a *.java file through the use of gen-class ?
12:44clj_newbis there a way to check if a java objects supports a .foo() ?
12:48TimMcclj_newb: Sure, use the java.lang.reflect API.
13:04anierotechnomancy: ohai!
13:26technomancyaniero: cljs is still pretty rough around the edges unfortunately =\
13:26technomancykind of a rough place to get started with clojure
13:33anierotechnomancy: 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:33technomancyaniero: clojurescript feels like clojure did when I started in 2008
13:33technomancythough admittedly I haven't gotten a chance to try lein-cljsbuild yet
13:34anierohmm, 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:34anierowhat 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:36anieroi'll see if i can find anyone doing data binding / event handling type stuff with swing. seems that should be analagous
13:45TimMcmmm, soup
13:46TimMcI don't mind it too much.
13:52Raynesaniero: I like callback soup. Especially with a little salt.
13:59TimMcnot sugar?
14:00yaziriansalting is more cryptographically secure
14:00amalloyRaynes likes his soup like he likes his IRC conversations: spicy
14:01yaziriansalted alphabet soup only spells words for the intended eater
14:02emezeskeDoes alphabet soup have parens? That's what I want in mine
14:03yazirianadd some elbow macaroni
14:03ibdknoxpuns - the lowest form of high humor :p
14:04emezeskeyazirian: :)
14:06technomancyso 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:06technomancyso... what am I missing?
14:06arohnertechnomancy: accidental variable capture is not an issue because of ~ and #
14:06arohnertechnomancy: i.e. you're not seeing the pain because rich already solved it
14:06jweiss 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:07technomancyarohner: that's what I thought
14:07technomancybut this Byrd interview makes it seem like Clojure needs hygenic macros, and people seem to be nodding and agreeing
14:07technomancymakes it seem like he thinks Clojure needs them, rather
14:08arohnertechnomancy: in scheme and CL, symbols in macros don't default to resolving to vars, so the problem is significantly worse
14:08arohnerlink?
14:08technomancyhttp://clojure.com/blog/2012/02/16/take5-william-byrd.html
14:08technomancyemezeske: happens all the time in elisp =(
14:08emezesketechnomancy: yuck!
14:09arohnertechnomancy: AFAIK, there's exactly one implementation of hygienic macros in scheme, and nobody understands it, they just keep copying it around
14:10technomancyone 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:10TimMctechnomancy: Haha, was that Alec?
14:11tmciverHa! I liked that guy! He was entertaining.
14:11technomancyTimMc: the akamai guy; i forget his name
14:11tmciverHe's they guy who wanted to fight anyone who didn't agree with him.
14:11TimMcFriend 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:12amalloyisn't rplevy at akamai? i don't think he ported syntax-rules, though
14:12jweissi'm glad other people don't understand syntax-rules either, makes me feel better
14:12TimMcamalloy: I don't think he's at Akamai any more? Maybe he is.
14:12tmciverNo, he's not.
14:13Raynes"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:13technomancywould have been less agonizing if I had grabbed dinner before the meeting
14:13redingerYou mean robert Levy?
14:13Raynestechnomancy: ^ KILL IT WITH FIRE
14:13TimMcLast time I saw Alex he tried to convince me to rewrite all my stuff in Racket.
14:13Raynesredinger: Howdy. Don't often see you around these parts.
14:13amalloytechnomancy: 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:13redingerRaynes: Oh, I'm always around... :)
14:13TimMcredinger: No, Robert isn't the one who gave the "talk".
14:14humasectCinC
14:14TimMcsyntax-rules is deep, intuitive magic.
14:14redingerNow I'm curious who gave the talk after that description
14:14TimMcredinger: Alec Heller
14:14redingerAh, okay
14:14TimMccurmudgeon extraordinaire
14:15technomancy"the zenspider of clojure"
14:15TimMc?
14:15TimMc$google zenspider
14:15lazybot[zenspider.com by ryan davis] http://www.rubyholic.com/
14:15amalloybabilen: 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:16Raynes"Will Clojure become as popular as Ruby or Python? Probably not."
14:16RaynesJesus. This interview is depressing.
14:16Raynestechnomancy: This interview. Depressing.
14:16RaynesI liked Friedman better. He was mostly quiet and had a nice hat. :|
14:17TimMcamalloy: I think it is doable. Maybe we have different ideas of what is desired?
14:17amalloyhe wants a lazy sequence of lazy partitions
14:18amalloyright?
14:18TimMcyep
14:18TimMcI think that can be done, with certain limitations.
14:19amalloyi 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:19TimMcHe can't.
14:19TimMcBut the latest partition can always be lazy.
14:20amalloyno. suppose you got a reference to the latest, lazy partition, okay, and traversed ten elements of it
14:20TimMcBig limitation, still a high utility.
14:20amalloynow you stop, and ask for the next partition
14:21TimMcYes, the latest becomes fully realized, and the next is lazy.
14:21amalloyhm, maybe it's possible. you finish forcing the previous partition at that point? that may work
14:21TimMcIn fact, I think he almost has it.
14:21amalloyhm. but there's a cost associated with that - you can't handle infinite sequences anymore
14:22TimMcWell, you're not gonna have a finite partition after n infinite partition.
14:22amalloybecause 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:22amalloyso what. it has to hold onto the head whether it's infinite or not, just in case it turns out to be finite
14:24TimMcamalloy: Did you see the implementation plan I gave babilen?
14:24amalloyi'm not sure. the conversation seems to be spread out over time and i probably missed it
14:24Raynesamalloy: Get your Ocarina.
14:26TimMcamalloy: 1) prefix? 2) a lazy-seq fn to replace subsequences with a sentinal object 3) a fn to lazily partition at sentinals
14:27TimMcThis makes sense in my head, although 3) is the fuzziest.
14:30amalloyi 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:31amalloybut i'm not so confident of that, i suppose. we'll see what babilen turns up with
14:31bartek1hello
14:32bartek1how easily get submap of map with specified keys?
14:32ibdknoxRaynes: I think it's a fair statement. I doubt Clojure will be of Ruby or Python level usage
14:32bartek1is there function?
14:32technomancybartek1: try select-keys
14:32Raynesibdknox: I didn't say it wasn't fair. I said it was depressing.
14:32ibdknoxtruth
14:32Raynesibdknox: Those statements are the kind of statements that make everyone wonder "Well, why am I even bothering then?"
14:32bartek1perfect, thank you :)
14:33technomancyRaynes: so you can have an unfair advantage
14:33RaynesIn the worst case, it could spark a bunch of mailing list threads quoting him and asking that question.
14:33ibdknoxI'm with technomancy on this one
14:33technomancyLet's all run off and implement viaweb. =)
14:33ibdknox:D
14:35jweissi'm in that spot now, competing against python (and winning) but have to convince people that i'm winning. not that easy, yet.
14:35jweisswhen the python project fails to catch up as they promised, then i'll have an easier time
14:52jweissi 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:52jweissforce them to be the same object. is that reliable?
14:54hiredmanjweiss: I generally lock the functions var
14:55jweisshiredman: 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:55raekjweiss: 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:55jweissraek: yep that's what i want. i'll look into that. thanks
14:57jweiss,(identical? (.intern "asdf") (.intern (apply str (reverse "fdsa"))))
14:57puredangergenerally locking on interned strings is considered bad form in Java (because you collide with anyone else that locks on the same obj)
14:57clojurebot#<Exception java.lang.Exception: SANBOX DENIED>
14:57jweissbah
14:58jweisspuredanger: what would you recommend instead?
14:58puredangerwhy not defonce an object to lock against?
14:59puredangeror create an explicit ReentrantLock instance and .lock/.unlock it
14:59jweisspuredanger: hadn't used defonce before, that looks like it would work
15:00jweissalthough i sort of have the same problem, i want threads with equal values of a certain string to use the same lock
15:02puredangerjweiss: so you're effectively lock-striping?
15:02jweisspuredanger: i'm not sure what that is :)
15:02jweissi want to lock an object that's really in a remote service
15:02puredangerjweiss: you could also leverage refs for this w/ensure I think and be more-clojure-y
15:02jweissjust by the name of it
15:03puredangerjweiss: so you really want a map with string keys and a lock object as val
15:03jweisspuredanger: that sounds right
15:03puredangerjweiss: but you have the issue of not wanting to race on creating the object
15:04puredangerjweiss: you could use ConcurrentHashMap.putIfAbsent for that
15:04jweisswow did not expect this to be so complex
15:05jweissaren't keywords always the same object?
15:05jweissthought of (locking (keyword myparent-obj) ... )
15:06puredangerjweiss: this is actually a common (and commonly done wrong) problem when using explicit locks :)
15:06puredangerkeywords are identical (based internally on string interning)
15:06jweissyeah, 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:09puredangerjweiss: 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:12jweisspuredanger: ok, thanks
15:23TimMcamalloy: I implemented (1) and (2) really quickly, but I'm actually kind of stuck on (3).
15:23TimMcamalloy: (1) and (2): https://refheap.com/paste/769
15:23amalloyah, you're giving me a perfect opportunity to use the wit i swallowed last time: that's because (3) is the impossible part
15:24TimMcgrrr
15:25TimMcI think it can be done with clever use of sentinals.
15:26TimMcsome kind of 2-phase lazy-seq
15:30RaynesTimMc: 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:30TimMcI don't remember, what username did I use?
15:30Raynestrack-browserid
15:31RaynesWell, your username is timmc.
15:31TimMcOh, yeah -- that's standard.
15:31RaynesI do that too though.
15:31TimMcI have a set of prefixes I use for signing up for commercial and other services.
15:31RaynesI use a random email on sites I'm not comfortable with.
15:32TimMcHaving 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:38wei_is there a take-while with state? for example, I want to take flip a coin until I see both heads and tails
15:39wei_(take-until-heads-and-tails '(1 1 0 1 1 1 1 1 1 0 0 1 0 1 0)) -> (1 1 0)
15:39Raynesamalloy: ^ Isn't there a 4clojure problem devoted to this
15:40TimMcwei_: You could do something with map vec s (drop 1 s)
15:40TimMcor something like that
15:40amalloyi think there is, yeah
15:40amalloy$google 4clojure global take-while
15:40lazybot[114. Global take-while - 4Clojure] http://www.4clojure.com/problem/114
15:40Raynesamalloy: Go steal a solution from the db and give it to wei.
15:40wei_haha
15:40wei_thanks :)
15:40tmciver(first (partition-by identity s))
15:41tmcivernope, that doesn't do it.
15:42RaynesYou get a little trophy for trying.
15:42tmciverThanks Raynes, that means a lot to me.
15:43TimMcwei_: Oh wait, you want context potentially all the way back to the head of the seq?
15:44wei_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:44tmciver(let [ [f s] (partition-by identity s)] (concat f s)) ;; ugly
15:55TimMcloop recur :-)
16:01TimMcamalloy: https://refheap.com/paste/769 seems to work, haven't checked laziness yet
16:04RaynesWhat the...
16:04Raynesrecur isn't detected as a builtin… Man, what was Georg even thinking when he wrote that lexer.
16:12TimMcamalloy: Just checked, it is lazy in the latest partition (eager by one element.)
16:22technomancyanyone want a Leiningen sticker?
16:23redingertechnomancy: Is there a catch to get it? :)
16:24technomancyyou have to have a patch submission accepted
16:24technomancybut I have a really easy one
16:26beffbernardQuick question.. defn.. overloading.. how do you call yourself?
16:26redingerI knew it! If I had the time today I would
16:28raekbeffbernard: (defn f ([] (f 1)) ([x] ...))
16:28tmciverbeffbernard: you can provide multiple implementations of a function of differing arities. You can call out to a different implementation from one of those.
16:29beffbernardokie dokie
16:29beffbernardthanks
16:30tmciverbeffbernard: http://clojure.org/special_forms#Special%20Forms--%28fn%20name?%20%28[params*%20]%20exprs*%29+%29
16:38TimMcbeffbernard: You can recur to the same arity, or recurse to a different one.
16:47pcavsWhat'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:48hiredmanpcavs: only if you load/run the code multiple times
16:50pcavshiredman: ahh, but what if this is a web service?
16:50hiredmanwhat about it?
16:50pcavsLike what's the proper way to do this in a noir app, or ring app, or w/e.
16:51hiredmanoh, well don't use the code reloading features noir comes with
16:51weavejesterOr perhaps use defonce
16:51hiredman(which should only be for developement anyway)
16:51hiredmanring won't reload code by itsself
16:52ibdknoxpcavs: if you're in dev mode changes will cause it to reload. Simple solution is to defonce
16:53ibdknoxhiredman: it's only in dev mode :)
16:53hiredmanibdknox: sure
16:53pcavsokay cool, in clojure do all top level definitions in a namespace get loaded/executed whenever that namespace is loaded?
16:54pcavs(I would assume so, but just getting my noob questions out of the way now)
16:54weavejesterAs far as I'm aware
16:54weavejesterdefonce is there to get around the issue of reloading
16:54weavejesterUsually used to atoms or refs
17:00zxcxzc1im 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:00zxcxzc1how i get the line number of the error?
17:00brehautdont use load-file?
17:01Somelauwbrehaut: nope
17:02hiredmanactually load-file should give you a file name
17:02zxcxzc1so i have to set up a namespace first and then use use?
17:02hiredmanzxcxzc1: are you sure the exception is originating from code loaded via load-file?
17:03hiredmanthe class names in the stacktrace are also useful
17:03zxcxzc1im calling a function i loaded via load-file
17:03zxcxzc1"ClassCastException java.lang.Long cannot be cast to clojure.lang.IFn user/eval53"
17:04hiredmanthe function are trying to call is actually a number
17:04hiredmanjust type in the name of the "function" without calling it
17:05hiredmanthe exception is coming from code you typed at the repl
17:06zxcxzc1i 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:06hiredman(1 2 3)
17:06hiredman,(1 2 3)
17:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
17:06zxcxzc1i 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:07zxcxzc1oh man
17:07zxcxzc1thanks...
17:15TimMcbabilen: https://refheap.com/paste/769 (the last bit needs cleanup, though)
17:18amalloyTimMc: fwiw, stylistically i hate seeing (let [splitter (fn splitter ...)] (splitter ...)). it just seems simpler to write ((fn splitter ...) ...)
17:19amalloybut i see it done all the time, so i guess i'm in the vocal minority
17:19TimMcYou're just bitter.
17:20TimMcActually, it's a big enough fn that I don't want to do that.
17:20TimMchas it's own docs and everything
17:20TimMc*its, dammit
17:20hiredmanamalloy: letfn!!!
17:22mrevilis for lazy?
17:22TimMcyup
17:22mrevilTY
17:23TimMcbabilen: Oops, might not work perfectly yet...
17:24amalloyerr...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:24TimMcmrevil: Check it for yourself: ##((constantly :no-op) (for [x (range)] x))
17:24lazybot⇒ :no-op
17:25hiredmanamalloy: my point is a) letfn is great b) and thats it
17:25amalloyhaha okay
17:26TimMchiredman is loony for letfn
17:26hiredmanI strongly prefer letfn to leting fns
17:26tmciverTimMc: how does your example prove that for is lazy? Isn't that just a demonstration of constantly?
17:27technomancyhiredman: I have a harder time scanning them
17:27hiredmantechnomancy: ok
17:27technomancymy eyes are immediately drawn to (defn, (fn, and #(), but letfn doesn't have a visual HAY GUISE FUNCTION HERE marker
17:27hiredmantechnomancy: hardly objective
17:27technomancyI like letfn in principle though
17:28hiredmanletfn communicates intent
17:28technomancyI think as long as the function bodies aren't long it helps
17:28hiredmanand if theory would make it easier for the compile to optimize easier then the general let case (but it doesn't)
17:28technomancywhen you have a (my-thingy opening ten lines away from the top of the (letfn form it's worse
17:29hiredman:)
17:29technomancyfreaking theory, amirite?
17:29tmciverTimMc: nvm, I think I see.
17:30BorkdudeI 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:30emezeskehiredman: I did not know about letfn. I like that way better than let ... (fn [] ...
17:30hiredmanI 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:30Borkdudethe 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:30technomancyok, actually my complaint is that in nearly everywhere else in clojure, seeing (x ...) means that x is being called.
17:31technomancyI don't feel comfortable breaking that rule
17:31hiredman(defn … ([] ...))
17:31amalloy(defn + ([x] x) ...)
17:31hiredmanetc
17:31technomancythat's not a symbol in the first position though
17:32Borkdudeam I missing something?
17:32amalloyso? ((juxt inc dec) 1) doesn't have a symbol in the first position and it is a call
17:32hiredmannot having a symbol in the first position is kind of the point of lisp-1
17:32technomancyamalloy: (( functions as a very clear indicator that something higher-order is going on
17:33technomancyhiredman: the point is you don't have to have a symbol in the first position to be a call, which is different
17:33amalloythere's also the fairly-gross-imo requirement to use ( on symbols in ns. stuff like (ns foo (:import (javax.swing JFrame JPanel)))
17:34technomancythe whole ns macro is gross though
17:34technomancyit doesn't interfere with scanning issues because it's always in the same place
17:35Borkdudecemerick: do you have a clue what I'm doing wrong?
17:38uvtcHi #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:38amalloyi think that's about right, uvtc
17:39uvtc(aside from clojure.core, which is available without needing to be `require`d)
17:39uvtcamalloy, Thanks.
17:39RaynesTimMc: 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:39uvtcIs there a way from the repl to get a listing of those namespaces?
17:40hiredmanuvtc: you can get a list of loaded namespaces
17:41newb_clHi
17:41uvtchiredman: that would be useful too. How would one do that?
17:41hiredmanit's pretty intuitive
17:42hiredmantry and see if you can figure it out
17:43newb_clif 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:43uvtchiredman, `(loaded-libs)`
17:43hiredmannope
17:44uvtchiredman, My autocomplete suggests `loaded-namespaces`, but that fails for me.
17:45uvtchiredman, (my repl autocomplete)
17:45newb_clit says CCE string to ifn
17:46bsteuberis there any changelog for clojurescript?
17:47uvtchiredman, nevermind --- I think the autocomplete learned that other prospective fn name from a past attempt at trying it.
17:49dnolenbsteuber: no, but there probably should be
17:55ibdknoxdnolen: +1 for a change log
17:56TimMcRaynes: Come at me bro.
17:56ibdknoxlol
17:56ibdknoxthe more invasive the signup process the better
17:57TimMcI've decided to back up all my data to refheap pastes.
17:59amalloygood news, TimMc, all your data is already associated with your refheap login
18:01uvtcI 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:02uvtcI get: "ClassNotFoundException clojure.string java.net.URLClassLoader$1.run (URLClassLoader.java:217)"
18:02uvtcIs there a way to view that docstring from within the repl?
18:05TimMcWelp, I've achieved a 10-20x speedup in the query time for this demo. Time to go home!
18:08uvtcI suppose it's just easiest to look at the source.
18:18uvtcIs 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:18uvtcs/namespaces/namespace names/
18:19RaynesYes.
18:19uvtcRaynes, Great. Thanks.
18:21TimMcuvtc: Yes, and then they are referred to casually without that prefix.
18:21TimMcamalloy: Admit that it wasn't impossible!
18:22uvtcTimMc: Ah, thanks.
18:22amalloyTimMc: you still haven't *really* done it because at most one sub-partition can be lazy at a time
18:22TimMcpfff
18:23TimMcI agree on *that*.
18:23amalloyfeel free to address hatemail to /dev/null
18:23TimMcamalloy@example.org
18:26uvtcHm. 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:26hiredmanit's a mavenism
18:26hiredmancontrib and clojure are built with maven
18:26hiredmanjust about everything else uses lein
18:27TimMcuvtc: clojure.core isn't very idiomatic of clojure projects. :-)
18:27TimMcsame with most of contrib
18:27uvtchiredman: Ah, thanks.
18:28uvtcTimMc: ha. :)
18:31ferdI 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:31technomancyferd: the contrib ones are deprecated
18:31ibdknoxferd: clojure.java.shell
18:31Raynesferd: clojure.java.shell is the good one.
18:31Raynesferd: If it doesn't do everything you need, check out https://github.com/Raynes/conch
18:31ferdthanks! Hey Raynes, I saw your conch too
18:31ferdyes
18:32ferdI like it's power... but it lacks simpler syntax for when all I need is to get a String (or lines seq)
18:32ferdthanks!
18:32RaynesRight, 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:32RaynesI wrote conch for the sole purpose of streaming output and input.
18:33RaynesI definitely support the use of clojure.java.shell if your needs are within its limitations.
18:33Raynes(And they usually are)
18:33ferdyep, that was my understanding
18:34ferdFYI: there's an example in http://clojure.org/libs that uses contrib.shell-out... would be nice to change it
18:34technomancywe should get a lazybot trigger to warn people about how clojure.org is always outdated. =(
18:34ferda detail... but one of the top google search for "clojure shell out" landed me there
18:34Raynestechnomancy: Hahaha, indeed.
18:35technomancysad but true
18:51brehautferd: google sends you to what is popularly linked, not what is true
18:53ferdbrehaut: ??? I know... but how can you tell that the example on clojure.org is not "true" ?
18:53RaynesYou can ask us.
18:53Raynes:p
18:54brehautclojure.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:56AimHere,(clojure.java.shell/sh "pwd")
18:56clojurebot#<ExecutionException java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.java.shell>
18:58RaynesThat wouldn't work anyways.
18:59technomancybrehaut: nice
18:59technomancystep 1: travel in time back to 2009. step 2: documentation is correct.
18:59ibdknoxlol
18:59AimHereI'm not convinced the clojure documentation is even mutable
18:59Raynes&(range 1000)
18:59lazybot⇒ (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:00brehautAimHere: it doesnt need to be; clojure.org just needs to be a reference
19:04wei_i want to get 5 different random sequences. but this gives me 5 identical random sequences
19:04wei_(repeat 5
19:04wei_ (let [flips (repeatedly #(rand-int 2))]
19:04wei_ (take 5 flips)))
19:04wei_what gives?
19:06emezeskewei_: I think you might want 'repeatedly instead of 'repeat
19:14wei_awesome! thanks.
19:26TimMcbrehaut: They forgot to declare the clojure.org var :dynamic.
19:27brehautlol
19:28technomancyoh snap!
19:35jweissi 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:36jweiss223 of those files are in .git :)
19:37technomancyjweiss: try :local-repo-classpath true
19:37ibdknoxtechnomancy: I wonder if that's what's causing my thing too
19:38jweisstechnomancy: but there's only like 45 files in lib/
19:38ibdknoxwhat does :local-repo-classpath do?
19:38ibdknoxjweiss: are you on a mac?
19:38jweissibdknox: no, linux
19:38ibdknoxhm
19:38jweissand my other projects don't take a long time
19:39jweissjust this one
19:39jweisswonder if it's because i'm using checkouts?
19:39ibdknoxdoes it chew through your CPU?
19:39jweissi can try unlinking
19:39jweissibdknox: no, seems to be io bound
19:39ibdknoxk
19:39ibdknoxdifferent then :)
19:39jweisswell, not even that, it's just pretty much idle
19:40jweissif i immediately rerun, it runs fast
19:41jweisshttp://fpaste.org/3nJb/ <- thread dump of main
19:41jweissseems to be gc'ing
19:43jweisshm, there is an explicit call to gc.
19:43jweissthat don't seem right. esp since it's to help windows users :)
19:43perezdso, I am sure that this question gets asked constantly, how does one deploy a leinigen-based clojure project as a server-side ?
19:43hiredmanthat is weird
19:43perezdI wanted to use heroku, but they don't support persistent TCP
19:43perezddo I need an app server?
19:43perezdTomcat? something
19:43dgrnbrgWhat is IHashEq used for in Clojure?
19:43perezdreally uninformed person here
19:43dgrnbrgIs it used instead of hashCode()?
19:44ibdknoxperezd: what are you currently using?
19:44perezdibdknox: starting my first project
19:44perezdi have nothing yet
19:44perezdjust leinigen project
19:44perezdand 1 failing test :)
19:44hiredmanperezd: depends, I just use jetty-runner for little http apps
19:44ibdknoxperezd: what kind of app are you trying to create?
19:44perezdbasically a websocket server
19:44perezdusing aleph
19:45ibdknoxperezd: then you have everything you need :)
19:45ibdknoxaleph runs a server (netty)
19:45perezdright, but I mean…how do I do this.
19:45perezdhow do I deploy
19:45perezdI can't assume I just run lein run on a server
19:45perezdthat sounds bad
19:45perezddo I make a war file?
19:45perezdlol
19:45perezdI don't know
19:45perezdI've never deployed JVM
19:46perezdlearning!
19:46ibdknoxperezd: lein run will work just fine
19:46perezdis that really a good idea?
19:46ibdknoxlein trampoline run might be better
19:46ibdknoxwhy not?
19:46perezdwell for one, the tutorial advised against it
19:46technomancyyeah, if you use "lein trampoline run" and set LEIN_NO_DEV then the overhead of leiningen is basically just at process boot time
19:46technomancyoh crap, does it?
19:46ibdknoxtechnomancy: :p
19:46technomancyperezd: that's probably from before lein trampoline was implemented
19:46perezd"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:47perezdwhat does trampoline do?
19:47technomancyit causes there to be only a single JVM resident
19:47ibdknoxperezd: 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:47perezdthats sounds important
19:47perezdokay good then :)
19:47perezdjust making sure
19:47perezdI know things like Tomcat exist
19:48emezesketechnomancy: Am I correct in believing that trampoline is going away in lein 2?
19:48perezdso I figured I should make sure I don't need that
19:48technomancyperezd: 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:48technomancyemezeske: no, that's not true
19:48technomancyemezeske: originally I wasn't sure if it would make it into the preview release
19:48perezdokay, so lein run is okay if you've got a plan for freezing deps
19:48emezesketechnomancy: Ah, okay, maybe that's what I was thinking
19:48technomancybut then while looking into how much work it would be I realized it was easy
19:48amalloynobody could ever throw away a trampoline. they're so fun
19:48emezesketechnomancy: I'm working on some REPL stuff for lein-cljsbuild, which currently has to be trampolined
19:49emezesketechnomancy: Will it still need that in lein 2?
19:49technomancyemezeske: depends why you need the trampoline =)
19:49technomancyis it for access to *in*?
19:49emezesketechnomancy: Yeah
19:49perezdone does not simply throw away a trampoline
19:49technomancyemezeske: might be able to make it work with an in-process subclassloader
19:49emezesketechnomancy: Hmm, even in lein 1.x?
19:49technomancyemezeske: no, in 2
19:50hiredmanor build an uberjar on a ci server and just run it
19:50emezesketechnomancy: One thing i was thinking: could there be some way for a plugin to say "always run this action in a trampoline"?
19:50technomancyhiredman: yup, also perfectly reasonable
19:50perezdokay, let me ask this:
19:50technomancyemezeske: yeah! you can do that in lein2
19:50technomancyit's the best
19:50perezdare there any obvious DON'Ts I should watch out for
19:50technomancyyou can partially apply aliases
19:50hiredmandon't deploy from git
19:50technomancydon't check jar files into git
19:51emezesketechnomancy: That's great. I just *know* people (including me) will just type "lein cljsbuild repl..." instead of "lein trampoline cljsbuild repl..."
19:51technomancyperezd: the leiningen wiki has a page on "Repeatability"; definitely worth a read IMHO
19:51TimMc~repeatability
19:51clojurebotrepeatability is crucial for builds, see https://github.com/technomancy/leiningen/wiki/Repeatability
19:51TimMcBAM
19:51technomancyaha; thanks =)
19:51TimMctechnomancy: ^ you should bookmark that or something ;-)
19:51perezdexcellent, i am gonna go through that
19:51perezdso another question
19:51perezdhttps://github.com/clojure-clutch/clutch
19:51perezdis this seen as the defacto CouchDB?
19:52perezdlibrary
19:54brehautperezd: yes, its very good
19:54perezdokay cool. I'm hoping to interact with couchdb, my fav db
19:54brehaut(and the view server is optional)
19:54perezdyeah, I figured
19:54perezdits a neat idea tho
19:54perezdjavascript/spidermonkey is fast enough if you throw parallelism into the mix :)
19:55brehauta neater idea: http://cemerick.com/2011/10/11/writing-couchdb-views-using-clojurescript/
19:55brehautclutch's view server isnt really about speed; its more about expressiveness
19:55perezdunfortunately, I care about speed there more :)
19:55perezdcemerick appears to be the guy I should stalk for clojure+couchdb
20:00jweissfinally found and bound slime-repl-previous-matching-input. feel like i just stopped hitting myself in the head with a hammer.
20:01perezdany recommended tutorials for swank/slime ?
20:01jweissperezd: have you checked out the github swank-clojure page?
20:01perezdnot yet
20:02perezdjust getting started
20:02brehautperezd: http://dev.clojure.org/display/doc/Getting+Started+with+Emacs
20:02jweisshelpful for getting it running, has some keyboard shortcuts listed there
20:02perezdnice
20:02perezdexcellent, thank you
20:02technomancydon't trust anything but the readme for swank
20:02technomancyso much bad info out there
20:03perezdok
20:03perezdgood to know
20:03technomancyclojurebot: swank?
20:03clojurebotswank is try the readme. seriously.
20:03technomancyclojurebot: forget swank |is| try the readme. seriously.
20:03clojurebotI forgot that swank is try the readme. seriously.
20:03technomancyclojurebot: swank is trust the readme and the readme only. all others will lead you astray.
20:03clojurebotIk begrijp
20:04brehautim pretty sure the getting started with textmate page is wrong. it should be filled with mean spirited laughter
20:04technomancyyeah, does confluence support html5 yet?
20:05brehauttechnomancy: http://i.imgur.com/2Kq6Y.jpg
20:06technomancynice!
20:06brehautvia @romanandreg
20:07chemphow can clojure read my .class files in the current directory? it's not working by default
20:08chempanyone?
20:08clojurebot#<ClassCastException java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.IPersistentStack>
20:09technomancychemp: that's possible but extremely awkward, you should get your dependencies from maven repositories
20:10hiredmantechnomancy: well, come on, it's not that hard
20:10chemptechnomancy, 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:10hiredmanactually, at all hard really
20:10technomancyyeah, but I don't feel like explaining it =\
20:10chempas easily as possible
20:11technomancychemp: the normal approach is to use the lein javac task to compile your .java source into the classes/ dir
20:11hiredmanchemp: a. figure out how to load your classes in java b. clojure is largely the same
20:12chemphiredman, well, I know how to import classes
20:12hiredmanimporting is not what I meant
20:12chemphiredman, do i just put my .class files in a dir classes/ ?
20:12hiredmananywhere on the classpath
20:16chemphiredman, why doesn't clojure look for classes in my current directory, isn't that in the classpath?
20:16hiredmandid you put it on the classpath?
20:17chempisn't it there by default?
20:17brehautno
20:17chempthen how does java find files?
20:17hiredmanthere is no default classpath
20:17chempok
20:18chempso do i just do a CLASSPATH=. ; export CLASSPATH ?
20:18hiredman-cp
20:18hiredmananyway, google it, the internet has lots of people explaining the classpath
20:20perezdso, 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:27technomancyperezd: yeah, I think so
20:27perezdk cool
20:28perezdso emacs is pretty cool
20:28technomancyit's true
20:28brehautemacs may be cool, but nothing about it is pretty
20:29perezdusing prelude with it makes it kinda pretty
20:29perezdhttps://github.com/bbatsov/emacs-prelude
20:29technomancybrehaut: I don't know what you're talking about; inconsolata is great.
20:29TcepsAFKI've found that color-theme helps ^_^
20:29brehauttechnomancy: the complete lack of negative space for frames annoys me greatly
20:29brehautframes? windows?
20:30brehauti think i mean windows
20:30perezdso just got this after a lien run: https://gist.github.com/d117399de5f8bef560f4
20:30perezdthis looks bad
20:30technomancybrehaut: do you have the fringe turned off?
20:30brehauttechnomancy: at the moment i have whatever the defaults are for e24 and the starter kit
20:30brehauttechnomancy: theres a small 1 character wide verticle gutter on either side of each window
20:32brehauttechnomancy: experiementation indicates that i have the fringes on
20:32technomancymine's like 5px
20:32technomancynot really a complete lack of negative space
20:32perezdany ideas on my gist exception?
20:33brehauttechnomancy: well, mine gets full of line wrapping sigels (thanks again, django templates)
20:33brehauttechnomancy: about 10px here
20:34seancorfieldperezd: you're using old contrib with clojure 1.3
20:34seancorfieldwhat's in your project.clj? (gist?)
20:34perezdseancorfield:
20:34perezdhttps://gist.github.com/a8f0d54a18ae1cd4cbea
20:35seancorfieldhmm, aleph 0.2.0 isn't compatible with clojure 1.3...?
20:35perezdhmm appears to not be...
20:35perezdupon inspection of its project.clj
20:36xeqiperezd: https://github.com/ztellman/aleph/issues/34
20:36xeqitheres a bug report with the same error
20:36perezdnice
20:36xeqibut it links to a closed 1.3 compat issue
20:36xeqiso I would have thought it fixed
20:36perezdthere is a branch for 1.3
20:36perezdapparently
20:36seancorfieldchange the aleph version to 0.2.1-alpha2-SNAPSHOT and run lein deps
20:37perezdokay, I'll give that a go
20:38seancorfieldthat seems to bring in tools.logging and data.json which are new contrib
20:39perezdexcellent, thanks!
20:39perezdI'll report back if it messes up
20:39perezdso far so good
20:39seancorfieldi'm on a crusade to get everyone using 1.3 instead of 1.2 :)
20:40perezdi want to subscribe to your newsletter
20:40seancorfieldlol
20:40perezdyay aleph works!
20:40perezdjust got my ZOMG world
20:42perezdhttp://www.ostinelli.net/a-comparison-between-misultin-mochiweb-cowboy-nodejs-and-tornadoweb/
20:42perezdsomeone should do this to clojure/aleph
20:43perezdcan't say the results shock me
20:47perezdjust ran the test on my laptop, 90.2 conns a second
20:47perezdavg time 6.8 ms
20:47perezd5000 requests, 5000 replies, 55 seconds
20:47perezdpretty nice actually
20:47perezdgot a few of these in the logs: java.lang.Exception: Cannot read from a drained channel.
20:55TimMcseancorfield: How do you feel about maintaining backwards compat with 1.2 (where trivial)?
20:55TimMcI sometimes feel like being a bastard and not even testing with 1.2.
20:55technomancythere's not gonna be an excuse when lein2 rolls around
20:56TimMcNice.
20:56technomancyhttps://gist.github.com/1846759
20:56TimMcOh, you mean :profiles.
20:57technomancyyeah, that's dakrone's usage of multi-version testing in clj-http
20:57technomancyI heart it so.
20:58TimMcNice prompt, dakrone.
21:01perezdugh, I have this exact problem: https://gist.github.com/1450202
21:01perezdanyone know whats up?
21:12seancorfieldTimMc: all the libraries i work on work with Clojure 1.2 and 1.3
21:12seancorfieldsometimes that's hard tho'...
21:21seancorfieldperezd: i've been looking thru the lamina / potemkin source for a t that's not declared but i don't see it...
21:22seancorfieldyou might need to clone aleph and / or lamina and run lein install to put a snapshot into your local maven repo... :)
21:23TimMcIt's probably something sneaky, like a string being destructured.
21:23seancorfieldoh that won't help, aleph is squarely clojure 1.2 in that repo
21:24TimMcTry macro-expanding lamina/enqueue
21:25seancorfieldyou could try the clj-1.3 branch i guess
21:26TimMc&[#_ #_ #_ 1 2 3 4 5]
21:26lazybot⇒ [4 5]
21:26TimMc#_ nests!
21:27brehauti wonder how many third party readers implement that behavior correctly
21:27TimMcI think it is the natural interpretation.
21:28brehautTimMc: i'm pretty sure my syntax highlighters reader would stumble on that
21:28brehautthough in an actual reader it might not be a problem
21:29brehaut(i need to preserve a lot more crap)
21:30seancorfieldok, 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:31seancorfieldperezd: i just got it running with your hello world core.clj that way
21:31seancorfieldso the JAR on clojars.org is just out of date
22:30brehautbah django's templates make a hash of dynamic and lexical scoping
22:39georgekhi, 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:44xeqigeorgek: the javasourcecode.org includes non-public classes and test classes
22:46georgekahh, perfect, thanks