#clojure logs

2010-07-25

00:19BahmanHi all!
00:59rdsrwhile constructing an uberjar with lein, why does lein do a cleanup first, could this also be the reason why my uberjar does contain any of my dependencies
00:59rdsrs/does/doesn't/
00:59sexpbotwhile constructing an uberjar with lein, why doesn't lein do a cleanup first, could this also be the reason why my uberjar doesn't contain any of my dependencies
01:01rdsrcrap, substitution fail
01:01rdsrwell the first one is "does" and the next one is "doesn't"
01:03technomancyit does a cleanup followed by a compile, which will force deps to be fetched
01:04technomancyI mean, it should
01:11rdsrin my case my standalone jar just contains my files
01:12technomancyrdsr: does an explicit call to deps before calling uberjar fix it?
01:12technomancyrdsr: anyway, if you have a simple repro case please create an issue
01:13rdsrnope, I tried that
01:13rdsrok I will do that, thanks
01:26rubydiamondhi guys..
01:26rubydiamond clj script/run.clj
01:26rubydiamondException in thread "main" java.io.FileNotFoundException: Could not locate ring/adapter/jetty__init.class or ring/adapter/jetty.clj on classpath: (run.clj:0)
01:26rubydiamond at clojure.lang.Compiler.eval(Compiler.java:4658)
01:26rubydiamondI am going thru this http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html
01:28seancronHi everyone. Does anyone know how can I do (while swing-window-is-open ...) in clojure?
01:29rdsrrubydiamond: ring.jetty.adaptor should be on your classpath
01:29rubydiamondrdsr: but that tutorial is not mentioning it..
01:29rubydiamondrdsr: is there any other command I should try.. may be lein specific
01:29rdsrI see that the tutorial is using lein
01:30technomancyrubydiamond: everyone has their own definition of the "clj" script. it appears yours differs from the one used by the author of the tutorial
01:30rdsris clj your custom script
01:30rubydiamondrdsr: nope.. I have installed clojure..
01:30rubydiamondit's coming with it
01:30rubydiamondtechnomancy: I have installed it with homebrew
01:31technomancyrubydiamond: clojure doesn't come with a shell script
01:31seancronrubydiamond: check the version of clojure and clojure-contrib in your project.clj file. Is it 1.2.0-beta1?
01:31rubydiamondtechnomancy: there are 18 jars in lib folder and i don't want to manually set classpath for each .. will lein help me to run it
01:32technomancythough whoever repackaged it for homebrew may have added one
01:32technomancysure
01:32technomancybut the project has to be set up for it. the lein-run plugin might help though
01:35rubydiamondis installing the lein-run plugin
01:36rubydiamondtechnomancy: it helped ... but another error looks like in tutorial
01:36rubydiamond lein run script/run.clj
01:36rubydiamond [null] Exception in thread "main" java.lang.Exception: Unable to resolve symbol: a in this context (core.clj:17)
01:37rubydiamondhttps://gist.github.com/fc22629ac2fb6f30e144 here is code
01:37rubydiamondI don't see any symbol 'a' there
01:40seancronrubydiamond: Try cloning the example from the tutorial and see if you can get that working http://github.com/mmcgrana/adder
01:43rubydiamondseancorfield: ok
01:43rubydiamond_seancron: ok
01:48rubydiamond_seancron: that cloned rep worked... so looks like a bug in tutorial..
01:48rubydiamond:)
02:11seancronrubydiamond: Glad to hear that it worked for you
02:11rubydiamondseancron: clone worked .. but if you follow tutorial till clj run script.. it doesn't work
02:19rubydiamondhttps://gist.github.com/9462c30f0b86bed809d8 technomancy get this error for lein repl
02:19rubydiamondseancron: if you know more
02:27seancronrubydiamond: Maybe take a look at the clj script that was linked to at the beginning of the tutorial? http://mmcgrana.github.com/2010/03/clojure-setup.html
02:28seancronrubydiamond: I'm going to bed though. Good luck.
02:34rubydiamondseancron_: thanks
02:48Deranderrubydiamond: how did you install lein-run?
02:49rubydiamondDerander: adding dependency for it
02:49DeranderI did that, but "lein run" in the project root says undefined task lein, after I've run lein deps and it appeared to have installed
02:56rubydiamondDerander: let me help you
02:57rubydiamondDerander: add "[lein-run "1.0.0-SNAPSHOT"]" in your project.clj as dependency..
02:57Deranderdone
03:01slyrus_surely an equivalent to this is built in somewhere: (defn position [coll x] (some (fn [[a b]] (when (= b x) a)) (indexed coll)))
03:03Deranderrubydiamond: I am failing at the next step. lein reports that it has installed the dependency. lein run does not work, however.
03:05Chousukeslyrus_: maybe in contrib, but not in core.
03:13slyrus_yay: (map clojure.pprint/pprint (map #(vector % (graph-distance-matrix %)) (connected-components q10))) works. now i can go to bed.
03:16rubydiamondDerander: hmm
03:16rubydiamondis it the same proj
03:16Deranderrubydiamond: I got it figured out -- had to add it as a dev-dependency
03:16Deranderfor some reason
03:16DeranderI am not certain what the difference between the two is, but it worked
03:16rubydiamondDerander: hmm.. ok
04:28rubydiamondguys.. if I run a clojure factorial program for number 100
04:28rubydiamonddoes it mean .. it's using mutiple cores while processing it
04:37greghI suppose that depends on how you've written your program
04:52rubydiamondgregh: okay..
04:52rubydiamondalso I am getting error while loading compojure from command line
04:52rubydiamondhttp://yfrog.com/f/jy2dvp/
04:54rubydiamondanybody there
05:00ChousukeIs your classpath properly configured?
05:00Chousukealso unless you're using an old version of compojure, you'll need to require compojure.core instead
05:00Chousukethe namespace was renamed because single-segment namespaces cause problems.
05:12rubydiamondChousuke: hmm
05:13rubydiamondChousuke: I am running lein swank
05:13rubydiamondand I have compojure and clojureql as deps in it
05:14rubydiamondChousuke: somehow (use 'compojure.core) worked
05:15rubydiamondbut not able to use clojureql
05:15rubydiamond(use 'clojureql)
05:15bpsmi've added patches for clojure #413, #410, #408, #277 if anyone's awake an bored and wants to look at them.
05:16rubydiamondbpsm: okay.. I hope.. I can learn clojure fast and I understand your patches so that I can take a look at them
05:16rubydiamondbpsm: hey.. (use 'clojureql) not working for me
05:17bpsmnot working, in what sense? exception?
05:17bpsmrubydiamond: not working, in what sense? exception?
05:18rubydiamondbpsm: I have added it in project.clj as deps [org.clojars.snuxoll/clojureql "1.0.0"]
05:18rubydiamondusing lein
05:18rubydiamondnow trying to use those using REPL .. swank clojure
05:18rubydiamond(use 'compojure.core)
05:18Chousukerubydiamond: probably the namespace is wrong again
05:18rubydiamondthat worked..
05:18Chousukeright
05:18rubydiamondbut not clojureql
05:19rubydiamondChousuke: how do I know what to use
05:19Chousukerubydiamond: you read the documentation for the library to see what namespaces there are
05:19Chousukelibraryname.core is a common convention (because clojure uses it)
05:19rubydiamondChousuke: hmm
05:19Chousukefor the main namespace, that is
05:19rubydiamondChousuke: .core seems to be not working
05:19Chousukethere are often others too.
05:22Chousukerubydiamond: the namespace is dk.bestinclass.clojureql
05:22Chousukerubydiamond: http://gitorious.org/clojureql/pages/Home#Documentation
05:22rubydiamondhmm?
05:22rubydiamondlet me try that
05:22rubydiamondoh yeah .. it worked..
05:22Chousukerubydiamond: clojure libraries contain namespaces, and you load those with use or require (prefer require; use pollutes your namespace)
05:23Chousukeso to start using a library you need to figure out what namespace you want to load.
05:23rubydiamondChousuke: hmm
05:23rubydiamondChousuke: thanks very much.. trying out http://vimeo.com/8356990
05:24Chousukehmm
05:24Chousukethat video is probably outdated
05:24rubydiamondChousuke: yeah
05:24Chousukeso don't be too confused if some more things don't work :)
05:24rubydiamondbtw do you know where lein copies jars
05:24rubydiamondChousuke: right
05:24Chousukein the maven repo
05:25Chousuke~/.m2 on unixoids :P
05:25clojurebotIt's greek to me.
05:26rubydiamondChousuke: looks like now I am stuck at open-global
05:26rubydiamondopen-global is not available for my clojure
05:27Chousukeit's probably a compojure or clojureql function
05:27Chousukethat has been either renamed or moved to some other namespace
05:27rubydiamondChousuke: :(
05:28Chousukerubydiamond: here's a more uptodate compojure tutorial http://mmcgrana.github.com/2010/07/develop-deploy-clojure-web-applications.html
05:29Chousukeno emacs though, but the tutorial uses lein too so you can just use lein swank
05:29rubydiamondChousuke: yeah I have tried that today morning..
06:41rubydiamondisn't it wrong http://sicpinclojure.com/?q=print/book/export/html/16
06:41rubydiamonddefine is not defined in clojure..
06:42fyuryurubydiamond: yes, seems like a mistake
06:43rubydiamondfyuryu: right..
06:52Nikelandjelorubydiamond: Isn't it about scheme?
06:53rubydiamondNikelandjelo: it's sicp in clojure
06:53rubydiamondso the syntax should be in clojure.. as I undestand
06:55Nikelandjelorubydiamond: Actually I don't see any example of clojure syntax in this site. Weird...
06:56fyuryurubydiamond: http://sicpinclojure.com/?q=sicp/1-1-2-naming-and-environment#comment-12
06:56rubydiamondlol
06:57fyuryuseems like a work in progress
07:02RaynesIt's definitely a work in progress.
07:02RaynesI'm not sure how much *progress* is actually being made though.
07:02RaynesEverything looks the same as it did about a year ago.
07:03rubydiamondhope I can contribute to it in future
07:03rubydiamondI have recently started reading SCIP a
07:03rubydiamondnd learnig clojure too
07:38Rayneschouser: ping
10:02jlihm, strange. I'm using a fixed thread pool executor to handle all my tasks, which all just commutatively add stuff to a set. but it seems like I only see actual concurrency when I have (println @ref) in my task function
10:02jli(cpu% goes over 100%, I see stuff printed at the same time)
10:03jliwhen I remove the println, I see everything printed all at once (my "getting future" and "thread pool shutting down" messages), and the code is capped at 100%
10:03jlithe answer is still correct, but not sure what's gong on
10:04jligoing
10:05RaynesThe fact that there isn't a Clojure openid library yet makes a happy Raynes a sad Raynes.
10:10raek</3
10:10raekI would want one too
10:11Raynesraek: If I can grok the spec, I'm considering writing one.
10:12Raynesraek: The Java openID libraries make my eyes bleed.
10:15raekOpenId4Java?
10:15Raynesraek: I don't read Java very well.
10:15raekit woulde be nice to build the clojure library on another working library
10:15RaynesI don't think I'd be able to do that.
10:17raekAFAIK, there are two versions of OpenID in use
10:18Rayneshttp://code.google.com/p/openid4java/wiki/SampleConsumer
10:18raekmaybe I'l check out OpenId4Java later this evening
10:19RaynesI'm not familiar with this httpservlet nonsense.
10:19raekthat example shouldn't be too hard to port to clojure
10:19raekmaybe we could use some of clojure
10:19raek's web frameworks for that
10:20RaynesGood luck with that.
10:20raekring (and thus compojure) is servlet-based
10:20raekI'll invsetigate it it's worth the effort
10:20jliokay, I think it's because I'm concat'ing onto my result ref, and concat is lazy
10:20jlidoes that make any sense?
10:22raekwell, lazy sequences (concat is one of them) and side-effects doesn't play very well together
10:23raekwhat do you mean with "concat
10:23raek'ing onty my result ref"
10:23raekonto the contents of the ref??
10:24jliI have my reference to a set. I have a thread pool. the tasks that I run generate collections. I want to collect all the collections, so I concat each one to the set in a dosync
10:24jlimaybe I should be using pcalls, or something?
10:24jlioh, I should use doseq to force it, right?
10:25dnolen_jli: doall
10:25raekdoall forces a lazy sequence
10:25raekdoseq is just (dorun (for ...))
10:26jlinice! that was it. thanks dnolen_, raek.
10:28dnolen_jli: concat will convert your PersistentHashSet into a LazySequence
10:28dnolen_,(reduce conj #{} [1 2 3 4])
10:28clojurebot#{1 2 3 4}
10:29Raynes-> (into #{} [1 2 3 4])
10:29sexpbot=> #{1 2 3 4}
10:32dnolen_Raynes: yeah into is better
10:33jli(into current-ref new-data), yay
10:51otfromIs anyone about who is familiar with pallet?
11:15slyrus_is there a built-in function to convert a java 2d array to a vector of vectors?
11:16slyrus_(vec (map vec (vec ...))) ?
12:38notsonerdysunnyis adding an additional argument the only way to simulate return-type polymorphism ... or is there a better way?
12:41raekthe polymorphism mechanisms provided by clojure only does dispatch based on the arguments
12:42notsonerdysunnyyea I know .. that is why I said "simulate return-type polymorphism" .. :) .. but I see what you are saying ..
12:42raeknotsonerdysunny: you want to dispatch differently based on what type the function is expected to return?
12:43notsonerdysunnyraek: yes
12:43raekI guess the called would need tell the function what it want it to return
12:43daakui'm a defmacro n00b, and can't quite get why this doesn't work: http://gist.github.com/489676 or how to debug what the hell is going on :) -- it's a 2 line macro which involves calling another macro
12:43notsonerdysunnyso the function would be lazy .. probably created by application of partial
12:44raekdaaku: have you tried using macroexpand-1 ?
12:44raekyou can use that to see what the macro expands to
12:44lozhYou've missed the ` off the start of the macro form I think
12:44raek,(macroexpand-1 '(and a b))
12:44clojurebot(clojure.core/let [and__3464__auto__ a] (if and__3464__auto__ (clojure.core/and b) and__3464__auto__))
12:45daakucool, let me try those things
12:45raekthe asgument you pass to it should be the code, and since macroexpand-1 is a function it needs to be quoted so that it isn't evaluated by clojure first
12:45clojurebotclojure-stub is http://github.com/nakkaya/clojure-stub/tree/master
12:47raekdaaku: it often helps if you write a sample input and the the code you want that to become
12:47raekin the simple cases, it's often just a matter of putting everything in a syntax-quote (`) and putting unquotes at the right places
12:48raekalso, you should not (except under special circumstances) need to resort to ~'
12:50daakuraek: cool, thanks for the info -- i've been trying different things to see how it plays
12:50daakui added sample input and output as you suggested: http://gist.github.com/489676
12:50daakui think what makes this trickier is that inside the macro i'm using another macro
12:51raekmacros are simply functions from code to code
12:51daakuthe (select ...) is a macro
12:51raekif the macro expansion contains a macro, that will be expanded when the compiler gets to it
12:51raekbut that's after you macro is done with the code
12:53daakudoes the compiler to macroexpand or just the first level? i think what i'm running into is that i want the compiler to not expand the (select ..) macro at load time, but don't quite have that figured out
12:53raekthat would be (defmacro entity-exists [kind conditions] `(= 1 (count (:result (select-batch (where ~kind (~conditions)) 1)))))
12:54raekif the compiler sees a macro, it does the expansion
12:54daakuraek: nice. that works
12:54daakuraek: now to understand why :)
12:54raekthen, it continues with the new code
12:54raekjust like if you had typed that instead
12:55daakuit's like a really smart s/macro-call/expanded/ before the compilation
12:55daakuor as part of the compilation rather?
12:56raekit's done somewher in the "compler parts" of clojure... that all i know. :)
12:58raekalso, ` is just a convenience feature so one does not have to make tons of nested (list ...) calls to build the new code
12:58raekthe code outside the syntax quote is executed during expand-time
12:59daakuraek: yeah, that was what i didn't get
12:59daakui thought everything inside a defmacro is part of expand-time
12:59daakubut now that seems obviously limiting :) so it all kinda makes more sense
13:02tommgHi! I'm just starting to learn Clojure and I came across a tutorial that uses leiningen - I'm using snow leopard and have this installed but whenever I use the command: lein deps I always get errors saying it cannot satisfy dependencies. It looks like its downloading what it needs then errors with '7 artifacts are missing' error - is this the best place to ask?
13:03raekhere and in #leiningen is fine, I think
13:04ihodestry running lein clean; lein deps
13:04ihodesand make sure you're not behind something like WebSense (or another firewall) that could stop access to Clojars.org.
13:04raekI don't have much advice, but if everything else fails, try removing the local repository
13:04raek~/.m2 in unix
13:05ihodestruth, you can rm ~/.m2 and try again
13:05clojurebotit's a UNIX system! I know this!
13:05tommgthanks, ill try again with it - it just seems like it failing to download from the repo's but it doesn't mention this - although I have checked the sites and the paths do exist
13:05hiredmanalso likely you have the wrong names/versions of artifacts so of course those artifacts cannot be found
13:07tommgahah!
13:07tommgremoved my local repo and its working now
13:07tommgthanks! simple
13:08ihodesgreat! lein is a great tool. learn to love it ^^. i'd also check out cljr (http://github.com/liebke/cljr) for jus ttestign out ideas you have with a quick repl
13:18ihodesdoes anyone have any suggestions for a Java or Clojure lib that can handle drawing a hundred thousand point xy-plot in under 30 seconds? Incanter isn't able to on my c2duo
13:19ihodes(which uses JFreeChart)
13:29notsonerdysunnygiven a function can I find out how arguments it needs in a programmatic way ... ( i know slime does ... this ..) but otherwise ..is it possible?
13:31rhudson,(:arglists (meta #'reduce))
13:31clojurebotnil
13:31rhudsonhmm, that worked in my repl
13:32ihodes*clojure-version*
13:32ihodes,*clojure-version*
13:32clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
13:33ihodes,(meta #'reduce)
13:33clojurebot{:ns #<Namespace clojure.core>, :name reduce, :file "clojure/core.clj", :line 773}
13:33ihodesodd...
13:33ihodesdoesn't have as much here...
13:33ihodesworks in my repl as well.
13:34rhudson-> (:arglists (meta #'reduce))
13:34sexpbot=> ([f coll] [f val coll])
13:35rhudson-> (clojure-version)
13:35sexpbot=> "1.2.0-beta1"
13:36tomojbut it doesn't really work
13:36tomoj(:arglists (meta #'apply)) gives ([f args* argseq]) for instance
13:36hiredmanand only works on vars
13:37rhudsonBut it's all that's available at runtime, unless there's some IFn method that can cough up info
13:38raekhrm, I'm looking for a blog which recently compared the "craft of coding" to being a cook
13:38raekanyone seen that?
13:38notsonerdysunnythanks rhudson ..
13:39raek,(:arglists (meta #'map))
13:39clojurebot([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
13:39raekreduce is a protocol method now
13:39rhudson?
13:39raekthose should also set the arglists metadata, imho
13:40raekbut apparently, the doesn't now
13:40daakuanyone using compojure? i'm wondering how i'm supposed to get the ring request object (need to access cookies)
13:40hiredmanrhudson: fns are just objects, so you can do various reflection things to them
13:40rhudsonright
13:40raekdaaku: the request map is what is handed to your handler
13:42raekok, I take it back: reduce is not a procol method (internal-reduce is)
13:42daakuraek: isn't that for a ring handler? my compojure handlers (the ones setup using defroutes) seem to get url/form/query params
13:42raekthe old 0.3 versions binds the request map to the magic variable 'request'
13:43raekin the 0.4 versions one has to provide a name for the request manually
13:44raekdefroutes makes a ring handler
13:46raekhrm, I can't find the docs where I saw it
13:48daakuraek: i see, i'm using 0.4. i can't find docs, and i'm not smart enough to figure out what's going on looking at the source here http://github.com/weavejester/compojure/blob/master/src/compojure/core.clj
13:50raek(defn- compile-route [method route bindings body]
13:50raek(GET "toute" <bindings> <body>)
13:50raek*route
13:50raeknow I found where the bindings should go
13:51daakubind-request does the heavy lifting?
13:51rhalltomoj: thanks for your help yesterday with swank.core/break... turns out my project was polluted with some version mismatches... I cleaned it up and everything is fine now
13:52raekappears so
13:53raektry (GET "..." request <body>)
13:55raekas far as I can tell from the code, that should result in a (let [request <request-map>] <body>)
13:55daakuraek: so that worked, but i can't understand why -- i see that we get into the else clause of the if in bind-request
13:55daakucool, i think i get it now
13:56raekI can swear I have seen some docs exaplining this
13:56raekbut compojure seems to be a turbulent project
13:57raekapparently, a lot of it's functionality was accumulated into ring
13:57raekI've only used the 0.3 versions
13:58daakui'm just getting started, and i'm not so sure i should be using compojure or ring directly
13:58daakui started off with a sample app engine project, so kinda stuck with it
13:59raekthe projects I'm aware of are: compojure, ring, moustache and aleph
14:04daakualeph seemed cool. i've been using nodejs for random projects, and while the async nature gave huge perf gains, the callback model sucked. i was surprised to see aleph perform so well.
14:06raekI'm considering using moustache, due to it's nestable nature
14:07raekI want to generate the routes from another hierarchy
14:07raeklike saying, foos has many bars, and automatically get urls like /foo/1/bar/2
14:08daakui hadn't see this -- i thought you were refering to the templating language
14:08daaku*seen
14:12daakui think i need to try this
14:12daakuthanks for pointing it out raek
14:40gfrlogtest
14:42gfrlogDoes anybody know about why functions like split-with are implemented so inefficiently? (http://github.com/richhickey/clojure/blob/a1eff35124b923ef8539a35e7a292813ba54a0e0/src/clj/clojure/core.clj#L2212)
14:42gfrloglike is it a subtlety involving lazy seqs, or has nobody gotten to it yet?
14:42gfrlog(basically I'd be happy to do it, just wanted to make sure it wouldn't be wasted effort)
14:45qbggfrlog: The results of take-while and drop-while are lazy, so they won't be evaluated until needed
14:45gfrlogbut that implementation will still evaluate them twice, won't it?
14:46qbgEvaluate what twice?
14:46gfrlogthe predicate
14:47qbgIf you are forcing both of them all the way, yes
14:47gfrlogso is there no way to do it lazily without double evaluation?
14:49qbgYou should be able to, but it wouldn't make much of a difference unless the predicate was expensive
14:50qbgBenchmarking would be needed to see if there would be any real gain
14:50somniumgfrlog: it returns two different lazy-seqs, I think you would have to do the take-while part eagerly to only evaluate the predicates once
14:51gfrlogoff the top of my head I would think something like this:
14:52qbgI'm going try to write it with only one evaluation of pred
14:52gfrlogmap the collection to pairs of the elements and the results of the function, then create a take-while and a drop-while that just examines the computed result, and return something that maps the elements back out
14:52gfrlogI was gonna write code, but then I thought explaining it might be clearer. Now I think I would've been better with code
14:52gfrlogone sec
14:53gfrlog'(1 [:a :b :c])
14:54gfrlog,(1 [:a :b :c])
14:54clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
14:54ihodesother way around
14:54gfrlog,([:a :b :c] 1)
14:54clojurebot:b
14:54gfrlogvery good
14:56gfrlogokay
14:56gfrloghttp://gist.github.com/489785
14:56gfrlog(my-split-with #(> % 0) [5 1 2 3 -2 -1 0 1 2])
14:56gfrlog[(5 1 2 3) (-2 -1 0 1 2)]
14:57gfrlogI've never contributed anything to the codebase before -- does anyone know if this sort of thing would be welcome?
15:01qbgYour split-with is about 3.27 times slower that the built in one for a simple predicate
15:01somniumgfrlog: that version does add an extra lazy seq that both close over. some cases (eg: my-split-with identity [ ... ]) might get slower too.
15:02qbg#(< % 0) on the coll (range -10000 10000)
15:02somniumgfrlog: in any case, you may want to read:
15:02somniumhttp://clojure.org/contributing
15:07gfrlogSo I suppose this has already been thought through, and the conclusion is that for large predicates the programmer should create his own implementation?
15:10gfrlog,((fn [x] (x x)) (fn [x] (x x)))
15:10clojurebotjava.lang.StackOverflowError
15:12raeknice, my CA got in
15:17raekcan somewhone here who's a member on the assembla space bump up my membership from watcher to member?
15:25gfrlog, (*
15:25clojurebotEOF while reading
15:25gfrlog (*
15:25gfrlog (+
15:25gfrlog (+ (*) (*))
15:25gfrlog (*))
15:25gfrlog (+
15:25gfrlog (*
15:25gfrlog (+ (*) (*))
15:25gfrlog (+
15:25gfrlog (+ (*) (*))
15:25gfrlog (*)))
15:25gfrlog (*)))
15:25gfrlog (+ (*) (*)))
15:26gfrlog,(* (* (+ (+ (*) (*)) (*)) (+ (* (+ (*) (*)) (+ (+ (*) (*)) (*))) (*))) (+ (*) (*)))
15:26clojurebot42
15:28serp_,(*)
15:28clojurebot1
15:40chousercute
15:41rhallcan anyone point me to doc on the contents of the project.clj file?
15:42raekrhall: http://github.com/technomancy/leiningen
15:42raekrhall: http://github.com/technomancy/leiningen/blob/master/sample.project.clj
15:42raekthe second link contains more details
15:43rhallok, yeah... read that... I was wondering if there was an actual manual, or if that sample contains all the options
15:43map_reducehey, i've got a memory management question: I've got about 1.3M lines of data split over 32 files. I open up the files using (map #(duck-streams/read-lines %) file-list)) . Then I pass the map into seq-utils/flatten. Everything works just fine, but when I was doing some tests, I noticed that just asking for (count (flatten etc... )) my memory usage skyrockets. Does this mean i'm some how maintaing a reference
15:43raekthere's not much more than that
15:43rhall(thx, tho raek... didn't mean that to sound so "short")
15:43raekother plugins may more keys to the defproject form, of course
15:44rhallyeah... what I'm really trying to work out is how to include a fairly large directory of jars
15:44rhallwithout coping them all to my lib dir
15:45raeknow I will attempt to use leiningens new checkout dependecy feature
15:45Drakesonwhich swank-clojure is most common? technomancy's ore jochu's?
15:45raektechnomancy's
15:45raekjochu was the original maintainer, but technomancy is the current, IIRC
15:46chousermap_reduce: probably
15:47DrakesonI see. could someone with commit access please fix the completion? (src/swank/commands/completion.clj and .../contrib/swank_c_p_c.clj need a very minor fix)
15:47map_reducechouser: are there some basic things I should look for to debug this?
15:47lozhmap-reduce: try running java with a reduced heap size, if it doesn't go oom it could just be a garbage collection artifact
15:47Drakesontechnomancy: ping
15:48map_reducelozh: cool thanks, i'll try that
15:48raekDrakeson: if you have a github accound, you can fork it, patch it, and send a pull request to technomancy
15:49Drakesonraek, yeah I know, I am probably being lazy. the fix is basically a typo, though
15:51raekhe might be busy with his job, but he will take a look at your pull request eventually
15:51Drakesonraek: nevermind, I'll do that if I cannot reach him
15:51raekI made a small 2-line patch for clojure-mode once
15:53raekcan one delegate commit acces on github?
15:54Drakesonraek: there is this "organization" thing, targeted at businesses that pay monthly, ...
15:55map_reducelozh: thanks, i just played with the heap size and set it to a uselessly small number. The reported memory usage went down by about 40% and the thing still didn't squak
15:55Drakesonapparently they occasionally allow free software projects to use that, though.
15:56raekyeah, saw that clojure got an organization account recently
15:58DeranderDrakeson: yeah, I think that suitably large foss can get those accounts because they figure it'll draw in more profitable users than it costs
15:58hiredmanhuh?
15:59hiredmanI think you can just start an organization
15:59hiredmanseajure (seattle clojure group) has one
15:59Deranderoh, yes. I'm wrong
15:59DeranderI was mixing private/public in my head
16:01edbondhow to create a subclass of java class in clojure?
16:02raekedbond:
16:02raekhttp://clojure.github.com/clojure/clojure.core-api.html#clojure.core/proxy
16:02hiredmanedbond: don't
16:04raekifaik, proxy is for interfacing with java when the api requires subclassing
16:05edbondI want to subclass Folder from javax.mail but don't want to do this in java.
16:05raekhiredman: what are the alternatives?
16:06raekedbond: proxy will let you do it.
16:06edbondok, thanks
16:06Raynesraek: He sells magic wands.
16:08raekinheriting from classes is not very clojure-ish, and should not be used when designing clojure code
16:08raekbut clojure cannot fix java
16:24daakuis there a way to figure out what's pulling in a specific dependency in lein?
16:46hugoddaaku: you could run "mvn dependency:tree", which would use the lein generated pom.xml
16:47daakuhugod: cool, it's running
16:48daakunice, that worked
17:07BahmanHi all!
17:11daakuanyone know of a good library (or plugin) for running app engine via lein repl? i have a bunch of hacks that work from various places atm, looking for something better
17:12raekthere is a lein-gae plugin
17:12raekI have never used it nor app engine, though
17:15daakulooks like that's for setting up the stub xml and the dependencies
17:31raekanyone know if Apache License v2.0 is compatible with the EPL (clojure's license)?
17:37Raynesraek: I believe so.
17:38raekjust investigating if openid4java can be used at all
17:38raekit's really sad that there are incompatible free software licenses
17:39raekbut at least the clojure world seems to use the same license
17:40raeksomeone should make a license compability graph...
17:40raekthat would be awesome!
17:41raeklike this, but not only to/from GPL: http://www.gnu.org/licenses/quick-guide-gplv3-compatibility.png
17:48quidnuncIs there a specific reason clojure wasn't GPL licensed?
17:49quidnuncnvm, clojure.org/funding
17:54raekhrm, TagSoup has that license too, and I recall that I found out that its license should be compatible with the EPL
17:57raekthen, what license should a openid4java wrapper library for clojure have? Apache or EPL?
17:57raekboth?
18:24gfrlog,(take 11 (iterate dec 10))
18:24clojurebot(10 9 8 7 6 5 4 3 2 1 0)
18:29seancronDoes anyone know how can I do (while swing-window-is-open ...) in clojure?
18:31raekI suspect you could do an event handler for the close event and update an atom, or something
18:34seancronI'm working with Incanter and I want it to continuously set-data until I close the table window
18:39raekmaybe you could subclas WindowAdapter with proxy and implement windowClosing/windowClosed
18:39raekand add it to the frame with addWindowListner
18:39seancronraek: here's the code I'm using right now http://gist.github.com/489954
18:40raekyou'd need to get access to te JFrame
18:41raekI'm not an incater user (yet), so I don't know how
18:43seancronIt looks like (view ...) returns the JFrame
18:45raekthen you could invoke .addWindowLister on it and pass your proxy object
18:59seancronIs there a break statement in clojure?
19:00gfrlogwhat would it do?
19:01seancronBreak out of an infinite loop that's updating a window
19:03raekno, you'll have to "not loop" instead
19:04raek(loop [] (when @running (do-stuff) (recur)))
19:04raek(here running could be an atom containing a boolean)
19:06seancronwhat does the @ do?
19:06gfrlogdereferences the atom
19:07gfrlog'running' refers to the atom, while '@running' refers to its current value
19:07gfrlog(it could also be a ref or agent with the same syntax)
19:08seancronThank you. Still getting the hang of clojure
19:08gfrlognp
19:08raek@foo is the same as (deref foo), if you need to lookup some details about it
19:08gfrlog,(let [a (atom true)] (println a) (println @a))
19:08clojurebot#<Atom@17d8325: true> true
19:09gfrlog(doc deref)
19:09clojurebot"([ref]); Also reader macro: @ref/@agent/@var/@atom/@delay/@future. Within a transaction, returns the in-transaction-value of ref, else returns the most-recently-committed value of ref. When applied to a var, agent or atom, returns its current state. When applied to a delay, forces it if not already forced. When applied to a future, will block if computation not complete"
19:10raekthe concurrency primitives (ref/agent/var/atom) are used rather than mutating variables
19:11raeknames introduced by let aren't even called "local variables" (instead, often just "locals") since they cannot be changed
19:12raekthe concurrency primitives provide different solutions for doing "variable assignment" in a multithreaded environment
19:14seancronOkay, thanks
19:45seancronIs there a more idiomatic way to pause for 10 seconds than (. Thread (sleep 10000)) ?
19:47gfrlogthere sure oughta be
19:47raek(Thread/sleep 10000)
19:47Lajlaraek, does Clojure support the COMEFROM statement to create a new thread?
19:48raekbut other than that, none what I'm aware of
19:48raekLajla: never heard of that
19:49Lajlaraek, essentially an inverted GOTO.
19:49LajlaIf the program hits a certain line number, it automatically jumps back to the point where you put the COMEFROM statement.
19:49LajlaLike, if you put COMEFROM 120:
19:49LajlaThe moment you hit line 120, execution continues at that label.
19:50rlbhttp://en.wikipedia.org/wiki/COMEFROM
19:50LajlaIrrespective of what is on line 120
19:50LajlaSo, if you have COMEFROM 120: on different palces in your program.
19:50LajlaYou start different threads if you end up at 120.
19:50raekah
20:03Lajlaraek, but does it?
20:04raekLajla: what do you think? :)
20:07daakuis there a url query string parsing/generating library for clojure (maybe full blown url parsing library)?
20:08Lajlaraek, who made the bot ignore me?
20:09aldebrnI have an xml-derived hash map, with a key :tag which can take on multiple values such as :title, :section, and :paragraph. For each of these possibilities, I have an eponymous function. What's the right way to invoke e.g. the paragraph function when the value is :paragraph?
20:09aldebrn(Multiple values as in, one of a finite set of values)
20:09raekdaaku: java.net.URL could be used
20:09raek,(bean (java.net.URL. "http://clojure.org/api&quot;))
20:09clojurebotjava.lang.reflect.InvocationTargetException
20:10raekuser=> ,(bean (java.net.URL. "http://clojure.org/api&quot;))
20:10raek{:path "/api", :protocol "http", :authority "clojure.org", :host "clojure.org", :ref nil, :content #<HttpInputStream sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@1ae90c>, :class java.net.URL, :defaultPort 80, :port -1, :query nil, :file "/api", :userInfo nil}
20:10daakuclojurebot fail?
20:11daakuoh, wow. bean huh
20:11raekprobably the sandbox disallowing it
20:12raekbasically, it turns the object into a read-only map, with each key representing a getter method
20:13daakui'm not a java guy, so forgive me if it's obvious, but isn't that a bad thing to go call every getter function?
20:13daakuor are beans special in that getters are always light weight?
20:14raekit only calls the function when you get the value of the key
20:14raekit returns an object that implements APersistentMap
20:14daakuof course, lazy clojure
20:15daakui'm ashamed of how much code i keep deleting. i had 200 lines of code this morning, now i'm down to 160.
20:15daakuand that's after _adding_ functionality
20:15raekI had the same experience when I started with clojure
20:15raekthe more I coded, the more the code shrank
20:16daakuit's both gratifying and demoralizing at the same time
20:17raekaldebrn: if I understood your question correctly, you could use multimethods
20:17raek(defmulti some-fn :tag)
20:18raek(defmethod some-fn :title [m] code-for-when-tag-is-title)
20:18raekthe third argument to defmulti is the dispatch function
20:18raek(keywords are functions too and works like this: #(get % :tag) )
20:19raekthe distpatch function is applied to the arguments of a some-fn call and returns a value
20:19raekthat value is used to choose which implementation to invoke
20:19raekhope this helps, now I need to sleep
20:20aldebrnThanks raek, I could implement just that
20:20raekLajla: I have no idea
20:20raekgood night
20:20Lajlaraek, it was you wasn't it.
20:20Lajlabeause you're angry that yu couldn't have me.
21:44seancronraek: I realize you're asleep right now, but thanks for your help. I finally my code working. It now updates the data table every 10 seconds and actually exits on closing the window. If you want to see what I ended up with, you can check it out at http://gist.github.com/489954
21:46Lajlaseancorfield, an I take the thanks instead then?
21:47seancorfieldhuh? oh you mean seancron
21:52Lajlaseancorfield, I do.
21:52LajlaDamned autocomplete.
21:52LajlaAny way, you can thank and worship My Shadow too.
22:13daakuis there a private equivalent of def? i need to hold a private vector which will never change
22:18gfrlog(def #^{:private true} my-vector [:a :b :c])
22:18gfrlogI think
22:19hiredman#^ is deprecated, use ^
22:19gfrlogooh nice
22:19gfrlogI always thought that looked clunky
22:19hiredmanif you are on master I think ^:private should work
22:19daakubeta1?
22:19hiredmanbut maybe not for 1.2-beta?
22:20hiredmanI think the ^:private stuff comes with the static branch, which isn't part of 1.2
22:20hiredmanso in 1.3 ^:foo is equiv of ^{:foo true}
22:21daakuhiredman: yep, didn't work in 1.2
22:21hiredman:/
22:21daakuthe map syntax did, so good for now :)
22:22gfrlogalso, a shortcut when using defn is defn-
22:22gfrlogat least in the tired worn out versions of clojure that I use
22:22daakuyep, i was hoping there'd be def-
22:23daakuhehe
22:25daakuhow "moving" would you say the clojure core/libraries are? do things change in breaking ways often?
22:25daakujust trying to get a rough idea, i know this is subjective
22:30brehautis there a way to create a set (eg hash-set) from a seq where it discards duplicates rather than raising an exception?
22:33rhudsonbrehaut, I think you only get exceptions with duplicates in set literals
22:33brehauti had thought that
22:33rhudson,(into #{} [:a :a :a :a :a :a])
22:33clojurebot#{:a}
22:33brehaut,(apply hash-set [:a :a :a])
22:33clojurebotjava.lang.IllegalArgumentException: Duplicate key: :a
22:34brehautthats probably why im having a problem ;)
22:34rhudsonbut that's equivalent to (hash-set :a :a :a)
22:34gfrlog,(hash-set :a :a :a)
22:34clojurebotjava.lang.IllegalArgumentException: Duplicate key: :a
22:36brehautyes it is
22:36brehautbut its what im doing ;) i dont hav ea literal vector to fill from
22:36brehautinto ftw anyway