#clojure log - Nov 09 2009

The Joy of Clojure
Main Clojure site
Google Group
List of all logged dates

0:13 technomancy: is it kosher to use org.clojure for the groupId of your own projects?

0:14 or should you only use a domain if it's one you are associated with?

0:26 are "Don't know how to create ISeq from: Keyword" errors when AOTing code that works fine otherwise indicative of a certain type of problem?

0:26 _ato: technomancy: 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

0:26 technomancy: definitely not going to use my own domain

0:27 since 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

0:28 using 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.

0:28 _ato: yeah, I agree

0:28 technomancy: it's a curious custom

0:29 _ato: but maven kind of forces it on you

0:29 it makes sense from a name collision purity standpoint, but it's damn ugly

0:29 technomancy: we 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

0:29 djork: few days? s/old-domain/new-domain/g

0:30 technomancy: djork: java devs... what can you do. (I wasn't working on that project myself.)

0:30 djork: heh

0:30 technomancy: _ato: maven forces you to use a group ID, but that's it; it's only convention that says it must be a domain.

0:30 lots of projects use their name as their group ID too

0:31 _ato: yeah but to get uploaded to maven central repo you must have a domain

0:31 I know some don't

0:32 but that was because they were uploaded before they made that policy

0:32 technomancy: ah, that's a shame

0:32 * technomancy has high hopes for a clojure-community-specific maven repo

0:40 technomancy: I'm seeing long pauses at the end of the "compile" cycle with clojure-maven-plugin

0:40 no CPU, disk, or network usage

0:40 _ato: Thread.sleep(10); // coffee break

0:40 :p

0:41 technomancy: also 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.

0:42 _ato: yeah, 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

0:44 technomancy: by work a lot better, do you just mean that they don't require any XML and don't invent a lot of new words?

0:46 you 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.

0:47 _ato: yeah that and it's really easy to get things into the central repository (http://gemcutter.org/)

0:48 and you don't need to fuss around with version numbers when you just don't care

0:49 technomancy: _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.

0:49 but otherwise I am in agreement

0:54 I 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.

4:10 piccolino: If you call seq on something that's already a sequence, does that create an extra object, or does it just return itself?

4:12 _ato: piccolino: just return itself

4:12 piccolino: Thanks.

7:37 ol3: hello, how do I convert an java map to a clojure map?

7:38 liwp: ol3: try (into {} <your java map>)

7:38 ol3: you can use the java map like a clojure map in most places, IIRC

7:38 eevar2: better yet; don't, unless you must

7:40 liwp: ,(get (System/getProperties) "os.arch")

7:40 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)

7:40 liwp: blah

7:40 anyhow, java maps (and hashtables) can be used anywhere where you would use a clojure map

7:41 hiredman: erm

7:41 I don't believe conj will work on a java map

7:42 liwp: hiredman: true

7:43 hiredman: and into uses conj (conj! on master I guess)

7:44 liwp: hiredman: but in the into example above we're using conj with a clojure map and we seq the java map

7:44 hiredman: indeed

7:44 liwp: (into {} (System/getProperties)) definitely works

7:44 hiredman: sure

7:44 the reverse would not

7:44 liwp: agreed

7:45 so 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?

7:46 hiredman: I suppose

7:46 but really you aren't using a map in that into example, you are using something seq returns a seq for

7:46 liwp: yep

7:47 hiredman: anyway :P

7:47 liwp: ;)

7:53 cemerick: cgrand set me straight on this a while ago, but is it the case that host invocations in -> can't be hinted?

7:53 * cemerick has a mind like a sieve :-/

7:53 AWizzArd: rhickey: there now is a bug in reading deftypes where a field name contains a "-"?

7:54 For example (deftype foo [a b some-key])

7:54 cemerick: AWizzArd: java names are necessary at this point

7:54 hiredman: - is not valide in java names

7:54 AWizzArd: when I then make a (foo 1 2 3) I can access (:a my-foo) but not (:some-key my-foo)

7:54 cemerick: oki, I see

7:55 cemerick: there are apparently plans to resolve that, but probably a low priority right now

7:55 AWizzArd: however, ((keyword "some-key") my-foo) works :)

7:56 also (get my-foo :some-key)

7:56 cemerick: yes, the issue is in the generation of the 'native' callsite associated with keyword lookup

7:56 hiredman: only literal keywords get the fast path to field access

8:02 cgrand: cemerick: http://www.assembla.com/spaces/clojure/tickets/205-Preserve-type-hints-set-on-inlined-or-interop-forms has a patch for that

8:03 cemerick: ah-ha

8:04 I thought I was going nuts.

8:04 cgrand: if you pick this patch don't forget http://www.assembla.com/spaces/clojure/tickets/206-make----and-----metadata-aware, they taste great together

8:04 cemerick: wow, that patch requires compiler changes. That's a little surprising.

8:05 thankfully, I don't do much with arrays :-)

8:05 I just get tripped up on 205 every time I touch ByteBuffers, etc.

8:08 rhickey: cgrand: both patches approved, should go in soon

8:09 cgrand: rhickey: cool, thanks

8:09 rhickey: hrm, someone tweeted "Clojure makes easy things hard, and hard things easy" :(

8:10 AWizzArd: there will be more such misconceptions in the future

8:10 eevar2: fits better for haskell :p

8:11 cemerick: rhickey: I can see that, esp. for typical Java folk.

8:11 the-kenny: rhickey: You should ask what's an "easy thing" in clojure :)

8:12 chouser: If you're used to imperative with mutable everything, trying to rewire your brain for functional and immutable does take real effort.

8:12 the-kenny: chouser: That's true.

8:12 Fossi: well, it's surely a bit hard for some people (me incl) to get their heads wrapped around their data instead of doing things imperatively

8:12 so i can see that part

8:12 the-kenny: But this isn't a problem of clojure.

8:12 cemerick: that, and clojure does not lend itself to any kind of copy/paste coding, which is outrageously common

8:12 rhickey: yes, I'd hope this is more of a speedbump/learning curve thing than a persisting property once you are familiar with it

8:13 Fossi: and of course clojure is cool for more complex things you want to do to that data afterwards

8:13 rhickey: from my experience, that's the case

8:14 and then you even start to carry the goodness over to javascript and write functional code there as well :)

8:14 the-kenny: rhickey: I had this problem with Common Lisp.. After CL, I've used Haskell. The switch from haskell/cl was very easy.

8:14 I tried switching from Common Lisp to Clojure some time ago, but it was hard because of the immutable data structures.

8:15 After haskell, everything was easy and clear :)

8:16 esj: for 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.

8:17 cemerick: This 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".

8:19 rhickey: cemerick: 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

8:20 ambalek: the trick is getting people to try it

8:20 cemerick: it 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.

8:21 * hoeck writes code for insurance agents : /

8:21 cemerick: lots 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.

8:22 * rhickey looks forward to 15% market share :)

8:26 ambalek: someone should make a 'try clojure' sandbox

8:26 eevar2: isn't that what clojurebot is for? ;)

8:26 ambalek: clojurebot: get on the web will you?

8:26 clojurebot: I don't understand.

8:26 ambalek: oh you will

8:27 liwp: is 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

8:27 ambalek: yeah

8:27 'try ruby'

8:27 liwp: ~google try ruby

8:27 clojurebot: First, out of 5510000 results is:

8:27 try ruby! (in your browser)

8:27 http://tryruby.sophrinix.com/

8:27 ambalek: _why made it

8:27 ttmrichter: How about porting Clojure to the NekoVM back end?

8:27 liwp: ambalek: yeah, that's right

8:27 tomoj: huh I didn't know someone had resurrected it

8:28 ttmrichter: I'll get my own hat and coat, thank you. :)

8:49 chouser: piccolino: 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

9:57 Nathell: hello

9:57 has anyone used Ring with Slime?

10:08 esj: yes

10:13 ayal: Hello. I am working on emacs with slime and was wondering if there exists a way to evaluate multiple files at once.

10:16 esj: another question, please: how do I lookup what :: means. (doc '::) fails, not surprisingly.

10:17 chouser: esj: a good place to start for punctuantion-y things like that is http://agriffis.n01se.net/misc/20091109-10:15:12.png

10:17 no

10:17 not that

10:17 try here: http://clojure.org/reader

10:18 esj: :)

10:18 thank-you chouser.

10:19 chouser: ayal: I don't know slime, but you can have a .clj file with a bunch of (load-file "foo.clj") for various foos

10:21 esj: ah. :: means resolve symbol in current namespace.

10:21 chouser: keyword. yes.

10:21 esj: ayal: or if you prefer brutality you can copy paste the smaller into the clojure process...

10:22 keyword, yes - sorry, I'm still getting over my ruby infestation, where things starting with : are called symbols.

10:23 skillet-thief: hi. are there some run time errors that can't be caught with try/catch?

10:24 here is what i am doing : http://pastebin.com/m69d2137b



10:25 ayal: chouser: I am working on a remote server using swank. I think load-file would not work for me.

10:26 chouser: ayal: ah, I see.

10:28 skillet-thief: it's probably laziness tripping you up

10:28 skillet-thief: chouser: ah!

10:28 chouser: skillet-thief: heh. let me know if you need more hints.

10:29 skillet-thief: chouser: I'll have to think about that one.

10:30 chouser: there are two kinds of scope, right? lexical and dynamic. They interact in complex ways.

10:30 skillet-thief: right...

10:30 chouser: try/catch is dynamic, lazy seqs (since they're built on closures) are lexical

10:31 skillet-thief: ok, so somehow the exception I'm trying to catch is out of scope.

10:31 chouser: hm. actually thinking about the lexical scope in this case doesn't help much.

10:32 skillet-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:32 skillet-thief: so it looks like the exception that gets caught is caught because the input is rejected immediately before the parsing starts.

10:33 chouser: but 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:33 skillet-thief: ok, that makes sense. I suspected the repl was involved somemhow.

10:34 so I should wrap in a doseq or something like that?

10:35 chouser: hm...

10:37 parse-trim returns a map, so just forcing the top level won't help.

10:37 this is a complication I hadn't considered.

10:38 what do you intend to do with the results?

10:39 skillet-thief: sorry, had to step away.

10:39 chouser: if 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:40 skillet-thief: that might work. I am trying to sanitize html input. If the parse fails I want to output straight text instead.

10:40 chouser: oh

10:41 (doto (lx/parse-trim rdr) (-> :content doall))

10:41 I think that'll force reading of the whole input

10:42 since it can't know it's gotten to the last top-level element until it's parsed to the end of the input

10:44 skillet-thief: ok, that works I think.

10:44 the error gets caught anyway.

10:46 all 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:46 chouser: no so great being the author of a package full of little problems. :-P

10:47 but I'm happy to help! :-)

11:11 ol3: hello, i want to specialize on the second argument of a multimethod.

11:12 (defmulti f [x y] (fn [x y] (class y)))

11:12 is this the way to do it?

11:12 arsatiki: seems sane

11:14 ol3: thank you, now i need the type of all types, T?

11:15 ,(class "str")

11:15 clojurebot: java.lang.String

11:15 ol3: ,(class (class "str"))

11:15 clojurebot: java.lang.Class

11:16 ol3: ,(class (class (class "str")))

11:16 clojurebot: java.lang.Class

11:18 arohner: ol3: what do you mean type of all types?

11:18 do you mean a generic type?

11:20 ol3: arohner: the supertype of every object

11:20 arohner: java.lang.Object

11:20 ol3: thank you :)

11:42 sorry for spamming this room but i get this error:

11:42 The syntax for defmulti has changed. Example: (defmulti name dispatch-fn :default dispatch-value)

11:43 hiredman: ol3: well, it did

11:43 ol3: so no parameters?

11:43 hiredman: what do mean?

11:44 defmulti never took "parameters"

11:46 ol3: hm

11:46 you're right

11:56 but it did not work either

11:57 i want to specialize on String and Throwable

11:57 but

11:57 ,(class "string")

11:57 clojurebot: java.lang.String

11:57 ol3: works

11:58 hiredman: multimethods are very flexible, so just saying "I want to specialize on String and Throwable" is too broad

12:02 lisppaste8: Chouser pasted "defmulti/defmethod for ol3" at http://paste.lisp.org/display/90045

12:04 hiredman: :(

12:04 (comp type first list)

12:06 ol3: chouser: it works thank you

12:07 (defmethod handle-response [Object Throwable] [exchange throwable] ...)

12:07 vs

12:07 (defmethod handle-response Throwable [exchange throwable] ...)

12:07 chouser: hiredman: you really do think (fn [x y] (type y)) is less clear than (comp type first list)?

12:08 hiredman: chouser: you want the type of the first thing from a list of things

12:08 ol3: (comp type second list)

12:08 hiredman: or second

12:08 chouser: actually, that's not the same at all. were you talking about seomthing else?

12:08 hiredman: chouser: :(

12:08 chouser: I want the type of the second arg

12:08 hiredman: not paying close enough attention

12:09 chouser: oh well. lunchtime. :-)

12:10 hiredman: ~apologize for me

12:10 clojurebot: mea culpa!

13:00 replaca_: First cut of the "up-to-date" clojure core doc robot output up at http://tomfaulhaber.github.com/clojure/

13:03 piccolino: chouser: thanks for the clarification on seqs.

13:06 technomancy: replaca_: looks great!

13:06 replaca_: technomancy: thanks!

13:07 hiredman: my 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:07 replaca_: :-)

13:08 fogus: replaca_: Is it possible to aggregate the functions/forms like so http://jtra.cz/stuff/lisp/sclr/index.html

13:09 hiredman: fogus: have you seen the cheatsheet?

13:09 somnium: replaca_: while asking for ponies, would a wiki version with extended examples/docs be possible?

13:09 fogus: replaca_: I have

13:10 the-kenny: I like this reference.

13:10 replaca_: 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:10 fogus: if there were a taxonomy applied their, it would be easy to push it through to the docs

13:11 *their => there

13:11 fogus: replaca_: That's what I thought. Not trying to play down your robot's output, it looks great. :)

13:12 replaca_: 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:12 somnium: replaca_: indeed, its awesome already

13:13 replaca_: 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:13 fogus: replaca_: Understood

13:13 replaca_: so I'd like it to be attached to the source just like the doc is

13:14 which means (for clojure-core) Rich needs to sign up for it

13:29 piccolino: I'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:29 somnium: piccolino: you can set thread-local bindings with binding

13:30 danlarkin: piccolino: you can alter-var-root, but consider that a last resort

13:31 piccolino: So with binding, you could redefine *buffer-size* and then run a function with that new definition being used?

13:31 technomancy: danlarkin: you really shouldn't tell people about that. =)

13:31 danlarkin: technomancy: :-o

13:32 technomancy: "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:33 piccolino: 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:33 piccolino: And other threads using the same code will not see that value?

13:34 somnium: http://clojure.org/Vars

13:34 I'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:35 technomancy: set! only works inside a binding call IIRC

13:36 cemerick: set! works on any var that has a non-root binding

13:37 you don't need to be within the lexical scope of binding...that'd make set! and bindings far less useful

13:39 technomancy: right; same thing FSVO "inside"

13:39 cemerick: yeah, I only mentioned lexical scope because somnium did :-)

13:40 technomancy: FSVO?

13:40 technomancy: For Some Value Of

13:40 cemerick: ah

13:41 leafw: any "filter" function that iterates a sequence and returns true if a query eleemnt is found?

13:41 short of creating a set from it?

13:41 technomancy: ,(doc any?)

13:41 clojurebot: I don't understand.

13:42 the-kenny: hm... I think I need a better understanding of the difference between binding and let... Can someone give me some hints?

13:42 somnium: thanks for the answers (and the wtf package in emacs is great for acronyms btw) :-)

13:44 leafw: ,(doc any?)

13:44 clojurebot: Huh?

13:44 leafw: technomancy: ?

13:45 technomancy: ~(doc any?)

13:45 clojurebot: Titim gan éirí ort.

13:45 technomancy: coulda sworn that was defined. I guess you should just use "some".

13:46 maravillas: there's not-any?

13:46 technomancy: ...which always stood out as a particularly poorly-named function. I presume because it was taken from CL?

13:46 maravillas: but it doesn't look like there's an any?

13:46 cemerick: ,(doc some)

13:46 clojurebot: "([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:47 leafw: ,(doc not-any?)

13:47 clojurebot: "([pred coll]); Returns false if (pred x) is logical true for any x in coll, else true."

13:48 leafw: ok, "some" is what I wanted.

13:48 thanks.

13:56 technomancy: ,(seq (.split "hey.jude" "."))

13:56 clojurebot: nil

13:56 technomancy: ,(seq (.split "hey jude" " "))

13:56 clojurebot: ("hey" "jude")

13:56 technomancy: what's going on there?

13:57 is it treating the "." argument like a regex for some reason?

14:00 hiredman: split takes a regex

14:00 just as a string

14:01 becuase java doesn't have regex literals

14:01 technomancy: loverly, thanks.

14:26 chouser: ,(seq (.split #"\." "hey.jude"))

14:26 clojurebot: ("hey" "jude")

14:27 technomancy: chouser: even better not to have to double-escape; thanks

14:36 fradiavalo: xb

14:45 chouser: technomancy: 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:03 Kjellski: Good evening...

15:11 jfields: how do I do Foo.class in clojure?

15:11 (Foo/class) didn't seem to work.

15:12 chouser: jfields: just Foo

15:12 jfields: right. sorry. thanks.

15:12 pdrummond: Is this the right place to ask about Compojure?

15:13 hiredman: pdrummond: there is a google group for compojure, but feel free to ask away

15:15 pdrummond: Yeah, 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:15 hiredman: pdrummond: I believe so

15:16 theres always that var

15:16 ,*clojure-version*

15:16 clojurebot: {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "alpha"}

15:17 pdrummond: I'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:17 the-kenny: pdrummond: Classpath correct?

15:19 hiredman: ~namespaces

15:19 clojurebot: namespaces 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:19 hiredman: the fact that compojure has that single segment name is rather annoying

15:19 pdrummond: well - (System/getProperty "java.class.path") shows compojure.jar but my slime config uses a different clojure.jar and clojure-contrib.jar.

15:20 hiredman: pdrummond: what is the full text of the exception?

15:20 pdrummond: 0: java.lang.Class.forName0(Native Method)

15:20 1: java.lang.Class.forName(Class.java:264)

15:20 2: clojure.lang.RT.loadClassForName(RT.java:1499)

15:20 3: clojure.lang.RT.load(RT.java:385)

15:21 4: clojure.lang.RT.load(RT.java:367)

15:21 5: clojure.core$load__5058$fn__5061.invoke(core.clj:3734)

15:21 6: clojure.core$load__5058.doInvoke(core.clj:3733)

15:21 7: clojure.lang.RestFn.invoke(RestFn.java:413)

15:21 8: clojure.core$load_one__5010.invoke(core.clj:3578)

15:21 9: clojure.core$load_lib__5031.doInvoke(core.clj:3615)

15:21 10: clojure.lang.RestFn.applyTo(RestFn.java:147)

15:21 11: clojure.core$apply__3243.doInvoke(core.clj:390)

15:21 12: clojure.lang.RestFn.invoke(RestFn.java:443)

15:21 13: clojure.core$load_libs__5043.doInvoke(core.clj:3641)

15:21 14: clojure.lang.RestFn.applyTo(RestFn.java:142)

15:21 15: clojure.core$apply__3243.doInvoke(core.clj:390)

15:21 16: clojure.lang.RestFn.invoke(RestFn.java:460)

15:21 the-kenny: pdrummond: *Too* much text

15:21 pdrummond: 17: clojure.core$use__5052.doInvoke(core.clj:3711)

15:21 hiredman: :(

15:21 the-kenny: Use lisppaste

15:21 pdrummond: 18: clojure.lang.RestFn.invoke(RestFn.java:413)

15:21 19: pd$eval__3615.invoke(NO_SOURCE_FILE:1)

15:21 hiredman: pastebin

15:21 pdrummond:

15:21 Sorry! New to ERC as well! :(

15:21 hiredman: ok

15:22 that is the slime whatever

15:22 the-kenny: lisppaste8: url

15:22 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

15:22 hiredman: I was sorting up hoping for a real stack trace

15:22 s/up/of/

15:22 pdrummond: Opps o_O!

15:22 hiredman: maybe someone who uses slime can tell you how to get one

15:23 pdrummond: Going to try making Compojure and Slime use the same jars. 2 Mins...

15:28 Anyone know how to restart Slime and have it pick up new vars? slime-restart-inferior-lisp doesn't seem to do it?

15:29 technomancy: pdrummond: re-running M-x swank-clojure-project should do it

15:29 pdrummond: technomancy: never used that - it's asking me for a Project root??

15:30 technomancy: pdrummond: that's the easy way; you shouldn't have to manage your classpath by hand if you use it.

15:30 it'll pick up on all the jars in lib/ in your project root for you

15:31 pdrummond: Ahhh - thanks! Will look into that.

16:00 hi back! Anyone know why swank-clojure-project hangs on me?

16:00 tomoj: pdrummond: do you have clojure.jar in lib/ or target/dependency?

16:01 danlarkin: pdrummond: it hangs for me too. I do: M-x-:

16:01 and then (swank-clojure-project "...")

16:01 pdrummond: :tomoj yep

16:03 danlarkin: sorry, M-x-: ?

16:03 danlarkin: Not sure what you mean

16:03 danlarkin: pdrummond: M-x-: is bound to eval-expression

16:04 so you could do M-x eval-expression also

16:06 pdrummond: I see - doesn't seem to be working - just says "Polling /tmp/slime..." but nothing happens!

16:06 danlarkin: switch to your inferior lisp buffer and see if it has a stacktrace

16:07 pdrummond: danlarkin: Ah! ClassNotFoundException: clojure.main. More classpath woes! Will look into it, thanks.

16:07 Sorry - NoClassDefFoundError

16:08 danlarkin: pdrummond: are you using a maven project layout? maybe you need to symlink target/dependency/ to lib/?

16:09 until the next release of swank-clojure

16:09 I think :)

16:11 pdrummond: danlarkin: no I was using lib.

16:14 wavis__: \nick wavis

16:16 djork: what's the deal with pr and fns

16:16 if I get a fn caught up in my data structure, it prints an unreadable form

16:18 hiredman: correct

16:18 so don't

16:33 kefka: ,(binding [+ *] (+ 3 4))

16:33 clojurebot: 7

16:33 kefka: So I can't locally re-bind a function. Hmm.

16:33 I couldn't on my repl either.

16:34 Chousuke: yes you can

16:34 danlarkin: kefka: + has inlines defined

16:34 kefka: How do I do it? What's wrong with what I'm doing above?

16:34 Chousuke: ,(binding [+ *] (+ 1 2 3 4))

16:34 clojurebot: 24

16:34 kefka: Ok.

16:34 Chousuke: + gets inlined, so it fails :/

16:34 kefka: I see.

16:34 Is there anything you can bind to cancel out the inlines?

16:35 danlarkin: why do you want to rebind +? :)

16:35 Chousuke: no. but you can use #'+ instead of + to work around it.

16:35 kefka: ,(binding [#'+ *] (+ 3 4))

16:35 clojurebot: java.lang.ClassCastException: clojure.lang.Cons cannot be cast to clojure.lang.Symbol

16:35 Chousuke: no, I mean, in the actual expression :)

16:35 kefka: ,(binding [+ *] (@#'+ 3 4))

16:35 clojurebot: 12

16:36 Chousuke: the @ is redundant

16:36 kefka: Okay. That helps.

16:36 ,(#'+ 3 4)

16:36 clojurebot: 7

16:36 kefka: ,((var +) 3 4)

16:36 clojurebot: 7

16:36 kefka: Cool. So vars are applicative when functions.

16:36 Chousuke: vars redirect invocation to their values

16:36 kefka: Makes sense.

16:39 Chousuke: Thanks. I can now do what I'm looking to do, I think.

17:16 shmay: what exactly does 'sync' do? how is it different from dosync?

17:18 djork: ,(doc sync)

17:18 clojurebot: "([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:18 shmay: thanks, but that was what was confusing

17:18 djork: right

17:18 looks confusing to me :)

17:18 ,(doc dosync)

17:18 clojurebot: "([& 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:19 djork: sync is in-development, right

17:19 ?

17:20 I have no idea, really

17:20 shmay: i was just looking at ants.clj, and rich used it, so i wanted to figure it out

17:20 djork: hmm

17:20 chouser: sync is older

17:21 it has an arg for "flags-ignored-for-now", which afaik still has no usable options.

17:21 shmay: so it's basically the same as dosync?

17:21 chouser: I think rhickey just didn't want to keep making people write (sync nil ...), so he provided (dosync ...)

17:21 ,(macroexpand '(dosync a b c))

17:21 clojurebot: (. clojure.lang.LockingTransaction (clojure.core/runInTransaction (clojure.core/fn [] a b c)))

17:22 chouser: ,(macroexpand-1 '(dosync a b c))

17:22 clojurebot: (clojure.core/sync nil a b c)

17:22 chouser: yes. the same. :-)

17:23 shmay: got it, thanks chouser and djork

17:23 hiredman: ~def contains?

17:23 pfft

17:23 RT? cheater

17:23 chouser: heh

17:23 hiredman: ~def c.l.RT

17:27 spuz: I'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:27 For example to implement when as a function: (defn whenfn [predicate functiontoevaliftrue args] (if predicate (functiontoevaliftrue args) nil))

17:28 ordnungswidrig: hi

17:29 hiredman: my 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:30 spuz: hiredman: 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:31 leafw: how to do (apply str (range 10)) but with #(str % \tab) ? For some reason, the latter as pred of apply fails

17:31 spuz: the when macro apparently falls into the "conditional evaluation" category

17:31 ordnungswidrig: Is there a short notation for a map get on a fixed key? Sth. like #(get % :a)

17:31 leafw: ie. how to print a list with elements separated with tabs?

17:31 ordnungswidrig: I'm doing a (-> map :key1 :key2 :key3) but key4 is not a symbol but a string

17:31 chouser: spuz: macros allow you to avoid all kinds of repetition, including the manual creation of lambdas

17:31 leafw: short of doseq etc with prn

17:32 hiredman: ordnungswidrig: use get

17:32 (get "foo")

17:32 chouser: spuz: '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:32 hiredman: (-> foo (get "bar")) ~ (get foo "bar")

17:32 ordnungswidrig: hiredman: I cannot partial get because the map comes first in the argument list.

17:32 hiredman: you don't need to

17:33 ordnungswidrig: hiredman: magic

17:33 hiredman: ,(-> {:a 1} (get :a))

17:33 clojurebot: 1

17:33 hiredman: it's how -> works

17:33 spuz: chouser: thanks that pretty much answers my question

17:33 ordnungswidrig: hiredman: I see but I cannot believe :-) Does -> simply insert the first argument?

17:33 hiredman: yes

17:34 ->> inserts the last

17:34 ordnungswidrig: hmmm and -2> the second? ;-)

17:35 hiredman: the was a post recently on the group about generalizing the pattern by using substitution of a special symbol

17:36 ordnungswidrig: special symbol?

17:37 hiredman: (-> foo (get :$ :a) (map inc :$))

17:37 spuz: chouser: 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:38 ordnungswidrig: hiredman: I see

17:38 hiredman: they are good for making things look like special forms

17:38 Chousuke: spuz: your function-when is not strictly correct as the args get evaluated in all cases.

17:38 ordnungswidrig: brb

17:38 hiredman: :$ is funny looking

17:38 Chousuke: I liked the let-> idea

17:39 (let-> [x init] (foo x) (bar x) ...)

17:39 hiredman: :|

17:39 Chousuke: where x always gets rebound to the result of the previous expression, of course

17:40 hiredman: I see

17:41 _mst: would (let-> [x (println "foo")] (foo x) (bar x) ...) print twice? (not that I'm saying it's a good idea :P)

17:41 spuz: Chousuke: ah yes, in that case I guess you would need a lambda for every argument which would incredibly ugly

17:43 hiredman: spuz: actually I have a macro that cannot be replaced with a λ

17:44 it loads a property file into a clojure map at macroexpand/compile time, so at runtime there is just a clojure map of properties

17:44 and I don't have to ship the properties file

17:44 well, deploy the properties file

17:44 spuz: hiredman: that's pretty neat :)

17:45 hiredman: god, who ships things these days besides microsoft?

17:45 spuz: and it was so simple

17:45 spuz: great for compile time parameters, not so much for run time parameters I guess

17:45 hiredman: yeah

17:46 http://gist.github.com/226651 <-- line 11

17:49 spuz: hiredman: nice

17:49 anyway enough clojuring, bed time :p

18:55 twbray: Just a hypothesis.... might it be the case that Java gc is single-threaded?

19:02 Hmm... maybe -XX:+UseParallelGC is my friend

19:23 hiredman: ~google headius favorite jvm flags

19:23 clojurebot: First, out of 272 results is:

19:23 Headius: My Favorite Hotspot JVM Flags

19:23 http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html

19:23 hiredman: :D

19:36 neilmock: ,(doc use)

19:36 clojurebot: "([& 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:38 neilmock: this doesn't appear to have an effect on the current namespace

19:39 sorry just trying to figure it out as a beginner, i know it works properly in the ns macro

20:02 tomoj: is it possible to build a hash inside syntax-quote?

20:02 sudoer: anyopen using vimclojure? I ahve installed it, but cant get any syntax highlighting to appear

20:03 tomoj: I've been trying stuff like `{~@(apply concat (for [i (range 10)] [i i]))} but getting ArrayIndexOutOfBounds exceptions

20:03 I was able to make it work with `(into {} ....), but that seems silly

20:04 chouser: tomoj: you need an even number of forms inside the {} at read time

20:04 sudoer: how can I tell if vimclojure is running?

20:05 tomoj: chouser: I see.

20:05 so no way to have a macro to expand into a literal hash?

20:05 (no non-trivial way I mean.. `{3 3} works)

20:06 chouser: with forms inside `{} it's not really literal anyway

20:06 ,'`{a b c d}

20:06 tomoj: but I mean, after the macro is expanded

20:06 clojurebot: (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:06 chouser: biab

20:06 tomoj: right now my macro expands to (into {} ...), where I would want it to expand to just {...}

20:07 ooh

20:07 I didn't know {} was weird like that

20:13 well, if anyone feels like critiquing my macro chops: https://gist.github.com/4952f067ca8114e2e26b

20:18 chouser: actually it's ` that's weird like that.

20:18 ,'`[a b]

20:18 clojurebot: (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:19 chouser: ,'`(a b)

20:19 clojurebot: (clojure.core/seq (clojure.core/concat (clojure.core/list (quote sandbox/a)) (clojure.core/list (quote sandbox/b))))

20:19 tomoj: oh I think I understand

20:20 chouser: so you might was well just `(apply hash-map ~@(for ...))

20:20 tomoj: ` transforms literals into code that builds the forms that would look like that

20:20 chouser: right

20:22 tomoj: 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:23 tomoj: yeah it would probably be more readable if broken up

20:23 chouser: I 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:24 right, more readable, easier to test and debug.

20:24 tomoj: yeah..

20:24 slime-macroexpand-1 helps a lot, but small functions are still easier

20:24 chouser: also, sometimes people want to build on top of existing macro and having helper functions to call instead can ease that quite a bit.

20:24 anyway, if it works I don't know that I'd bother changing it around.

20:25 tomoj: nope.. it's purpose at this point has a very limited scope anyway

20:25 I was mainly wondering if I was doing anything idiotic with syntax-quote and ~ etc

20:25 since I built it by trial-and-error really :(

20:33 technomancy: what's the reasoning behind keywords not implementing IMeta?

20:38 danlarkin: technomancy: because there's only one copy for the whole vm

20:39 technomancy: ,(identical? 'foo 'foo)

20:39 clojurebot: false

20:39 technomancy: ,(identical? :foo :foo)

20:39 clojurebot: true

20:39 technomancy: I see

20:39 thanks

20:44 vogon_poet: hi, i'm new here

20:44 what is the etiquette?

20:44 chouser: vogon_poet: be friendly, ask your question, post your comment, don't paste more than a line or two at a time.

20:45 vogon_poet: welcome!

20:45 vogon_poet: thanks!

20:45 is there anyone here familiar with Incanter?

20:45 technomancy: the only rule we have that you'll want to keep in mind is: no poetry bad enough to cause permanent mental scarring.

20:46 the-kenny: vogon_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:46 the-kenny: Oh, lol

20:47 replaca_: I think everyone has established their geek cred :-)

20:47 vogon_poet: yes

20:47 (i can write some REALLY TERRIBLE poetry. but i won't subject you to it.)

20:48 _ato: wow, incanter looks nice (I hadn't heard of it)

20:49 vogon_poet: yeah, it is really nice as a replacement for R

20:49 but my problem is i can't get it to work outside of the prepackaged REPL it comes with

20:49 JAS415: i just want to note that clojure + erlang = sweet (although kind of redundant)

20:49 vogon_poet: running inside of VimClojure, i get this error

20:50 Clojure

20:50 Clojure=> (use '(incanter core))

20:50 #<CompilerException java.lang.NoClassDefFoundError: cern/colt/matrix/tdouble/impl/DenseColDoubleMatrix2D (REPL:0)>

20:50 Clojure=>

20:50 some guy on the clojure google group had the same problem, but his solution was basically voodoo and didn't apply to me anyway

20:50 replaca_: vogon_poet: do you have the incanter library in your classpath. He preinstalls a lot of stuff

20:50 vogon_poet: as far as I can tell, yes

20:51 chouser: that's definitely a classpath-related error

20:51 vogon_poet: yeah

20:51 chouser: can you find DenseColDoubleMatrix2D.class in a jar or dir somewhere.

20:51 vogon_poet: one 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:52 chouser: how are you setting your classpath?

20:53 vogon_poet: everything i need for vimclojure, and as far as i know everything for incanter, is in an environment variable in my .bashrc

20:53 and it's part of the command i've set up to start up the backend for vimclojure

20:53 Mac OS X, btw

20:54 _ato: parallelcolt-0.7.2.jar

20:54 is the one that class is from

20:55 chouser: vogon_poet: try this at your repl: (System/getProperty "java.class.path")

20:56 vogon_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 _ato: note that if your vimclojure startup script does java -cp something it's gonna override the CLASSPATH environment variable

20:57 vogon_poet: are you using java 6? the wildcard classpath doesn't work in java 5

20:57 vogon_poet: nope, java 5

20:58 _ato: ah that'd be it

20:58 vogon_poet: i suppose this means i have to put all those jars into my classpath individually?

20:58 _ato: yeah

20:58 or do something like:

20:59 JAS415: sudo apt-get java 6 :-P

20:59 or w/e

20:59 vogon_poet: i'm on a mac

20:59 which i suspect has java 6 installed

20:59 _ato: CLASSPATH=$(echo lib/* processing/* | sed 's/ /:/g')

20:59 vogon_poet: but i've already dealt with enough icky configuration tonight and i don't even want to think about that

21:00 oh

21:00 thank you!

21:00 the-kenny: vogon_poet: There should be an app called "Java Preferences" in /Application/Utilities or so. You can set the active java version there.

21:03 vogon_poet: PROBLEM SOLVED

21:03 thank you so much

21:03 i love all of you

21:04 hiredman: ~love

21:04 clojurebot: I don't understand.

21:04 hiredman: :/

21:04 chouser: seems about right

21:05 <20 minutes from "new here" to "problem solved". way to go guys.

21:05 * chouser gives #clojure a high-five.

21:06 the-kenny: :)

22:13 hiredman: clojurebot: entertain me

22:13 clojurebot: Pardon?

22:27 _ato: nyaha! placeholder page up: http://clojars.org/

22:28 arbscht: I'm drawing the line at 'clojars'. any more puns on 'closure' will be duly ignored.

22:30 _ato: arbscht: clojurejars was just too long. :)

22:33 chouser: _ato: the ruby link at the bottom seems broken

22:34 _ato: yeah their site is currently down

22:34 chouser: oh

22:34 _ato: not a good thing to cop perhaps :p

22:34 chouser: :-)

22:35 _ato: they're in the process of taking over the rubygems.org domain, so it might be related to that

22:53 technoma`: _ato: are you sure you didn't mean to link to gemcutter.org?

22:54 _ato: ah

22:54 yeah you're right

22:54 _mst: I was wondering why I couldn't find rubycutter.org in google :)

22:54 _ato: ah

22:54 it's back up

22:54 it was down too

22:54 I swear! :)

23:00 technomancy: _ato: how do you plan on letting users manage uploads?

23:05 _ato: technomancy: I was planning on adding a "push" command to your tool actually! :-)

23:06 technomancy: _ato: awesome. so are you going to use scp, or a web service, or what?

23:06 for the actual transport + auth?

23:07 _ato: hadn'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 _mst: github's "paste your public key" approach is quite nice. Easy to set up...

23:08 _ato: yeah

23:08 technomancy: it's certainly simpler than the sourceforge approach of giving every user an actual unix shell account.

23:08 _ato: problem is it's probably not so good for windows users

23:09 although there are pure java ssh libraries so maybe it's not so hard, just have the tool gen the key for them

23:10 I 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:13 technomancy: focus 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 _ato: yeah true.

23:14 technomancy: ivy and maven share the same repository format, working on adding capra support is probably a sidetrack of little value for now.

23:15 _ato: given that nothing uses capra yet, yes I agree. :)

23:15 qed: Could someone explain apply and reduce to me?

23:15 They seem to work alike, but they seem different somehow

23:16 JAS415: much different

23:16 qed: their documentation for instance, apply f args* argseq

23:16 technomancy: anyway, 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:16 chouser: qed: (apply foo a b c [d e f]) is the same as (foo a b c d e f)

23:16 qed: that is, foo is called once with all the args

23:17 technomancy: qed: reduce is for accumulating a single value by calling a function once for every element in a sequence.

23:17 chouser: qed: (reduce foo x [a b c]) is (foo (foo (foo x a) b) c)

23:17 qed: so what's the difference between (apply + [1 2 3])

23:17 and (reduce + [1 2 3])

23:18 technomancy: qed: 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:18 chouser: that 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:18 qed: so it's idiomatic?

23:18 _ato: yes, either is fine

23:19 apply + is probably slightly more common

23:19 qed: _ato: was that a yes, it is idiomatic?

23:20 _ato: qed: yes

23:20 qed: okay cool, thanks technomancy chouser _ato

23:21 chouser: rhickey 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:22 technomancy: reduce is a personal favourite of mine

23:22 qed: i tend to use reduce

23:22 _mst: right, yep

23:22 qed: ive been hearing about clojure and grable?

23:22 whats up with that?

23:24 technomancy: _ato: you'll let me figure out what?

23:25 _ato: technomancy: leiningen just uses maven's repository right?

23:25 I mean for storing downloaded stuff

23:25 and has a command to unpack into your project?

23:25 technomancy: it uses maven-ant-tasks to fetch dependencies from a maven repo, yeah.

23:26 _mst: "uberjar". nice :)

23:26 qed: whats that called?

23:26 not grable is it?

23:26 JAS415: gradle?

23:26 qed: yes, thank you

23:27 http://m.3wa.com/?p=350

23:27 read that the other day FWIW...

23:27 JAS415: yeah, you can use clojure with pretty much any java library

23:27 qed: ive never learned maven, never learned java, went straight to the ruby stuff :\

23:28 so maven looks extra scary to me

23:28 _ato: ah gradle uses Ivy, so it does maven repos as well

23:28 qed: wish i knew what the hell that meant :)

23:28 _ato: qed: it just means you can use the same packages with gradle as with maven or ivy or leiningen

23:29 qed: ah

23:29 chouser: I'm just biding my time until these smart and knowledgable folks get everything running smoothly.

23:29 Then I'll follow the tutorial.

23:29 qed: ^

23:29 * qed makes a sheep noise

23:30 qed: what is the preferred setup for the clojure-ist?

23:30 I've been using emacs and swank-clojure

23:30 JAS415: that's what i use

23:30 slime is nice too

23:30 qed: yeah using that as well

23:30 JAS415: paredit mode?

23:31 qed: swank-clojure, clojure-mode, slime, paredit

23:31 JAS415: yup

23:31 qed: it's a sweet little setup

23:31 it feels pretty good once you get into it

23:31 JAS415: yeah there's a bit of a learning curve, but once you get it it goes pretty well

23:32 qed: project euler really got me to buckle up and start learning clojure

23:32 the code is small enough so you dont feel like the extra 10-15 minutes you spend navigating the editor is really *that* painful

23:32 errr i should have said i learned emacs with clojure sort of concurrently

23:32 pun intended

23:35 when i map a function like (map #(fn %))

23:35 Can i specify the input twice by using 2 %

23:35 like (map #(+ % %))

23:36 on some seq

23:36 JAS415: yes

23:36 wavis: ,(apply #(+ %1 %2) (list 3 4))

23:36 clojurebot: 7

23:38 JAS415: re project euler: project euler is fun, another good exercise is to write a small application thing

23:38 i did a little twitter client myself

23:39 qed: wavis: thanks -- that's awesome

23:39 JAS415: although i guess you do end up seeing some of the ugly doing stuff like that

23:39 wavis: :) maybe not exactly what you asked for, but it's a "you can also..."

23:39 qed: user> (map #(Math/pow % %) [1 2 3])

23:39 (1.0 4.0 27.0)

23:41 except Math/pow wont go that high

23:43 JAS415: how high?

23:43 _ato: emit: there's a expt function in clojure.contrib.math which might work

23:43 qed: ^ (i meant)

23:43 hiredman: erm

23:43 qed: yeah im trying that now

23:44 hiredman: I seem to recall that contrib.math was just sort of a rough sketch

23:44 qed: how would you get the last ten integers in a bigint

23:44 like take -10?

23:48 hiredman: bigint has a bit clear method

23:49 qed: how about the last 10 elements of a sequence?

23:49 somnium: ,(take 3 (reverse [1 2 3 4 5 6]))

23:49 clojurebot: (6 5 4)

23:49 qed: oh man, duh

23:49 thank you

23:50 somnium: less verbose than than (drop-while (- (count coll) n))

23:52 hiredman: ,((comp first filter) (comp (partial = 10) count) (iterate rest (range 20)))

23:52 clojurebot: (10 11 12 13 14 15 16 17 18 19)

23:53 qed: (apply str (reverse (take 10 (reverse (seq (str (reduce + (map #(expt-int % %) (range 1 1001)))))))))

23:53 is there any better way to do that?

23:54 that finds the last 10 digits of 1^1 + 2^2 + 3^3 ... 1000^1000

23:54 hiredman: have you looked at http://java.sun.com/javase/6/docs/api/java/math/BigInteger.html

23:54 qed: i find myself using that whole str->seq->str thing a lot

23:54 hiredman: bigint has an xor method and a bitset method

23:54 qed: and it feels sort of wrong

23:55 thanks hiredman ill check it out

23:57 * _ato making leiningen uberjar itself

23:57 _ato: :D

23:57 needs away to specify repositories, it can't find clojure.jar snapshot

23:58 sudoer: uh, what method should I use to split a string?

23:59 _ato: ,(vec (.split "foo bar" " "))

23:59 clojurebot: ["foo" "bar"]

Logging service provided by n01se.net