#clojure log - Jul 31 2011

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

0:36 jhickner: getting a strange encoding issue with clojurescript. compiling this cljs expression: (name :foo) results in an extended character in the compiled js: cljs.core.name.call(null,"﷐'foo")

0:37 grant__: slime/swank seem to die on a null pointer exception, and the only way around it is to restart. any way to fix this, and hopefully see better errors? :)

0:37 jhickner: anyone else running into this? my source cljs file is utf-8 encoded

0:38 ohpauleez: jhickner: That seems odd. I'll try to recreate it tonight, but I suggest you hit the mailing list with that, and if confirmed by someone else, open up a bug report

0:38 jhickner: ok will do

0:38 thanks

0:38 ohpauleez: np

0:39 Blackfoot: jhickner: you need to make sure your charset is utf8

0:40 jhickner: my source file is utf-8. is there something else I need to do during compilation?

0:40 clojurebot: amespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it

0:40 Blackfoot: in the html <meta content=”charset=utf-8″ />

0:41 lucca: those are not normal quotes.

0:42 grant__: actually, i'm using swank-clojure

0:42 jhickner: no change when including that in my html (with fixed quotes)

0:43 the actual generated .js file has non-utf8 characters in it, even though my source file is utf-8

0:43 Blackfoot: hrm, you may also want to try setting the encoding in your browser

0:44 eg in chrome: wrench->tools->encoding->Unicode

0:45 ohpauleez: Blackfoot: I think it's the output of the compiler that has non-utf8 characters in it, which shouldn't be happening

0:45 Blackfoot: just to be sure: the symptom i was seeing was (keyword? :keyword) returning false.

0:45 ohpauleez: ahh, yea, that sounds like it may be different

0:45 jhickner: wrench -> tools -> encoding reads UTF-8

0:48 Blackfoot: jhickner: can you look at the string representing the keyword in chrome's inspector? is the first character correct?

0:49 jhickner: in chrome's inspector, it looks like this: "﷐'container"

0:49 that's the output of (name :container)

0:51 Blackfoot: OK, so that looks like an incorrect encoding. when you open the generated JS in an editor, is the first character correct?

0:51 jhickner: no, it's incorrect there too

0:52 Blackfoot: huh, that is odd. can you pastbin the code somewhere? i can try compiling it here

0:53 jhickner: ok sure

0:57 ok, here's a gist with a short sample and the resulting compiled js: https://gist.github.com/1116419

1:00 * ohpauleez looking at it now

1:00 Blackfoot: ok, i can reproduce without charset

1:02 ohpauleez: jhickner: yeah, hit the mailing list and I'd even make the bug report since this is surprising behavior, I'm sure other peopl

1:02 people will hit it as well

1:02 jhickner: ok

1:03 Blackfoot: and it is fixed with the meta

1:03 is this in your HTML file: <head> <meta charset="utf-8"> </head>

1:05 jhickner: you're right, that fixes it. I had tried it with <meta content="charset=utf-8"> before

1:06 Blackfoot: shoot, sorry about that. i pasted in someone else's "fix"

1:07 ohpauleez: Right, but the compiler still should be preventing that

1:08 that was my point

1:10 Blackfoot: ohpauleez: yea, it sounds like the problem is coming up a lot. not sure how the compiler can prevent it unless there's a way to specify charset in the javascript file

1:11 ohpauleez: I think it's safe that the compiler should always generate utf-8, being that it's the default across most web systems

1:11 and most web frameworks generate, handle, and expect utf-8

1:12 Blackfoot: I think that is what it's doing now. browsers are reading it as iso-8859-1 by default

1:13 ohpauleez: hmm, that is weird

1:13 Blackfoot: in jhickner's gist, the character is correct

1:14 jhickner: if it was correct, wouldn't it display correctly in an editor set for utf-8?

1:14 ohpauleez: Blackfoot: That's totally insane, thanks for telling me about that

1:15 Blackfoot: jhickner: it should

1:16 jhickner: the character in question is Hex fdd0, so i'm not sure if there's a canonical way to display it

1:17 in fact, http://www.fileformat.info/info/unicode/char/fdd0/index.htm . maybe that's why it was chosen as the keyword prefix, it shouldn't be used otherwise

1:19 jhickner: hmm, interesting. so it might be intentional then?

1:20 Blackfoot: the use of that character is intentional. the interaction with browsers with the wrong encoding is probably not

2:35 tnks: anyone around?

2:35 I'm in Java, but need fast(ish) persistent data structures.

2:36 There's only a handful of Java libraries with persistent collections.

2:37 So I started playing around with calling Clojure directly from Java.

2:37 which was easy to do with the HashMap.

2:37 but I was curious how to call PersistentTreeMap.

2:37 I couldn't figure out the right idiom.

2:37 kept getting a null-pointer exception.

2:38 Blackfoot: sorry, haven't trying calling in that direction

2:38 tnks: yeah, it's not the common use case, I'm sure.

2:38 calling Scala from Java sucks hard-core.

2:39 I'm not sure how to get at Scala objects.

2:39 and method names have awful names for symbols.

2:39 I think Clojure is probably easier to call. . . but more casting.

2:40 Just calling PersistentTreeMap.EMPTY throws the exception for me.

2:40 which strikes me as odd.

2:40 Blackfoot: I'd try to find examples in the clojure source code

3:36 rado_: hello, is there a clojure REPL that supports bash like shortcuts

3:36 hiredman: "bash like shortcuts"?

3:36 rado_: like up arrow

3:36 for history

3:36 hiredman: ~google rlwrap

3:36 clojurebot: First, out of 6900 results is:

3:36 rado_: Ctrl+a for beginning of line

3:36 clojurebot: Rlwrap - utopia.ision.nl

3:37 http://utopia.knoware.nl/~hlub/rlwrap/

3:37 ohwow_: I thought jline supported that?

3:37 hiredman: jline, depending on what version you use, has unicode issues

3:38 ohwow_: oh

3:38 rado_: ahaha

3:38 i have to run though another program

3:38 been spoiled by python and ruby repls

3:41 rlwrap works, thanks!

4:16 ohwow|: Hello

4:29 _leonid: hello

7:06 Vinzent: can anybody give me an advice on developing desktop apps on clojurescript?

7:50 lobotomy: so, is it possible to get utf-8 working with the emacs-slime-swank-clojure combo somehow?

7:51 in emacs, when i say M-x slime-connect, that works without any problems etc (well, the versions differ); but entering e.g. "ö" into the repl closes the slime connection: "Lisp connection closed unexpectedly: connection broken by remote peer"

7:51 Vinzent: I have slime-net-coding-system (or something similar) setted to utf-8

7:51 lobotomy: i have that too, doesn't help

7:51 could it be on the swank side? not sure where to start debugging this

7:52 Vinzent: hm, there were something in swank, but i thought iy was fixed...

7:52 lobotomy: using cake and hmm

7:52 not sure how "cake swank" sets things up... does it need a utf8 setting or something

7:53 Vinzent: slime-net-coding-system 'utf-8-unix and [swank-clojure "1.3.2"] all works: user> "привет" => "привет"

7:53 so it's a candidate for cake's issue list, i think

7:56 hiredman: Vinzent: you need to set the jvm to use utf8 as well, not sure if the latest swank-clojure defaults to utf8 or not

7:56 lobotomy: used slime earlier, it didn't work then either

7:57 which would point to the jvm yeah

7:57 hiredman: ~google jvm default encoding

7:57 clojurebot: First, out of 37500 results is:

7:57 utf 8 - Setting the default Java character encoding? - Stack Overflow

7:57 http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding

7:59 lobotomy: hmm, in ~/.cake/project.clj i have :jvm-opts ["-Dfile.encoding=utf8"] but that doesn't help

8:00 changed that to UTF8 but that didn't help either :)

8:01 Vinzent: UTF-8, no?

8:01 hiredman: https://gist.github.com/1070768

8:01 lobotomy: hmm... ps aux|grep -i cake reports that the cake thing doesn't include the -Dfile.encoding on the command line

8:02 hiredman: (what I have in emacs for utf8)

8:02 lobotomy: cake runs a persistent jvm, you'll need to restart it to run it with new flags

8:02 lobotomy: yeah, i have

8:03 hiredman: I recommed leiningen

8:03 lobotomy: the x-select-request-type doesn't help either

8:03 the other stuff i already had in .emacs

8:04 looking like it's cake's fault, it doesn't seem to give that file.encoding= option to the jvm

8:04 (also i'm on os x, not sure which things that breaks...)

8:05 hiredman: dunno, I use lein on osx and everything is fine

8:05 is there a reason you are using cake?

8:05 lobotomy: apparently it's better than lein :)

8:05 hiredman: ah

8:05 no

8:06 lobotomy: i used lein for a while a year ago, it worked fine, except it also had this exact same problem

8:06 hiredman: lein is clearly superior to cake

8:06 ~cake

8:06 clojurebot: cake is http://hackage.haskell.org/package/cake-0.0.1

8:06 hiredman: ~lein

8:06 clojurebot: lein is http://github.com/technomancy/leiningen

8:07 ohwow_: cake has no docs ?

8:07 lobotomy: can you elaborate? i read that cake has that persistent jvm thing, which lein doesn't

8:07 hiredman: lobotomy: the persistent jvm is an anti-feature

8:08 Vinzent: I've heard main cake feature is ability to write tasks easily

8:08 hiredman: ah, yet another anti-feature of cake is the task macro

8:08 Vinzent: why?

8:08 clojurebot: why not?

8:09 hiredman: where lein's tasks are just clojure functions, cake tasks are not

8:09 lobotomy: why is the persistent jvm an anti-feature?

8:09 hiredman: lobotomy: because if you are running slime, how often do you start a new jvm?

8:10 lobotomy: dunno, haven't gotten that far yet ;)

8:10 hiredman: basically it makes things more complex without solving anything

8:10 Vinzent: how many tasks have you written?

8:10 Vinzent: hiredman, I'm using lein :)

8:10 hiredman: good

8:11 Vinzent: but persistent jvm was handful for running 'cake test' etc

8:12 hiredman: *shrug*

8:12 lein does have an interactive mode if you want to run tasks like that

8:14 Vinzent: now it does; but cake was here for a long time

8:14 hiredman: a long time?

8:16 Vinzent: yeah (before lein interactive was written)

8:24 lobotomy: ooh, i installed leiningen instead, and with that it works

8:25 leiningen seems to obey the :jvm-opts ["-Dfile.encoding=UTF8"] in the project.clj

8:25 it adds that to the command line and afaict that makes the difference

8:26 now, how to do a bug report for cake... :)

8:42 heh, #cake.clj seems to be not that active. i found a way to get the file.encoding option to the cake command line but it still doesn't work. oh well

10:37 foodoo: There's (cons) which prepends a value to a list. Is there also a function that appends to the end of a list? I couldn't find any so far

10:39 Scriptor: foodoo: conj, but only for vectors

10:40 conj's behavior is dependent on the datastructure it's used for

10:40 ,(doc conj)

10:40 clojurebot: "([coll x] [coll x & xs]); conj[oin]. Returns a new collection with the xs 'added'. (conj nil item) returns (item). The 'addition' may happen at different 'places' depending on the concrete type."

10:41 foodoo: I see. (conj) behaves exactly like (cons) for lists. For vectors it has the desired behaviour

10:42 Scriptor: yep

10:42 it's because lists aren't well-suited for adding to the end, it's O(n) time

10:43 pdk: conj always adds at the point where it's most efficient

10:43 foodoo: But adding to the front is O(1) I suppose?

10:43 pdk: for lists/vectors this means it adds to opposite ends

10:43 pretty much yeah

10:43 visualize it as being a singly linked list

10:44 (doc append)

10:44 clojurebot: Cool story bro.

10:44 pdk: naturally

10:44 foodoo: (doc append) gives me an unresolved var. Do I need a specific package for this?

10:44 pdk: could try concat instead

10:44 clojurebot: Cool story bro.

10:45 pdk: ,(concat '(1 2 3) '(4 5 6) [7 8 9])

10:45 clojurebot: (1 2 3 4 5 ...)

10:45 pdk: ,(concat '(1 2 3) '(4 5 6))

10:45 clojurebot: (1 2 3 4 5 ...)

10:45 pdk: this is a bot of few words

10:45 ohwow|: http://www.4clojure.com/problem/27 could somebody please tell me how to solve this with one-liner?

10:45 Using nth?

10:45 I am not sure what's the idiomatic solution

10:46 pdk: i'd try nth and every? with a lambda, let me think

10:46 foodoo: ohwow: Something like #(= (reverse %) %) maybe?

10:46 pdk: or hell like that too

10:46 ohwow|: foodoo: hm, i see

10:47 but what if the sequence is really big

10:47 pdk: it'd be an issue with ram usage

10:47 but iterating over it is gonna be at least O(n) anyway

10:48 foodoo: You probably can't solve it in one line, if you need to worry about RAM or other technical limitations

10:51 But thanks for showing me that website. I'll probably learn with that instead project euler for a while

10:52 ohwow|: :)

10:53 How can I do let-rec in clojure?

11:01 Oh, nevermind, sorry

11:03 foodoo: By the way: Is there something like an unlist macro? For example if I want to add all numbers of a list, I can't just say (+ mylist) but need to use (reduce)

11:03 ohwow|: (apply + mylist)

11:04 ,(apply + '(1 2 3))

11:04 clojurebot: 6

11:05 pdk: apply, reduce, map etc foodoo

11:06 also inside a ` you can use ~@ to splice in the contents of a list

11:06 ,`(1 ~@(2 3 4) 5)

11:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:06 pdk: welp

11:06 ,`'(1 ~@(2 3 4) 5)

11:06 clojurebot: #<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>

11:06 pdk: yeah i'm an expert

11:07 ohwow|: ,`(1 ~@(list 2 3 4) 5)

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

11:07 ohwow|: :3

11:07 pdk: ~@'(2 3 4) works too

11:07 clojurebot: @ , {a b c]

11:07 pdk: k didnt know that would produce output

11:08 Chousuke: I wonder why it did :P

11:08 ~@

11:08 clojurebot: @ , {a b c]

11:08 Chousuke: huh

11:08 :P

11:08 ohwow|: ~@hello

11:08 clojurebot: Cool story bro.

11:08 foodoo: ah, thanks. But don't worry, this notation is so ugly, that I rather resort to reduce/map/etc. when possible ;)

11:08 ohwow|: foodoo: the notation is rather powerful

11:08 and apply is good too

11:09 pdk: ` is mostly used within macro definitions so i'd stick with apply etc where you can

11:14 ohwow|: Is there a way to determine if the data structure could be turned into a sequence?

11:29 ,(str (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq "HeLLo")))

11:29 clojurebot: "clojure.lang.LazySeq@18c27"

11:29 ohwow|: How to actually evaluate a sequence?

11:29 peteriserins: ,seq?

11:29 clojurebot: #<core$seq_QMARK_ clojure.core$seq_QMARK_@18e0f79>

11:30 peteriserins: ,(seq [1 2 3])

11:30 clojurebot: (1 2 3)

11:30 peteriserins: ,(seq? [1 2 3])

11:30 clojurebot: false

11:31 kumarshantanu: ohwow|: (apply str lazy-seq-here)

11:31 ohwow|: (apply str (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq "HeLLo")))

11:31 oops

11:32 Thanks

11:32 (fn [st]

11:32 (apply str

11:32 (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq st))))

11:32 Is this a good solution for this problem: http://www.4clojure.com/problem/29#prob-title ?

12:05 kumarshantanu: How can I find out if my send-off work is finished or not?

12:05 I want to poll

12:41 foodoo: how can I recur in an anonymous function, when I don't have a tail recursion?

12:46 Scriptor: foodoo: recur seems to work in anonymous functions fine, what do you mean by you don't have tail recursion?

12:48 ohpauleez: foodoo: If you have such unralentless recursion happening in the function, it's probably better to spin it out into a dedicated function

12:50 foodoo: I'm playing around on 4clojure.com and I need to define a function for which the unit tests pass. To my knowledge I can't assign a name to the provided function for "explicit" recursion. Or am I mistaken?

12:50 Scriptor: foodoo: (fn func-name [args] ...)

12:51 foodoo: oh, thought defn was for named functions and fn was for anonymous functions. Thank you very much :)

12:51 Scriptor: that's true, fn is for anonymous functions, but you can add an explicit name to them for convenience's sake

12:52 whereas defn actually stores that function in a var

12:53 foodoo: The funny thing is: I also tried (fn [l] (let [myInnerFunction ... ] (myInnerfunction l)) which worked fine on my machine, but the web form didn't like it

12:53 It couldn't resolve the symbol myInnerfunction

12:54 huray! Problem solved :)

13:09 triyo: I'm looking through the devnotes in ClojureScript repo and I can't seem to find notes on what Atom actually is (compiled to) in Cljs. Anyone have an idea.

13:09 ?

13:16 Blackfoot: triyo: the source code is pretty readable, src/cljs/cljs/core.cljs

13:16 it looks like it compiles into an Atom object

13:18 triyo: Blackfoot: thanks, it does look pretty straightforward.

13:22 Today I made an epic fail with cljs. The line has been so well blurred between clj and cljs at dev time that when I introduced an atom in my cljs part, I thought it will live across each HTTP as its running in the JVM process. Opps its a cljs Atom, so client side, not the same at all.

13:25 One has to be conscious what clojure-like code runs where as same constructs may mean very different things.

13:25 Ver interesting

13:25 *very

13:31 ohpauleez: triyo: but you could send the atom's current value over the wire and set! the atom on the server side, no?

13:34 triyo: Yup you could, you are absolutely right. I am just stating that one needs to be conscious what is front-end and whats back-end and its not easy as one may thing since the line has been really well blurred.

13:37 wastrel: hi clojureelles

13:41 ejackson: triyo: ooh, that's interesting, the atoms are cleared between http calls, makes sense.

13:42 triyo: thats obvious when you think of it. But since the clojure/core team has done an amazing job to blur the line between clj and cljs, you get caught out every now and then.

13:45 For instance, because my front-end and backend code now look the same, I get a feeling that both are running in the same runtime space and thats far from the truth of course. (Front-end = JS VM and Backend = Java VM)

13:45 Saturnation: silly question, but how can I recursively create a list without including the nil as the last item added? Used to nil in Lisp not showing up in the list...

13:46 triyo: edge case that checks on nil

13:47 Saturnation: triyo, not sure what you mean?

13:48 raek: Saturnation: (1 2 3 nil) and (1 2 3 . nil) are not the same thing[using classical lisp syntax here, not clojure]

13:48 Blackfoot: Saturnation: your base case should be the empty list, ()

13:49 Saturnation: Blackfoot, Ah, that's what I'm looking for, thanks

13:49 * Saturnation trying to get used to feeling like an idiot... :)

13:49 Saturnation: nil is not () :)

13:50 triyo: oops I meant *base-case*

13:50 *blush*

13:50 Blackfoot: we're all learning from each other :)

13:50 Saturnation: actually, the escape from the loop is () not nil

13:51 * Saturnation wonders how much Clojure today is like Java in '96

13:51 dnolen: ,(empty? ())

13:51 clojurebot: true

13:51 dnolen: Saturnation: ?

13:51 Saturnation: the culture and learning

13:52 not the semantics :)

13:53 triyo: We just have to insure it never becomes main stream and it will be the best language ever ;)

13:55 Saturnation: recur keeps slapping me about

13:56 triyo: why? UnsupportedOperationException? :)

13:56 Saturnation: shame it never praises me when I finally get the tail position correct

13:56 triyo: Hehe thought you'd say that

13:57 Saturnation: yells ever time I get it wrong, but no thanks for getting it right.

13:58 triyo: hehe, when you get it right, then you have to worry about the base case else you'll drive you're vm to a grinding halt. :)

13:58 Saturnation: I'm pretty good about the base case, hence the questions about nil and () :)

14:02 triyo: Anyone know if ClojureScript supports try/catch at the moment?

14:03 I see "try" form is identical to clojure "try" however what about catch.

14:03 One can't catch Exception of course

14:08 ejackson: triyo - yeah, easy to forget its in a different VM

14:09 dnolen: triyo: catch Error I would htink.

14:09 triyo: dnolen: I'll try that, thanks

14:15 ejackson: yup, however, I think this requires nothing more than an initial conscious thought as to which space you're working in. Its interesting as this doesn't come in to play in traditional thought: javascript for frontend and clojure for backend.

14:34 Another cljs gotcha for me. I have a configuration clj file that holds the config settings for my web application. So I thought, great, I have a (def DEBUG true), I'll just do a quick :require in my cljs. Fail.

14:35 On that thought, is there a neat way to do this?

14:38 Reason this is useful is, say for instance I have a bunch of ajax calls to public services such as twitter, and google apps. In dev mode, I don't want those calls to be made on each http request. So it would be cool if at the web app level, in my config.clj, I can set my DEBUG to true and have the cljs code automatically switch to using the mock maps as data instead of making real call to those services.

14:43 MasseR: What does the "#'foo" syntax mean?

14:44 mjreed: Ok, really dumb question. Trying to use the string API in 1.2 (JRE 1.6.0). According to the doc at http://clojure.github.com/clojure/clojure.string-api.html, I should do that with "(ns your.namespace.here (:require '[clojure.string :as str]))", but that gives me a "java.lang.Exception: lib names inside prefix lists must not contain periods".

14:45 raek: mjreed: remove the qupte

14:45 *quote

14:45 is the quote there in the docs? if so, it's a typo

14:45 mjreed: yes, it's there in the docs.

14:46 raek: MasseR: it is a short form for (var foo), which is a special form that returns the variable object for the global "foo"

14:46 (the thing whose content changes when you use 'def' or 'binding')

14:46 MasseR: Ah mutable?

14:47 raek: for fixing bugs, yes

14:47 with binding you get a temprarily mutable version, which is local to the thread

14:47 you should never call def at runtime other than when you fix bugs

14:48 mjreed: yup, much better. thought I'd tried it quoteless, but apparently not. Thanks!

14:48 MasseR: So I suppose jetty requires it for some reason. (Still getting used to documentation)

14:49 raek: ah, there you use it to get a layer of indirection

14:49 if you change the web app handler function, you don't need to restart the server

14:50 if you started the server and gave it foo instead of #'foo, you get the current value of foo (a function)

14:50 and when you reevaluate the def form for the handler, ther server won't get the new version

14:50 #'foo solves this problem

14:51 MasseR: Hmm... By intuition, a "deeper" value?

14:51 raek: (also calling a var as a function results in the function that the var points to being called)

14:57 wall: hello

14:58 leonid_: hi

14:58 wall: i need help on drawing primitive circle in clojure using swt library

14:59 can help me?

14:59 leonid_: sorry I'm a novoce

14:59 novice*

15:00 wall: or send link to project what do it

15:00 i'm novice so :)

15:05 Pupeno: At work we have hackdays, when we can work in whatever we want for a day… even contributing to an open source project. I'd like to do something Clojure related, to learn and contribute back… any recommendations?

15:38 imade: hello, can't I use (filter Character/isUpperCase "Hello World") to get \H and \W ?

15:39 lobotomy: try (filter #(Character/isUpperCase %) "Hello World")

15:39 imade: yeah that works

15:39 lobotomy: for some reason static methods don't work directly, don't know details though

15:41 imade: k so I get (\H \W) and one way to conwert it bact to str would be to use (apply str (..chars...)), but is there any more idiomatic way or how you usually do it

15:46 Scriptor: imade: I think apply is the idiomatic way

15:47 imade: the problem with apply is that 4clojure doesn't allow it, I get a privileged exception

15:47 Scriptor: ah, which problem is this?

15:48 imade: http://www.4clojure.com/problem/29

15:48 (apply str #(filter (fn [c] (Character/isUpperCase c)) %))

15:49 oh might be my bad

15:49 yup

15:49 works now

15:49 #(apply ...)

15:50 didn't notice it until pasted here

15:51 grant__: so when i'm using clojure with slime/swank, making a gui like thing, i can't get the REPL to work unless i wrap the entire program in a (future), but i can't get error output unless i DONT wrap it in a future.

15:51 i want the best of both worlds - is that possible?

15:52 imade: are you using windows? I remember there was something similar with windows, repl, and swin

15:52 grant__: nah, im on ubuntu :/

15:54 imade: yeah I have only written little bit swing gui with clojure and repl so that every time I change smth I relaunch it, but probably that's not how you want to do it

15:54 grant__: nope :)

15:54 the future is an almost perfect solution, but it's kinda aggravating to have silent errors

15:54 imade: maybe a simple logger file?

15:55 grant__: how would i go about getting the error logs?

15:56 imade: I think simple logging solution like log4j would produce nice stack traces also

15:56 grant__: i mean, when i do future, the errors seem to completely disappear

15:56 i have no idea where they go

16:00 oh, i figured it out! i dont need a future after all

16:00 imade: actually, I haven't tried it myself, but there's this thing called SwingUtilities.invokeLater when developing with repl

16:00 oh, so how you gonna do_

16:01 stuart sierra has many blog posts about swing and clojure

16:55 manutter: Hey all, I'm having a problem with agents

16:55 https://gist.github.com/1117190

16:55 Basically, it looks like neither "send" nor "send-off" ever actually does anything.

16:56 Am I missing a step somewhere?

16:58 Blackfoot: manutter: are you using any other agents?

16:58 manutter: No, started a fresh repl and did the bare-bones stuff in the gist

16:58 gfrlog: when I do that in my repl it is 200 immediately

16:58 manutter: have you checked your repl for demons?

16:58 manutter: Ok, I've got something hosed locally then.

16:58 gfrlog: ghosts?

16:58 Blackfoot: yea, same here. perhaps tere's a problem starting the agent thread pool

16:59 hiredman: you need to upgrade lein and swank-clojure

16:59 manutter: Yeah, it's weird, I'm not getting errors or anything, it's just not happening

16:59 hiredman: hmm, I think I did that recently, let me try again

17:10 Ok, still kinda weird: did lein upgrade, did lein plugin install swank-clojure "1.3.1", did lein new agent-test, ran emacs, did clojure-jack-in,

17:10 result is "agents don't work"

17:10 lein repl gives me agents that do work.

17:10 hiredman: you need 1.3.2

17:11 manutter: Ah, there's been an upgrade to that too? Cool, let me try that

17:11 Do I need to uninstall 1.3.1?

17:11 hiredman: yes

17:11 manutter: thanks for the info

17:12 Oh, lookee lookee, I seem to have swank-clojure-1.4.0-SNAPSHOT.jar in there too.

17:13 hiredman: if it is a recent snapshot then that is fine

17:13 manutter: Ok, I'll try cleaning it out anyway just to reduce the number of variables.

17:15 I'll be danged, still the same thing

17:16 Is it strange that there's a swank-clojure executable in ~/lein/bin?

17:16 hiredman: does your project pull in an old swank-clojure?

17:16 manutter: It shouldn't, I just made a brand new project just for testing this.

17:18 That swank-clojure executable has a create date of a couple minutes ago, like when I installed the plugin.

17:18 lucca: which versions of slime and what package works? I've tried... a few, and they seem to die with protocol errors mostly

17:19 manutter: well, I gotta go afk, but I'll leave my window open in case anybody has any ideas.

17:51 amalloy: lobotomy: Character/isUpperCase isn't a function, so you can't use it as a function. it's a java method, so you have to wrap it in a function

17:51 lobotomy: how reasonable :)

17:57 Blackfoot: is there a maven package for cljs? ie a lein dependency?

18:07 amalloy: Blackfoot: i think cljs is still in the hunter-gatherer phase

18:10 Blackfoot: looks like it uses clojure 1.3 beta. what's the state of that version with other libraries? on scale of completely broken to mostly working?

18:45 Frozenlock: Greetings gentlemen, is there any java introduction for someone with lisp experience? I've already found http://copperthoughts.com/p/clojurists-guide-to-java/ , unfortunatly it isn't enough for my lack of knowledge. :(

18:48 tauntaun: I can't defrecord, strangely. Is a special require necessary?

18:54 amalloy: tauntaun: no

18:54 but "i can't defrecord" isn't easily debuggable. gist up some code, what you think should happen, and what actually happens

18:56 tauntaun: Here's something from my REPL (and please bear in mind I'm new to Clojure):

18:56 user=> (doc defrecord)

18:56 java.lang.Exception: Unable to resolve var: defrecord in this context (NO_SOURCE_FILE:5)

18:56 leonid_: ,(doc defrecord)

18:56 clojurebot: "([name [& fields] & opts+specs]); Alpha - subject to change (defrecord name [fields*] options* specs*) Currently there are no options. Each spec consists of a protocol or interface name followed by zero or more method bodies: protocol-or-interface-or-Object (methodName [args*] body)* Dynamically generates compiled bytecode for class with the given name, in a package with the same name as the curr...

18:56 tauntaun: That's nice.

18:57 hiredman: tauntaun: what version of clojure?

18:57 tauntaun: Now, am I forgetting to require a namespace? Include a classpath?

18:57 amalloy: tauntaun: did you install clojure through your system package manager or something? 1.1 doesn't have defrecord

18:57 leonid_: !help clojurebot

18:57 raek: tauntaun: sounds like you are running a version of clojure 1.1 or older

18:57 leonid_: !help

18:57 would like to read a manual for the bot

18:57 hiredman: ~help

18:57 clojurebot: http://www.khanacademy.org/

18:58 tauntaun: Yikes, 1.0.0.

18:58 Yes, it was through aptitude.

18:58 amalloy: murder it

18:58 raek: tauntaun: specify [org.clojure/clojure 1.2.1] in your project.clj

18:59 amalloy: raek: i doubt he's using lein yet

18:59 raek: eh, "1.2.1" instead of 1.2.1

18:59 amalloy: yeah, I'm waiting for the "where is that file" question :-)

18:59 ~lein

18:59 clojurebot: lein is http://github.com/technomancy/leiningen

19:00 * tauntaun didn't imagine that Ubuntu's package would be so old.

19:00 raek: tauntaun: use Leiningen or Cake

19:00 amalloy: $google technomancy package leiningen debian

19:00 lazybot: [technomancy/leiningen - GitHub] https://github.com/technomancy/leiningen

19:00 amalloy: feh

19:00 he wrote a thing recently about how package managers are great for users but not really for developers

19:01 technomancy: fwiw the next ubuntu will have 1.2.1

19:01 but yeah, still really not much fun

19:01 hiredman: which will be outdated

19:02 technomancy: hiredman: you really think clojure 1.3 will be released before the next ubuntu?

19:02 hiredman: when is the next ubuntu?

19:02 amalloy: october, right?

19:03 hiredman: 1.3 has been in "beta" for at least a month now, yes?

19:23 ibdknox_: any thoughts on how we should setup managing clojurescript dependencies?

19:23 a plugin to lein maybe?

21:00 scottj: anyone have a really short solution to http://www.4clojure.com/problem/53 ? my solution was one of the longer ones and I'm curious to see how this could be done better

21:27 sritchie: amalloy, I'm on chrome, and for some reason can't enter spaces on any of the 4clojure problems

21:27 any idea what's going on?

21:28 amalloy: sritchie: maybe ace (the code-editor box javascipr library we use) is incompatible with your version of something?

21:29 sritchie: probably that's it, I'm on 14.0.835.8 on the dev channel

21:30 amalloy: sritchie: we use a plain <input> box if you have javascript disabled, but i don't think we have a way for you to say "use <input> anyway"

21:34 ibdknox_: scottj: my naive first attempt https://gist.github.com/1117436

21:37 scottj: ibdknox_: yeah that's what I did with style diffs, if you submitted yours what score did it get?

21:37 leonid_: i hope 4clojure has some sort of cheat-proof system

21:39 ibdknox_: how does one see your score?

21:39 leonid_: for example, I hold the shortest solution for Last Element ( http://4clojure.com/problem/19 ) with rand-nth

21:39 scottj: leonid_: ha, how many times did you submit that?

21:39 leonid_: a lot of itmes

21:40 ibdknox_: scottj: 290

21:40 leonid_: who is in charge of main 4clojure dev?

21:40 i can suggest something

21:40 amalloy: haha rand-nth. i love that function

21:41 scottj: ibdknox_: mine's 331, see the graph how there's one at 50, some at 100,150

21:41 ibdknox_: hm

21:42 there must be some magical function that does most of the work for you

21:42 amalloy: probably not

21:42 someone just submitted {[7 6 5 4] [] ...} as their solution

21:43 hiredman: thats what you get for showing the tests

21:43 leonid_: amalloy: could you filter rand-related functions?

21:43 amalloy: hiredman: indeed. but if we don't show the tests, we get hella confused complaints from lots of users

21:43 hiredman: do the tests actually check if the first sequence of N is returned

21:43 amalloy: so we decided to show them all. if people want to "cheat", they're only cheating themselves

21:43 clojurebot: max people is 317

21:44 leonid_: amalloy: my opinion is a little different. a good problem is where cheat solutions are non-optimum

21:44 suboptimal*

21:45 amalloy: leonid_: feel free to write four times as many test cases for each problem

21:45 technomancy: unless cheating is considered a hack in and of itself

21:45 leonid_: also, problems like this should be revised: http://4clojure.com/problem/86

21:45 hiredman: amalloy: have you seen https://github.com/clojure/test.generative ?

21:45 leonid_: instead of actually calculating happy numbers, one can just write < 4

21:46 amalloy: hiredman: i haven't. something like haskell's lazytest?

21:46 er

21:46 whatever it's called

21:46 i don't actually use any haskell but they have this cool thing

21:46 hiredman: right

21:46 technomancy: quickcheck?

21:46 hiredman: so maybe some combination of "pass shown tests + pass generated tests"

21:46 amalloy: leonid_: writing page upon page of test code is boring, and we're not here to give out grades; we're here to help people learn clojure

21:46 Hodapp: Sometimes, people who cheat aren't only cheating themselves; that's just something they like to tell third graders

21:47 Then again, I'm in the US, where we ostensibly value honesty but often idolize dishonesty...

21:48 hiredman: Hodapp: how so?

21:48 Hodapp: hiredman: How so to which?

21:49 hiredman: Hodapp: pick

21:50 leonid_: amalloy: it never hurts to keep the system cheat-proof.. I would help after I'm more experienced with clojure

21:51 amalloy: great. we certainly accept patches

21:51 Hodapp: hiredman: Examine the news and look at the shining praise that is lumped upon companies, businessmen, and sometimes politicians who have been substantially less than honest and fair in their conduct.

21:52 leonid_: filtering rand functions, having a form of test cases like (= (map ___ [<a list of inputs>]) [<a list of expected outputs>]) would discourage cheating also

21:52 Hodapp: hiredman: They'll crucify the same sometimes, but just as often they'll paint them as heroes of capitalism and self-reliance.

21:53 hiredman: Hodapp: as you are discussing america, lets put this on an american footing and saying the burden of proof rests on the prosecution, so please point out specific examples

21:53 say

21:54 Hodapp: hiredman: Prosecution is irrelevant. Law does not define honesty and fairness.

21:55 scottj: I think it's most common that they're praised despite being dishonest, not because of their dishonesty. so not sure the dishonesty is being idolized.

21:56 hiredman: Hodapp: please forgive me, I did not mean to imply this is a court of law, just suggesting that if you make accusations that you should be able to cite evidence instead of wave your hands at someone and say "go read the news"

21:56 Hodapp: scottj: I was speaking a little figuratively there. I didn't mean it was the dishonesty itself, but rather the person in possession of it.

21:56 scottj: (my response may be a distinction without a difference)

21:56 Hodapp: scottj: It was plenty relevant.

21:57 leonid_: amalloy: just curious, if test cases of a problem are revised, what happens if one's code that used to work before no longer does?

21:59 amalloy: leonid_: you still have credit, but if you submit again the tests fail. just like if you submit something right and then something wrong

21:59 so there are a few people whose "recorded" solutions fail

21:59 technomancy: if you think idolizing dishonest politicians is an American thing, you probably haven't seen much of the rest of the world.

22:01 leonid_: amalloy: that doesn't seem right, but I can see how fixing that is difficult

22:01 scottj: Hodapp: Zuckerberg is the first example that comes to my mind, but it's not clear to me that his reception in America is different than elsewhere, or that he's not disdained commensurate to his original sin.

22:02 leonid_: amalloy: to be clear, I'm not try to diss 4clojure or anything.. just throwing some ideas that might help

22:02 trying*

22:02 Hodapp: technomancy: I wasn't implying that it wasn't elsewhere, just that it is here.

22:02 scottj: Hodapp: if you think this has changed over time I'd be curious if you have a hypothesis why

22:03 Hodapp: scottj: That'd require a deeper examination of journalism over time than I care to take the time to do.

22:03 I'd rather drink beer and learn Clojure.

22:07 amalloy: i'm really not interested in writing strict anti-"cheating" code for 4clojure. if a magic fairy (thanks, hiredman) gave us a patch that made "lame" solutions never pass the tests and didn't confuse people trying to learn, i'd accept it. but i'm not going to write it myself, and i'd rather my magic fairies spent their time adding some cool new feature that makes users enjoy it more or learn more

22:07 scottj: I rarely find a person who holds a kantian position on honesty, so to me it's no surprise that people are praised despite being dishonest.

22:08 hiredman: I really should read emails outloud before I send them

22:08 Hodapp: scottj: It's not so much praise despite being dishonest that I'm talking about, but having achieved some status with the help of dishonesty.

22:09 technomancy: clojurebot: who's the magic fairy?

22:09 clojurebot: Gabh mo leithscéal?

22:09 * Hodapp looks at clojurebot

22:09 amalloy: he only speaks fae

22:11 Scriptor: the language of leprechauns

22:14 leonid_: alright just got a legit solution for Last Element with 9 letters

22:17 aamar: 9! I'm still at 20.

22:19 amalloy: 9 is pretty incredible

22:19 Scriptor: are we counting whitespace?

22:19 leonid_: no, only non-whitespaces

22:20 aamar: then I'm at 14. Hm...

22:28 leonid_: now at 8

22:30 jdoliner: hi, could anyone help me with an installation problem I'm having?

22:31 Scriptor: hmm, shortest I'm getting is 13

22:31 jdoliner: ask, don't ask to ask :)

22:33 jdoliner: I'm getting the following error: https://gist.github.com/1117481

22:33 on ubuntu 11.04

22:33 with clojure 1.2

22:33 hiredman: what jdk?

22:33 jdoliner: I've found some other people with the same problem online

22:34 hiredman: what jdk?

22:34 jdoliner: gcj-4.4

22:35 hiredman: thats not java

22:35 install a real java and try again

22:35 jdoliner: is sun-java6-jdk a real one?

22:35 hiredman: yes

22:36 jdoliner: k

22:36 hiredman: mostly anything besides gcj is real

22:36 gcj is (well intentioned) junk

22:36 jdoliner: I see

22:39 technomancy: it sounds like gcj might be dropped for non-mips arches

22:40 hiredman: and mips may be better served with something like jamvm and jikes

22:43 huh, I didn't know clojure had a printf

22:44 jdoliner: hiredman: thanks that fixed it

22:44 amalloy: hiredman: it inherited the one that java got in 1.5

22:45 hiredman: amalloy: no, it's (print (apply format ...))

22:47 amalloy: hiredman: well, yes, but format just shells out to String/format, which was added in 1.5

22:48 hiredman: amalloy: I have been aware of format for a long time, I didn't realize that was a fn that did printing and formating in one

22:49 amalloy: fair enough. i'm not sure what point i was trying to make anyway

23:02 jlf: hmm, dabbrev-expand (M-/) is broken when trying to complete a symbol that begins at the start of a line at the repl. is that a known issue? e.g. doing (def foo 123) and M-/ at user> fo results in `dabbrev-expand: No dynamic expansion for `user> fo' found'

23:09 scottj: jlf: hippie-expand works for me

23:15 jlf: yeah, here too. i'm guessing there's a missing word boundary text property or somesuch that is confusing dabbrev-expand.

23:34 phenom_: any idea why defrecords don't have to impement all functions if implenting a protocol?

23:37 leonid_: ,(take 5 (range))

23:37 clojurebot: (0 1 2 3 4)

Logging service provided by n01se.net