#clojure log - May 28 2010

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

0:25 slyrus: any slime/swank-clojure users/hackers around?

0:26 lancepantz: i'm new to it, but yeah

0:27 scott_: i'm also new to it

0:27 slyrus: things seem ok for a the first dozen or so commands, but then it hangs :(

0:27 scott_: it breaks if I enter something that raises an error

0:27 lancepantz: slime-repl hangs?

0:27 scott_: i'm not sure how well set up mine is

0:28 slyrus: yeah

0:28 *inferior-lisp ...* still works

0:30 it seems to have something to do with error handling as it's usually seems to be when I type a form that should trigger an error

0:31 dunno if it's the emacs-lisp side of thing or the clojure side of things that's hanging

0:31 (or where to begin debugging either, for that matter)

0:31 anyone know the clojure equivalent of (sb-thread:list-all-threads) ? :)

0:32 lancepantz: yeah, i'm not experienced enough to be any help

0:34 technomancy: slyrus: you could try starting swank with lein swank and connecting with M-x slime-connect

0:34 then you could see if reconnecting fixed it

0:40 slyrus: hmm... I guess I have to figure out how to use leiningen then...

0:42 technomancy: slyrus: or maven if that's the way you roll

0:43 slyrus: ack! that's even worse! :)

0:43 I roll with ASDF. doesn't help me much here :)

0:44 technomancy: slyrus: http://vimeo.com/8934942 is a pretty good intro

0:46 slyrus: technomancy: I appreciate the suggestion, but I'm not sure how adding the complexity of leinengen into the mix is going to make this easier to debug

0:47 technomancy: slyrus: sure; I assumed you were using a build tool when I suggested that

0:47 slyrus: sure, emacs is a great build tool! :)

0:47 Raynes: Emacs is a great *

0:49 slyrus: coming from a lisp background, I'm not used to packaging code into things that have a "main". Losing the main function was one of the things I really liked when I moved from c-like languages to lisp.

0:50 lancepantz: you don't have to use it

0:50 and i think you'd be surprised at how simple lein swank is

0:50 slyrus: yeah, but you can't run lein swank without it

0:50 or if you can I'm doing something wrong

0:51 lancepantz: a main function?

0:51 slyrus: yeah

0:51 lancepantz: maybe i don't know what i'm doing right :)

0:52 but i don't see how a main function would impact lein swank

0:52 slyrus: not having one seems to make lein swank unhappy

0:52 technomancy: you don't need a main function for lein swank

0:52 lancepantz: i'd guess you had an unrelated error

0:53 slyrus: oh, perhaps I'm misreading this error: "[null] Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main"

0:54 lancepantz: yeah, i think that would be caused by clojure not being on your classpath

0:54 slyrus: hrm... ok

0:55 lancepantz: not even sure if that is possible with lein though

0:55 maybe it didn't bootstrap properly?

0:55 slyrus: yeah, that's what I thought!

0:57 who knows, but trying to figure out why various shell scripts/environment variables can't find all sorts of crazy jars seems like a losing battle. teaching slime how to find the jars I want is pretty straightforward.

0:58 perhaps I'm just thinking about things the wrong way, but I really don't want all the crap in ~/.m2

0:59 technomancy: it becomes worth it as soon as you add in a dependency that pulls in a transitive dependency. working with that by hand is way more trouble than it's worth.

1:00 lancepantz: i have my issues with lein, but it does solve that exact problem pretty well

1:00 technomancy: for trivial projects you can just brute-force your way through it. but it's a lot of unnecessary work.

1:02 zakwilson: I have :dev-dependencies [[swank-clojure "1.2.1"]] in a project.clj file and lein deps says it's missing on one computer, but not another. I'm guessing something is missing or misconfigured.

1:02 The machine that isn't working is running Mac OS 10.5. Not sure where to start troubleshooting.

1:02 technomancy: zakwilson: java 1.5 maybe?

1:03 zakwilson: Now running Leiningen 1.1.0 on Java 1.6.0_15 Java HotSpot(TM) 64-Bit Server VM

1:04 technomancy: hard to say then

1:05 slyrus: oh, I see... lein deps copies the clojure-xxx and clojure-contrib-xxx jars into lib which lein swank then finds.

1:08 ok, I've got some random jar I want another file to depend on. How do I make it such that the lein :dependencies can find that jar?

1:10 lancepantz: if its a standard library, see if it's on clojars

1:10 lein searches 3 or 4 other public repos

1:11 slyrus: no, it's not a "standard library", not that I no who the standard bearers are, I just know it's something I've built here

1:11 lancepantz: i meant commonly used

1:12 slyrus: I don't want some automagic downloader that finds the jar, I've already got the dang thing locally

1:13 lancepantz: you can either set up a private maven repo or put it in your .m2

1:13 *commence bitching* :)

1:13 slyrus: ack!

1:14 technomancy: there are very few instances where something like that doesn't belong on clojars

1:14 slyrus: so I guess I have to learn maven to use lein. I was trying to avoid that.

1:14 ???

1:14 what is clojars?

1:14 technomancy: it's a community jar repository: http://clojars.org

1:15 slyrus: but I already have the jar here. why would I want to put (and require my stuff to find it) on clojars?

1:15 technomancy: if your build isn't repeatable on more than one machine it's not much of a build

1:16 slyrus: could be. I don't really care about builds. I just want my SLIME repl to work!

1:16 technomancy: I mean, you can just put it in lib if you just want to do a hack job

1:17 which is fine for this situation probably

1:17 I was just saying you probably don't want a private m2 repo

1:18 http://www.catonmat.net/blog/wp-content/uploads/2008/11/edsger-dijkstra-quick-and-dirty.jpg

1:18 ^ but sometimes that's just what you need to get the job done. even if it causes edsger dijkstra to look down upon you in disapproval.

1:18 slyrus: oh, but I have to copy it to {the-directory-with-my-project.clj}/lib, I can't just tell the project.clj where to find it in the local filesystem?

1:20 lancepantz: correct

1:21 dnolen: slyrus: there's also lein install, which I find convenient

1:21 lancepantz: then he'd have to build that jar with lein though

1:27 zakwilson: http://gist.github.com/416794 <-- I'm having issues getting a parallel map for a fast f and large coll to scale to more cores. It's perfect with two, but doesn't improve further with four.

1:50 chouser: pmap doesn't work well for fast f

2:00 zakwilson: chouser: I'm well aware. That's why I wrote a version that partitions the collection and runs (pmap #(doall (map f %)) the-partitioned-collection)

2:01 And applies concat to that

2:01 chouser: heh, I just wrote that myself

2:01 no traction

2:02 do you care about pmap's laziness?

2:02 zakwilson: No. I'm content with a strict version for this.

2:02 chouser: is your input a seq? lazy? or a vector?

2:02 zakwilson: a map

2:03 chouser: you want to transform both keys and values?

2:04 zakwilson: Yes, in this case

2:12 chouser: wouldn't happen to be a sorted map, would it?

2:12 if so, subseq might be better than partition

2:13 zakwilson: Not sorted. Just your ordinary, average 27,000 element persistenthashmap

2:15 chouser: there's a branch of clojure that modifies vectors to work with the forkjoin library. Sounds to me that you want something like that for maps.

2:16 zakwilson: I've heard of it. Seems possible, though I'd love to have a general-purpose pmap for fast fs and big colls. I'm going to test mine a bit more - I have reason to believe it may actually not be a problem with zpmap itself.

2:18 chouser: part of the problem with seqs here is that the thread that processes the last partition has to walk the whole seq up to the start of that partition (or wait for a thread that does)

2:19 so if the speed of f approaches the speed of walking the seq, there's really just nothing left to parallelize

2:19 you'd really want to exploit the structure of the map itself

2:20 subseq on a sorted map lets you do that to some extent

2:21 SinDoc: Where can we define member data for a deftype?

2:22 chouser: SinDoc: (deftype Foo [member data here])

2:22 but are you sure you don't want defrecord?

2:23 SinDoc: no, I'm not sure

2:23 Raynes: If you aren't sure, you probably want defrecord.

2:23 chouser: right

2:23 deftype is more primitive

2:24 SinDoc: The question is whether the fact that defrecord implements IPersistentSeq is useful for me

2:24 a priori, i'd say no

2:24 chouser: IPersistentMap perhaps?

2:25 SinDoc: sure, I hadn't checked

2:25 but if it's implied by the fact that I want member data, then I guess I should use defrecord

2:29 i guess member data DOES imply the use of defrecord

2:29 zakwilson: chouser: I had the impression that I wouldn't have that issue with a map or a vector.

2:30 chouser: walking a seq of a map is still O(n), even if looking up any one key is nearly O(1)

2:31 building a subseq on a sorted map is O(log n), so it might be a win for partitioning

2:31 though I must say 27,000 items doesn't seem like very many.

2:32 ,(time (let [r (range 27000), m (zipmap r r)] (zipmap (map inc (keys m)) (map inc (vals m)))))

2:32 clojurebot: ping?

2:32 clojurebot: PONG!

2:32 chouser: ,(time (let [r (range 27000), m (zipmap r r)] (zipmap (map inc (keys m)) (map inc (vals m)))))

2:33 Chousuke: clojurebot is a bit slow sometimes :P

2:33 chouser: huh. well, on my box that map of 27000 items is built and then a new one created with inc'ed keys and values, all in 65 msecs

2:33 zakwilson: 58ms here

2:36 chouser: hard to beat

2:36 zakwilson: My problem isn't zpmap not being faster than map or pmap. My problem is that it isn't getting more out of four cores than two.

2:43 I need sleep. Thanks for looking at this. I'll revisit it tomorrow.

2:48 SinDoc: I guessed wrong. Things seem clearer after reading http://clojure.org/datatypes

2:49 The Datatypes page isn't linked from the sidebar and that makes people miss it

2:55 chittoor: hola!

2:55 Raynes: Hai.

3:13 Licenser_: I found something very ugly :(

3:13 if a var is a string you can't use with-meta :(

3:33 vegai: what's the proper way to launch a jar made by lein jar?

3:33 I keep getting

3:33 Failed to load Main-Class manifest attribute from

3:35 Raynes: I'm not entirely certain that 'lein jar' produces executable jars.

3:35 Licenser_: vegai: you have to tell your project.lcj what the main class is

3:35 Raynes: I think only 'lein uberjar' does that.

3:35 Licenser_: Am I wrong?

3:35 Licenser_: Raynes: yes and no

3:35 Raynes: It has to be one or the other mate.

3:36 Licenser_: you need to run it with java -cp your.jar:lib/clojure.jar... main.class.thingy.main

3:36 vegai: Raynes: same effect with uberjar

3:36 Raynes: So it does create executable jars.

3:36 My mistake. :)

3:36 vegai: What he said.

3:36 vegai: aye

3:37 Licenser_: Raynes: what exactly is a executable jar?

3:37 no jar is executable

3:37 Raynes: Licenser_: If a jar has a Main-Class attribute, it's executable.

3:37 vegai: could info about this be added to http://github.com/technomancy/leiningen ?

3:37 Licenser_: problem is that you have to add -cp and since sun is silly -cp and -jar isn't compatible

3:37 vegai: and could lein new perhaps do some of this automatically?

3:37 Licenser_: vegai: there is a info in the page

3:38 look at the parameters for the project.cljk

3:38 vegai: Licenser_: yes, but a preferred way to run leinized application might be nice

3:39 Licenser_: vegai: I am not sure if there is anythi8ng like that

3:52 I have the following problem and am running out of ideas: I want to make a jtree (swing) backed with a nested map. Problem is, the threeModel interface requires nodes to keep track of parents/silbigs so I'd have to return the "path" to the node as node to keep track of where they are. Now if I do that the nodes themself render as vectors not as strings and I don't find a way to attatch the path to the string, since it not even has meta data. Any ideas here?

3:55 Raynes: Oh man.

3:55 How did I not know about clojure-http-client.

3:56 clj-apache-http depends on the internet. It will be nice to get rid of all those jars in sexpbot.

3:58 * Licenser_ is really sadish about this

4:00 Licenser_: Is it possible to extend a class with Proxy?

4:00 it seems when I try that it only recognizes the methods already published by class :(

4:01 Raynes: I think you'd need gen-class for that.

4:04 Licenser_: I don't want stinking gen-class :( it is AOT :(

4:05 hmm I could overwrite the toString of a vector to get what I want but that'd be hugely ugly in my eyes and very badly hacked :(

4:05 vegai: well, some sort of docs lein needs

4:05 or fools like me will be scared

4:05 hoeck: Licenser_: proxy subclasses or implements interfaces

4:06 genclass is only required if you need the performance or a stable classname

4:06 vegai: I was going to do a small task on clojure, but now I've fought with lein more time than it would've taken me to do the thing in python in the first place ;)

4:07 (sorry if that's a bit of a troll)

4:07 Licenser_: hoeck: but I could not use proxy to create an Object that had the aditional .path method, clojure refused to do that

4:07 hoeck: proxy cannot create new methods

4:07 Licenser_: see that is my problem

4:07 hoeck: but

4:08 you could create a protocol: (defprotocol Path (path [t ...])) and then let your proxy implement that

4:08 Licenser_: that works?

4:08 hoeck: or use gen-interface to create an interface with a `path' method

4:09 Licenser_: when I use defprotocol could I call (path obj) ?

4:12 hoeck: Licenser_: http://gist.github.com/416900

4:12 Licenser_: yes, (path x) works also

4:12 Licenser_: wooh!

4:13 hoeck: Licenser_: are you actually subclassing anything or only implement swing interfaces?

4:13 Licenser_: no I just need some way to store the Path data with the object itself

4:13 this is just for ugly swing stuff

4:14 hoeck: and you don't subclass a, say, javax.swing.JTree$Node ?

4:14 Licenser_: no it is ugly

4:15 hoeck: then using deftype may be a bit more idiomatic, since it can also implement arbitrary interfaces

4:15 just my 2c

4:15 Licenser_: :/ I find this very badly(not) documented

4:15 hoeck: I kind of don't see through all that

4:15 will deftzpe even create java objects?

4:16 cemerick: Licenser_: you realize you're working with prerelease stuff, right? :-)

4:18 hoeck: well, (doc deftype) says it all, but its a bit terse :)

4:19 Licenser_: cemerick: psst :P

4:19 hoeck: Licenser_: *everyting* in clojure is a java object :P

4:19 cemerick: hrm?

4:19 Licenser_: cemerick: don't tell me those things, I might get scared :P

4:20 cemerick: ha

4:20 Licenser_: hmm I think the documentation is wrong

4:21 hoeck: which part of it?

4:21 Licenser_: deftype seems to require you to supply this for the implementation of functions http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/defprotocol does show it does not

4:24 hoeck: right, that needs an update

4:24 Licenser_: also it should be Foo. not Foo

4:28 weee it works I love you hoeck! purely platonic of cause

4:30 Raynes: Licenser_: I'm going to teach you English. First lesson: The word you're looking for is "course". "Of course!" "Of course I love bananas!"

4:30 Licenser_: :D

4:31 hoeck: Raynes: aren't you the father of sexpbot?

4:32 sexpbot could pm all the non-native speakers and correct their grammar and spelling mistakes :P

4:33 Chousuke: :P

4:33 On some channels it feels the natives need that more.

4:33 spariev: hoeck: as a non-native speacker, I would appreciate such a service :)

4:34 hoeck: spariev: me too :P

4:34 spariev: Raynes, what your waiting for ? :)

4:35 Chousuke: NLP isn't trivial :P

4:35 spariev: oh, I missed *are* :)

5:01 Lajla: Chousuke, are you a native?

5:05 Chousuke: Lajla: nope

5:06 Lajla: Chousuke, am I? Does 6 years old count for you?

5:07 Chousuke, what is your native language then?

5:10 Chousuke: Lajla: Finnish

5:13 Licenser_: I have a question to resolve

5:14 if I do: (resolve 'some-existig-var) it returns the var, if I do (resolve 'non-existing-var) it returns nil, but if I do (resolve 'some.namespace) it throws a very odd excepotion

5:17 Lajla: Chousuke, hyvin?

5:17 Miksi ovat suomalaiset kaikkialla?

5:18 Miksi olette mun maailmasessa? =(

5:18 Ja mun kanavissa?

5:21 Chousuke: IRC is a Finnish invention after all P

5:23 Lajla: Chousuke, onko?

5:24 Ajattelen että sari sanoi sitä aikoinaan.

5:25 Chousuke: juu. Mutta puhutaan täällä englantia :P

5:25 Lajla: Mutta ajattelen että kaikki suomalaiset ovat salaliitossa tuhota maailman.

5:25 Licenser_: I think I found a evilish bug in clojkure

5:26 the new changes to core & contrib make it impossible to (require 'c.c.seq-utils)

5:26 the ns exists but breaks stuff horrible

5:26 Lajla: Chousuke, en koskaan, IRC on suomalainen.

5:26 Olen teidän suomalaisessa salatiitossa.

5:27 Chousuke: :P

5:27 Lajla: Tuhoamme maailman, mä ja suomalaiset.

5:28 Nyt olen tullut kuolemaksi, maailmojen tahoaja.

5:29 tuhoaja*

5:29 Licenser_: gesundheit Lajla

5:29 * Licenser_ goes for lunch

5:30 Lajla: Licenser_, näe, olemme tuhoanut, mä ja suomalaiset.

5:31 yhdeksi, olemme tuhoanut maailman kohta.

5:31 muahahahahhahaha

5:33 chouser, mutta pidä musta kii, ja älä päästä koskaan.

5:33 Eh, Chousuke.

5:34 hoeck: Lajla: stop hitting the `ä'-key :P

5:34 Chousuke: :P

5:34 Lajla: hoeck, I also have æ

5:34 pædantic

5:34 Encyclopædia Britannica

5:35 hoeck, welcne cræft cænnst þu?

5:36 hoeck: is æ the same as ä?

5:36 LauJensen: hoeck: no its ae fused

5:36 Lajla: LauJensen, not per se.

5:36 In Old English, it was a sound on its own.

5:37 The same sound as in man

5:37 Old English wrote the sounds in man, and in father differently.

5:37 LauJensen: Well Im Danish and we're the guys you stole it from

5:37 And we still use both æ ø and å regularily

5:37 Lajla: As in, cræft (craft, skill) versus nama (name)

5:37 Hmm, I guess it's the reverse.

5:38 THe Anglo-Saxon switched to the Latin alphabet long before the Norse.

5:39 LauJensen: In Danish, æ is ae fused together, and sounds like it as well

5:40 Lajla: LauJensen, substituting æ for ae is not allowed is it?

5:41 As in, it's considered a seperate letter, not just a typographic ligature.

5:41 LauJensen: Yes, and aa for å and oe for ø

5:41 Lajla: Right?

5:41 Ahh, no way.

5:41 LauJensen: Yea, its syntactic sugar

5:41 Lajla: In Finnish, if ä isn't available a is praeferred.

5:41 I always thought it was considered a seperate letter.

5:42 separate

5:43 LauJensen: You can write whatever you want in Danish. For instance our 3.rd biggest city Århus, is now officially changing to writing Aarhus instead, just for kicks

5:43 Same with Ålborg, you can freely write Aalborg on your mail and nobody would be confused

6:04 Lajla: LauJensen, ahh and æ exchanged for ae too?

6:05 As far as I know, å originated from ae, as in, an a with a small e over it.

6:06 LauJensen: Lajla: Lets talk about it once we've learned everything there is to know about Clojure :)

6:08 Lajla: LauJensen, but etymology of gliphs is far more important than Clojure. =(

6:08 Chousuke, tanssikaamme Ievan Polkkasta.

6:14 Licenser_: cooookies

6:15 Lajla: Licenser_, ruisleipää. =(

6:15 Lajla muuten ruisleiväks.

6:16 vegai: Lajla: mitä ihmettä

6:16 oh, you're playing with a translator?

6:17 Lajla: vegai, ei ole hyvä suomalainen, tai on?

6:17 vegai, are you?

6:18 vegai: suomalainen? yes. A good one? debatable

6:18 Lajla: I don't think translators produce 'mun' in lieu of minun that often.

6:19 Err, Suomi*

6:20 Chousuke: :P

6:21 Lajla: Chousuke, don't laugh at my poor attempt at Finnish.

6:21 I had less than poper education, my flatmate just happens to speak it over the phone with her mother, and a very dutchified variant too.

6:21 Chousuke: Donit's understandable.

6:21 Don

6:21 sdfhksadlkj

6:21 Don't worry*

6:22 Lajla: I heard Finns living in Finland only two times, and that to me sounded like 'Finnish with a heavy Swedish accent.' =(

6:22 clojurebot: {1024 1024, 2048 2048, 3072 3072, 4096 4096, 5120 5120, 6144 6144, 7168 7168, 8192 8192, 9216 9216, 10240 10240, 11264 11264, 12288 12288, 13312 13312, 14336 14336, 15360 15360, 16384 16384, 17408 17408, 18432 18432, 19456 19456, 20480 20480, 21504 21504, 22528 22528, 23552 23552, 24576 24576, 25600 25600, 26624 26624, 32 32, 1056 1056, 2080 2080, 3104 3104, 4128 4128, 5152 5152, 6176 6176, 7200 7200, 8224 8224, 9248 9248,

6:22 "Elapsed time: 796.294 msecs"

6:22 Chousuke: Have you actually studied Finnish or how did you learn it?

6:22 wow, that was late.

6:23 Lajla: Chousuke, I will train under your tutelage and address you as 'mun opettaja, maailmojen tuhoaja'

6:23 Chousuke: :P

6:23 Lajla: Chousuke, well, I watched my flatmate talk it with her mother and the rest from IRC.

6:23 THere are actually a lot of finns on IRC I've come to notice.

6:24 Chousuke: that's pretty impressive.

6:24 Finnish grammar is far from trivial. I'm Finnish, and I haven't a clue about it.

6:24 I'm lucky that I just know it :P

6:25 Lajla: Nahh, Finnish grammar is actually quite simple once you get to know it, Finnish is ideal for me, I suck at learning word lists, but all words are derived from each other and the grammar is very regular.

6:25 If you see a word like 'nettiyhteyttä' for the first time you just know it means 'internet connexion'.

6:26 Chousuke: well, that does help

6:27 though you need to be able to recognise where one word ends and another begins

6:27 bozhidar: I think that Russian grammar is one of the hardest ones around

6:28 Chousuke: Does it have 15 noun cases like Finnish? :P

6:28 Lajla: Chousuke, well, it's fairly obviously netti + yksi + eys + partitive case.

6:28 Chousuke, well, Russian is often said to be hard, but Czech is a lot harder.

6:28 bozhidar: I'm not sure what those noun cases are, but it has 8 "padezha"(I don't know the English word for it)

6:29 Lajla: Russian is just one of the harder languages that people have interest in learning.

6:29 Russian has six case I think.

6:29 seven if you count the new vocative.

6:29 Nominative, accusative, genetitive, locative/praepositional, dative, instrumental.

6:29 bozhidar: Lajla: I stand corrected

6:29 Chousuke: Lajla: heh, I wouldn't have thought of "yhteys" having any relation to "yksi" if you hadn't mentioned it :)

6:29 bozhidar: Иванка Радева дава винаги твърди предложения ;-)

6:30 a mnemonic to remember them

6:30 Chousuke: What are the cases in Finnish anyway?

6:30 Lajla: Chousuke, hmm, well, I guess most English speakers also don't in 'unity' and 'unit'

6:31 Chousuke, taking yks: yks, yhden, yhtä, yhden, yhdessä, yhdestä, yhteen, yhdeltä, yhdellä, yhdelle, yhtenä, ydeksi from the top of my head.

6:31 Chousuke: yeah, but the names of those?

6:31 Lajla: There are some more, but I think those are only limited to literary speech, as I never really learnt Finnish I don't know those.

6:31 Ahh

6:32 Chousuke: also the first should be "yksi"

6:32 though it's yks in speech

6:32 Lajla: nominative, genetive, partitive, accusative, inessive, ablative, ... , .. allative, dative, ...,essive, translative

6:32 Chousuke, oh yeah, that's true.

6:32 Chousuke: yeah there's the "comitative" case which is "yksine" which means something like "with (his) single ..."

6:33 Lajla: To be honest, I more or less vary yks and yksi depending on the stress on the word.

6:33 Ahh, yes, and also an absessive or something.

6:33 yksettä or something.

6:33 Meaning 'without one'

6:33 Chousuke: I think that needs to be yhdettä

6:34 Lajla: Ehh, that is correct.

6:34 Chousuke: yksittä in plural I suppose. if that makes sense.

6:35 Lajla: But I guess Finnish is hard for people that learn it by just memorizing all parts, I'm too lazy to go through lists and lists of grammar and words and rather just extrapolate a pattern, which is easier in Finnish because it's regular and all words are derived from one another.

6:35 Hmm, plural is yhdittä I would gather.

6:35 Chousuke: that sounds wrong to me.

6:36 I think the plural inhibits consonant gradation in this case.

6:36 Lajla: Ah,, it seems you're right according to wiktionary.

6:36 I never really use the plurals of yks I guess.

6:36 Singular not that often too, more in derivations like yhteen.

6:36 Or yhdeksi.

6:36 Or wait, that are cases too.

6:40 Chousuke: One of the things I like about Finnish is that neologisms are commonly coined and adopted

6:40 There aren't that many words in use that are obviously non-Finnish :/

6:41 Lajla: Chousuke, actually, some estimates place the surviving Finnish vocabulary in Finnish to be at 300 words.

6:41 For instance, tyttö is a borrowing from a Germanic language, compare English: daughter.

6:41 Chousuke: Yeah, I've heard that too

6:42 Lajla: Finnish is quite unique in that it has even borrowed words of close kinship like 'äiti', it's very unusual for a language to borrow words for things such as 'mother' and 'daughter'.

6:42 Finnish seems to borrow and naturalize words easily, but borrows grammar very hard.

6:42 Chousuke: The words are integrated so well into the language that you can't tell foreign words from native ones :P

6:43 Lajla: kahdeksan is also from kaksi + dek (IE, compare latin: decum) as in 'two from ten'

6:43 Yap, Finnish adjusts loans to Finnish phonology.

6:43 Chousuke: I hope we're not inhibiting Clojure discussions with this off-topic rambling :P

6:44 seems like most people are idling right now though.

6:44 Licenser_: I never idle I just dn't pay attention :P

6:44 Chousuke: Also I had no idea kahdeksan was formed like that. :P

6:45 Lajla: Closure is probably excellent to model Finnish grammar in.

6:45 I once started doing it in Scheme, never finnish.

6:45 Licenser_: Lajla: because concurrency is very important in finnish?

6:45 Lajla: Licenser_, no, because lisps just happen to be.

6:45 Licenser_, I think you should serve me.

6:46 And address me as 'Mine overlord'

6:46 Chousuke: will you be digging for precious minerals?

6:47 Lajla: All Finland has of that is Ukon Kivi man.

6:47 'ukkonen' is also an awesome word.

6:47 Actually, 'thunder' has a similar origin, it's also a diminitive of 'thor' in a way I think.

6:47 Chousuke: It's amusing how ukko means an old man nowadays

6:48 Lajla: Chousuke, voinko panna ukot sun perseeseen?

6:49 Chousuke: that was just random :P

6:49 Lajla: Tai kahdeksan katanaa, jos olet sadomasokisti?

6:49 vegai: :-o

6:50 Lajla: http://thisdomainisirrelevant.net/1035

7:14 npoektop: hi! trying to do (use 'clojure.contrib.repl-utils) and then (apropos ...). It says "Unable to resolve symbol". But it should be there: http://richhickey.github.com/clojure-contrib/repl-utils-api.html

7:17 candera: npoektop: Working for me at my 1.2 REPL.

7:18 bozhidar: I don't have it either - 1.1 REPL

7:18 Chousuke: those docs are for the contrib master branch

7:18 are you using it or the 1.1 release?

7:19 npoektop: Chousuke, 1.1

7:19 ok. it's ok

7:21 bozhidar: btw I was wondering what might be causing an exception when trying to use slime-edit-definition in SLIME(M-. by default)

7:21 I only get NPEs when trying to use it

7:22 with functions that I loaded myself into slime

7:22 but it works great with stuff coming with clojure itself

7:23 if the fact that I'm not loading the whole source file causing this?

7:26 candera: Does it work if you eval the whole file via slime-eval-buffer?

7:27 I seem to recall that one of the various options will give SLIME enough info to locate things in source, while others will not. Which makes sense when you think about how it would know where something is if you just eval it from the middle of a buffer or whatever.

7:29 bozhidar: candera: no, same problem with slime-eval-buffer

7:29 candera: Maybe I'm thinking of slime-compile-file.

7:31 bozhidar: candera: slime-compile-file throws an exception - Wrong number of args passed to: basic$eval--986$compile-file-for-emacs

7:31 candera: Yeah, OK, I thought that might happen. Sorry: I'm out of ideas, even ideas as lame as the first two. :p

7:32 bozhidar: the file is pretty basic, just a couple defn, maybe a namespace declartion is required?

7:35 candera: Could be - if you give it a namespace you can (require) it, and that will result in a load from a file, which might be enough to get SLIME to be able to understand it.

7:45 * Lajla panee suomalaisen chousukeen.

7:45 Licenser_: hmm the new defmulti, does not get a list of arguments any more?

8:54 fogus_: LauJensen: Is this the best URL for ClojureQL? http://gitorious.org/clojureql/

10:27 clojurebot: {1024 1024, 2048 2048, 3072 3072, 4096 4096, 5120 5120, 6144 6144, 7168 7168, 8192 8192, 9216 9216, 10240 10240, 11264 11264, 12288 12288, 13312 13312, 14336 14336, 15360 15360, 16384 16384, 17408 17408, 18432 18432, 19456 19456, 20480 20480, 21504 21504, 22528 22528, 23552 23552, 24576 24576, 25600 25600, 26624 26624, 32 32, 1056 1056, 2080 2080, 3104 3104, 4128 4128, 5152 5152, 6176 6176, 7200 7200, 8224 8224, 9248 9248,

10:27 "Elapsed time: 338.891 msecs"

10:29 chouser: wth!?

10:29 Lajla: ,(factorial 40000)

10:35 clojurebot: java.lang.Exception: Unable to resolve symbol: factorial in this context

10:42 bhenry: ,(let [fact (fn [x] (apply * (range 1 (inc x))))] (fact 40000))

10:42 clojurebot: Execution Timed Out

10:42 bhenry: ,(let [fact (fn [x] (apply * (range 1 (inc x))))] (fact 400))

10:42 clojurebot: 640345228466238952623479703195030058507025830260029594586844459428023971691868314362784786474632646762943505750358568108482981628835174352289619886468029979373416541508381624264619423523070462443250151144486708906627739149181173319559964407095496713452904770203224349112107975932807951015453726672516278778900093497637657103263503315339653498683868313393520243737881577867915063118587026182701698197400629830253085912983461622

10:43 fogus_: clojurebot is not self-aware!

10:44 or is it?

10:50 Ankou: hi, I've read that you should work against the seq abstraction and work with vectors and so on whenever possible. But is it better to work with seqs or to do stuff like (vec (map f [1 2 3]))?

10:51 chouser: that example *is* working with seqs. 'map' is a seq function.

10:52 to achieve the same thing without using the seq abstraction, you'd have do to something like...

10:53 (loop [v [1 2 3] i 0] (if (== i (count v)) v (recur (update-in v [i] f) (inc i)))) ; don't do this

10:55 rhickey: chouser: update-in is a bit much

10:56 chouser: (assoc v i (f (nth v i)))

10:57 (transient [1 2 3]) ... (persistent! v) ... assoc!

10:58 rhickey: why not conj? updating every element in a vector is much more expensive than creating a new one

10:59 phobbs: Hello. I want to do something like this: (for [temp-func '(+ - *)] (temp-func 1 2)) concisely... but that returns (2 2 2), when it seems like it should return (3 -1 2)...

10:59 cburroughs: the standard clojure-maven-plugin compile <executions> fragment runs after java compilation, which is no good if the java code depends on clojure code. Is there a way to make mvn compile compile clojure code first?

10:59 chouser: rhickey: why not vec?

10:59 rhickey: chouser: as in the original?

11:00 chouser: yes

11:00 fogus_: ,(let [tf (juxt + - *)] (tf 1 2))

11:00 clojurebot: [3 -1 2]

11:00 rhickey: chouser: yes, of course that's fine

11:00 fogus_: phobbs: ^^

11:00 rhickey: but the non-seq replacement isn't replace-in-place

11:00 phobbs: fogus: thanks! juxt is cool.

11:01 fogus_: phobbs: I love juxt

11:01 phobbs: fogus: but why does the code I provided behave differently?

11:01 chouser: phobbs: to get a sequence of functions, you want [+ - *] instead of '(+ - *)

11:02 phobbs: what is the difference?

11:02 ,(for [tf [+ - *]] (tf 1 2))

11:02 clojurebot: (3 -1 2)

11:03 Licenser_: phobbs: '(+ - *) = (list '+ '- '*)

11:03 chouser: ' prevents things from being evaluated, so you had a list of symbols.

11:03 Licenser_: all elements are not evaluated

11:03 fogus_: ,('+ 1 2)

11:03 clojurebot: 2

11:03 chouser: symbols are not the same as the functions they name

11:04 phobbs: oh

11:04 thanks

11:04 Licenser_: (list + - *) should have worked too

11:04 chouser: (list + - *) would work too

11:04 phobbs: but if I do ,(def temp-func '+)

11:04 ,(def tf '+)

11:04 clojurebot: DENIED

11:04 phobbs: haha

11:05 ok well if you do that

11:05 fogus_: we know what you mean

11:05 Licenser_: phobbs: nope won't work

11:05 phobbs: huh ok

11:05 I thought I had already tested that. Well that explains it, thanks!

11:05 Licenser_: (def tf +) will so

11:05 chouser: (let [v [1 2 3]] (loop [v2 (transient []) i 0] (if (== i (count v)) (persistent! v2) (recur (conj! v2 (f (nth v i))) (inc i))))) ; don't do this either

11:05 candera: So I'm curious: given that a symbol is Runnable, what does it do when invoked?

11:06 chouser: looks itself up in a map

11:06 candera: But in this case it was being applied to two integer arguments.

11:06 chouser: ,('the-answer '{the-answer 42})

11:06 clojurebot: 42

11:06 chouser: ,('the-question '{the-answer 42} :not-found)

11:06 clojurebot: :not-found

11:06 candera: ,('+ 2 2)

11:06 clojurebot: 2

11:07 chouser: ,('the-question 2 :not-found)

11:07 clojurebot: :not-found

11:07 candera: ,('+ 2)

11:07 clojurebot: nil

11:07 rhickey: ,(.run 'foo)

11:07 clojurebot: java.lang.RuntimeException: java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol

11:07 candera: ,('+ 1 2 3 4 5)

11:07 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: Symbol

11:07 Licenser_: ,(.run forest run!)

11:07 clojurebot: java.lang.Exception: Unable to resolve symbol: forest in this context

11:08 phobbs: ,(.run 'forest run!)

11:08 clojurebot: java.lang.Exception: Unable to resolve symbol: run! in this context

11:08 candera: Looks like it takes one or two args. But what on earth does it do?

11:08 phobbs: ,(.run 'forest 'run)

11:08 clojurebot: java.lang.IllegalArgumentException: No matching method found: run for class clojure.lang.Symbol

11:09 rhickey: ('foo {'foo 42})

11:09 ,('foo {'foo 42})

11:09 clojurebot: 42

11:09 chouser: candera: it looks up the symbol in the first arg. If the first arg is not a map or the symbol is not found, it returns the second arg or nil if not given.

11:09 candera: Ah, got it. Makes sense.

11:10 Consistent with other map lookup APIs.

11:10 Licenser_: hmm I think we should make a clojure form that renames nil to a_cookie. Then you could say "

11:10 fogus_: candera: check this out http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/Symbol.java#L119

11:10 Licenser_: This function returns a_cookie"

11:10 phobbs: ok, I have another question: I want to use multisets, so I figured lists should work.

11:11 candera: fogus_: Thanks. I wasn't quite curious enough to go source spelunking. ;)

11:11 phobbs: ,(clojure.set/union '(1 2 3) '(2 3 4))

11:11 clojurebot: (4 3 2 1 2 3)

11:11 fogus_: I've had that page up for 6months waiting for this question. :p

11:11 phobbs: but difference doesn't work with lists

11:11 ,(clojure.set/difference '(1 2 3) '(2 3 4))

11:11 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IPersistentSet

11:11 phobbs: why can union accept lists but difference can't?

11:12 is there a better way to do this?

11:12 fogus_: phobbs: why not use sets?

11:12 phobbs: multi-sets can have repeats.

11:12 #{1 1}

11:12 ,#{1 1}

11:12 clojurebot: Duplicate key: 1

11:12 phobbs: doesn't work.

11:12 fogus_: oh, i missed the multisets comment

11:12 sorry

11:15 chouser: phobbs: clojure.set functions are only sure to work with sets. Some of them might not be that strict, but their behavior is undefined.

11:16 what does difference mean on a multiset anyway? (difference [1 1 1] [1]) => [1 1] ?

11:17 phobbs: Yeah, that's what I was intending

11:17 I guess I could keep a map between elements and counts

11:17 and implement difference myself

11:18 chouser: that might be best

11:19 rhickey: there's no such thing as a multiset

11:23 hoeck: phobbs: http://gist.github.com/410875

11:24 phobbs: rhickey: I meant the concept, http://en.wikipedia.org/wiki/Multiset

11:26 hoeck: that's awesome. Did you find that or just write it? thanks a lot

11:30 hoeck: phobbs: some days ago, someone needed a multiset for a project euler task

11:30 rhickey: phobbs: smells like a map to me, but the operations are fine

11:31 hoeck: phobbs: but its only a minimal implementation, some things are missing

11:32 jweiss: is there a functional way of taking a list of lists and basically "turning it sideways" - so that i get a new list of lists, but the rows and cols are inverted

11:33 ie, [ [ 1 2 3 ] [ 4 5 6] ] -> [ [ 1 4] [2 5] [3 6]]

11:34 chouser: jweiss: those are vectors

11:34 jweiss: for seqs, (def transpose (partial apply map vector))

11:35 meh. probably should be 'list' instead of 'vector' there

11:36 jweiss: chouser: sweet, thanks

11:36 yeah it works with vector input also - since they are also seqs right?

11:37 chouser: apply and map will seq across them, so yes a vector of vectors will work

11:44 djpowell: hmm - clojure.java.sh doesn't handle stderr very well

11:44 you need two threads to do it properly

11:47 chouser: djpowell: bleh, really? do you have a failing test case?

11:48 cgrand: why does Var.bindRoot dissoc meta's :macro?

11:49 djpowell: - (sh "cmd" "/c dir c: 1>&2")

11:49 chouser: stderr's buffer gets full and the call hangs

11:53 Java's Process class could really have done with having nio support so that you could block on both streams from one thread - instead we just got the blatent intern project of ProcessBuilder which doesn't seem to make using Process any easier at all

11:54 replaca: yeah, it would be nice to do some more work on getting a relly nice version of "sh"

11:55 one that let you easily manage the different ways you might want to use it

11:55 djpowell: sh reading a byte at a time is going to be a bit inefficient too if there is lots of output

11:56 Licenser_: does reduce increase the stack size further then the function it calles + 1?

11:56 chouser: the most important issues are around the API -- what do you think of that?

11:56 the implementation can be fixed

11:57 digash: I am getting this "java.lang.ClassFormatError: Invalid method Code length 68016 in class file" from compiler any suggestions?

11:57 djpowell: I haven't tried it yet - but it looks ok

11:59 chouser: digash: do you have a large literal object?

11:59 patrkris: rhickey: are locks taken in any particular order in the commit phase of a transaction? I see that for commutes it seems to be the case, but not for refs. Am I right?

11:59 rhickey: that didn't make sense - i meant for commutes and not for sets

11:59 chouser: djpowell: btw, why use "cmd" instead of calling dir directly?

11:59 Licenser_: I know this from jruby,. it happens as chouser when your objects grow too much

11:59 chouser: oh, is dir not external on windows?

12:00 djpowell: yeah

12:00 chouser: blah

12:00 ok

12:00 djpowell: and even if it was, you need "cmd /c" to enable the shell feature of redirection

12:00 digash: chouser: i am generating protocols from a macro, would that create a large literal?

12:01 tmountain: can anyone tell me the easiest way to write a lazy seq to a file?

12:01 djpowell: chouser: I think Java is the same with unix? I think you'd need to use 'sh' or something to include pipes in your command line - not sure

12:01 rhickey: patrkris: sets are flagged as owned previously, and won't be acquired and held otherwise, so the committer knows it owns them and doesn't need to sort

12:02 chouser: digash: hm... protocols include a literal. are they really large protocols?

12:02 patrkris: rhickey: oh yeah right - and that isn't the case for commutes. Thanks!

12:02 chouser: djpowell: yeah, for piping you'd have to.

12:02 digash: chouser: not really, it works if i use definterface, but not with defprotocol

12:04 tmountain: nm, spit ... ;-)

12:04 digash: chouser: i will try to split it into multiple namespaces, maybe it will help

12:06 Licenser_: digash: do you use genclass?

12:06 digash: chouser: also i am getting quite a few "Warning: protocol #'com.pico... is overwriting method positi... of protocol Long...

12:07 Licenser_: no genclass, i was using definterface which i believe does and then switched to defprotocol and start getting that error

12:10 chouser: my clojure repl startup time recently fell off some kind of cliff. Used to be 1 or maybe 2 seconds, now over 8

12:11 Licenser_: digash: *nods* okay was just a thought that a gen-class in your ns might cause this :)

12:12 chouser: oh, it appears to be something it my own setup. sorry for the noise.

12:23 djpowell: hmm - is there an easy way to create a new thread in clojure - an actual new thread - not just some potential thread-poolish thing

12:23 arohner: djpowell: (Thread.)

12:24 djpowell: (actually some sort of pluggable executor strategy might be nice)

12:24 arohner: djpowell: and clojure fns are all runnable, so (Thread. #(map foo bar))

12:55 replaca: chouser: (re: sh) one thing I would like is a way to get output incrementally (or even just automatically redirect it to *out* when I'm doing something where I want the client to see the output)

12:58 chouser: yeah, that's often requested. I'm worried about people failing to close one of the streams which may keep zombie processes around

13:02 replaca: chouser: I think what's necessary is an interface that makes it easy to do what you want, but no more. There are a lot of separate ways that you end up wanting to use a shell-out feature and I don't think that any language has packaged them up really nicely

13:03 chouser: I certainly think the the "run and just give me a string back" needs to be on the menu, but it's not always what you want to eat

13:04 chouser: yeah, I've never seen a shell-out API that is both pleasant to use and feature-complete.

13:04 replaca: chouser: It would be a great step forward if we could have a nice shell out in Clojure (compared to Python say, which is also always not-quite-right it seems)

13:04 chouser: I hoped that by ditching feature-complete as a goal, I could at least get pleasant-to-use. Not sure it worked.

13:05 replaca: chouser: and I don't want us to cast in stone (or silly putty) something that doesn't meet our goal

13:05 chouser: I think that we have the facilities to get both in Clojure. I don't think it has to be a single call, though it may be with the right keyword args

13:12 jweiss: when in slime, and you "use" a file from the repl, and the compiler throws an error, how do you determine what line of the source file it choked on?

13:13 chouser: jweiss: you want to look at the final (not the root) exception, and you should see the filename and line number in the exception message itself

13:14 I don't know how to do that in slime, sorry.

13:17 jweiss: chouser: all it says is "Don't know how to create ISeq from: clojure.lang.Symbol"

13:17 i guess i can try lein repl

13:18 oh wait there it is on the lein swank stdout :)

13:18 sweet

13:35 hm, i am trying to call str on a sequence, and println it. i am getting "clojure.lang.LazySeq@3e2"

13:36 so either str is not the right way (even though it seems to work at the repl) or I need to unlazify my code?

13:36 replaca: Q: does anyone know how to get any info about a protocol dynamically? It doesn't seem to own its symbol: (doc Streams) gives me an error for example.

13:50 oops, my bad -- I was comparing different versions of io and it changed

13:51 zakwilson: http://gist.github.com/416794 <-- I'm having issues getting a parallel map for a fast f and large coll to scale to more cores. It's perfect with two, but doesn't improve further with four.

14:11 timcharper: can anyone see this ?

14:11 zakwilson: Yes

14:12 timcharper: LimeChat is being lame.... I posted a whole stream of messages and none of them made it through

14:12 back to ERC

14:21 r2q2: Where is a good tutorial for compojure?

14:25 fogus_: Can anyone comment on which is the cleaner syntax? http://gist.github.com/417513

14:26 ysph: r2q2: that's a good question, i started writing a compojure app a few weeks ago, i remember the groups post about changes in the latest version being helpful

14:26 i can't recall finding an actual up-to-date tutorial

14:27 here it is http://groups.google.com/group/compojure/msg/519e8fd5cd76dacb

14:28 chouser: fogus_: my bikeshed is red

14:28 erm, I mean "kontract"

14:28 fogus_: :P

14:29 zakwilson: I think I like the keywords better, but it just doesn't matter much.

14:29 chouser: in general, clojure tends towards less grouping, though of course there are still things like gen-class that group where it might not be necessary

14:30 kontract reminds me of how defrecord/deftype don't group per protocol

14:30 a.k.a. rhickey's bikeshed is blue so yours should be too

14:30 fogus_: contract seems very common-lispy to me.

14:31 although I might need another group os parens for that. ;)

14:31 I'm leaning towards kontract

14:32 chouser: But I don't even own a bike! :(

14:32 r2q2: ysph: Thank you for your help!

14:33 ysph: fogus_: maybe you could throw a 'c' and a 'k' in there somehow

14:33 contrakt

14:34 i guess that's about the same, oh well

14:34 r2q2: good luck

14:35 fogus_: I'll reserve contrakt for when the constraints are specified with infix notation. :O

14:40 r2q2: ysph: You too!

15:17 phobbs: I'm having some problems getting slime set up on emacs

15:17 I get a bunch of these errors when I start slime:

15:17 WARNING: group-by already refers to: #'clojure.core/group-by in namespace: swank.core.protocol, being replaced by: #'swank.util/group-by

15:18 furthermore, something in my emacs setup is stopping the slime buffer from appearing. It shows up when I use emacs-starter-kit.

15:19 Also, when I use a print statement, I get a message: error in process filter: slime-dispatch-event: Elisp destructure-case failed: (:write-string "<WHAT I PRINTED>")

15:20 the inability to print is really bothering me. The warnings don't seem to affect anything, and I don't seem to miss the *SLIME* buffer that much...

15:20 though who knows, since I haven't spent practically any time in it, besides what I've seen from emacs-starter-kit.

15:26 arkrost: hi! Tell me please what is the difference between class and type functions from clojure.core. It would be nice to see when they will return different results.

15:26 chouser: ,(class #^{:type ::Foo} {})

15:26 clojurebot: clojure.lang.PersistentArrayMap

15:26 chouser: ,(type #^{:type ::Foo} {})

15:26 clojurebot: :sandbox/Foo

15:28 arkrost: What can I use this for?

15:29 chouser: well, you could make a multimethod that dispatches on type and have different maps be routed to different method implementations based on their :type metadata

15:29 but that whole approach is less often useful now with protocols and records

15:30 stuarthalloway: promotion of string to core is proceeding in a branch: http://github.com/stuarthalloway/clojure/tree/string

15:30 feedback welcome!!

15:31 bad ideas are liebke's fault

15:31 chouser: heh

15:31 liebke: thanks

15:31 stuarthalloway: and man, that dude swears a lot

15:45 _na_ka_na_: if a future is created, what are the semantics of it getting executed in another thread? is it done immediately by cr8ing a new thread? or in a thread-pool? or not unitl one @'s it?

15:45 arohner: _na_ka_na_: it happens in the agent thread pool, starting immediately

15:45 chouser: the send-off pool

15:46 _na_ka_na_: oh, but the docs don't say so ..

15:46 reading the docs it appears it happens immediately?

15:46 chouser: yes, immediately

15:47 _na_ka_na_: but then that will give me an impression that (map #(future ..) (range 100)) will create a 100 threads?!

15:47 chouser: I would think so, yes.

15:48 _na_ka_na_: but you just said it uses the send-off pool?

15:48 chouser: yes

15:48 _na_ka_na_: isn't that pool of fixed size?

15:48 chouser: no

15:48 send is fixed-size. send-off grows

15:48 _na_ka_na_: oh ya ..

15:49 mefesto: does `proxy` not like it when an interface has an overloaded signature?

15:49 _na_ka_na_: does it also mean that pmap is not lazy at all?!

15:50 it will spawn (count coll) threads ?

15:50 chouser: _na_ka_na_: no, pmap throttles itself some.

15:51 _na_ka_na_: oh ok, just saw the source it throttles as map is lazy .. .

15:51 kotarak: mefesto: what is your problem exactly?

15:51 mefesto: getting an IllegalArgumentException: Wrong number of args (2)

15:51 kotarak: mefesto: code?

15:51 mefesto: one sec while i gist

15:51 _na_ka_na_: chouser: thanks

15:52 kotarak: mefesto: and a shameless plug: http://bit.ly/cS8AjJ

15:52 hsjunnesson: Using leiningen I tried adding :jvm-opts ["-XstartOnFirstThread"] to the project file, but that didn't work with "lein swank". JAVA_OPTS=-XstartOnFirstThread" lein swank does though.

15:52 chouser: mefesto: you can have multiple method bodies on each proxy method for the various arities

15:53 kotarak: mefesto: but not for different types, you to take care of that in the functions.

15:54 mefesto: http://gist.github.com/417642

15:54 kotarak: mefesto: so (.foo the-proxy "some string") and (.foo the-proxy 5) has to be distinguished in the foo function

15:54 mefesto: i wanted to be able to treat a spring context similar to a map and do: (:beanName ctx)

15:55 chouser: kotarak: very nice treatment in the blog post.

15:55 kotarak: chouser: thanks :)

15:56 mefesto: kotarak: thanks i think i see what im doing wrong. (btw great blog :)

15:57 stuarthalloway: so nobody has any (more) feedback on the string fns?

15:58 chouser: :else not :default

15:59 stuarthalloway: chouser: you're talking to me, aren't you

15:59 chouser: stuarthalloway: hi :-)

16:00 I like the type-dispatched functions. that was missing from some late versions in contrib, wasn't it?

16:00 they're cond now because that's faster than mutlimethods?

16:00 stuarthalloway: yes, and some people like it the other way

16:01 chouser: yes, liebke and I perf-tested everything that wasn't a straight java passthrough

16:01 chouser: you're talking about yourself, aren't you

16:01 stuarthalloway: i like the code as is

16:02 and I just committed :default -> :else

16:02 with your name in the commit msg, so I hope I understood what you were about

16:02 chouser: capitalize seems like an odd inclusion.

16:03 stuarthalloway: rhickey thought so too

16:03 the fns chosen came from an informal read of what people were using

16:03 mefesto: kotarak, chouser: got it working, thanks :)

16:03 chouser: whew, on his side of something for once.

16:03 the only name I have any question about is trim-nl

16:04 stuarthalloway: if you were really on his side you wouldn't use string fns at all

16:04 chouser: and it's not terrible.

16:04 heh

16:04 stuarthalloway: what would you like to call it

16:04 chouser: should have known better.

16:04 stuarthalloway: btw (and I plan to email the list about this)

16:04 ... all these decisions are being made with Rich's input

16:04 chouser: trim-nl docs should perhaps reference string/trim instead of String.trim ?

16:04 stuarthalloway: rich and I have a phone call every day

16:05 chouser: I miss having all of Rich's imput logged somewhere.

16:05 input

16:05 stuarthalloway: where was it before?

16:05 chouser: here or on the group.

16:05 stuarthalloway: I am trying to take things off his plate, not hide him from the world !

16:06 chouser: yeah, it could be you're just party to what used to be only in his head. I guess that's a win. :-)

16:06 * stuarthalloway will do anything to make that more of a win

16:06 riddochc: I just read the thread on the string functions. It started to feel a little like bikeshedding...

16:06 stuarthalloway: so long as it continues the current trend of freeing him to focus on strategic things

16:07 hamza: gents, which function do i need to implement so that sort call will work on my defrecods? or is it possible?

16:07 chouser: the main thing that bothers me about trim-nl is that with some fonts it's not obvious it isn't trim-n1

16:07 stuarthalloway: riddohc: hope the code doesn't feel that way!

16:07 chouser: but I don't have any great suggestions.

16:07 stuarthalloway: chouser: how about trim-newline?

16:08 riddochc: stuarthalloway: I haven't looked at the code for it, yet, so I don't know.

16:08 chouser: yeah, actually -- that's not bad. I'm not a fan of long function names, but maybe worth it in this case.

16:08 pedroteixeira: wouldn't be better to use regexp replace for the "trim-nl" function?

16:08 tomoj: chouser: I read that as "... trim-n1 ... trim-n1" :(

16:08 chouser: tomoj: exactly

16:08 ok, gotta go.

16:08 stuarthalloway: I have complete confidence you'll choose wisely

16:09 despite that :default fiasco

16:09 SinDoc: stuarthalloway: I get this when I try to run labrepl: http://gist.github.com/417488

16:09 chouser: stuarthalloway: actually, there's another :default in there still.

16:10 stuarthalloway: doh!

16:10 SinDoc: abedra has forked labrepl and is fixing the warnings

16:10 as long as they are warnings they won't hurt you

16:11 SinDoc: warnings are my friends, yeah but the server doesn't start

16:11 stuarthalloway: SinDoc: hmm, that's odd

16:12 SinDoc: BTW, I'm on IntelliJ

16:12 stuarthalloway: can you try grabbing abedra's and see if it works for you

16:12 he has renamed labrepl to embark

16:12 chouser: will remove the other :default in the next commit

16:12 pedroteixeira: perhaps, overloadinf the function trim to take an argument to remove newlines is better than having trim-ln?

16:12 SinDoc: stuarthalloway: OK. No problem; thanks!

16:13 abedra: SinDoc: all the labs work, I am just working on updating all the instructions

16:14 fogus_: riddochc: I prefer the term bike-shedding. :p

16:14 SinDoc: abedra: Is the problem on my end then?

16:14 riddochc: fogus_: You mean, hyphenated?

16:16 fogus_: yes, that is more aesthetically pleasing

16:17 liebke: ok, this is a little confusing, but

16:17 I am stuarthalloway, on liebke's box

16:17 while he is on my box making trimr run faster

16:17 Raynes: technomancy: ping

16:17 liebke: so if I offend anyone, remember that I am stuarthalloway

16:18 pedroteixeira: we decided that all the overloading would happen in replace

16:18 so if you havea simple need, you can hit a named fn

16:18 pedroteixeira: liebke: ok, cool :)

16:18 liebke: if you have a need outside the anticipated defaults, use replace

16:19 and man, pedroteixeira is hard to type...

16:20 kotarak: Is there a naming convention for protocols in contrib? Like ISomeInterface; maybe PSomeProtocol?

16:20 pedroteixeira: it is shorter than stuarthalloway ;)

16:20 liebke: fair enough, but it is full of vowels

16:20 nDuff: vowels are great -- at least for folks using dvorak, they're easy to type.

16:21 liebke: the best thing about dvorak is switching into (or out of) it on your friend's keyboard

16:22 kotarak: not so much yet, thoughts?

16:22 abedra: SinDoc: i mean they all work on my embark project

16:24 SinDoc: abedra: obviously, I should pull embark then

16:24 kotarak: liebke: Hmm.. I would maybe just go with CapitalInFront. This is sufficiently clear in usual clojure code, I'd say. Makes sense?

16:24 liebke: agreed on cap conventions

16:24 abedra: SinDoc: yes, for now

16:24 liebke: no need for I or P

16:25 kotarak: liebke: k

16:25 SinDoc: abedra: So it's a fork and you plan to merge back later

16:25 riddochc: I have a set of shell aliases I use, 'asdf' and 'aoeu', to switch back and forth between qwerty and dvorak, so my wife can occasionally use my laptop.

16:25 kotarak: btw, what should bugs be tagged like which should be fixed for 1.2? Is this rhickey's privilege to decide?

16:26 I'm asking because I opened a ticket for the new reductions. (with patch)

16:26 liebke: kotarak: if I understand your question correctly, yes, Rich decides

16:26 kotarak: rhickey didn't react to email...

16:26 liebke: I (stu) saw that. please mark it as 1.2 and assign to me (stu)

16:27 kotarak: k

16:27 liebke: thanks!

16:28 abedra: SinDoc: correct

16:28 kotarak: done

16:29 SinDoc: abedra: I noticed there's no pom.xml

16:31 abedra: SinDoc: yep, you'll have to use leiningen for now

16:31 lein deps

16:31 then ./script/repl

16:37 phobbs: why would giving type hints slow something down?

16:38 I'm using the example on clojure.org/transients

16:38 * Raynes notes, smugly, that it would slow YOU down because you have to take the time to type them. :>

16:38 phobbs: (defn vrange2 [n]

16:38 (loop [i 0 v (transient [])]

16:38 (if (< i n)

16:38 (recur (inc i) (conj! v i))

16:38 (persistent! v))))

16:38 but on my machine,

16:38 (defn vrange3 [n]

16:38 (loop [ i (int 0) v (transient [])]

16:38 (if (< i n)

16:38 (recur (inc i) (conj! v i))

16:38 (persistent! v))))

16:38 is slower

16:38 Raynes: -> gist.github.com

16:38 phobbs: oh, sorry

16:39 Raynes: For pastes that are over one or two lines, please paste them at a pastebin like gist.

16:39 Isn't a biggy, you didn't know. <3

16:39 lancepantz: burn him!

16:39 Raynes: :)

16:39 lancepantz: :D

16:40 Chousuke: phobbs: possibly because conjing the i into a vector ends up boxing it anywa

16:40 phobbs: so you're just unboxing it with the int cast, for no gain

16:41 phobbs: http://gist.github.com/417710

16:42 oh... can I make it a vector of ints to stop this? Or is there no way to avoid this overhead?

16:42 Lajla: Chousuke, te pornotähdet.

16:43 Chousuke: vectors of primitives will be in 1.2 I think? or is that for 1.3

16:43 Lajla: Is there a point to your random interjections? :P

16:43 kotarak: Argh, is there a tutorial for maven on OS X (to compile contrib)?

16:44 Lajla: Chousuke, it's like James Joyce, it keeps insanity away.

16:44 phobbs: Chousuke: if you don't use transients, the type hint speeds it up. What's conj! doing that conj isn't?

16:44 Chousuke: hmm :P

16:45 phobbs: huh.

16:45 Raynes: Compiling contrib manually should be punishable by horrific death.

16:45 Chousuke: phobbs: I can't see any reason why a type hint would speed that up at all

16:45 phobbs: transients or no transients

16:46 kotarak: Raynes: when developing for contrib this not applicable, I think.

16:46 Raynes: kotarak: That's a special circumstance. ;)

16:46 kotarak: Under Raynes Law, you're allowed to compile contrib yourself if you're contributing!

16:46 Isn't it obvious? :p

16:47 Chousuke: isn't just mvn compile enough?

16:47 maybe mvn clojure:compile or something

16:47 phobbs: Chousuke: speeds it up ~2x on my machine

16:47 kotarak: Chousuke: yeah, but how to get a mvn in the first place?

16:48 Chousuke: phobbs: that makes no sense.

16:48 phobbs: Chousuke: Optimizing high-level languages makes no sense. I should be writing this sort of code in java.

16:49 digash: kotarak: if you on mac os $ sudo port install maven2

16:49 Chousuke: but is there any reason you're not using into? :P

16:49 kotarak: digash: thanks

16:49 phobbs: Chousuke: not really, I was just fooling around with the example code, that's all.

16:53 _na_ka_na_: Q: If I only use a commutative fn in my dosync transactions, will a transaction ever be re-tried?

16:54 meaning I'm using the commute function to change the ref

16:57 mefesto: yeah i think it can be retried

16:58 you should be using side-effect-free fns for updating refs

17:05 arkrost: /exit

17:07 _na_ka_na_: mefesto: its a side effect free fn only, just want to understand why will it be re-tried? as its commute

17:08 mefesto: well afaik, the transaction will be retried automatically if some other thread happened to commit the tx before this one...

17:08 tx-a starts then tx-b starts, tx-b commits, tx-a retries, tx-a commits

17:09 assuming tx-{a,b} use some of the same refs

17:09 because at the point that tx-b commits, the values that tx-a were working with are incorrect and needs to retry

17:11 _na_ka_na_: I agree with you completely if one were using ref-set or alter ... but this is commute .. doc of which says .. At the commit point of the transaction, sets the value of ref to be: (apply fun most-recently-committed-value-of-ref args)

17:11 mefesto: at least that's what i thought happens... i could be wrong :)

17:11 which is fine if it's only one ref we are talking about... but what if there are other refs involved?

17:11 maybe if all refs involved were only using commute then it wouldn't matter?

17:12 _na_ka_na_: my original question was: If I *only* use a commutative fn in my dosync transactions, will a transaction ever be re-tried?

17:12 thats what it seems but I'm not yet experienced enough to trust my understanding a 100% :P

17:13 mefesto: yeah after reading the doc on it again i think you are right...

17:14 says, "you must accept last-one-in-wins behavior"

17:15 _na_ka_na_: Hmm

18:10 OForero: hi, I have a problem in the REPL

18:10 (use 'uk.ac.liv.oforero.currencies)

18:11 results in clojure.lang.Namespace.warnOrFailOnReplace(Namespace.java:84)

18:11 is there an option to tell the REPL to just relax and replace?

18:36 mefesto: OForero: (use :reload 'your.ns) ?

18:36 OForero: oki doki, thanks

19:39 dysinger: sup

21:10 konr: Java hides the evaluable nature of data and thus binds the programmer into a never-ending cycle of suffering called Sunsara

21:10 blbrown_win3: is there a jason smith on here, that posts on the clojure groups forum. Calling mr smith

21:13 does anyone have examples for "embedding clojure" into a thread application, like a web server. If I am on a web server, I want to setup each request such that it loadeds in a seperate clojure untime

21:13 tomoj: really?

21:13 sounds slow

21:14 blbrown_win3: possibly, that is the ideal.

21:14 tomoj: you want a slow web server?

21:14 blbrown_win3: as slow as possible, yet

21:14 yes

21:14 tomoj: strange :)

21:14 blbrown_win3: possibly

21:20 timmorgan: noob question... why does this work: (map (fn [i] {:id i}) [1 2 3])

21:20 but this doesn't: (map #({:id %}) [1 2 3])

21:20 java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

21:21 tomoj: #(foo) means (fn [...] (foo))

21:21 #({:id %}) means (fn [i] ({:id i}))

21:22 ,({})

21:22 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

21:22 timmorgan: ok, so can I not create a map from within the #() from of fn?

21:22 s/from/form

21:22 konr: hash-map

21:22 tomoj: well, you could, but it would probably not be any better

21:22 timmorgan: hash-map, thanks

21:23 tomoj: ends up being one character longer than the fn version I think

21:23 timmorgan: no the fn version is about 8 chars longer

21:23 maybe I'm not making sense

21:24 tomoj: the only hash-map version I can think of is: (map #(hash-map :id %) [1 2 3])

21:24 which is one character longer than the fn version

21:24 timmorgan: ok got it

21:24 so #({}) freaks clojure out?

21:24 is it the nested brackets?

21:24 tomoj: well, {} is a function

21:25 ,(map #({:a 1 :b 2 :c 3} %) [:a :b :c])

21:25 clojurebot: (1 2 3)

21:25 tomoj: #({}) is trying to call it with no args

21:25 (#({:a 1 :b 2 :c 3} %) is silly, of course)

21:25 timmorgan: ok, let's say that I want to create a hash-map for each arg in a vector

21:26 (map #({:id %}) [1 2 3])

21:26 I still don't get why that doesn't work

21:26 I can use fn for this, but my brain needs to know why :-)

21:26 tomoj: because you're trying to call {:id 1} as a function

21:26 #({:id %}) means (fn [x] ({:id x}))

21:26 ,({:id 1})

21:26 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap

21:27 tomoj: you can call {:id 1} as a function just fine, but it takes one argument

21:27 ,({:id 1} :id)

21:27 clojurebot: 1

21:27 timmorgan: I think there is some fundamental lisp-type thing I'm missing here -- why does it *call* the hash-map as a function, rather than just returning it

21:27 tomoj: that's just what #() means

21:28 #(foo) means (fn [] (foo))

21:28 not (fn [] foo)

21:28 timmorgan: oh!

21:28 (I realize that's the second time you said that)

21:28 tomoj: no problem :)

21:28 timmorgan: thank you -- that's what I was missing

21:28 tomoj: I used to get confused by it as well

21:29 so you can use #(hash-map :id %) if you want to use #(), but it's not much prettier :/

21:29 clojurebot: kotarak prefers hg

21:29 timmorgan: ok, I see now, thank you so much for your patience with me :-)

21:30 what is clojurebot talking about?

21:30 tomoj: sometimes she just randomly says something, not sure exactly why

21:31 timmorgan: ah, ok, funny

21:43 jimt: join #scala

21:46 lancepantz: nooooooooooooooooooooooooo!

22:05 jimt: lancepantz: Yes, it is scary compared to Clojure.

22:06 (But seems to play better in the Android playground at the moment.)

23:29 mebaran151: what would be the best way to capture raw keyboard events?

23:30 like say I wanted to actual read the backspace key instead of allow it to immediately delete a character

23:42 tomoj: mebaran151: in a terminal?

23:42 or like, swing or something?

Logging service provided by n01se.net