#clojure logs

2010-06-23

00:00dnolen_so yay, nay? no one using clj-apache-http ?
00:12gstamp_is the macroexpand feature in swank-clojure not working for anyone else? When I try and expand a macro I just get the name of the macro back rather than the expansion
00:17tomojgstamp_: where's point when you do it
00:18gstamp_on the macro name itself
00:19tomojput it on the opening paren
00:20gstamp_great. thank you, that works
00:20tomojI thought it used to clean it up a bit, but mine doesn't anymore
00:32dnolen_tomoj: I patched it, you need to use swank-clojure from HeAD
00:33tomojcool
00:33tomojwas that a regression or was it my imagination?
00:33dnolen_tomoj: things broke because of clojure 1.2.0 work
00:34tomojah
00:43tomojdnolen_: very nice, thanks :)
00:43dnolen_tomoj: np
00:43tomojfor is such a monster
00:43tomoj47 lines for (for [x (range 10)] x)...
00:45dnolen_Clojure is like the most awesome Object Oriented language evar
01:21defntomoj: did you look at the challenge problem
01:24tomojyep
01:24tomojhaven't thought much about it, though
01:30defnhelp me solve it :)
01:39tomojdepth-first search can't be right, I guess
01:46defnactually i think that will work
01:48tomojbut it will be too slow, won't it? :(
01:52defnyeah :(
01:52defnI think using symmetry can help
01:53defnyou could do depth first but discard bad paths early in the search
01:54defndetecting when a path splits the grid into two unconnected pieces could be helpful maybe???
03:02Licenserhmm the agent pool thingy is really hurting clojures performance :(
03:36BahmanHi all!
03:37BahmanI am new to Clojure and just learning it.
03:38BahmanI am Bahman from Iran.
03:39BahmanBTW, what's the difference between "remove" and "drop-while"? I can't find out how they differ.
03:39LicenserGreetings Bahman :) it is a good decision to learn Clojure, it's a wonderful language!
03:40tomoj,(drop-while even? [2 4 6 1 3 7 8 10])
03:40tomoj$(drop-while even? [2 4 6 1 3 7 8 10])
03:40sexpbot=> (1 3 7 8 10)
03:40tomoj$(remove even? [2 4 6 1 3 7 8 10])
03:40sexpbot=> (1 3 7)
03:40Licenser$(drop-while odd? [1 3 2 1 4])
03:40sexpbot=> (2 1 4)
03:40Licenseroh darn you tomoj ;P I was about to give the exact same esaple just with odd
03:40tomojsorry :(
03:41BahmanYes Licenser...I've always liked to learn Lisp but the problem was that as I'm a Java developer I'm used to read-to-use high-level components like Workflow engines which Lisp lacked.
03:41BahmanFortunately Clojure doesn't have this problem.
03:41Licenser*nods* You'll also find the comunity qite friendly :)
03:42BahmanLicenser: Yes..it seems so :-)
03:43Bahmantomoj: 8 is even...why it's not dropped?
03:43LicenserBahman: drop while drops the first elements as long as the condition is true
03:43Licenserremove removes all elements for that the condition is true
03:44Licenserso drop-while stops as soon as it finds a element that does not match the condition
03:44BahmanLicenser: I see the point. Thanks.
03:44Licenser:)
03:44Licenserwelcome
03:45BahmanSo, is it alright to ask here such silly questions if I'm stuck? :-D
03:46BahmanOr should I use the forums (if any)?
03:46LicenserOf cause it is, most of us started like that :P
03:47BahmanGood for me :-D
04:13KjellskiHow would you do this idiomatically? I want to parse a file with "newline" separated textblocks. I want to group these blocks, which are themselves csv. I´ve already slurped the data in and parsed it with
04:14Kjellskiclojure-csv. Now I´ve got the vector over vectors, wich I want to separate with the elements [""] in there..
04:14KjellskiAny ideas?
04:14LicenserI'd make do (re-seq #"[^\n]" data)
04:14KjellskiOn the file?
04:14Licenserah okay you areldy have something
04:15KjellskiOkay, and after that use parse-csv?
04:15Licenserwell won't clojure-csv not already do that for you?
04:15Licensernever used the cloure-csv lib
04:15KjellskiYes, but it´s a vector over vectors, which I want to group elements from...
04:16AWizzArd,(doc group-by)
04:16Licensera vector of vectors, I guess it are vectors of fields in vectors of lines right?
04:17AWizzArdOkay, clojurebot is offline. But maybe clojure.contrib.seq/group-by
04:17KjellskiAWizzArd: Thanks, I´ll have a look at that... ;)
04:17Licenser$(doc group-by)
04:17sexpbot=> ------------------------- clojure.core/group-by ([f coll]) Returns a map of the elements of coll keyed by the result of f on each element. The value at each key will be a vector of the correspon... http://gist.github.com/449631
04:17KjellskiLicenser: thanks, I´ll have a try....
04:18Licenserhmm I apearently suck at making clojure code fast .P
04:19sparievLicenser: you should write some ruby - it'll help you to stop worrying about clojure speed :)
04:19Licenserspariev: :P
04:25Licenseractually it's not slow it's an infinit loop
04:34Licenserhmm what was the function to divide two integers?
04:34Licenserrem was the reminder but I never can remember the name of the other one :(
04:35spariev$(doc quot)
04:35sexpbot=> ------------------------- clojure.core/quot ([num div]) quot[ient] of dividing numerator by denominator. nil
04:36LicenserThank you!
05:06LicenserHmm I just tried to implement a few benchmarks in clojure and I noticed that it's beauty quicky gets burried under a heap of performance measures :(
05:11eevar2Licenser: profiling overhead?
05:11Licensereevar2: no what I mean is when you want to get close to java'ish speed you've to do tons of ugly things
05:11Licenserand it still isn't exactly fast :P
05:12eevar2ah. missed "beauty" in that sentence
05:12Licenserclojure is great because solutions look clean and nice in it, are easy to read and understand
05:12Licenserif you want to get it fast this gets lost and you write java with parens in different places (at least that is what it feels like to me right now)
05:13Fossi well, most "benchmarks" are actually pretty screwed anyway
05:13eevar2if you stick to the same algorithms, i.e. using loops instead of creating lists and so on, performance isn't all that different?
05:13Fossiwell i guess that counts as "ugly things"
05:13eevar2might not be quite as idiomatic, but
05:14Licensereevar2: yes it does kind of
05:14Licenserbecause you can't really use any of the build in functions since they are slow
05:14Licenserwell not slow slow but compared to pure javaish code they are slow
05:15Licensermy first atempt was quite nice looking short and well slow
05:16Licensernow it gets slowly more and more ugly as it gets faster and faster
05:18tomojLicenser: you have a java version written?
05:18LicenserI know where one is but I haven't written it myself
05:21tomojare you planning to blog this attempt?
05:21Licensertomoj: yes as sonn as I'm happy with it but I'm not :P
05:21tomojusing prim?
05:21tomojdunno how much that would help
05:21Licenserhttp://gist.github.com/449687 if you want to look
05:21Licensertomoj: yes using prim
05:22LicenserI want to see how much worth the changes are
05:22tomojthe lisp code in that paper is horrifyingly ugly
05:23AWizzArdIn what way?
05:23Licenseras in if you really benefit from it when writing fast code
05:23Licenserand while being nearly convinced that the tradeoff is worth it, I slwoy think again it isn't since you anway have to make it ugly if you want it fast
05:24bobo_why is ugly code always faster then pretty code? in all languages, feels so wrong
05:24Licenserbobo_: I agree :I(
05:24Licenserbut I think it isn't in assembly
05:24BahmanLicenser: Look at the C code: SMALL k2=(k+1)>>1 ...it's somewhat a cheating :-) You can only do such things in C or Assembly.
05:25bobo_assambly is always ugly
05:25eevar2Licenser: _are_ you profiling btw, or just fumbling around blind? ;)
05:25Licensereevar2: I know what is slow, I managed to reduce the overhead to nearly 0 in my algorithm
05:25Licensernow the only thing that is slow is the permutations
05:26Licenserat least that is what I think
05:26Licenserbut I'm not using a profiler as they always make me itchy
05:26LicenserI do profile by hand so (as in removing bits of code to see the impact)
05:27Licenserto make this fast I need to implement the permutations myself on a static mutating *cry* array
05:27Licenseras I did with the reversing part
05:27hoeckLicenser: and did you measure the differences of a relatively beautiful fannkuch benchmark in prim and normal clojure?
05:27Licenserhoeck: I admit no
05:27Licenserbut I should do that
05:28hoeckbecause that would be really interesting to see
05:29Licensertrue
05:32hoeckLicenser: do you have a nice looking but easily understandable and probably slow version of the fannkuch benchmark?
05:32Licenserhoeck: yes give me one second to make sure it is correct :P
05:33hoeckgreat :)
05:35Licenserit is still testing :P
05:36LicenserI got the source for scala from http://shootout.alioth.debian.org/u32/program.php?test=fannkuchredux&lang=scala&id=1 too
05:36Licenserfor this clojure sadly is 10 times slower :(
05:36Licenserin the optimized version that is
05:36Licenserand 60 times lower in the nice one
05:37Licenserhttp://gist.github.com/449701 the nice code
05:37LicenserI find this pretty ideomatic at least
05:37bartjhi all
05:38hoeckLicenser: thanks
05:38Licenserwelcome hoeck I might push the entire thing to github too
05:38Licenserperhaps others are better then me at making things fast <tm>
06:08Licenserhoeck: http://gist.github.com/449731
06:08Licensertest results
06:08bartjI am not able to appreciate the value of partial
06:08Licenserit is only partially useful bartj
06:15hoeckLicenser: are you measuring the whole jvm execution time?
06:15Licenserhoeck: yes
06:16hoeckwhy?
06:16LicenserI know it is not exact
06:16hoeckno warmup etc etc?
06:16Licenserbecase it should be the same for every compliation
06:16Licenserthe multiplyer should not change
06:16Licenserjust an index
06:16Licenseror rather a static value
06:17LicenserI will push my setup shortly
06:18hoeckbut you are currently measuring jvm and clojure startup performance, not really the pfannkuchen
06:21Licenserhoeck: well for the small numbers yes, but usually I take bigger ones
06:21Licenserwhere you see something like a few secs difference
06:21Licenseror a magnitude of difference
06:22sparievLicenser: have you considered using Criterium http://hugoduncan.org/post/2010/benchmarking_clojure_code_with_criterium.xhtml for benchmarking ?
06:22Licenser*looks at that*
06:22sparievalso, LauJensen has nice post on proper benchmarking AFAIK
06:22Chousukeincluding the jvm startup time and not doing any warmup will not make clojure look good at all :P
06:23Licenserspariev: since I want to not only benchmark clojure that isn't too helpful
06:23Chousukeit also won't be realistic
06:23Licenseractually if 1.1 takes twice as long as 1.2 (for example) that is a quite useful information unels 1.1 starts twice as slow as 1.2
06:26Chousukein those results you posted the actual execution time seems to be obscured by the startup.
06:26ChousukeIt's difficult to tell how well it's actually performing
06:26LicenserChousuke: yes I know that was just to show how it looks I'll post new ones that might be more interesting
06:26Licensersince they are longer runing
06:26Licenserbut yes I know the benchmarks are falwed, as all benchmarks are, I know in what direction they are flawed so I hopefully won't go to draw bad conclusions from it
06:27hoeckLicenser: I'm using criterium too to do the fannkuch
06:27hoeckLicenser: which branch is the one you use
06:27LicenserI use 1.2 master and 1.2 equal
06:28LicenserI will github push the whoel setup in about 2 minutes (then this run should be through)
06:28hoeckLicenser: I mean, I'm looking for the one with magical loops and primitive ops as the default
06:28Licenseryes I push the exact .jars I use
06:28Licenserunless that is prohibited and rhicky will sue me for it :(
06:28Chousukeof course it's not prohibited :P
06:28Licenser:P
06:29Chousukeunless you've done modifications, of course
06:29Licenserhttp://gist.github.com/449748
06:29Licenserhere results now I push
06:29LicenserI compiled them
06:32Chousukethe difference with scala shouldn't be that big, considering you should be able to get jvm-native speeds from numerical calculations now.
06:33LicenserChousuke: I agree but from the code I have it sadly is
06:33Licenserpushing right now but with all the jars in there it take a moment
06:34Licenserbut the difference beteen master and equal is scarry for idomatic clojure code
06:34Licenserit seems the equal branch is slower right now
06:34Licenserat least for this kind of code
06:35Licenser20s difference isn't startup time either
06:35LicenserI wonder what causes this
06:41Chousukedid you remember to use ^:static and type hint as necessary?
06:41eevar2never ever profile your benchmarks
06:42eevar2i hear you can go blind
06:42defnlol
06:44bartjis there a better way to remove empty strings in a sequence than:
06:45bartj, (remove #(= "" (.trim %)) [" " "abc" "" "x"])
06:45bartj,(remove #(= "" (.trim %)) [" " "abc" "" "x"])
06:48sparievbartj: there is also blank? function in c.c.str-utils2/string , which you can use - (remove blank? [" " "abc" "" "x"])
06:49Licensereevar2: you know even I, and I know that might seem as a shock, can only do one thing at a time :P
06:49Licenserhttp://github.com/Licenser/clj-shootout have fun
06:50Licenserbut Chousuke the point was to see how basic code works compared in main and equal
06:50hoeckLicenser: got a clojure build from may competing against equals, old code does (fannkuch 7) in 190ms, equals in 240
06:51bartjspariev: cool, thanks
06:51sparievnp
06:51Licenserhoeck: what? o.O
06:51hoeckLicenser: so we basically made the same observation, that equals is a bit slower on the idiomatic code
06:52Licenserwall 190 vs 240 isn't a bit sadly :( that is about 20%
06:52hoeckright :/
06:53Licensernow the task is to find WHAT makes it slower eevar2 and now I'm going to profile
06:53ChousukeLicenser: that doesn't look like very fast code at all.
06:54LicenserChousuke: I know it is ideomatic code, the nicest way I could come up to write this algorithm
06:54Chousukeand there's next to nothing that would get a benefit from the equals branch
06:56LicenserChousuke: I know but oddly enough it is not too far away from what much clojure code deos: reorganizing lists and gathering data above them
06:56ChousukeLicenser: I think the main problem in the function version is that you're using concat a lot
06:56Chousukethat'll create one *really* lazy seq
06:57ChousukeMy first guess would be that the overhead of laziness is killing performance :/
06:58LicenserChousuke: but it never gets realized fully
06:58ChousukeLicenser: that's the problem
06:58ChousukeLicenser: it creates a whole bunch of thunks :P
06:58Licenseronly the first argument but I'll see once I toss on the horror profiler
07:00Chousukeyou'll have one lazy seq, take one item from it, then make a lazy seq over the rest of it, repeating, until you have a lazy seq times a dozen :P
07:01Licenseractually 38 lazy seqs deep
07:03Licensernow I've to remember how I get this silly profiler to actually profile stuff :P
07:04Licenserthere was some trick to put the the starting class but I don't remember o.O
07:07Licenserah I fear I know what it was :( it was meh
07:10Bootviswhat is the recommended way to store 2-dimensional data persistently?
07:11Licenserit seems reverse costs the most
07:14Licenserdepends on your access method
07:14Licenserif it is 2 dimensional in sense of k/v then a hashmal if it is 2 dimensional in the sense of a matrix then a vector of vectors
07:15Bootvisthanks
07:16Licenseroddly enough both reverse and nthnext (both core functions) have gotten slower o.O
07:32Licenserthis is very odd
07:42BahmanA question: I'm reading "Practical Closure" and I came across this sentence: "When writing idiomatic Clojure, one cannot use sequences too much."
07:43BahmanIs it correct? I think it should be "...once cannot avoid...".
07:46BahmanJust to clear things: I thought Clojure is about sequences but this sentence seems the have the opposite meaning.
07:47cemerickBahman: It's an odd sentence in any case.
07:47cemerickSequences are core to idiomatic clojure.
07:47Licenserseqs are usually your friends
07:49sparievbahman: maybe you should submit this error at the apress site - http://apress.com/book/errata/1312 , oddly (as compared to manning) there is no forum for this kind of stuff
07:49BahmanGood to know that...So it's just a typo.
07:49BahmanThanks everyone.
07:50BahmanWill do spariev.
07:53Licenserit seels Chousuke is right lazy seq, for some reason is slower
07:55ChousukeI think the sentence makes perfect sense.
07:55ChousukeSaying you can't use sequences too much means no matter how much you use them, it's not excessive
07:55ttmrichterWait a second: there's a SECOND book on Clojure out? Cool!
07:56ChousukeBahman: ^^
07:56rfgBahman: I don't think it's a typo, just one of these sentences that doesn't sound right unless you are a native speaker.
07:56cemerickChousuke: of course, you *can* use sequences too much, if they're not appropriate for a given problem. :-)
07:56Licenseractually it seems you can use them too much :P
07:56Chousukecemerick: well, yeah. :P
07:57BahmanOh!
07:57cemerickIt's definitely an odd thing to say.
07:57Chousukecemerick: but a little hyperbole never hurt anyone. much.
07:57BahmanYou're just 30 seconds late rfg :-)
07:58cemerickChousuke: and here I was going to reimpl stuff to use alist seqs instead of maps! :-P
07:58rfgThat's because I'm typing on my phone :)
07:58Licenserso here is the odd thing: running the fannkuchen2 code with doall around the concat makes equal faster, doing it without the concat makes master faster
07:58Chousukecemerick: but maps become alists when you call seq on them!
07:58BahmanSo the sentence is analogous to "priceless"...whatever the "price" it is not enough...no matter how much seqs are used, it's not enough. Right?
07:59ChousukeBahman: it's not *excessive*
07:59BahmanChousuke: Got your point.
08:00cemerickChousuke: right! Clearly, alists (and therefore seqs) are superior to maps! ;-)
08:02AWizzArdcemerick: alists as in CLs alists?
08:03Licenseraaaaaaaaaaaaaahhh lists?
08:03cemerickAWizzArd: yeah, don't worry about it, I'm being sarcastic/snarky.
08:07cemerickmmm, juicy NoSuchFieldError when AOT-compiling
08:09rhickeycemerick: I've got half a cup down, shoot
08:09cemerickrhickey: NoSuchFieldError during AOT: https://gist.github.com/d8ba04dd0613cb7e11ba
08:11BahmanWell, clojure.org seems to be banning access from Inside Iran :-(
08:12rhickeycemerick: have you got top-level calls?
08:12ChousukeBahman: wouldn't it be the other way around :/
08:13cemerickrhickey: No....but, in which direction are you after?
08:13BahmanI don't know...I doubt even those censor-men know about Clojure :-S
08:13ChousukeBahman: ie. Iran would ban clojure.org (Though I have no idea why), not vice versa :P
08:13cemerickrhickey: The reference to the java class is in a fn; the static init in the class is there to support later RT.var lookups (both static and in method bodies).
08:14rhickeycemerick: which version of Clojure?
08:15BahmanChousuke: Maybe...thinking how to find out...
08:15ttmrichterBahman, I'll show you how to work around your censors if you want to talk in private.
08:15Bahmanttmrichter: Will appre
08:15BahmanI appreciate that :-)
08:15ttmrichter(For reference I'm in China and have censorship problems too. ;)
08:16Chousukewhy would clojure.org get blocked? :P
08:16cemerickrhickey: latest snapshot AFAIK: 1.2.0-master-20100607.150309-85
08:16Chousukemaybe because it's hosted on wikispaces?
08:16ttmrichterChousuke: They may share an IP block with something the Iranian government doesn' tlike.
08:18rhickeygreat, going to ggroup starts infinite loop - google fail
08:20cemerickI heard that yesterday too -- which browsers are afflicted? FF does just fine. *shrug*
08:20hoeckstrange, had the same problem a week ago, couldn't even login to gmail, deleting all my google related cookies helped though
08:21rhickeynuked cookies, works
08:22rhickeycemerick: target/classes is clear when you start this AOT?
08:23cemerickrhickey: yeah -- I've triple-checked that at this point
08:23cemerickI can bounce back and forth between success and failure reliably by commenting out the RT.load
08:24rhickeycemerick: have you got a circularity in your static inits?
08:25cemerickrhickey: not that I'm aware of, though wouldn't that cause an error of some kind?
08:26cemerickFWIW, this code is unchanged since the last time it was built ~Feb
08:27Chousukegit bisect? :)
08:27rhickeythe error is really bogus, as every reference to a var callsite is made from within the same class
08:27cemerickChousuke: If I must. I'm not thrilled about the prospect of bisecting ~5 months of clojure commits.
08:28Associat0rdoes Clojure allow unboxed user-defined value tyes (structs) on the CLR?
08:29Chousukecemerick: well, it's a binary search so it won't take *that* long :)
08:29cemerickrhickey: My random initial thought was that the RT.load call isn't setting things up properly for the compiler -- so docviewer__init gets generated, but without certain vars that are only conditionally emitted?
08:30cemerickmy understanding of the compiler is quite out of date, pre-reify
08:32rhickeycemerick: yes, you could not have the callsites flag set, but that would disable both the callsite field generation and the references to it, i.e. as if you didn't have callsites
08:32cemerickright
08:33Associat0rrhickey: does Clojure allow unboxed user-defined value tyes (structs) on the CLR?
08:33cemerickrhickey: so, binding *compile-path* = null before the RT.load in the java class (with a pop after) leads to a successful compile.
08:34cemerickrhickey: The RT.load generates classes missing the callsites, and then the "normal" load sees classfiles already, and just invokes the __init.load(), assuming callsites are already there?
08:35rhickeycemerick: you are getting two different versions of the classes
08:44rhickeycemerick: it used to be that during AOT the compiler loaded the classes from disk, now doesn't to support dynamic classes and interfaces
08:44AWizzArdWhen I AOTed a defrecord, will then (.getClassLoader MyRec) ==> #<AppClassLoader sun.misc.Launcher$AppClassLoader@1ba34f2> while a non-AOTed record will yield something such as #<DynamicClassLoader clojure.lang.DynamicClassLoader@13c7b52>?
08:45cemerickrhickey: then perhaps RT.load should suppress AOT using the same binding I just used?
08:45AWizzArdCould that be a way to build a reliable record? fn?
08:46rhickeycemerick: that's how explicitly loaded files get compiled
08:47cemerickso it is
08:51cemerickrhickey: RT.load has always been a bit hacky; perhaps a method specifically suited for runtime loading of namespaces from Java is warranted, which would then set things up so as to not trip up AOT.
08:51cemerickprobably just an invocation of require, actually
08:52rhickeycemerick: who said you could call RT.load?
08:52rhickeyyou can invoke require
08:52cemerickrhickey: heh, no one! :-P
08:53cemerickBut, tons of people do, because one often needs to load code from Java. A proper support route for that seems reasonable.
08:53rhickeycemerick: require
08:53cemericksupported*
08:53rhickeyRT.var("clojure.core/require").invoke(...)
08:54cemerickrhickey: right as I said before -- but help out the poor java folk, and give them something with a signature like RT.require(String).
08:54rhickeycemerick: the general recipe is - get the var you would use to do the same job from Clojure and invoke it
08:54AWizzArdWe need a better Java API (:
08:55rhickeycemerick: when does that stop?
08:55cemerickrhickey: at some point, but after zero. :-)
08:55rhickeycemerick: try the latest (disables direct binding, as it is doomed)
08:56cemerickrhickey: will do
08:57cemerickrhickey: Some supported host API is still needed though. At least enough to load namespaces and call fns in a java-idiomatic way.
08:57AWizzArdrhickey: Do you have plans to to provide a record? and/or deftype? function?
08:58rhickeyAWizzArd: maybe
08:58AWizzArdWould be very helpful for my Serialization lib.
08:59AWizzArdCurrently I check (parents MyRec) to estimate if something has good chances to be a record
09:02chouserif it's just a matter of a tool to view, create, and delete rules for you, perhaps it could be done outside gmail and then use http calls to make it happen inside
09:04cemerickcontrib failures @ http://build.clojure.org/ just now
09:05cemericknot sure who turn the batlight on for these day
09:05cemerickdays
09:05cemerickwhoa, wonky hudson error
09:09rhickeycemerick: stuart halloway is on that
09:20AWizzArdMaybe if Clojure managed internally a Set of all defrecords/deftypes, then such a lookup could be done easily, without adding empty interfaces and such.
09:22mattreplcan anyone think of a reason why I'd be getting a Var unbound exception from within a deftest? The Var is defined in a "project.core" namespace and the test is defined in a "project.core-test" namespace which references "project.core" via a use expression in it's own namespace def "(ns project.core-test (:use [project.core] :reload-all).....)"
09:23mattreplI'm using master branch, did the most recent pull yesterday.
09:24rhickeyAWizzArd: a marker interface is far superior to a registry
09:24AWizzArdmattrepl: did you just do (def xyz) and then try to access it, without intializing it with a value?
09:24AWizzArdrhickey: ah okay, didn't know that
09:24mattreplAWizzArd: in this case the Var is a function that was defined with defn
09:25AWizzArdJust thought that such a marker interface could be used by any class, even if those are not Records.
09:26mattreplI get similar behavior from the "user" ns in SLIME, strangely it works only if I run slime-compile-defun before attempting to dereference the Var
09:27mattreplI say "strangely" because I didn't have this problem before using a similar project setup
09:29mattreplor rather, "the Var is bounded to a function that was defined with defn"
09:30mattreplI have an idea of what would be broken, but I'm not sure why others wouldn't have already reported it... diving in...
09:30mmarczykrhickey: about the ggroup infinite loop, deleting all googlegroups.com cookies fixed it for me
09:31rhickeymmarczyk: yes, me too
09:31mmarczykrhickey: perhaps there were some groups.google.com cookies too... not sure
09:31mmarczykah, ok then :-)
09:31rhickeycemerick: any word on latest and your problem?
09:32cemerickrhickey: sorry, got caught by a call; another 15m anyway
09:43mmarczykhm, I've got a (defprotocol ToSQL (to-sql [self])) in one namespace, then a (defrecord InfixOperator [op-name] ToSQL (to-sql [self] op-name)) in another; the latter generates a reflection warning -- "call to contains can't be resolved"; any idea why?
09:43rshhow do you remove a macro defined in a ns?
09:44Chousukersh: ns-unmap
09:45rshthanks
09:45mmarczykrsh: as you would with a function; nb. this won't have any effect on code using this macro and compiled when it was in place
09:49mmarczykrhickey: in core_deftype.clj, line 215, shouldn't there be a type hint on v#?
10:03alexykhow do I make a stand-alone executable? uber-jar?
10:03sparievyes, lein uberjar will do
10:22mattrepl*sigh* misplaced parens around a series of defns. no compile error, but resulted in Var being interned but no function bounded
10:24chousermattrepl: just yesterday systray had that very same error message with the very same cause
10:26mattreplchouser: sounds like something worth fixing, maybe a compiler warning for nested defs?
10:27chouserjust added it to my lint tool todo list
10:32mattreplis it a conscious decision to put items like that in a lint tool instead of in the compiler? is there a plan to integrate a lint tool with the compiler?
10:33chouserI don't know.
10:33chouserCompiler errors are great, but warnings are a pain. We use a warning because we're not *sure* it's an error...
10:34chouserif we're not sure it's an error, that means someone might want to keep the warned code, which means they rightfully would want a way to turn it off
10:35chouserbut you don't want a lib that turns it off to also turn it off in the lib-user's code, so how do you control the warning? at what granularity?
10:36mattreplnamespace?
10:36chouserif a flexible system is provided to let you turn on/off warnings per ns, file, function, etc. do we really want all that complexity bundled into the compiler?
10:37chouserperhaps if a lint tool can demonstrate sufficient value, simplicity, and flexibility, parts of it could be included in the compiler. or perhaps that would simply demonstrate it works fine standalone.
10:37mattreplcould be namespace metadata, the lint tool looks for it, and the compiler could optionally call lint
10:37chouserhm, that's an interesting idea
10:39cemerickrhickey: clean builds now, thank you :-)
10:39cemerickI suppose I'll go eliminate the RT.load usages in any case.
10:41cemerickI reserve the balance of my Java API griping time though. ;-)
10:41chouserheh, I like it. Senate rules.
10:48AWizzArdIs there a better way to produce all non-nil elements of a seq other than (take-while identity (iterate f coll)) or (take-while identity (repeatedly f))?
10:48cemerickchouser: same in the House. I'm cameralism-agnostic.
10:48arohnerAWizzArd: (remove nil? seq)
10:49AWizzArd,(last (take-while identity (iterate #(.getComponentType %) (class (make-array String 2 2 2 2)))))
10:49AWizzArd$(last (take-while identity (iterate #(.getComponentType %) (class (make-array String 2 2 2 2)))))
10:49sexpbotjava.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752
10:50AWizzArdanyway, remove nil? is not the way, as this wouldn't produce the seq itself
10:50chouserI yield the remainder of my cameralism time to the gentleman from Massachusetts
10:50cemerickMan, one step towards a legislative process, and we're already getting less done!
10:50AWizzArdA version of iterate and/or repeatedly that stops when a specific result was found.
10:51AWizzArd(repeat-until nil? f) and (iterate-until nil? f coll) so to say
10:52chouser$(take-while identity (iterate #(and % (.getComponentType %)) (class (make-array String 2 2 2 2))))
10:52sexpbotjava.lang.NoClassDefFoundError: clojure/core$iterate$fn__3752
10:52chouserthe bots are all broken?
10:52AWizzArdseems so
10:53AWizzArdNot online or broken :p
10:53AWizzArdThe above code I pasted works in my Clojure.
10:55AWizzArdIs there a Superclass for all Arrays?
10:55chouserObject
10:55chouser:-)
10:55AWizzArdOther than Obj...
10:57AWizzArdHow can one detect if a given Object is an Array?
10:58AWizzArd(.isArray (make-array String 5))
10:58AWizzArdk
10:58chouserreally?
10:59AWizzArdyes
10:59AWizzArdhttp://java.sun.com/javase/6/docs/api/java/lang/Class.html#isArray()
10:59chouserI get java.lang.IllegalArgumentException: No matching field found: isArray for class [B
10:59AWizzArdyes, I forgot to wrap it into (class ..)
10:59chouserah
10:59AWizzArdretyped it here
11:01AWizzArd(defn get-array-dims [a] (map count (take-while identity (iterate first (make-array Object 1 2 3 4 5)))))
11:01AWizzArdarray? and get-array-dimensions could be helpful in Core.
11:04rhickeywtf? google group redirect infinite loop came right back
11:39KjellskiWhat would you do if you want to iterate through a vector and at some particular element you want to start collecting until some other particular element?
11:40mattrepldrop-while then take-while?
11:42Kjellskimattrepl: hmm, how would that look like?
11:42Kjellski,(doc take-while)
11:43mattrepl(take-while #("not the end element") (drop-while #("not the start element")))
11:44Kjellskimattrepl: thanks, I´ll try that...
11:44mattrepltweak as necessary for inclusivity
11:45hiredmanping?
11:46hiredmanping?
11:46clojurebotPONG!
11:47rmarianskiKjellski: split-with might do what you want also
11:48Kjellskirmarianski: thanks, I´ll try that too...
12:03Kjellskirmarianski: Following problem, that gives me only the first occurence and rest. But I need it like this: blocks from 1 to 1 [1 2 2 1 3 3 1 4 4] -> ([1 2 2] [1 3 3] [1 4 4])
12:06rmarianskiKjellski: afaik, you'll have to write something custom
12:07dnolenerg how can I produce a string that has double quotes without backquoting the double quote?
12:07Chousukecan you?
12:07chouser,(char 34)
12:07clojurebot\"
12:08Chousukethat's probably not very convenient :P
12:08chouserno backquoting in the input! :-)
12:09chouserdnolen: there's no way to put double-quotes in a string literal without backquoting it.
12:09dnolenchouser: is there a simple way to replace them?
12:10chouser,(.replace "I said 'Hello World!'" \' \")
12:10clojurebot"I said \"Hello World!\""
12:10chouseryou mean like that?
12:14dnolenchouser: thx, I thought the presence of \" in the string was an issue, but now I see that it's probably something else.
12:17KjellskiHow can I "unuse" a namespace?
12:20FossiKjellski: afaik you can't
12:21chouserremove-ns
12:21RaynesThere is remove-ns.
12:21Rayneso/
12:21Kjellskity
12:21Raynes;)
12:23JorejiAnyone can tell me why (. (identity String) newInstance "fred") is no longer working?
12:24KjellskiHmmm... removed like this: (remove-ns 'clojure.contrib.str-utils) but this won´t work because when I try (use 'clojure.contrib.str-utils2) e.g. chomp is already bound... =(
12:27chouserJoreji: the newInstance method of Class doesn't take any args. Doubt it ever has.
12:28chouserJoreji: if you want to use reflection to call a constructor with arguments, try clojure.lang.Reflector/invokeConstructor
12:29Jorejichouser: I got that from: http://en.wikibooks.org/wiki/Learning_Clojure
12:29JorejiAll I want is to create an instance of a class which I store inside a symbol
12:30chouser,(clojure.lang.Reflector/invokeConstructor String (to-array ["fred"]))
12:30clojurebot"fred"
12:30JorejiAh, thanks!
12:30chouserit would be better to store a clojure function that does what you want, than just storing the symbol
12:31chouser,(let [ctor #(String. %)] (ctor "fred"))
12:31clojurebot"fred"
12:31chousersimpler, more flexible, and much much faster
12:33Jorejichouser: Yeah, but I'd need to use a macro in order to get the #(String. %) fun work for other cases. This I'm trying to avoid. Fortunately I only use it sparsely, so it shouldn't be a problem.
12:38chouser,((fn [p s] (->> [nil s] (iterate (fn [[_ [_ & xs]]] (split-with (complement p) xs))) (partition 2 1) (map (fn [[[_ [i]] [r]]] (cons i r))) (take-while first))) #{1} [1 2 2 1 3 3 1 4 4])
12:38clojurebot((1 2 2) (1 3 3) (1 4 4))
12:38chouserKjellski: that's for you
12:38chouserbut I suppose there's a better way
12:39chouseroh. duh.
12:40chouser,(map #(apply concat %) (partition 2 (partition-by #{1} [1 2 2 1 3 3 1 4 4])))
12:40clojurebot((1 2 2) (1 3 3) (1 4 4))
12:40chousersheesh
12:42lpetitHello all, I've not been there for the past 24 hours. Are we close to the end of the prim et al. branch story ?
12:43rhickeylpetit: no
12:44lpetitok !
12:45rhickeylpetit: people have given up on bigint contagion too easily, I haven't, and am working on it
12:47lpetitrhickey: it's very exciting to assists / be part of the construction of such a great language !
12:48rhickeylpetit: not very glamorous from here :)
12:51hoeckrhickey: so you are working on a compromise?
12:53rhickeyhoeck: more like what I first proposed, i.e. bigint contagion, while addressing some issues of that, but keeping the best of the other work (loop/recur, literals as primitives, etc)
12:53rhickeybigint contagion would allow for polymorphic use of +, -, *, less need for auto-promoting prime versions
12:55chouseryay
12:55hoeckgreat
12:55chouserless need for prime versions seems like a huge win to me
12:56Rayneslpetit: Does counterclockwise work with Eclipse 3.5? I heard a guy saying it wasn't working earlier, so I'm curious.
12:56rhickeybut a lot of work - a return to some sort of equiv based =, a new BigInt type, changes to key lookup in maps/sets
12:57chouserAre you punting on the new BigInt for now? Surely someone else could do that for you.
12:57dnolenwow, a better BigInt. no compromise.
12:58rhickeychouser: I'd love help on that, I could spec it easily. We need it because BigInteger and Long hashCodes differ for the same values, secondarily, for performance
12:59chouserI shouldn't volunteer for that, but I might anyway.
12:59chouserdon't tell fogus I'm not working on the book.
13:00fogusdon't tell chouser I'm not working on the book.
13:00chouserdon't tell Manning we're not working on the book. :-/
13:01chouserrhickey: the interface would look a lot like BigInteger?
13:01rhickeythe net result would be that heterogeneous keys would be supported for maps and sets, when used with the Clojure API would use equiv, from Java, adds an .equals test
13:02cemerickrhickey: doesn't kawa have a good set of bigs? At least a good start, perhaps...
13:02rhickeychouser: not at all, quite minimal BigInt/fromBiginteger /fromLong .toBigInteger, j.u.Number API, accessors for long and BigInt parts, then just implement the needed support for clojure.lang.Numbers
13:02cemerickeh, it's probably not license-compatible
13:03rhickeycemerick: no need for that whole impl, just punt to BigInteger, all this is is a shell wrapping long-or-BigInteger, enforcing the semantic that BigInteger is null if fits in long
13:03rhickeyIt's quite a small thing
13:04rhickeyremember, Long et al don't provide arithmetics, just holders, this is like that
13:20chouserrhickey: you'd want BigInt on the prim branch?
13:25rhickeychouser: on new branch, equiv, not there yet...
13:26chouserok
13:29rhickeychouser: there now
13:29rhickeyhttp://github.com/richhickey/clojure/tree/equiv
13:33cemerickBasically-working patch for #322 (making transitivity of AOT-compilation optional): http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e
13:34cemerickrhickey, chouser: thoughts welcome
13:35cemerickThe only issue remaining is that the guard @ http://github.com/cemerick/clojure/commit/6f14e0790c0d283a7e44056adf1bb3f36bb16e0e#L1R5876 is necessary to avoid class gen by genclass and proxy, but putting it there makes protocol interface lookup fail at the moment.
13:39hiredman,(docs resolve)
13:39clojurebotjava.lang.Exception: Unable to resolve symbol: docs in this context
13:39hiredman,(doc resolve)
13:39clojurebot"([sym]); same as (ns-resolve *ns* symbol)"
13:46rhickeychouser: you doing BigInt.java first? I need to twiddle with Numbers
13:49bhenryis there a built in exponents function? (something x y) -> x^y
13:49chouserrhickey: I was going to jump right into a .clj
13:49chouserdeftype
13:50rhickeychouser: we'll have issue with that being available early enough
13:50rhickeybootstrap
13:50chouser:-( boo. yeah.
13:50rhickeychouser: if that sours it for you, let me know, the map part is easier than I thought
13:51chouserpoor timing to work on a multistage clojure self-compiler I suppose
13:51rhickeyyeah
13:51chouserI can still take a swing at it.
13:53mattreplbhenry: (Math/pow x y)
13:54bhenrymattrepl: thanks. i was just using (defn ** [x y] (apply * (repeat y x)))
13:55bhenry,(let [** #(apply * (repeat %2 %1))] (** 2 3))
13:55clojurebot8
13:57bhenry,(Math/pow 2 3)
13:57clojurebot8.0
14:02chouserrhickey: .toLong throws on overflow? returns primitive?
14:06rhickeychouser: follow http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html
14:08chouserso longValue instead of toLong
14:08rhickeychouser: right
14:15chouserhm, could probably use two classes and one interface to leverage method dispatch instead of having if(bigint == null) everywhere
14:22iwillighi, i am trying to build a standalone jar with lein and i keep on getting the perplexing error
14:22iwillighttp://paste.pocoo.org/show/229013/
14:23iwilligthis is my main class
14:23iwillighttp://paste.pocoo.org/show/229025/
14:23iwilliganyone have a few tips for a nb
14:24cemerickiwillig: the error is actually in geo.io
14:24qbgDon't do def outside of the toplevel
14:24cemerickiwillig: and, what qbg said :-)
14:24KirinDavecemerick: Yo dude. I am back.
14:25iwilligcemerick: how where you able to tell the error was in io ?
14:25qbgProbably from "at geo.io$read_features__101.doInvoke(io.clj:49)"
14:25qbgbeing the most recent call in your code
14:26iwilligthanks gusy
14:26iwillig*guys
14:28lpetitRaynes: if you still here, then the answer is yes, 3.5 is its current primary target
14:31cemericklpetit: it seemed to work with a 3.6 RC I tried last week *shrug*
14:42lpetitcemerick: thx for the info. I hoped it was.
14:42lpetitmust quit, cu
14:43cemericklpetit: np -- I only used it for an afternoon, though, so don't take that as gospel :-)
15:04fliebelIs there anything in Clojure or Java to make servers other than HTTP? especially SMTP and POP3.
15:08bartj, (/ 22 7)
15:08clojurebot22/7
15:08bartj, (/ 10 10)
15:08clojurebot1
15:09bartjer, why is (/ 10 10) not a Ratio type?
15:10chouserreduces
15:10chouser,(/ 4 2)
15:10clojurebot2
15:10chouser,(/ 2 4)
15:10clojurebot1/2
15:11bartjit seems, like division with remainders are retained as Ratio type, right?
15:13chouserdivision with integers that does not result in a whole number results in a Ratio, yes.
15:16bartjchouser: thanks
15:29lpetittcrayford created a project on github about clojure refactorings. I expect to add this kind of feature sooner or later (rather sooner than later !) to counterclockwise, but I'm not sure about the current impl. He apparently choosed to use the reader. So he's loosing information : how the metadata was entered (was it ^:key1 ^:key2 or {:key1 true :key2 true} ?), the comments, etc. . When the...
15:29lpetit...time permits to work on it for ccw, I guess I would first try to do as much as possible via static analysis with external source code parser, and maybe, in a second pass, try to 'plug' some info from a dynamic environment, if useful at all. Thoughts ?
15:39bartj, (contains? '("9" "8") "9") ; I was expecting a "true"
15:39clojurebotfalse
15:40chouser,(contains? #{"9" "8"} "9")
15:40clojurebottrue
15:40fyuryubartj: contains? checks if a map contains a *key*
15:41bartj, (doc contains?)
15:41clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
15:41cemericklpetit: entirely as an observer, I've seen a lot of editor plugins have a lot of trouble when they did anything other than use the language's real parser/reader/compiler/etc
15:41bartjfyuryu: the doc says it is a collection?
15:41somniumis it possible to generate and populate namespaces programmatically?
15:41bartjI assumed any seq would do...
15:42fyuryubartj: well, I should be more precise, but still, it looks for a key
15:42cemericklpetit: the ^:key1 vs {:key1 true} thing is really more of a formatting preference than anything, and you can default that to use the former if the metadata map is all keyword keys and boolean true values. There's probably more complicated scenarios.
15:43fyuryubartj: since vectors are also maps (of their keys)
15:44lpetitcemerick: ccw uses its own hand-made parsetree with great success AFAIK :-p
15:44fyuryu,(contains? [0 1] 1)
15:44clojurebottrue
15:45cemericklpetit: well, hopefully it pans out well :-)
15:46bhenryfyuryu be cautious that the 1 it's finding is the key of that vector and not the value 1
15:46bhenry,(contains? [0 2] 1)
15:46clojurebottrue
15:46lpetitcemerick: maybe, but what about the comments. And what about spaces / current indentation of the source code ? Why should a refactoring command ruin someone's carefully hand-made formatting ? I think those are pretty strong arguments against using the current parser as is. But still, I'm unsure about the "mix" story, as in mixing dynamic and static information to try go deeper in the...
15:46lpetit...understanding of the semantics of the source code (e.g. where macros are used, that is almost ... everywhere !) ?
15:47fyuryubhenry: yes, my example could be better.
15:47bhenryfyuryu my bad. i thought it was you having trouble, not answering the question.
15:48fyuryu,(contains? [:a :b] 1)
15:48clojurebottrue
15:48lpetitcemerick: but of course, if the current reader could be enhanced/instrumented to e.g. have a version which preserves everything in the source code
15:48cemericklpetit: That's a fair point -- perhaps the next-gen reader should provide a more verbose output that includes everything tooling might need
15:48cemerickheh
15:48lpetitcemerick: but wait, no, there may still be the problem of the reader macros, no ?
15:48lpetiteh
15:49lpetit,(read-string "hello")
15:49clojurebothello
15:49lpetit,(read-string "hello there")
15:49clojurebothello
15:49lpetit,(read-string "(hello there)")
15:49clojurebot(hello there)
15:49lpetit,(read-string "(hello #_there)")
15:49clojurebot(hello)
15:49lpetitcemerick: see, #_there was swallowed too :-(
15:50lpetit(quite normal)
15:50cemericklpetit: Sure -- the current impl isn't suitable then. IIUC, the reader's due for a pure-clojure replacement -- at that point, I'm sure the powers that be will be receptive to changes to help out on the tooling front. *shrug*
15:50lpetitcemerick: oh, and last but not least: the reader will only help with strict-strict correct syntax. I'm pretty sure the need may occur to be able to work on "sufficiently correct syntax" where possible
15:51bartjfyuryu: there is no "1" in [:a :b], yet returns true?
15:51lpetitcemerick: yeah. Though maybe our timeframes may not overlap :-(
15:51cemericklpetit: any ideas how the scala plugins do it (which do use scalac et al)?
15:51lpetitcemerick: to be continued. thx for sharing thoughts
15:51lpetitcemerick: no idea
15:52cemerickheh, FWIW of course ;-)
15:52raekbartj: [:a :b] has the keys (in this case indices) 0 and 1
15:52bhenrybartj it's finding the key 1
15:52bhenry,(let [v [:a :b]] (v 1))
15:52clojurebot:b
15:52lpetitcemerick: of course :-p
15:52lpetit(just kidding)
15:54bartj, (contains? [:a :b] :c)
15:54clojurebotfalse
15:55Licensergreetings my lispy friends
15:55bartjok, first time seeing vectors being used as maps!
15:57chouser,(map (vec "acgt") [2 1 3 1 2 1])
15:57clojurebot(\g \c \t \c \g \c)
15:57chouser,(map (vec "acgt") [2 0 3 0 1 0])
15:57clojurebot(\g \a \t \a \c \a)
15:58bartjbhenry: in your example, (contains? [:a :b] 1) -- we first get the key b and then check for the existence of b in [:a :b] - right?
15:58fliebelchouser: Huh, what are you doing?
15:58chouserfliebel: I'm using a vector as a fn
15:58rhickeychouser: got anything?
15:58chouserrhickey: yeah, but I don't know java very well
15:59chouserit's hurting me
15:59fliebelchouser: So you create a vector of char symbols which get retrieved with map?
15:59chouserrhickey: give me another 5 minutes and I might have a useful starting place for you.
15:59rhickeyouch
15:59rhickeychouser: ok, thanks
15:59bhenrybartj: you're confusing keywords with keys. and i should have said index instead of key. the 1 is an index in [:a :b]
16:00bhenryso contains? is looking for a key. in a vector, its keys are its indices. [:a :b :c] will return true in contains? for 0 1 2
16:01bartjbhenry: thanks!
16:01fliebelDo Clojure or Java have a network library like Twisted?
16:02dnolenfliebel: Netty
16:02dnolenthere's the beginning of wrapper for it called saturnine on github
16:02fliebeldnolen: thanks, I'll look it up. I need to do some SMTP adn POP3 server stuff.
16:03bartjbhenry: what about a list?
16:03chouserrhickey: I haven't touched Numbers.java, but I have a BigInt.java. You want it in email?
16:03bartj, (contains? '(9 8) 1)
16:04clojurebotfalse
16:04bhenrybartj a list will always return false in contains?
16:04rhickeychouser: could you please email to dev list? Thanks!
16:06bartjbhenry: it seems to be that lists also have indices because things like this:
16:06bartj(first '(1 2))
16:06bartj, (first '( 1 2))
16:06clojurebot1
16:06bartj*because of
16:07bhenrybartj, first doesn't find it by an index
16:07bhenryneither do things like get.
16:07bhenryyou can
16:07bhenry't do this
16:08bhenry,(let [my-list '(1 2 3)] (my-list 1))
16:08clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
16:08bhenrybut you can do
16:08bhenry,(let [my-vec [1 2 3]] (my-vec 1))
16:08clojurebot2
16:09bartjand this is because vectors are allocated in contiguous memory locations and lists are not - right?
16:10bhenrythat's over my head, but i just read the joy of clojure and they specifically cover contains? on lists and vectors and other things like sets.
16:11bartjer, anyone here can confirm the above, plz?
16:11hiredmanbartj: that is not true
16:11hiredmanvectors are not arrays
16:11somniumbartj its unrelated
16:12rhickeychouser: or just put in Files section of clojure-dev
16:12bartjhmm, then why does contains? work on vectors and not on lists?
16:12hiredmana list like '(1 2) is logically a head and a tail, there is no numbering
16:13hiredman,(doc contains?)
16:13clojurebot"([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'."
16:14bartjhiredman / bhenry: thank you for your patience, I get it...
16:15chouserrhickey: just sent.
16:15rhickeychouser: thanks!
16:15chouserI screwed up the overflow cases -- happy to fix it if you're rather not.
16:16chouserof course I likely screwed up other things too. Hope it saves you some time anyway.
16:17rhickeychouser: it will, thanks again
16:24nathanmarzdoes "reduce" use the stack as it goes through the seq? i'm getting a StackOverflowError while doing a reduce on a really long seq
16:28bhenrynathanmarz, is the code gistable (aka not proprietary)
16:31nathanmarzbhenry: http://gist.github.com/450501
16:31nathanmarzit happens rarely
16:31nathanmarzit might be happening in that map actually
16:36qbgnathanmarz: The code might be making lazy thunks too deep with map
16:37Chousukethat's most likely what's happening.
16:37qbgTry using doall around the map
16:38ChousukeI'm not quite sure what you're trying to do there
16:38Chousukewhat kind of input do you have and what kind of output do you need?
16:38lpetitchouser: no reimplementation of equals/hashcode in BigInt ?
16:38chouseroh
16:38chouserI didn't get that far, did I. :-P
16:38chouserI'm just so slow at Java
16:38lpetitwasn't it the whole point of doing the exercise ? :-p
16:40rhickeylpetit: done already
16:40lpetitrhickey: ok then, so no need to give more feedback on the email ?
16:41rhickeylpetit: nope, that was just a starting point
16:41lpetitrhickey: ok, so just using clojure-dev as your private chouser/rhickey sandbox :-p
16:41rhickeylpetit: public, that's the point
16:42lpetitrhickey: ok, copyright et al.
16:48Nanakhielmmarczyk, are you there?
16:48mmarczykNanakhiel: ?
16:48Nanakhielhttp://codepad.org/Ej8SrXi1 do you agree with the design goals?
16:48NanakhielAs you can hopefully infer, it is designed towards easy and efficient compilation
16:49mmarczykum, why'd you ask me?
16:50Nanakhielmmarczyk, because you are the fifth greatest programmer.
16:50mmarczykchanged your nick, I see?
16:50NanakhielAlso, you solved my issue with tail calls, and I have your leg in my stomach.
16:50mmarczykanything to do with a recent screenshot?
16:50NanakhielAhh
16:50NanakhielNahh
16:50NanakhielI have multiple
16:50IslaamIncluding this treasure I got before all others
16:50LajlaI have about 30 registered I think
16:51mmarczykwell, sorry, no time now
16:51Lajlammarczyk, you can't go anywhere, you have but one leg.
16:52LajlaMuahahahha
18:18Licenseroptimizing clojure isn't actally funnny :(
18:35dsopis there a way at to start a compojure app using leinigen without building a jar?
18:37lancepantzdsop: you can do so from a repl, if that's what you're interested in
18:37dsoplancepantz: hm I was thinking more of a lein run target
18:38lancepantzyeah, just reopen you're namespace and call run-jetty in it
18:38lancepantzi guess you don't need to reopen it actually
18:39lancepantz*your :)
18:43mmarczykdsop: there are at least two "lein run" plugins, one's available on Clojars -- leiningen-run "0.2" worked for me in a toy project -- and I remember reading about another one some time ago...
18:44mmarczykdsop: here's another one: http://github.com/sids/lein-run/
18:48dsopmmarczyk: thank you!
19:00mmarczyknp
19:05kensanataYum, Practical Clojure arrived...
19:11Licenserbenchmarks make me cry
19:12Licenserhttp://gist.github.com/450704 is ugly code!
19:14LicenserI give up for today good night people
19:31alexykclj-json spends a long time rebuilding a map upon read. Is there a simple way to use jackson in stream mode, token by token, to rebuild a map very fast?
19:31alexykI guess avoiding reflection, in case I know what my map looks like.
19:34aretealexyk: you can use ObjectMapper and pass a Map type to readValue(Type)
19:34aretebut I don't know if it can handle clojure's Map types
19:34alexykarete: what if I have nested maps? my idea is to read token by token
19:35alexykand construct my nested type as I go
19:35aretealexyk: it'll make a map of maps
19:35aretejackson is fab =)
19:35alexykarete: well I have 3 levels :)
19:36areteit has no depth limit
19:37kirasthere doesn't seem to be a lot of information about using clojure for android programming yet. i found some links explaining how it can be done and this link http://groups.google.com/group/clojure/browse_thread/thread/213b7675a78755de/8195672b167d0ffd but is there a general consensus on whether it's a good idea at this point compared to just using java?
19:41dsopis there a good documentation of compojure 0.4, i searched but i didn't found any
19:43nathanmarzChousuke qbg: you guys were right about that function, doall did the trick. thanks for the help
19:43qbgNo problem
19:43alexykhow do you specify a main for leiningen's uberjar?
19:43qbgThe :main option in project.clj
19:44alexykmeaning which clojure source to write?
19:44mmarczykdsop: http://formpluslogic.blogspot.com/2010/04/migrating-from-compojure-032-to-040-and_01.html http://carpathia.blogspot.com/2010/05/yet-another-clojure-compojure-google.html http://compojureongae.posterous.com/ -- all "focused" articles, but you'll probably be able to gather some useful info from there
19:44qbg:main specifies the class to be used
19:44qbgI usually use a :gen-class'ed namespace
19:45qbgFor a REPL, you would use :main clojure.main
19:45alexykqbg: I have pure clojure, no gen-class...
19:45alexykI just want one defn to be main
19:46mmarczykalexyk: use :main with a namespace name
19:46mmarczykalexyk: it'll call the function -main from there
19:46alexykok
19:47qbgI believe you still need to :gen-class that namespace
19:49alexyklancepantz: is jiraph-0.1.3 on clojars fresh?
19:52ninjuddalexyk: it is, but i have some changes in my local repo that i'm planning to commit later this week
19:52ninjuddswitching to protocols
19:53ninjuddand switching off ant
19:53alexykninjudd: coolio! finally a reason to learn them. Back to Clojure as OCaml now works and beats it 3x.
19:53alexykspeedwise
19:53alexykbut there's way
19:53alexykto catch up since
19:53alexykthe current clojure is simple
19:54alexyk(sorry return is in the way :)
19:55ninjuddhmm, are you using the jiraph walk code?
19:55alexykninjudd: I only use the .tc
19:56ninjuddah
19:56ninjuddare you doing graph traversals? or just bulk read and write benchmarks
19:57mmarczykqbg: alexyk: apparently no :gen-class is needed for :main
19:57alexykmmarczyk: cool, thx
19:58qbgInteresting...
19:58mmarczykqbg: I tried (ns foo.core) (defn -main [& args] (println "Foo!")) plus a project.clj with just :main foo.core in defproject, ran lein uberjar (with clojure and contrib jars in lib/) and java -jar foo-0.0.1-standalone.jar prints Foo!
19:59qbgPerhaps leiningen does some magic
19:59alexykninjudd: did you guys figure out how to use clojure-protobuf with lein?
19:59mmarczykI do note that leiningen.core is :gen-classed
19:59mmarczykI wonder why
19:59ninjuddhad some trouble getting it to work
20:00alexykninjudd: so do I have to manually do that beforehand?
20:03technomancymmarczyk: the gen-class is to make the uberjar work
20:03technomancysince http://www.assembla.com/spaces/clojure/tickets/315-add-support-for-running--main-namespace-from-clojure-main-without-aot still hasn't been applied =\
20:05technomancywait... you got java -jar to work without gen-class? iiiiinteresting.
20:05mmarczyktechnomancy: right
20:06mmarczyktechnomancy: which is why I'm wondering if this issue might have been solved somehow without #315 noticing
20:07mmarczyktechnomancy: btw, would you like a patch for this? http://github.com/technomancy/leiningen/issues/#issue/55
20:07technomancymmarczyk: yes! that'd be grande.
20:07technomancyand also grand.
20:07mmarczyk:-)
20:08mmarczyk:jar-name in defproject then?
20:08technomancysure
20:08mmarczykwill be ready in a minute
20:09lancepantzmmarczyk: what about war and ubers?
20:09mmarczyklancepantz: ah, good point about uber
20:09lancepantzi guess war would be in the plugin's logic
20:09technomancymmarczyk: can't repro -main working without :gen-class here. perhaps you tried it with gen-class, removed the gen-class and tried again without cleaning?
20:09mmarczykright
20:09clojurebotNo, technomancy, you want gen-interface + proxy
20:09mmarczyktechnomancy: hm... I thought I cleaned
20:09mmarczyklet me check again
20:10mmarczykah. well, apparently I hadn't -- sorry for the confusion
20:11technomancygot my hopes up. =)
20:11technomancywell, #315 solves it pretty nicely... just no idea how long it'll take to get applied.
20:11mmarczykonly for them to be shattered again immediately... sorry ;-)
20:11mmarczykalexyk: :gen-class after all then...
20:12mmarczykyeah, your comment on HN is relevant here...
20:12alexykclojurebot talks back. I must have been drinking
20:12technomancyclojurebot has an attitude.
20:13alexykit'll get Obama summon it to White House and fire it if it keeps at it
20:15alexyk"I have a deep respect and admiration for the clojurebot. It solved inane examples thrown at it by newbies for 2 years. It suffered hiredman's domestic abuse without crying. But Clojure is bigger than any bot."
20:24mmarczykah, turns out lein has the standard (uber)jar naming scheme hardcoded in a number of places... refactoring that now
20:40mmarczyktechnomancy|away: would you mind having "lein jar foo" create "foo.jar" (rather than the current "lein jar foo.jar")?
20:43bhenrymmarczyk: why not both instead of "rather than"
20:44mmarczykbhenry: how do you mean? take notice of a trailing ".jar" in the name and throw it away?
20:44mmarczykbhenry: I mean, *not* throw it away, just not add another one
20:46bhenrysomething to catch it. i don't personally, but someone might have something made already to do this that they shouldn't have to change. it's not a big deal in this example, but i hate when things get broken from code changes.
20:46mmarczykme too, so I suppose I won't break it after all :-)
20:49mmarczykalthough actually in this case
20:50mmarczyk...ah, never mind, I realised what I was going to say might be false actually :-P
20:51bhenryyeah. i wondered if people will read this later and be like "damn that bhenry, mmarczyk was going to make a change i've been hoping for since day one and he blew it."
20:51mmarczyk:-D
20:52mmarczykit'll be an scratch-a-word-from-two-lines-then-add-to-one change, not to worry ;-)
23:48slyrusanyone (here) working on computational biology projects in clojure?
23:51BahmanHi all!