2012-02-11
| 00:00 | seancorf | $google clojure irc log |
| 00:00 | lazybot | [#clojure log - Feb 10 2012] http://clojure-log.n01se.net/ |
| 00:00 | seancorf | heh |
| 00:02 | seancorf | muhoo: did you solve your math.numeric-tower problem? |
| 00:03 | seancorf | i would have expected the dependency to look like [[org.clojure/math.numeric-tower "0.0.1"]] |
| 00:06 | Raynes | seancorf: http://lazybot.org/logs/#clojure/2012-02-10 :D |
| 00:08 | muhoo | seancorf: that worked, thanks! |
| 00:13 | seancorf | yay! :) |
| 00:13 | muhoo | here's what confused the hell out of me |
| 00:13 | muhoo | the namespaces make no sense |
| 00:13 | muhoo | (require 'clojure.math.numeric-tower) |
| 00:13 | muhoo | but (add-dependencies '[[org.clojure/math.numeric-tower "0.0.1"]]) |
| 00:13 | muhoo | so, why org.clojure/math.numeric-tower in one, and clojure.math.numeric-tower in the other? |
| 00:14 | seancorf | it's just the pattern used for (new) contrib libraries |
| 00:14 | seancorf | you have org.clojure/clojure but that contains clojure.set, clojure.java.io, etc |
| 00:15 | Raynes | muhoo: Also, namespaces are not what maven artifacts are named after. |
| 00:16 | seancorf | and you have congomongo as the artifact but you require somnium.congomongo so there's no direct correlation between artifact names and namespaces |
| 00:16 | muhoo | ah. different naming conventions. |
| 00:17 | muhoo | makes sense. |
| 00:18 | seancorf | clojure core and contrib is in the org.clojure group with a variety of artifacts, technically congomongo has congomongo/congomongo as its full name |
| 00:18 | seancorf | but, yeah, the whole maven artifact thing is confusing if you're not used to it (as i wasn't before i started doing clojure) |
| 00:19 | muhoo | yep, it's one of those things. thanks for explaining it. |
| 00:19 | muhoo | it's not too surprising after some thought. debian package names for language libraries often bear little resemblance to the actual namespace path inside the language itself. |
| 00:21 | Raynes | seancorf: What do you think of monger? |
| 00:25 | seancorf | Raynes: we use CongoMongo at World Singles so I haven't looked at monger... CongoMongo does exactly what we need: a thin wrapper around the MongoDB Java driver :) |
| 00:25 | Raynes | seancorf: I keep forgetting that pretty much everything you ever do is the result of something you needed at work. |
| 00:25 | Raynes | :p |
| 00:26 | Raynes | But yeah, monger looks neat. It looks 'prettier', but it also looks more macro-driven and heavy. |
| 00:27 | antares_ | Raynes: only query DSL (which is not the only way to query, regular finders are also there) uses macros. Take a look at the implementation, it is very straightforward. |
| 00:28 | Raynes | antares_: In that case, excellent. |
| 00:28 | Raynes | antares_: Are you the Monger guy? |
| 00:28 | antares_ | Raynes: the goal wasn't really to make it pretty but to make it feature complete and integrated with joda time, clojure.data.json and so on. I don't think monger will have many more DSLish features except for a fixtures framework. |
| 00:28 | antares_ | Raynes: I am |
| 00:29 | antares_ | Raynes: and each part is opt-in. We don't force you to use joda time integration, we don't assume it is available in other namespaces, we don't load query DSL automagically, etc. |
| 00:29 | Raynes | antares_: I'd like to move RefHeap to monger, if only just to try it out (I'd be very unlikely to not use my changes though), but the snapshots kind of kill that for me. Could you perhaps release some alphas/betas/RCs or something? Just something solid that I can depend on? I don't care that it be totally API-stable and complete, just that I have something that isn't going to change right underneath me. |
| 00:29 | Raynes | I should have disclaimed that I hadn't actually looked at the implementation of things. |
| 00:29 | antares_ | monger.core, monger.collection and monger.gridfs probably give you roughly what congomongo has, w/o a single macro |
| 00:30 | antares_ | Raynes: that sounded OK :) |
| 00:30 | antares_ | no worries |
| 00:31 | antares_ | Raynes: another person asked for a non-snapshot release today: https://github.com/michaelklishin/monger/issues/7 :) |
| 00:31 | antares_ | Raynes: so, I think I will do a beta1 now |
| 00:31 | Raynes | That sounds great! I'll move RefHeap to it in the morning. |
| 00:32 | Raynes | (God bless Saturday) |
| 00:33 | Raynes | antares_: I've got this thing embedded in me from work: we never snapshot things at work ever. We always release alphas or betas. It's so deeply embedded that I almost always do it in my own projects now. |
| 00:34 | antares_ | Raynes: ok. I am releasing validateur that monger depends on and is currently a snapshot only |
| 00:34 | Raynes | I can, of course, see the benefit of snapshots early in development though. No sense in releasing half-done or non-working crap, but sometimes you do want to put that out there. |
| 00:34 | antares_ | or maybe I should just completely remove this dependency. It is a validations library that monger can work without. |
| 00:35 | antares_ | Raynes: monger was started in early August |
| 00:35 | antares_ | Raynes: so it is very close to 1.0, the doc site is not ready yet. |
| 00:35 | Raynes | Yeah, I saw it ages ago. |
| 00:36 | Raynes | antares_: I'm going to have fun with this. :> |
| 00:37 | muhoo | whenever i read anything about mongo, i keep hearing a robotic voice in th eback of my head saying "why don't you write your data to /dev/null? it will be very fast" |
| 00:37 | muhoo | damn xtranormal. |
| 00:37 | Raynes | antares_: You're the travis-ci guy too, aren't you? |
| 00:38 | Raynes | Man, you don't ever half-ass things. |
| 00:38 | Raynes | I want to be like you. |
| 00:38 | Raynes | But I like releasing things really quickly. |
| 00:38 | Raynes | RefHeap took two weeks. |
| 00:38 | antares_ | Raynes: I am |
| 00:38 | antares_ | Raynes: I also have maybe a dozen of Clojure libraries for Neo4j Server, RabbitMQ, Web crawling and so on |
| 00:39 | antares_ | and happen to maintain 3 Ruby AMQP clients :) |
| 00:39 | Raynes | Have you seen Jiraph? |
| 00:39 | antares_ | no |
| 00:39 | Raynes | https://github.com/flatland/jiraph |
| 00:39 | antares_ | is it something for jira? :) |
| 00:39 | Raynes | God no. |
| 00:39 | Raynes | We wouldn't dare. |
| 00:39 | antares_ | oh |
| 00:39 | antares_ | sounds interesting, let me see the license |
| 00:39 | Raynes | amalloy: Is that README up-to-date? |
| 00:40 | antares_ | Raynes: jiraph looks very interesting, thanks for bringing it up |
| 00:40 | Raynes | antares_: EPLv1 |
| 00:40 | Raynes | antares_: We use this at work, so you can pretty much count on it being supported. :P |
| 00:41 | antares_ | Raynes: it is embeddable, correct? |
| 00:41 | antares_ | or accessible over the network? or both? |
| 00:41 | Raynes | Yes. It has a tokyo cabinet layer for backend storage. |
| 00:43 | Raynes | amalloy: I'm going to put going over this README on my todo list for Monday, since it hasn't been changed since the partial rewrite. |
| 00:44 | antares_ | Raynes: do you think it's OK for monger to depend on a library that is useful with it but is not a hard dependency in any way? |
| 00:44 | antares_ | all my projects tend to integrate with one another but I can see why people may not like pulling extra jars |
| 00:44 | Raynes | If it is a problem for somebody they can always exclude it. |
| 00:45 | antares_ | ah, right |
| 00:45 | antares_ | I keep forgetting that with Maven-based tools you can do it |
| 00:45 | antares_ | cool |
| 00:47 | Raynes | I really need to get my stuff on travis-ci, but that means I have to write tests... |
| 00:48 | Raynes | I'm still not sure how to test something like RefHeap. |
| 00:48 | Raynes | That's going to take some thought. |
| 00:48 | Raynes | I think Noir has some nice test tools though. I'm just not good with testing I/Oish things. |
| 00:48 | muhoo | i like the way debian does it: required, recommended, and suggested, IIRC |
| 00:48 | Raynes | muhoo: How has your RefHeaping been going lately, btw? |
| 00:48 | Raynes | Anymore problems with server lag? |
| 00:49 | muhoo | Raynes: naw, works great! it's now my go-to paste tool |
| 00:49 | Raynes | I'm assuming you're using refheap.el |
| 00:49 | Raynes | I noticed. You got the 700th paste. With an error message... |
| 00:49 | muhoo | i just bound a key in emacs to refheap-paste-region |
| 00:49 | Raynes | :p |
| 00:49 | muhoo | most of my pasting is asking for help with stuff i can't figure out how to get working :-) |
| 00:49 | Raynes | Hah, I actually don't have any keys for my refheap Vim stuff. I get a strange thrill out of typing :Refheap |
| 00:50 | antares_ | Raynes: just checking, to do a beta release with lein I need to change version to 1.0.0-beta1, lein pom, jar and push things to clojars, right? I don't I've done a beta release with lein before :) |
| 00:50 | antares_ | only GAs and snapshot releases |
| 00:50 | Raynes | antares_: Yeah. Nothing special. |
| 00:52 | antares_ | Raynes: 1.0.0-beta1 is up on clojars |
| 01:06 | rads | ibdknox: how do I know how to structure my code within the state machines? what should go in a transition vs the in/out functions for a state? |
| 01:07 | rads | re: waltz |
| 01:11 | Raynes | antares_: You rock. |
| 01:11 | antares_ | Raynes: I updated Neocons README to mention jiraph for people who need an embedded graph db. Great work. |
| 01:11 | Raynes | antares_: I can't take any credit for Jiraph. I've done very little work on it. amalloy and ninjudd get all the credit. |
| 01:12 | antares_ | hm, yeah, I meant "great work everybody who worked on it" :) |
| 01:14 | ibdknox | rads: transitions should be used to set and unset states, shouldn't really do much else |
| 01:14 | ibdknox | rads: in/out should do whatever interfac-y things you need to do |
| 01:15 | Raynes | ibdknox: When I get around to testing RefHeap, would you up for helping me out? |
| 01:15 | rads | in some of the examples, you use crate within the transitions |
| 01:15 | rads | er, store |
| 01:15 | rads | (which is fetch) |
| 01:15 | rads | so you're updating remote state during the transition too? |
| 01:15 | ibdknox | getting state |
| 01:16 | ibdknox | think of transitions as the interface for your thing, whatever it is |
| 01:16 | ibdknox | what can you do with it? |
| 01:16 | rads | I see |
| 01:16 | ibdknox | Raynes: how can I help? |
| 01:17 | Raynes | ibdknox: I suck at testing websites and I/O. I expect that you don't. |
| 01:17 | Raynes | ibdknox: Mostly I just mean help me out by answering questions and listening to long explanations of how things work so that you can explain the best way to test certain things. |
| 01:17 | Raynes | Also, not tonight. Not tomorrow either. Eventually. |
| 01:18 | ibdknox | sure :) |
| 01:18 | Raynes | Great. :> |
| 01:18 | Raynes | Or you can just write the tests for me. That works to. As a matter of fact, go do that. |
| 01:18 | Raynes | ;P |
| 01:21 | antares_ | Raynes: by the way, monger now has a mailing list: https://groups.google.com/forum/#!forum/clojure-monger |
| 01:22 | rads | ibdknox: thanks for the help, btw |
| 01:23 | ibdknox | rads: np :) |
| 01:25 | Raynes | antares_: Joined. |
| 02:39 | Raynes | muhoo: ping |
| 02:55 | muhoo | Raynes: yo |
| 02:56 | Raynes | muhoo: https://refheap.com/paste/708 Just wanted to show you the better highlighting I just added. Notice that ns is highlighted the same as 'defn' (and other top-level things). |
| 02:57 | muhoo | nice. now how do i get that in clojure-mode.el ? :-) |
| 02:58 | Raynes | The color theme? |
| 02:58 | muhoo | (ns is not highlighted at all in clojure-mode, pfui). |
| 02:58 | Raynes | Well, this was a change to the pygments lexer. |
| 02:58 | Raynes | I couldn't tell you how to fix the clojure-mode lexer. :p |
| 02:58 | muhoo | i kno, i'm being silly |
| 02:58 | muhoo | your highlighting is better than that of my editor |
| 02:58 | Raynes | I never had problems with clojure-mode. :O |
| 02:59 | muhoo | oh it's great. at some point i'm going to have to learn how to edit modes. |
| 02:59 | Raynes | Also, for future reference, the color theme is a version of tomorrow-night-bright that I wrote for pygments. |
| 03:01 | muhoo | heh, it was a simple matter of customize-face. nice. |
| 03:10 | Raynes | muhoo: The Clojure highlighting in Pygments is getting pretty good with my recent changes, even if it is all one big regexfest. |
| 03:12 | muhoo | you've inspired me to edit the crap out of my customize-face stuff |
| 03:12 | muhoo | i love this. i've got all my java stuff a different color from the builtins, from the macros, it's very nice. |
| 03:13 | muhoo | makes reading clj a lot easier. since, because there's so little syntax, it's kind of hard to tell what's what without it. |
| 03:17 | Raynes | muhoo: I'm going to try to move refheap to enlive soon. |
| 03:17 | Raynes | muhoo: I expect suicidal tendencies though, so I might have to back down. |
| 03:17 | muhoo | "i'm not crazy, you're the one that's crazy, you're driving me crazy" |
| 03:18 | muhoo | http://www.youtube.com/watch?v=LoF_a0-7xVQ |
| 03:19 | muhoo | all i wanted was a pepsi. just one pepsi |
| 03:19 | muhoo | ok, well i like hiccup because it's simple and i can read that source and understand most of it |
| 03:20 | muhoo | it's like the difference between generating html or doing jquery js stuff. matter of taste and/or application i suppose |
| 03:28 | fliebel | Can we do Enlive in ClojureScript yet? |
| 03:35 | Raynes | fliebel: https://github.com/ckirkendall/enfocus |
| 03:37 | fliebel | Raynes: yay |
| 03:43 | fliebel | cemerick mentioned cljs is now a regular lein dep, but where is it? |
| 03:46 | fliebel | ok, org.clojure.clojurescript |
| 03:52 | fliebel | Is the Clojure reader the same thing as the ClojureScript reader? |
| 04:59 | originalserver | I am selling dedicated servers in different countries, only windows xp, 2003,2008, seven! write who need them. |
| 05:30 | Guest11659 | Hey. I have a script file which I run through (load-file "myfile.clj") through the REPL. However the REPL does not print out my (print-str "hello world!") just the result of a following calculation. How come? |
| 05:30 | Guest11659 | err nevermind |
| 06:59 | dEPy | how do I run my project with leiningen? I specified my main clj in project.clj |
| 06:59 | dEPy | but when I do "lein run" I get: Exception in thread "main" java.lang.NullPointerException (NO_SOURCE_FILE:1) |
| 07:02 | vijaykiran | dEPy: do you have a -main method in the clj ? |
| 07:04 | dEPy | oh.. stupid me :) |
| 07:07 | dEPy | works now yea.. thanks |
| 07:07 | dEPy | totally forgot about it O_o |
| 07:13 | vijaykiran | dEPy: np |
| 07:43 | pyr | are dev-dependencies accessible during lein test ? |
| 07:44 | jcidaho | Hi. Our project at work has been using Clojure for 2-3 months now, and we're pleased with it and impressed at how quickly the team have picked it up. We're currently embedded Clojure in our monolithic Java app, but now we're looking at web framework options. I've been searching round various forums etc. Any definitive choice atm? Any really good blog entry that nails it head on for where we are right now? I.e. Noir vs composure, enlive vs hiccup, clojuresc |
| 07:44 | jcidaho | clojurescriptone. There's a lot of stuff out there and it all looks quite good tbh. Currently playing with Compojure and Hiccup, quite impressed by that combo... |
| 07:44 | pyr | jcidaho: it fits a lot of needs |
| 07:44 | pyr | jcidaho: really depends on what you want to do |
| 07:45 | pyr | jcidaho: clojurescript doesn't really have a "framework" yet |
| 07:45 | pyr | though pinot comes close |
| 07:45 | pyr | if you think you would have been fine with sinatra in the ruby world |
| 07:45 | vijaykiran | pyr: yes, dev-deps are test deps |
| 07:45 | jcidaho | it's not a public facing app, but houses a rule engine that we want to expose for our users to see what rules are in place, and in future to comment, track, rule breaks etc |
| 07:45 | pyr | then compojure will be fine |
| 07:46 | jcidaho | Noir would seem to wrap composure - any driver for moving to that? |
| 07:46 | jcidaho | compojure sorry |
| 07:46 | vijaykiran | jcidaho: as pyr said, depends on what you want to build |
| 07:46 | pyr | vijaykiran: 'k, thx |
| 07:47 | jcidaho | could you clarify that a bit… Compojure is good for build X type apps vs something-else that isn't.. |
| 07:47 | pyr | jcidaho: compojure and noir share a lot indeed |
| 07:48 | vijaykiran | compojure is "micro" framework not a full stack framework |
| 07:48 | vijaykiran | noir is more comparable to framework |
| 07:48 | pyr | jcidaho: think sinatra vs rails, in a way |
| 07:48 | jcidaho | ok |
| 07:48 | pyr | jcidaho: if you're building something that can be easily manipulated in js on the frontend |
| 07:48 | pyr | which would be advisable for a non web facing app |
| 07:49 | pyr | then compojure might just do, you send out json from api endpoints |
| 07:49 | pyr | and let the frontend do its thing |
| 07:49 | jcidaho | make sense |
| 07:49 | vijaykiran | I built an internal app SPA - with backbone frontend and clojure backend |
| 07:50 | Raynes | jcidaho: Noir is probably your best bet. |
| 07:51 | Raynes | Compojure is really minimal. Excessively so. |
| 07:52 | jcidaho | check it out some more - thanks |
| 07:54 | Raynes | antares_: ping |
| 08:46 | fhd | Can I somehow undo a (require)? |
| 08:47 | raek | fhd: what effect of require do you want to undo? |
| 08:47 | Raynes | &(doc remove-ns) |
| 08:47 | lazybot | ⇒ "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace." |
| 08:48 | Raynes | I'm not sure if that has the effect of removing the mapping that was created though. |
| 08:48 | fhd | raek: I'm executing tests from the REPL, updating with (require ... :reload) |
| 08:48 | fhd | raek: But when I remove a test, it's still executed by clojure.test |
| 08:48 | Raynes | You probably need to ns-unmap the tests you remove. |
| 08:48 | fhd | Raynes: Okay, thanks |
| 08:49 | Raynes | Reloading a require has the effect of just evaluating all that code again, so things you change and added are reflected. Unfortunately, it doesn't remove things that have been removed. |
| 08:50 | fhd | Raynes: Yeah, ns-unmap does the trick |
| 10:41 | blakesmith | Hrm, anyone ever had read-line fail in slime? https://gist.github.com/1801099 |
| 12:20 | scottj | blakesmith: I think that's a "known issue; don't do it" |
| 13:30 | weavejester | Does anyone happen to know if deftype can work with loadClass? |
| 13:30 | weavejester | i.e. create a class with deftype that can be loaded into a java library via loadClass. |
| 13:32 | TimMc | I don't see why not. What is loadClass used for? |
| 13:34 | weavejester | I think it might have to do with the classloader |
| 13:34 | weavejester | I have a Java library with a static logging class loaded from a system property using loadClass |
| 13:35 | weavejester | So I was trying to create a class with deftype and set the property to the full type name |
| 13:37 | weavejester | So if I defined a type: (deftype T []) |
| 13:37 | weavejester | Then: (.. (Thread/currentThread) (getContextClassLoader) (loadClass "user.T")) |
| 13:37 | weavejester | Doesn't work... |
| 13:37 | weavejester | I'm guessing that user.T isn't in the context class loader for the thread... |
| 13:38 | TimMc | Huh. |
| 13:39 | weavejester | (.getClassLoader (class (T.))) => #<DynamicClassLoader clojure.lang.DynamicClassLoader@1548414> |
| 13:39 | weavejester | So I guess types all have their own class-loaders |
| 13:40 | jcidaho | hi - what do ppl use for http acceptance testing. I.e. writing test wrapping something like htmlunit so test a compojure style app? I see there's a couple of webdriver ports - any stand-out winner atm? |
| 13:41 | weavejester | web testing ala htmlunit isn't something I've kept an eye on, I'm afraid. |
| 13:43 | weavejester | Hm, if I explicitly set the class loader of the thread it works... |
| 13:43 | jcidaho | k, surprised on the web finding that there doesn't seem to an option that leaps out |
| 13:44 | TimMc | weavejester: Wow, is that kosher? |
| 13:45 | weavejester | TimMc: Well, you can do it... but I don't know whether it'll mess up anything! |
| 13:45 | weavejester | What I could do... |
| 13:45 | weavejester | Is create a new Thread... |
| 13:45 | weavejester | Swap in the Clojure class loader |
| 13:45 | weavejester | Then load the static Java logging library |
| 13:46 | weavejester | Then end the thread |
| 13:46 | TimMc | Heh. |
| 13:46 | muhoo | jcidaho: don't people use ci stuff, like hudson, or travis-ci ? |
| 13:47 | weavejester | I really hate it when Java programs use things like loadClass and the static {} block instead of just working OOP |
| 13:47 | jcidaho | how does CI help? Want a test tool for interrogating noir/compojure output |
| 13:47 | weavejester | muhoo: CI is something different. You run your tests in a CI system, but CI isn't a testing tool. |
| 13:49 | jcidaho | think I should investigate clj-webdriver. Never really used webdriver in java-land, more htmlunit and some selenium (pre webdriver) |
| 13:49 | jcidaho | so clk-webdriver is prob a good choice |
| 13:50 | arohner | weavejester: IIRC, every class (and every clojure fn) get their own classloader, because classes can't be GC'd, by themselves, but a classloader + all it's classes can, if the classloader has no references |
| 13:51 | weavejester | arohner: Ah, so if a Java library is using loadClass to load a logging class, I can't override that with a type without some fiddling |
| 13:52 | arohner | weavejester: yeah, that will probably require gen-class |
| 13:53 | weavejester | arohner: I think I can get around it by creating a new thread and changing the context class loader. |
| 14:13 | seancorfield | ibdknox: you about? |
| 14:26 | seancorfield | nm, figured it out (:externs in ClojureScript :compiler directive) |
| 14:33 | TimMc | Haha, if I hit up-arrow while lein is running some task (e.g. uberjar), I see repl commands I have typed in the past. |
| 14:34 | TimMc | I guess it wraps everything in rlwrap. |
| 14:40 | rhall | hi all... anyone around? |
| 14:41 | seancorfield | rhall: yup |
| 14:41 | rhall | hi... hit something I can't explain... was hoping to get an opinion or two |
| 14:41 | seancorfield | TimMc: i assume that's in interactive mode? |
| 14:42 | rhall | (when-let [z (try (new ZipFile "junk") (catch ZipException _)) ] println z) |
| 14:42 | rhall | (when-let [z (try (new ZipFile zip-name) (catch ZipException _)) ] println z) |
| 14:42 | rhall | those two lines... assuming (def zip-name "junk") ... should be identical, right? |
| 14:43 | seancorfield | but...? :) |
| 14:43 | rhall | the one with the constant works as written |
| 14:43 | rhall | the one with the variable leaks the exception |
| 14:43 | rhall | I took out the try catch and the stack is different |
| 14:44 | seancorfield | yes because of CLJ-855 i suspect |
| 14:44 | seancorfield | (new ZipFile ^String zip-name) |
| 14:44 | seancorfield | see if that solves it |
| 14:44 | seancorfield | (i'm assuming you're on clojure 1.3) |
| 14:44 | rhall | yep, 1.3 |
| 14:45 | seancorfield | add the type hint and see if it catches the exception as expected |
| 14:45 | rhall | yep, that did it |
| 14:45 | rhall | hmm... |
| 14:45 | rhall | so I saw the invocation sequence was diff between the two cases |
| 14:45 | rhall | using the constant was a newinstance |
| 14:45 | rhall | using the var was a reflection call |
| 14:46 | seancorfield | without the type hint, clojure does reflection to set up the call - and exceptions thrown from reflected code are wrapped in RuntimeException so your catch won't catch it |
| 14:46 | rhall | ok, makes sense |
| 14:46 | seancorfield | clojure/dev are still hotly discussing the right solution for exception wrapping / unwrapping |
| 14:47 | seancorfield | CLJ-855 is the ticket in JIRA that relates to this issue |
| 14:47 | seancorfield | having to (catch RuntimeException _) and unwrap it to find the real exception is a PITA |
| 14:47 | rhall | yeah... not ideal |
| 14:48 | rhall | but sticking type hints everywhere is not cool either |
| 14:48 | seancorfield | but having checked exceptions in the clojure compiler is also undesirable (which was how things were in 1.2) |
| 14:48 | rhall | ok, thought this was new behavior but didn't go back to 1.2 yet to test |
| 14:48 | seancorfield | rhall: agreed, hence the "hotly discussing" comment :) |
| 14:49 | rhall | appreciate the fix tho... I can deal with it that way for the moment |
| 14:49 | rhall | guess I should start following clojure dev |
| 14:52 | TimMc | seancorfield: Nope, not in interactive mode, just `lein uberjar`. Pretty funny. |
| 14:52 | TimMc | seancorfield: It would be nice if slingshot could peer down through the layers of RTEs to see the underlying ones. |
| 15:04 | TimMc | &(proxy [Object] []) |
| 15:04 | lazybot | java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.DynamicClassLoader |
| 15:09 | citizenparker | Hey blakesmith! =) |
| 15:13 | ibdknox | seancorfield: what's up? |
| 15:14 | seancorfield | hey ibdknox i was having problems with jayq and advanced compilation mode... i was trying to recreate my success of the other night, from scratch |
| 15:14 | seancorfield | i missed the :externs line... then i put it in the wrong place... got it working now (and blogged!) |
| 15:15 | seancorfield | also the update to lein-cljsbuild 0.0.12 solved the externs on the class path issue - thanx for that heads up! |
| 15:15 | seancorfield | if evan was around, i'd thank him too :) |
| 15:15 | ibdknox | sweet! so you can just put "externs/jquery.js" |
| 15:15 | ibdknox | ? |
| 15:15 | seancorfield | yup |
| 15:16 | seancorfield | the whole gory episode is here http://corfield.org/blog/post.cfm/getting-started-with-clojurescript-and-jquery-and-fw-1 |
| 15:17 | ibdknox | awesome |
| 15:17 | ibdknox | we now have a real library story |
| 15:18 | seancorfield | yup |
| 15:19 | seancorfield | now i need to figure out whether i can reasonably start using cljs + jayq at world singles for production code :) |
| 15:20 | seancorfield | we use a few jquery plugins so i guess i'd need externs for those too... but mostly we just use plain ol' jquery and a helping of raw JS in our UI... |
| 15:46 | dbushenko | hi all! |
| 15:46 | dbushenko | a make an uberjar with leiningen |
| 15:46 | dbushenko | but when it runs it throws lots of warnings |
| 15:46 | dbushenko | how to eliminate them? |
| 15:52 | empity | dbushenko: well you have first to read and understand the warnings I'm afraid |
| 15:52 | empity | they normally mean something not perfectly correct is going on |
| 15:52 | dbushenko | empity: they are not mine. They are from the included library Lobos |
| 15:53 | dbushenko | is there a way just to disable all the warnings? |
| 15:54 | ibdknox | seancorfield: you can bind events with jayq too, then you wouldn't need to export that function and all the code would be contained :) |
| 15:54 | AeroNotix | any eu people want to trade Practical Clojure for Clojure in Action? |
| 16:17 | weavejester | Leiningen 1.7 doesn't have profiles yet, does it? |
| 16:26 | skelternet | I think I am running into a problem caused by calling a macro in a function, and as that macro renders code, it checks the type of a parameter I'd like to pass it, and throws an exception |
| 16:27 | skelternet | specifically, I'm trying to call noir's pre-route. |
| 16:27 | augustl | The web framework I want: ring, clout, and a basic defpage macro `(defpage :get "/foo" {constraints...} [req] (... handler ...))`. Purely functional. Any suggestions? :) |
| 16:28 | skelternet | augustl, not happy with noir? |
| 16:28 | augustl | skelternet: I don't like the way it uses side effects for cookies and other things |
| 16:29 | augustl | I would prefer to just return a ring handler where I set the Set-Cookie header |
| 16:29 | skelternet | augustl, so routes and all of the chains would build up a map and pass to subsequent functions? |
| 16:29 | augustl | I guess I can do that with noir though, heh :) |
| 16:30 | augustl | skelternet: not sure what you mean |
| 16:31 | skelternet | I think the problem I'm running into is that the pre-route macro checks the parameter I"m handing it at runtime, and because it's not a string literal, it throws a compile time exception. I've even tried ~ |
| 16:32 | skelternet | augustl: there is so much that we lean on state for when handling a request…you want a purely functional mechanism…al |
| 16:32 | skelternet | all the things traditional frameworks hold as state somewhere end up having to be passed along some how. |
| 16:35 | augustl | skelternet: I'm used to writing web apps with Rails |
| 16:35 | augustl | there, you typically don't have cross-request state other than the database |
| 16:35 | augustl | you only store the logged in users ID in the cookie for example, fetching the user from the db on every request |
| 16:37 | MenTaLguY | so, what's the best way to add a generated .jar to the classpath (and get it packaged as part of the uberjar) in leiningen? |
| 16:38 | MenTaLguY | from a leiningen plugin |
| 16:39 | skelternet | augustl: I would think compojure, ring, could be used similarly, but I am still learning. very much the noob. |
| 16:40 | skelternet | Mentalguy: I think you could write a rudimentary pom for it and install it to your local repository. How familiar are you with mvn? |
| 16:41 | MenTaLguY | skelternet: I don't think that's viable |
| 16:41 | MenTaLguY | it's a .jar with generated code |
| 16:41 | MenTaLguY | not something I can stick in an MVN repository somewhere |
| 16:41 | MenTaLguY | local or otherwise |
| 16:42 | skelternet | What do you mean by generated? |
| 16:42 | augustl | won't a .jar in lib/ automatically be on the classpath? |
| 16:43 | augustl | perhaps `lein clean` removes it though |
| 16:43 | skelternet | I am not sure about that. I am concerned that that's just where leiningen just stashes its downloaded deps. |
| 16:43 | MenTaLguY | a .jar in lib/ will not automatically be on the classpath |
| 16:43 | skelternet | no…I just did a clean, and it's still there |
| 16:44 | skelternet | does the .jar contain generated SOURCE code? or .classes ? |
| 16:44 | MenTaLguY | Ruby gems :) |
| 16:44 | skelternet | huh. |
| 16:45 | skelternet | 'quizzical dog look |
| 16:45 | skelternet | seriously? |
| 16:46 | MenTaLguY | yes |
| 16:46 | MenTaLguY | I originally looked at extending mvn to use gems as a repository |
| 16:46 | MenTaLguY | but there's a lot of impedence mismatch between mvn and gems as far as the way that dependencies are resolved |
| 16:47 | MenTaLguY | so at this point I'm writing a leiningen plugin that uses the normal Ruby gems/bundler infrastructure to pull down the gems, and then packages them as a .jar to be included in the uberjar/classpath |
| 16:47 | MenTaLguY | the missing piece is getting that .jar actually on the classpath |
| 16:48 | trptcolin | cool. would the plugin hook into the normal `lein deps` flow? |
| 16:48 | MenTaLguY | (I think if it's on the classpath, uberjar should pick it up too) |
| 16:48 | MenTaLguY | yeah, that's the idea |
| 16:48 | trptcolin | maybe toss it in :resources-path ? |
| 16:48 | MenTaLguY | I'd rather not users of the plugin had to that manually |
| 16:48 | MenTaLguY | er, have to do that manually |
| 16:48 | trptcolin | right. i mean have the plugin do that. |
| 16:49 | MenTaLguY | is there a way to override/supplement options like that globally? |
| 16:49 | trptcolin | unfortunately i haven't done any nested jar stuff w/ lein, so i'm kind of guessing |
| 16:49 | MenTaLguY | I know how to robert.hooke get-classpath, I'm wondering if there's a better way though |
| 16:51 | trptcolin | getting ahold of the values should just be a lookup from your plugin task, like (:resources-path project) or (:extra-classpath-dirs project). modifying them, i'm not sure. |
| 16:52 | MenTaLguY | yes exactly |
| 16:53 | MenTaLguY | well, I'll bbl |
| 16:56 | trptcolin | there's a default value for :resources-path : "resources", but i'm guessing you knew that.. |
| 16:58 | MenTaLguY | actually, I had forgotten that |
| 16:58 | MenTaLguY | the question is whether that will add .jars in that directory themselves to the classpath though |
| 16:58 | MenTaLguY | I mean, I would need whatever/resources/vendor-gems.jar to be on the classpath, not whatever/resources itself |
| 16:58 | MenTaLguY | although |
| 16:59 | MenTaLguY | maybe I'm thinking about this the wrong way |
| 16:59 | MenTaLguY | if I just install the gems directly to the resources/ directory.... |
| 16:59 | MenTaLguY | hmm. |
| 16:59 | MenTaLguY | that might be simpler |
| 16:59 | trptcolin | oh, skip the jarring? could work. they'll be zipped anyway in the uberjar situation |
| 17:01 | MenTaLguY | exactly |
| 17:01 | MenTaLguY | simple makes me happy |
| 17:03 | MenTaLguY | hmm |
| 17:03 | MenTaLguY | you know, asking people to add vendor/gems to :resources-path isn't so terrible |
| 17:04 | trptcolin | well, except if they're using :resources-path for something else |
| 17:10 | MenTaLguY | you can set multiple directories for the resource path |
| 17:10 | MenTaLguY | it's a sequence, not a single string |
| 17:14 | trptcolin | cool. there was one of these knobs that's newly-a-sequence in lein2, didn't remember whether this was one |
| 17:15 | MenTaLguY | bbl |
| 17:23 | muhoo | gems? in clojure? |
| 17:29 | Raynes | muhoo: Where? |
| 18:30 | Raynes | ibdknox: ping |
| 18:31 | ibdknox | Raynes: sup? |
| 18:31 | Raynes | ibdknox: Have you used enlive? |
| 18:31 | ibdknox | barely |
| 18:32 | ibdknox | I'm likely not much help I'm afraid :( |
| 18:35 | trptcolin | ditto for the clojure part, i'm afraid :) |
| 18:35 | Frozenlock | Perhaps, but I don't see as much lowercase-uppercase mixes |
| 18:36 | amalloy | unluckily 9 isn't the same as ( either |
| 18:36 | Raynes | ibdknox: Do you happen to know of any open source projects using enlive? |
| 18:36 | Raynes | I've seen none. Enlive is supposed to be so super popular, yet nobody seems to actually use it. :| |
| 18:37 | ibdknox | Raynes: they do, but it's for the stuff that isn't just side-projects (it's better than hiccup when you work with non-devs) |
| 18:37 | ibdknox | dnolen has a nice tutorial as does marick I believe |
| 18:37 | ibdknox | Raynes: https://github.com/marick/enlive-tutorial |
| 18:38 | Raynes | dnolen's tutorial is pretty meh. I read through Brian's last night. I know how to use Enlive -- I don't know how to restructure my project in an expressive way using it. I was hoping to see some real examples. |
| 18:38 | ibdknox | ah |
| 18:38 | ibdknox | don't know of any |
| 18:38 | ibdknox | I find enlive overly complex |
| 18:39 | Raynes | So do I, for the most part. |
| 18:39 | muhoo | i ffear enlive |
| 18:40 | muhoo | but if i had to screenscrape, i'd probably go there first. |
| 18:40 | muhoo | or, if a designer handed me some html/css to use as a template and said "here, it's done, have fun". |
| 18:43 | ibdknox | Raynes: why're you making the switch? |
| 18:43 | Raynes | ibdknox: Because it seems like it might be a cleaner solution. |
| 18:43 | Raynes | I mean, I haven't had problems other than mental block so far. |
| 18:43 | ibdknox | mm |
| 19:03 | alex_baranosky | how can I do integer division? |
| 19:04 | seancorfield | ,(long (/ 23 4)) |
| 19:04 | clojurebot | 5 |
| 19:04 | alex_baranosky | thanks! |
| 19:05 | seancorfield | (/ 23 4) |
| 19:05 | clojurebot | *suffusion of yellow* |
| 19:05 | seancorfield | ,(/ 23 4) |
| 19:05 | clojurebot | 23/4 |
| 19:05 | seancorfield | the first time i did division and got a fraction i was like wtf? |
| 19:05 | seancorfield | ,(double (/ 23 4)) |
| 19:05 | clojurebot | 5.75 |
| 19:06 | rhall | ok... #clojure newb here... why is clojurebot saying "suffusion of yellow" ?? |
| 19:06 | lazybot | rhall: Uh, no. Why would you even ask? |
| 19:06 | rhall | cool and lazybot is joining in |
| 19:06 | ibdknox | well done lazy bot |
| 19:06 | hiredman | google it |
| 19:06 | seancorfield | i'd guess because i typed a clojure form without , at the beginning? |
| 19:06 | seancorfield | (try again) |
| 19:07 | ibdknox | such a great book |
| 19:07 | seancorfield | so it's more subtle than just any form... |
| 19:07 | seancorfield | (/ 1 2) |
| 19:07 | clojurebot | 1/2 |
| 19:07 | seancorfield | hmph |
| 19:07 | seancorfield | (/ 23 4) |
| 19:07 | clojurebot | *suffusion of yellow* |
| 19:07 | seancorfield | (/ 23 3) |
| 19:07 | clojurebot | *suffusion of yellow* |
| 19:07 | seancorfield | (/ 23 x) |
| 19:07 | ibdknox | greater than 4 |
| 19:08 | seancorfield | oh |
| 19:08 | seancorfield | (/ 5 2) |
| 19:08 | clojurebot | 5/2 |
| 19:08 | seancorfield | (/ 5 1) |
| 19:08 | clojurebot | *suffusion of yellow* |
| 19:08 | seancorfield | ah, i see |
| 19:08 | ibdknox | http://www.thateden.co.uk/dirk/ |
| 19:08 | seancorfield | $google suffusion of yellow |
| 19:08 | lazybot | [Dirk Gently's Holistic I-Ching Calculator] http://www.thateden.co.uk/dirk/ |
| 19:09 | seancorfield | geeks... gotta love 'em... |
| 19:15 | jodaro | is there a way to do the tailable cursor thing in congomongo? |
| 19:41 | seancorfield | jodaro: not sure what you're asking for? |
| 19:54 | jodaro | seancorfield: http://www.mongodb.org/display/DOCS/Tailable+Cursors |
| 19:54 | jodaro | not even sure if the java driver supports it |
| 20:21 | Frozenlock | Is there a newer way (integrated with slime?) to get java doc from clojure than this http://bc.tech.coop/blog/081120.html ? |
| 20:34 | amalloy | well, there's C-c shift-i |
| 20:59 | emezeske | ibdknox: Hey, so I was just thinking about fleshing out the various *-helpers from hiccup in crate |
| 21:00 | emezeske | ibdknox: Any reason to keep them all in crate.tags? I was thinking about making it crate.form-helpers, crate.page-helpers, etc, like hiccup |
| 21:01 | tmciver | amalloy: Cool, I didn't know about that emacs command. Thanks. It seems to only work on Classes (not methods), true? |
| 21:02 | amalloy | well, it inspects objects |
| 21:03 | tmciver | I tried it on Class in an expression like (. Class forName ...) and it worked beautifully. |
| 21:03 | amalloy | sure. classes are objects |
| 21:03 | amalloy | methods ain't |
| 21:05 | gfredericks | amalloy: you're talking about java? |
| 21:05 | tmciver | amalloy: in what sense do you mean classes are objects? |
| 21:06 | amalloy | &(instance? Object (class "x")) |
| 21:06 | lazybot | ⇒ true |
| 21:07 | amalloy | that returns true for anything at all, of course, but my point is you can have a reference to a Class object. you can refer to Method objects too, but that's really part of the reflection facility and Methods are just a part of a Class anyway |
| 21:08 | gfredericks | amalloy: is there an underlying jvm distinction here, or is it just semantics about the package name differences between java.lang.Class and java.lang.reflect.Method? |
| 21:09 | amalloy | eh |
| 21:09 | amalloy | classes are a lot more first-class than methods are |
| 21:09 | amalloy | but it's just a difference of degree |
| 21:09 | amalloy | i think you mean "are you just being a dick" |
| 21:09 | gfredericks | amalloy: but that could backfire because if you're just being a dick then that's probably also what I'm doing |
| 21:10 | gfredericks | though maybe it's not important because if you're not being a dick I'm probably still being a dick |
| 21:11 | skelternet | LoL…I'm listening to y'all via text-to-speech from the other room. The tone of the conversation is equally ambiguous if I read it or hear it read to me. |
| 21:13 | tmciver | skelternet: text-to-speech? Cool! How do you do it? |
| 21:13 | skelternet | Adium has it built in |
| 21:15 | tmciver | Doh! OSX :( |
| 21:16 | skelternet | not available on other platforms? Surely other IRC clients have the feature. |
| 21:16 | rhall | skelternet: does adium read all the drop messages too :) |
| 21:16 | rhall | I'm running erc in emacs |
| 21:17 | rhall | I think I can hack festival to read the erc stream |
| 21:17 | skelternet | rhall: people leaving and entering? no. at least not the way I've configured it. |
| 21:17 | skelternet | though it does annoy my wife when the clojure conversation picks up when I'm not in the house and I've forgotten to shut it down. |
| 21:18 | emezeske | Can anyone point me in the right direction to figure out what the ClojureScript equivalent of (instance? clojure.lang.Named x) would be? |
| 21:18 | rhall | skelternet: I'm sure :) |
| 21:20 | gfredericks | emezeske: since no one else has answered yet, I will speculate it has something to do with protocols? |
| 21:21 | emezeske | gfredericks: That makes sense. Starting point! Thanks. |
| 21:21 | skelternet | emez: I'm curious what the answer will be. I thought javascript is a nearly typeless prototype-based language. |
| 21:22 | gfredericks | skelternet: my assumption is if there is such an equivalent it'll be entirely at the clojurescript semantic level, not JS; e.g. protocols |
| 21:22 | emezeske | skelternet: If I'm lazy enough, the answer might be (or (symbol? x) (keyword? x)) ^_^ |
| 21:22 | gfredericks | ,(instance? clojure.lang.Named "foo") |
| 21:22 | clojurebot | false |
| 21:22 | gfredericks | ,(name "foo") |
| 21:22 | clojurebot | "foo" |
| 21:22 | gfredericks | I hate everything |
| 21:23 | amalloy | &(doc satisfies?) |
| 21:23 | lazybot | ⇒ "([protocol x]); Returns true if x satisfies the protocol" |
| 21:23 | amalloy | (satisfies? INamed x) is surely the JS thing |
| 21:25 | gfredericks | oh of course strings couldn't be clojure.lang.Named, since you can't muck with the string class. I am ashamed. |
| 21:26 | skelternet | ibdknox: if you have a minute, I have a pre-route question for you. |
| 21:41 | Frozenlock | Could someone help in translating the following example in working clojure code? |
| 21:41 | Frozenlock | I'm ok with this: java: test.initialize(); clojure: (.initialize test) |
| 21:41 | Frozenlock | But this..... java: (test.sendBroadcast(2222, new WhoIsRequest(null, null)); clojure: ??? |
| 21:41 | lazybot | Frozenlock: How could that be wrong? |
| 21:42 | alandipert | (.sendBroadcast test 2222, (WhoIsRequest. nil nil)) |
| 21:43 | Frozenlock | alandipert: thanks! |
| 21:44 | alandipert | Frozenlock: no problemo |
| 21:50 | emezeske | amalloy: You are awesome, thanks |
| 22:07 | Null-A | How can I perform lookup in hash-map by using pointer of object as key |
| 22:08 | burlappsack | does clojure have support for pointers? |
| 22:08 | Null-A | it has support for identity |
| 22:08 | Tcepsa | burlappsack: Not that I know of... but there is a lot that I don't know ^_^; |
| 22:10 | burlappsack | I don't think it does |
| 22:10 | burlappsack | clojure is written in Java |
| 22:18 | muhoo | tis funny. the first time i call any function in my repl, it takes like 30 seconds. the next time, it takes less than a second. |
| 22:18 | muhoo | slow computers and java don't get along so well. |
| 22:20 | Arafangion | muhoo: Yet my Atom-based system is fast enough for everything else. |
| 22:26 | muhoo | yep. atom here too. |
| 22:26 | muhoo | netbooks ftw |
| 22:27 | muhoo | ok, i'm confused. if i have something like (for ... (loop [] .... (recur)), what gets recurred? |
| 22:27 | muhoo | the loop, or the for? |
| 22:28 | muhoo | i'm trying to figure out this: https://refheap.com/paste/714 |
| 22:33 | amro | muhoo: for isn't a recur target |
| 22:35 | burlappsack | has anyone hear used a profiler for clojure code? |
| 22:35 | burlappsack | like visualvm or something similar? |
| 22:42 | alandipert | burlappsack: i've had success with yourkit |
| 22:43 | burlappsack | okay, i'll have to check it out |
| 22:44 | burlappsack | thanks |
| 22:45 | burlappsack | have you found using the profiler helped you choose the correct clojure commands/structure to use? |
| 22:50 | alandipert | burlappsack: oh, no - i used it for performance work |
| 22:51 | alandipert | (characterizing the behavior of a web service that needed to meet certain perf criteria) |
| 22:51 | alandipert | burlappsack: the tool you are looking for is practice :-) |
| 22:52 | burlappsack | lol |
| 22:52 | burlappsack | i'm speaking about performance |
| 22:52 | alandipert | burlappsack: oh, sorry i misunderstood. yourkit definitely handy |
| 23:19 | jweiss | i have trace logs that are stored as data like: [(+ 1 (- 5 2) nil] [(- 5 2) nil] [3 true] [4 true] (where the boolean is whether it's the function call or the return value) I want to nest everything back up for printing as html. is there a simple functional way to do that, maybe using reduce? [(+ 1 (- 5 2) [(- 5 2) 3] 4] |
| 23:38 | muhoo | jweiss: zipper? |
| 23:41 | jweiss | muhoo: yeah that might do it |
| 23:42 | alandipert | jweiss: i'd probly use walk |
| 23:42 | alandipert | esp. if these things are arbitrarily deep |