#clojure log - Jun 13 2011

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

1:31 technomancy: clojurebot: jira is <reply>Well, *have* you got a 27B/6?

1:31 clojurebot: Huh?

1:31 technomancy: whatevs

5:54 Dranik: hi all1

6:21 clgv: what is the idiomatic way to do mutual recursion (2 functions) without causing a stackoverflow? I don't see a straightforward loop-recur approach

6:24 djpowell: Is there a problem with github? I get a 403 error from doing git pull on an existing repository

6:26 clgv: one suggestion I found is using trampoline - is that the idiomatic one? are there others?

6:28 wallaw: hey, is the something like the C# xsd.exe schema compiler available for clojure?

7:04 Useful-_: I started writing a question, and realised the answer half way through writing it. Thanks for the help all :)

7:05 raek: clgv: maybe generate a lazy sequence of the intermediate values

7:06 realization of lazy sequences works kinda like trampoline in a sense

7:06 clgv: raek: hm true. so I have to decide which of the two is the more direct write down of my functions

7:07 raek: Stuart Halloway has a part about this in his book Programming Clojure

7:07 clgv: ok, gotta look that up now ;)

7:13 raek: Section 5.4, page 167

7:13 clgv: raek: thx. guessed it from the table of contents ;)

7:15 my only problem is that I have another between the recursive function calls which causes some knots in my brain with the trmpoline example ;)

7:16 *another function.

7:16 guess I have to draw a sketch of it to get rid of the knots ;)

7:20 manutter: clgv: there's a nice freeware app from vue.tufts.edu that's good for flow charts, concept maps, etc.

7:21 May be overkill for what you need, but I'm a big fan so I thought I'd mention it :)

7:23 raek: clgv: another alternative is to have a function that takes a state argument which it uses in a case form to select which body to use and then recur

7:24 having functions calling each other in a CPS-ish way is like a state machine too

7:25 so a state arg makes the state explicit, instead of existing implicitly in the call stack

7:31 clgv: raek: yeah sounded pretty much like a state machine to me ;)

7:32 the task that I do is: implementing a sort of cartesian-product on a tree structure

7:33 I have a tree description for parameter values of a configuration that can have sub-configurations that may hold parameter values and sub-configurations as well

7:35 I just noticed that my current recursive implementation is not a tail recursion right now. I have rewrite that one...

7:36 Vinzent: Protocol functions can't have var-args?

7:38 clgv: Vinzent: yes, they cannot have var-args

7:38 Vinzent: '& will be interpreted as variable name

7:39 Vinzent: clgv, ok... thanks

7:39 clgv: Vinzent: I ran into that one as well some time ago. if you really need it you can simply define a normal function

7:43 Vinzent: clgv, yes, but it requires a lot of code, i think it doesn't matter in my case

8:04 lnostdal-laptop: ,(map (fn [char] (print char)) "hello")

8:04 clojurebot: hello

8:04 (nil nil nil nil nil)

8:05 lnostdal-laptop: odd .. clojure-1.3 from git returns a completely different result

8:05 manutter: that is odd -- that's the correct result

8:06 the function will print one char and return nil, and map assembles all the nils into a seq of nils

8:06 what does 1.3 return?

8:06 lnostdal-laptop: just: (henil lnil lnil onil nil)

8:07 ..which doesn't make sense

8:07 Bronsa: yes it does

8:07 manutter: ah, ok, that's a lettle less odd then

8:07 It's just interspersing the print output with the repl result output

8:08 lnostdal-laptop: any way for it to not do that?

8:08 Bronsa: its doint that only at the repl

8:08 *it's

8:08 lnostdal-laptop: (i use print output to debug, but still want to see proper result output)

8:09 Vinzent: btw, is there the update function in 1.3?

8:09 lnostdal-laptop: i tried both the terminal and emacs+slime actually; same result

8:09 Vinzent: (signature like in assoc, works like update-in)

8:09 manutter: hmm, try wrapping your function in with-out-str?

8:10 ,(doc with-out-str)

8:10 clojurebot: "([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."

8:10 lnostdal-laptop: that results in ""

8:11 manutter: You need to do something like (def my-out (with-out-str (map (fn [c] (print c)) "hello")) my-out

8:12 lnostdal-laptop: my-out => ""

8:12 manutter: Hm, that surprises me...

8:13 lnostdal-laptop: i'll try updating swank-clojure

8:14 raek: I think the problem is laziness and dynamic rebinding of *out*

8:15 try (with-out-str (dorun (map (fn [c] (print c)) "hello")))

8:15 manutter: Ah yes

8:15 Bronsa: yes

8:15 lnostdal-laptop: that worked, raek

8:16 but i'm not sure what's going on, though

8:16 reading up on dorun now

8:16 Bronsa: it's because map returns a lazy-seq

8:16 that doesnt get evaluated

8:16 you need to dorun it in order to evaluate it

8:17 raek: with-out-str creates a string writer, executes the body and then makes the string of what has been written

8:17 manutter: when you type it directly at the REPL, the REPL forces the lazy seq to be realized

8:17 when you run it inside with-out-str, the REPL is no longer directly printing the output, so the result stays lazy

8:17 raek: but map is lazy, so the body just returns a lazy-seq object that hasn't done any side-effects yet

8:18 lnostdal-laptop: ok

8:21 doall actually

8:21 ..will print hello .. then return the complete result

8:21 coming from a CL background; this is closer to Haskell or something :)

8:22 manutter: Try coming from PHP... ;)

8:23 lnostdal-laptop: hm, yeah, i'm doing PHP at work now .. it's clumsy :P .. will switch to Clojure there soon though :)

8:23 manutter: oh, envy. We're stuck with PHP for the duration. I'm trying to find ways to squeeze it in though.

8:31 lnostdal-laptop: ok, gotta go .. cya later, and thanks!

8:45 kephale: I am working with a namespace from a namespace that someone else develops which changes frequently, but requires some extra modifications to be useful for me. What is the best way to load/override the functions in that base namespace?

8:46 Currently I just have a file that enters the namespace and loads/overloads all the definitions with my versions

8:46 clgv: kephale: sounds like a really strange approach

8:46 kephale: but that leads to order-dependent use flags

8:47 clgv: yeah its really awkward

8:48 clgv: what exactly do you have to adjust?

8:49 kephale: there are some functions that display the status of some loops (evolutionary computation stuff, so the loops are long in terms of wall clock time) where I overload those display functions to provide extra information

8:49 raek: kephale: sounds like you should consider making a fork or talking to the author

8:50 kephale: technomancy's robert.hooke could be possible to use too

8:50 kephale: raek: forking was my original solution, but sometimes the updates can be frequent enough and lead to enough clashes that it was becoming an impractical approach

8:51 I'll look into robert.hooke though, not familiar with that

8:51 raek: https://github.com/technomancy/robert-hooke

8:51 it allows you to add hooks to other people's functions

8:52 and you can override the original behavior

8:52 kephale: OooooOooo

8:52 hot tip!

8:52 raek: might not be very stable to do this on private defs, though

8:54 kephale: I'll risk it : P

8:55 clgv: kephale: but displaying statusinfos hardwired sounds like a not so good design decision anyway

8:56 kephale: mybe you can talk the author into providing them via optional parameters or something like that...

8:56 kephale: clgv: i didn't really describe that part the best way. we're doing genetic programming and are crunching statistics on the population of programs at each generation.

8:58 some of the statistics are essential, and i have some extra ones that are critical to my experiments. plus there are a few other situations where i need to override functions for the reproduction of programs and such

9:02 void_: Hi, what should I do in this situation: I have a "layout" function which is called by view functions to render content inside of layout. Those view functions are called by controller functions.

9:02 Now I want to add listing from DB to the layout. Should I pass the data to view functions, and then pass the data to layout function? I don't want to call database from view.

9:02 How do you people solve this? In Rails/whatever you would just set an ivar with the data and display it.

9:04 manutter: what's an ivar?

9:04 Vinzent: void_, you can get data in your function, pass it to view, and wrap it in layout in middlewares (if I've understood your question correctly)

9:04 void_: manutter: instance variable

9:04 manutter: ah, gotcha

9:05 void_: Vinzent: well, the problem is, data is not needed by view, but by layout

9:05 so if layout was added by middlewere, how would I pass it data?

9:06 as a temp solution, layout just takes data from db

9:07 timvisher: hey all

9:07 anyone familiar with clj-http or a related technology?

9:07 i'm getting a response from http://interfacelift.com/wallpaper/details/2608/venice.html that surprises me

9:07 the body has nothing but '\n' in it

9:08 it works with on google but google doesn't start it's body with \n

9:08 wondering if this is a known behavior

9:08 Vinzent: void_, ah! don't know, I think I'd just split it into 2 functions

9:09 manutter: timvisher: are you setting a user-agent header? The interfacelift.com may be mistaking you for a bot and sending you an empty body

9:09 timvisher: mmm

9:10 that sounds highly likely

9:10 clgv: manutter: then it's actually not "mistaking him for a bot", isnt it? ;)

9:10 void_: try curl ?

9:10 manutter: well, for a certain kind of bot, I mean. You know--badbots.

9:11 clgv: lol :D

9:12 timvisher: void_: do you know the curl command off the top of your head that shows the body?

9:12 I'm getting 'data not shown' where I would expect to see the body

9:12 void_: I mean just command line curl

9:13 it shows body by default

9:13 manutter: If curl is giving you "data not shown" then you're probably getting back binary data

9:13 void_: well, look

9:13 vojto ~ $ curl "http://interfacelift.com/wallpaper/details/2608/venice.html"

9:13 vojto ~ $

9:13 just empty

9:14 manutter: I think you need to see the headers, particularly content-type and content-length

9:14 void_: -i

9:15 timvisher: void_: that's what I thought. So it seems manutter is probably right

9:15 i'll mess around with the headers i'm sending

9:18 well. good news is that setting the user-agent to the chrome string seems to be returning a body. Bad news is that the stupid slime error I've been getting since Friday is choking on displaying the results...

9:21 any guesses? https://gist.github.com/1022749

9:21 this is killing my ability to develop...

9:22 manutter: you've rebooted your system since you started getting those errors?

9:23 timvisher: nope

9:23 try not to knee-jerk re-boot. Makes me feel like a windows user. ;)

9:23 what would that affect though?

9:23 I've completely deleted and reinstalled slime a few times

9:23 manutter: Yeah, I know what you mean. The error text seems like it's having network issues

9:24 timvisher: mmm

9:24 ok

9:24 manutter: maybe there's a bad socket stuck somewhere?

9:24 timvisher: well i shall bring my uptime back to 0 and see if that helps :)

9:24 thanks1

9:24 thanks!*

9:24 manutter: I don't know if that's even possible, but I'd knee jerk here :)

9:32 timvisher: boo

9:32 restarting brings no change

9:32 manutter: :(

9:33 damn windows users...

9:33 timvisher: lol

9:33 clgv: timvisher: that was the remaining windows user portion in you that had this foolish hope ;)

9:33 * timvisher blushes and admits that that was indeed exactly what that was

9:34 timvisher: so what can i do to debug this?

9:34 it seems to be related directly to what I'm attempting to print

9:34 i can execute and display most things find

9:34 fine*

9:35 raek: timvisher: that looks really scary... why do you get HTML from some site with amazon ads in your swank-clojure socket stream?

9:35 manutter: ok, so something is coming through the data channel that's making it choke

9:35 timvisher: but so far i have 3 examples of slime killing things: https://gist.github.com/1022749, https://gist.github.com/1018899, and https://gist.github.com/1018881

9:36 raek: I agree. I think i'm already being a really bad internet citizen and claiming to be chrome when I'm not

9:36 manutter: are you using CDT at all?

9:36 timvisher: I just want to verify that it works before I do it right.

9:36 not intentionally

9:36 raek: timvisher: are you runing a web server on the computer?

9:36 manutter: heh, that's true, *good* internet citizens only claim to be Mozilla when they're not.

9:37 timvisher: raek: I sometimes do

9:37 before Friday that never seemed to cause an issue.

9:37 I'm not running it right now

9:37 raek: currenlty?

9:37 timvisher: which OS, btw?

9:38 timvisher: os x 10.6.7

9:38 raek: looks like malware that injects popups in all socket streams or something...

9:38 timvisher: raek: ah, you're saying that it may not be in the interfacelift stream at all?

9:38 hadn't even considered that

9:39 manutter: ah, do you have google toolbar or something?

9:39 raek: timvisher: erh. you were using a http client. then it makes more sense...

9:39 timvisher: I think this could be an encoding issue

9:39 timvisher: raek: it's in the view source when I get the page from Chrome

9:40 raek: (didn't read the whole problem...)

9:40 timvisher: manutter: I have a ton of crap, but I don't have google toolbar

9:40 raek: timvisher: try customizing the slime-net-coding-system to utf-8-unix

9:40 timvisher: Quicksilver?

9:40 manutter: that's a thought--are you setting a character-encoding header in your client call?

9:40 timvisher: manutter: I am not

9:40 but in both of these cases I have utf-8 chars present

9:41 at least I know I do in my app

9:41 * manutter scratches his head and tries to remember if the client is *supposed* to set a character encoding

9:41 raek: timvisher: what happens if you write the character "µ" in your repl?

9:41 timvisher: and it's possible that interface lift has it

9:41 raek: the error you get is from Slime and not Clojure

9:41 * timvisher re-jacks-in

9:42 timvisher: I get the same sort of error

9:42 raek: timvisher: then the problem is that Slime is configured for the wrong coding (swank used UTF-8)

9:43 timvisher: you get the error when swank sends the result of your evaluation to be printed in Slime

9:43 nad it contains a non-ASCII character

9:43 timvisher: that appears to be the case

9:43 slime-net-coding-system is set to iso-latin-1-unix

9:43 so i should set it to utf-8-unix

9:43 raek: yup

9:44 timvisher: should i need to restart emacs for that or just slime?

9:44 raek: if (seq "åäö") in the repl returns (\å \ä \ö), then the coding is set up right

9:44 dunno, try "re-jack-in"

9:45 * timvisher let's out a rousing cheer that frightens all of his cube-mates severely

9:47 timvisher: You guys are the best! :)

9:51 raek: "just another service provided by your friendly neighborhood Encoding-Man!"

9:55 jweiss: question on code/data equivalence. if i want to write a DSL for automated testing, what's a recommended way to write the procedure for the test - it's code that's part of a larger data structure. So it's also data. from what i've seen in other projects i'm guessing the way to go is a closure.

9:56 rather than quoted sexp

10:01 manutter: jweiss: sure, all you need to pass along is an anonymous function to be called when needed.

10:48 Dranik: did anyone found the solution for problem of displaying the unicode symbols in the ring-webapp?

10:58 Vinzent: Dranik, what's problem? Works good for me. btw, I've uploaded sample jaco project: https://github.com/dnaumov/jaco-examples/tree/master/src/jaco/examples

11:01 raek: Dranik: I think the problem discussed some day ago was fixed by having the "Content-Type: text/html; charset=UTF-8" header in the response

11:01 Dranik: raek: how can I set that with Compojure?

11:02 void_, hello!

11:02 raek: Dranik: when you return a response, you simply add it in the :headers map of it

11:02 Dranik: how did you fix the problem with unicode?

11:02 raek: thanks, I'll try that...

11:03 raek: Dranik: you can use the ring util function 'content-type', which makes this a bit shorter

11:08 void_: Dranik: Did it work?

11:08 I was stuck with it, because I used Content-type instead of Content-Type :)

11:08 but it's very simple

11:09 * void_ back to push ups

11:10 Dranik: void_, still trying

11:11 void_, I can't get it. the function (content-type) works with the response, but I render a request

11:11 how can I set the content type in the request?

11:11 void_: you don't set content type in request

11:11 you want to change response

11:11 you render string/html/whatever to the response

11:12 Dranik: void_: could you please show me an example?

11:12 void_: I just return this instead of string with html

11:12 {:status 200 :headers {"Content-Type" "text/html; charset=utf-8"} :body body}

11:12 while body is whatever html you want to render

11:12 I wrote a function that I call manually from controller functions

11:12 Dranik: let me try....

11:12 void_: of course it would be smarter to wrap it in middleware or something, but I don't need that now

11:14 Dranik: yep, that worked! thanks!

11:15 raek: (use '[ring.util.response :only [response content-type]) (-> the-html (response) (content-type "text/html; charset=utf-8"))

11:16 Dranik: raek: and how to do that for both request and response?

11:19 raek: Dranik: I don't understand. the Content-Type header is something you give in the response so that the client knows what type (and charset) the data is in

11:20 there is also a Content-Type header in the request, bit that is for the payload the client sends with a POST request

11:20 Dranik: ok, let me try...

11:21 raek: GET parameters are always in UTF-8, so you don't need to specify any coding for them

11:22 s/something you give/the client gives/

11:22 no, scratch that

11:22 I misread my own utterance :)

11:22 it was fine

11:23 Dranik: raek: something is wrong with your code. I've pasted it and it doesn't work...(((

11:26 solussd: Could anyone here w/ experience using both conjure and compojure speak to the advantages of compojure over conjure? Compojure seems to be much more popular and I don't understand why.

11:27 raek: Dranik: sorry, there is a ] missing after "content-type"

11:28 void_: solussd: first time hearing about something called Conjure

11:28 raek: http://clojuredocs.org/ring/ring.util.response

11:29 void_: but it looks nice Conjure is a Rails like framework for the Clojure programming language

11:29 https://github.com/macourtney/Conjure

11:29 Dranik: raek: Unable to resolve symbol: the-html in this context

11:31 Vinzent: i guess you should replace it with your html code or whatever you want to send to the outup

11:32 void_, I prefer compojure because it's much simplier and more "clojurish" (but i have no experierence with conjure, just read throught the wiki)

11:35 raek: Dranik: sorry, "the-html" was a placeholder for the html code you generate

11:36 Dranik: you could use "<h1>åäö</h1>" to test with

11:38 Dranik: raek, Vinzent: finally I've got that! thanks

11:38 raek: Dranik: maby ring-based tools automatically wraps a repsonse that is a string in a {:status 200, :headers {}, :body <the string here>} map. normally you make the map yourself (possibly with 'response') in larger apps than hello world

11:40 I recommend reading the ring spec to get a feeling for the concepts of ring (requests, responses and handlers): https://github.com/mmcgrana/ring/blob/master/SPEC

11:46 Dranik: raek: thanks

11:46 Vinzent: Dranik, np. But i don't understand why i can't reproduce the bug? All my pages already have correct headers without setting content-type manually. Is this behaviour changed in the latest compojure\ring versions or what?

11:47 Dranik: Vinzent: I dunno, I've just tried to put cyrillic symbols and had ???????? string instead normal letters

11:48 Vinzent: Dranik, interesting... I've only have problems with codepage in earlier versions of leiningen

12:01 Dranik: Vinzent which version of leiningen and compojure do u have?

12:10 chas: 1

12:19 Vinzent: Dranik, sompojure 0.6.3 and lein 1.3.1, with standard set of middlewares (params, public, etc)

12:22 gfrlog: $google sompojure

12:22 sexpbot: First out of results is:

12:23 manutter: $google typo

12:23 sexpbot: First out of 3550000 results is: Typographical error - Wikipedia, the free encyclopedia

12:23 http://en.wikipedia.org/wiki/Typographical_error

12:23 clgv: lllol^^

12:25 gfrlog: The important thing that we've learned is that "Sompojure" is an available project name :)

12:26 clgv: gfrlog: if there is no trademark on it, then compojure is available as well ;)

12:27 Dranik: Vinzent: my compojure is 0.6.2 and lein 1.4.2

12:27 gfrlog: W000! time to make me some moneys

12:27 Cozey: hi. will jetty 7 be supproted by ring?

12:27 gfrlog: I see somebody is already squatting on compojure.com

12:47 edw: If I wanted to serialize e.g. a regular expression using contrib.json, how would I go about doing that? (I don't need to round-trip the regex, just serialize it.)

12:59 TimMc: edw: Who is consuming it?

13:04 jweiss: is there a way to preserve the source of an anonymous fn? Let's say my fn is a test procedure, i want to print out the procedure in the results. but once it's compiled i don't seem to have access to the source

13:06 clgv: jweiss: you cannot as is - but you can implement a defn-like macro that writes down the source as meta data in the defn statement

13:07 jweiss: clgv: i guess defn must do it so i could steal pieces of it, right

13:07 amalloy: jweiss: defn doesn't do it

13:07 jweiss: amalloy: no? how does clojure.repl/source-fn get it?

13:07 clgv: jweiss: your only option to access code of a function is to intercept the function definition with a macro

13:08 jweiss: backtracks to an actual source file?

13:08 amalloy: &(-> first var meta (juxt :line :file))

13:08 sexpbot: ⟹ #<core$juxt$fn__3663 clojure.core$juxt$fn__3663@1a281b4>

13:08 amalloy: hm

13:08 technomancy: jweiss: https://github.com/Seajure/serializable-fn sorta

13:08 amalloy: &(-> first var meta ((juxt :line :file)))

13:08 sexpbot: ⟹ [48 "clojure/core.clj"]

13:08 jweiss: clgv: ok, that should be pretty straightforward, i hope

13:10 clgv: jweiss: technomancy's link could be a start afair

13:10 edw: TimMc: The output should be the pattern string, so that a tool can use it to generate a pattern when consuming the JSON output. I figured it out: <https://gist.github.com/1023199>.

13:10 jweiss: clgv: technomancy: yup that's pretty much it. thanks

13:14 amalloy: what ever happened to the proposal to have a public function for parsing defn args (with optional docstring etc) and then making defn and defmacro use it?

13:14 technomancy: it has some issues about only working with closures over certain types of expressions

13:15 patches welcome

13:17 clgv: amalloy: good question. copy&pasting the part from defn is really fragile (and copy&paste ;) )

13:18 Vinzent: there is name-with-attributes

13:18 in contrib

13:25 amalloy: Vinzent: good find. that seems to handle the most common cases; with this around it seems like the real thing might not be needed

13:26 eg it doesn't read/set :arglist meta for you, but mostly that's probably unnecessary

13:27 * technomancy would like :arglists for fn =\

13:28 clgv: amalloy: but I feel a little unsafe with something external. the best solution would be to be able to use exactly the same code that is used in defn

14:38 mvakilian: Hi everyone!

14:38 I'm Mohsen Vakilian, a PhD student working with Prof. Ralph Johnson at the University of Illinois at Urbana-Champaign (UIUC).

14:38 Ralph is a co-author of the seminal book on design patterns (GoF) and his research group has a history of important contributions to IDE's.

14:38 Our team <http://codingspectator.cs.illinois.edu/People> is studying how developers interact with the Eclipse IDE for evolving and maintaining their code.

14:39 We have noticed that some of the people in the Clojure community do Java programming, e.g. developers contributing to counterclockwise.

14:40 Therefore, we'd like to invite you to our research study on Eclipse, and would greatly value your help.

14:40 To participate you should be at least 18 years old and use Eclipse Helios for Java development.

14:40 As a participant, we ask that you complete a short survey and install our Eclipse plug-in called CodingSpectator <http://codingspectator.cs.illinois.edu/&gt;.

14:40 CodingSpectator monitors programming interactions non-intrusively in the background and periodically uploads it to a secure server at UIUC.

14:40 To get a representative perspective of how you interact with Eclipse, we would appreciate if you could install CodingSpectator for two months.

14:40 Rest assured that we are taking the utmost measures to protect your privacy and confidentiality.

14:40 hiredman: mvakilian: buzz off

14:42 offby1: odd. Not really spam; not trolling, probably well-intentioned ... yet nevertheless out of place

14:42 hiredman: ^-

14:42 mvakilian: Sorry for interrupting you guys.

14:42 I tried posting message to the mailing list but it didn't get approved.

14:43 I couldn't find another channel to invite Clojure developers to our study.

14:43 mids: next time try communicating your message without pasting a wall of text; it could have been a one liner

14:44 hiredman: your first post to the mailing list can take sometime to get approved

14:44 manutter: I might suggest putting the bulk of the text on a web page somewhere and then just saying "we're looking for volunteers to help with a study," with a link

14:44 mvakilian: I'd hang around just in case some of you are interested in helping our study and have questions.

14:44 offby1: mvakilian: yes: a one or two line summary would surely have been better received.

14:44 manutter: I don't think people object to the topic so much as the volume of text

14:44 offby1: mvakilian: but it's obvious that you're well-intentioned, so ... no harm done

14:45 mvakilian: I sent my message to the mailing list on 6/11/2011.

14:45 clojurebot: No entiendo

14:46 manutter: shush clojurebot nobody's talking to you.

14:46 mvakilian: There is already a web page that you can refer to get more information about our study and sign up: <http://codingspectator.cs.illinois.edu/ConsentForm/&gt;

14:47 manutter: mvakilian, did you get back a rejection notice or just not get a response?

14:48 mvakilian: manutter: I didn't get any response.

14:48 manutter: Might be lost in the backlog or might have gotten mistaken for spam

14:49 You should post a tweet via twitter.com that says "UIUC researchers looking for #clojure volunteers to help with study", might get picked up and re-broadcast on disclojure.org.

14:50 oh, you'll need to include a shortened URL in that tweet too

14:50 mvakilian: manutter: Nice suggestion. We'll do that.

16:12 Somelauw: Hi for some reason I really need to think when I'm trying to indent lisp code.

16:16 * the-kenny delegates indenting to his editor of choice (Emacs)

16:19 Somelauw: yes, but I also don't know when to hit enter

16:20 So should your code be as short in length as possible or as small in width.

16:20 And I never got the hang of Emacs.

16:21 So I use cake in terminal + vim.

16:30 tremolo: Somelauw: Code should never be wider than 80 chars. This is law.

16:42 grantm: occasionally, i get stack traces that start at core.clj:0, which doesn't help me at all. how can i figure out where the actual bug is occurring? can i?

16:46 bartj: grantm, can you post your stack trace somewhere ?

16:46 *you

16:46 grantm: sure; although i actually figured it out - i was more hoping for general strategies

16:47 Somelauw: I made it a stackoverflow question: http://stackoverflow.com/questions/6335886/how-to-properly-indent-clojure-lisp

16:50 grantm: bartj: http://pastebin.com/ggFBX1F5

16:52 bartj: grantm, I prefer and think the best way to have a look at stack traces is to look from the bottom

16:52 grantm: hm, okay

16:52 bartj: so in your case, it would be either in game.test

16:52 grantm: bartj: how do i get the rest of the trace?

16:53 bartj: also, it is preferable to look at *your* code first for errors

16:53 grantm: right :P

16:53 actually you're right... i didn't even notice the game.test.core stuff

16:53 bartj: ie. ignore all clojure.* libraries first

16:53 grantm: yeah

16:54 bartj: all the best with your clojure game (?)

16:54 grantm: thanks ... haha yup :P

16:55 a game is my first project in any new language

16:57 technomancy: has anyone ever used derive outside the context of multimethods?

16:57 (not looking for help with a problem, just genuinely curious if it's a thing people do)

16:57 bdesham: speaking of games, anyone know of any games written in clojure? I'm writing one, but it feels awkward to have so much state in clojure

16:58 grantm: bdesham: we should talk :P

16:59 bdesham: grantm: :)

17:01 grantm: bdesham: i'm keeping it open source here https://github.com/johnfn/game but since i'm a few days new to the language i suspect most of my style is wrong :)

17:07 bdesham: grantm: neat. I'll have to take a look when I get a chance :)

17:08 grantm: bdesham: cool :) be sure to point me towards any cool stuff you make

17:09 bdesham: will do. I'm planning to put my project on github as well, once it's reached at least beta quality

17:10 grantm: sounds much further along than mine ;)

17:10 what kind of game is it?

17:11 dnolen: bdesham: Penumbra has a couple of games (Asteroids, Pong, Tetris) that come w/ it and somebody's been working on a dungeon game, http://groups.google.com/group/clojure/browse_thread/thread/86d5e628f6b70125/b40901c22c996bde

17:15 bdesham: kind of an arcade/puzzle game

17:15 not particularly graphics-heavy, but a little challenging... it's my first game, and my first big clojure project

17:16 grantm: nice! clojure is an interesting language choice for your first game :)

17:17 void_: bdesham: I really like Mire, the one from Peepcode screencast

17:17 bdesham: I had had the idea for the game kicking around for a long time, and when I started learning clojure I thought, ok, I'll just code it in this

17:17 turned out to be a weird choice, yes ;-)

17:17 void_: https://github.com/technomancy/mire

17:17 ach technomancy wrote this too

17:17 bdesham: dnolen: void_: thanks for the links

17:18 ha, along with leiningen? pretty impressive repertoire right there

17:18 grantm: wow, mire is pretty interesting

17:23 amalloy: bdesham: technomancy wrote a lot of things

17:24 i guess "wrote" is wrong cause he keeps going. "has written"

17:27 jcromartie: I'm playing with markov chains here https://gist.github.com/1023496

17:28 my markov-next function actually returns the next *chain*

17:28 and so markov-seq returns a seq of chains

17:28 they are mostly redundant, like ["one"] ["one" "two"] ["one" "two" "three"]

17:29 I'd really just like an infinite seq of words

17:31 gm

17:31 hm

17:31 got it :) map + iterate

17:32 amalloy: jcromartie: rand-nth already exists

17:32 jcromartie: oh cool

17:33 seancorfield: and there's map-indexed - in case you're just doing (iterate inc 0)

17:34 jcromartie: "man is vanity and vexation of his belly and the king shall be unclean seven days"

17:34 seancorfield: no, (map last (iterate gen-next-chain init-chain)) here https://gist.github.com/1023496

17:34 brehaut: ,(map #(take 4 %) [(range) (iterate inc 0)])

17:34 clojurebot: ((0 1 2 3) (0 1 2 3))

17:35 brehaut: seancorfield: is there a subtle reason you wouldnt use range? chunking?

17:36 seancorfield: brehaut: i've seen (map f (iterate inc 0) some-seq) quite often so i was thinking of that

17:36 it wouldn't really matter whether they used (range) or (iterate inc 0) in that case

17:37 map-indexed would still be better

17:37 brehaut: oh for sure

17:37 amalloy: seancorfield: (iterate inc 0) made sense before (range) existed, i think

17:37 (iterate inc 10) still makes sense since there's no way to give range a start point and no endpoint

17:37 seancorfield: yup

17:38 jcromartie: if you just want to flatten your seq of chains, you could just apply concat to it

17:39 jcromartie: not really

17:39 seancorfield: (apply concat seq-of-vectors)

17:39 amalloy: jcromartie: i did some work on a markov chainer for sexpbot months ago

17:39 jcromartie: each successive chain includes the priors

17:39 updated again: https://gist.github.com/1023496

17:39 I think it's good

17:39 seancorfield: yeah, just looked and saw map last ...

17:40 amalloy: it's not running anymore because i got the mongo backend all wrong but if you want to look for inspiration it's on github

17:40 seancorfield: there's always so many ways to solve problems :)

17:40 amalloy: seancorfield: there's more than one way to do it…think we should steal the perl slogan?

17:42 seancorfield: lol... didn't know that was perl's m.o. :)

17:42 have you moved to LA yet?

17:42 amalloy: yep. i can hit lancepantz or ninjudd with a stick if they annoy me

17:42 seancorfield: enjoying the city of angels?

17:42 amalloy: or at any rate i'm close enough to. didn't think to put that in my contract though

17:43 seancorfield: the city is eh. i like my apartment and the new job though

17:45 brehaut: amalloy: 100% less php?

17:47 amalloy: brehaut: yeah, and that seems unlikely to change

17:47 brehaut: awesome :)

17:48 bdesham: I'd like to call a function on each value in a map... is this a safe way to do it? https://gist.github.com/1023802

17:48 or should I be using a sorted map or something like that

17:52 [mattb]: user=> java.lang.ClassNotFoundException: clojure.contrib.math-functions

17:52 :(

17:53 er

17:53 user=> java.lang.ClassNotFoundException: clojure.contrib.generic.math-functions

17:53 amalloy: bdesham: ew

17:53 bdesham: haha

17:53 amalloy: (into {} (for [[k v] m] [k (f v)]))

17:54 your way is safe but is both inefficient and hard to read

17:55 void_: how do I get integer value from a string?

17:55 the-kenny: Integer/parseInt ?

17:55 void_: thanks

17:55 the-kenny: I'm not sure if this is the best way, though

17:55 kephale: void_: or read-string

17:55 parseInt is probably faster though

17:56 bdesham: amalloy: ok, thanks!

17:56 gfrlog: I switched to clojure because I wanted a language where :-D was a valid expression.

17:57 amalloy: int D = 1; int x = false ? 0 :-D;

17:58 gfrlog: oh; nevermind then. big waste of time this was.

17:58 bdesham: lol

17:58 gfrlog: no wait

17:58 that's just a part of the expression

17:58 :-D still doesn't stand on its own

17:58 in clojure it's not just an expression, it's a dang function

17:59 bdesham: ,(class :-D)

17:59 clojurebot: clojure.lang.Keyword

17:59 amalloy: gfrlog: in java nothing stands on its own. you have to wrap anything in at least two layers of {}s before it feels comfortable

17:59 gfrlog: amalloy: yeah but there are still some things that are expressions...like literals and arrays and such.

18:00 you couldn't ever say

18:00 Feeling myFeeling = :-D ;

18:06 void_: &:-D

18:06 sexpbot: ⟹ :-D

18:06 void_: &:-(

18:06 sexpbot: ⟹ :-

18:06 void_: &:-'(

18:06 sexpbot: ⟹ :-

18:06 bdesham: ,(keyword ":-)")

18:06 clojurebot: ::-)

18:06 bdesham: oops

18:06 ,(keyword "-)")

18:06 clojurebot: :-)

18:06 void_: ha you can skip :

18:06 bdesham: but of course, never do that ;-)

18:07 void_: So in Rails, you sometimes put logic into model. Here in Clojure there's no model, because there are no objects. Only a hashmap. So where would you put functions that are supposed to do something with model data?

18:08 I'm putting it into my controller namespace. (I have two namespaces, one for view-related code, one for controller.)

18:08 brehaut: void_: you still have a model layer; its just functions that operate on the model

18:09 void_: Ok I see.

18:09 So to make it fit nicely with what I have, I would probably create new namespace containing functions to deal with the model.

18:09 brehaut: void_: IMO the major difference between an OO MVC and a FP MVC is how hard you try to push pure functional code

18:09 void_: pure functional = doesn't change any state, right?

18:09 brehaut: correct

18:11 void_: Functional is fun! ;)

18:11 &(keyword ":)")

18:11 brehaut: but sometimes challenging ;)

18:11 sexpbot: ⟹ ::)

18:11 void_: &(keyword ")")

18:11 sexpbot: ⟹ :)

18:11 void_: lol

18:11 love this :D

18:15 amalloy: uhmmmm no offense but you can /msg sexpbot instead of spamming the whole channel with emoticons

18:17 gfrlog: but then how would I know that I had many a void somewhere very happy?

18:26 [mattb]: lol alright what am I missing

18:26 (use clojure.contrib.generic.math-functions)

18:27 neither use nor require works

18:27 amalloy: [mattb]: is this inside an (ns) form or bare at the repl?

18:27 [mattb]: bare

18:27 bdesham: try (use 'clojure.contrib.generic.math-functions)

18:27 amalloy: 'clojure....

18:27 that is, quote it

18:27 bdesham: if you're at the repl

18:28 [mattb]: aha

18:28 filenotfoundexception

18:28 closer...

18:28 amalloy: you're using lein or cake, i hope?

18:29 [mattb]: erm...

18:29 void_: amalloy: sorry didn't mean to spam

18:30 amalloy: [mattb]: if that question is confusing, you're probably not using one of them

18:30 [mattb]: haha yeah I'm reading now

18:30 amalloy: srsly use one. doing all the classpath stuff from the command line is so painful

18:30 $google raynes get started clojure

18:30 sexpbot: First out of 619 results is: An indirect guide to getting started with Clojure » Bathroom ...

18:30 http://blog.raynes.me/%3Fp%3D48

18:30 amalloy: god damn

18:30 blog.raynes.me?p=48

18:31 Raynes: amalloy: Hah hah, haw.

18:31 [mattb]: lol thanks

18:31 amalloy: Raynes: plz find and fix the bug that makes sexpbot print that url wrong

18:32 or eventually i'll remember to stop telling people to read it

18:32 Raynes: amalloy: Hehe.

18:32 Scriptor: damnit, emacs isn't smart enough yet to recognize .me urls

18:33 brehaut: quick! mass exodus to vim!

18:33 [mattb]: lol

18:33 I took the time to learn vim

18:33 amalloy: Scriptor: i'm sure if i'd prefaced it with http://, it'd work

18:33 [mattb]: I'll be damned if I'm gonna conjure more time to learn emacs >:(

18:34 Scriptor: [mattb]: heh, that's what I've been doing

18:35 [mattb]: I don't have the patience anymore :(

18:35 amalloy: ESC :more_patience

18:35 [mattb]: if I was still coding full time I might get around to it, but programming is just a tool for my real work now

18:35 I don't have the luxury of playing with tools

18:35 Scriptor: ah, for me I just figured out the basics while using it for irc

18:36 [mattb]: heh

18:36 you run an IRC client in your EmacsOS?

18:36 amalloy: M-x erc

18:36 i forget if it's built-in or i had to install a package

18:37 technomancy: amalloy: there are _two_ IRC clients built-in to Emacs

18:37 amalloy: nice

18:38 i'm not sure i could bear to have only one

18:38 Scriptor: I actually like this more than the other windows irc clients

18:38 [mattb]: the only thing that sucks about vim and clojure is the lack of slime

18:38 sadly :(

18:38 well, not the only thing, but the big thing

18:39 Scriptor: didn't someone make a slime plugin for vim?

18:39 seancorfield: anyone around connected with the try-clojure.org project? seems to be running r-e-a-l-l-y slowly and the REPL isn't starting up fully...

18:39 [mattb]: yeah but it's finicky

18:39 Scriptor: with nailgun or something like that, at least it comes with vimclojure

18:40 amalloy: seancorfield: Raynes

18:40 Raynes: seancorfield: Probably needs a good ol' restart.

18:40 Somelauw: hmm, is there a clojure idle for people like me who can't handle emacs? (Like drracket for scheme)

18:40 Raynes: I'll do that in a moment.

18:40 seancorfield: thanx Raynes - i wanted to point some folks to it who are new to clojure

18:40 * amalloy doesn't do anything useful in #clojure except highlight people

18:40 Raynes: seancorfield: Cool. I'll ping you when I have it restarted.

18:41 ihodes: Somelauw: try Eclipse and ccw http://code.google.com/p/counterclockwise/

18:41 Somelauw: i haven't tried it out, but i hear good things

18:42 Raynes: seancorfield: Should be good to go. Let me know if you have any more problems.

18:42 Somelauw: Or what I actually want is a clojure debugger?

18:42 seancorfield: thanx Raynes - looks snappy now!

18:43 amalloy: Somelauw: ccw may have something, but most of the work on clojure debuggers is going into swank/slime

18:43 Somelauw: ihodes: I will try it, thanks

18:43 ihodes: Somelauw: i think ccw can handle all of that. i use emacs for everything, so i'm not sure about much wrt ccw; there are also some debugging libs in clojure--maybe technomancy has one published?--that you can use

18:43 Somelauw: And swank/slime can only be used with emacs?

18:43 Raynes: seancorfield: I need to throw together a script to restart it every few days or so. There isn't a whole lot that can be done to make it unnecessary, given the inperfection of sandboxing.

18:44 amalloy: Somelauw: well, slime is part of emacs. you could write a slime client for something else

18:44 ihodes: Somelauw: yeah, slime is in emacs. unless someone's ported it to other places. not AFAIK

18:44 amalloy: swank is the server side of the slime/swank protocol; it really isn't related to emacs except in that slime is the usual client

18:44 ihodes: Somelauw: what amalloy said.

18:45 amalloy: but i think writing slime clients is not easy :P

18:45 ihodes: amalloy: take one look at the code. it's terrifying.

18:45 brehaut: nothing like reverse engineering a moving target

18:45 Somelauw: So if I don't learn emacs I am doomed?

18:45 ihodes: brehaut: by the way, thanks for yoru nice ring ecosystem writeup. best overview i've read of the stack.

18:46 Somelauw: not at all!

18:46 Raynes: No, you're not doomed. There are plenty of fine IDE plugins. You don't really need a debugger. Not nearly as much as you think you do anyway.

18:46 ihodes: Somelauw: for e.g. cemerick uses ccw.

18:46 brehaut: ihodes: thanks :)

18:47 i used ccw for a while; i switched to emacs because i dont like in eclipse all day and it was such an overhead. ccw is really nice though

18:47 Scriptor: Somelauw: emacs isn't all that hard, to be honest, once you have slime set up it's fairly straightforward

18:47 Raynes: Isn't CCW working on supporting CDT?

18:47 I can't keep up with those things.

18:47 * Raynes huggles his Emacs.

18:47 amalloy: i still haven't gotten around to trying swank-clj

18:48 but it's true, you don't need a debugger that badly

18:48 Raynes: I have my very own debugger: (fn [x] (prn x) x) ; :)

18:48 the-kenny: lein swank && M-x slime-connect RET ftw

18:48 amalloy: with a functional language, if your code compiles and the data that comes out is roughly the right shape, the function probably works

18:48 Raynes: #(doto % prn)

18:49 hiredman: the-kenny: latest clojure-mode and swank-clojure shorten that to just M-x clojure-jack-in

18:49 Raynes: #(or (prn %) %)

18:49 ihodes: hiredman: WHAT!?

18:49 the-kenny: hiredman: Oh, good to know. My installation is really outdated

18:49 Scriptor: hiredman: really? Awesome, I don't have to keep doing M-x shell every tmie

18:49 *time

18:49 hiredman: the latest clojure-mode has bits to read elisp out of jars, so you don't even need slime installed

18:49 ihodes: i just run the swank server in a different tmux window... don't know why i do it that way though. habit. a bad habit. it's a pain sometimes.

18:50 hiredman: clojure-mode pulls a copy of slime.el out of the swank-clojure jar and loads it

18:53 Scriptor: btw, has anyone here read purely functional data structures and done the exercises?

18:59 ihodes: Scriptor: it's on my list... it looks so cool. i'm betting a lot of people who're idling have read oit

19:01 Scriptor: it looks awesome, but I really need to get around to reading more than the first few pages

19:02 there're a couple of blog posts about clojure's vector and hashmap implementations that are pretty good though

19:04 bdesham: hehe... http://plope.com/Members/chrism/oss_sarcasm

19:05 Scriptor: that page speaks to e

19:08 cemerick: Somelauw: ccw is a fine environment. Unless there are vim guys waiting to beat me, I'd say that it's probably #2 in terms of usage.

19:09 Which reminds me, I totally fell down today, not posting the new state of clojure survey.

19:09 :-(

19:10 Any last-minute suggestions for questions, etc? http://cemerick.com/2011/06/10/state-of-clojure-2011-what-questions-do-you-have/

19:10 Raynes: CDT? C Development Toolkit?

19:10 Raynes: cemerick: Sure.

19:10 amalloy: cemerick: oh yeah, questions

19:11 cemerick: Raynes: What part of it would it support? Seems entirely orthogonal to me.

19:11 amalloy: clojure debugging toolkit

19:11 Raynes: cemerick: Clojure Debugging Toolkit, or whatever it's called.

19:11 amalloy: don't let Raynes's vague "sure" confuse you

19:11 Raynes: I think you might need another cup of coffee, Chassy.

19:11 cemerick: ah-ha

19:11 I've never used CDT, so I didn't flash on it.

19:11 amalloy: cemerick: one i thought of: "when you evangelize clojure to others, what excites them? what worries them"

19:12 cemerick: Yes, CDT integration is in the TODO list. Big job.

19:12 bdesham: cemerick: "did you find clojure to be a newbie-friendly language/community? if not, what could we improve?"

19:12 cemerick: I probably have my hands full with more REPL and editing enhancements.

19:12 bdesham: something along those lines

19:13 cemerick: Debuggers are great, but there's still a ton of tasty lower-hanging fruit to nab.

19:13 Raynes: cemerick: Yay! Survey! Now I'm never going to get any work done.

19:13 amalloy: Raynes: you only have to fill it out once

19:13 Scriptor: cemerick: this might go under current usage, but somethign about how easy it is to find libraries

19:13 hiredman: yegge says he is writing a debugger

19:13 Scriptor: or start a new project

19:13 Raynes: amalloy: Yes, but I'll do it slowly.

19:14 cemerick: hiredman: didn't he say that right after saying that he's not aware of what's out there already?

19:14 amalloy: haha

19:14 hiredman: cemerick: seems likely

19:15 cemerick: amalloy: that's a good one

19:15 brehaut: man, rhino on rails. lookin forward to that

19:15 Raynes: Yegge says lots of things. Lots of confusing indecisive things, sometimes. :<

19:15 cemerick: bdesham: I think that's probably covered by the general "what can we do to improve things over the next year" write in. :-)

19:15 amalloy: cemerick: i thought of it right after i read your request for questions, but forgot to ever send it to you. see, asking in #clojure is about the only way to get my input :P

19:15 cemerick: Raynes: easier to claim you were right later on! :-P

19:16 Raynes: cemerick: So, you're throwing that survey up tonight? Think you could ping me when it's a-go? Heaven forbid I check my feed reader.

19:16 cemerick: amalloy: Ah, home sweet home :-D

19:16 technomancy: cemerick: "how likely are you to use Clojure from the command-line?" maybe?

19:16 cemerick: Raynes: tomorrow morning, I think.

19:17 technomancy: or rather, would you want to if the situation were to improve?

19:17 Raynes: Ah, cool. Even better. I'll look for it then.

19:17 cemerick: technomancy: That's a tricky one to word so that the responses won't be biased. :-)

19:17 Scriptor: cemerick: another one, "is Clojure your first choice for a new project, if not, why?"

19:18 cemerick: "Would you like a hoverboard, if it existed?" YES!!!!

19:18 technomancy: probably true

19:18 Raynes: cemerick: Of course.

19:18 bdesham: cemerick: ok, fair enough :)

19:19 cemerick: Scriptor: Nice, I'll add a variant of that, try to get a sense of Clojure's place in people's programming language choice hierarchy.

19:19 kephale: cemerick: not if i can have a flying scooter

19:19 bdesham: I'm using C++ for a project right now... oh god, how I wish I could use clojure

19:19 technomancy: "Have you noticed Clojure's command-line support is not that great? (A) Yeah, what's up with that? (B) What?"

19:20 Scriptor: anyone have any inspiration for a clojure project idea? Trying to find something solid to learn with

19:21 cemerick: technomancy: ha :-)

19:21 tremolo: Scriptor: how about a twitter client

19:21 cemerick: technomancy: Best make sure you have a good answer if 95% choose (a). ;-)

19:21 tremolo: twitter clients are the hello world du jour

19:22 next up: key/value stores

19:22 bdesham: tremolo: haha

19:22 cemerick: technomancy: I think the real deal would be to reimplement java.exe et al.

19:22 Scriptor: heh, I've had the weirdest hello world projects

19:22 hiredman: "do you use clojure for distributed(multiple computer) parallel/concurrent work"

19:22 * cemerick is only half-serious

19:23 hiredman: what's a .exe?

19:23 Scriptor: a java compiler in clojure?

19:23 brehaut: hiredman: virus vector

19:24 * cemerick was trying to be explicit about reimpl the executable, not Java.

19:24 technomancy: cemerick: not totally crazy: http://hashdot.sourceforge.net/

19:24 Scriptor: oh, java, not javac

19:25 hiredman: Scriptor: a compiler would be much easier

19:25 cemerick: technomancy: so that's normalizing java's behaviour for scripting — nothing to do with startup times and such, right?

19:26 Scriptor: hiredman: true, most of the optimizations happen at runtime, iirc

19:26 technomancy: cemerick: right. I guess it's only half the story.

19:27 (the half that's possible?)

19:27 startup time improvements are probably only feasible via large cash bribes to Oracle execs.

19:28 "Please stop pretending the Client JVM doesn't exist. Sincerely, Twenty Thousand Dollars."

19:29 hiredman: $20k?

19:29 clojurebot: $what is love

19:29 sexpbot: It's AWWWW RIGHT!

19:29 Somelauw: okay thanks, I think I will try ccw and maybe one day try to setup emacs + swank again.

19:29 cemerick: Most of the startup time is class init for stuff that you may not be using at all -- the dependency tree among java.lang, java.io, and java.util is *large*. I'll bet you could get some of the benefits of jigsaw and such by shadowing some key classes in a jar added to the boot classpath that would then lazily load the shadowed classes when they're actually needed.

19:30 </speculation>

19:32 technomancy: hiredman: that's the frequent customer discount

19:33 cemerick: Somelauw: if you have any troubles, post on the -users ML :-)

19:34 hiredman: technomancy: part of a payment plan?

19:51 carllerche: Is there literal syntax for java longs?

19:52 (trying to call a java method that requires a long from clojure)

19:53 brehaut: carllerche: (long 1) ?

19:54 carllerche: That's a cast no? I guess it doesn't matter

19:54 seancorfield: use type hinting?

19:54 ^long 1

19:55 (or use clojure 1.3.0 :) )

19:55 carllerche: seancorfield: using ^long gives me an "Unable to resolve classname: long" error

19:55 is clojure 1.3.0 out?

19:56 seancorfield: alpha 8 is available

19:56 hiredman: seancorfield: seriously? ^long 1? are you for real?

19:57 seancorfield: i didn't actually try it *feeble smile*

19:58 i was just thinking about type hints in calls to java methods

19:58 hiredman: seancorfield: if you needed to try then you need to spend more time reading docs and reading code

19:58 brehaut: carllerche: the literal syntax for a long is to use a literal int that is long than a java int but not so long that it has to be a bigint

19:58 hiredman: it is obvious it cannot work if you actually understand what ^ does

19:59 seancorfield: no need to be snippy

19:59 ihodes: hiredman: whoa whoa, be calm

19:59 we're all friends here

20:00 * ihodes quoting A Game of Thrones

20:01 Scriptor: that's also on my reading list

20:01 brehaut: Scriptor: the first 100 pages of the first book are a bit tedious, it gets great after that

20:02 ihodes: i've just started watching the TV show...i never do that before a book, but hey. it's great so far. currently reading the sequel to The Name of the Wind. Which is excellent.

20:03 __name__: Is that worth 19 € for all 4 books?

20:04 ‘American Tolkien’ got me interested.

20:05 ihodes: __name__: if the TV show is any indication (and i hear the books are better), then hell yes.

20:05 Scriptor: ihodes: Wise Man's Fears? Great book

20:05 ihodes: Scriptor: so far, it's absolutely fantastic.

20:05 seancorfield: hiredman: i know in Clojure 1.3 you don't need to hint vars initialized to primitives (and in fact can't) but i only use 1.3 so i actually have to fire up a specific repl to go see how it used to behave... and that's why i suggested carllerche use 1.3 :)

20:06 hiredman: ^long 1 cannot work in any version of clojure

20:06 seancorfield: now that i think about that, it's clearly the case - and i understand why...

20:07 hiredman: ^long 1 tells the reader to use {:tag long} as metadata on the following form

20:07 numbers do not support metadata

20:07 seancorfield: i did not expect such an attack for a mistaken suggestion, however

20:07 hiredman: attack?

20:07 seancorfield: clearly others felt you were harsh as well

20:07 hiredman: others can feel what they like

20:09 ihodes: hiredman: seancorfield: let's just all talk abotu fantasy books for a spell. or just how awesome Enlive is?

20:10 seancorfield: squirrel! :)

20:10 __name__: ihodes: Thanks.

20:12 ihodes: seancorfield: hell yes.

20:13 hiredman: the other day I used the verb "trached" in front of a group of bright people, and just got blank looks, so I said "tracheotomy" and *still* got blank looks, same sense of incredulity when I see someone recomend ^long 1

20:14 seancorfield: carllerche: do you feel comfortable trying an alpha build of clojure? i know a lot of folks don't, but there are some nice advances over 1.2

20:14 https://github.com/clojure/clojure/blob/master/changes.txt changes from 1.2 to 1.3 alpha 8

20:14 carllerche: possibly, I ahven't looked at 1.3 yet at all

20:14 I'll look in a sec

20:15 thanks for the tips

20:15 seancorfield: hiredman: maybe we can buy each other a beer at the conj and be less incredulous :)

20:16 hiredman: possibly

20:16 Scriptor: even better, if you guys are near nyc there's a potential meetup on wednesday

20:19 hiredman: we're not, and I don't drink, so either way we'll just have to work something out

20:29 dnolen: make your own Watson in Clojure, core.logic gets Definite Clause Grammar support https://gist.github.com/1024087

20:31 grantm: hey guys, when i make a little gui app and run it in a repl, killing the app kills the repl too, which is annoying. Is there any way to get around that?

20:32 in fact, is anyone familiar with running guis in the repl in general? i would love to be able to tweak values during runtime, but i'm not sure how to write my code that way (i have an "infinite loop")

20:33 brehaut: grantm: generally if you have some piece of code that runs off by itselfs and you want to update the functions on the fly, you can use var quoteing

20:33 grantm: and then just redef the var

20:34 hiredman: grantm: there are some swing constants you set on the jframe which control what happens when you close the window

20:34 grantm: the problem with just typing stuff in is that i can't (there's no repl prompt)

20:34 brehaut: grantm: eg (defn handler [r] {:body "hello, world", :status 200}) (run-jetty #'handler)

20:34 hiredman: you run your loop in another thread

20:34 grantm: ahh, i see!

20:35 brehaut: grantm: (future some-expression) will run it on a background thread

20:46 dnolen: sum total code for DCG syntax support in core.logic ... 60 lines.

20:47 clojurebot: chouser: Some high-tech profiling with Activity monitor and println shows that I'm doing 100% of one core and not so much IO, though the number of files being read is huge(I estimate 5 per second).

20:48 dnolen: with DCG + tabling == packrat parser.

20:51 brehaut: dnolen: that looks really interesting

20:52 gfrlog: brehaut: is (future) a valid replacement for (.start (Thread. ...)) in all cases, or is there a pool that would get exausted?

20:52 brehaut: gfrlog: im not the right person to ask sorry, but i dont _think_ they use threadpools up?

20:52 amalloy: i think futures use the agent threadpool

20:53 brehaut: gfrlog: looking at the source to future-call (used internally by future) it uses clojure.lang.Agent/soloExecutur

20:53 dnolen: brehaut: yeah would be fun to port this http://web.student.tuwien.ac.at/~e0225855/lisprolog/lisprolog.html

20:53 brehaut: and the java.util.concurrent.Future

20:54 dnolen: hah awesome

20:55 dnolen: with core.logic near SWI perf, core.logic should have good perf for many parsing tasks.

20:59 brehaut: it would be nice to have more expressive parser tools available

21:01 (not to disparage fnparse)

21:05 dnolen: the other nice bit is that all of the existing Prolog parsing literature applies, http://cs.union.edu/~striegnk/courses/nlp-with-prolog/html/index.html

22:29 [mattb]: is there a difference between #^Graphics and ^Graphics

22:29 ?

22:29 brehaut: #^ is prior to 1.2

22:29 or maybe 1.1

22:29 its the old meta notation anyway

22:30 otherwise identical

22:30 (hiredman will probably correct me about now)

22:31 [mattb]: lol

22:31 brehaut: im generally wrong when i make blanket statements like 'otherwise identical' :P

22:31 use ^ anyway

22:32 [mattb]: are you looking at (for example) the ants demo?

22:33 [mattb]: yup

22:33 so I'm sure you're right

22:38 amalloy: brehaut: i think there is some devious subtle difference in an edge case somewhere but i don't know what it is

22:40 brehaut: amalloy: there was bound to be something

22:40 amalloy: brehaut: though, looking at the source, #^ and ^ are both hooked into MetaReader, so it looks to me like they're the same and i'm misremembering

22:40 brehaut: hah ok

22:45 [mattb]: how the hell do you use (ints

22:46 dnolen: <[mattb]> ?

22:46 [mattb]: no matter what I give it it complains that it can't be cast

22:47 even (ints (into-array Integer for shits and giggles

22:48 dnolen: <[mattb]> a complex expression please.

22:50 <[mattb]> sorry I meant complete.

22:50 [mattb]: I just want an int[] initialized from some sequence

22:50 dnolen: ,(make-array Integer/TYPE 10)

22:50 clojurebot: #<int[] [I@462718>

22:50 jcromartie: int-array

22:50 dnolen: ,(int-array [1 2 3])

22:50 clojurebot: #<int[] [I@18e546>

22:50 [mattb]: aha..

22:50 could have sworn I tried int-array

22:50 jcromartie: ,((juxt type seq) (int-array [1 2 3 4 5]))

22:50 clojurebot: [[I (1 2 3 4 5)]

22:50 [mattb]: dammit, thanks

22:52 woot, works! thanks

23:18 lonstein: I'm trying to convert an example to clojure that involves Java object literal syntax... new Foo( Bar.class )

23:18 but not seeing an obvious way to do that. Is there an idiom other than going to the classloader?

23:24 OneWhoFrogs: Hi all. This code (https://gist.github.com/1024248) gives me the error "Exception in thread "main" java.lang.RuntimeException: java.lang.Exception: Can't resolve: document". What's the best way to solve this?

23:24 brehaut: lonstein: what are you trying to accomplish with the object literal?

23:26 lonstein: brehaut: it's supplied to a constructor

23:27 brehaut: lonstein: _why_ though. without knowing anything about your program other than you have something in java you want the clojure equivalent we cannot provide you a reasonable suggestion

23:28 seancorfield: hiredman: so i'll buy you a non-alcoholic beverage of your choice at the conj then...

23:29 lonstein: brehaut: ok, specifically, I'm messing with the javax.sounds.sampled classes, playing sounds. The DataLine.Info constructor expects an actual class and the audio format

23:31 in Java that would be along the lines of info = new DataLine.Info( Clip.class, stream.getFormat() )

23:34 is there an equivalent idiom in clojure for the .class syntax or does one do something along the lines of (. (ClassLoader/getSystemClassLoader) loadClass "classname") to get it?

23:35 brehaut: i *think* that just referencing the class works

23:36 lonstein: hrm.

23:37 brehaut: i dont know how you would reference or import a nested class though

23:37 ,(type String)

23:37 clojurebot: java.lang.Class

23:39 lonstein: tried it at the repl, hah, it works. that was simple. I assumed it couldn't work

23:40 thanks

23:45 brehaut: no problem

23:45 sorry i was slow getting an answer

23:53 lonstein: brehaut: no, it's ok. I should have framed the question fully. I'm a bit tired

23:54 thanks

23:55 brehaut: no problem; it does always pay to provide the details of what and why.

Logging service provided by n01se.net