1:00 chessguy: ,('(fn [x] (x*2)) 4)
1:00 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn
1:00 chessguy: ,((fn [x] (x*2)) 4)
1:00 clojurebot: java.lang.Exception: Unable to resolve symbol: x*2 in this context
1:00 chessguy: ,((fn [x] (* x 2)) 4)
1:00 clojurebot: 8
1:02 hiredman: ...
1:07 chessguy: sorry just playing
1:07 hiredman: don't mind me
1:08 chessguy: quite alright, bedtime for me anyway
2:01 cads: how's this channel's clojurebot secured against some kind of malicious code?
2:01 is it hard to do?
2:02 hiredman: ~sandbox
2:02 clojurebot: sandbox is http://
2:13 msingh: did anyone reply to me before?
2:25 hoeck: msingh: looking at the log, no one answered
2:25 hoeck: and I don't know much about SOAP either
2:29 replaca: msingh: I'll probably be giving the SOAP thing a whirl in a week or two
2:29 it's mostly just wrapping existing java stuff
2:30 msingh: do you have a need for it or just curious
2:46 msingh: replaca: sorry was afk. Yes i have a need for it. Atm im using a python library (like the one i linked to above) but i'd rather work with lisp
2:53 replaca: msingh: do you know java?
2:53 msingh: replaca: Yeah i work with Java at work
2:54 but i dont want to write java at home :P
2:54 replaca: well, yeah, you'll have to wrap some
2:54 so it's good to know it
2:55 msingh: i tried googling for soap and java but got some badly outdated links to books from 2000/2001
2:55 replaca: do you know clojure yet, or just getting on board?
2:55 msingh: just getting on board
2:55 hiredman: I thought everyone is doing rest these days
2:55 msingh: i know common lisp adequately though
2:56 replaca: yeah, I've got one API that we built where soap just work better cause of it's complexity
2:57 so my advice is look at the apache axis library
2:57 and wrap that to do what you want
2:58 I can send you a PDF that shows how to do it in java for our system
2:58 but you'd be on your own to make it work in clojure til I get to it
3:00 msingh: sure please give the link
3:00 replaca: have to be email, not a public link
3:02 it's only a semi-public doc
3:03 msingh: you should have got a pm from me
3:09 got it, let me have a read.
3:09 replaca: cool, hope it helps!
3:09 I'm going to crash now. Goodnight all!
3:10 msingh: thanks! good night :)
4:30 unlink: Is there a shorthand for (let [x 1] (let [y (+ x 1)] y))?
4:30 (or with a 3rd level)
4:39 cgrand1: unlink: (let [x 1 y (+ x 1)] y) ?
4:40 unlink: Oh, it depends on the ordering.
4:41 cgrand1: yup (let [y (+ x 1) x 1] y) won't work
4:41 unlink: yeah
4:41 cgrand1: you can evan write (let [x 1 x (+ x 1)] x)
4:42 unlink: But you can't make recursive calls to x, it seems.
4:43 cgrand: if you want to define recursive fns use let-fn
4:43 unlink: (doc let-fn)
4:43 clojurebot: I don't understand.
4:43 unlink: whoops
4:44 letfn has strange syntax
4:44 cgrand: ,(letfn [(a [x] (inc (b x))) (b [y] (* 2 y))] (a 3))
4:44 clojurebot: 7
4:46 unlink: I always expect the ( to come somewhere after the function name
4:46 cgrand: with let you would have written (letfn [a (fn [x] (inc (b x))) b (fn [y] (* 2 y))] (a 3)) but it would have failed. To convert from let to letfn rewrite each XXX (fn ....) into (XXX ...) that's all
4:47 unlink: I guess if I really want that syntax I can use letfn*
5:00 cgrand: better write you own macro on top of letfn
5:23 AWizzArd: Moin
6:00 Lau_of_DK: Hey boys
6:01 I have a very nicely written Clojure program, which I ant-compiled to a jar, and it runs very beautifully, very functionallly, without any errors, but once its finished and the main loop terminates - the program lingers, it doesnt halt - why?
6:01 Cark: a thread is still running
6:02 i had this problem with a timer
6:04 Lau_of_DK: Yes, it seems one of them lingers - can I force their death ?
6:04 Cark: well if you'd kill it, your program wouldn't be beautyfull anymore
6:04 you should gracefully close it =P
6:05 unlink: pthread_join
6:05 Lau_of_DK: I think I'll kill it
6:05 I can benefit from clojurebots thunk execution
6:10 Since this is a http stress-tester, then no shame in the server bukling
6:10 clojurebot: where are you?
6:12 Cark: ah that looks like cool stuff
6:12 Lau_of_DK: ,(loop  (recur))
6:12 clojurebot: Execution Timed Out
6:12 Lau_of_DK: It sure is
6:17 Man, it works beautifully :)
6:27 Thats hot hiredman :)
6:36 Exception, the .stop Thread method is horribly deprecated
9:21 AWizzArd: is there already a function to calculate the average value of l vector of numbers?
9:44 karl_: "Someone, somewhere" would be my answer. Not in the standard lib as far as I know though.
10:01 Chousuke: might be in contrib
12:52 unlink: user=> \u1d11e
12:52 java.lang.IllegalArgumentException: Invalid unicode character: \u1d11e
12:53 (char 0x1d11e) gives me \ud11e
13:02 dreish: (let [chars (make-array Character/TYPE 2)] (Character/toChars 0x1d11e chars 0) chars)
13:08 G0SUB: any idea how to get M-. to work with Clojure + SLIME?
13:25 dreish: unlink: Even easier would be just "\uD834\uDD1E"
13:26 unlink: I guess I didn't really appreciate that Java doesn't let you put !BMP chars in a "char"
13:26 dreish: Right, char is UTF-16.
13:27 I discovered that some time after getting into Clojure.
13:27 unlink: Well, more importantly it's exactly 2 bytes.
13:28 This is surprising behavior when you're used to Python's unicode handling.
13:29 dreish: Java was one of the first languages to adopt Unicode, before supplementary characters existed.
13:30 unlink: Yes. Well it's not clear if UTF-16 is a strength or limitation. There are tradeoffs no matter which encoding you choose.
13:30 It's clearly a limitation if you have to handle supplementary characters a lot.
13:31 G0SUB: any idea how to get M-. to work with Clojure + SLIME?
13:32 unlink: nth can give you 1/2 a character, and length gives you a surprising number when your string countains supplementary chars.
13:36 dreish: ,(let [s "\uD834\uDD1E"] (.codePointCount s 0 (.length s)))
13:36 clojurebot: 1
13:36 dreish: :-/
13:37 unlink: Is that unexpected?
13:37 dreish: No, just a little inconvenient.
13:38 I don't know why there isn't a no-args version of the method that covers the whole string.
13:39 unlink: >>> len(u'\U0001d11e')
13:40 dreish: Maybe someday Clojure can be improved to make these kinds of things more convenient, but I doubt it'll be a high priority this year.
13:43 unlink: I've never seen a character outside BMP unless I was looking for one.
14:10 Chouser: well, shoot.
14:10 I just wrote a nifty little app for use internally at my company.
14:11 I chose Clojure because, well, I'm a fanboi. But also because I was looking forward to providing a single .jar that would give them not only an app, but a Clojure REPL should they ever realize they need one.
14:12 this is glue stuff -- a very small piece of logic with interfaces for TCP/expect, tftp, and dbus
14:13 the first two are fine, but dbus needs to use a unix socket in this case.
14:13 java doesn't support unix sockets without a separate JNI .dll/.so
14:14 ...and suddently deployment gets a lot more complicated. Do I ask the user to install a prerequisite package for their particlar repo?
14:14 Or do I try to stick the .so in the .jar, and unpack it for them on startup?
14:15 where do I unpack it to, such that it has appropriate permissions without creating a security hazard?
14:15 if they download their own, what if the versions don't match what I bundled?
14:15 Why didn't I just write it in ruby and deplay a .gem?
14:15 * Chouser sighs.
14:21 dreish: Chouser: I don't think deploying JNI is so unusual.
14:22 Chouser: Is there an easy way to do so in a single .jar?
14:22 cp2: jkljljl
14:22 dreish: If I were doing it in Eclipse, on a Mac, I know I would just right click on the project, pick Export ..., and choose Mac application bundle.
14:23 Not much help if you're not using Eclipse or deploying for the Mac, I know. :-/
14:23 Looking at a resulting app bundle, I see a directory with several jars and two .jnilib files.
14:31 Chouser: dreish: hm, ok.
14:31 well, maybe I shouldn't give up just yet.
14:31 I found some answers on forums that were not at all encouraging.
14:31 dreish: Chouser: It might get unreasonably ugly if you absolutely can only deliver one jar file.
14:31 Chouser: ...should teach me to trust the Internet.
14:32 dreish: Then you're stuck trying to do something like unpack the jnilibs from the jar, in your app, and then ... ? Maybe even have to relaunch the app? I don't know.
14:35 danlarkin: real answer: shouldn't have written it in clojure :_/
14:36 hiredman: well, any jvm language
14:37 targeting the jvm is targeting java space, "The Enterprise"
14:37 gnuvince_: Hello all
14:39 p_l: Chouser: I guess you'll have to distribute an archive, to be unpacked, which would contain all the parts and a wrapper script...
14:49 Chouser: hm
14:49 but I *like* clojure. I don't want to write it in ruby...
14:51 dreish: You could write a Clojure program that outputs Ruby code at runtime.
14:59 Chouser: hm
14:59 maybe perl
15:06 dnolen: Chouser: can you just a shell script and call it from Clojure?
15:06 just write a shell script I mean.
15:08 I've have something like this in one of my libraries: (defn shell [com] (. (Runtime/getRuntime) (exec com)))
15:09 Chouser: yes, but the thing I would exec would have to be installed as well.
15:09 half of one, six dozen of the other...
15:10 dnolen: and you can't just package the shell script in the .jar? I have to admit I know very little about deploying .jars, the REPL is everything to me :)
15:39 Lau_of_DK: Hey guys
15:43 unlink: hello ??
15:44 Chousuke: :p
15:46 unlink: mik�?
16:22 AWizzArd_: ,(* 1.5 0.4 250)
16:22 clojurebot: 150.00000000000003
16:23 AWizzArd: ,(* 1.5M 0.4M 250)
16:23 clojurebot: 150.00M
17:05 gnuvince_: ~seen Cark
17:05 clojurebot: Cark was last seen in #clojure, 653 minutes ago saying: ah that looks like cool stuff
17:14 * Rayne- huggles hiredman
17:32 DTrejo: ~seen gnuvince
17:32 clojurebot: gnuvince was last seen in #clojure, 3046 minutes ago saying: I don't know, I don't think I've ever used --rev
17:32 DTrejo: --rev
18:07 Raynes: "Never argue with an idiot. They'll drag you down to their level and then beat you with experience."
19:18 chessguy: 'evening
19:20 durka42: evening
19:21 chessguy: anybody up for some chat about concurrency in clojure/
19:28 hiredman: chessguy: ?
19:28 chessguy: so this is sort of more of a design question than a technical question, i suppose
19:29 i have this very complex idea, and a pretty good idea of the kind of things i want it to do, but no clue where to start
19:30 the idea is, i want to provide a way of expressing ideas around genetic programming
19:30 but i want it to be a more interactive style than the typical GP engine
19:30 te: chessguy: that sounds familiar
19:31 * hiredman knows nothing about GP
19:31 te: chessguy: I had a massive project/thinking man's fruit sort of idea like yours
19:31 chessguy: I can only recommend one thing: plan a little, do a lot
19:31 chessguy: so i have this notion of a workspace with genetic individuals laying around on it, and also problem instances, and you can use htis sort of DSL to interact with it
19:31 and the DSL will automatically scale up to many cores
19:32 te: what do you mean?
19:33 te: chessguy: idea as abstract and as difficult as yours are only accomplished by doing stuff
19:33 it is easy to get into perpetual planning mode with them, redefining the goals etc. all the time
19:33 don't even consider starting unless you establish some very simple mini goals first
19:33 chessguy: fair enough
19:33 i don't even have a clue where to start though
19:34 like how do i share the state across commands?
19:34 te: STM
19:35 I recommend Stuart's book
19:35 he has a good example
19:35 chessguy: oh nice
19:36 i've been thinking about that
19:38 hiredman: ~jdoc java.util.Formatter
19:38 (don't mind me)
19:39 chessguy: it took me about 3 seconds to go "was that for me? nah"
19:40 i'm thinking a breadth-first approach would be good
19:40 get a nice variety of features just barely implemented and the build on that
19:44 so i'd want to implement the whole workspace as a ref?
19:47 err, i mean to say store it in a ref, i suppose
19:55 hiredman: man
19:55 it sure would be nice if tagsoup had a link to the javadoc on the website
20:04 chessguy: what's the difference between a form and an expression?
20:04 durka42: not much
20:05 hiredman: clojurebot: what does the hyperspec have to say on the difference between a form and a expression
20:05 clojurebot: hyperspec is not applicable
20:07 hiredman: uh, I think it's: everything is an expression, and lists are forms
20:57 blbrown: join #ubuntu
20:58 yonatan__: hello
20:58 is there some way to extend a java class from clojure at runtime?
21:02 nevermind, found it (proxy)
21:02 clojurebot: proxy is <Chouser> proxy teases with its ease of use, then suddenly betrays.
21:02 yonatan__: hmm
21:05 st3f4n: what is the clojure equivalent of CL's write-to-string? (to convert a number to a string)
21:09 ah .. str :-)
21:27 hiredman: yonatan__: proxy doesn't let you add new methods
21:27 yonatan__: does it let me override old ones?
21:27 hiredman: yes
21:27 yonatan__: i can live with that. thanks hiredman
21:57 st3f4n: hmm should compojure trunk work with clojure trunk?
23:00 chessguy: suppose i needed to do the same thing 10000 times in clojure, and each time resulted in some value, and i'm interested in a collection of the 10000 values. but i want to do this in a way that will split across as many cores as are available. how would i go about that in clojure?
23:01 gnuvince_: pmap?
23:01 chessguy: ,(doc pmap)
23:01 clojurebot: "([f coll] [f coll & colls]); Like map, except f is applied in parallel. Semi-lazy in that the parallel computation stays ahead of the consumption, but doesn't realize the entire result unless required. Only useful for computationally intensive functions where the time of f dominates the coordination overhead."
23:03 chessguy: you're saying do (pmap f (range 1 10000)) or something?
23:05 ,(let (f (fn  3)) (f 8))
23:05 clojurebot: java.lang.IllegalArgumentException: let requires a vector for its binding
23:05 chessguy: ,(let [f (fn  3)] (f 8))
23:05 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--3142$f
23:06 chessguy: oooh, nasty little error message :)
23:06 ,(let [f (fn  3)] (f))
23:06 clojurebot: 3
23:06 chessguy: ,(let [f (fn [x] 3)] (f))
23:06 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--3154$f
23:07 chessguy: so why is pmap only useful if f is expensive?
23:10 hiredman: p overhead
23:10 thread bookkeeping, etc
23:11 chessguy: but what if f is cheap but the number of times it needs to run is huge?
23:12 hiredman: hmmm
23:12 try it and see
23:12 chessguy: i don't have multiple cores handy to test with :)
23:36 eee: hi
23:36 i kinda need help understanging something
23:36 or I'm too lazy to read up
23:36 cipher: ,slurp
23:36 clojurebot: #<core$slurp__4614 clojure.core$slurp__4614@1625b8c>
23:37 cipher: ,eval
23:37 clojurebot: #<core$eval__3985 clojure.core$eval__3985@17bcd8f>
23:37 eee: what's the relationship of generics in java to data structures in clojure?
23:37 cipher: clojurebot: slurp?
23:37 clojurebot: slurp is worse
23:38 Chouser: The type parameters given in java generics are erased before they hit bytecode.
23:38 They are invisible and completely ignored by Clojure.
23:38 ,(doc slurp)
23:38 clojurebot: "([f]); Reads the file named by f into a string and returns it."
23:38 eee: so like what if I make a java data structure that calls specific functions on a template parameter
23:39 cads: hey, where can i find documentation on clojure that's been generated in the style of an rdoc?
23:39 like how can i print out all the functions in a namespace, and their doc strings?
23:39 Chouser: eee: can you do that? I know almost nothing about Java generics.
23:39 cipher: ,(slurp "/proc/cpuinfo")
23:39 clojurebot: java.security.AccessControlException: access denied (java.io.FilePermission /proc/cpuinfo read)
23:39 cipher: cool!
23:40 eee: like the heap I am trying to make foe clojure in paraterized on a type T that "extends" (should have been implements but java got it wrong for generics) "Comparable"
23:40 is parameterized
23:41 Chouser: eee: my guess (and it's only a guess) is that the instance will be cast to Comparable at any call sites.
23:41 eee: so clojure throws out the specifix type, but the type still needs 'compareTo' to be implemented
23:42 and, if I made the heap require a template param that has "getPriority()" be implemented, would that make it useless to clojure programmers?
23:43 you'd try to insert something and it would crash because the type you inserted wouldn't have a 'getPriority()' method?
23:44 see, my problem right now is that my heap really only takes a priority
23:44 it can only compare one priority to another
23:45 so if you wanted to say that you had some ADT, say Car A
23:45 and it compared equal to Car B
23:45 you could end up deleting the wrong car
23:46 because they both compare equally even though they are different objects
23:47 also in clojure if you were to change the priority, you'd change the identity
23:47 because you are what you equal
23:48 chessguy: hm, you are what you equal. very profound
23:49 st3f4n: i'm watching the clojure screencast from peepcode.com
23:49 eee: i just realized something after I said that
23:49 that may be true for clojure
23:49 but I can check address in clojure
23:49 might have an idea
23:49 hows the peepcode, st3f4n
23:50 st3f4n: eee, it is well done, but it touches a LOT of stuff in just an hour
23:50 gnuvince_: st3f4n: have you watched the screencasts by Rich?
23:50 st3f4n: no not yet
23:50 eee: a non-clojure person I know watched it and concluded that there are "just as many gotchas in clojure as in anything else"
23:50 st3f4n: well, partly
23:50 gnuvince_: OK.
23:50 st3f4n: if you got a Lisp background, the "Clojure for Lisp Programmers" is a really nice one.
23:51 st3f4n: eee, sure, clojure is not the holy grail :)
23:51 gnuvince_: thanks, i'll find that one
23:51 eee: well, it has to be better than python for some people.
23:51 to me, that's not hard
23:52 if you don't already have a jvm, python can be a lot more low ceremony
23:52 gnuvince_: eee: the way I figure it, people have more problems when something is consistent than when it has a lot of rules and exceptions.
23:52 st3f4n: so far i like clojure a lot
23:52 eee: i agree gnuvince_
23:52 st3f4n: the one thing that i don't like is the error reporting .. the java stack traces are completely unusable
23:52 eee: I don't see outgrowing clojure
23:52 soooooo many macros and growing
23:53 double edged sword macros
23:53 gnuvince_: Case in point: people saying that prefix notation is unnatural and can't get used to it, yet these people are able to handle prefix, infix and postfix in the same language with different precedences
23:53 eee: well, I'm off to play with my ideantity woes in this heap
23:53 gnuvince_: identity woes?
23:53 eee: i agree with that, too
23:53 but with macros, you can go just as crazy
23:54 st3f4n: personally i think it is weird if a programmer has problems with prefix notation
23:54 eee: clojure's concept of identity, ya know? not mine, literally!
23:54 nice chattin
23:55 st3f4n: the peepcode screencast is cool but i find a bunch of things that they should do differently .. like using (when ..) instead of (if () (do ...))
23:55 gnuvince_: I haven't seen it.
23:55 st3f4n: and i think there was something like 'you create a list with quote (a b c)'
23:56 which is a little misleading and the parens are missing :)
23:56 cipher: I've been kind of annoyed at having to watch screencasts to learn the language. it feels like the documentation is weaker than the videos.
23:57 chessguy: the plus side of the peeopcode screencast is a nice demonstration of different concurrency feature
23:57 st3f4n: yeah, it is a nice example
23:57 and i get all motivated after watching it :)
23:57 chessguy: cipher, it's better than having to go back to the academic papers, like in haskell :)
23:57 gnuvince_: I think that regardless of whether it's the best screencast ever, it gives Clojure more exposure, which can't be bad.
23:58 st3f4n: do you think Clojure can give real errors and stack traces in the future? or will it always be stuck with the stack traces that is has now?
23:58 cipher: it's nice, but videos like a search feature. implement that and I'm game :)
23:59 gnuvince_: st3f4n: I don't know. I hope they could be improved somewhat, but ultimately, whatever Java gives, Clojure gives you.