#clojure logs

2009-11-09

00:13technomancyis it kosher to use org.clojure for the groupId of your own projects?
00:14technomancyor should you only use a domain if it's one you are associated with?
00:26technomancyare "Don't know how to create ISeq from: Keyword" errors when AOTing code that works fine otherwise indicative of a certain type of problem?
00:26_atotechnomancy: better to use your own. same if you're going to use a domain as your namespace. If you don't have a domain you could just use youaccountname.github.com
00:26technomancydefinitely not going to use my own domain
00:27technomancysince the only reason I'm changing it is that the previous author used *his* own domain, and he's not involved in the project any more. =P
00:28technomancyusing a domain as a namespace is totally unnecessary; if your name is not unique without your domain, then you should pick a better name to begin with.
00:28_atoyeah, I agree
00:28technomancyit's a curious custom
00:29_atobut maven kind of forces it on you
00:29_atoit makes sense from a name collision purity standpoint, but it's damn ugly
00:29technomancywe had a few days of checkin freeze on one team at my last job to switch over the code base from a company we'd acquired just to get rid of the old domain
00:29djorkfew days? s/old-domain/new-domain/g
00:30technomancydjork: java devs... what can you do. (I wasn't working on that project myself.)
00:30djorkheh
00:30technomancy_ato: maven forces you to use a group ID, but that's it; it's only convention that says it must be a domain.
00:30technomancylots of projects use their name as their group ID too
00:31_atoyeah but to get uploaded to maven central repo you must have a domain
00:31_atoI know some don't
00:32_atobut that was because they were uploaded before they made that policy
00:32technomancyah, that's a shame
00:40technomancyI'm seeing long pauses at the end of the "compile" cycle with clojure-maven-plugin
00:40technomancyno CPU, disk, or network usage
00:40_atoThread.sleep(10); // coffee break
00:40_ato:p
00:41technomancyalso it appears you can't have (:use (clojure.main :only [repl])) in your ns; you have to use [clojure.main :only [repl]]... didn't realize there was a difference between the paren version and the bracket version.
00:42_atoyeah, I want something that works just as easily as Ruby's gems. which aren't as fancy or complicated as maven but for some reason they just work a whole lot better
00:44technomancyby work a lot better, do you just mean that they don't require any XML and don't invent a lot of new words?
00:46technomancyyou just have to laugh that someone actually thought calling the file a "project object model dot extensible markup language" was a good idea. there are six words in that phrase, and only one of them is relevant.
00:47_atoyeah that and it's really easy to get things into the central repository (http://gemcutter.org/)
00:48_atoand you don't need to fuss around with version numbers when you just don't care
00:49technomancy_ato: not needing to fuss about version numbers is nice up front, but nearly always causes problems in the long-term for projects that break backwards compatibility.
00:49technomancybut otherwise I am in agreement
00:54technomancyI have been playing with hudson at work, and I think it would not be hard to make a central repo for clojure projects at large.
04:10piccolinoIf you call seq on something that's already a sequence, does that create an extra object, or does it just return itself?
04:12_atopiccolino: just return itself
04:12piccolinoThanks.
07:37ol3hello, how do I convert an java map to a clojure map?
07:38liwpol3: try (into {} <your java map>)
07:38liwpol3: you can use the java map like a clojure map in most places, IIRC
07:38eevar2better yet; don't, unless you must
07:40liwp,(get (System/getProperties) "os.arch")
07:40clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
07:40liwpblah
07:40liwpanyhow, java maps (and hashtables) can be used anywhere where you would use a clojure map
07:41hiredmanerm
07:41hiredmanI don't believe conj will work on a java map
07:42liwphiredman: true
07:43hiredmanand into uses conj (conj! on master I guess)
07:44liwphiredman: but in the into example above we're using conj with a clojure map and we seq the java map
07:44hiredmanindeed
07:44liwp(into {} (System/getProperties)) definitely works
07:44hiredmansure
07:44hiredmanthe reverse would not
07:44liwpagreed
07:45liwpso let's say that a java map can be used in place of a clojure map if it's being observed (i.e. not constructed / modified), would that be more accurate?
07:46hiredmanI suppose
07:46hiredmanbut really you aren't using a map in that into example, you are using something seq returns a seq for
07:46liwpyep
07:47hiredmananyway :P
07:47liwp;)
07:53cemerickcgrand set me straight on this a while ago, but is it the case that host invocations in -> can't be hinted?
07:53AWizzArdrhickey: there now is a bug in reading deftypes where a field name contains a "-"?
07:54AWizzArdFor example (deftype foo [a b some-key])
07:54cemerickAWizzArd: java names are necessary at this point
07:54hiredman- is not valide in java names
07:54AWizzArdwhen I then make a (foo 1 2 3) I can access (:a my-foo) but not (:some-key my-foo)
07:54AWizzArdcemerick: oki, I see
07:55cemerickthere are apparently plans to resolve that, but probably a low priority right now
07:55AWizzArdhowever, ((keyword "some-key") my-foo) works :)
07:56AWizzArdalso (get my-foo :some-key)
07:56cemerickyes, the issue is in the generation of the 'native' callsite associated with keyword lookup
07:56hiredmanonly literal keywords get the fast path to field access
08:02cgrandcemerick: http://www.assembla.com/spaces/clojure/tickets/205-Preserve-type-hints-set-on-inlined-or-interop-forms has a patch for that
08:03cemerickah-ha
08:04cemerickI thought I was going nuts.
08:04cgrandif you pick this patch don't forget http://www.assembla.com/spaces/clojure/tickets/206-make----and-----metadata-aware, they taste great together
08:04cemerickwow, that patch requires compiler changes. That's a little surprising.
08:05cemerickthankfully, I don't do much with arrays :-)
08:05cemerickI just get tripped up on 205 every time I touch ByteBuffers, etc.
08:08rhickeycgrand: both patches approved, should go in soon
08:09cgrandrhickey: cool, thanks
08:09rhickeyhrm, someone tweeted "Clojure makes easy things hard, and hard things easy" :(
08:10AWizzArdthere will be more such misconceptions in the future
08:10eevar2fits better for haskell :p
08:11cemerickrhickey: I can see that, esp. for typical Java folk.
08:11the-kennyrhickey: You should ask what's an "easy thing" in clojure :)
08:12chouserIf you're used to imperative with mutable everything, trying to rewire your brain for functional and immutable does take real effort.
08:12the-kennychouser: That's true.
08:12Fossiwell, it's surely a bit hard for some people (me incl) to get their heads wrapped around their data instead of doing things imperatively
08:12Fossiso i can see that part
08:12the-kennyBut this isn't a problem of clojure.
08:12cemerickthat, and clojure does not lend itself to any kind of copy/paste coding, which is outrageously common
08:12rhickeyyes, I'd hope this is more of a speedbump/learning curve thing than a persisting property once you are familiar with it
08:13Fossiand of course clojure is cool for more complex things you want to do to that data afterwards
08:13Fossirhickey: from my experience, that's the case
08:14Fossiand then you even start to carry the goodness over to javascript and write functional code there as well :)
08:14the-kennyrhickey: I had this problem with Common Lisp.. After CL, I've used Haskell. The switch from haskell/cl was very easy.
08:14the-kennyI tried switching from Common Lisp to Clojure some time ago, but it was hard because of the immutable data structures.
08:15the-kennyAfter haskell, everything was easy and clear :)
08:16esjfor me, rank noob, the problem has been having to travel from clojure into another language to get in depth texts on the new concepts clojure employs, and then translate them back. Effort. This will soon go away as stuff gets written / published.
08:17cemerickThis is one helluva self-selected group, though. Walk into an insurance co or whatever, and people will quite simply blanch at the sight of something like clojure. That's the other end of the spectrum, but hints at what's going on the back of the mind of the "typical developer".
08:19rhickeycemerick: yes, I'm sure Clojure will never be for everyone. Sticking with Lisp was an early decision that sealed that. OTOH, it is interesting to see, given people's broader exposure to other things (vs e.g. when Java was trying to convert C folks), how big the potential base might be
08:20ambalekthe trick is getting people to try it
08:20cemerickit helps a lot that we're well past the point where it's really difficult to get work done if you're using tools that are outside of what "the industry standard" is.
08:21cemericklots of langs will have 15% "market share" as things go along. Lots of good and bad aspects to that, although if we can all agree to stay on some managed platform (jvm/clr), that'll mitigate a lot of the downside.
08:26ambaleksomeone should make a 'try clojure' sandbox
08:26eevar2isn't that what clojurebot is for? ;)
08:26ambalekclojurebot: get on the web will you?
08:26clojurebotI don't understand.
08:26ambalekoh you will
08:27liwpis there a web version of clojurebot? I remember there was a web version of Ruby's irb at some point so one could try Ruby by just playing with the web repl
08:27ambalekyeah
08:27ambalek'try ruby'
08:27liwp~google try ruby
08:27clojurebotFirst, out of 5510000 results is:
08:27clojurebottry ruby! (in your browser)
08:27clojurebothttp://tryruby.sophrinix.com/
08:27ambalek_why made it
08:27ttmrichterHow about porting Clojure to the NekoVM back end?
08:27liwpambalek: yeah, that's right
08:27tomojhuh I didn't know someone had resurrected it
08:28ttmrichterI'll get my own hat and coat, thank you. :)
08:49chouserpiccolino: a "seq" is just an interface, so it could depend on the type of object. But generaly, calling seq on a seq will return itself: http://tinyurl.com/yckufcq/src/jvm/clojure/lang/ASeq.java#L106
09:57Nathellhello
09:57Nathellhas anyone used Ring with Slime?
10:08esjyes
10:13ayalHello. I am working on emacs with slime and was wondering if there exists a way to evaluate multiple files at once.
10:16esjanother question, please: how do I lookup what :: means. (doc '::) fails, not surprisingly.
10:17chouseresj: a good place to start for punctuantion-y things like that is http://agriffis.n01se.net/misc/20091109-10:15:12.png
10:17chouserno
10:17chousernot that
10:17chousertry here: http://clojure.org/reader
10:18esj:)
10:18esjthank-you chouser.
10:19chouserayal: I don't know slime, but you can have a .clj file with a bunch of (load-file "foo.clj") for various foos
10:21esjah. :: means resolve symbol in current namespace.
10:21chouserkeyword. yes.
10:21esjayal: or if you prefer brutality you can copy paste the smaller into the clojure process...
10:22esjkeyword, yes - sorry, I'm still getting over my ruby infestation, where things starting with : are called symbols.
10:23skillet-thiefhi. are there some run time errors that can't be caught with try/catch?
10:24skillet-thiefhere is what i am doing : http://pastebin.com/m69d2137b
10:24skillet-thief
10:24skillet-thief
10:25ayalchouser: I am working on a remote server using swank. I think load-file would not work for me.
10:26chouserayal: ah, I see.
10:28chouserskillet-thief: it's probably laziness tripping you up
10:28skillet-thiefchouser: ah!
10:28chouserskillet-thief: heh. let me know if you need more hints.
10:29skillet-thiefchouser: I'll have to think about that one.
10:30chouserthere are two kinds of scope, right? lexical and dynamic. They interact in complex ways.
10:30skillet-thiefright...
10:30chousertry/catch is dynamic, lazy seqs (since they're built on closures) are lexical
10:31skillet-thiefok, so somehow the exception I'm trying to catch is out of scope.
10:31chouserhm. actually thinking about the lexical scope in this case doesn't help much.
10:32chouserskillet-thief: right. any work that's done to build the lazy-seq while you're still inside the try/catch can throw exceptions that get caught.
10:32skillet-thiefso it looks like the exception that gets caught is caught because the input is rejected immediately before the parsing starts.
10:33chouserbut once you pass that lazy seq out of the try/catch and on to something else that consumes it (for example the printer at the repl), errors caused then are no longer in your try/catch
10:33skillet-thiefok, that makes sense. I suspected the repl was involved somemhow.
10:34skillet-thiefso I should wrap in a doseq or something like that?
10:35chouserhm...
10:37chouserparse-trim returns a map, so just forcing the top level won't help.
10:37chouserthis is a complication I hadn't considered.
10:38chouserwhat do you intend to do with the results?
10:39skillet-thiefsorry, had to step away.
10:39chouserif you just do that work inside the try/catch, then any errors thrown will be caught, but any errors that would be caused by later unparsed parts of the input can just be ignored.
10:40skillet-thiefthat might work. I am trying to sanitize html input. If the parse fails I want to output straight text instead.
10:40chouseroh
10:41chouser(doto (lx/parse-trim rdr) (-> :content doall))
10:41chouserI think that'll force reading of the whole input
10:42chousersince it can't know it's gotten to the last top-level element until it's parsed to the end of the input
10:44skillet-thiefok, that works I think.
10:44skillet-thiefthe error gets caught anyway.
10:46skillet-thiefall right, thanks. I'm going to go read the docs to try to understand why that works. (It's great talking to the package author about my little problems :-)
10:46chouserno so great being the author of a package full of little problems. :-P
10:47chouserbut I'm happy to help! :-)
11:11ol3hello, i want to specialize on the second argument of a multimethod.
11:12ol3(defmulti f [x y] (fn [x y] (class y)))
11:12ol3is this the way to do it?
11:12arsatikiseems sane
11:14ol3thank you, now i need the type of all types, T?
11:15ol3,(class "str")
11:15clojurebotjava.lang.String
11:15ol3,(class (class "str"))
11:15clojurebotjava.lang.Class
11:16ol3,(class (class (class "str")))
11:16clojurebotjava.lang.Class
11:18arohnerol3: what do you mean type of all types?
11:18arohnerdo you mean a generic type?
11:20ol3arohner: the supertype of every object
11:20arohnerjava.lang.Object
11:20ol3thank you :)
11:42ol3sorry for spamming this room but i get this error:
11:42ol3The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)
11:43hiredmanol3: well, it did
11:43ol3so no parameters?
11:43hiredmanwhat do mean?
11:44hiredmandefmulti never took "parameters"
11:46ol3hm
11:46ol3you're right
11:56ol3but it did not work either
11:57ol3i want to specialize on String and Throwable
11:57ol3but
11:57ol3,(class "string")
11:57clojurebotjava.lang.String
11:57ol3works
11:58hiredmanmultimethods are very flexible, so just saying "I want to specialize on String and Throwable" is too broad
12:02lisppaste8Chouser pasted "defmulti/defmethod for ol3" at http://paste.lisp.org/display/90045
12:04hiredman:(
12:04hiredman(comp type first list)
12:06ol3chouser: it works thank you
12:07ol3(defmethod handle-response [Object Throwable] [exchange throwable] ...)
12:07ol3vs
12:07ol3(defmethod handle-response Throwable [exchange throwable] ...)
12:07chouserhiredman: you really do think (fn [x y] (type y)) is less clear than (comp type first list)?
12:08hiredmanchouser: you want the type of the first thing from a list of things
12:08ol3(comp type second list)
12:08hiredmanor second
12:08chouseractually, that's not the same at all. were you talking about seomthing else?
12:08hiredmanchouser: :(
12:08chouserI want the type of the second arg
12:08hiredmannot paying close enough attention
12:09chouseroh well. lunchtime. :-)
12:10hiredman~apologize for me
12:10clojurebotmea culpa!
13:00replaca_First cut of the "up-to-date" clojure core doc robot output up at http://tomfaulhaber.github.com/clojure/
13:03piccolinochouser: thanks for the clarification on seqs.
13:06technomancyreplaca_: looks great!
13:06replaca_technomancy: thanks!
13:07hiredmanmy first reaction was "holy crap, there is a lot of stuff in core" my second reaction was "is that all there is in core?"
13:07replaca_:-)
13:08fogusreplaca_: Is it possible to aggregate the functions/forms like so http://jtra.cz/stuff/lisp/sclr/index.html
13:09hiredmanfogus: have you seen the cheatsheet?
13:09somniumreplaca_: while asking for ponies, would a wiki version with extended examples/docs be possible?
13:09fogusreplaca_: I have
13:10the-kennyI like this reference.
13:10replaca_fogus: not unless we add that info to the source. The documentation is built from source so relies on the metadata on the vars
13:10replaca_fogus: if there were a taxonomy applied their, it would be easy to push it through to the docs
13:11replaca_*their => there
13:11fogusreplaca_: That's what I thought. Not trying to play down your robot's output, it looks great. :)
13:12replaca_somnium: in theory, but we'd need a place to put the wiki, etc. I'm happy to add it, if folks come up wit a way they want to do it
13:12somniumreplaca_: indeed, its awesome already
13:13replaca_fogus: I'm all for the taxonomy, btw, I just worry about bit rot since the robot tracks the source automatically without me doing anything
13:13fogusreplaca_: Understood
13:13replaca_so I'd like it to be attached to the source just like the doc is
13:14replaca_which means (for clojure-core) Rich needs to sign up for it
13:29piccolinoI'm looking at duck-streams, and I am wondering about the variables defined at the top, like *buffer-size*. Is that variable going to be shared by all threads? Assuming that you wanted to read from multiple-streams concurrently, would they all need to have the same buffer size?
13:29somniumpiccolino: you can set thread-local bindings with binding
13:30danlarkinpiccolino: you can alter-var-root, but consider that a last resort
13:31piccolinoSo with binding, you could redefine *buffer-size* and then run a function with that new definition being used?
13:31technomancydanlarkin: you really shouldn't tell people about that. =)
13:31danlarkintechnomancy: :-o
13:32technomancy"By the way, there's a shotgun in the closet which you can use to shoot that thing (or possibly your foot), but you didn't hear that from me."
13:33technomancypiccolino: you run your function that needs the new value of *buffer-size* inside the binding form. once it exits *buffer-size* will be returned to its original value.
13:33piccolinoAnd other threads using the same code will not see that value?
13:34somniumhttp://clojure.org/Vars
13:34somniumI'm wondering, what is the difference between binding and a set! done in a function body? is set! lexically bound? (I've never used set! on a var)
13:35technomancyset! only works inside a binding call IIRC
13:36cemerickset! works on any var that has a non-root binding
13:37cemerickyou don't need to be within the lexical scope of binding...that'd make set! and bindings far less useful
13:39technomancyright; same thing FSVO "inside"
13:39cemerickyeah, I only mentioned lexical scope because somnium did :-)
13:40cemericktechnomancy: FSVO?
13:40technomancyFor Some Value Of
13:40cemerickah
13:41leafwany "filter" function that iterates a sequence and returns true if a query eleemnt is found?
13:41leafwshort of creating a set from it?
13:41technomancy,(doc any?)
13:41clojurebotI don't understand.
13:42the-kennyhm... I think I need a better understanding of the difference between binding and let... Can someone give me some hints?
13:42somniumthanks for the answers (and the wtf package in emacs is great for acronyms btw) :-)
13:44leafw,(doc any?)
13:44clojurebotHuh?
13:44leafwtechnomancy: ?
13:45technomancy~(doc any?)
13:45clojurebotTitim gan éirí ort.
13:45technomancycoulda sworn that was defined. I guess you should just use "some".
13:46maravillasthere's not-any?
13:46technomancy...which always stood out as a particularly poorly-named function. I presume because it was taken from CL?
13:46maravillasbut it doesn't look like there's an any?
13:46cemerick,(doc some)
13:46clojurebot"([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return true if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"
13:47leafw,(doc not-any?)
13:47clojurebot"([pred coll]); Returns false if (pred x) is logical true for any x in coll, else true."
13:48leafwok, "some" is what I wanted.
13:48leafwthanks.
13:56technomancy,(seq (.split "hey.jude" "."))
13:56clojurebotnil
13:56technomancy,(seq (.split "hey jude" " "))
13:56clojurebot("hey" "jude")
13:56technomancywhat's going on there?
13:57technomancyis it treating the "." argument like a regex for some reason?
14:00hiredmansplit takes a regex
14:00hiredmanjust as a string
14:01hiredmanbecuase java doesn't have regex literals
14:01technomancyloverly, thanks.
14:26chouser,(seq (.split #"\." "hey.jude"))
14:26clojurebot("hey" "jude")
14:27technomancychouser: even better not to have to double-escape; thanks
14:36fradiavaloxb
14:45chousertechnomancy: it was long after I had been using String.split that I found Pattern.split. I generally prefer it as well, so I try to help others shorten that gap. :-)
15:03KjellskiGood evening...
15:11jfieldshow do I do Foo.class in clojure?
15:11jfields(Foo/class) didn't seem to work.
15:12chouserjfields: just Foo
15:12jfieldsright. sorry. thanks.
15:12pdrummondIs this the right place to ask about Compojure?
15:13hiredmanpdrummond: there is a google group for compojure, but feel free to ask away
15:15pdrummondYeah, looking on the group now but still confused! It has it's own deps.zip - you know if the clojure jar it uses is clojure 1.0?
15:15hiredmanpdrummond: I believe so
15:16hiredmantheres always that var
15:16hiredman,*clojure-version*
15:16clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}
15:17pdrummondI'm just starting with clojure again after a break. Got clojure/slime installed really easy then I installed Compojure without any problems. But if I do (ns hello-world (:use compojure)) I get a NoClassDefFoundError
15:17the-kennypdrummond: Classpath correct?
15:19hiredman~namespaces
15:19clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
15:19hiredmanthe fact that compojure has that single segment name is rather annoying
15:19pdrummondwell - (System/getProperty "java.class.path") shows compojure.jar but my slime config uses a different clojure.jar and clojure-contrib.jar.
15:20hiredmanpdrummond: what is the full text of the exception?
15:20pdrummond 0: java.lang.Class.forName0(Native Method)
15:20pdrummond 1: java.lang.Class.forName(Class.java:264)
15:20pdrummond 2: clojure.lang.RT.loadClassForName(RT.java:1499)
15:20pdrummond 3: clojure.lang.RT.load(RT.java:385)
15:21pdrummond 4: clojure.lang.RT.load(RT.java:367)
15:21pdrummond 5: clojure.core$load__5058$fn__5061.invoke(core.clj:3734)
15:21pdrummond 6: clojure.core$load__5058.doInvoke(core.clj:3733)
15:21pdrummond 7: clojure.lang.RestFn.invoke(RestFn.java:413)
15:21pdrummond 8: clojure.core$load_one__5010.invoke(core.clj:3578)
15:21pdrummond 9: clojure.core$load_lib__5031.doInvoke(core.clj:3615)
15:21pdrummond 10: clojure.lang.RestFn.applyTo(RestFn.java:147)
15:21pdrummond 11: clojure.core$apply__3243.doInvoke(core.clj:390)
15:21pdrummond 12: clojure.lang.RestFn.invoke(RestFn.java:443)
15:21pdrummond 13: clojure.core$load_libs__5043.doInvoke(core.clj:3641)
15:21pdrummond 14: clojure.lang.RestFn.applyTo(RestFn.java:142)
15:21pdrummond 15: clojure.core$apply__3243.doInvoke(core.clj:390)
15:21pdrummond 16: clojure.lang.RestFn.invoke(RestFn.java:460)
15:21the-kennypdrummond: *Too* much text
15:21pdrummond 17: clojure.core$use__5052.doInvoke(core.clj:3711)
15:21hiredman:(
15:21the-kennyUse lisppaste
15:21pdrummond 18: clojure.lang.RestFn.invoke(RestFn.java:413)
15:21pdrummond 19: pd$eval__3615.invoke(NO_SOURCE_FILE:1)
15:21hiredmanpastebin
15:21pdrummond
15:21pdrummondSorry! New to ERC as well! :(
15:21hiredmanok
15:22hiredmanthat is the slime whatever
15:22the-kennylisppaste8: url
15:22lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
15:22hiredmanI was sorting up hoping for a real stack trace
15:22hiredmans/up/of/
15:22pdrummondOpps o_O!
15:22hiredmanmaybe someone who uses slime can tell you how to get one
15:23pdrummondGoing to try making Compojure and Slime use the same jars. 2 Mins...
15:28pdrummondAnyone know how to restart Slime and have it pick up new vars? slime-restart-inferior-lisp doesn't seem to do it?
15:29technomancypdrummond: re-running M-x swank-clojure-project should do it
15:29pdrummondtechnomancy: never used that - it's asking me for a Project root??
15:30technomancypdrummond: that's the easy way; you shouldn't have to manage your classpath by hand if you use it.
15:30technomancyit'll pick up on all the jars in lib/ in your project root for you
15:31pdrummondAhhh - thanks! Will look into that.
16:00pdrummondhi back! Anyone know why swank-clojure-project hangs on me?
16:00tomojpdrummond: do you have clojure.jar in lib/ or target/dependency?
16:01danlarkinpdrummond: it hangs for me too. I do: M-x-:
16:01danlarkinand then (swank-clojure-project "...")
16:01pdrummond:tomoj yep
16:03pdrummonddanlarkin: sorry, M-x-: ?
16:03pdrummonddanlarkin: Not sure what you mean
16:03danlarkinpdrummond: M-x-: is bound to eval-expression
16:04danlarkinso you could do M-x eval-expression also
16:06pdrummondI see - doesn't seem to be working - just says "Polling /tmp/slime..." but nothing happens!
16:06danlarkinswitch to your inferior lisp buffer and see if it has a stacktrace
16:07pdrummonddanlarkin: Ah! ClassNotFoundException: clojure.main. More classpath woes! Will look into it, thanks.
16:07pdrummondSorry - NoClassDefFoundError
16:08danlarkinpdrummond: are you using a maven project layout? maybe you need to symlink target/dependency/ to lib/?
16:09danlarkinuntil the next release of swank-clojure
16:09danlarkinI think :)
16:11pdrummonddanlarkin: no I was using lib.
16:14wavis__\nick wavis
16:16djorkwhat's the deal with pr and fns
16:16djorkif I get a fn caught up in my data structure, it prints an unreadable form
16:18hiredmancorrect
16:18hiredmanso don't
16:33kefka,(binding [+ *] (+ 3 4))
16:33clojurebot7
16:33kefkaSo I can't locally re-bind a function. Hmm.
16:33kefkaI couldn't on my repl either.
16:34Chousukeyes you can
16:34danlarkinkefka: + has inlines defined
16:34kefkaHow do I do it? What's wrong with what I'm doing above?
16:34Chousuke,(binding [+ *] (+ 1 2 3 4))
16:34clojurebot24
16:34kefkaOk.
16:34Chousuke+ gets inlined, so it fails :/
16:34kefkaI see.
16:34kefkaIs there anything you can bind to cancel out the inlines?
16:35danlarkinwhy do you want to rebind +? :)
16:35Chousukeno. but you can use #'+ instead of + to work around it.
16:35kefka,(binding [#'+ *] (+ 3 4))
16:35clojurebotjava.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol
16:35Chousukeno, I mean, in the actual expression :)
16:35kefka,(binding [+ *] (@#'+ 3 4))
16:35clojurebot12
16:36Chousukethe @ is redundant
16:36kefkaOkay. That helps.
16:36kefka,(#'+ 3 4)
16:36clojurebot7
16:36kefka,((var +) 3 4)
16:36clojurebot7
16:36kefkaCool. So vars are applicative when functions.
16:36Chousukevars redirect invocation to their values
16:36kefkaMakes sense.
16:39kefkaChousuke: Thanks. I can now do what I'm looking to do, I think.
17:16shmaywhat exactly does 'sync' do? how is it different from dosync?
17:18djork,(doc sync)
17:18clojurebot"([flags-ignored-for-now & body]); transaction-flags => TBD, pass nil for now Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls. Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of sync. The exprs may be run more than once, but any effects on Refs will be atomic."
17:18shmaythanks, but that was what was confusing
17:18djorkright
17:18djorklooks confusing to me :)
17:18djork,(doc dosync)
17:18clojurebot"([& exprs]); Runs the exprs (in an implicit do) in a transaction that encompasses exprs and any nested calls. Starts a transaction if none is already running on this thread. Any uncaught exception will abort the transaction and flow out of dosync. The exprs may be run more than once, but any effects on Refs will be atomic."
17:19djorksync is in-development, right
17:19djork?
17:20djorkI have no idea, really
17:20shmayi was just looking at ants.clj, and rich used it, so i wanted to figure it out
17:20djorkhmm
17:20chousersync is older
17:21chouserit has an arg for "flags-ignored-for-now", which afaik still has no usable options.
17:21shmayso it's basically the same as dosync?
17:21chouserI think rhickey just didn't want to keep making people write (sync nil ...), so he provided (dosync ...)
17:21chouser,(macroexpand '(dosync a b c))
17:21clojurebot(. clojure.lang.LockingTransaction (clojure.core/runInTransaction (clojure.core/fn [] a b c)))
17:22chouser,(macroexpand-1 '(dosync a b c))
17:22clojurebot(clojure.core/sync nil a b c)
17:22chouseryes. the same. :-)
17:23shmaygot it, thanks chouser and djork
17:23hiredman~def contains?
17:23hiredmanpfft
17:23hiredmanRT? cheater
17:23chouserheh
17:23hiredman~def c.l.RT
17:27spuzI'm reading Stuart Holloway's Programming Clojure and still trying to understand exactly when macros are useful. The book says that almost all macros fall into one of 6 categories, however as far as I can tell, the all fall into the last which is "Avoiding a lambda". Couldn't you implement most of Clojure's macros by passing in a lambda function as an argument rather than direct function calls?
17:27spuzFor example to implement when as a function: (defn whenfn [predicate functiontoevaliftrue args] (if predicate (functiontoevaliftrue args) nil))
17:28ordnungswidrighi
17:29hiredmanmy librarything says I am reading Programming Clojure, but is really in the middle of a stack of computer related books on one of my desks, so I cannot comment on what it says
17:30spuzhiredman: well basically it says the six occations when you might want to use a macro are "conditional evaluation, defining vars, java interop, postponing evaluation, wrapping evaluation or avoiding a lambda"
17:31leafwhow to do (apply str (range 10)) but with #(str % \tab) ? For some reason, the latter as pred of apply fails
17:31spuzthe when macro apparently falls into the "conditional evaluation" category
17:31ordnungswidrigIs there a short notation for a map get on a fixed key? Sth. like #(get % :a)
17:31leafwie. how to print a list with elements separated with tabs?
17:31ordnungswidrigI'm doing a (-> map :key1 :key2 :key3) but key4 is not a symbol but a string
17:31chouserspuz: macros allow you to avoid all kinds of repetition, including the manual creation of lambdas
17:31leafwshort of doseq etc with prn
17:32hiredmanordnungswidrig: use get
17:32hiredman(get "foo")
17:32chouserspuz: 'when' could be implemented using a lambda, as you say, but it *isn't* -- no new function is defined (at compile time) or instantiated.
17:32hiredman(-> foo (get "bar")) ~ (get foo "bar")
17:32ordnungswidrighiredman: I cannot partial get because the map comes first in the argument list.
17:32hiredmanyou don't need to
17:33ordnungswidrighiredman: magic
17:33hiredman,(-> {:a 1} (get :a))
17:33clojurebot1
17:33hiredmanit's how -> works
17:33spuzchouser: thanks that pretty much answers my question
17:33ordnungswidrighiredman: I see but I cannot believe :-) Does -> simply insert the first argument?
17:33hiredmanyes
17:34hiredman->> inserts the last
17:34ordnungswidrighmmm and -2> the second? ;-)
17:35hiredmanthe was a post recently on the group about generalizing the pattern by using substitution of a special symbol
17:36ordnungswidrigspecial symbol?
17:37hiredman(-> foo (get :$ :a) (map inc :$))
17:37spuzchouser: I guess I had the impression that macros were a bit more magical and mysterious but I see what they are good at is encapsulating the use of special forms
17:38ordnungswidrighiredman: I see
17:38hiredmanthey are good for making things look like special forms
17:38Chousukespuz: your function-when is not strictly correct as the args get evaluated in all cases.
17:38ordnungswidrigbrb
17:38hiredman:$ is funny looking
17:38ChousukeI liked the let-> idea
17:39Chousuke(let-> [x init] (foo x) (bar x) ...)
17:39hiredman:|
17:39Chousukewhere x always gets rebound to the result of the previous expression, of course
17:40hiredmanI see
17:41_mstwould (let-> [x (println "foo")] (foo x) (bar x) ...) print twice? (not that I'm saying it's a good idea :P)
17:41spuzChousuke: ah yes, in that case I guess you would need a lambda for every argument which would incredibly ugly
17:43hiredmanspuz: actually I have a macro that cannot be replaced with a λ
17:44hiredmanit loads a property file into a clojure map at macroexpand/compile time, so at runtime there is just a clojure map of properties
17:44hiredmanand I don't have to ship the properties file
17:44hiredmanwell, deploy the properties file
17:44spuzhiredman: that's pretty neat :)
17:45hiredmangod, who ships things these days besides microsoft?
17:45hiredmanspuz: and it was so simple
17:45spuzgreat for compile time parameters, not so much for run time parameters I guess
17:45hiredmanyeah
17:46hiredmanhttp://gist.github.com/226651 <-- line 11
17:49spuzhiredman: nice
17:49spuzanyway enough clojuring, bed time :p
18:55twbrayJust a hypothesis.... might it be the case that Java gc is single-threaded?
19:02twbrayHmm... maybe -XX:+UseParallelGC is my friend
19:23hiredman~google headius favorite jvm flags
19:23clojurebotFirst, out of 272 results is:
19:23clojurebotHeadius: My Favorite Hotspot JVM Flags
19:23clojurebothttp://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html
19:23hiredman:D
19:36neilmock,(doc use)
19:36clojurebot"([& args]); Like 'require, but also refers to each lib's namespace using clojure.core/refer. Use :use in the ns macro in preference to calling this directly. 'use accepts additional options in libspecs: :exclude, :only, :rename. The arguments and semantics for :exclude, :only, and :rename are the same as those documented for clojure.core/refer."
19:38neilmockthis doesn't appear to have an effect on the current namespace
19:39neilmocksorry just trying to figure it out as a beginner, i know it works properly in the ns macro
20:02tomojis it possible to build a hash inside syntax-quote?
20:02sudoeranyopen using vimclojure? I ahve installed it, but cant get any syntax highlighting to appear
20:03tomojI've been trying stuff like `{~@(apply concat (for [i (range 10)] [i i]))} but getting ArrayIndexOutOfBounds exceptions
20:03tomojI was able to make it work with `(into {} ....), but that seems silly
20:04chousertomoj: you need an even number of forms inside the {} at read time
20:04sudoerhow can I tell if vimclojure is running?
20:05tomojchouser: I see.
20:05tomojso no way to have a macro to expand into a literal hash?
20:05tomoj(no non-trivial way I mean.. `{3 3} works)
20:06chouserwith forms inside `{} it's not really literal anyway
20:06chouser,'`{a b c d}
20:06tomojbut I mean, after the macro is expanded
20:06clojurebot(clojure.core/apply clojure.core/hash-map (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/a)) (clojure.core/list (quote sandbox/b)) (clojure.core/list (quote sandbox/c)) (clojure.core/list (quote sandbox/d)))))
20:06chouserbiab
20:06tomojright now my macro expands to (into {} ...), where I would want it to expand to just {...}
20:07tomojooh
20:07tomojI didn't know {} was weird like that
20:13tomojwell, if anyone feels like critiquing my macro chops: https://gist.github.com/4952f067ca8114e2e26b
20:18chouseractually it's ` that's weird like that.
20:18chouser,'`[a b]
20:18clojurebot(clojure.core/apply clojure.core/vector (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/a)) (clojure.core/list (quote sandbox/b)))))
20:19chouser,'`(a b)
20:19clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/a)) (clojure.core/list (quote sandbox/b))))
20:19tomojoh I think I understand
20:20chouserso you might was well just `(apply hash-map ~@(for ...))
20:20tomoj` transforms literals into code that builds the forms that would look like that
20:20chouserright
20:22chousertomoj: if that works for you, you can leave it alone. But I would have tried to move pretty much the entire (fn ...) into a stand-alone function, and pass key-fn-map into it.
20:23tomojyeah it would probably be more readable if broken up
20:23chouserI may be overlooking something that would make that undesirable, but in general it's good to have a macro do as little as possible itself, relying on helper functions.
20:24chouserright, more readable, easier to test and debug.
20:24tomojyeah..
20:24tomojslime-macroexpand-1 helps a lot, but small functions are still easier
20:24chouseralso, sometimes people want to build on top of existing macro and having helper functions to call instead can ease that quite a bit.
20:24chouseranyway, if it works I don't know that I'd bother changing it around.
20:25tomojnope.. it's purpose at this point has a very limited scope anyway
20:25tomojI was mainly wondering if I was doing anything idiotic with syntax-quote and ~ etc
20:25tomojsince I built it by trial-and-error really :(
20:33technomancywhat's the reasoning behind keywords not implementing IMeta?
20:38danlarkintechnomancy: because there's only one copy for the whole vm
20:39technomancy,(identical? 'foo 'foo)
20:39clojurebotfalse
20:39technomancy,(identical? :foo :foo)
20:39clojurebottrue
20:39technomancyI see
20:39technomancythanks
20:44vogon_poethi, i'm new here
20:44vogon_poetwhat is the etiquette?
20:44chouservogon_poet: be friendly, ask your question, post your comment, don't paste more than a line or two at a time.
20:45chouservogon_poet: welcome!
20:45vogon_poetthanks!
20:45vogon_poetis there anyone here familiar with Incanter?
20:45technomancythe only rule we have that you'll want to keep in mind is: no poetry bad enough to cause permanent mental scarring.
20:46the-kennyvogon_poet: Oh, and please don't read the poetry of your race to us :)
20:46_ato:) I was just typing the exact same thing
20:46the-kennyOh, lol
20:47replaca_I think everyone has established their geek cred :-)
20:47vogon_poetyes
20:47vogon_poet(i can write some REALLY TERRIBLE poetry. but i won't subject you to it.)
20:48_atowow, incanter looks nice (I hadn't heard of it)
20:49vogon_poetyeah, it is really nice as a replacement for R
20:49vogon_poetbut my problem is i can't get it to work outside of the prepackaged REPL it comes with
20:49JAS415i just want to note that clojure + erlang = sweet (although kind of redundant)
20:49vogon_poetrunning inside of VimClojure, i get this error
20:50vogon_poetClojure
20:50vogon_poetClojure=> (use '(incanter core))
20:50vogon_poet#<CompilerException java.lang.NoClassDefFoundError: cern/colt/matrix/tdouble/impl/DenseColDoubleMatrix2D (REPL:0)>
20:50vogon_poetClojure=>
20:50vogon_poetsome guy on the clojure google group had the same problem, but his solution was basically voodoo and didn't apply to me anyway
20:50replaca_vogon_poet: do you have the incanter library in your classpath. He preinstalls a lot of stuff
20:50vogon_poetas far as I can tell, yes
20:51chouserthat's definitely a classpath-related error
20:51vogon_poetyeah
20:51chousercan you find DenseColDoubleMatrix2D.class in a jar or dir somewhere.
20:51vogon_poetone of the responses to the google group suggested that it's caused by the classpath of the jar files and my own classpath somehow colliding
20:52chouserhow are you setting your classpath?
20:53vogon_poeteverything i need for vimclojure, and as far as i know everything for incanter, is in an environment variable in my .bashrc
20:53vogon_poetand it's part of the command i've set up to start up the backend for vimclojure
20:53vogon_poetMac OS X, btw
20:54_atoparallelcolt-0.7.2.jar
20:54_atois the one that class is from
20:55chouservogon_poet: try this at your repl: (System/getProperty "java.class.path")
20:56vogon_poet"/Users/mike/clojure/clojure/clojure.jar:/Users/mike/clojure/clojure-contrib/clojure-contrib.jar:/Users/mike/clojure/vimclojure-2.1.2/build/vimclojure.jar:/Users/mike/clojure/incanter/incanter.jar:/Users/mike/clojure/incanter/lib/*:/Users/mike/clojure/incanter/lib/processing/*"
20:56_atonote that if your vimclojure startup script does java -cp something it's gonna override the CLASSPATH environment variable
20:57_atovogon_poet: are you using java 6? the wildcard classpath doesn't work in java 5
20:57vogon_poetnope, java 5
20:58_atoah that'd be it
20:58vogon_poeti suppose this means i have to put all those jars into my classpath individually?
20:58_atoyeah
20:58_atoor do something like:
20:59JAS415sudo apt-get java 6 :-P
20:59JAS415or w/e
20:59vogon_poeti'm on a mac
20:59vogon_poetwhich i suspect has java 6 installed
20:59_atoCLASSPATH=$(echo lib/* processing/* | sed 's/ /:/g')
20:59vogon_poetbut i've already dealt with enough icky configuration tonight and i don't even want to think about that
21:00vogon_poetoh
21:00vogon_poetthank you!
21:00the-kennyvogon_poet: There should be an app called "Java Preferences" in /Application/Utilities or so. You can set the active java version there.
21:03vogon_poetPROBLEM SOLVED
21:03vogon_poetthank you so much
21:03vogon_poeti love all of you
21:04hiredman~love
21:04clojurebotI don't understand.
21:04hiredman:/
21:04chouserseems about right
21:05chouser<20 minutes from "new here" to "problem solved". way to go guys.
21:06the-kenny:)
22:13hiredmanclojurebot: entertain me
22:13clojurebotPardon?
22:27_atonyaha! placeholder page up: http://clojars.org/
22:28arbschtI'm drawing the line at 'clojars'. any more puns on 'closure' will be duly ignored.
22:30_atoarbscht: clojurejars was just too long. :)
22:33chouser_ato: the ruby link at the bottom seems broken
22:34_atoyeah their site is currently down
22:34chouseroh
22:34_atonot a good thing to cop perhaps :p
22:34chouser:-)
22:35_atothey're in the process of taking over the rubygems.org domain, so it might be related to that
22:53technoma`_ato: are you sure you didn't mean to link to gemcutter.org?
22:54_atoah
22:54_atoyeah you're right
22:54_mstI was wondering why I couldn't find rubycutter.org in google :)
22:54_atoah
22:54_atoit's back up
22:54_atoit was down too
22:54_atoI swear! :)
23:00technomancy_ato: how do you plan on letting users manage uploads?
23:05_atotechnomancy: I was planning on adding a "push" command to your tool actually! :-)
23:06technomancy_ato: awesome. so are you going to use scp, or a web service, or what?
23:06technomancyfor the actual transport + auth?
23:07_atohadn't thought that far ahead. I was going to look at what maven's deploy command supports so that maven users can push to it as well
23:07_mstgithub's "paste your public key" approach is quite nice. Easy to set up...
23:08_atoyeah
23:08technomancyit's certainly simpler than the sourceforge approach of giving every user an actual unix shell account.
23:08_atoproblem is it's probably not so good for windows users
23:09_atoalthough there are pure java ssh libraries so maybe it's not so hard, just have the tool gen the key for them
23:10_atoI was also thinking a basic web form where you can just upload a jar in your browser and pick and choose dependencies for really simple projects, so you don't need to download/configure anything
23:13technomancyfocus on one method first and get that rock solid; it's easy to get distracted in other things you think "might be useful"
23:13_atoyeah true.
23:14technomancyivy and maven share the same repository format, working on adding capra support is probably a sidetrack of little value for now.
23:15_atogiven that nothing uses capra yet, yes I agree. :)
23:15qedCould someone explain apply and reduce to me?
23:15qedThey seem to work alike, but they seem different somehow
23:16JAS415much different
23:16qedtheir documentation for instance, apply f args* argseq
23:16technomancyanyway, I think this is important. people don't bother with dependency management because they get scared away by all the overhead and jargon of maven, but doing that stuff by hand is very tedious
23:16chouserqed: (apply foo a b c [d e f]) is the same as (foo a b c d e f)
23:16chouserqed: that is, foo is called once with all the args
23:17technomancyqed: reduce is for accumulating a single value by calling a function once for every element in a sequence.
23:17chouserqed: (reduce foo x [a b c]) is (foo (foo (foo x a) b) c)
23:17qedso what's the difference between (apply + [1 2 3])
23:17qedand (reduce + [1 2 3])
23:18technomancyqed: apply is a single function call
23:18_ato~def +
23:18_mst_ato: what's the use-case for the 'pull' side of it? Would it be a command to pull all required jars into a specified directory, or some sort of gems-like system-wide repository?
23:18chouserthat is, foo is called repeatedly, once for each element of the seq, with two args: the previous result of foo and the elemnt itself.
23:18_ato+ with more than 2 arguments calls reduce
23:18qedso it's idiomatic?
23:18_atoyes, either is fine
23:19_atoapply + is probably slightly more common
23:19qed_ato: was that a yes, it is idiomatic?
23:20_atoqed: yes
23:20qedokay cool, thanks technomancy chouser _ato
23:21chouserrhickey has recommended 'reduce' in general, 'apply' for (apply str ...) in particular because it is more efficient.
23:22_ato_mst: I'm going to let technomancy figure that part out. But the idea is if you want to use Clojure with maven (which is a per-user local repository usually) you can just add clojars.org to your ~/.m2/settings.xml
23:22technomancyreduce is a personal favourite of mine
23:22qedi tend to use reduce
23:22_mstright, yep
23:22qedive been hearing about clojure and grable?
23:22qedwhats up with that?
23:24technomancy_ato: you'll let me figure out what?
23:25_atotechnomancy: leiningen just uses maven's repository right?
23:25_atoI mean for storing downloaded stuff
23:25_atoand has a command to unpack into your project?
23:25technomancyit uses maven-ant-tasks to fetch dependencies from a maven repo, yeah.
23:26_mst"uberjar". nice :)
23:26qedwhats that called?
23:26qednot grable is it?
23:26JAS415gradle?
23:26qedyes, thank you
23:27qedhttp://m.3wa.com/?p=350
23:27qedread that the other day FWIW...
23:27JAS415yeah, you can use clojure with pretty much any java library
23:27qedive never learned maven, never learned java, went straight to the ruby stuff :\
23:28qedso maven looks extra scary to me
23:28_atoah gradle uses Ivy, so it does maven repos as well
23:28qedwish i knew what the hell that meant :)
23:28_atoqed: it just means you can use the same packages with gradle as with maven or ivy or leiningen
23:29qedah
23:29chouserI'm just biding my time until these smart and knowledgable folks get everything running smoothly.
23:29chouserThen I'll follow the tutorial.
23:29qed^
23:30qedwhat is the preferred setup for the clojure-ist?
23:30qedI've been using emacs and swank-clojure
23:30JAS415that's what i use
23:30JAS415slime is nice too
23:30qedyeah using that as well
23:30JAS415paredit mode?
23:31qedswank-clojure, clojure-mode, slime, paredit
23:31JAS415yup
23:31qedit's a sweet little setup
23:31qedit feels pretty good once you get into it
23:31JAS415yeah there's a bit of a learning curve, but once you get it it goes pretty well
23:32qedproject euler really got me to buckle up and start learning clojure
23:32qedthe code is small enough so you dont feel like the extra 10-15 minutes you spend navigating the editor is really *that* painful
23:32qederrr i should have said i learned emacs with clojure sort of concurrently
23:32qedpun intended
23:35qedwhen i map a function like (map #(fn %))
23:35qedCan i specify the input twice by using 2 %
23:35qedlike (map #(+ % %))
23:36qedon some seq
23:36JAS415yes
23:36wavis,(apply #(+ %1 %2) (list 3 4))
23:36clojurebot7
23:38JAS415re project euler: project euler is fun, another good exercise is to write a small application thing
23:38JAS415i did a little twitter client myself
23:39qedwavis: thanks -- that's awesome
23:39JAS415although i guess you do end up seeing some of the ugly doing stuff like that
23:39wavis:) maybe not exactly what you asked for, but it's a "you can also..."
23:39qeduser> (map #(Math/pow % %) [1 2 3])
23:39qed(1.0 4.0 27.0)
23:41qedexcept Math/pow wont go that high
23:43JAS415how high?
23:43_atoemit: there's a expt function in clojure.contrib.math which might work
23:43_atoqed: ^ (i meant)
23:43hiredmanerm
23:43qedyeah im trying that now
23:44hiredmanI seem to recall that contrib.math was just sort of a rough sketch
23:44qedhow would you get the last ten integers in a bigint
23:44qedlike take -10?
23:48hiredmanbigint has a bit clear method
23:49qedhow about the last 10 elements of a sequence?
23:49somnium,(take 3 (reverse [1 2 3 4 5 6]))
23:49clojurebot(6 5 4)
23:49qedoh man, duh
23:49qedthank you
23:50somniumless verbose than than (drop-while (- (count coll) n))
23:52hiredman,((comp first filter) (comp (partial = 10) count) (iterate rest (range 20)))
23:52clojurebot(10 11 12 13 14 15 16 17 18 19)
23:53qed(apply str (reverse (take 10 (reverse (seq (str (reduce + (map #(expt-int % %) (range 1 1001)))))))))
23:53qedis there any better way to do that?
23:54qedthat finds the last 10 digits of 1^1 + 2^2 + 3^3 ... 1000^1000
23:54hiredmanhave you looked at http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html
23:54qedi find myself using that whole str->seq->str thing a lot
23:54hiredmanbigint has an xor method and a bitset method
23:54qedand it feels sort of wrong
23:55qedthanks hiredman ill check it out
23:57_ato:D
23:57_atoneeds away to specify repositories, it can't find clojure.jar snapshot
23:58sudoeruh, what method should I use to split a string?
23:59_ato,(vec (.split "foo bar" " "))
23:59clojurebot["foo" "bar"]