#clojure logs

2010-07-09

00:06ysph(car '())
00:06ysphsorry guys
00:58fuchsdWhat's the idiomatic way to run a function with side effects on every element in a list? Is it to use a sequence comprehension and then doseq it?
01:00fuchsderr, mapping the side effect function on the sequence and then doseq'ing it?
01:00fuchsd(using map)
01:11ysphfuchsd: does for do what you want?
01:11fuchsdI think I'm overthinking it; map seems to do it
01:11fuchsdLet's just say I want to print every item in a list,
01:12fuchsdI'd do it like this:
01:12cemerickfuchsd: doseq
01:12fuchsd,(dorun (map println '("one" "two" "three")))
01:13ysphcemerick's suggestion is the proper one
01:13fuchsdOk, cool; thanks!
01:14ysphas in (doseq [x '("one" "two" "three")] (println x))
01:14fuchsdPerfect, that's what I'm looking for
01:15fuchsdThanks
01:22ysphfuchsd: btw, you might want to read about the bindings and filterings provided by for ((doc for)), they are the same in doseq
01:24fuchsdOh, cool
01:29fuchsdi
01:44LicenserMorning my lispy friends
01:49hiredmanping?
01:50hiredmanping?
01:50clojurebotPONG!
01:51LicenserPong
01:51LicenserGreetings hiredman
02:43vibrantmorning
02:43LicenserMorning vibrant
02:58harblcathi all, I have a question
02:59harblcatI've got a lot of calls I'm making to a java class, and I can't do anything better than (do (Toolkit/init) (Toolkit/setup ...) ...)
02:59harblcatit there a better way?
03:00harblcatI tried using doto, but I can't access the static methods of the class, I guess.
03:07Chousukeharblcat: for static calls, not really.
03:08harblcataww..
03:09LicenserIt Looks like a uglyish toolkit so, perhaps there is an alternAtive?
03:09Chousukeyou could always write your own macro for repeated static calls
03:11harblcatjcurses is what I am using, but there are a couple of other tools with the same thing going on...
03:12harblcatis there a way to at least shorten 'Toolkit' to 'T' or something? (def T Toolkit)?
03:12LicenserWrite a wrapper for the rest of us? :)
03:12harblcatI'm not that good yet ;)
03:13Chousukeharblcat: hm, not that I know
03:13ChousukeI don't think alias works on classes either
03:13Chousukebut you could try I guess.
03:18LicenserI always feel pain when I see a system with 16 CPUs and it isn't mine :(
03:25LauJensenGood morning all
03:28LicenserMorning laujensen
03:54cais2002looks like most ppl are from europe
03:54cais2002anyone else in a timezone that's already late afternoon now?
03:54mikemcais2002: yep
03:55cais2002hehe, yeah i know
03:56LicenserCais2002 many people from he us don't show up until later
04:04LauJensencais2002: I am in Europe, but I think we're promoting the UGT time standard nowadays
04:07cais2002laujensen: now i got it..
04:07LicenserUgt?
04:07clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
04:07esjGood Mood Folkses
04:08LicenserWownice
04:09LicenserMorning esj
04:10LauJensenGood morning esj
04:10LauJensen,ugt
04:10clojurebotjava.lang.Exception: Unable to resolve symbol: ugt in this context
04:10LauJensenclojurebot: ugt
04:10clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
04:10LauJensenclojurebot is knowledgable
04:11LicenserJap and it even explains things when you jvust add a ?
04:13LicenserCookies?
04:14Licenserclojurebot: Cookies
04:14clojurebotPardon?
04:14Licenser:(
04:14LicenserHe does not know cookies, what a sad way to live
04:18LauJensenugT?
04:18clojurebotugt is Universal Greeting Time: http://www.total-knowledge.com/~ilya/mips/ugt.html
04:18LauJensencool
04:19LicenserYap
04:20LicenserSo I wonder how to explain him stuff
04:23cais2002?cookies
04:23cais2002cookie?
04:23LauJensenclojurebot: Licenser is the man who puts licenses on everything
04:23clojurebotRoger.
04:23LauJensenLicenser?
04:24clojurebotLicenser is the man who puts licenses on everything
04:24cais2002guys, is there a way to inspect all possible methods/fields of a given var/object?
04:25LauJensencais2002: C-c I
04:25Licenserclojurebot: Cookies *nom* *nom* *nom*
04:25clojurebotTitim gan éirí ort.
04:26LicenserCookies?
04:26cais2002Laujensen: is that some emacs syntax?
04:26cais2002how do I do it in repl?
04:26LauJensencais2002: Yes, of course
04:26LauJensenIn the repl, just hold Ctrl and hit c, let go, hit shift+i
04:26LauJensenC-c I
04:26LauJensenThen you'll be prompted for an object of a class to inspect. Try "String" for instance
04:26LauJensenAnd you'll see all fields and methods
04:27LauJensenOnly works in SLIME
04:27LauJensenFor all other IDEs, go find your webbrowser, wait for it to start. Navigate to the adress bar, type in "google.com", then navigate to the search field, type "string javadoc", click search and wait for the result. Once you have some results, there should be a link to sun/oracle docs. There you can see the same thing
04:28bozhidar;-)
04:29LicenserOh come on clojure. Jt don't be boring
04:30bozhidarbtw anyone having problems with the SLIME REPL + paredit?
04:30bozhidarfor some reason
04:30bozhidarit's the only mode in which paredit
04:30LauJensenhaha
04:30LauJensenbozhidar: I refer you to my latest tweet
04:30bozhidardoesn't work normally
04:31bozhidar@LauJensen?
04:31LauJensenThats right
04:32bozhidarhehe
04:32bozhidarI'm actually rather fond of paredit :-)
04:32bozhidarexcept for the [] pairing and skipping
04:33LauJensenYea a few people were defending it last night as well
04:33bozhidarthat works somewhat strange
04:33bozhidarcompared to parenthesis
04:33bozhidaryou can also switch to autopair
04:33bozhidarit's a lot less intrusive
04:33bozhidarbut it's more general purpose
04:34bozhidardoesn't have anything lisp related in it
04:34LauJensenIm fine just using Emacs
04:34bozhidarlike navigating sexps
04:36esjI like that it understands sexps and I can navigate them, rather than chars or lines, i think thats smart.
04:36dissipatehello
04:37dissipateanyone here use enclojure in netbeans?
04:38LauJensendissipate: I've heard of 2 guys, but they're both Americans
04:39dissipateLauJensen, so consensus is enclojure is bad?
04:39zmilai used enclojure - but during some hours only :)
04:39LauJensendissipate: No I think its the most featureful of all the inefficient IDEs available
04:39LauJensenThe guys working on it do good work
04:40LauJensendissipate: but did you read this? http://bestinclass.dk/index.clj/2010/07/trail-blazing-innovators.html
04:40dissipatewell supposedly i can't even compile because it is running out of memory. lol
04:40LauJensenhehe
04:42noidiis there something like mapcat buf for "for" (i.e. forcat)?
04:42noidiI seem to keep doing a lot of (apply concat (for ...))
04:43dissipateso emacs is the mac daddy?
04:43noidimost of them (apply hash-map (apply concat (for ...))), where I build [key value] pairs in the for
04:44Chousukenoidi: you could just do (into {} (for ...))
04:45Chousukeit'll be a fair bit faster too
04:45noidiChousuke, great, thanks!
04:45dissipateLauJensen, i'm a noob to clojure and emacs. what's the best way to get started?
04:46LauJensendissipate: http://bestinclass.dk/index.clj/2009/12/clojure-101-getting-clojure-slime-installed.html
04:47LauJensenAs you can see thats from last december so it might be outdated. You need to get clojure-mode and swank-clojure installed. When installing them like I do in that screencast, you also get slime and slime-repl from ELPA
04:47LauJensenThen when you download a new project (or make one), add lein-swank as a dependency, run 'lein deps' to pull that dependencen, then 'lein swank' to start a server. From emacs, you just hit M-x slime-connect to get a repl going for that specific project.
04:47LauJensenAnother approach, which is the one I use, is shown in that first link I dropped
04:48LicenserWe would really need some kind of out of the box way to do that all it is tiresome :(
04:49dissipatesounds like i'm already in over my head!
04:49LauJensendissipate: Just take it one step at the time. I've given you 2 screencasts now, watch them first
04:49dissipateeven getting enclojure set up was a task.
04:49LauJensenI show you a full installation on a fresh linux box, so it shouldnt be too tricky to keep up
04:49LauJensenAnd if there are questions Im here for a few hours, so shoot away
04:51dissipateenclojure in netbeans is incredibly memory hoggish
04:51dissipateand the whole thing is a good chunk of a gigabyte to download/install. seems crazy
04:51bobo_dissipate: realy? i dont find it using more then just netbeans
04:52dissipatebobo_, i mean netbeans actually
04:52dissipatei just don't understand why an IDE needs to be hundreds of megabytes...
04:53bobo_well, it supports alot, just the java version is 54MB
04:53bobo_javaSE that is
04:54dissipateLauJensen, thanks for the screen casts. i will check them out.
04:54LauJensennp
04:55bobo_dissipate: http://freegeek.in/blog/2009/08/setting-up-emacs-clojure-with-emacs-starter-kit/ is pretty good for emacs aswell
04:57cais2002what does #^"[C" mean?
04:59Licensercais2002: It is a java array
04:59LauJensenIts an old-school type hint
05:02cais2002so the new style is just ^"[C" , right?
05:03LicenserOne thing at is bad about the current repl is that it never forgets you introduce bugs reload the namespace but the old stuff stays :(
05:04hsarvellLau: Yes nice screencast, for no2 I want to see what Emacs can do when it comes to actually coding Clojure.
05:08LicenserWow very strange if I just reload thie ns it woke o.o
05:19LauJensenhsarvell: Thanks :)
05:19LauJensencais2002: yea
05:20LauJensenLicenser: wow, you can wake up a namespace?
05:27dissipatebobo_, thanks for that link.
05:54bartjhi all
05:56bartjre: formatting/style guidelines, is there any quick way to know when I need to start/"break" an expression to a new-line ?
05:56bartjeg: (when (="p" "np") (println "win 1M$") (println "try more"))
06:04LauJensenbartj: Theres a style-guide on assembla, though I dont think it covers new-lines
06:04LauJensenTypically, use them when they enhance readability
06:04LauJensen(when x
06:04LauJensen (do y)
06:04LauJensen (dy z))
06:04LauJensenbut not
06:04LauJensen(map some fn
06:04LauJensen some coll)
06:05bartjLauJensen: does the start of an expression always warranty a new line ? (that seems to be the major difference in your examples)
06:08Chousukebartj: just do what looks good and is easy to read
06:09Chousukeadding newlines to a map invocation can help if the function/coll are formed from some complicated expression
06:10Chousukewith when, the usual convention is to do a linebreak after the condition, but that's not always necessary either.
06:11ChousukeI guess in general macros tend to have some group of parameters and then a "body"
06:11Chousukeand there should be a line break before the body
06:13eevar2bartj whatever you do, don't do this -- http://gregslepak.posterous.com/on-lisps-readability
06:13Chousukeheh :P
06:14ChousukeI honestly don't find the C-style parens any easier
06:14eevar2meh, really should rework my sentences into something legible before hitting enter
06:14ChousukeYou still need to trace the "invisible line" up to the matching level
06:15eevar2indeed. and the guy is cheating by indenting with 2x the space in his 2nd example
06:15Chousukethe extra indentation is what helps in the example on that page, not the paren placement
06:16bartjeevar2: that link is really really good! thanks!!
06:16Chousukebartj: :P it's an example of what not to do
06:17Chousukebartj: people will complain if you put closing parens on their own lines. that's just not done in lisp-land
06:17ChousukeI agree though that it's somewhat arbitrary
06:18Chousukebut I don't agree that suddenly going C-style would make lisp any more approachable.
06:19scottjI didn't read gregslepak's post bc it's too long but he places trailing paren on reduce (functions) and hashes in a way I don't think even C-style languages do
06:20bartjChousuke: sometimes, its useful to know what one must not do ...
06:20Chousukebtw, his example of stacking C braces is perfectly readable to me :D
06:20Chousukeit looks pretty good actually
06:21ChousukeI think because the code is closer together, it's easier to see which block things belong to
06:21Chousukeif it's spread out, it gets longer and you need to jump up and down to confirm the block level
06:22bobo_i would say the method is to long no mather what style you type it in
06:23Chousukewell, yeah.
06:23Chousukewith C and similar languages I have a habit of commenting block ends with a note telling what they are.
06:23Chousukeso I don't need to jump up to confirm so often
06:23LicenserCoooooooookies
06:24Chousukeit's useful in lisp too, I think
06:25Chousukeif your function really gets long, a comment is a good "landmark"
06:25bartjChousuke: may I urge you to write a styling document for Clojure
06:25Chousukekind of like a 'you are here' dot on maps :P
06:27Chousukebartj: did you check out the style notes on assembla?
06:29bartjChousuke: link please ?
06:29Chousukehttp://www.assembla.com/wiki/show/clojure/Clojure_Library_Coding_Standards
06:29ChousukeI suppose I could write a summary of what I think is important. hmm.
06:31bartjChousuke: that link unfortunately has no information on "indentation"
06:32Chousukebartj: well, indentation typically is either two spaces per level, or aligned with above code (in case of function parameters)
06:33Chousukebut you can break any rule if you think it helps readability
06:33Chousukealigning params for example may result in too deep indentation
06:35nipraHighlighted matching parens, forward-sexp, backward-sexp, up-list, backward-down-list, ... are some of my good friends :-P Cheers!
06:36bartjChousuke: Something along the lines of: http://lxr.linux.no/linux/Documentation/CodingStyle
06:45nipraFor comments, we should follow advice on page 41: norvig.com/luv-slides.ps
07:50BahmanHi all!
09:16Raynes,(letfn [(f [] (keyword (name (gensym))) #(f))] (trampoline f))
09:16clojurebotExecution Timed Out
09:17Rayneshiredman: Is clojurebot susceptible to the same thing you broke sexpbot with last night?
09:20defn,(ns-publics 'clojure.core)
09:20clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, val #'clojure.core/val, chunked-seq? #'clojure.core/chunked-seq?, find-protocol-impl #'clojure.core/find-protocol-impl, vector-of #'clojure.core/vector-of, object-array #'clojure.core/object-array, *compile-path* #'clojure.core/*compile-path*, max-key #'clojure.core/max-key, lis
09:20defncool, hiredman finally fixed it, deleted my issue on github, never replied to me, never acknowledged there was a problem, but fixed it
09:23RaynesThe issue is dead, all hail the issue.
09:26defn,(letfn [(f [] (symbol (name (gensym))) #(f))] (trampoline f))
09:26clojurebotExecution Timed Out
09:28defnRaynes: you could build a little timer with atoms
09:28defnmaybe?
09:28RaynesHrm?
10:07cemerickfogus_: any thoughts on the scala 2.8 pain being aired on the interwebs?
10:18fogus_cemerick: There is a reason that we're still on 2.7.2
10:18chouser"we"?
10:18cemerickfogus_: I've heard from three others via twitter to the same effect.
10:19cemerickis it your codebase that needs porting, or critical libs, or both?
10:20fogus_cemerick: I mean my project team (but really just me)
10:21fogus_cemerick: Just our codebase. I use Scala to pull together some Java libs. We do not use any other Scala save for Scala itself
10:23fogus_moving from 2.7.2 to 2.7.3 was less than stellar. From 2.7.2 to 2.8 is a nightmare
10:24cemerickI'm mostly confused as to why it's not just called 3.0. There was some mention of it being "too late to change" the version number, but that seems really odd.
10:24cemerickI mean, as soon as the breaking change became evident, wasn't twiddling the pom an easy, self-evident fix?
10:24fogus_I'm not sure either. The changes are pretty extensive and entirely pervasive
10:24cemerick(Says the bystander, in hindsight.)
10:25fogus_cemerick: Every change is a breaking change
10:25fogus_always
10:26fogus_It's kinda sad because I pitched Scala to my group and it's kinda going the wrong way (IMO) since they bought off on it
10:27fogus_"though #^ is just deprecated at this point – no breaking changes" LOL
10:28fogus_cemerick: I get the impression that Stephan Schmidt thinks ^String is something more than it is
10:29cemerickfogus_: mmm, probably. Though, as I was telling chouser a few weeks ago, I'd like to see hints become more than just advice.
10:30cemerickHe reminded me of this http://bit.ly/d84RO9 which was one of the more fun macros I've ever done. I do continue to like that style.
10:30bobo_hm, is it the same way in clojure btw, if you compile with one version of clojure you cant use the library in another version of clojure?
10:31fogus_As do I. Although, I wouldn't base my language choice on s^String, s:String, String:s, or ^String s
10:32cemerickbobo_: The language and libraries have remained remarkably stable, so something written for 1.1 or 1.0 will almost surely work in 1.2, etc.
10:32cemerickAOT-compiled classfiles *will* break if you build against 1.1 and try to run against 1.2 though, which is unfortunate.
10:33bobo_ok, so the bytecode thing is same in other words?
10:33cemerickThe solution there is to either just recompile (no source changes needed), or ship source instead of classfiles if you can.
10:33cemerickIt's fair to say clojure is source-compatible from 1.1 to 1.2, but not binary compatible.
10:35cemerickThe amount of squawking about 2.8 is remarkable though. Some indication of how large the base of users is.
10:35cemerickI wonder how much of it will be taken by more timid folks as unacceptable levels of FUD.
10:36fogus_cemerick: I missed that thread originally... [b:String [c:Double :as list:java.util.List] {d:java.util.Random :d}] is surprisingly clean!
10:39fogus_While it stinks that 2.8 breaks my work code, I'm more bitter that it breaks my BASIC DSL :p
10:39cemerickdamn, not FORTRAN?
10:40rfgFORTRAN favours the brave.
10:43yacinwith clojure.contrib.logging/with-logs, what should i be using as the "log-ns" argument?
10:44yacini thought *ns* was bound to the current active namespace, so i was using that
10:44yacinbut it prints "clojure.contrib.logging$fn__168$impl_write_BANG___176 invoke" which isn't particularly useful/helpful
11:19gilescbdoes anyone know which is the "trunk" congomongo? since somnium doesn't appear to be incorporating pulls?
11:21gilescbor does chaos reign supreme?
11:30bigwavejakei have a lazyseq. i need to force it to return all the results. how do i do it?
11:30eckroth(doseq myseq) ?
11:30dnolen_bigwavejake: doall
11:30dnolen_(doall (map inc [1 2 3 4]))
11:30eckrothdnolen_: can you describe the differences (in practice)?
11:30dnolen_,(doall (map inc [1 2 3 4]))
11:30clojurebot(2 3 4 5)
11:31dnolen_eckroth: what do you mean?
11:31eckrothdnolen_: between doseq and doall
11:31dnolen_,(doseq [x (map inc [1 2 3 4])] x)
11:31clojurebotnil
11:31bigwavejakednolen_: thanks!
11:32dnolen_eckroth: doseq returns nil, it's for sideeffects
11:44eckrothdnolen_: oh wow, that's straightforward! thanks.
12:41yesudeepCan the recur form occur any number of times within the definition of a function?
12:41chouseryes, but only in tail positions
12:42yesudeepalright chouser. thank you. :-)
12:44yesudeepchouser: Does clojure barf with an error if the programmer mistakenly uses recur in a non-tail position?
12:44yesudeepI should probably try that out.
12:45tomoj,(fn [] (inc (recur)))
12:45clojurebotjava.lang.UnsupportedOperationException: Can only recur from tail position
12:46yesudeephmmm.. nice tomoj.
12:51eckrothcan I provide a method in defrecord without referring to any protocols? ie. can I make record methods without first defining a protocol?
12:54Chousukeeckroth: you can implement interfaces, but if you mean to ask whether it's possible to create new methods, then I don't think so.
12:56eckrothChousuke: I think you're right; if I don't refer to a protocol, I get an unrelated error; if I refer to a protocol but make a method not in the protocol, I'm told I can't create new methods
13:06lpetitHi, emacs users :-)
13:07lpetitI'm sick of my current logitech keyboard. After all those years, starting to feel the pain out of my wrists
13:08lpetitWith so heavy use of the Control, Shift (and Alt ?) key in emacs, how do you manage not get hurt ? Is there a dirty secret concerning how to hit those keys ? Or do you all use special keyboards ?
13:08lpetitOr do I need to buy two new arms ? :-)
13:09eckrothlpetit: I find "mousing around" the worst for my right wrist; using Emacs is much better for me. Perhaps an alternative for you is Vi-like keybindings?
13:10fogus_lpetit: You need one of these: http://world.std.com/~jdostale/kbd/SpaceCadet1.jpeg
13:12lpetitfogus_: hey, I'm not *that* old ! :)
13:12maravillasi like the thumbs up and down keys...very roman emperor
13:14shadowsparhttp://kinesis-ergo.com/contoured.htm
13:16shadowsparI don't use emacs, but I've used that ^^ kbd for 5 years, and it's made a huge difference for me
13:16lpetiteckroth: oh ? My right wrist doesn't suffer from mousing around: my arm rotates over my elbow, and the movements of the wrist while "mousing around" are small. No, it's really my left little finger, when reaching the Ctrl key which is the problem
13:16shadowsparthe kinesis ones put all the modifier keys (except Shift) into the thumbwells, which might help
13:17lpetitshadowspar: now this looks really like star trek material. I like it !
13:17eckrothlpetit: I understand the Ctrl key issue; however, I've been using Thinkpads all my life and I love the "trackpoint", but it's not good for my wrist; I also have terrible chair/desk pairings so my wrist is always bent when using the mouse :(
13:19shadowsparlpetit: it's not too bad to learn to type on since all the letter/number keys are in the same spot
13:19shadowspara lot of ppl like them, but it's not the end-all and be-all of ergo keyboards by any means. there's a lot of stuff out there =)
13:21cemerickHYPER-SUPER-META-CONTROL....ASSEMBLE!
13:21lpetitI guess I'll have to find a local store where I can try them, so
13:21cemericklpetit: the standard apple keyboards are very, very nice IMO. Very short key travel, which is key for me.
13:24lpetitcemerick: doesn't very short key travel mean the hands are even closer than with normal keyboards, and the elbows having a greater angle ?
13:25cemericklpetit: no, key travel refers to the height of the key caps. The shorter the key travel, the less effort you need to expend in order to register a keypress.
13:26lpetitcemerick: ok. Must leave work and go home. Thanks for the input, alls
13:26lpetitbye
13:28nickikCan somebody help me with a problem setting up webdevelopment?
13:29nickikI made a new project with line and added compojure to the deps
13:31nickikthen i downloaded everything with lein deps
13:34yacinif i want to serialize a java object with print-dup, but all the information isn't in the constructor, can i do something like:
13:35yacin#=(.add (java.util.ArrayList.) 4)
13:35yacin?
13:35yacinor does read-string not understand arbitrary clojure exprs?
13:37cemerickyacin: I think that'd work, though you'd want #=(doto (ArrayList.) (.add 4))
13:38defnclojurebot is nowhere close to SKYNET when compared to this: http://techcrunch.com/2010/07/08/anybots-arrington-robot/
13:38yacinhmm, it doesn't seem to evaluate the expression
13:38yacin(clojure.core/let [G__14535 (java.util.ArrayList.)] (.add G__14535 4) G__14535)
13:38defnyacin: um yeah, that would just read everything you typed in
13:39defnso it couldnt stop naughty things from happening
13:39defnyou could arbitrarily execute code on the server
13:39yacini realize the implications of something like this
13:39yacinbut i want to do it anyway
13:39defnyou just did...at your own REPL
13:40cemerickyacin: read doesn't evaluate anything, eval does
13:41defnyacin: im sorry i missed what you were trying to do there
13:41yacini don't understand why #=(java.util.ArrayList.) returns an instance then, instead of just the expression
13:41defni thought you were trying to do:
13:41yacinno worries
13:41defn,#=(java.util.ArrayList.)
13:41clojurebotEvalReader not allowed when *read-eval* is false.
13:41defnto the bot
13:41yacinno, i have a java class that doesn't have all the necessary information in its constructor
13:41qbgWhy is EvalReader so restricted?
13:41yacinso i need to create it, and run some methods to add the extra data
13:41yacinin order to make a suitable print-dup for it
13:42yacinif that makes sense
13:43yacinit seems to eval when the form is just a constructor, but not when it's wrapped with doto, which i would like
13:45ohpauleezWhat does #= do?
13:45cemerickit's part of an undocumented, unsupported serialization framework
13:46ohpauleezahh, gotcha
13:46chouserunsupported?
13:46cemericklast I heard on that topic was "it'll change, don't depend on it continuing to be there"?
13:47chouseroh, interesting.
13:47yacinso, is what i'm trying to do possible?
13:47ohpauleezAlso, a quick clojure in commercial apps update
13:47yacinotherwise, i'll have to parse everything, which won't be fun =\
13:48ohpauleezI know of one instance where clojure will probably be used in a large, commercial, video game
13:50chouseryacin: #=(eval (doto (java.util.ArrayList.) (.add 4)))
13:50chouserbut don't tell anyone I told you that, and I'm by no means recommending it
13:50yacinyeah, i just tried it myself
13:51chouseryou might do better to create a class with a static method to create ArrayLists
13:51cemericka binary print/read is way more sane in any case
13:52yacinchouser: yeah, i might go ahead and do that instead
13:52cemerickJust a stable fn in a namespace will do
13:52yacini just need to get it done fast right now
13:52cemerickchouser: the only way to go when you've got a mix of clojure and java bits
13:52cemerickPlus, legible print/read is godawful slow.
13:57chouseroh, indeed. a function rather than a static method
13:58chouserI can never remember what exactly #=() supports
13:58chousercemerick: optimize first! debug later! :-)
13:59cemerickchouser: I prefer to do both. :-)
13:59cemerickprint/read is simply too slow for many, many things, of course
14:00slyrusstupid mutable (?) vector question: if I have '((1 "foo") (2 "bar") (4 "moose")) and I want ["foo" "bar" nil "moose"] from that, is there an easy way to do that?
14:00chouserwhy nil?
14:01chouseroh, I see.
14:03qbgslyrus: It would be rather easy to write such a function
14:04slyruswhy, trivial: (loop ... for x in '... do (setf (aref ...)) :)
14:04slyrusi mean, yeah, trivial
14:04slyrusin common lisp... for me anyway
14:04qbgFind the size of the vector to create, and then use reduce
14:07cemerickI just feel dirty now: https://gist.github.com/1d7cdc705e6b71721207
14:08chouser,(reduce (fn [v [i x]] (conj (reduce (fn [v _] (conj v nil)) v (range (- i (count v) 1))) x)) [] '((1 "foo") (2 "bar") (4 "moose")))
14:08clojurebot["foo" "bar" nil "moose"]
14:08chouserI'm sure there's a better way
14:08slyrusthanks chouser
14:08chouserthat assumes keys are in order
14:08qbgMy method: http://gist.github.com/469794
14:10chouserqbg's handles out-of-order keys
14:10slyruscool. I guess there's no vector-push-extend in this language :)
14:10chouserthough I think it's O(n log n) instead of O(n)
14:11qbgIf log_32(n) is small enough, then that log n should be small enough
14:11slyrusI was trying to use an atom and swap! and not getting anywhere
14:11ohpauleezIs there a reason why you both used (fn ..) and not #()?
14:12chouserdifferent reasons
14:12chouserwell, we both used it once for destructuring the key/value pairs
14:12chouserI used it a second time because I was ignoring the second arg
14:12ohpauleezahhh right, cool
14:13chousershould have used repeat nil like qbg did instead. :-)
14:17qbgLearning Clojure shouldn't be too hard if you come from CL
14:21chousercemerick: you made a magic auto-generated function!
14:21slyrusqbg: it seems to be two things: learning the differences (how CL concepts map onto clojure) and breaking old/bad habits
14:21cemerickchouser: dirty, filthy, ashamed.
14:21cemerickHowever, I've got a 14-slot record, and it's not going to get any smaller. :-/
14:22qbgslyrus: It also helps a lot if you used SLIME with CL
14:23slyrusqbg: is there any other way? :)
14:23slyrusspeaking of slime... how do I tell an emacs buffer that I want to switch slime connections?
14:24slyrusah, slime-cycle-connections
14:27laz0rcan anyone help me setting up swank-clojure with elpa? I seem to have the problem that elpa installed the wrong clojure version (1.1.0, I think I need 1.2.1)
14:29slyruslearning clojure is a mixed bag for me... part "man, this would be really trivial in common lisp" and part "oh, that's really nice!". the latest example of the latter is (map :my-keyword ...) that's much nicer than cl's alist/plist/etc... cruft
14:29technomancylaz0r: you don't need swank-clojure from elpa; just get clojure-mode and slime-repl and follow the instructions in the http://github.com/technomancy/swank-clojure readme
14:29technomancyheh; plists... =)
14:32laz0rtechnomancy: I tried already before trying to install with elpa, but found that readme a bit confusing
14:33laz0rI did however get lein to work, and 'lein deps' did install clojure-1.2.0 in the lib/ subdirectory of swank-clojure
14:34laz0ris that what I am supposed to do?
14:34qbglaz0r: You create a project and add swank-clojure as a dev-dependency
14:35qbgThen after running 'lein deps', you should be able to run 'lein swank' and connect to the project with SLIME
14:38anonymouse89any swarmiji users?
14:38technomancyanonymouse89: I think there is only one user of swarmiji
14:38anonymouse89:(
14:40laz0rqbg: ok, so I create a dummy project which just consists of a project.clj file, in which I put that just one line like: ":dev-dependencies [[swank-clojure "1.2.1"]]
14:40laz0rand then I run 'lein deps'?
14:40qbgYou create the project with 'lein new <project name>'
14:41anonymouse89In that case, my application is very cpu-intensive and currently uses agents to get full utilization on all local cores. I'm looking to span multiple boxes.
14:41qbgAnd yes, after adding that line, run 'lein deps'
14:41anonymouse89I'm a bit clueless about the simplest way to do this
14:44slyrusqbg: this seems to work for me: http://gist.github.com/469794
14:44slyrusand thanks for your help!
14:47qbgslyrus: Note the following:
14:47qbg,(assoc [nil] 5 "hello")
14:47clojurebotjava.lang.IndexOutOfBoundsException
14:47qbgBut:
14:47qbg,(assoc [nil] 1 "hello")
14:47clojurebot[nil "hello"]
14:50laz0rqbg: ok, lein deps did install swank-clojure-1.2.1, but it is now in a subdirectory of my dummy project
14:51qbgYes, 'lein deps' will put all of the dependencies into libs/
14:51laz0rcan I somehow replace the swank-clojure-1.1.0 file in ~/.swank-clojure to make emacs use 1.2.1 automaticly?
14:51qbgYes, just replace it :)
14:51laz0rah, ok
14:52qbgThough it should only ever use that swank-clojure if you use 'M-x slime'
14:52laz0rthats exactly what I want it to do
14:53qbgI just have a symlink to the jar in my clone of the swank-clojure repo
14:53laz0rI wanted to play around with clojure, I had an old installation and thought 'oh well, I might as well upgrade it first'
14:59laz0rmh, now slime does not start anymore
14:59laz0rSearching for program: no such file or directory, lisp
14:59laz0rI installed it with elpa, so I assume it should work
15:01qbgSounds like something happened to what is in your .emacs
15:02qbgYou could fix that, or use swank-clojure from a project
15:02qbg(2nd option is likely much easier)
15:14threepwoodcan i say (re-find (re-matcher #"foo" "foobar")) more concisely? re-matches only does a complete match.
15:16qbg,(first (re-seq #"foo" "foobar"))
15:16clojurebot"foo"
15:16qbg?
15:16ataggart,(re-find #"foo" "foobar")
15:16clojurebot"foo"
15:19threepwoodthanks
15:31slyrusqbg: I see. interesting behavior there. http://gist.github.com/469794 should be more robust then.
15:32laz0rqgb: you are right, it is a lot easier like that
15:32laz0roops, qbg i mean
15:33laz0rstill, I wonder whats wrong with my config... maybe I will find out
15:33qbglaz0r: Did you remove elpa or something like that?
15:34laz0rit is removed right now yes, but I was just trying around to find out whats wrong
15:35laz0rI just saw that it is complaining about a version mismatch
15:35laz0rbut only after I installed that latest slime to try that out
15:35qbgIgnore the version mismatch
15:36laz0rI think a solution would be to set the inferior-lisp-program to execute clojure
15:43ericthorsenI have some code that uses genclass and has a dependency build order problem...I'm now using the maven plugin and cannot get past this.
15:44ericthorsenWhat is the current recipe for this? Declaring the namespaces using the compileDeclaredNamespaceOnly does not seem to work (I read that somewhere)
15:47cemerickericthorsen: what does your dependency DAG look like?
15:48ericthorsenVery simple, no cycles...A depends on B both are genclass java classes. A instantiates a B so during AOT it is looking for the class file
15:48cemerickericthorsen: Add a (:require B) to A
15:49cemerickericthorsen: ... *before* the relevant import! :-)
15:51ericthorsencemerick: you rock!!! Thank you
15:52cemerickyes, yes I do ;-)
15:52cemericknp
15:52cemerickericthorsen: how's the enclojure-ing going?
15:52cemerickI haven't upgraded to 6.8 yet.
15:52ericthorsencemerick: Very good...I have a mate from sun helping out...we are skying every other week
15:53cemericknice
15:53cemerickI saw the assembla invite with a sun.com email, thought something might be up
15:54ericthorsencemerick: I'm testing going back to multiple modules again in hopes to simplify contributions....in the past classloader hell...but I'm hoping for better luck now. Should know before the end of the weekend
15:54cemericksounds good
15:55ericthorsencemerick: I think if we can get some of minor but time consuming irritants out of the way...we can make it much easier for people to contribute there
15:55bultersg'day all...
15:56cemerickericthorsen: yeah; not sure if you noticed, but I'm going to be trying my hand at getting ccw to use the enclojure repl server
16:07bigwavejakeI have to pass a seq to a variadic Java method with the following signature: process(Map<String,Object> attributes, String... processingComponentIdsOrClassNames)
16:07bigwavejakeHow do I pass the seq of Strings?
16:08bigwavejake(.process my-obj attributes ["Class1"]) doesn't work
16:18TakeVIs it possible to use Clojure with a scripting language?
16:25dakroneTakeV: how so? do you mean calling a scripting language from Clojure?
16:26dakroneI've had some success calling ruby via Java's ScriptingEngineManager
16:26dakronesame with javascript
16:26bigwavejakeI found an answer for pushing Clojure seqs into a variadic Java method: pass them like this: (into-array ["Class1"])
16:27TakeVdakrone: Yeah, that's exactly what I mean. Looking into JavaScript or Groovy right now.
16:29dakroneTakeV: here's a good article I used as a reference for some of the work I was doing: http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/
16:29TakeVThank you.
17:24ohpauleezanyone in here use moustache a lot?
17:29Raynesohpauleez: Doesn't qualify as "a lot", but I used it in tryclojure.
17:30ohpauleezRaynes: Is there a way to get this to work without using a Ring Handler style function... ["index" names] {:get (fn-returns-str names)}
17:30ohpauleezthat you know of
17:31ohpauleezI haven't looked at what is really happening in the code yet, so if you don't know off the top of your head, that's totally cool
17:32RaynesNo clue.
17:32ohpauleezcool, thanks anyway though!
17:42Raynesohpauleez: Couldn't you wrap that in a function?
17:42Raynesohpauleez: Just came to me that that might work.
17:42ohpauleezthat's what i just did
17:43RaynesDunno why I didn't think of that at first.
17:43Raynes:p
17:43ohpauleezI originally avoided it for readability of the routing table
17:43ohpauleezbut it's not so bad
17:44arohnermaven accepting invalid checksums into the central repository is one of the most idiotic things I've ever heard
17:44arohnerseriously, wtf maven?
17:45arohnerand serving checksum files that can be read by maven 2.1, but not maven 2.0 (lein uses maven 2.0)
17:58technomancymaven 2.1 has a bug that hangs the JVM that they don't seem to be in any hurry to fix =(
17:58arohnertechnomancy: ouch
17:59arohnerdoes 2.2.1 have any crazy bugs?
18:11lancepantzdoes anyone have an example of using log4j with clojure.contrib.logging?
18:24arohnerlancepantz: http://gist.github.com/470168
18:24lancepantzthanks!
18:30arohnerlancepantz: that's also using commons-logging btw
18:30arohnernm
18:34lancepantzarohner: i was actually looking for an example with clojure.contrib.logging
18:35arohnerlancepantz: oh, sorry. reading FTW
18:35lancepantz:)
18:36timcharperWould I make richhickey cry if I used metadata as a memoize cache bucket ?
18:37Raynestimcharper: Dunno. Ask him, he's right over there. :p
18:38timcharperrhickey: would it make you cry if I used metadata as a momoize cache for fetching associated records from a database ?
18:38timcharperhahah.. ^momoize^memoize
18:41lancepantztimcharper: i believe thats essentially what lancet does if you call a task twice
18:46timcharperis that considered an abuse of meta-data ?
18:46timcharper(looking at lancet now)
20:25dnolenanybody have luck getting the mysql connector from jarvana ?
20:31ecretcan someone offer some tips on integrating clojure code inside a java project? I realize I could treat the java stuff as a jar and override classes but is there maybe some other ways?
20:32ecreti have a large java codebase, that is down to one jar. I would like to start new changes in clojure inside it and am curious for tips. I know clojure and java, perhaps its a vm question?
20:36Lajlaecret, I love you, hug me like you'd hug the Microsoft Chief Software Architect.
20:37ecretLajla, my last job I had to start putting .net controls inside a win32 application
20:37ecretso i would not hug him
20:37ecreti realize its a poor question. i was hoping maybe there was a magical way
20:39Lajlaecret, I atually know crap about clojure, all people here hate me, I'm just here to talk Finnish.
20:39LajlaOf which I also know crap.
20:39LajlaSorry man.
20:39LajlaBut I stil love you.
20:42wdouglasI'm having an issue getting swank-clojure to show stacktrace of locals in the repl, I'm using 1.1 with swank clojure 1.2.1 just trying with a simple let and swank.core/break
20:43technomancywdouglas: local inspection requires clojure 1.2
20:43wdouglastechnomancy: thank you sir
20:50technomancynp
20:50dysingerI'm looking to hire some clojure devs - if anyone's wanting work
20:58technomancyyeah, come work for dysinger and enjoy working from environments like http://www.flickr.com/photos/technomancy/3797798785/ and http://twitpic.com/23bgqb =)
20:59dysingeror my version http://www.hoopgirl.com/blog/kauai.jpg
20:59dysinger(not my photo but close)
20:59dysinger:)
21:00dysingertoo bad we didn't get any beach computing photos from May
21:01technomancydysinger: http://www.flickr.com/photos/technomancy/4673178238/
21:05scottjare there docs for what to do to replace dependency foo with your own foo when both projects use lein?
21:06technomancyscottj: yeah, change the group-id to org.clojars.$USER and publish to clojars
21:06technomancyassuming you can't get your changes accepted upstream for some reason. (but you should try really really hard to do so)
21:07scottjwell I'm thinking for developing the changes and testing them out in the first place
21:07technomancyoh sure. if you don't need to share across a team you can just do lein install instead of pushing to clojars.
21:08technomancyor use checkout dependencies
21:32bultersanyone here aware of a manual on how to set up emacs/clojure-swank?
21:34hiredmanclojurebot: emacs?
21:34clojurebotemacs is an out-moded belief system
21:34hiredmanclojurebot: clojure-mode?
21:34clojurebotclojure-mode is an Emacs mode for Clojure, found at git://github.com/jochu/clojure-mode.git
21:34hiredmanclojurebot: slime?
21:34clojurebotslime-install is an automated elisp install script at http://github.com/technomancy/emacs-starter-kit/blob/2b7678e9a331d243bf32cd8b591f826739dad2d9/starter-kit-lisp.el#-72
21:34hiredmanhmmm
22:04mudgehello
22:10mudgei know that if you want to compile clj files to .class files you can use the compile function, like so: (compile 'namespace) but what if you want to compile all the clj files in a whole directory?
22:10dnolenDatabase for a Concurrent World, http://dosync.posterous.com/22516635
22:10dnolens/Database/Databases
22:15lancepantzmudge: you have to do it yourself
22:16lancepantzmudge: you can use read-file-ns-decl and find-clojure-sources-in-dir from clojure.contrib.find-namespaces
22:17lancepantzthen a doseq, and viola
22:17mudgelancepantz: oh, i see, neato
22:18lancepantzi believe that currently if you compile a ns, it will transitively compile all refered to nses
22:18lancepantzbut i think that is changing, there was a discussion about it on assembla the past week or so
22:19mudgehmm, but actually I'm compiling from ant like so: <java classname="clojure.lang.Compile" fork="true" failonerror="true">
22:19mudgeAnt
22:22lancepantzthat's going to be a little tricky, i'm not an expert there
22:22lancepantzi'm not familier with using the Java task to call clojure
22:23mudgek
22:25mudgei have a different question
22:25mudgelets say that you have a clojure file with some code in it and you want to use a function in a different clojure file, how do you do that?
22:26chouser"some code" but not a lib with its own namespace
22:26qbgmudge: Have the first file correspond to a namespace and then use or require it from the other namespace
22:26mudgeokay, cool
22:27mudgedo all clojure files have a namespace declared at the top?
22:27mudgecan namespaces span multiple files?
22:27mudgejust want to know how things are done
22:27lancepantzthey do not all have an ns, but its very good practice to do so
22:27qbgUsually you have one file per namespace
22:27mudgeoh okay
22:28qbgThough exceptions are made for huge namespaces
22:28mudgehow would a namespace span more than one file?
22:29qbgThe way clojure.core does it is that the main file loads the other files at some point
22:29mudgeyea, that makes sense
22:29mudgelike an "include" in C ?
22:30mudgeread in other files to make a big file?
22:30lancepantzmudge: there is a function, load-file
22:31qbgand there is also load
22:31mudgeokay
22:31qbgIt is sort of like include from C, but it is just another function call in the file
22:32mudgei get it
22:51absalomAre there really clojure jobs that allow one to program in environments like the ones linked earlier?
22:51absalomI've been programming professionally in CL for a long time, but usually in secret.
22:55mudgewowsers, I just figured out that to have compiled clojure code to .class files I don't have to compile every namespace and use gen-class for every namespace
22:55mudgei can just use gen-class and compile a single clojure file --- and everything that clojure file requires or uses will automatically be compiled to .class too!
22:55mudgethis makes me happy
22:58mudgeso I'm thinking that you don't want to write clojure in a java way, you just want to be able to interoperate with java
22:58mudgewould everyone agree with me?
22:59hiredmanis that something in dispute?
23:02mudgeno, it's just that I'm writing a module for an existing java application, and I found myself writing clojure code as if it was java ---- writing new namespaces and treating them like classes by writing methods
23:02mudgeinstead of using a namespace to organize functions
23:02mudgeand implementing interfaces with my namespaces, and extending my namespaces etc.
23:03mudgeinstead of all that, i could just use namespaces to organize my functions, and use proxy if I need extra functionality in existing java classes
23:04mudgei'm figuring out what my coding style should be in clojure
23:04mudgeanybody have any good tips on coding style in clojure, specifically structure of programs
23:05mudgei'm wondering what's good ways to structure programs in clojure
23:05hiredmanfunctions in namespaces
23:05mudgemaybe writing one main file, and writing libraries of functions for that one main file to use
23:06mudgehiredman, yes, so functions in namespaces to be used as libraries, right? what do you do to structure the main flow of your program?
23:07mudgeuse one namespace for that? and that namespace then just uses other namespaces as libraries of functions?
23:08hiredmanmudge: depends on what kind of program you are writing and how it interacts
23:09mudgewell how do you do things hiredman?
23:09mudgehow have you done things?
23:09hiredman~source
23:09clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
23:09hiredmanit ain't super but it's something
23:09mudgeokay
23:11hiredmangenerally stuff can be divided pretty cleanly between namespaces
23:12hiredmanbut really I don't think any of my personal projects has gotten large enough for it to be a huge concern
23:12hiredmanI certainly didn't spend time thinking about what namespaces functions should go in while writing clojurebot
23:12mudgeokay
23:13mudgeby the way, i know there would be problems with clojure bot using "def" or "defn" but it sure would be cool to be able to do that with clojure bot
23:13aria42Anyone know in Slime how to send a form to the REPL rather than the mini-bubber?
23:15scottjunclear
23:15hiredmanmudge: *shrug*
23:25mudgeso all things in clojure usually lowercase?
23:25mudgenamespaces and function names are all lowercase?
23:25mudgeis that the convention?
23:25scottjyeah
23:27aria42no ideas?
23:28mudgegreen slime?
23:28mudgeslime has mini bubbers?
23:28aria42s/bubbers/buffer/
23:28aria42I'm not sure what bubbers are, but I'm sure emacs interacts with it
23:30mudgewhy do clojure file names user underscores, but the namespaces use hyphens? file test_this, namespace test-this
23:32aria42I believe its because java package and class identifiers don't allow hyphens and since namespaces map to java packages
23:33mudgemakes sense
23:38scottjaria42: you mean how to show the result in the repl instead of in the minibuffer? I don't know what it means to send the form the minibuffer
23:38aria42yes.
23:39aria42so C-X C-E evals and sends result to mini-buffer
23:39aria42and is there a command that will send the form to the slime-repl and evaluate
23:40scottjI think you'll have to write some elisp
23:41aria42that's never a good thing
23:41aria42sigh, you're probably right, I'm a little shocked this isn't baked in
23:41scottjaria42: tried #lisp? CLer's tend to have more experience with slime
23:43hiredmanC-c C-c evals the current form and C-c C-k compiles the current file
23:44scottjhiredman: not what aria42 is looking for
23:44scottjwants the code to be send to the repl and the output to appear there
23:45scottj"sent to" as in the code is visible in the repl
23:46hiredmanC-k C-x o C-y
23:46aria42hiredman: Thanks!