#clojure logs

2011-07-31

00:36jhicknergetting 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")
00:37grant__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? :)
00:37jhickneranyone else running into this? my source cljs file is utf-8 encoded
00:38ohpauleezjhickner: 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
00:38jhicknerok will do
00:38jhicknerthanks
00:38ohpauleeznp
00:39Blackfootjhickner: you need to make sure your charset is utf8
00:40jhicknermy source file is utf-8. is there something else I need to do during compilation?
00:40clojurebotamespaces 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
00:40Blackfootin the html <meta content=”charset=utf-8″ />
00:41luccathose are not normal quotes.
00:42grant__actually, i'm using swank-clojure
00:42jhicknerno change when including that in my html (with fixed quotes)
00:43jhicknerthe actual generated .js file has non-utf8 characters in it, even though my source file is utf-8
00:43Blackfoothrm, you may also want to try setting the encoding in your browser
00:44Blackfooteg in chrome: wrench->tools->encoding->Unicode
00:45ohpauleezBlackfoot: I think it's the output of the compiler that has non-utf8 characters in it, which shouldn't be happening
00:45Blackfootjust to be sure: the symptom i was seeing was (keyword? :keyword) returning false.
00:45Blackfootohpauleez: ahh, yea, that sounds like it may be different
00:45jhicknerwrench -> tools -> encoding reads UTF-8
00:48Blackfootjhickner: can you look at the string representing the keyword in chrome's inspector? is the first character correct?
00:49jhicknerin chrome's inspector, it looks like this: "﷐'container"
00:49jhicknerthat's the output of (name :container)
00:51BlackfootOK, so that looks like an incorrect encoding. when you open the generated JS in an editor, is the first character correct?
00:51jhicknerno, it's incorrect there too
00:52Blackfoothuh, that is odd. can you pastbin the code somewhere? i can try compiling it here
00:53jhicknerok sure
00:57jhicknerok, here's a gist with a short sample and the resulting compiled js: https://gist.github.com/1116419
01:00Blackfootok, i can reproduce without charset
01:02ohpauleezjhickner: yeah, hit the mailing list and I'd even make the bug report since this is surprising behavior, I'm sure other peopl
01:02ohpauleezpeople will hit it as well
01:02jhicknerok
01:03Blackfootand it is fixed with the meta
01:03Blackfootis this in your HTML file: <head> <meta charset="utf-8"> </head>
01:05jhickneryou're right, that fixes it. I had tried it with <meta content="charset=utf-8"> before
01:06Blackfootshoot, sorry about that. i pasted in someone else's "fix"
01:07ohpauleezRight, but the compiler still should be preventing that
01:08ohpauleezthat was my point
01:10Blackfootohpauleez: 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
01:11ohpauleezI think it's safe that the compiler should always generate utf-8, being that it's the default across most web systems
01:11ohpauleezand most web frameworks generate, handle, and expect utf-8
01:12BlackfootI think that is what it's doing now. browsers are reading it as iso-8859-1 by default
01:13ohpauleezhmm, that is weird
01:13Blackfootin jhickner's gist, the character is correct
01:14jhicknerif it was correct, wouldn't it display correctly in an editor set for utf-8?
01:14ohpauleezBlackfoot: That's totally insane, thanks for telling me about that
01:15Blackfootjhickner: it should
01:16Blackfootjhickner: the character in question is Hex fdd0, so i'm not sure if there's a canonical way to display it
01:17Blackfootin 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
01:19jhicknerhmm, interesting. so it might be intentional then?
01:20Blackfootthe use of that character is intentional. the interaction with browsers with the wrong encoding is probably not
02:35tnksanyone around?
02:35tnksI'm in Java, but need fast(ish) persistent data structures.
02:36tnksThere's only a handful of Java libraries with persistent collections.
02:37tnksSo I started playing around with calling Clojure directly from Java.
02:37tnkswhich was easy to do with the HashMap.
02:37tnksbut I was curious how to call PersistentTreeMap.
02:37tnksI couldn't figure out the right idiom.
02:37tnkskept getting a null-pointer exception.
02:38Blackfootsorry, haven't trying calling in that direction
02:38tnksyeah, it's not the common use case, I'm sure.
02:38tnkscalling Scala from Java sucks hard-core.
02:39tnksI'm not sure how to get at Scala objects.
02:39tnksand method names have awful names for symbols.
02:39tnksI think Clojure is probably easier to call. . . but more casting.
02:40tnksJust calling PersistentTreeMap.EMPTY throws the exception for me.
02:40tnkswhich strikes me as odd.
02:40BlackfootI'd try to find examples in the clojure source code
03:36rado_hello, is there a clojure REPL that supports bash like shortcuts
03:36hiredman"bash like shortcuts"?
03:36rado_like up arrow
03:36rado_for history
03:36hiredman~google rlwrap
03:36clojurebotFirst, out of 6900 results is:
03:36rado_Ctrl+a for beginning of line
03:36clojurebotRlwrap - utopia.ision.nl
03:37clojurebothttp://utopia.knoware.nl/~hlub/rlwrap/
03:37ohwow_I thought jline supported that?
03:37hiredmanjline, depending on what version you use, has unicode issues
03:38ohwow_oh
03:38rado_ahaha
03:38rado_i have to run though another program
03:38rado_been spoiled by python and ruby repls
03:41rado_rlwrap works, thanks!
04:16ohwow|Hello
04:29_leonidhello
07:06Vinzentcan anybody give me an advice on developing desktop apps on clojurescript?
07:50lobotomyso, is it possible to get utf-8 working with the emacs-slime-swank-clojure combo somehow?
07:51lobotomyin 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"
07:51VinzentI have slime-net-coding-system (or something similar) setted to utf-8
07:51lobotomyi have that too, doesn't help
07:51lobotomycould it be on the swank side? not sure where to start debugging this
07:52Vinzenthm, there were something in swank, but i thought iy was fixed...
07:52lobotomyusing cake and hmm
07:52lobotomynot sure how "cake swank" sets things up... does it need a utf8 setting or something
07:53Vinzentslime-net-coding-system 'utf-8-unix and [swank-clojure "1.3.2"] all works: user> "привет" => "привет"
07:53Vinzentso it's a candidate for cake's issue list, i think
07:56hiredmanVinzent: you need to set the jvm to use utf8 as well, not sure if the latest swank-clojure defaults to utf8 or not
07:56lobotomyused slime earlier, it didn't work then either
07:57lobotomywhich would point to the jvm yeah
07:57hiredman~google jvm default encoding
07:57clojurebotFirst, out of 37500 results is:
07:57clojurebotutf 8 - Setting the default Java character encoding? - Stack Overflow
07:57clojurebothttp://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding
07:59lobotomyhmm, in ~/.cake/project.clj i have :jvm-opts ["-Dfile.encoding=utf8"] but that doesn't help
08:00lobotomychanged that to UTF8 but that didn't help either :)
08:01VinzentUTF-8, no?
08:01hiredmanhttps://gist.github.com/1070768
08:01lobotomyhmm... ps aux|grep -i cake reports that the cake thing doesn't include the -Dfile.encoding on the command line
08:02hiredman(what I have in emacs for utf8)
08:02hiredmanlobotomy: cake runs a persistent jvm, you'll need to restart it to run it with new flags
08:02lobotomyyeah, i have
08:03hiredmanI recommed leiningen
08:03lobotomythe x-select-request-type doesn't help either
08:03lobotomythe other stuff i already had in .emacs
08:04lobotomylooking like it's cake's fault, it doesn't seem to give that file.encoding= option to the jvm
08:04lobotomy(also i'm on os x, not sure which things that breaks...)
08:05hiredmandunno, I use lein on osx and everything is fine
08:05hiredmanis there a reason you are using cake?
08:05lobotomyapparently it's better than lein :)
08:05hiredmanah
08:05hiredmanno
08:06lobotomyi used lein for a while a year ago, it worked fine, except it also had this exact same problem
08:06hiredmanlein is clearly superior to cake
08:06hiredman~cake
08:06clojurebotcake is http://hackage.haskell.org/package/cake-0.0.1
08:06hiredman~lein
08:06clojurebotlein is http://github.com/technomancy/leiningen
08:07ohwow_cake has no docs ?
08:07lobotomycan you elaborate? i read that cake has that persistent jvm thing, which lein doesn't
08:07hiredmanlobotomy: the persistent jvm is an anti-feature
08:08VinzentI've heard main cake feature is ability to write tasks easily
08:08hiredmanah, yet another anti-feature of cake is the task macro
08:08Vinzentwhy?
08:08clojurebotwhy not?
08:09hiredmanwhere lein's tasks are just clojure functions, cake tasks are not
08:09lobotomywhy is the persistent jvm an anti-feature?
08:09hiredmanlobotomy: because if you are running slime, how often do you start a new jvm?
08:10lobotomydunno, haven't gotten that far yet ;)
08:10hiredmanbasically it makes things more complex without solving anything
08:10hiredmanVinzent: how many tasks have you written?
08:10Vinzenthiredman, I'm using lein :)
08:10hiredmangood
08:11Vinzentbut persistent jvm was handful for running 'cake test' etc
08:12hiredman*shrug*
08:12hiredmanlein does have an interactive mode if you want to run tasks like that
08:14Vinzentnow it does; but cake was here for a long time
08:14hiredmana long time?
08:16Vinzentyeah (before lein interactive was written)
08:24lobotomyooh, i installed leiningen instead, and with that it works
08:25lobotomyleiningen seems to obey the :jvm-opts ["-Dfile.encoding=UTF8"] in the project.clj
08:25lobotomyit adds that to the command line and afaict that makes the difference
08:26lobotomynow, how to do a bug report for cake... :)
08:42lobotomyheh, #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:37foodooThere'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:39Scriptorfoodoo: conj, but only for vectors
10:40Scriptorconj's behavior is dependent on the datastructure it's used for
10:40Scriptor,(doc conj)
10:40clojurebot"([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:41foodooI see. (conj) behaves exactly like (cons) for lists. For vectors it has the desired behaviour
10:42Scriptoryep
10:42Scriptorit's because lists aren't well-suited for adding to the end, it's O(n) time
10:43pdkconj always adds at the point where it's most efficient
10:43foodooBut adding to the front is O(1) I suppose?
10:43pdkfor lists/vectors this means it adds to opposite ends
10:43pdkpretty much yeah
10:43pdkvisualize it as being a singly linked list
10:44pdk(doc append)
10:44clojurebotCool story bro.
10:44pdknaturally
10:44foodoo(doc append) gives me an unresolved var. Do I need a specific package for this?
10:44pdkcould try concat instead
10:44clojurebotCool story bro.
10:45pdk,(concat '(1 2 3) '(4 5 6) [7 8 9])
10:45clojurebot(1 2 3 4 5 ...)
10:45pdk,(concat '(1 2 3) '(4 5 6))
10:45clojurebot(1 2 3 4 5 ...)
10:45pdkthis is a bot of few words
10:45ohwow|http://www.4clojure.com/problem/27 could somebody please tell me how to solve this with one-liner?
10:45ohwow|Using nth?
10:45ohwow|I am not sure what's the idiomatic solution
10:46pdki'd try nth and every? with a lambda, let me think
10:46foodooohwow: Something like #(= (reverse %) %) maybe?
10:46pdkor hell like that too
10:46ohwow|foodoo: hm, i see
10:47ohwow|but what if the sequence is really big
10:47pdkit'd be an issue with ram usage
10:47pdkbut iterating over it is gonna be at least O(n) anyway
10:48foodooYou probably can't solve it in one line, if you need to worry about RAM or other technical limitations
10:51foodooBut thanks for showing me that website. I'll probably learn with that instead project euler for a while
10:52ohwow|:)
10:53ohwow|How can I do let-rec in clojure?
11:01ohwow|Oh, nevermind, sorry
11:03foodooBy 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:03ohwow|(apply + mylist)
11:04ohwow|,(apply + '(1 2 3))
11:04clojurebot6
11:05pdkapply, reduce, map etc foodoo
11:06pdkalso inside a ` you can use ~@ to splice in the contents of a list
11:06pdk,`(1 ~@(2 3 4) 5)
11:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:06pdkwelp
11:06pdk,`'(1 ~@(2 3 4) 5)
11:06clojurebot#<ClassCastException java.lang.ClassCastException: java.lang.Long cannot be cast to clojure.lang.IFn>
11:06pdkyeah i'm an expert
11:07ohwow|,`(1 ~@(list 2 3 4) 5)
11:07clojurebot(1 2 3 4 5)
11:07ohwow|:3
11:07pdk~@'(2 3 4) works too
11:07clojurebot@ , {a b c]
11:07pdkk didnt know that would produce output
11:08ChousukeI wonder why it did :P
11:08Chousuke~@
11:08clojurebot@ , {a b c]
11:08Chousukehuh
11:08Chousuke:P
11:08ohwow|~@hello
11:08clojurebotCool story bro.
11:08foodooah, thanks. But don't worry, this notation is so ugly, that I rather resort to reduce/map/etc. when possible ;)
11:08ohwow|foodoo: the notation is rather powerful
11:08ohwow|and apply is good too
11:09pdk` is mostly used within macro definitions so i'd stick with apply etc where you can
11:14ohwow|Is there a way to determine if the data structure could be turned into a sequence?
11:29ohwow|,(str (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq "HeLLo")))
11:29clojurebot"clojure.lang.LazySeq@18c27"
11:29ohwow|How to actually evaluate a sequence?
11:29peteriserins,seq?
11:29clojurebot#<core$seq_QMARK_ clojure.core$seq_QMARK_@18e0f79>
11:30peteriserins,(seq [1 2 3])
11:30clojurebot(1 2 3)
11:30peteriserins,(seq? [1 2 3])
11:30clojurebotfalse
11:31kumarshantanuohwow|: (apply str lazy-seq-here)
11:31ohwow|(apply str (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq "HeLLo")))
11:31ohwow|oops
11:32ohwow|Thanks
11:32ohwow|(fn [st]
11:32ohwow| (apply str
11:32ohwow| (filter (fn [x] (re-matches #"[A-Z]" (str x))) (seq st))))
11:32ohwow|Is this a good solution for this problem: http://www.4clojure.com/problem/29#prob-title ?
12:05kumarshantanuHow can I find out if my send-off work is finished or not?
12:05kumarshantanuI want to poll
12:41foodoohow can I recur in an anonymous function, when I don't have a tail recursion?
12:46Scriptorfoodoo: recur seems to work in anonymous functions fine, what do you mean by you don't have tail recursion?
12:48ohpauleezfoodoo: If you have such unralentless recursion happening in the function, it's probably better to spin it out into a dedicated function
12:50foodooI'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:50Scriptorfoodoo: (fn func-name [args] ...)
12:51foodoooh, thought defn was for named functions and fn was for anonymous functions. Thank you very much :)
12:51Scriptorthat's true, fn is for anonymous functions, but you can add an explicit name to them for convenience's sake
12:52Scriptorwhereas defn actually stores that function in a var
12:53foodooThe 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:53foodooIt couldn't resolve the symbol myInnerfunction
12:54foodoohuray! Problem solved :)
13:09triyoI'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:09triyo?
13:16Blackfoottriyo: the source code is pretty readable, src/cljs/cljs/core.cljs
13:16Blackfootit looks like it compiles into an Atom object
13:18triyoBlackfoot: thanks, it does look pretty straightforward.
13:22triyoToday 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:25triyoOne has to be conscious what clojure-like code runs where as same constructs may mean very different things.
13:25triyoVer interesting
13:25triyo*very
13:31ohpauleeztriyo: but you could send the atom's current value over the wire and set! the atom on the server side, no?
13:34triyoYup 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:37wastrelhi clojureelles
13:41ejacksontriyo: ooh, that's interesting, the atoms are cleared between http calls, makes sense.
13:42triyothats 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:45triyoFor 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:45Saturnationsilly 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:46triyoedge case that checks on nil
13:47Saturnationtriyo, not sure what you mean?
13:48raekSaturnation: (1 2 3 nil) and (1 2 3 . nil) are not the same thing[using classical lisp syntax here, not clojure]
13:48BlackfootSaturnation: your base case should be the empty list, ()
13:49SaturnationBlackfoot, Ah, that's what I'm looking for, thanks
13:49Saturnationnil is not () :)
13:50triyooops I meant *base-case*
13:50triyo*blush*
13:50Blackfootwe're all learning from each other :)
13:50Saturnationactually, the escape from the loop is () not nil
13:51dnolen,(empty? ())
13:51clojurebottrue
13:51dnolenSaturnation: ?
13:51Saturnationthe culture and learning
13:52Saturnationnot the semantics :)
13:53triyoWe just have to insure it never becomes main stream and it will be the best language ever ;)
13:55Saturnationrecur keeps slapping me about
13:56triyowhy? UnsupportedOperationException? :)
13:56Saturnationshame it never praises me when I finally get the tail position correct
13:56triyoHehe thought you'd say that
13:57Saturnationyells ever time I get it wrong, but no thanks for getting it right.
13:58triyohehe, 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:58SaturnationI'm pretty good about the base case, hence the questions about nil and () :)
14:02triyoAnyone know if ClojureScript supports try/catch at the moment?
14:03triyoI see "try" form is identical to clojure "try" however what about catch.
14:03triyoOne can't catch Exception of course
14:08ejacksontriyo - yeah, easy to forget its in a different VM
14:09dnolentriyo: catch Error I would htink.
14:09triyodnolen: I'll try that, thanks
14:15triyoejackson: 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:34triyoAnother 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:35triyoOn that thought, is there a neat way to do this?
14:38triyoReason 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:43MasseRWhat does the "#'foo" syntax mean?
14:44mjreedOk, 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:45raekmjreed: remove the qupte
14:45raek*quote
14:45raekis the quote there in the docs? if so, it's a typo
14:45mjreedyes, it's there in the docs.
14:46raekMasseR: it is a short form for (var foo), which is a special form that returns the variable object for the global "foo"
14:46raek(the thing whose content changes when you use 'def' or 'binding')
14:46MasseRAh mutable?
14:47raekfor fixing bugs, yes
14:47raekwith binding you get a temprarily mutable version, which is local to the thread
14:47raekyou should never call def at runtime other than when you fix bugs
14:48mjreedyup, much better. thought I'd tried it quoteless, but apparently not. Thanks!
14:48MasseRSo I suppose jetty requires it for some reason. (Still getting used to documentation)
14:49raekah, there you use it to get a layer of indirection
14:49raekif you change the web app handler function, you don't need to restart the server
14:50raekif you started the server and gave it foo instead of #'foo, you get the current value of foo (a function)
14:50raekand when you reevaluate the def form for the handler, ther server won't get the new version
14:50raek#'foo solves this problem
14:51MasseRHmm... By intuition, a "deeper" value?
14:51raek(also calling a var as a function results in the function that the var points to being called)
14:57wallhello
14:58leonid_hi
14:58walli need help on drawing primitive circle in clojure using swt library
14:59wallcan help me?
14:59leonid_sorry I'm a novoce
14:59leonid_novice*
15:00wallor send link to project what do it
15:00walli'm novice so :)
15:05PupenoAt 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:38imadehello, can't I use (filter Character/isUpperCase "Hello World") to get \H and \W ?
15:39lobotomytry (filter #(Character/isUpperCase %) "Hello World")
15:39imadeyeah that works
15:39lobotomyfor some reason static methods don't work directly, don't know details though
15:41imadek 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:46Scriptorimade: I think apply is the idiomatic way
15:47imadethe problem with apply is that 4clojure doesn't allow it, I get a privileged exception
15:47Scriptorah, which problem is this?
15:48imadehttp://www.4clojure.com/problem/29
15:48imade(apply str #(filter (fn [c] (Character/isUpperCase c)) %))
15:49imadeoh might be my bad
15:49imadeyup
15:49imadeworks now
15:49imade#(apply ...)
15:50imadedidn't notice it until pasted here
15:51grant__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:51grant__i want the best of both worlds - is that possible?
15:52imadeare you using windows? I remember there was something similar with windows, repl, and swin
15:52grant__nah, im on ubuntu :/
15:54imadeyeah 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:54grant__nope :)
15:54grant__the future is an almost perfect solution, but it's kinda aggravating to have silent errors
15:54imademaybe a simple logger file?
15:55grant__how would i go about getting the error logs?
15:56imadeI think simple logging solution like log4j would produce nice stack traces also
15:56grant__i mean, when i do future, the errors seem to completely disappear
15:56grant__i have no idea where they go
16:00grant__oh, i figured it out! i dont need a future after all
16:00imadeactually, I haven't tried it myself, but there's this thing called SwingUtilities.invokeLater when developing with repl
16:00imadeoh, so how you gonna do_
16:01imadestuart sierra has many blog posts about swing and clojure
16:55manutterHey all, I'm having a problem with agents
16:55manutterhttps://gist.github.com/1117190
16:55manutterBasically, it looks like neither "send" nor "send-off" ever actually does anything.
16:56manutterAm I missing a step somewhere?
16:58Blackfootmanutter: are you using any other agents?
16:58manutterNo, started a fresh repl and did the bare-bones stuff in the gist
16:58gfrlogwhen I do that in my repl it is 200 immediately
16:58gfrlogmanutter: have you checked your repl for demons?
16:58manutterOk, I've got something hosed locally then.
16:58gfrlogghosts?
16:58Blackfootyea, same here. perhaps tere's a problem starting the agent thread pool
16:59hiredmanyou need to upgrade lein and swank-clojure
16:59manutterYeah, it's weird, I'm not getting errors or anything, it's just not happening
16:59manutterhiredman: hmm, I think I did that recently, let me try again
17:10manutterOk, 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:10manutterresult is "agents don't work"
17:10manutterlein repl gives me agents that do work.
17:10hiredmanyou need 1.3.2
17:11manutterAh, there's been an upgrade to that too? Cool, let me try that
17:11manutterDo I need to uninstall 1.3.1?
17:11hiredmanyes
17:11manutterthanks for the info
17:12manutterOh, lookee lookee, I seem to have swank-clojure-1.4.0-SNAPSHOT.jar in there too.
17:13hiredmanif it is a recent snapshot then that is fine
17:13manutterOk, I'll try cleaning it out anyway just to reduce the number of variables.
17:15manutterI'll be danged, still the same thing
17:16manutterIs it strange that there's a swank-clojure executable in ~/lein/bin?
17:16hiredmandoes your project pull in an old swank-clojure?
17:16manutterIt shouldn't, I just made a brand new project just for testing this.
17:18manutterThat swank-clojure executable has a create date of a couple minutes ago, like when I installed the plugin.
17:18luccawhich versions of slime and what package works? I've tried... a few, and they seem to die with protocol errors mostly
17:19manutterwell, I gotta go afk, but I'll leave my window open in case anybody has any ideas.
17:51amalloylobotomy: 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:51lobotomyhow reasonable :)
17:57Blackfootis there a maven package for cljs? ie a lein dependency?
18:07amalloyBlackfoot: i think cljs is still in the hunter-gatherer phase
18:10Blackfootlooks 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:45FrozenlockGreetings 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:48tauntaunI can't defrecord, strangely. Is a special require necessary?
18:54amalloytauntaun: no
18:54amalloybut "i can't defrecord" isn't easily debuggable. gist up some code, what you think should happen, and what actually happens
18:56tauntaunHere's something from my REPL (and please bear in mind I'm new to Clojure):
18:56tauntaunuser=> (doc defrecord)
18:56tauntaunjava.lang.Exception: Unable to resolve var: defrecord in this context (NO_SOURCE_FILE:5)
18:56leonid_,(doc defrecord)
18:56clojurebot"([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:56tauntaunThat's nice.
18:57hiredmantauntaun: what version of clojure?
18:57tauntaunNow, am I forgetting to require a namespace? Include a classpath?
18:57amalloytauntaun: did you install clojure through your system package manager or something? 1.1 doesn't have defrecord
18:57leonid_!help clojurebot
18:57raektauntaun: sounds like you are running a version of clojure 1.1 or older
18:57leonid_!help
18:57leonid_would like to read a manual for the bot
18:57hiredman~help
18:57clojurebothttp://www.khanacademy.org/
18:58tauntaunYikes, 1.0.0.
18:58tauntaunYes, it was through aptitude.
18:58amalloymurder it
18:58raektauntaun: specify [org.clojure/clojure 1.2.1] in your project.clj
18:59amalloyraek: i doubt he's using lein yet
18:59raekeh, "1.2.1" instead of 1.2.1
18:59raekamalloy: yeah, I'm waiting for the "where is that file" question :-)
18:59raek~lein
18:59clojurebotlein is http://github.com/technomancy/leiningen
19:00raektauntaun: use Leiningen or Cake
19:00amalloy$google technomancy package leiningen debian
19:00lazybot[technomancy/leiningen - GitHub] https://github.com/technomancy/leiningen
19:00amalloyfeh
19:00amalloyhe wrote a thing recently about how package managers are great for users but not really for developers
19:01technomancyfwiw the next ubuntu will have 1.2.1
19:01technomancybut yeah, still really not much fun
19:01hiredmanwhich will be outdated
19:02technomancyhiredman: you really think clojure 1.3 will be released before the next ubuntu?
19:02hiredmanwhen is the next ubuntu?
19:02amalloyoctober, right?
19:03hiredman1.3 has been in "beta" for at least a month now, yes?
19:23ibdknox_any thoughts on how we should setup managing clojurescript dependencies?
19:23ibdknox_a plugin to lein maybe?
21:00scottjanyone 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:27sritchieamalloy, I'm on chrome, and for some reason can't enter spaces on any of the 4clojure problems
21:27sritchieany idea what's going on?
21:28amalloysritchie: maybe ace (the code-editor box javascipr library we use) is incompatible with your version of something?
21:29sritchieprobably that's it, I'm on 14.0.835.8 on the dev channel
21:30amalloysritchie: 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:34ibdknox_scottj: my naive first attempt https://gist.github.com/1117436
21:37scottjibdknox_: yeah that's what I did with style diffs, if you submitted yours what score did it get?
21:37leonid_i hope 4clojure has some sort of cheat-proof system
21:39ibdknox_how does one see your score?
21:39leonid_for example, I hold the shortest solution for Last Element ( http://4clojure.com/problem/19 ) with rand-nth
21:39scottjleonid_: ha, how many times did you submit that?
21:39leonid_a lot of itmes
21:40ibdknox_scottj: 290
21:40leonid_who is in charge of main 4clojure dev?
21:40leonid_i can suggest something
21:40amalloyhaha rand-nth. i love that function
21:41scottjibdknox_: mine's 331, see the graph how there's one at 50, some at 100,150
21:41ibdknox_hm
21:42ibdknox_there must be some magical function that does most of the work for you
21:42amalloyprobably not
21:42amalloysomeone just submitted {[7 6 5 4] [] ...} as their solution
21:43hiredmanthats what you get for showing the tests
21:43leonid_amalloy: could you filter rand-related functions?
21:43amalloyhiredman: indeed. but if we don't show the tests, we get hella confused complaints from lots of users
21:43hiredmando the tests actually check if the first sequence of N is returned
21:43amalloyso we decided to show them all. if people want to "cheat", they're only cheating themselves
21:43clojurebotmax people is 317
21:44leonid_amalloy: my opinion is a little different. a good problem is where cheat solutions are non-optimum
21:44leonid_suboptimal*
21:45amalloyleonid_: feel free to write four times as many test cases for each problem
21:45technomancyunless cheating is considered a hack in and of itself
21:45leonid_also, problems like this should be revised: http://4clojure.com/problem/86
21:45hiredmanamalloy: have you seen https://github.com/clojure/test.generative ?
21:45leonid_instead of actually calculating happy numbers, one can just write < 4
21:46amalloyhiredman: i haven't. something like haskell's lazytest?
21:46amalloyer
21:46amalloywhatever it's called
21:46amalloyi don't actually use any haskell but they have this cool thing
21:46hiredmanright
21:46technomancyquickcheck?
21:46hiredmanso maybe some combination of "pass shown tests + pass generated tests"
21:46amalloyleonid_: 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:46HodappSometimes, people who cheat aren't only cheating themselves; that's just something they like to tell third graders
21:47HodappThen again, I'm in the US, where we ostensibly value honesty but often idolize dishonesty...
21:48hiredmanHodapp: how so?
21:48Hodapphiredman: How so to which?
21:49hiredmanHodapp: pick
21:50leonid_amalloy: it never hurts to keep the system cheat-proof.. I would help after I'm more experienced with clojure
21:51amalloygreat. we certainly accept patches
21:51Hodapphiredman: 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:52leonid_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:52Hodapphiredman: They'll crucify the same sometimes, but just as often they'll paint them as heroes of capitalism and self-reliance.
21:53hiredmanHodapp: 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:53hiredmansay
21:54Hodapphiredman: Prosecution is irrelevant. Law does not define honesty and fairness.
21:55scottjI 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:56hiredmanHodapp: 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:56Hodappscottj: 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:56scottj(my response may be a distinction without a difference)
21:56Hodappscottj: It was plenty relevant.
21:57leonid_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:59amalloyleonid_: you still have credit, but if you submit again the tests fail. just like if you submit something right and then something wrong
21:59amalloyso there are a few people whose "recorded" solutions fail
21:59technomancyif you think idolizing dishonest politicians is an American thing, you probably haven't seen much of the rest of the world.
22:01leonid_amalloy: that doesn't seem right, but I can see how fixing that is difficult
22:01scottjHodapp: 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:02leonid_amalloy: to be clear, I'm not try to diss 4clojure or anything.. just throwing some ideas that might help
22:02leonid_trying*
22:02Hodapptechnomancy: I wasn't implying that it wasn't elsewhere, just that it is here.
22:02scottjHodapp: if you think this has changed over time I'd be curious if you have a hypothesis why
22:03Hodappscottj: That'd require a deeper examination of journalism over time than I care to take the time to do.
22:03HodappI'd rather drink beer and learn Clojure.
22:07amalloyi'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:07scottjI 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:08hiredmanI really should read emails outloud before I send them
22:08Hodappscottj: 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:09technomancyclojurebot: who's the magic fairy?
22:09clojurebotGabh mo leithscéal?
22:09amalloyhe only speaks fae
22:11Scriptorthe language of leprechauns
22:14leonid_alright just got a legit solution for Last Element with 9 letters
22:17aamar9! I'm still at 20.
22:19amalloy9 is pretty incredible
22:19Scriptorare we counting whitespace?
22:19leonid_no, only non-whitespaces
22:20aamarthen I'm at 14. Hm...
22:28leonid_now at 8
22:30jdolinerhi, could anyone help me with an installation problem I'm having?
22:31Scriptorhmm, shortest I'm getting is 13
22:31Scriptorjdoliner: ask, don't ask to ask :)
22:33jdolinerI'm getting the following error: https://gist.github.com/1117481
22:33jdolineron ubuntu 11.04
22:33jdolinerwith clojure 1.2
22:33hiredmanwhat jdk?
22:33jdolinerI've found some other people with the same problem online
22:34hiredmanwhat jdk?
22:34jdolinergcj-4.4
22:35hiredmanthats not java
22:35hiredmaninstall a real java and try again
22:35jdolineris sun-java6-jdk a real one?
22:35hiredmanyes
22:36jdolinerk
22:36hiredmanmostly anything besides gcj is real
22:36hiredmangcj is (well intentioned) junk
22:36jdolinerI see
22:39technomancyit sounds like gcj might be dropped for non-mips arches
22:40hiredmanand mips may be better served with something like jamvm and jikes
22:43hiredmanhuh, I didn't know clojure had a printf
22:44jdolinerhiredman: thanks that fixed it
22:44amalloyhiredman: it inherited the one that java got in 1.5
22:45hiredmanamalloy: no, it's (print (apply format ...))
22:47amalloyhiredman: well, yes, but format just shells out to String/format, which was added in 1.5
22:48hiredmanamalloy: 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:49amalloyfair enough. i'm not sure what point i was trying to make anyway
23:02jlfhmm, 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:09scottjjlf: hippie-expand works for me
23:15jlfyeah, here too. i'm guessing there's a missing word boundary text property or somesuch that is confusing dabbrev-expand.
23:34phenom_any idea why defrecords don't have to impement all functions if implenting a protocol?
23:37leonid_,(take 5 (range))
23:37clojurebot(0 1 2 3 4)