2010-05-28
| 00:25 | slyrus | any slime/swank-clojure users/hackers around? |
| 00:26 | lancepantz | i'm new to it, but yeah |
| 00:27 | scott_ | i'm also new to it |
| 00:27 | slyrus | things seem ok for a the first dozen or so commands, but then it hangs :( |
| 00:27 | scott_ | it breaks if I enter something that raises an error |
| 00:27 | lancepantz | slime-repl hangs? |
| 00:27 | scott_ | i'm not sure how well set up mine is |
| 00:28 | slyrus | yeah |
| 00:28 | slyrus | *inferior-lisp ...* still works |
| 00:30 | slyrus | 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 |
| 00:31 | slyrus | dunno if it's the emacs-lisp side of thing or the clojure side of things that's hanging |
| 00:31 | slyrus | (or where to begin debugging either, for that matter) |
| 00:31 | slyrus | anyone know the clojure equivalent of (sb-thread:list-all-threads) ? :) |
| 00:32 | lancepantz | yeah, i'm not experienced enough to be any help |
| 00:34 | technomancy | slyrus: you could try starting swank with lein swank and connecting with M-x slime-connect |
| 00:34 | technomancy | then you could see if reconnecting fixed it |
| 00:40 | slyrus | hmm... I guess I have to figure out how to use leiningen then... |
| 00:42 | technomancy | slyrus: or maven if that's the way you roll |
| 00:43 | slyrus | ack! that's even worse! :) |
| 00:43 | slyrus | I roll with ASDF. doesn't help me much here :) |
| 00:44 | technomancy | slyrus: http://vimeo.com/8934942 is a pretty good intro |
| 00: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 |
| 00:47 | technomancy | slyrus: sure; I assumed you were using a build tool when I suggested that |
| 00:47 | slyrus | sure, emacs is a great build tool! :) |
| 00:47 | Raynes | Emacs is a great * |
| 00: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. |
| 00:50 | lancepantz | you don't have to use it |
| 00:50 | lancepantz | and i think you'd be surprised at how simple lein swank is |
| 00:50 | slyrus | yeah, but you can't run lein swank without it |
| 00:50 | slyrus | or if you can I'm doing something wrong |
| 00:51 | lancepantz | a main function? |
| 00:51 | slyrus | yeah |
| 00:51 | lancepantz | maybe i don't know what i'm doing right :) |
| 00:52 | lancepantz | but i don't see how a main function would impact lein swank |
| 00:52 | slyrus | not having one seems to make lein swank unhappy |
| 00:52 | technomancy | you don't need a main function for lein swank |
| 00:52 | lancepantz | i'd guess you had an unrelated error |
| 00:53 | slyrus | oh, perhaps I'm misreading this error: "[null] Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main" |
| 00:54 | lancepantz | yeah, i think that would be caused by clojure not being on your classpath |
| 00:54 | slyrus | hrm... ok |
| 00:55 | lancepantz | not even sure if that is possible with lein though |
| 00:55 | lancepantz | maybe it didn't bootstrap properly? |
| 00:55 | slyrus | yeah, that's what I thought! |
| 00:57 | slyrus | 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. |
| 00:58 | slyrus | perhaps I'm just thinking about things the wrong way, but I really don't want all the crap in ~/.m2 |
| 00: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. |
| 01:00 | lancepantz | i have my issues with lein, but it does solve that exact problem pretty well |
| 01:00 | technomancy | for trivial projects you can just brute-force your way through it. but it's a lot of unnecessary work. |
| 01: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. |
| 01:02 | zakwilson | The machine that isn't working is running Mac OS 10.5. Not sure where to start troubleshooting. |
| 01:02 | technomancy | zakwilson: java 1.5 maybe? |
| 01:03 | zakwilson | Now running Leiningen 1.1.0 on Java 1.6.0_15 Java HotSpot(TM) 64-Bit Server VM |
| 01:04 | technomancy | hard to say then |
| 01:05 | slyrus | oh, I see... lein deps copies the clojure-xxx and clojure-contrib-xxx jars into lib which lein swank then finds. |
| 01:08 | slyrus | 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? |
| 01:10 | lancepantz | if its a standard library, see if it's on clojars |
| 01:10 | lancepantz | lein searches 3 or 4 other public repos |
| 01: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 |
| 01:11 | lancepantz | i meant commonly used |
| 01:12 | slyrus | I don't want some automagic downloader that finds the jar, I've already got the dang thing locally |
| 01:13 | lancepantz | you can either set up a private maven repo or put it in your .m2 |
| 01:13 | lancepantz | *commence bitching* :) |
| 01:13 | slyrus | ack! |
| 01:14 | technomancy | there are very few instances where something like that doesn't belong on clojars |
| 01:14 | slyrus | so I guess I have to learn maven to use lein. I was trying to avoid that. |
| 01:14 | slyrus | ??? |
| 01:14 | slyrus | what is clojars? |
| 01:14 | technomancy | it's a community jar repository: http://clojars.org |
| 01:15 | slyrus | but I already have the jar here. why would I want to put (and require my stuff to find it) on clojars? |
| 01:15 | technomancy | if your build isn't repeatable on more than one machine it's not much of a build |
| 01:16 | slyrus | could be. I don't really care about builds. I just want my SLIME repl to work! |
| 01:16 | technomancy | I mean, you can just put it in lib if you just want to do a hack job |
| 01:17 | technomancy | which is fine for this situation probably |
| 01:17 | technomancy | I was just saying you probably don't want a private m2 repo |
| 01:18 | technomancy | http://www.catonmat.net/blog/wp-content/uploads/2008/11/edsger-dijkstra-quick-and-dirty.jpg |
| 01:18 | technomancy | ^ 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. |
| 01: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? |
| 01:20 | lancepantz | correct |
| 01:21 | dnolen | slyrus: there's also lein install, which I find convenient |
| 01:21 | lancepantz | then he'd have to build that jar with lein though |
| 01: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. |
| 01:50 | chouser | pmap doesn't work well for fast f |
| 02: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) |
| 02:01 | zakwilson | And applies concat to that |
| 02:01 | chouser | heh, I just wrote that myself |
| 02:01 | chouser | no traction |
| 02:02 | chouser | do you care about pmap's laziness? |
| 02:02 | zakwilson | No. I'm content with a strict version for this. |
| 02:02 | chouser | is your input a seq? lazy? or a vector? |
| 02:02 | zakwilson | a map |
| 02:03 | chouser | you want to transform both keys and values? |
| 02:04 | zakwilson | Yes, in this case |
| 02:12 | chouser | wouldn't happen to be a sorted map, would it? |
| 02:12 | chouser | if so, subseq might be better than partition |
| 02:13 | zakwilson | Not sorted. Just your ordinary, average 27,000 element persistenthashmap |
| 02: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. |
| 02: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. |
| 02: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) |
| 02:19 | chouser | so if the speed of f approaches the speed of walking the seq, there's really just nothing left to parallelize |
| 02:19 | chouser | you'd really want to exploit the structure of the map itself |
| 02:20 | chouser | subseq on a sorted map lets you do that to some extent |
| 02:21 | SinDoc | Where can we define member data for a deftype? |
| 02:22 | chouser | SinDoc: (deftype Foo [member data here]) |
| 02:22 | chouser | but are you sure you don't want defrecord? |
| 02:23 | SinDoc | no, I'm not sure |
| 02:23 | Raynes | If you aren't sure, you probably want defrecord. |
| 02:23 | chouser | right |
| 02:23 | chouser | deftype is more primitive |
| 02:24 | SinDoc | The question is whether the fact that defrecord implements IPersistentSeq is useful for me |
| 02:24 | SinDoc | a priori, i'd say no |
| 02:24 | chouser | IPersistentMap perhaps? |
| 02:25 | SinDoc | sure, I hadn't checked |
| 02:25 | SinDoc | but if it's implied by the fact that I want member data, then I guess I should use defrecord |
| 02:29 | SinDoc | i guess member data DOES imply the use of defrecord |
| 02:29 | zakwilson | chouser: I had the impression that I wouldn't have that issue with a map or a vector. |
| 02:30 | chouser | walking a seq of a map is still O(n), even if looking up any one key is nearly O(1) |
| 02:31 | chouser | building a subseq on a sorted map is O(log n), so it might be a win for partitioning |
| 02:31 | chouser | though I must say 27,000 items doesn't seem like very many. |
| 02:32 | chouser | ,(time (let [r (range 27000), m (zipmap r r)] (zipmap (map inc (keys m)) (map inc (vals m))))) |
| 02:32 | chouser | clojurebot: ping? |
| 02:32 | clojurebot | PONG! |
| 02:32 | chouser | ,(time (let [r (range 27000), m (zipmap r r)] (zipmap (map inc (keys m)) (map inc (vals m))))) |
| 02:33 | Chousuke | clojurebot is a bit slow sometimes :P |
| 02: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 |
| 02:33 | zakwilson | 58ms here |
| 02:36 | chouser | hard to beat |
| 02: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. |
| 02:43 | zakwilson | I need sleep. Thanks for looking at this. I'll revisit it tomorrow. |
| 02:48 | SinDoc | I guessed wrong. Things seem clearer after reading http://clojure.org/datatypes |
| 02:49 | SinDoc | The Datatypes page isn't linked from the sidebar and that makes people miss it |
| 02:55 | chittoor | hola! |
| 02:55 | Raynes | Hai. |
| 03:13 | Licenser_ | I found something very ugly :( |
| 03:13 | Licenser_ | if a var is a string you can't use with-meta :( |
| 03:33 | vegai | what's the proper way to launch a jar made by lein jar? |
| 03:33 | vegai | I keep getting |
| 03:33 | vegai | Failed to load Main-Class manifest attribute from |
| 03:35 | Raynes | I'm not entirely certain that 'lein jar' produces executable jars. |
| 03:35 | Licenser_ | vegai: you have to tell your project.lcj what the main class is |
| 03:35 | Raynes | I think only 'lein uberjar' does that. |
| 03:35 | Raynes | Licenser_: Am I wrong? |
| 03:35 | Licenser_ | Raynes: yes and no |
| 03:35 | Raynes | It has to be one or the other mate. |
| 03:36 | Licenser_ | you need to run it with java -cp your.jar:lib/clojure.jar... main.class.thingy.main |
| 03:36 | vegai | Raynes: same effect with uberjar |
| 03:36 | Raynes | So it does create executable jars. |
| 03:36 | Raynes | My mistake. :) |
| 03:36 | Raynes | vegai: What he said. |
| 03:36 | vegai | aye |
| 03:37 | Licenser_ | Raynes: what exactly is a executable jar? |
| 03:37 | Licenser_ | no jar is executable |
| 03:37 | Raynes | Licenser_: If a jar has a Main-Class attribute, it's executable. |
| 03:37 | vegai | could info about this be added to http://github.com/technomancy/leiningen ? |
| 03:37 | Licenser_ | problem is that you have to add -cp and since sun is silly -cp and -jar isn't compatible |
| 03:37 | vegai | and could lein new perhaps do some of this automatically? |
| 03:37 | Licenser_ | vegai: there is a info in the page |
| 03:38 | Licenser_ | look at the parameters for the project.cljk |
| 03:38 | vegai | Licenser_: yes, but a preferred way to run leinized application might be nice |
| 03:39 | Licenser_ | vegai: I am not sure if there is anythi8ng like that |
| 03:52 | Licenser_ | 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? |
| 03:55 | Raynes | Oh man. |
| 03:55 | Raynes | How did I not know about clojure-http-client. |
| 03:56 | Raynes | clj-apache-http depends on the internet. It will be nice to get rid of all those jars in sexpbot. |
| 04:00 | Licenser_ | Is it possible to extend a class with Proxy? |
| 04:00 | Licenser_ | it seems when I try that it only recognizes the methods already published by class :( |
| 04:01 | Raynes | I think you'd need gen-class for that. |
| 04:04 | Licenser_ | I don't want stinking gen-class :( it is AOT :( |
| 04:05 | Licenser_ | 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 :( |
| 04:05 | vegai | well, some sort of docs lein needs |
| 04:05 | vegai | or fools like me will be scared |
| 04:05 | hoeck | Licenser_: proxy subclasses or implements interfaces |
| 04:06 | hoeck | genclass is only required if you need the performance or a stable classname |
| 04: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 ;) |
| 04:07 | vegai | (sorry if that's a bit of a troll) |
| 04:07 | Licenser_ | hoeck: but I could not use proxy to create an Object that had the aditional .path method, clojure refused to do that |
| 04:07 | hoeck | proxy cannot create new methods |
| 04:07 | Licenser_ | see that is my problem |
| 04:07 | hoeck | but |
| 04:08 | hoeck | you could create a protocol: (defprotocol Path (path [t ...])) and then let your proxy implement that |
| 04:08 | Licenser_ | that works? |
| 04:08 | hoeck | or use gen-interface to create an interface with a `path' method |
| 04:09 | Licenser_ | when I use defprotocol could I call (path obj) ? |
| 04:12 | hoeck | Licenser_: http://gist.github.com/416900 |
| 04:12 | hoeck | Licenser_: yes, (path x) works also |
| 04:12 | Licenser_ | wooh! |
| 04:13 | hoeck | Licenser_: are you actually subclassing anything or only implement swing interfaces? |
| 04:13 | Licenser_ | no I just need some way to store the Path data with the object itself |
| 04:13 | Licenser_ | this is just for ugly swing stuff |
| 04:14 | hoeck | and you don't subclass a, say, javax.swing.JTree$Node ? |
| 04:14 | Licenser_ | no it is ugly |
| 04:15 | hoeck | then using deftype may be a bit more idiomatic, since it can also implement arbitrary interfaces |
| 04:15 | hoeck | just my 2c |
| 04:15 | Licenser_ | :/ I find this very badly(not) documented |
| 04:15 | Licenser_ | hoeck: I kind of don't see through all that |
| 04:15 | Licenser_ | will deftzpe even create java objects? |
| 04:16 | cemerick | Licenser_: you realize you're working with prerelease stuff, right? :-) |
| 04:18 | hoeck | well, (doc deftype) says it all, but its a bit terse :) |
| 04:19 | Licenser_ | cemerick: psst :P |
| 04:19 | hoeck | Licenser_: *everyting* in clojure is a java object :P |
| 04:19 | cemerick | hrm? |
| 04:19 | Licenser_ | cemerick: don't tell me those things, I might get scared :P |
| 04:20 | cemerick | ha |
| 04:20 | Licenser_ | hmm I think the documentation is wrong |
| 04:21 | hoeck | which part of it? |
| 04: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 |
| 04:24 | hoeck | right, that needs an update |
| 04:24 | Licenser_ | also it should be Foo. not Foo |
| 04:28 | Licenser_ | weee it works I love you hoeck! purely platonic of cause |
| 04: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!" |
| 04:30 | Raynes | Licenser_: :D |
| 04:31 | hoeck | Raynes: aren't you the father of sexpbot? |
| 04:32 | hoeck | sexpbot could pm all the non-native speakers and correct their grammar and spelling mistakes :P |
| 04:33 | Chousuke | :P |
| 04:33 | Chousuke | On some channels it feels the natives need that more. |
| 04:33 | spariev | hoeck: as a non-native speacker, I would appreciate such a service :) |
| 04:34 | hoeck | spariev: me too :P |
| 04:34 | spariev | Raynes, what your waiting for ? :) |
| 04:35 | Chousuke | NLP isn't trivial :P |
| 04:35 | spariev | oh, I missed *are* :) |
| 05:01 | Lajla | Chousuke, are you a native? |
| 05:05 | Chousuke | Lajla: nope |
| 05:06 | Lajla | Chousuke, am I? Does 6 years old count for you? |
| 05:07 | Lajla | Chousuke, what is your native language then? |
| 05:10 | Chousuke | Lajla: Finnish |
| 05:13 | Licenser_ | I have a question to resolve |
| 05:14 | Licenser_ | 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 |
| 05:17 | Lajla | Chousuke, hyvin? |
| 05:17 | Lajla | Miksi ovat suomalaiset kaikkialla? |
| 05:18 | Lajla | Miksi olette mun maailmasessa? =( |
| 05:18 | Lajla | Ja mun kanavissa? |
| 05:21 | Chousuke | IRC is a Finnish invention after all P |
| 05:23 | Lajla | Chousuke, onko? |
| 05:24 | Lajla | Ajattelen että sari sanoi sitä aikoinaan. |
| 05:25 | Chousuke | juu. Mutta puhutaan täällä englantia :P |
| 05:25 | Lajla | Mutta ajattelen että kaikki suomalaiset ovat salaliitossa tuhota maailman. |
| 05:25 | Licenser_ | I think I found a evilish bug in clojkure |
| 05:26 | Licenser_ | the new changes to core & contrib make it impossible to (require 'c.c.seq-utils) |
| 05:26 | Licenser_ | the ns exists but breaks stuff horrible |
| 05:26 | Lajla | Chousuke, en koskaan, IRC on suomalainen. |
| 05:26 | Lajla | Olen teidän suomalaisessa salatiitossa. |
| 05:27 | Chousuke | :P |
| 05:27 | Lajla | Tuhoamme maailman, mä ja suomalaiset. |
| 05:28 | Lajla | Nyt olen tullut kuolemaksi, maailmojen tahoaja. |
| 05:29 | Lajla | tuhoaja* |
| 05:29 | Licenser_ | gesundheit Lajla |
| 05:30 | Lajla | Licenser_, näe, olemme tuhoanut, mä ja suomalaiset. |
| 05:31 | Lajla | yhdeksi, olemme tuhoanut maailman kohta. |
| 05:31 | Lajla | muahahahahhahaha |
| 05:33 | Lajla | chouser, mutta pidä musta kii, ja älä päästä koskaan. |
| 05:33 | Lajla | Eh, Chousuke. |
| 05:34 | hoeck | Lajla: stop hitting the `ä'-key :P |
| 05:34 | Chousuke | :P |
| 05:34 | Lajla | hoeck, I also have æ |
| 05:34 | Lajla | pædantic |
| 05:34 | Lajla | Encyclopædia Britannica |
| 05:35 | Lajla | hoeck, welcne cræft cænnst þu? |
| 05:36 | hoeck | is æ the same as ä? |
| 05:36 | LauJensen | hoeck: no its ae fused |
| 05:36 | Lajla | LauJensen, not per se. |
| 05:36 | Lajla | In Old English, it was a sound on its own. |
| 05:37 | Lajla | The same sound as in man |
| 05:37 | Lajla | Old English wrote the sounds in man, and in father differently. |
| 05:37 | LauJensen | Well Im Danish and we're the guys you stole it from |
| 05:37 | LauJensen | And we still use both æ ø and å regularily |
| 05:37 | Lajla | As in, cræft (craft, skill) versus nama (name) |
| 05:37 | Lajla | Hmm, I guess it's the reverse. |
| 05:38 | Lajla | THe Anglo-Saxon switched to the Latin alphabet long before the Norse. |
| 05:39 | LauJensen | In Danish, æ is ae fused together, and sounds like it as well |
| 05:40 | Lajla | LauJensen, substituting æ for ae is not allowed is it? |
| 05:41 | Lajla | As in, it's considered a seperate letter, not just a typographic ligature. |
| 05:41 | LauJensen | Yes, and aa for å and oe for ø |
| 05:41 | Lajla | Right? |
| 05:41 | Lajla | Ahh, no way. |
| 05:41 | LauJensen | Yea, its syntactic sugar |
| 05:41 | Lajla | In Finnish, if ä isn't available a is praeferred. |
| 05:41 | Lajla | I always thought it was considered a seperate letter. |
| 05:42 | Lajla | separate |
| 05: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 |
| 05:43 | LauJensen | Same with Ålborg, you can freely write Aalborg on your mail and nobody would be confused |
| 06:04 | Lajla | LauJensen, ahh and æ exchanged for ae too? |
| 06:05 | Lajla | As far as I know, å originated from ae, as in, an a with a small e over it. |
| 06:06 | LauJensen | Lajla: Lets talk about it once we've learned everything there is to know about Clojure :) |
| 06:08 | Lajla | LauJensen, but etymology of gliphs is far more important than Clojure. =( |
| 06:08 | Lajla | Chousuke, tanssikaamme Ievan Polkkasta. |
| 06:14 | Licenser_ | cooookies |
| 06:15 | Lajla | Licenser_, ruisleipää. =( |
| 06:15 | Lajla | Lajla muuten ruisleiväks. |
| 06:16 | vegai | Lajla: mitä ihmettä |
| 06:16 | vegai | oh, you're playing with a translator? |
| 06:17 | Lajla | vegai, ei ole hyvä suomalainen, tai on? |
| 06:17 | Lajla | vegai, are you? |
| 06:18 | vegai | suomalainen? yes. A good one? debatable |
| 06:18 | Lajla | I don't think translators produce 'mun' in lieu of minun that often. |
| 06:19 | Lajla | Err, Suomi* |
| 06:20 | Chousuke | :P |
| 06:21 | Lajla | Chousuke, don't laugh at my poor attempt at Finnish. |
| 06:21 | Lajla | 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. |
| 06:21 | Chousuke | Donit's understandable. |
| 06:21 | Chousuke | Don |
| 06:21 | Chousuke | sdfhksadlkj |
| 06:21 | Chousuke | Don't worry* |
| 06:22 | Lajla | I heard Finns living in Finland only two times, and that to me sounded like 'Finnish with a heavy Swedish accent.' =( |
| 06: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, |
| 06:22 | clojurebot | "Elapsed time: 796.294 msecs" |
| 06:22 | Chousuke | Have you actually studied Finnish or how did you learn it? |
| 06:22 | Chousuke | wow, that was late. |
| 06:23 | Lajla | Chousuke, I will train under your tutelage and address you as 'mun opettaja, maailmojen tuhoaja' |
| 06:23 | Chousuke | :P |
| 06:23 | Lajla | Chousuke, well, I watched my flatmate talk it with her mother and the rest from IRC. |
| 06:23 | Lajla | THere are actually a lot of finns on IRC I've come to notice. |
| 06:24 | Chousuke | that's pretty impressive. |
| 06:24 | Chousuke | Finnish grammar is far from trivial. I'm Finnish, and I haven't a clue about it. |
| 06:24 | Chousuke | I'm lucky that I just know it :P |
| 06: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. |
| 06:25 | Lajla | If you see a word like 'nettiyhteyttä' for the first time you just know it means 'internet connexion'. |
| 06:26 | Chousuke | well, that does help |
| 06:27 | Chousuke | though you need to be able to recognise where one word ends and another begins |
| 06:27 | bozhidar | I think that Russian grammar is one of the hardest ones around |
| 06:28 | Chousuke | Does it have 15 noun cases like Finnish? :P |
| 06:28 | Lajla | Chousuke, well, it's fairly obviously netti + yksi + eys + partitive case. |
| 06:28 | Lajla | Chousuke, well, Russian is often said to be hard, but Czech is a lot harder. |
| 06: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) |
| 06:29 | Lajla | Russian is just one of the harder languages that people have interest in learning. |
| 06:29 | Lajla | Russian has six case I think. |
| 06:29 | Lajla | seven if you count the new vocative. |
| 06:29 | Lajla | Nominative, accusative, genetitive, locative/praepositional, dative, instrumental. |
| 06:29 | bozhidar | Lajla: I stand corrected |
| 06:29 | Chousuke | Lajla: heh, I wouldn't have thought of "yhteys" having any relation to "yksi" if you hadn't mentioned it :) |
| 06:29 | bozhidar | Иванка Радева дава винаги твърди предложения ;-) |
| 06:30 | bozhidar | a mnemonic to remember them |
| 06:30 | Chousuke | What are the cases in Finnish anyway? |
| 06:30 | Lajla | Chousuke, hmm, well, I guess most English speakers also don't in 'unity' and 'unit' |
| 06:31 | Lajla | Chousuke, taking yks: yks, yhden, yhtä, yhden, yhdessä, yhdestä, yhteen, yhdeltä, yhdellä, yhdelle, yhtenä, ydeksi from the top of my head. |
| 06:31 | Chousuke | yeah, but the names of those? |
| 06: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. |
| 06:31 | Lajla | Ahh |
| 06:32 | Chousuke | also the first should be "yksi" |
| 06:32 | Chousuke | though it's yks in speech |
| 06:32 | Lajla | nominative, genetive, partitive, accusative, inessive, ablative, ... , .. allative, dative, ...,essive, translative |
| 06:32 | Lajla | Chousuke, oh yeah, that's true. |
| 06:32 | Chousuke | yeah there's the "comitative" case which is "yksine" which means something like "with (his) single ..." |
| 06:33 | Lajla | To be honest, I more or less vary yks and yksi depending on the stress on the word. |
| 06:33 | Lajla | Ahh, yes, and also an absessive or something. |
| 06:33 | Lajla | yksettä or something. |
| 06:33 | Lajla | Meaning 'without one' |
| 06:33 | Chousuke | I think that needs to be yhdettä |
| 06:34 | Lajla | Ehh, that is correct. |
| 06:34 | Chousuke | yksittä in plural I suppose. if that makes sense. |
| 06: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. |
| 06:35 | Lajla | Hmm, plural is yhdittä I would gather. |
| 06:35 | Chousuke | that sounds wrong to me. |
| 06:36 | Chousuke | I think the plural inhibits consonant gradation in this case. |
| 06:36 | Lajla | Ah,, it seems you're right according to wiktionary. |
| 06:36 | Lajla | I never really use the plurals of yks I guess. |
| 06:36 | Lajla | Singular not that often too, more in derivations like yhteen. |
| 06:36 | Lajla | Or yhdeksi. |
| 06:36 | Lajla | Or wait, that are cases too. |
| 06:40 | Chousuke | One of the things I like about Finnish is that neologisms are commonly coined and adopted |
| 06:40 | Chousuke | There aren't that many words in use that are obviously non-Finnish :/ |
| 06:41 | Lajla | Chousuke, actually, some estimates place the surviving Finnish vocabulary in Finnish to be at 300 words. |
| 06:41 | Lajla | For instance, tyttö is a borrowing from a Germanic language, compare English: daughter. |
| 06:41 | Chousuke | Yeah, I've heard that too |
| 06: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'. |
| 06:42 | Lajla | Finnish seems to borrow and naturalize words easily, but borrows grammar very hard. |
| 06:42 | Chousuke | The words are integrated so well into the language that you can't tell foreign words from native ones :P |
| 06:43 | Lajla | kahdeksan is also from kaksi + dek (IE, compare latin: decum) as in 'two from ten' |
| 06:43 | Lajla | Yap, Finnish adjusts loans to Finnish phonology. |
| 06:43 | Chousuke | I hope we're not inhibiting Clojure discussions with this off-topic rambling :P |
| 06:44 | Chousuke | seems like most people are idling right now though. |
| 06:44 | Licenser_ | I never idle I just dn't pay attention :P |
| 06:44 | Chousuke | Also I had no idea kahdeksan was formed like that. :P |
| 06:45 | Lajla | Closure is probably excellent to model Finnish grammar in. |
| 06:45 | Lajla | I once started doing it in Scheme, never finnish. |
| 06:45 | Licenser_ | Lajla: because concurrency is very important in finnish? |
| 06:45 | Lajla | Licenser_, no, because lisps just happen to be. |
| 06:45 | Lajla | Licenser_, I think you should serve me. |
| 06:46 | Lajla | And address me as 'Mine overlord' |
| 06:46 | Chousuke | will you be digging for precious minerals? |
| 06:47 | Lajla | All Finland has of that is Ukon Kivi man. |
| 06:47 | Lajla | 'ukkonen' is also an awesome word. |
| 06:47 | Lajla | Actually, 'thunder' has a similar origin, it's also a diminitive of 'thor' in a way I think. |
| 06:47 | Chousuke | It's amusing how ukko means an old man nowadays |
| 06:48 | Lajla | Chousuke, voinko panna ukot sun perseeseen? |
| 06:49 | Chousuke | that was just random :P |
| 06:49 | Lajla | Tai kahdeksan katanaa, jos olet sadomasokisti? |
| 06:49 | vegai | :-o |
| 06:50 | Lajla | http://thisdomainisirrelevant.net/1035 |
| 07: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 |
| 07:17 | candera | npoektop: Working for me at my 1.2 REPL. |
| 07:18 | bozhidar | I don't have it either - 1.1 REPL |
| 07:18 | Chousuke | those docs are for the contrib master branch |
| 07:18 | Chousuke | are you using it or the 1.1 release? |
| 07:19 | npoektop | Chousuke, 1.1 |
| 07:19 | npoektop | ok. it's ok |
| 07:21 | bozhidar | btw I was wondering what might be causing an exception when trying to use slime-edit-definition in SLIME(M-. by default) |
| 07:21 | bozhidar | I only get NPEs when trying to use it |
| 07:22 | bozhidar | with functions that I loaded myself into slime |
| 07:22 | bozhidar | but it works great with stuff coming with clojure itself |
| 07:23 | bozhidar | if the fact that I'm not loading the whole source file causing this? |
| 07:26 | candera | Does it work if you eval the whole file via slime-eval-buffer? |
| 07:27 | candera | 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. |
| 07:29 | bozhidar | candera: no, same problem with slime-eval-buffer |
| 07:29 | candera | Maybe I'm thinking of slime-compile-file. |
| 07:31 | bozhidar | candera: slime-compile-file throws an exception - Wrong number of args passed to: basic$eval--986$compile-file-for-emacs |
| 07:31 | candera | Yeah, OK, I thought that might happen. Sorry: I'm out of ideas, even ideas as lame as the first two. :p |
| 07:32 | bozhidar | the file is pretty basic, just a couple defn, maybe a namespace declartion is required? |
| 07: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. |
| 07:45 | Licenser_ | hmm the new defmulti, does not get a list of arguments any more? |
| 08: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 | clojurebot | "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 | fogus_ | 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 | chouser | to achieve the same thing without using the seq abstraction, you'd have do to something like... |
| 10:53 | chouser | (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 | chouser | (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 | phobbs | ,(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 | phobbs | 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 | phobbs | ,(def tf '+) |
| 11:04 | clojurebot | DENIED |
| 11:04 | phobbs | haha |
| 11:05 | phobbs | 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 | phobbs | 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 | rhickey | ,('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 | candera | 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 | phobbs | ,(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 | phobbs | 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 | phobbs | #{1 1} |
| 11:12 | phobbs | ,#{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 | fogus_ | 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 | chouser | 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 | phobbs | I guess I could keep a map between elements and counts |
| 11:17 | phobbs | 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 | phobbs | 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 | jweiss | ie, [ [ 1 2 3 ] [ 4 5 6] ] -> [ [ 1 4] [2 5] [3 6]] |
| 11:34 | chouser | jweiss: those are vectors |
| 11:34 | chouser | jweiss: for seqs, (def transpose (partial apply map vector)) |
| 11:35 | chouser | meh. probably should be 'list' instead of 'vector' there |
| 11:36 | jweiss | chouser: sweet, thanks |
| 11:36 | jweiss | 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 | djpowell | 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 | djpowell | chouser: stderr's buffer gets full and the call hangs |
| 11:53 | djpowell | 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 | replaca | 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 | chouser | 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 | patrkris | 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 | chouser | 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 | digash | 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 | replaca | 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 | replaca | 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 | chouser | 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 | jweiss | i guess i can try lein repl |
| 13:18 | jweiss | oh wait there it is on the lein swank stdout :) |
| 13:18 | jweiss | sweet |
| 13:35 | jweiss | hm, i am trying to call str on a sequence, and println it. i am getting "clojure.lang.LazySeq@3e2" |
| 13:36 | jweiss | 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 | replaca | 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 | timcharper | 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 | ysph | i can't recall finding an actual up-to-date tutorial |
| 14:27 | ysph | here it is http://groups.google.com/group/compojure/msg/519e8fd5cd76dacb |
| 14:28 | chouser | fogus_: my bikeshed is red |
| 14:28 | chouser | 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 | chouser | kontract reminds me of how defrecord/deftype don't group per protocol |
| 14:30 | chouser | 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 | fogus_ | although I might need another group os parens for that. ;) |
| 14:31 | fogus_ | I'm leaning towards kontract |
| 14:32 | fogus_ | 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 | ysph | contrakt |
| 14:34 | ysph | i guess that's about the same, oh well |
| 14:34 | ysph | 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 | phobbs | I get a bunch of these errors when I start slime: |
| 15:17 | phobbs | WARNING: group-by already refers to: #'clojure.core/group-by in namespace: swank.core.protocol, being replaced by: #'swank.util/group-by |
| 15:18 | phobbs | furthermore, something in my emacs setup is stopping the slime buffer from appearing. It shows up when I use emacs-starter-kit. |
| 15:19 | phobbs | 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 | phobbs | 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 | phobbs | 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 | chouser | 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 | stuarthalloway | feedback welcome!! |
| 15:31 | stuarthalloway | 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 | _na_ka_na_ | 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 | chouser | 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 | _na_ka_na_ | 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 | chouser | I like the type-dispatched functions. that was missing from some late versions in contrib, wasn't it? |
| 16:00 | chouser | they're cond now because that's faster than mutlimethods? |
| 16:00 | stuarthalloway | yes, and some people like it the other way |
| 16:01 | stuarthalloway | 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 | stuarthalloway | and I just committed :default -> :else |
| 16:02 | stuarthalloway | 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 | stuarthalloway | 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 | chouser | 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 | chouser | 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 | stuarthalloway | ... 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 | chouser | 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 | 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 | chouser | ok, gotta go. |
| 16:08 | chouser | stuarthalloway: I have complete confidence you'll choose wisely |
| 16:09 | chouser | 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 | stuarthalloway | SinDoc: abedra has forked labrepl and is fixing the warnings |
| 16:10 | stuarthalloway | 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 | stuarthalloway | he has renamed labrepl to embark |
| 16:12 | stuarthalloway | 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 | liebke | I am stuarthalloway, on liebke's box |
| 16:17 | liebke | 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 | liebke | pedroteixeira: we decided that all the overloading would happen in replace |
| 16:18 | liebke | 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 | liebke | 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 | liebke | 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 | kotarak | 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 | abedra | lein deps |
| 16:31 | abedra | then ./script/repl |
| 16:37 | phobbs | why would giving type hints slow something down? |
| 16:38 | phobbs | I'm using the example on clojure.org/transients |
| 16:38 | phobbs | (defn vrange2 [n] |
| 16:38 | phobbs | (loop [i 0 v (transient [])] |
| 16:38 | phobbs | (if (< i n) |
| 16:38 | phobbs | (recur (inc i) (conj! v i)) |
| 16:38 | phobbs | (persistent! v)))) |
| 16:38 | phobbs | but on my machine, |
| 16:38 | phobbs | (defn vrange3 [n] |
| 16:38 | phobbs | (loop [ i (int 0) v (transient [])] |
| 16:38 | phobbs | (if (< i n) |
| 16:38 | phobbs | (recur (inc i) (conj! v i)) |
| 16:38 | phobbs | (persistent! v)))) |
| 16:38 | phobbs | 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 | Raynes | 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 | Chousuke | phobbs: so you're just unboxing it with the int cast, for no gain |
| 16:41 | phobbs | http://gist.github.com/417710 |
| 16:42 | phobbs | 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 | Chousuke | 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 | Chousuke | 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 | Chousuke | 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 | Raynes | kotarak: Under Raynes Law, you're allowed to compile contrib yourself if you're contributing! |
| 16:46 | Raynes | Isn't it obvious? :p |
| 16:47 | Chousuke | isn't just mvn compile enough? |
| 16:47 | Chousuke | 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 | _na_ka_na_ | meaning I'm using the commute function to change the ref |
| 16:57 | mefesto | yeah i think it can be retried |
| 16:58 | mefesto | 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 | mefesto | tx-a starts then tx-b starts, tx-b commits, tx-a retries, tx-a commits |
| 17:09 | mefesto | assuming tx-{a,b} use some of the same refs |
| 17:09 | mefesto | 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 | mefesto | which is fine if it's only one ref we are talking about... but what if there are other refs involved? |
| 17:11 | mefesto | 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 | _na_ka_na_ | 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 | mefesto | 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 | OForero | (use 'uk.ac.liv.oforero.currencies) |
| 18:11 | OForero | results in clojure.lang.Namespace.warnOrFailOnReplace(Namespace.java:84) |
| 18:11 | OForero | 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 | blbrown_win3 | 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 | tomoj | 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 | blbrown_win3 | 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 | timmorgan | but this doesn't: (map #({:id %}) [1 2 3]) |
| 21:20 | timmorgan | java.lang.IllegalArgumentException: Wrong number of args passed to: PersistentArrayMap |
| 21:21 | tomoj | #(foo) means (fn [...] (foo)) |
| 21:21 | tomoj | #({:id %}) means (fn [i] ({:id i})) |
| 21:22 | tomoj | ,({}) |
| 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 | timmorgan | 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 | timmorgan | 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 | tomoj | which is one character longer than the fn version |
| 21:24 | timmorgan | ok got it |
| 21:24 | timmorgan | so #({}) freaks clojure out? |
| 21:24 | timmorgan | is it the nested brackets? |
| 21:24 | tomoj | well, {} is a function |
| 21:25 | tomoj | ,(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 | tomoj | (#({: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 | timmorgan | (map #({:id %}) [1 2 3]) |
| 21:26 | timmorgan | I still don't get why that doesn't work |
| 21:26 | timmorgan | 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 | tomoj | #({:id %}) means (fn [x] ({:id x})) |
| 21:26 | tomoj | ,({: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 | tomoj | ,({: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 | tomoj | #(foo) means (fn [] (foo)) |
| 21:28 | tomoj | not (fn [] foo) |
| 21:28 | timmorgan | oh! |
| 21:28 | timmorgan | (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 | tomoj | 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 | timmorgan | 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 | jimt | (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 | mebaran151 | 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 | tomoj | or like, swing or something? |