#clojure logs

2011-06-13

01:31technomancyclojurebot: jira is <reply>Well, *have* you got a 27B/6?
01:31clojurebotHuh?
01:31technomancywhatevs
05:54Dranikhi all1
06:21clgvwhat is the idiomatic way to do mutual recursion (2 functions) without causing a stackoverflow? I don't see a straightforward loop-recur approach
06:24djpowellIs there a problem with github? I get a 403 error from doing git pull on an existing repository
06:26clgvone suggestion I found is using trampoline - is that the idiomatic one? are there others?
06:28wallawhey, is the something like the C# xsd.exe schema compiler available for clojure?
07:04Useful-_I started writing a question, and realised the answer half way through writing it. Thanks for the help all :)
07:05raekclgv: maybe generate a lazy sequence of the intermediate values
07:06raekrealization of lazy sequences works kinda like trampoline in a sense
07:06clgvraek: hm true. so I have to decide which of the two is the more direct write down of my functions
07:07raekStuart Halloway has a part about this in his book Programming Clojure
07:07clgvok, gotta look that up now ;)
07:13raekSection 5.4, page 167
07:13clgvraek: thx. guessed it from the table of contents ;)
07:15clgvmy only problem is that I have another between the recursive function calls which causes some knots in my brain with the trmpoline example ;)
07:16clgv*another function.
07:16clgvguess I have to draw a sketch of it to get rid of the knots ;)
07:20manutterclgv: there's a nice freeware app from vue.tufts.edu that's good for flow charts, concept maps, etc.
07:21manutterMay be overkill for what you need, but I'm a big fan so I thought I'd mention it :)
07:23raekclgv: 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
07:24raekhaving functions calling each other in a CPS-ish way is like a state machine too
07:25raekso a state arg makes the state explicit, instead of existing implicitly in the call stack
07:31clgvraek: yeah sounded pretty much like a state machine to me ;)
07:32clgvthe task that I do is: implementing a sort of cartesian-product on a tree structure
07:33clgvI 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
07:35clgvI just noticed that my current recursive implementation is not a tail recursion right now. I have rewrite that one...
07:36VinzentProtocol functions can't have var-args?
07:38clgvVinzent: yes, they cannot have var-args
07:38clgvVinzent: '& will be interpreted as variable name
07:39Vinzentclgv, ok... thanks
07:39clgvVinzent: I ran into that one as well some time ago. if you really need it you can simply define a normal function
07:43Vinzentclgv, yes, but it requires a lot of code, i think it doesn't matter in my case
08:04lnostdal-laptop,(map (fn [char] (print char)) "hello")
08:04clojurebothello
08:04clojurebot(nil nil nil nil nil)
08:05lnostdal-laptopodd .. clojure-1.3 from git returns a completely different result
08:05manutterthat is odd -- that's the correct result
08:06manutterthe function will print one char and return nil, and map assembles all the nils into a seq of nils
08:06manutterwhat does 1.3 return?
08:06lnostdal-laptopjust: (henil lnil lnil onil nil)
08:07lnostdal-laptop..which doesn't make sense
08:07Bronsayes it does
08:07manutterah, ok, that's a lettle less odd then
08:07manutterIt's just interspersing the print output with the repl result output
08:08lnostdal-laptopany way for it to not do that?
08:08Bronsaits doint that only at the repl
08:08Bronsa*it's
08:08lnostdal-laptop(i use print output to debug, but still want to see proper result output)
08:09Vinzentbtw, is there the update function in 1.3?
08:09lnostdal-laptopi tried both the terminal and emacs+slime actually; same result
08:09Vinzent(signature like in assoc, works like update-in)
08:09manutterhmm, try wrapping your function in with-out-str?
08:10manutter,(doc with-out-str)
08:10clojurebot"([& body]); Evaluates exprs in a context in which *out* is bound to a fresh StringWriter. Returns the string created by any nested printing calls."
08:10lnostdal-laptopthat results in ""
08:11manutterYou need to do something like (def my-out (with-out-str (map (fn [c] (print c)) "hello")) my-out
08:12lnostdal-laptopmy-out => ""
08:12manutterHm, that surprises me...
08:13lnostdal-laptopi'll try updating swank-clojure
08:14raekI think the problem is laziness and dynamic rebinding of *out*
08:15raektry (with-out-str (dorun (map (fn [c] (print c)) "hello")))
08:15manutterAh yes
08:15Bronsayes
08:15lnostdal-laptopthat worked, raek
08:16lnostdal-laptopbut i'm not sure what's going on, though
08:16lnostdal-laptopreading up on dorun now
08:16Bronsait's because map returns a lazy-seq
08:16Bronsathat doesnt get evaluated
08:16Bronsayou need to dorun it in order to evaluate it
08:17raekwith-out-str creates a string writer, executes the body and then makes the string of what has been written
08:17manutterwhen you type it directly at the REPL, the REPL forces the lazy seq to be realized
08:17manutterwhen you run it inside with-out-str, the REPL is no longer directly printing the output, so the result stays lazy
08:17raekbut map is lazy, so the body just returns a lazy-seq object that hasn't done any side-effects yet
08:18lnostdal-laptopok
08:21lnostdal-laptopdoall actually
08:21lnostdal-laptop..will print hello .. then return the complete result
08:21lnostdal-laptopcoming from a CL background; this is closer to Haskell or something :)
08:22manutterTry coming from PHP... ;)
08:23lnostdal-laptophm, yeah, i'm doing PHP at work now .. it's clumsy :P .. will switch to Clojure there soon though :)
08:23manutteroh, envy. We're stuck with PHP for the duration. I'm trying to find ways to squeeze it in though.
08:31lnostdal-laptopok, gotta go .. cya later, and thanks!
08:45kephaleI 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?
08:46kephaleCurrently I just have a file that enters the namespace and loads/overloads all the definitions with my versions
08:46clgvkephale: sounds like a really strange approach
08:46kephalebut that leads to order-dependent use flags
08:47kephaleclgv: yeah its really awkward
08:48clgvwhat exactly do you have to adjust?
08:49kephalethere 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
08:49raekkephale: sounds like you should consider making a fork or talking to the author
08:50raekkephale: technomancy's robert.hooke could be possible to use too
08:50kephaleraek: 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
08:51kephaleI'll look into robert.hooke though, not familiar with that
08:51raekhttps://github.com/technomancy/robert-hooke
08:51raekit allows you to add hooks to other people's functions
08:52raekand you can override the original behavior
08:52kephaleOooooOooo
08:52kephalehot tip!
08:52raekmight not be very stable to do this on private defs, though
08:54kephaleI'll risk it : P
08:55clgvkephale: but displaying statusinfos hardwired sounds like a not so good design decision anyway
08:56clgvkephale: mybe you can talk the author into providing them via optional parameters or something like that...
08:56kephaleclgv: 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.
08:58kephalesome 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
09:02void_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.
09:02void_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.
09:02void_How do you people solve this? In Rails/whatever you would just set an ivar with the data and display it.
09:04manutterwhat's an ivar?
09:04Vinzentvoid_, 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)
09:04void_manutter: instance variable
09:04manutterah, gotcha
09:05void_Vinzent: well, the problem is, data is not needed by view, but by layout
09:05void_so if layout was added by middlewere, how would I pass it data?
09:06void_as a temp solution, layout just takes data from db
09:07timvisherhey all
09:07timvisheranyone familiar with clj-http or a related technology?
09:07timvisheri'm getting a response from http://interfacelift.com/wallpaper/details/2608/venice.html that surprises me
09:07timvisherthe body has nothing but '\n' in it
09:08timvisherit works with on google but google doesn't start it's body with \n
09:08timvisherwondering if this is a known behavior
09:08Vinzentvoid_, ah! don't know, I think I'd just split it into 2 functions
09:09manuttertimvisher: are you setting a user-agent header? The interfacelift.com may be mistaking you for a bot and sending you an empty body
09:09timvishermmm
09:10timvisherthat sounds highly likely
09:10clgvmanutter: then it's actually not "mistaking him for a bot", isnt it? ;)
09:10void_try curl ?
09:10manutterwell, for a certain kind of bot, I mean. You know--badbots.
09:11clgvlol :D
09:12timvishervoid_: do you know the curl command off the top of your head that shows the body?
09:12timvisherI'm getting 'data not shown' where I would expect to see the body
09:12void_I mean just command line curl
09:13void_it shows body by default
09:13manutterIf curl is giving you "data not shown" then you're probably getting back binary data
09:13void_well, look
09:13void_vojto ~ $ curl "http://interfacelift.com/wallpaper/details/2608/venice.html&quot;
09:13void_vojto ~ $
09:13void_just empty
09:14manutterI think you need to see the headers, particularly content-type and content-length
09:14void_-i
09:15timvishervoid_: that's what I thought. So it seems manutter is probably right
09:15timvisheri'll mess around with the headers i'm sending
09:18timvisherwell. 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...
09:21timvisherany guesses? https://gist.github.com/1022749
09:21timvisherthis is killing my ability to develop...
09:22manutteryou've rebooted your system since you started getting those errors?
09:23timvishernope
09:23timvishertry not to knee-jerk re-boot. Makes me feel like a windows user. ;)
09:23timvisherwhat would that affect though?
09:23timvisherI've completely deleted and reinstalled slime a few times
09:23manutterYeah, I know what you mean. The error text seems like it's having network issues
09:24timvishermmm
09:24timvisherok
09:24manuttermaybe there's a bad socket stuck somewhere?
09:24timvisherwell i shall bring my uptime back to 0 and see if that helps :)
09:24timvisherthanks1
09:24timvisherthanks!*
09:24manutterI don't know if that's even possible, but I'd knee jerk here :)
09:32timvisherboo
09:32timvisherrestarting brings no change
09:32manutter:(
09:33manutterdamn windows users...
09:33timvisherlol
09:33clgvtimvisher: that was the remaining windows user portion in you that had this foolish hope ;)
09:34timvisherso what can i do to debug this?
09:34timvisherit seems to be related directly to what I'm attempting to print
09:34timvisheri can execute and display most things find
09:34timvisherfine*
09:35raektimvisher: that looks really scary... why do you get HTML from some site with amazon ads in your swank-clojure socket stream?
09:35manutterok, so something is coming through the data channel that's making it choke
09:35timvisherbut 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
09:36timvisherraek: I agree. I think i'm already being a really bad internet citizen and claiming to be chrome when I'm not
09:36manutterare you using CDT at all?
09:36timvisherI just want to verify that it works before I do it right.
09:36timvishernot intentionally
09:36raektimvisher: are you runing a web server on the computer?
09:36manutterheh, that's true, *good* internet citizens only claim to be Mozilla when they're not.
09:37timvisherraek: I sometimes do
09:37timvisherbefore Friday that never seemed to cause an issue.
09:37timvisherI'm not running it right now
09:37raekcurrenlty?
09:37raektimvisher: which OS, btw?
09:38timvisheros x 10.6.7
09:38raeklooks like malware that injects popups in all socket streams or something...
09:38timvisherraek: ah, you're saying that it may not be in the interfacelift stream at all?
09:38timvisherhadn't even considered that
09:39manutterah, do you have google toolbar or something?
09:39raektimvisher: erh. you were using a http client. then it makes more sense...
09:39raektimvisher: I think this could be an encoding issue
09:39timvisherraek: it's in the view source when I get the page from Chrome
09:40raek(didn't read the whole problem...)
09:40timvishermanutter: I have a ton of crap, but I don't have google toolbar
09:40raektimvisher: try customizing the slime-net-coding-system to utf-8-unix
09:40timvisherQuicksilver?
09:40manutterthat's a thought--are you setting a character-encoding header in your client call?
09:40timvishermanutter: I am not
09:40timvisherbut in both of these cases I have utf-8 chars present
09:41timvisherat least I know I do in my app
09:41raektimvisher: what happens if you write the character "µ" in your repl?
09:41timvisherand it's possible that interface lift has it
09:41raekthe error you get is from Slime and not Clojure
09:42timvisherI get the same sort of error
09:42raektimvisher: then the problem is that Slime is configured for the wrong coding (swank used UTF-8)
09:43raektimvisher: you get the error when swank sends the result of your evaluation to be printed in Slime
09:43raeknad it contains a non-ASCII character
09:43timvisherthat appears to be the case
09:43timvisherslime-net-coding-system is set to iso-latin-1-unix
09:43timvisherso i should set it to utf-8-unix
09:43raekyup
09:44timvishershould i need to restart emacs for that or just slime?
09:44raekif (seq "åäö") in the repl returns (\å \ä \ö), then the coding is set up right
09:44raekdunno, try "re-jack-in"
09:47timvisherYou guys are the best! :)
09:51raek"just another service provided by your friendly neighborhood Encoding-Man!"
09:55jweissquestion 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.
09:56jweissrather than quoted sexp
10:01manutterjweiss: sure, all you need to pass along is an anonymous function to be called when needed.
10:48Dranikdid anyone found the solution for problem of displaying the unicode symbols in the ring-webapp?
10:58VinzentDranik, 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:01raekDranik: 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:01Dranikraek: how can I set that with Compojure?
11:02Dranikvoid_, hello!
11:02raekDranik: when you return a response, you simply add it in the :headers map of it
11:02Dranikhow did you fix the problem with unicode?
11:02Dranikraek: thanks, I'll try that...
11:03raekDranik: you can use the ring util function 'content-type', which makes this a bit shorter
11:08void_Dranik: Did it work?
11:08void_I was stuck with it, because I used Content-type instead of Content-Type :)
11:08void_but it's very simple
11:10Dranikvoid_, still trying
11:11Dranikvoid_, I can't get it. the function (content-type) works with the response, but I render a request
11:11Dranikhow can I set the content type in the request?
11:11void_you don't set content type in request
11:11void_you want to change response
11:11void_you render string/html/whatever to the response
11:12Dranikvoid_: could you please show me an example?
11:12void_I just return this instead of string with html
11:12void_{:status 200 :headers {"Content-Type" "text/html; charset=utf-8"} :body body}
11:12void_while body is whatever html you want to render
11:12void_I wrote a function that I call manually from controller functions
11:12Draniklet me try....
11:12void_of course it would be smarter to wrap it in middleware or something, but I don't need that now
11:14Dranikyep, that worked! thanks!
11:15raek(use '[ring.util.response :only [response content-type]) (-> the-html (response) (content-type "text/html; charset=utf-8"))
11:16Dranikraek: and how to do that for both request and response?
11:19raekDranik: 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:20raekthere is also a Content-Type header in the request, bit that is for the payload the client sends with a POST request
11:20Dranikok, let me try...
11:21raekGET parameters are always in UTF-8, so you don't need to specify any coding for them
11:22raeks/something you give/the client gives/
11:22raekno, scratch that
11:22raekI misread my own utterance :)
11:22raekit was fine
11:23Dranikraek: something is wrong with your code. I've pasted it and it doesn't work...(((
11:26solussdCould 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:27raekDranik: sorry, there is a ] missing after "content-type"
11:28void_solussd: first time hearing about something called Conjure
11:28raekhttp://clojuredocs.org/ring/ring.util.response
11:29void_but it looks nice Conjure is a Rails like framework for the Clojure programming language
11:29void_https://github.com/macourtney/Conjure
11:29Dranikraek: Unable to resolve symbol: the-html in this context
11:31Vinzenti guess you should replace it with your html code or whatever you want to send to the outup
11:32Vinzentvoid_, I prefer compojure because it's much simplier and more "clojurish" (but i have no experierence with conjure, just read throught the wiki)
11:35raekDranik: sorry, "the-html" was a placeholder for the html code you generate
11:36raekDranik: you could use "<h1>åäö</h1>" to test with
11:38Dranikraek, Vinzent: finally I've got that! thanks
11:38raekDranik: 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:40raekI 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:46Dranikraek: thanks
11:46VinzentDranik, 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:47DranikVinzent: I dunno, I've just tried to put cyrillic symbols and had ???????? string instead normal letters
11:48VinzentDranik, interesting... I've only have problems with codepage in earlier versions of leiningen
12:01DranikVinzent which version of leiningen and compojure do u have?
12:10chas1
12:19VinzentDranik, sompojure 0.6.3 and lein 1.3.1, with standard set of middlewares (params, public, etc)
12:22gfrlog$google sompojure
12:22sexpbotFirst out of results is:
12:23manutter$google typo
12:23sexpbotFirst out of 3550000 results is: Typographical error - Wikipedia, the free encyclopedia
12:23sexpbothttp://en.wikipedia.org/wiki/Typographical_error
12:23clgvlllol^^
12:25gfrlogThe important thing that we've learned is that "Sompojure" is an available project name :)
12:26clgvgfrlog: if there is no trademark on it, then compojure is available as well ;)
12:27DranikVinzent: my compojure is 0.6.2 and lein 1.4.2
12:27gfrlogW000! time to make me some moneys
12:27Cozey hi. will jetty 7 be supproted by ring?
12:27gfrlogI see somebody is already squatting on compojure.com
12:47edwIf 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:59TimMcedw: Who is consuming it?
13:04jweissis 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:06clgvjweiss: 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:07jweissclgv: i guess defn must do it so i could steal pieces of it, right
13:07amalloyjweiss: defn doesn't do it
13:07jweissamalloy: no? how does clojure.repl/source-fn get it?
13:07clgvjweiss: your only option to access code of a function is to intercept the function definition with a macro
13:08jweissbacktracks to an actual source file?
13:08amalloy&(-> first var meta (juxt :line :file))
13:08sexpbot⟹ #<core$juxt$fn__3663 clojure.core$juxt$fn__3663@1a281b4>
13:08amalloyhm
13:08technomancyjweiss: https://github.com/Seajure/serializable-fn sorta
13:08amalloy&(-> first var meta ((juxt :line :file)))
13:08sexpbot⟹ [48 "clojure/core.clj"]
13:08jweissclgv: ok, that should be pretty straightforward, i hope
13:10clgvjweiss: technomancy's link could be a start afair
13:10edwTimMc: 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&gt;.
13:10jweissclgv: technomancy: yup that's pretty much it. thanks
13:14amalloywhat 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:14technomancyit has some issues about only working with closures over certain types of expressions
13:15technomancypatches welcome
13:17clgvamalloy: good question. copy&pasting the part from defn is really fragile (and copy&paste ;) )
13:18Vinzentthere is name-with-attributes
13:18Vinzentin contrib
13:25amalloyVinzent: good find. that seems to handle the most common cases; with this around it seems like the real thing might not be needed
13:26amalloyeg it doesn't read/set :arglist meta for you, but mostly that's probably unnecessary
13:28clgvamalloy: 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:38mvakilianHi everyone!
14:38mvakilianI'm Mohsen Vakilian, a PhD student working with Prof. Ralph Johnson at the University of Illinois at Urbana-Champaign (UIUC).
14:38mvakilianRalph 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:38mvakilianOur team <http://codingspectator.cs.illinois.edu/People&gt; is studying how developers interact with the Eclipse IDE for evolving and maintaining their code.
14:39mvakilianWe have noticed that some of the people in the Clojure community do Java programming, e.g. developers contributing to counterclockwise.
14:40mvakilianTherefore, we'd like to invite you to our research study on Eclipse, and would greatly value your help.
14:40mvakilianTo participate you should be at least 18 years old and use Eclipse Helios for Java development.
14:40mvakilianAs 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:40mvakilianCodingSpectator monitors programming interactions non-intrusively in the background and periodically uploads it to a secure server at UIUC.
14:40mvakilianTo get a representative perspective of how you interact with Eclipse, we would appreciate if you could install CodingSpectator for two months.
14:40mvakilianRest assured that we are taking the utmost measures to protect your privacy and confidentiality.
14:40hiredmanmvakilian: buzz off
14:42offby1odd. Not really spam; not trolling, probably well-intentioned ... yet nevertheless out of place
14:42hiredman^-
14:42mvakilianSorry for interrupting you guys.
14:42mvakilianI tried posting message to the mailing list but it didn't get approved.
14:43mvakilianI couldn't find another channel to invite Clojure developers to our study.
14:43midsnext time try communicating your message without pasting a wall of text; it could have been a one liner
14:44hiredmanyour first post to the mailing list can take sometime to get approved
14:44manutterI 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:44mvakilianI'd hang around just in case some of you are interested in helping our study and have questions.
14:44offby1mvakilian: yes: a one or two line summary would surely have been better received.
14:44manutterI don't think people object to the topic so much as the volume of text
14:44offby1mvakilian: but it's obvious that you're well-intentioned, so ... no harm done
14:45mvakilianI sent my message to the mailing list on 6/11/2011.
14:45clojurebotNo entiendo
14:46manuttershush clojurebot nobody's talking to you.
14:46mvakilianThere 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:47manuttermvakilian, did you get back a rejection notice or just not get a response?
14:48mvakilianmanutter: I didn't get any response.
14:48manutterMight be lost in the backlog or might have gotten mistaken for spam
14:49manutterYou 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:50manutteroh, you'll need to include a shortened URL in that tweet too
14:50mvakilianmanutter: Nice suggestion. We'll do that.
16:12SomelauwHi for some reason I really need to think when I'm trying to indent lisp code.
16:19Somelauwyes, but I also don't know when to hit enter
16:20SomelauwSo should your code be as short in length as possible or as small in width.
16:20SomelauwAnd I never got the hang of Emacs.
16:21SomelauwSo I use cake in terminal + vim.
16:30tremoloSomelauw: Code should never be wider than 80 chars. This is law.
16:42grantmoccasionally, 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:46bartjgrantm, can you post your stack trace somewhere ?
16:46bartj*you
16:46grantmsure; although i actually figured it out - i was more hoping for general strategies
16:47SomelauwI made it a stackoverflow question: http://stackoverflow.com/questions/6335886/how-to-properly-indent-clojure-lisp
16:50grantmbartj: http://pastebin.com/ggFBX1F5
16:52bartjgrantm, I prefer and think the best way to have a look at stack traces is to look from the bottom
16:52grantmhm, okay
16:52bartjso in your case, it would be either in game.test
16:52grantmbartj: how do i get the rest of the trace?
16:53bartjalso, it is preferable to look at *your* code first for errors
16:53grantmright :P
16:53grantmactually you're right... i didn't even notice the game.test.core stuff
16:53bartjie. ignore all clojure.* libraries first
16:53grantmyeah
16:54bartjall the best with your clojure game (?)
16:54grantmthanks ... haha yup :P
16:55grantma game is my first project in any new language
16:57technomancyhas anyone ever used derive outside the context of multimethods?
16:57technomancy(not looking for help with a problem, just genuinely curious if it's a thing people do)
16:57bdeshamspeaking 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:58grantmbdesham: we should talk :P
16:59bdeshamgrantm: :)
17:01grantmbdesham: 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:07bdeshamgrantm: neat. I'll have to take a look when I get a chance :)
17:08grantmbdesham: cool :) be sure to point me towards any cool stuff you make
17:09bdeshamwill do. I'm planning to put my project on github as well, once it's reached at least beta quality
17:10grantmsounds much further along than mine ;)
17:10grantmwhat kind of game is it?
17:11dnolenbdesham: 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:15bdeshamkind of an arcade/puzzle game
17:15bdeshamnot particularly graphics-heavy, but a little challenging... it's my first game, and my first big clojure project
17:16grantmnice! clojure is an interesting language choice for your first game :)
17:17void_bdesham: I really like Mire, the one from Peepcode screencast
17:17bdeshamI 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:17bdeshamturned out to be a weird choice, yes ;-)
17:17void_https://github.com/technomancy/mire
17:17void_ach technomancy wrote this too
17:17bdeshamdnolen: void_: thanks for the links
17:18bdeshamha, along with leiningen? pretty impressive repertoire right there
17:18grantmwow, mire is pretty interesting
17:23amalloybdesham: technomancy wrote a lot of things
17:24amalloyi guess "wrote" is wrong cause he keeps going. "has written"
17:27jcromartieI'm playing with markov chains here https://gist.github.com/1023496
17:28jcromartiemy markov-next function actually returns the next *chain*
17:28jcromartieand so markov-seq returns a seq of chains
17:28jcromartiethey are mostly redundant, like ["one"] ["one" "two"] ["one" "two" "three"]
17:29jcromartieI'd really just like an infinite seq of words
17:31jcromartiegm
17:31jcromartiehm
17:31jcromartiegot it :) map + iterate
17:32amalloyjcromartie: rand-nth already exists
17:32jcromartieoh cool
17:33seancorfieldand there's map-indexed - in case you're just doing (iterate inc 0)
17:34jcromartie"man is vanity and vexation of his belly and the king shall be unclean seven days"
17:34jcromartieseancorfield: no, (map last (iterate gen-next-chain init-chain)) here https://gist.github.com/1023496
17:34brehaut,(map #(take 4 %) [(range) (iterate inc 0)])
17:34clojurebot((0 1 2 3) (0 1 2 3))
17:35brehautseancorfield: is there a subtle reason you wouldnt use range? chunking?
17:36seancorfieldbrehaut: i've seen (map f (iterate inc 0) some-seq) quite often so i was thinking of that
17:36seancorfieldit wouldn't really matter whether they used (range) or (iterate inc 0) in that case
17:37seancorfieldmap-indexed would still be better
17:37brehautoh for sure
17:37amalloyseancorfield: (iterate inc 0) made sense before (range) existed, i think
17:37amalloy(iterate inc 10) still makes sense since there's no way to give range a start point and no endpoint
17:37seancorfieldyup
17:38seancorfieldjcromartie: if you just want to flatten your seq of chains, you could just apply concat to it
17:39jcromartienot really
17:39seancorfield(apply concat seq-of-vectors)
17:39amalloyjcromartie: i did some work on a markov chainer for sexpbot months ago
17:39jcromartieeach successive chain includes the priors
17:39jcromartieupdated again: https://gist.github.com/1023496
17:39jcromartieI think it's good
17:39seancorfieldyeah, just looked and saw map last ...
17:40amalloyit'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:40seancorfieldthere's always so many ways to solve problems :)
17:40amalloyseancorfield: there's more than one way to do it…think we should steal the perl slogan?
17:42seancorfieldlol... didn't know that was perl's m.o. :)
17:42seancorfieldhave you moved to LA yet?
17:42amalloyyep. i can hit lancepantz or ninjudd with a stick if they annoy me
17:42seancorfieldenjoying the city of angels?
17:42amalloyor at any rate i'm close enough to. didn't think to put that in my contract though
17:43amalloyseancorfield: the city is eh. i like my apartment and the new job though
17:45brehautamalloy: 100% less php?
17:47amalloybrehaut: yeah, and that seems unlikely to change
17:47brehautawesome :)
17:48bdeshamI'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:48bdeshamor should I be using a sorted map or something like that
17:52[mattb]user=> java.lang.ClassNotFoundException: clojure.contrib.math-functions
17:52[mattb]:(
17:53[mattb]er
17:53[mattb]user=> java.lang.ClassNotFoundException: clojure.contrib.generic.math-functions
17:53amalloybdesham: ew
17:53bdeshamhaha
17:53amalloy(into {} (for [[k v] m] [k (f v)]))
17:54amalloyyour way is safe but is both inefficient and hard to read
17:55void_how do I get integer value from a string?
17:55the-kennyInteger/parseInt ?
17:55void_thanks
17:55the-kennyI'm not sure if this is the best way, though
17:55kephalevoid_: or read-string
17:55kephaleparseInt is probably faster though
17:56bdeshamamalloy: ok, thanks!
17:56gfrlogI switched to clojure because I wanted a language where :-D was a valid expression.
17:57amalloyint D = 1; int x = false ? 0 :-D;
17:58gfrlogoh; nevermind then. big waste of time this was.
17:58bdeshamlol
17:58gfrlogno wait
17:58gfrlogthat's just a part of the expression
17:58gfrlog:-D still doesn't stand on its own
17:58gfrlogin clojure it's not just an expression, it's a dang function
17:59bdesham,(class :-D)
17:59clojurebotclojure.lang.Keyword
17:59amalloygfrlog: in java nothing stands on its own. you have to wrap anything in at least two layers of {}s before it feels comfortable
17:59gfrlogamalloy: yeah but there are still some things that are expressions...like literals and arrays and such.
18:00gfrlogyou couldn't ever say
18:00gfrlogFeeling myFeeling = :-D ;
18:06void_&:-D
18:06sexpbot⟹ :-D
18:06void_&:-(
18:06sexpbot⟹ :-
18:06void_&:-'(
18:06sexpbot⟹ :-
18:06bdesham,(keyword ":-)")
18:06clojurebot::-)
18:06bdeshamoops
18:06bdesham,(keyword "-)")
18:06clojurebot:-)
18:06void_ha you can skip :
18:06bdeshambut of course, never do that ;-)
18:07void_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:08void_I'm putting it into my controller namespace. (I have two namespaces, one for view-related code, one for controller.)
18:08brehautvoid_: you still have a model layer; its just functions that operate on the model
18:09void_Ok I see.
18:09void_So to make it fit nicely with what I have, I would probably create new namespace containing functions to deal with the model.
18:09brehautvoid_: IMO the major difference between an OO MVC and a FP MVC is how hard you try to push pure functional code
18:09void_pure functional = doesn't change any state, right?
18:09brehautcorrect
18:11void_Functional is fun! ;)
18:11void_&(keyword ":)")
18:11brehautbut sometimes challenging ;)
18:11sexpbot⟹ ::)
18:11void_&(keyword ")")
18:11sexpbot⟹ :)
18:11void_lol
18:11void_love this :D
18:15amalloyuhmmmm no offense but you can /msg sexpbot instead of spamming the whole channel with emoticons
18:17gfrlogbut 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[mattb](use clojure.contrib.generic.math-functions)
18:27[mattb]neither use nor require works
18:27amalloy[mattb]: is this inside an (ns) form or bare at the repl?
18:27[mattb]bare
18:27bdeshamtry (use 'clojure.contrib.generic.math-functions)
18:27amalloy'clojure....
18:27amalloythat is, quote it
18:27bdeshamif you're at the repl
18:28[mattb]aha
18:28[mattb]filenotfoundexception
18:28[mattb]closer...
18:28amalloyyou're using lein or cake, i hope?
18:29[mattb]erm...
18:29void_amalloy: sorry didn't mean to spam
18:30amalloy[mattb]: if that question is confusing, you're probably not using one of them
18:30[mattb]haha yeah I'm reading now
18:30amalloysrsly use one. doing all the classpath stuff from the command line is so painful
18:30amalloy$google raynes get started clojure
18:30sexpbotFirst out of 619 results is: An indirect guide to getting started with Clojure » Bathroom ...
18:30sexpbothttp://blog.raynes.me/%3Fp%3D48
18:30amalloygod damn
18:30amalloyblog.raynes.me?p=48
18:31Raynesamalloy: Hah hah, haw.
18:31[mattb]lol thanks
18:31amalloyRaynes: plz find and fix the bug that makes sexpbot print that url wrong
18:32amalloyor eventually i'll remember to stop telling people to read it
18:32Raynesamalloy: Hehe.
18:32Scriptordamnit, emacs isn't smart enough yet to recognize .me urls
18:33brehautquick! mass exodus to vim!
18:33[mattb]lol
18:33[mattb]I took the time to learn vim
18:33amalloyScriptor: 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:34Scriptor[mattb]: heh, that's what I've been doing
18:35[mattb]I don't have the patience anymore :(
18:35amalloyESC :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[mattb]I don't have the luxury of playing with tools
18:35Scriptorah, for me I just figured out the basics while using it for irc
18:36[mattb]heh
18:36[mattb]you run an IRC client in your EmacsOS?
18:36amalloyM-x erc
18:36amalloyi forget if it's built-in or i had to install a package
18:37technomancyamalloy: there are _two_ IRC clients built-in to Emacs
18:37amalloynice
18:38amalloyi'm not sure i could bear to have only one
18:38ScriptorI 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[mattb]sadly :(
18:38[mattb]well, not the only thing, but the big thing
18:39Scriptordidn't someone make a slime plugin for vim?
18:39seancorfieldanyone 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:39Scriptorwith nailgun or something like that, at least it comes with vimclojure
18:40amalloyseancorfield: Raynes
18:40Raynesseancorfield: Probably needs a good ol' restart.
18:40Somelauwhmm, is there a clojure idle for people like me who can't handle emacs? (Like drracket for scheme)
18:40RaynesI'll do that in a moment.
18:40seancorfieldthanx Raynes - i wanted to point some folks to it who are new to clojure
18:40Raynesseancorfield: Cool. I'll ping you when I have it restarted.
18:41ihodesSomelauw: try Eclipse and ccw http://code.google.com/p/counterclockwise/
18:41ihodesSomelauw: i haven't tried it out, but i hear good things
18:42Raynesseancorfield: Should be good to go. Let me know if you have any more problems.
18:42SomelauwOr what I actually want is a clojure debugger?
18:42seancorfieldthanx Raynes - looks snappy now!
18:43amalloySomelauw: ccw may have something, but most of the work on clojure debuggers is going into swank/slime
18:43Somelauwihodes: I will try it, thanks
18:43ihodesSomelauw: 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:43SomelauwAnd swank/slime can only be used with emacs?
18:43Raynesseancorfield: 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:44amalloySomelauw: well, slime is part of emacs. you could write a slime client for something else
18:44ihodesSomelauw: yeah, slime is in emacs. unless someone's ported it to other places. not AFAIK
18:44amalloyswank 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:44ihodesSomelauw: what amalloy said.
18:45amalloybut i think writing slime clients is not easy :P
18:45ihodesamalloy: take one look at the code. it's terrifying.
18:45brehautnothing like reverse engineering a moving target
18:45SomelauwSo if I don't learn emacs I am doomed?
18:45ihodesbrehaut: by the way, thanks for yoru nice ring ecosystem writeup. best overview i've read of the stack.
18:46ihodesSomelauw: not at all!
18:46RaynesNo, 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:46ihodesSomelauw: for e.g. cemerick uses ccw.
18:46brehautihodes: thanks :)
18:47brehauti 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:47ScriptorSomelauw: emacs isn't all that hard, to be honest, once you have slime set up it's fairly straightforward
18:47RaynesIsn't CCW working on supporting CDT?
18:47RaynesI can't keep up with those things.
18:47amalloyi still haven't gotten around to trying swank-clj
18:48amalloybut it's true, you don't need a debugger that badly
18:48RaynesI have my very own debugger: (fn [x] (prn x) x) ; :)
18:48the-kennylein swank && M-x slime-connect RET ftw
18:48amalloywith a functional language, if your code compiles and the data that comes out is roughly the right shape, the function probably works
18:48amalloyRaynes: #(doto % prn)
18:49hiredmanthe-kenny: latest clojure-mode and swank-clojure shorten that to just M-x clojure-jack-in
18:49Raynes#(or (prn %) %)
18:49ihodeshiredman: WHAT!?
18:49the-kennyhiredman: Oh, good to know. My installation is really outdated
18:49Scriptorhiredman: really? Awesome, I don't have to keep doing M-x shell every tmie
18:49Scriptor*time
18:49hiredmanthe latest clojure-mode has bits to read elisp out of jars, so you don't even need slime installed
18:49ihodesi 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:50hiredmanclojure-mode pulls a copy of slime.el out of the swank-clojure jar and loads it
18:53Scriptorbtw, has anyone here read purely functional data structures and done the exercises?
18:59ihodesScriptor: it's on my list... it looks so cool. i'm betting a lot of people who're idling have read oit
19:01Scriptorit looks awesome, but I really need to get around to reading more than the first few pages
19:02Scriptorthere're a couple of blog posts about clojure's vector and hashmap implementations that are pretty good though
19:04bdeshamhehe... http://plope.com/Members/chrism/oss_sarcasm
19:05Scriptorthat page speaks to e
19:08cemerickSomelauw: 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:09cemerickWhich reminds me, I totally fell down today, not posting the new state of clojure survey.
19:09cemerick:-(
19:10cemerickAny last-minute suggestions for questions, etc? http://cemerick.com/2011/06/10/state-of-clojure-2011-what-questions-do-you-have/
19:10cemerickRaynes: CDT? C Development Toolkit?
19:10Raynescemerick: Sure.
19:10amalloycemerick: oh yeah, questions
19:11cemerickRaynes: What part of it would it support? Seems entirely orthogonal to me.
19:11amalloyclojure debugging toolkit
19:11Raynescemerick: Clojure Debugging Toolkit, or whatever it's called.
19:11amalloydon't let Raynes's vague "sure" confuse you
19:11RaynesI think you might need another cup of coffee, Chassy.
19:11cemerickah-ha
19:11cemerickI've never used CDT, so I didn't flash on it.
19:11amalloycemerick: one i thought of: "when you evangelize clojure to others, what excites them? what worries them"
19:12cemerickYes, CDT integration is in the TODO list. Big job.
19:12bdeshamcemerick: "did you find clojure to be a newbie-friendly language/community? if not, what could we improve?"
19:12cemerickI probably have my hands full with more REPL and editing enhancements.
19:12bdeshamsomething along those lines
19:13cemerickDebuggers are great, but there's still a ton of tasty lower-hanging fruit to nab.
19:13Raynescemerick: Yay! Survey! Now I'm never going to get any work done.
19:13amalloyRaynes: you only have to fill it out once
19:13Scriptorcemerick: this might go under current usage, but somethign about how easy it is to find libraries
19:13hiredmanyegge says he is writing a debugger
19:13Scriptoror start a new project
19:13Raynesamalloy: Yes, but I'll do it slowly.
19:14cemerickhiredman: didn't he say that right after saying that he's not aware of what's out there already?
19:14amalloyhaha
19:14hiredmancemerick: seems likely
19:15cemerickamalloy: that's a good one
19:15brehautman, rhino on rails. lookin forward to that
19:15RaynesYegge says lots of things. Lots of confusing indecisive things, sometimes. :<
19:15cemerickbdesham: I think that's probably covered by the general "what can we do to improve things over the next year" write in. :-)
19:15amalloycemerick: 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:15cemerickRaynes: easier to claim you were right later on! :-P
19:16Raynescemerick: 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:16cemerickamalloy: Ah, home sweet home :-D
19:16technomancycemerick: "how likely are you to use Clojure from the command-line?" maybe?
19:16cemerickRaynes: tomorrow morning, I think.
19:17technomancyor rather, would you want to if the situation were to improve?
19:17RaynesAh, cool. Even better. I'll look for it then.
19:17cemericktechnomancy: That's a tricky one to word so that the responses won't be biased. :-)
19:17Scriptorcemerick: another one, "is Clojure your first choice for a new project, if not, why?"
19:18cemerick"Would you like a hoverboard, if it existed?" YES!!!!
19:18technomancyprobably true
19:18Raynescemerick: Of course.
19:18bdeshamcemerick: ok, fair enough :)
19:19cemerickScriptor: 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:19kephalecemerick: not if i can have a flying scooter
19:19bdeshamI'm using C++ for a project right now... oh god, how I wish I could use clojure
19:19technomancy"Have you noticed Clojure's command-line support is not that great? (A) Yeah, what's up with that? (B) What?"
19:20Scriptoranyone have any inspiration for a clojure project idea? Trying to find something solid to learn with
19:21cemericktechnomancy: ha :-)
19:21tremoloScriptor: how about a twitter client
19:21cemericktechnomancy: Best make sure you have a good answer if 95% choose (a). ;-)
19:21tremolotwitter clients are the hello world du jour
19:22tremolonext up: key/value stores
19:22bdeshamtremolo: haha
19:22cemericktechnomancy: I think the real deal would be to reimplement java.exe et al.
19:22Scriptorheh, I've had the weirdest hello world projects
19:22hiredman"do you use clojure for distributed(multiple computer) parallel/concurrent work"
19:23hiredmanwhat's a .exe?
19:23Scriptora java compiler in clojure?
19:23brehauthiredman: virus vector
19:24technomancycemerick: not totally crazy: http://hashdot.sourceforge.net/
19:24Scriptoroh, java, not javac
19:25hiredmanScriptor: a compiler would be much easier
19:25cemericktechnomancy: so that's normalizing java's behaviour for scripting — nothing to do with startup times and such, right?
19:26Scriptorhiredman: true, most of the optimizations happen at runtime, iirc
19:26technomancycemerick: right. I guess it's only half the story.
19:27technomancy(the half that's possible?)
19:27technomancystartup time improvements are probably only feasible via large cash bribes to Oracle execs.
19:28technomancy"Please stop pretending the Client JVM doesn't exist. Sincerely, Twenty Thousand Dollars."
19:29hiredman$20k?
19:29clojurebot$what is love
19:29sexpbotIt's AWWWW RIGHT!
19:29Somelauwokay thanks, I think I will try ccw and maybe one day try to setup emacs + swank again.
19:29cemerickMost 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:30cemerick</speculation>
19:32technomancyhiredman: that's the frequent customer discount
19:33cemerickSomelauw: if you have any troubles, post on the -users ML :-)
19:34hiredmantechnomancy: part of a payment plan?
19:51carllercheIs there literal syntax for java longs?
19:52carllerche(trying to call a java method that requires a long from clojure)
19:53brehautcarllerche: (long 1) ?
19:54carllercheThat's a cast no? I guess it doesn't matter
19:54seancorfielduse type hinting?
19:54seancorfield^long 1
19:55seancorfield(or use clojure 1.3.0 :) )
19:55carllercheseancorfield: using ^long gives me an "Unable to resolve classname: long" error
19:55carllercheis clojure 1.3.0 out?
19:56seancorfieldalpha 8 is available
19:56hiredmanseancorfield: seriously? ^long 1? are you for real?
19:57seancorfieldi didn't actually try it *feeble smile*
19:58seancorfieldi was just thinking about type hints in calls to java methods
19:58hiredmanseancorfield: if you needed to try then you need to spend more time reading docs and reading code
19:58brehautcarllerche: 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:58hiredmanit is obvious it cannot work if you actually understand what ^ does
19:59seancorfieldno need to be snippy
19:59ihodeshiredman: whoa whoa, be calm
19:59ihodeswe're all friends here
20:01Scriptorthat's also on my reading list
20:01brehautScriptor: the first 100 pages of the first book are a bit tedious, it gets great after that
20:02ihodesi'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__name__‘American Tolkien’ got me interested.
20:05ihodes__name__: if the TV show is any indication (and i hear the books are better), then hell yes.
20:05Scriptorihodes: Wise Man's Fears? Great book
20:05ihodesScriptor: so far, it's absolutely fantastic.
20:05seancorfieldhiredman: 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:06hiredman^long 1 cannot work in any version of clojure
20:06seancorfieldnow that i think about that, it's clearly the case - and i understand why...
20:07hiredman^long 1 tells the reader to use {:tag long} as metadata on the following form
20:07hiredmannumbers do not support metadata
20:07seancorfieldi did not expect such an attack for a mistaken suggestion, however
20:07hiredmanattack?
20:07seancorfieldclearly others felt you were harsh as well
20:07hiredmanothers can feel what they like
20:09ihodeshiredman: seancorfield: let's just all talk abotu fantasy books for a spell. or just how awesome Enlive is?
20:10seancorfieldsquirrel! :)
20:10__name__ihodes: Thanks.
20:12ihodesseancorfield: hell yes.
20:13hiredmanthe 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:14seancorfieldcarllerche: 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:14seancorfieldhttps://github.com/clojure/clojure/blob/master/changes.txt changes from 1.2 to 1.3 alpha 8
20:14carllerchepossibly, I ahven't looked at 1.3 yet at all
20:14carllercheI'll look in a sec
20:15carllerchethanks for the tips
20:15seancorfieldhiredman: maybe we can buy each other a beer at the conj and be less incredulous :)
20:16hiredmanpossibly
20:16Scriptoreven better, if you guys are near nyc there's a potential meetup on wednesday
20:19hiredmanwe're not, and I don't drink, so either way we'll just have to work something out
20:29dnolenmake your own Watson in Clojure, core.logic gets Definite Clause Grammar support https://gist.github.com/1024087
20:31grantmhey 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:32grantmin 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:33brehautgrantm: 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:33brehautgrantm: and then just redef the var
20:34hiredmangrantm: there are some swing constants you set on the jframe which control what happens when you close the window
20:34grantmthe problem with just typing stuff in is that i can't (there's no repl prompt)
20:34brehautgrantm: eg (defn handler [r] {:body "hello, world", :status 200}) (run-jetty #'handler)
20:34hiredmanyou run your loop in another thread
20:34grantmahh, i see!
20:35brehautgrantm: (future some-expression) will run it on a background thread
20:46dnolensum total code for DCG syntax support in core.logic ... 60 lines.
20:47clojurebotchouser: 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:48dnolenwith DCG + tabling == packrat parser.
20:51brehautdnolen: that looks really interesting
20:52gfrlogbrehaut: is (future) a valid replacement for (.start (Thread. ...)) in all cases, or is there a pool that would get exausted?
20:52brehautgfrlog: im not the right person to ask sorry, but i dont _think_ they use threadpools up?
20:52amalloyi think futures use the agent threadpool
20:53brehautgfrlog: looking at the source to future-call (used internally by future) it uses clojure.lang.Agent/soloExecutur
20:53dnolenbrehaut: yeah would be fun to port this http://web.student.tuwien.ac.at/~e0225855/lisprolog/lisprolog.html
20:53brehautand the java.util.concurrent.Future
20:54brehautdnolen: hah awesome
20:55dnolenwith core.logic near SWI perf, core.logic should have good perf for many parsing tasks.
20:59brehautit would be nice to have more expressive parser tools available
21:01brehaut(not to disparage fnparse)
21:05dnolenthe 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[mattb]?
22:29brehaut#^ is prior to 1.2
22:29brehautor maybe 1.1
22:29brehautits the old meta notation anyway
22:30brehautotherwise identical
22:30brehaut(hiredman will probably correct me about now)
22:31[mattb]lol
22:31brehautim generally wrong when i make blanket statements like 'otherwise identical' :P
22:31brehautuse ^ anyway
22:32brehaut[mattb]: are you looking at (for example) the ants demo?
22:33[mattb]yup
22:33[mattb]so I'm sure you're right
22:38amalloybrehaut: i think there is some devious subtle difference in an edge case somewhere but i don't know what it is
22:40brehautamalloy: there was bound to be something
22:40amalloybrehaut: 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:40brehauthah ok
22:45[mattb]how the hell do you use (ints
22:46dnolen<[mattb]> ?
22:46[mattb]no matter what I give it it complains that it can't be cast
22:47[mattb]even (ints (into-array Integer for shits and giggles
22:48dnolen<[mattb]> a complex expression please.
22:50dnolen<[mattb]> sorry I meant complete.
22:50[mattb]I just want an int[] initialized from some sequence
22:50dnolen,(make-array Integer/TYPE 10)
22:50clojurebot#<int[] [I@462718>
22:50jcromartieint-array
22:50dnolen,(int-array [1 2 3])
22:50clojurebot#<int[] [I@18e546>
22:50[mattb]aha..
22:50[mattb]could have sworn I tried int-array
22:50jcromartie,((juxt type seq) (int-array [1 2 3 4 5]))
22:50clojurebot[[I (1 2 3 4 5)]
22:50[mattb]dammit, thanks
22:52[mattb]woot, works! thanks
23:18lonsteinI'm trying to convert an example to clojure that involves Java object literal syntax... new Foo( Bar.class )
23:18lonsteinbut not seeing an obvious way to do that. Is there an idiom other than going to the classloader?
23:24OneWhoFrogsHi 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:24brehautlonstein: what are you trying to accomplish with the object literal?
23:26lonsteinbrehaut: it's supplied to a constructor
23:27brehautlonstein: _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:28seancorfieldhiredman: so i'll buy you a non-alcoholic beverage of your choice at the conj then...
23:29lonsteinbrehaut: 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:31lonsteinin Java that would be along the lines of info = new DataLine.Info( Clip.class, stream.getFormat() )
23:34lonsteinis 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:35brehauti *think* that just referencing the class works
23:36lonsteinhrm.
23:37brehauti dont know how you would reference or import a nested class though
23:37brehaut,(type String)
23:37clojurebotjava.lang.Class
23:39lonsteintried it at the repl, hah, it works. that was simple. I assumed it couldn't work
23:40lonsteinthanks
23:45brehautno problem
23:45brehautsorry i was slow getting an answer
23:53lonsteinbrehaut: no, it's ok. I should have framed the question fully. I'm a bit tired
23:54lonsteinthanks
23:55brehautno problem; it does always pay to provide the details of what and why.