2011-11-14
| 00:05 | amalloy | no |
| 00:08 | klauern | ok |
| 00:35 | seancorfield | in a lein project file, how can i have code to build the dependencies and then specify that in the :dependencies entry? |
| 00:44 | amalloy | seancorfield: "code to build the dependencies"? |
| 00:59 | seancorfield | amalloy: i assumed i could create the dependencies in code and then drop them into the defproject but that doesn't work... so i hoping there's a trick to making it work? |
| 01:00 | seancorfield | back story: i'm switching to lein-multi and i have a long dependency list but only a small part will change across the multi-deps |
| 01:00 | seancorfield | so i want to have a main list and then conj on just the things that change... |
| 01:35 | amalloy | seancorfield: defproject doesn't get evaled, as far as i know. there's some sort of rudimentary syntax-quote support that might do what you want but i've never used it |
| 01:40 | amalloy | seancorfield: yes, that works |
| 01:40 | amalloy | defproject is a macro, but it politely looks inside its body to see if you've unquoted anything, and evals that |
| 01:41 | amalloy | so (defproject foo "1.0.0" :dependencies ~(into [...] (for [x whatever] ...))) |
| 01:58 | antares_ | seancorfield: hi. I would love your opinion on https://github.com/michaelklishin/monger |
| 03:31 | licenser | so are macros actually working in cljs or is that a rumor? I've not gotten one to work yet :( |
| 03:46 | Blkt | good morning everyone |
| 03:51 | leo2007 | In slime C-c C-m does not seem to expand, for example, #(.toLowerCase %) |
| 04:19 | robermann | hello |
| 04:41 | tsdh | Hi robermann |
| 05:08 | wtfcoder | for first real app experiement, Im going to port a C# console app that use nightly, it pulls information from a SQL server view (simple flat queries), builds a json representation, performs some minor transformations, and http posts this to our nosql store (couchdb) |
| 05:08 | wtfcoder | the relevants libraries exist for Java so i dont technically that it will be a problem |
| 05:09 | wtfcoder | is the best way to approach this top down, or bottom up, should I port the low-level functions from c# or start at high level |
| 05:10 | wtfcoder | im thinking the best way is high-level, should i start with say (defn sqlserver2couchdb [dbReader, couchPublisher] ) where dbReader and couchPublisher are functions? |
| 05:49 | fliebel | duck1123: How is OStatus doing? |
| 06:17 | jowag | what was Rich's talk at conj about? |
| 06:21 | fliebel | jowag: Hm, I had hoped it would be here. https://github.com/relevance/clojure-conj/tree/master/2011-slides |
| 06:27 | fliebel | Did Rich do a talk at all? I can;t find any mention of itl. |
| 06:40 | jowag | he should have had a keynote on Friday, 04:40 - 05:40pm, according to http://clojure-conj.org/schedule#fri |
| 08:13 | jcromartie | does ClojureQL support transactions across several inserts/updates? |
| 08:28 | gfredericks | jcromartie: I might be crazy, but you might be able to use the transaction macro from clojure.data.sql |
| 08:30 | jcromartie | gfredericks: you may be crazy, indeed |
| 08:31 | jcromartie | if ClojureQL uses c.c.sql underneath |
| 08:31 | jcromartie | oh clojure.data.sql? has it moved? |
| 08:32 | gfredericks | yeah |
| 08:32 | gfredericks | though clojureql may still point to c.c.sql |
| 08:32 | jcromartie | it must have only moved in an unreleased version |
| 08:32 | gfredericks | I'm sorry |
| 08:32 | jcromartie | there's no documentation of c.d.sql |
| 08:32 | gfredericks | clojure.java.jdbc |
| 08:32 | gfredericks | is what I should have said |
| 08:33 | gfredericks | but anyhow, clojureql does use c.j.jdbc |
| 08:33 | gfredericks | therefore, unless you know otherwise, I stick with my assertion that you could maybe use the transaction macro from c.j.jdbc |
| 08:34 | antares_ | jcromartie: if clojureql doesn't do what you want, take a look at http://sqlkorma.com, it is new, well maintained and also uses clojure.data.jdbc under the hood |
| 08:34 | gfredericks | I looked through the clojureql source once or twice, and my impression was that it made use of c.j.jdbc in a pretty straightforward manner |
| 08:34 | jcromartie | yes |
| 08:34 | jcromartie | looks like it would work |
| 08:34 | jcromartie | I saw Korma last week |
| 08:34 | jcromartie | looks nice |
| 08:35 | jcromartie | at the moment, I might just need to use something lower level though |
| 08:35 | jcromartie | I'm trying to adapt a very old badly-designed db |
| 08:35 | jcromartie | and it's MSSQL |
| 08:35 | jcromartie | so certain things are just slightly weird enough and unsupported in ClojureQL or Korma |
| 08:35 | jcromartie | OK but riddle me this |
| 08:35 | jcromartie | has clojure.contrib.sql become clojure.java.jdbc or what? |
| 08:36 | antares_ | jcromartie: yes |
| 08:38 | jcromartie | it's hard to keep up sometimes |
| 08:38 | jcromartie | :P but... mental note added! |
| 08:42 | jcromartie | the problem is all the old cruft on Google |
| 08:42 | jcromartie | I think I just need a good "starting point" for canonical information on this sort of thing |
| 08:43 | jcromartie | clojure.org is a good one :) |
| 08:44 | pyr | jcromartie: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go |
| 08:44 | licenser | aloa :) |
| 08:44 | licenser | since the conference is over perhaps i get some smart people: Question is: has anyone used macros in clojurescript beyond very trivial things? |
| 08:45 | licenser | because I can't get anything more complicated then a add to work which is somewhat frustrating and I'm not sure if I'm just too dumb or cljs is seriously broken when it comes to macros |
| 08:47 | Fossi | i thought macros were pretty special in that they don't really work runtime |
| 08:47 | licenser | Fossi: yap they run at 'compile' time but for me they keep breaking things :( |
| 08:48 | Fossi | so, what's the problem? the code they generate doesnt run? |
| 08:49 | Fossi | or does the compile fail? |
| 08:49 | licenser | from what I figured is that cljs does not go along with the way macros resolve names |
| 08:49 | Fossi | i'm about to try to write some clojurescript which is also valid clojure or the other way round, so i guess i might run into those problems as well |
| 08:50 | licenser | for example from (. ~context (save)) it makes "(. 1 (clgl.macros/save))" with context 1 |
| 08:50 | licenser | which is ewww |
| 08:50 | licenser | but that is a general problem in my macro I fear |
| 08:51 | licenser | I had something evil with bindings, since the binding arguments always got full namespace names :( |
| 08:55 | jcromartie | ah |
| 08:55 | licenser | or perhaps I am doing it horribly wrong o.o |
| 08:55 | licenser | hi jcromartie |
| 08:55 | jcromartie | licenser: hi |
| 08:59 | jcromartie | I guess [clojureql "1.0.2"] is not ready on clojars yet |
| 08:59 | jcromartie | LauJensen: FYI |
| 09:20 | jcromartie | yarg |
| 09:21 | jcromartie | I guess I need to use ClojureQL from source to use it with Clojure 1.3 |
| 09:30 | adamh | v/win 2 |
| 09:41 | michael_campbell | Morning #clojurians. |
| 09:42 | AWizzArd|work | $seen lpetit |
| 09:42 | lazybot | lpetit was last seen quitting 1 week ago. |
| 09:42 | jcromartie | ok so, let's say I want to use Clojure 1.3 and clojure.java.jdbc ... what is my project.clj going to look like? |
| 09:43 | jcromartie | err |
| 09:43 | jcromartie | hold on |
| 09:43 | jcromartie | never mind |
| 09:52 | jcromartie | I am afraid Korma is not quite up to the challenge of our DB structure :) |
| 09:52 | jcromartie | it has some of the weirdest joins and relationships |
| 09:52 | jcromartie | things that really make no sense |
| 09:54 | jcromartie | it can get us halfway there |
| 09:55 | jcromartie | but the idea of an entity mapping to one table is pretty much out the window here |
| 09:55 | bhenry | jcromartie: i thought he made it so that you could write your own abstractions for the weird stuff. |
| 09:56 | jcromartie | bhenry: maybe... I am sure I could mix it in with raw c.j.jdbc |
| 09:57 | ejackson | jcromartie: You're already into clojureQL ? Perhaps my funky join generator (https://github.com/ejackson/relation) could help you ? |
| 09:57 | jcromartie | ORM-ish :) yeah that's where we're at |
| 09:57 | jcromartie | ORM falls apart |
| 09:57 | jcromartie | but -ish might be right |
| 09:58 | ejackson | its maintains a hierarchy of relationships between tables (nexus.clj) and then chains of joins (chain.clj) |
| 09:58 | jcromartie | interesting |
| 09:58 | ejackson | yeah, its not yet released, but I'm using it |
| 09:59 | duck1123 | I'm still waiting for the ORM-ish abstraction for Korma |
| 09:59 | ejackson | an example of how its used in in my (also unreleased) simple bookeeping system (https://github.com/ejackson/bookkeeper/blob/master/src/bookkeeper/journal_entry.clj) |
| 10:00 | duck1123 | I switched from clj-record, and found that I was still missing some of the abstractions that clj-record had that I had to re-write |
| 10:00 | jcromartie | I am really just trying to put a nice API on top of a really nasty DB |
| 10:01 | jcromartie | the ideas going on in the DB are not really what I want to be using in my application |
| 10:01 | jcromartie | so, yeah... |
| 10:01 | duck1123 | sometimes there's no helping the really odd structures |
| 10:01 | ejackson | yeah, I've got a similar thing. transactions and joins to the rescue. |
| 10:02 | Borkdude | What would be suited material for students to begin with Clojure? (most of em are on Windows) |
| 10:02 | Borkdude | Also IDE: I think teaching them Emacs first is not an option... |
| 10:04 | ejackson | Borkdude: Counterclockwise in Eclipse. |
| 10:04 | cemerick | Borkdude: and if you run into problems, you can bug me. ;-) |
| 10:04 | cemerick | ejackson: Hi! :-D Pleasant flight back? |
| 10:05 | Borkdude | cemerick: deal :) |
| 10:05 | ejackson | cemerick: oh yes... AA is a delight. |
| 10:05 | Borkdude | cemerick: I already thought about it, because they have used Eclipse bfore |
| 10:05 | cemerick | Borkdude: there is a google group though, which is fairly active. |
| 10:06 | cemerick | ejackson: sarcasm, surely? ;-) |
| 10:06 | Borkdude | cemerick: how are dependencies handled, can you use lein in combination with ccw? |
| 10:06 | TimMc | Borkdude: Let 'em get a little experience with CLI. |
| 10:06 | ejackson | By blocking out *all* sensory input I found it delightful... |
| 10:07 | TimMc | ejackson: Full anaesthesia? |
| 10:07 | jcromartie | at least give them rlwrap |
| 10:09 | ejackson | TimMc: Just about :) |
| 10:10 | Borkdude | jcromartie: gotta check that out then |
| 10:10 | cemerick | Borkdude: Leiningen support is very near the top of the TODO list, but there's no integration there yet. Workarounds include http://sexp.posterous.com/poor-mans-integrating-leiningen-into-counterc and https://github.com/abrenk/lein-eclipse and just using `lein pom` in conjunction with m2eclipse (which they may have installed already for other purposes?). |
| 10:12 | Borkdude | cemerick: what is the normal way of getting dependencies then in ccw/eclipse? maven? |
| 10:14 | Borkdude | cemerick: or getting them with lein deps and then manually adding them to the classpath in eclipse? |
| 10:14 | raek | I know that some people run lein deps and add the jars that appear in lib/ to the classpath in eclipse |
| 10:16 | jcromartie | I think maybe Korma or ClojureQL can get us halfway there |
| 10:16 | jcromartie | but the hope is to create a modern API on top of the DB and then migrate the old structure away |
| 10:16 | jcromartie | so that it is sane |
| 10:16 | cemerick | Borkdude: If you're using m2eclipse, then the results of `lein pom` will be picked up automagically by the plugin. If not, then yeah, `lein deps` and then a re-selection of the updated jars from /lib does it. |
| 10:17 | cemerick | Leiningen integration in ccw is definitely 'coming soon', for some short definition of 'soon'. |
| 10:20 | jcromartie | is the developer of Korma on here? |
| 10:22 | cemerick | jcromartie: wait an hour or two, ibdknox is on PST. |
| 10:22 | jcromartie | I see |
| 10:33 | chouser | Aaaaa... I thought I knew clojure, but now I see I don't know anything. |
| 10:33 | TimMc | cemerick: Hapen to know if there are any lein plugins that set up .classpath and .project files? |
| 10:33 | cemerick | TimMc: That's what https://github.com/abrenk/lein-eclipse is. |
| 10:34 | TimMc | sweet |
| 10:34 | TimMc | Although I guess the lein pom + m2e trick would do that too. |
| 10:34 | cemerick | disclaimer: I've never used it, but it's apparently worked well for others. |
| 10:34 | cemerick | TimMc: That's what I do with leiningen projects currently. |
| 10:35 | TimMc | I'm trying to wedge some Clojure into a project at work, you see. :-) |
| 10:35 | cemerick | Sure, totally understand. Ping back if you hit issues. |
| 10:36 | cemerick | chouser: I still don't get it myself, but do share… ;-) |
| 10:36 | chouser | trying to switch from home-made vim/maven/etc. setup to emacs/lein/slime ...I have no idea what's going on anymore. |
| 10:36 | zerokarmaleft | chouser: you didn't lose a finger, did you? |
| 10:37 | cemerick | chouser: Ah, the hive mind envelops. |
| 10:38 | drewr | chouser: as a longtime user of lein+swank I often have the same feeling |
| 10:39 | drewr | I typically upgrade in a moment of weakness and then spend some amount of time fixing whatever breaks |
| 10:39 | zerokarmaleft | i can't remember who opened their talk with that weird enlightenment metaphor |
| 10:39 | drewr | zerokarmaleft: fogus |
| 10:39 | hhutch | i missed that |
| 10:40 | hhutch | i'm waiting for the video to hear the whole thing |
| 10:40 | michael_campbell | I missed most of what Fogus said, and I was 15' away from him. |
| 10:40 | cemerick | hah |
| 10:40 | michael_campbell | The scala DSL of Basic I understood... at least the output. |
| 10:41 | chouser | drewr: well, that's encouraging. :-P |
| 10:42 | tensorpudding | switching from vim to emacs is hard enough, without having to migrate to slime at the same time |
| 10:42 | drewr | it's (usually) worth it :-) |
| 10:42 | drewr | tensorpudding++ |
| 10:43 | tensorpudding | oh, it's definitely worth it |
| 10:43 | drewr | for me it was 10 years ago and wanting gnus |
| 10:43 | tensorpudding | to me gnus was a fancy way of crashing emacs |
| 10:43 | drewr | oh, my other comment was directed at chouser |
| 10:43 | tensorpudding | because that's what it did every time i tried |
| 10:45 | drewr | tensorpudding: custom emacs build? |
| 10:45 | tensorpudding | no? |
| 10:45 | drewr | or emacs23, notoriously unstable for a release |
| 10:45 | tensorpudding | it was in the days of emacs 23 |
| 10:45 | drewr | probably wasn't gnus's fault |
| 10:45 | michael_campbell | Gnus was much nicer when Lars started rewriting it as Ding. And the doc was fabulously funny, too. |
| 10:46 | drewr | michael_campbell: I showed up shortly after |
| 10:47 | michael_campbell | <nod> I remember quite literally laughing out loud reading the info on it. But, like anything that size, notoriously hard to get set up the way you wanted. a gajillion backends, email reading with it, automatic scoring.... (!!) |
| 10:48 | tensorpudding | i like thunderbird for mail well enough |
| 10:50 | drewr | michael_campbell: but on the other hand... all the time I've spent on it has paid off. it's the one thing in my toolchain that never breaks and never says no when I need it to do something |
| 10:51 | michael_campbell | gnus or emacs? |
| 10:52 | drewr | well, both, but I was specifically referring to gnus |
| 10:53 | michael_campbell | gotcha. |
| 10:56 | michael_campbell | nice, codebass' conj flickr album is up. |
| 11:01 | gtrak | any word on the lectures videos? |
| 11:01 | michael_campbell | That they were filmed I can confirm. Timing for release... no idea. |
| 11:03 | gtrak | i especially want the overtone one :-) |
| 11:03 | bhenry | gtrak: follow @confreaks for video release info |
| 11:03 | gtrak | thanks |
| 11:04 | bhenry | i also can't wait to show that one to everyone |
| 11:04 | michael_campbell | I was lucky enough to have landed at Sam's table (with cemerick) for dinner; he's a fantastically entertaining guy, even when not presenting. |
| 11:05 | gtrak | it was pretty priceless, i think i overheard rich hickey say 'frightening' :-) |
| 11:07 | cemerick | gtrak: Rich's first comment to Sam after his talk was "You're badass!". |
| 11:07 | gtrak | awesome |
| 11:07 | cemerick | Which is quite true. :-) |
| 11:07 | gtrak | yea, it was much more involved than his other videos |
| 11:08 | gtrak | and music was rich's thing, right? |
| 11:08 | cemerick | I had *no idea* of the scope of overtone beforehand. You're right, the videos that are out there now totally do not do it justice. |
| 11:09 | gtrak | should hook up overtone to core.logic next |
| 11:10 | gtrak | that could be truly frightening |
| 11:12 | TimMc | $google clojure overtone |
| 11:12 | lazybot | [rosejn/overtone - GitHub] https://github.com/rosejn/overtone |
| 11:13 | TimMc | Ah, supercollider. |
| 11:13 | Raynes | http://github.com/overtone/overtone |
| 11:13 | gtrak | TimMc, with lambdas and macros |
| 11:14 | TimMc | $google algorithms are thoughts, chainsaws are tools |
| 11:14 | lazybot | [Algorithms are Thoughts, Chainsaws are Tools on Vimeo] http://vimeo.com/9790850 |
| 11:14 | TimMc | ^ anything like that? |
| 11:14 | gtrak | yea, looks similar |
| 11:15 | duck1123 | using just clojure.test / midje, is there a good way to focus on a particular test? |
| 11:16 | duck1123 | I know you can do it with lazytest |
| 11:17 | gtrak | TimMc, yea, it was like that, except he also used some external input and explained all the thought behind it |
| 11:17 | TimMc | nice |
| 11:18 | hhutch | gtrak: Sam Aaron was already rewriting overtone to use core.logic and core.match at the conj |
| 11:18 | hhutch | small parts of it |
| 11:18 | gtrak | hhutch, oh really? |
| 11:18 | hhutch | yeah, actually you could see it in his talk |
| 11:18 | gtrak | like generative music programs? |
| 11:18 | hhutch | no, i just mean the overtone code base itself |
| 11:19 | hhutch | he had a use for core.match |
| 11:19 | gtrak | ah |
| 11:19 | hhutch | i have a feeling i will end up over using core.match for a while because it is so handy |
| 11:19 | gtrak | i think byrd's and friedman's reverse programs and genetic algos could be pretty awesome for music |
| 11:28 | TimMc | reverse programs? |
| 11:29 | ejackson | TimMc: Like an inverse function. Using logic programming you can specify the output and the engine will give you any number of programs that generate it. |
| 11:29 | ejackson | Friedman demo'd this at the conj, it was spectucular. |
| 11:33 | jcromartie | hm, clojure.java.jdbc works fine to run a query, but the same query fails with Korma |
| 11:38 | jcromartie | hm |
| 11:38 | jcromartie | apparently whatever method Korma is using requires me to specify the full database.schema.table name |
| 11:38 | jcromartie | while clojure.java.jdbc does not |
| 11:39 | gtrak | TimMc, the generated programs were more amusing than useful at this point, but you can add constraints |
| 11:39 | duck1123 | jcromartie: is this for adhoc queries / |
| 11:40 | jcromartie | no |
| 11:40 | jcromartie | duck1123: I have a defentity |
| 11:40 | jcromartie | in Korma |
| 11:40 | jcromartie | and an ad-hoc query in c.j.jdbc |
| 11:40 | jcromartie | but the query generated by Korma works fine in c.j.jdbc, just not in Korma |
| 11:40 | jcromartie | ... |
| 11:41 | duck1123 | and I assume the connection spec is the same in both cases? |
| 11:43 | jcromartie | yup |
| 11:43 | duck1123 | I know there's the issue that korma doesn't quote the names, I hit errors when I tried to have an alias named "database" |
| 11:43 | jcromartie | I don't think that' sit. |
| 11:43 | jcromartie | the SQL Server driver is complaining that there's no such thing as <table name> |
| 11:43 | jcromartie | let me paste the example |
| 11:45 | dnolen | gtrak: TimMc: to clear, the program they showed was an interpreter embedded into miniKanren. So it could run programs, generate programs, and check programs. |
| 11:47 | jcromartie | duck1123: https://gist.github.com/a518bece0b38b23ab226 |
| 11:50 | duck1123 | jcromartie: I don't know much about SQL server, but is the table actually named tblEmployees |
| 11:50 | jcromartie | yes |
| 11:52 | duck1123 | what happens if you change :subname to include the db-name, that's how I had to do it in mysql |
| 11:57 | jcromartie | hm |
| 12:00 | jcromartie | Korma just uses clojure.java.jdbc anyway, though |
| 12:10 | jkdufair | can anyone recommend a strategy for shuffling a list but applying a set of constraints to the shuffle? i'm trying to "pick names from a hat" for our christmas list but don't want siblings to get one another |
| 12:11 | jkdufair | here's what i have so far: http://pastebin.com/z9j49kvi |
| 12:11 | joegallo | generate a seq of calls to shuffle, and then filter out shufflings where the constraints don't apply |
| 12:11 | joegallo | get the first result that wasn't removed |
| 12:12 | jkdufair | yeah i thought of that. kind of brute force but for such a quick util that would work. thx! |
| 12:12 | joegallo | yeah, computers are fast, you'll be fine ;) |
| 12:13 | joegallo | consider (zip-map (shuffle kids) kids) for that |
| 12:14 | jkdufair | yes indeed |
| 12:28 | Raynes | jkdufair: To pair the kids, you're pulling them out two at a time? |
| 12:28 | jkdufair | MayDaniel: yes |
| 12:28 | jkdufair | Hehe. sorry |
| 12:29 | Raynes | Just curious. I'm playing around with it. |
| 12:29 | jkdufair | thanks. brute force not working super well |
| 12:33 | michael_campbell | jkdufair: Not trying to suggest anything different here, but your latest pastebin reminds me very much of the toy example of Cascalog that was presented at conj. I doubt you'll need to do something like this with petabytes of Kid's, however... ;-) |
| 12:34 | jkdufair | michael_campbell: yeah, we'd have a whole different problem to solve if we had petabytes of kids. though sometimes it feels like we do |
| 12:34 | michael_campbell | hah, I bet. Still, the abstractions in the cascalog interface might give you some ideas. |
| 12:34 | ejackson | but, to take michael_campbell's statement one further, you could try logic programming :) |
| 12:35 | jkdufair | yeah, it seems to boil down to a CSP. i'll take a look at cascalog |
| 12:35 | michael_campbell | and... what ejackson said, too. My brain is too small for that just now. (or maybe, just wired incorrectly due to years of thinking wrong!) |
| 12:36 | ejackson | cascalog requires, I think, that you install all of hadoop, which is overkill |
| 12:36 | jkdufair | hehe. though i've been looking for an excuse to learn hadoop. |
| 12:36 | ejackson | i think core.logic can solve this for you |
| 12:36 | michael_campbell | Dunno; the examples at the conj were against normal flat files I thought? |
| 12:37 | ejackson | yes, but remember all the processing, i think that was dispatching jobs to a local hadoop. |
| 12:37 | michael_campbell | I was actually considering looking at it as a db layer against RDBMS' ... but then I think I want to play around with Korma, too |
| 12:37 | michael_campbell | ejackson: that could be; I think you're right, in fact. |
| 12:38 | michael_campbell | now that you say it, it looks like this is a good sized entry project for some core.logic spelunking. |
| 12:39 | jcromartie | hooray |
| 12:39 | jcromartie | Korma is working for me now, BTW... duck1123 |
| 12:39 | ejackson | beware of the Mad Hatter :) |
| 12:39 | jcromartie | duck1123: I followed your subname advice |
| 12:40 | duck1123 | jcromartie: good to hear |
| 12:40 | jcromartie | now to get into Korma proper |
| 12:42 | fliebel | I'm probably looking at a spelling mistake here... any ideas? http://pastebin.com/gbTWDKsM |
| 12:43 | fliebel | duck1123: How is OStatus doing? |
| 12:43 | duck1123 | fliebel: I absolutely hate the Salmon protocol |
| 12:44 | Raynes | technomancy: ping |
| 12:46 | fliebel | duck1123: Yea, I've heard that before. They do some weird custom security encryption bit twidling, right? |
| 12:47 | duck1123 | fliebel: yeah. I'm still trying to figure out how best to apply it. Once I do that, I should be able to send subscription notices to status.net servers pretty easily |
| 12:49 | jcromartie | fliebel: did you get it? |
| 12:49 | fliebel | duck1123: How monolithic is your implementation? In other words, can I reuse some components? |
| 12:49 | fliebel | jcromartie: ? |
| 12:49 | jcromartie | fliebel: the :refer-clojure problem |
| 12:50 | fliebel | jcromartie: no :( It looks alright to me, but it does not work. |
| 12:50 | jcromartie | after quitting and restarting the REPL? |
| 12:51 | duck1123 | fliebel: the salmon part is still pretty deeply integrated. I've been trying to think of the best way to extract it, but it's tied to my notion of an activity atm |
| 12:51 | fliebel | jcromartie: yea, cake kill & cake repl, (use... |
| 12:51 | fliebel | duck1123: What do you think about activitystreams in json? |
| 12:53 | duck1123 | fliebel: I have serialization as json working, but I am not yet parsing json activity streams |
| 12:54 | fliebel | duck1123: I should have a closer look at your impl, before reinventing the wheel. TBH, I'm a bit afraid of your VC framework, for no apparent reason. |
| 12:55 | fliebel | *mvc |
| 12:56 | duck1123 | lol, it's a bit intimidating. I just pushed out a dev branch that has my un-cleaned up work from this weekend |
| 12:58 | fliebel | solution for the refer problem: do not overwrite core fns |
| 13:03 | TimMc | fliebel: The problem is a (defn assoc-in ...) in the same file as that snippet? |
| 13:03 | technomancy | Raynes: what's up? |
| 13:03 | fliebel | TimMc: yes. |
| 13:04 | jcromartie | loving the Korma so far... pretty early on though |
| 13:04 | TimMc | OK, should be easy for me to test locally then. |
| 13:05 | Raynes | technomancy: I was curious about your policy on giving people write access to the Leiningen repo. If it isn't inappropriate it, I'd like some of that so I can throw up branches of my cake -> leiningen and template work. |
| 13:06 | Raynes | If any of that made sense, please congratulate me. |
| 13:06 | technomancy | Raynes: once you get one accepted pull request you can have commit access, but potentially destabilizing stuff needs to be done on branches, naturally. |
| 13:06 | Raynes | Of course. |
| 13:07 | technomancy | the model that I've used so far with brand new tasks has been to get them polished in 3rd-party plugins and then merging them once they've been tested out and had a good community thumbs-up. |
| 13:07 | TimMc | fliebel: It is working for me... |
| 13:08 | TimMc | copy/pasted |
| 13:08 | fliebel | TimMc: Weird... Thanks. |
| 13:09 | Raynes | technomancy: Gotcha. |
| 13:09 | TimMc | Clearly, the problem is... "Nullified Parameter Destabilisation" |
| 13:09 | technomancy | Raynes: what did you have in mind specifically besides spawn? |
| 13:10 | Raynes | technomancy: Well, I don't really know yet. |
| 13:10 | technomancy | also, have you seen https://github.com/technomancy/leiningen/wiki/VersionTwo ? I expanded it a fair bit on my flight yesterday |
| 13:10 | fliebel | TimMc: Uh? So should I flip the input of the bloom array smoke screens? |
| 13:11 | TimMc | No! That will destabilize the redundant fitler drive. |
| 13:11 | TimMc | *filter |
| 13:11 | TimMc | and then you'll have two problems |
| 13:11 | fliebel | technomancy: I read a tweet or two about a cake + lein effort, what's what all about? |
| 13:12 | TimMc | Seriously though, your computer is insane. |
| 13:12 | technomancy | Raynes: the first point on "Open Questions" is the main thing that came up with the discussions with ninjudd. I want to see if we can state the problem precisely to help reason about the complexity vs benefit. |
| 13:12 | technomancy | if it's just additional defproject entries (which may affect classpath) then it's conceptually pretty simple. |
| 13:12 | Raynes | fliebel: I don't think there has been a formal announcement, but we've all decided (cake team + leiningen) that we'd like to work together on Leiningen rather than maintain cake and do the not-really-competing thing from now on. |
| 13:13 | fliebel | Raynes: Ok, so Leiningen it is. Maybe that also solves my refer-clojure problem :) |
| 13:13 | technomancy | fliebel: http://devinewines.ca/eventAuctions/auctionImages/powers_combined.jpg |
| 13:14 | Raynes | technomancy: Yeah, I'm purposely avoiding the whole contexts discussion while silently listening in from the back. I still don't really understand the whole concept. |
| 13:14 | wastrel | so hi folks |
| 13:14 | Raynes | Or maybe I just don't understand why it is so important. |
| 13:15 | technomancy | oh, this one's not bad either: http://images.cheezburger.com/completestore/2009/9/8/128969149726151424.jpg |
| 13:15 | wastrel | semi offtopic but when i first started reading about lisp i saw a deconstruction of hello world programs from other languages, how even though they're very simple they're all quite buggy and inconsistent with the syntax/rules of the language |
| 13:15 | fliebel | technomancy: I have photoshop... |
| 13:15 | wastrel | any idea where i can find that again? |
| 13:16 | technomancy | fliebel: there are surprisingly few good captain planet image macros readily searchable |
| 13:16 | wastrel | captain planet is/was godawful |
| 13:17 | gtrak | we're the planeteers, you can be one too, cuz saving our planet is the thing to do |
| 13:17 | technomancy | fliebel: basically a bunch of kids summon an environmental superhero with their magic rings; the catchprase was "by our powers combined..." |
| 13:17 | technomancy | also he had a mullet |
| 13:17 | gtrak | he was a lot like macgyver |
| 13:18 | fliebel | "Leiningen and the Cake" or "The ants are a lie" |
| 13:19 | technomancy | wow, Jeff Goldblum briefly voiced a Captain Planet villain‽ |
| 13:21 | cemerick | technomancy: Your meme prowess astonishes. :-) |
| 13:21 | technomancy | I been practicin'. |
| 13:22 | cemerick | The first thing I saw upon walking into the hotel bar on Wednesday night was pimp my ride on all screens, which was hilarious. |
| 13:23 | jcromartie | is "doc" gone from Clojure 1.3 |
| 13:23 | gtrak | i always thought acid rain was pretty cool |
| 13:23 | raek | jcromartie: no, it moved to clojure.repl/doc |
| 13:23 | jcromartie | ah |
| 13:23 | jcromartie | that's kind of noob-hostile, isn't it? |
| 13:23 | cemerick | jcromartie: nearly all REPLs (including Clojure's command-line one) use it in all namespaces implicitly. |
| 13:24 | cemerick | so, it should be available as before |
| 13:24 | michael_campbell | I just tried it in a repl; worked for me |
| 13:24 | jcromartie | hm |
| 13:24 | jcromartie | well after I (in-ns 'foo) in lein repl |
| 13:24 | jcromartie | I don't have it |
| 13:24 | michael_campbell | mind you, at this stage in my clojurification, I *LIVE* in "doc". |
| 13:24 | jcromartie | but maybe that's not the right way to do it? |
| 13:25 | jcromartie | when I'm developing I typically do: (require 'my-ns.core :reload) (in-ns 'my-ns.core) |
| 13:25 | jcromartie | for convenience |
| 13:25 | cemerick | jcromartie: in-ns only moves you into a namespace. ns is what defines one and performs all the initial refers into said namespace (including stuff from clojure.core and clojure.repl) |
| 13:26 | jcromartie | so, what's a better way to do it |
| 13:26 | jcromartie | (ns dev (:use my-ns.core :reload)) |
| 13:26 | technomancy | cemerick: oh wow, you mean clojure.repl comes along for the ride with refer-clojure if it detects you're in a repl? |
| 13:26 | cemerick | technomancy: provided by clojure.main/repl, IIRC |
| 13:27 | jcromartie | hm |
| 13:27 | jcromartie | (ns ...) doesn't include clojure.repl :) |
| 13:27 | cemerick | jcromartie: do you have doc available immediately upon starting your repl? |
| 13:27 | jcromartie | when I'm in lein repl |
| 13:27 | jcromartie | let's find out |
| 13:27 | jcromartie | yeah |
| 13:28 | cemerick | oh, I see what's happening |
| 13:29 | cemerick | hrm, maybe not |
| 13:29 | jcromartie | I'm using Clojure 1.3.0 if it makes a difference |
| 13:30 | technomancy | yeah, I don't think new nses get it |
| 13:31 | eftate | how much memory does a sequence use per element |
| 13:32 | cemerick | ah, I get the repl/pprint/etc refers automatically in every namespace because nREPL uses a new clojure.main/repl invocation for each expression. |
| 13:32 | cemerick | Not sure if that's a good thing or not. :-/ |
| 13:33 | eftate | might be a bad idea for me to read a file through a sequence of tokens |
| 13:33 | cemerick | eftate: however much memory each element requires |
| 13:34 | eftate | by my calculation sequence adds 40 bytes per element |
| 13:34 | eftate | or 32 if it's not lazy one |
| 13:34 | eftate | but since a lot of core functions return lazy ones... |
| 13:38 | eftate | so a sequence of strings is 40 for sequence element + 24 for string element + string length * 2 provided no japanese or something characters are used |
| 13:40 | eftate | or on 64 bit system sequence element takes up 80 bytes + 44 for string element + string length * 2 |
| 13:40 | eftate | hm... better stick with java char arrays |
| 13:50 | jkdufair | thanks for the help with the xmas gfit algorithm folks. my simple solution: http://pastebin.com/Ls4aqz95 |
| 13:52 | tsdh | Hi technomancy |
| 13:52 | tsdh | Is it possible to run leiningen with clojure 1.3? |
| 13:53 | amalloy | jkdufair: you can simplify is-sibling? and related functions a fair bit |
| 13:53 | technomancy | tsdh: Leiningen 2.0 will use Clojure 1.3. If you want to execute code requiring 1.3 in Leiningen 1.x you can use eval-in-project with a dummy project |
| 13:54 | amalloy | (defn siblings? [& kids] (apply = (map :family-name) kids)), for example |
| 13:54 | tsdh | technomancy: Thanks, I'll look it up. |
| 13:54 | technomancy | tsdh: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md <- see the "Clojure Version" heading |
| 13:54 | amalloy | er, misbalanced parens there but i hope you get the idea |
| 13:55 | tsdh | technomancy: That's exactly my use case. :-) |
| 13:56 | technomancy | tsdh: for clojurescript? |
| 13:56 | jkdufair | amalloy: do tell |
| 13:56 | jkdufair | oh thx! |
| 13:56 | amalloy | anyway, you can pull that testing logic up a bit as well: (defn attr-tester [attr] (fn [& kids] (apply = (map attr kids)))), (def is-sibling? (attr-tester :family-name)) |
| 13:56 | cemerick | technomancy: are different authentication bits in e.g. ~/.lein/init.clj considered "config files"? |
| 13:57 | cemerick | in VersionTwo, that is, sorry |
| 13:57 | jkdufair | cool. thk you |
| 13:57 | tsdh | technomancy: I've written a simple documentation generator that doesn't parse the sources but loads them and then generates the docs from the metadata. That means, that this leiningen plugin has to run with the project's :dependencies. |
| 13:57 | technomancy | cemerick: I was thinking specifically of properties and .clj that's read off the classpath, but user-settings would probably be another thing to add |
| 13:58 | jkdufair | amalloy: what does the & in the fxn arg mean? |
| 13:58 | cemerick | technomancy: that's actually my #1 usage of profiles in maven-land. |
| 13:58 | tsdh | jkdufair: It's a varargs function. |
| 13:58 | jkdufair | oh ok |
| 13:58 | technomancy | tsdh: in that case you should probably use eval-in-project with the actual project, not a dummy project. =) |
| 13:58 | technomancy | cemerick: interesting; good to know. |
| 13:59 | cemerick | +1 to generating pom.xml w/o maven itself, FWIW |
| 13:59 | tsdh | technomancy: Yep. Do I put that simply into the definition of the leiningen plugin? |
| 13:59 | technomancy | cemerick: oh, how so? for more reasons than just trimming the deps? =) |
| 14:00 | cemerick | Who wants to be the one to maintain leiningen.pom when some new bit of config should get surfaced in the XML? ;-) |
| 14:01 | technomancy | tsdh: yeah, you can see the test task for an example of running code in the project's classpath |
| 14:02 | tsdh | technomancy: Great, thanks. |
| 14:04 | TimMc | OK, I've got some Clojure code I'd like to run from Java. The .clj files are on the classpath, but I don't know how to *effectively* use gen-class and RT.var.invoke. |
| 14:04 | TimMc | Any good example projects I can look at? |
| 14:05 | gtrak | you shouldn't need to invoke if you're gen'ing a class, right? |
| 14:05 | gtrak | you can create an arbitrary facade |
| 14:05 | TimMc | The Clojure is included as source -- I need to call RT to find them. |
| 14:05 | TimMc | I don't have the luxury of a separate project compiling to a jar. |
| 14:06 | gtrak | uhh, so you're going to create a class dynamically and load it? |
| 14:06 | gtrak | and have java code reference a dynamically loaded class? |
| 14:06 | TimMc | Well, something like this I guess: http://stackoverflow.com/questions/2181774/calling-clojure-from-java/6410926#6410926 |
| 14:07 | gtrak | you still need to get clojure.jar to compile your namespaces |
| 14:07 | gtrak | but i suppose that will work |
| 14:07 | amalloy | TimMc: if the code isn't being AOT-compiled i don't believe you can use gen-class |
| 14:08 | gtrak | yea, gen-class makes no sense with that technique |
| 14:08 | TimMc | Hmm, right. |
| 14:08 | amalloy | so you more or less have to use RT.var to find whatever functions and invoke them |
| 14:08 | TimMc | So raek's example there on Stack Overflow is still appropriate? |
| 14:08 | amalloy | yes, that is what i would do |
| 14:09 | amalloy | (in what i understand your situation to be) |
| 14:09 | TimMc | And the "namespace" of com/company/ui/index.clj would be "com.company.ui.index", yeah? |
| 14:10 | TimMc | (I'm trying to use Enlive to generate HTML for this Java project.) |
| 14:10 | amalloy | *nod* |
| 14:11 | gtrak | does it automatically compile for you when you do it that way? |
| 14:12 | TimMc | I think so? |
| 14:12 | amalloy | gtrak: when you require it |
| 14:12 | gtrak | oh I see, there's a Compiler.load( that he calls |
| 14:13 | gtrak | not raek, but the other one |
| 14:14 | TimMc | hell yes |
| 14:14 | TimMc | Totally works. |
| 14:14 | tsdh | technomancy: Hm, now my problem is that in fact, I have to run the complete plugin in my project. However, I get the project not before the entry function is called... |
| 14:16 | technomancy | tsdh: gilardi scenario'd! |
| 14:16 | tsdh | technomancy: When wrapping the body of the entry fn in an eval-in-project, the functions called from there are not defined. Should I wrap every definition in an eval-in-project as well? |
| 14:16 | technomancy | you should read this: http://technomancy.us/143 |
| 14:17 | technomancy | basically you have to require the namespaces you need in another form with the init arg |
| 14:24 | TimMc | Preferred method for setting up a new Emacs for Clojure work? |
| 14:24 | TimMc | My old el-get script is not quite working. |
| 14:26 | tsdh | technomancy: Argh. Then it doesn't find the leiningen.compile namespace. Does that mean that I have to add leiningen to the :dependencies? |
| 14:27 | technomancy | tsdh: eh, you're trying to configure an AOT compilation from inside the project? |
| 14:28 | tsdh | technomancy: No, but for my plugin to use eval-in-project I have to require/use leiningen.compile. But when the plugin runs in the project, then that's not on the classpath. |
| 14:28 | technomancy | oh, I see. yeah, you need to keep things in separate namespaces. |
| 14:29 | technomancy | the task goes in leiningen.mytask, but the code that needs to run in the project should be in a different namespace |
| 14:29 | technomancy | swank-clojure actually might be a better example here |
| 14:29 | technomancy | src/leiningen/swank.clj runs in leiningen's process, but it calls eval-in-project to run code from src/swank/swank.clj and such. |
| 14:30 | tsdh | Ok, then I'll check that out. |
| 14:37 | amalloy | chouser: i seem to be listed as the project lead for DXML on jira. would you like to hold that lofty position instead? |
| 14:40 | tsdh | technomancy: Yay, that does the trick! |
| 14:41 | TimMc | argggh "Symbol's function definition is void: paredit-mode" |
| 14:42 | technomancy | tsdh: if you have suggestions on how the documentation could be clearer I'm interested |
| 14:46 | TimMc | Setting up Emacs is the most frustrating thing ever. |
| 14:46 | yazirian | It isn't so much an installation as a lifestyle choice. |
| 14:46 | TimMc | It isn't so much an installation as oh god what does anything mean. |
| 14:47 | TimMc | Or, why doesn't anything work in this otherwise identical setup. |
| 14:47 | TimMc | Is el-get a bad idea? That's what I'm trying to use to get paredit-mode. |
| 14:47 | cemerick | yazirian: that's cute |
| 14:47 | technomancy | I have no idea what the point of el-get is |
| 14:47 | yazirian | :) |
| 14:48 | tsdh | technomancy: Hm, I think that the case where only one form has to be evaluated in some other context is quite rare. So I'd use another example in the plugin docs, where the "real" plugin code is in leiningen.myplugin.core and the "real" plugin function leiningen.myplugin/myplugin simply evals (and requires) that in some other context. |
| 14:48 | cemerick | "emacs is a lifestyle choice" is apparently a common phrase/notion, though I hadn't noticed it before |
| 14:48 | yazirian | I've only ever either used package-install, or done it by hand. |
| 14:49 | TimMc | The guy who set me up with a .emacs on my laptop used el-get. |
| 14:50 | yazirian | This reminds me of a thing. A couple of weeks ago I got this wild idea to use SLIME from CVS. Imagine my surprise when the repl buffer stopped working. |
| 14:50 | TimMc | Is it worth upgrading to Emacs 24 (from 23) or is that going to be another rat pit? |
| 14:50 | technomancy | tsdh: yeah, in most cases it makes sense to keep the plugin as thin as possible and have all the code in something that's totally decoupled from lein |
| 14:50 | technomancy | I've found 24 to be more stable than 23 |
| 14:53 | mefesto | emacs24 available on ubuntu? i glanced through the software center but didn't see it |
| 14:53 | TimMc | Oog, dependency hell. |
| 14:54 | technomancy | mefesto: http://emacs.naquadah.org/ is the only source I know of for .debs |
| 14:54 | mefesto | technomancy: thanks |
| 14:54 | TimMc | Not gonna work on Linux Mint (not my idea). |
| 14:55 | technomancy | it's not bad to build from source as long as you get it from a git mirror rather than bzr |
| 14:56 | TimMc | That might not help with the dependencies. |
| 14:56 | TimMc | I don't want to install only to find out a week later that it *really needs* that version of ImageMagick, etc. |
| 14:56 | technomancy | yeah, you have to do a build-dep first, but build-dep of emacs23 gets you what you need to build 24 |
| 14:56 | technomancy | no idea how to do that without apt though |
| 14:57 | TimMc | Automatic package management is only nice if you live on the cutting edge. |
| 14:57 | technomancy | huh? |
| 14:57 | TimMc | Well, if something keeps you from being at the latest release of a distro, everything goes to hell. |
| 14:58 | TimMc | Ubuntu is terrible about making backports, and my understanding is that's not unusual. |
| 14:58 | technomancy | oh, for system libraries; I see |
| 14:59 | TimMc | ...and I'm on some godawful Ubuntu derivative called "Mint" which is even further removed from the latest repos. |
| 14:59 | amalloy | TimMc: i ran 24 for a week or two and had serious problems with window/frame management so i went back to 23. i understand most people don't have this issue though |
| 15:00 | yazirian | trying 24 now... it did some weird thing where it sent the initial frame to a different desktop |
| 15:00 | yazirian | but nyan-mode works, so i think we can be friends |
| 15:01 | technomancy | I'm telling you, lexical scope changes everything. |
| 15:01 | TimMc | So... `git clone https://github.com/technomancy/emacs-starter-kit.git .emacs.d` ? |
| 15:02 | yazirian | whoa... 24 has lexical? if i had known i would've been on it the day after they merged that |
| 15:02 | technomancy | TimMc: it's changed a bit with version 2; see the readme |
| 15:02 | TimMc | technomancy: Can't use v2, I'm on 23. |
| 15:03 | technomancy | TimMc: right; you will need to switch to the master branch then; the v2 branch is default now |
| 15:03 | TimMc | aha, I see the problem |
| 15:04 | TimMc | *bam* |
| 15:05 | scottj | does lein's :shell-wrapper actually work? |
| 15:05 | technomancy | scottj: it's certainly lightly-tested |
| 15:06 | technomancy | and it doesn't work on Java 1.5 |
| 15:06 | scottj | technomancy: is it created on lein jar or lein uberjar, and it appears in ~/.lein/bin? |
| 15:07 | technomancy | the jar task just puts it in the jar; only the 2-argument version of lein install places it in ~/.lein/bin |
| 15:07 | TimMc | WHat is the emacs-starter-kit way of getting Clojure mode, paredit, paren coloring, etc.? |
| 15:07 | technomancy | scottj: probably an oversight if the in-project version of lein install doesn't do it |
| 15:07 | scottj | technomancy: what command actually creates the shell script? |
| 15:08 | technomancy | scottj: "lein install swank-clojure 1.3.3" should do it |
| 15:08 | technomancy | oh, maybe lein plugin install too |
| 15:12 | TimMc | I see, package.el |
| 15:15 | gtrak | is dynamic binding gone now? |
| 15:15 | technomancy | gtrak: in elisp? it's still default; you have to opt-in to lexical scope since otherwise you'd break tons of stuff. |
| 15:15 | gtrak | TimMc, I got fed up with ubuntu for a few years, and now I love Arch, I use ubuntu for VMs though |
| 15:16 | dnolen | gtrak: no, you just need to declare which things will be dynamic with ^:dynamic |
| 15:16 | gtrak | ah, dnolen i meant in emacs, sorry :-) |
| 15:18 | scottj | is there a command to pr-str maps, vectors, keywords etc with their meta data in a way that works with read-string? |
| 15:18 | scottj | (or maybe it's not pr-str that I want) |
| 15:20 | technomancy | scottj: pr-str with *print-metadata* bound, I think |
| 15:20 | gtrak | print-dup? |
| 15:23 | amalloy | *print-meta* |
| 15:23 | technomancy | that's the one |
| 15:23 | amalloy | &(binding [*print-meta* true] (pr-str (with-meta [] {:foo 1}))) |
| 15:23 | lazybot | java.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad! |
| 15:24 | amalloy | ,(binding [*print-meta* true] (pr-str (with-meta [] {:foo 1}))) |
| 15:24 | clojurebot | "^{:foo 1} []" |
| 15:24 | amalloy | Raynes: wait, does lazybot not allow any bindings at all now? if so that sounds like a mistake |
| 15:24 | scottj | cool thanks! |
| 15:24 | Raynes | amalloy: He hasn't allowed for bindings since like 10 months ago. |
| 15:25 | Raynes | Not that I exactly know why. I'm sure I had a reason. |
| 15:25 | amalloy | i guess maybe because binding is a macro expanding to push/pop of threadbindings, and you can't allow people to push without popping? |
| 15:26 | Raynes | Seems like pop was a problem. |
| 15:26 | amalloy | either direction would be |
| 15:26 | mefesto | upgrade to emacs24 went surprisingly smooth :) |
| 15:27 | Iceland_jack | mefesto: :) |
| 15:28 | brehaut | apparently i am connected to the internet via a yoyo today |
| 15:29 | gtrak | if pushed or popped, individually, that sounds bad, but if both, why not? any weirdness would be caught by other guards |
| 15:30 | Raynes | gtrak: Well, binding is a macro that expands to those things. clojail macroexpands all code. If we want to allow for bindings, we have to allow for the things that it expands to, thus allowing for those things individually. |
| 15:33 | gtrak | does binding have to be a macro? |
| 15:34 | gtrak | or rather, maybe you can check if they appear in non-macro-expanded form, if they're used within a binding it should be safe |
| 15:35 | gtrak | actually, the more i think about it, the worse it seems :-) |
| 15:36 | gtrak | how about resetting the bindings for each executed form? too slow? |
| 15:36 | gtrak | or only if one of those were called |
| 15:39 | mefesto | gtrak: would with-bindings* work? |
| 15:39 | gtrak | same problem, right? |
| 15:39 | mefesto | ,(doc with-bindings*) |
| 15:39 | clojurebot | "([binding-map f & args]); Takes a map of Var/value pairs. Installs for the given Vars the associated values as thread-local bindings. Then calls f with the supplied arguments. Pops the installed bindings after f returned. Returns whatever f returns." |
| 15:39 | mefesto | it's a function |
| 15:40 | gtrak | the issue is it's hard to check if the user did the right thing, since we're not doing any static analysis |
| 15:40 | amalloy | gtrak: resetting each time isn't really possible because you can only really do it using push/pop thread bindings, which the user can break |
| 15:40 | gtrak | amalloy, directly to java? |
| 15:40 | gtrak | looking at it right now: static final ThreadLocal<Frame> dvals = new ThreadLocal<Frame>(){ |
| 15:41 | gtrak | the user can break the clojure vars that have the macros :-), but resetting them through java would have the same effect, no? |
| 15:42 | gtrak | and since it's thread-local, it shouldn't affect anyone else |
| 15:43 | gtrak | ha, what if he runs another thread and does it there? :-) |
| 15:43 | gtrak | say, in an agent |
| 15:48 | amalloy | gtrak: threads are pooled anyway, so thread-localness isn't really relevant |
| 15:48 | amalloy | someone else will wind up wanting to reuse the future he's broken |
| 15:49 | gtrak | yea exactly |
| 15:49 | gtrak | ah, didn't know futures were pooled |
| 15:49 | gtrak | but same issue there |
| 15:55 | cemerick | Interesting that rest is called more in ISeq. |
| 16:02 | amalloy | cemerick: a lot of weirdness in general, on the java side |
| 16:07 | dnolen | cemerick: yeah I always found that a bit odd, fixed in CLJS |
| 16:15 | TimMc | Why do the .java files in clojure.lang have no Javadocs? |
| 16:15 | Raynes | It was just officially announced that Leiningen and Cake are joining forces: https://groups.google.com/d/msg/clojure-cake/GG7DbCQmmW4/Uh7IdWNFmdwJ |
| 16:15 | TimMc | Makes interop hard from the Java side. |
| 16:17 | cemerick | Raynes, ninjudd, amalloy, lancepantz, et al.: seems like a win-win for everyone. Thank you. :-) |
| 16:17 | dnolen | exciting stuff |
| 16:18 | gtrak | awesome |
| 16:18 | joly | great news |
| 16:19 | cemerick | how often do "competing" open source projects "merge"? Must be a first. :-P |
| 16:19 | licenser | Raynes: awesome! |
| 16:20 | amalloy | cemerick: didn't rails soak up some competing project? i'm not much of a rubyist but i heard ninjudd mention something like that at dinner |
| 16:20 | pnicholson | cemerick: rails + merb |
| 16:20 | cemerick | amalloy: 'tis true. OK, a second instance of the phenomenon. |
| 16:20 | cemerick | :-P |
| 16:20 | fliebel | Will Lein 2 have anything to do with nREPL? |
| 16:21 | cemerick | fliebel: a lein-nrepl plugin will be appearing shortly, and ninjudd and I have been in early talks to make sure nREPL has whatever they need to make the transition for cake users as smooth as possible. |
| 16:22 | tomoj | does that mean lein gets ruby? |
| 16:22 | cemerick | I can't imagine. |
| 16:22 | Raynes | tomoj: It isn't a 'merge'. |
| 16:22 | Raynes | I hope people don't start throwing that word around. |
| 16:23 | cemerick | Raynes: sorry, I think I'm the one that threw that around. |
| 16:23 | tomoj | wonder if this is why clojure-cake.org is down |
| 16:23 | Raynes | It is "we, the cake team, are becoming a part of Leiningen. As such, we will contribute our cake features and code that make sense to Leiningen and work with the Leiningen team to make it better". |
| 16:23 | cemerick | (in quotes for a reason, FWIW) |
| 16:24 | gtrak | a people not code-merge |
| 16:24 | michael_campbell | cemerick: Struts2 also subsumed WebWork in the java UI framework world. |
| 16:24 | cemerick | michael_campbell: people still use struts, or any derivation thereof? :-O |
| 16:24 | fliebel | Pyramid did something aweful to Pylons and... whatever |
| 16:24 | amalloy | tomoj: hah no, i think that's an accident. ninjudd, any idea? i can't believe the dns record just happened to expire right now |
| 16:25 | Raynes | cemerick: No worries, just don't want it to be taken too literally. :p |
| 16:25 | moogatronic | cemerick: god help them, but yes. in fact, I consult on a struts 1 project even. |
| 16:25 | michael_campbell | cemerick: Tis true. My company does. Hence my casual throwing around of describing my day to day existence as "soul crushing" at the conj. |
| 16:25 | cemerick | Seriously. |
| 16:25 | moogatronic | the code even goes into CVS. =) |
| 16:25 | cemerick | Raynes: I'll from now on refer to it as The Goodness™. |
| 16:25 | michael_campbell | <- svn here. |
| 16:25 | Raynes | amalloy: No, it has been down for days. I told ninjudd at the conj, and he replied letting me know of his decision to work with Leiningen./ |
| 16:26 | Raynes | So maybe it is related. ;) |
| 16:26 | michael_campbell | This combining of efforts seems only but good, no? |
| 16:26 | moogatronic | i tried for SVN, but then I was tasksed with producing proof on why SVN was better in the form of a giant manual. |
| 16:26 | moogatronic | LMGTFY wasn't sufficient |
| 16:26 | michael_campbell | moogatronic: "atomic commits" usually gets some attention. |
| 16:26 | moogatronic | yeah, i tried that. |
| 16:26 | moogatronic | =) |
| 16:27 | michael_campbell | moogatronic: except for PHB's, who think "atomic" means "nuke it from orbit", which, while cool, isn't what you're going after (or, maybe you are) |
| 16:27 | moogatronic | the problem was the dinosaur chair-warming programmers who still wanted to go back to RCS |
| 16:27 | moogatronic | even though they mostly watch youtube videos all day instead of do any work. |
| 16:27 | michael_campbell | oh god. |
| 16:28 | michael_campbell | SCCS... |
| 16:28 | michael_campbell | DVCS... <shudder> |
| 16:28 | michael_campbell | err, PVCS, rather |
| 16:28 | joly | I got to interact with RCS, SCCS, and PVCS through recursive makefiles. I was glad to see the end of that "fun" |
| 16:29 | moogatronic | needless to say, git was out of the question as an upgrade option. =) |
| 16:29 | seancorfield | back |
| 16:29 | moogatronic | thankfully that isn't my full time thing. when it was though, 'soul crushing' was the exact adjective I used when talking to others about my job. |
| 16:30 | michael_campbell | that's because it is. |
| 16:30 | chouser | I'm going to apologize in advance, because but I'm going to go ahead and pretend this is #emacs |
| 16:30 | michael_campbell | I was, nay, *AM* ready to jump ship to a clojure shop, today. But I don't feel I know enough yet to be useful; like Groucho Marx said, I don't want to join any club that would have me as a member.... yet. |
| 16:31 | chouser | what's the appropriate way to dismiss a buffer such as *Help* that has popped up in front of what I want? |
| 16:31 | moogatronic | I kill it. |
| 16:31 | cemerick | Just click on the…oh, nevermind. |
| 16:31 | michael_campbell | C-x k |
| 16:31 | chouser | C-x k *Help* seems brutal and clumsy |
| 16:31 | chouser | oh |
| 16:31 | chouser | ok |
| 16:32 | gtrak | the thing I'm most excited about after conj is the prospect of a rules-engine for a type-system or whatever, that sounds freaking awesome |
| 16:32 | chouser | brutal and clumsy it is, then. :-) |
| 16:32 | brehaut | chouser: 'brutal and clumsy' is the emacs way isnt it? |
| 16:32 | michael_campbell | If it's the current buffer, just return. |
| 16:32 | jcromartie | hm, I'm not sure I can count on Korma to deliver performance when the joins are done lazily in a 1 + N subqueries fashion |
| 16:32 | michael_campbell | Or C-x b to switch to another buffer. |
| 16:32 | jcromartie | if I just want a little bit of extra info on 1K things, that's 1K queries |
| 16:32 | chouser | ok, thanks. |
| 16:32 | michael_campbell | and just let *Help* sit in the back. |
| 16:32 | moogatronic | chouser: on my mac cmd-k kills it. |
| 16:32 | moogatronic | i just think of it as 'close' |
| 16:32 | moogatronic | =) |
| 16:32 | michael_campbell | Or... M-x bury-buffer to make it go WAY back. |
| 16:32 | amalloy | chouser: usually it also pops up a recommendation in the minibuffer like C-x 1 or C-x 4 C-o RET |
| 16:32 | TimMc | chouser: Your window has divided into two buffers, yes? |
| 16:33 | jcromartie | jcromartie: it would be better if the db lib would do the join and "roll up" the records on the PK |
| 16:33 | jcromartie | instead of a subquery |
| 16:33 | TimMc | chouser: Expand the current buffer using C-x 1 or the other using C-x 0. |
| 16:33 | michael_campbell | jcromartie: I havent played w/Korma yet but can you not specify the entire query? (including joins)? |
| 16:34 | chouser | I had two windows open and *Help* replaced one of them. Killing it is just 3 keystrokes. If that's the right thing, I'm all set. |
| 16:34 | gtrak | dnolen, this a-la-carte type system idea is an awesome one |
| 16:34 | jcromartie | michael_campbell: if you specify joins along relations, for instance, (select vendors (with accounts) ...) Korma will issue a separate account query for each vendor |
| 16:35 | jcromartie | it's the classic 1+N query problem |
| 16:35 | jcromartie | n + 1 selects |
| 16:35 | amalloy | chouser: that's a reasonable thing to do. emacs recommends C-x 4 C-o RET |
| 16:36 | amalloy | but just killing help isn't crazy, since that command is absurdly long |
| 16:36 | brehaut | jcromartie: have you looked at join as well as with ? |
| 16:36 | jcromartie | no |
| 16:36 | jcromartie | it's not mentioned in the docs |
| 16:36 | chouser | I guess I was hoping for something that would hide or kill the most recently opened buffer. |
| 16:36 | brehaut | jcromartie: http://sqlkorma.com/api/0.2.0/korma.core-api.html#korma.core/join |
| 16:36 | jcromartie | hm |
| 16:36 | amalloy | chouser: C-x 4 C-o RET is it, sadly. you can bind that function to a less stupid sequence |
| 16:37 | jcromartie | yeah at this point I may as well look back to ClojureQL |
| 16:37 | michael_campbell | chouser: C-x k <return> should kill whatever's in front of you. (Mind you, with the starter-kit, I don't know what black magic ido-mode is doing) |
| 16:37 | dnolen | gtrak: yes, tho rhickey took that idea a bit further in his talk. |
| 16:38 | brehaut | syntax hilighting question: do people prefer the symbols for marcos, special forms and functions to be highlight differently or the all the same? |
| 16:38 | michael_campbell | chouser: if you have multiple panes, C-x k <return> should kill whatever buffer in which the cursor is currently active. |
| 16:38 | gtrak | dnolen, yea, is there any groups thread for the static analysis idea or is it too fresh? |
| 16:39 | michael_campbell | brehaut: Good catch; I can't imagine Chris would have left out something as basic as joins. =) |
| 16:39 | gtrak | he doesn't seem like one to propose something that won't get done |
| 16:40 | cemerick | brehaut: you can't tell between the two statically, so symbols in fn position should be colored uniformly IMO. |
| 16:40 | cemerick | e.g. a macro whitelist is really just a "clojure.core whitelist" |
| 16:40 | cemerick | s/e.g./i.e. |
| 16:40 | brehaut | cemerick: thats what im leaning towards too; the idea of writing an inferencer in javascript is not appealing ;) |
| 16:40 | chouser | cemerick: I aussme you mean "if you can't tell ... statically" ;-) |
| 16:41 | chouser | assume. *sigh* |
| 16:41 | brehaut | cemerick: and having the highlighter guess incorrectly (or omiting things) could be quite annoying |
| 16:41 | cemerick | chouser: he's in javascript for the syntaxhighlighter brush, so…he can't. ;-) |
| 16:41 | dnolen | gtrak: most of those ideas were things he wasn't planning on taking on himself. |
| 16:41 | cemerick | brehaut: yeah, don't even try. Ow. :-) |
| 16:42 | gtrak | dnolen, yea it's a lot of work, I'm just interested in it and I want to know more :-) |
| 16:42 | brehaut | cemerick: lol :) |
| 16:42 | dnolen | gtrak: not much prior discussion that I know of, but Will Byrd also seem pretty interested in the ideas as well. |
| 16:42 | dnolen | gtrak: cool! |
| 16:42 | brehaut | cemerick: the repo now has a scruffy demo page in it btw |
| 16:42 | cemerick | nice |
| 16:43 | jcromartie | LauJensen: ping? |
| 16:44 | cemerick | once the cljs compiler is on par with Clojure's, then maybe two or three bootstrap phases will get a Clojure compiler in cljs and therefore js... |
| 16:44 | cemerick | and we can have some serious highlighting for the syntaxhighlighter brush |
| 16:44 | dnolen | gtrak: definitely should get the conversation started. I think it's a good idea to try and tackle the problem in ClojureScript first, where there considerably less complexity. |
| 16:44 | brehaut | cemerick: that would be fantastic :) |
| 16:45 | chouser | heh |
| 16:45 | chouser | I'm learning emacs. That's about all I can imagine accomplishing for the next 6 months or so. |
| 16:45 | cemerick | brehaut: your brush would be *big*, even if that worked. |
| 16:45 | jcromartie | chouser: give yourself a little more credit |
| 16:46 | seancorfield | someone at the conj said the first ten years were the hardest, then emacs gets easier... |
| 16:46 | brehaut | cemerick: i think its already the largest brush for the syntax highlighter :P |
| 16:46 | cemerick | jcromartie: chouser should give emacs more credit; it'll fight for longer than 6 months to yield up its jewels. |
| 16:47 | jcromartie | hah |
| 16:47 | raek | what convention does db-specs follow in Korma? the same as clojure.java.jdbc uses? |
| 16:47 | jcromartie | raek: yes |
| 16:47 | chouser | Ok, C-M-x works to eval a form, but the results show up in a line at the bottom of the screen |
| 16:47 | jcromartie | raek: clojure.java.jdbc (neé clojure.contrib.sql) is the standard for SQL connections and execution |
| 16:47 | chouser | is there some way to send them to the repl buffer instead? |
| 16:47 | jcromartie | like Ring for SQL :P |
| 16:48 | gtrak | dnolen, yea, I'll take a look, I had a compilers class a couple years back, but it seems like the rules are different in lisp |
| 16:48 | chouser | *slime-repl clojure*, specifically? Hopefully with both the expression and its results showing up? |
| 16:48 | raek | jcromartie: terrific. I'm currently checking out how smoothly sqlite works with Korma... |
| 16:49 | moogatronic | chouser: C-c C-e at the end of a s-exp? |
| 16:50 | amalloy | chouser: i don't think so. usually you send stuff "silently" |
| 16:50 | chouser | moogatronic: that prompts for a expression, the results of which still end up as a single line at the bottom of the screen. |
| 16:50 | moogatronic | yeah, nevermind. =) i thoguht i saw it down there before, but i must have hallucinated |
| 16:50 | chouser | amalloy: :-( |
| 16:51 | moogatronic | select, C-x o, paste, enter |
| 16:51 | moogatronic | =) |
| 16:51 | jcromartie | raek: I've spent the day in Korma, and I have to say... I'm going back to ClojureQL for now |
| 16:51 | michael_campbell | chouser, I've been "learning emacs" for 20+ years now. |
| 16:51 | dnolen | gtrak: I could be wrong but I think we can plug into the analyzer phase and store facts about forms as they are encountered. |
| 16:51 | gtrak | dnolen, actually before he said anything, I was already thinking of trying to build a language AST in RDF... we have an RDF rules-engine at work, built in clojure, though I've a lot to learn |
| 16:52 | amalloy | chouser: fwiw moogatronic meant C-x C-e, but that isn't what you want either |
| 16:52 | chouser | dnolen: either that or run the analyzer and consume its output entirely independantly of the normal compiler |
| 16:53 | moogatronic | amalloy: yes, thanks. =) |
| 16:53 | gtrak | dnolen, yes, so first you have to describe what constitutes a fact, then build rules that infer other facts |
| 16:53 | chouser | ok, so the slime usage pattern seems a bit different from inferior-lisp |
| 16:53 | chouser | like you're expected to perhaps load a whole file, but then switch to the slime buffer to actually try things interactively. |
| 16:54 | raek | jcromartie: what did you not like about it? |
| 16:54 | amalloy | chouser: i do a lot of interactivity from the source buffer - it's not really necessary for the stuff to show up in the repl |
| 16:54 | raek | I head something about table and column names not being quoted (and also read that there is no standard way of doing that) |
| 16:54 | chouser | amalloy: so you go along with no handy record fo what you've been trying? |
| 16:55 | jcromartie | raek: I think there's a mismatch between how "nice" the interface attempts to be, and how nice the returned results and working with the data actually can be |
| 16:56 | amalloy | chouser: rather, i get a repl buffer that's not cluttered with pastes of multiple versions of my pending function, so it has more room for the output of the function, i guess? |
| 16:56 | jcromartie | raek: for instance, relations seem to only be one-deep and they are retrieved in an "n+1 selects" fashion... and as someone mentioned there's a "join" function, but at that point you're just back to flat rows |
| 16:56 | jcromartie | flat tables |
| 16:57 | jcromartie | and you have to specify things explicitly again, instead of using the has-one has-many |
| 16:57 | jcromartie | there's also no has-many-through, that I can see |
| 16:57 | raek | oh. |
| 16:57 | chouser | amalloy: I'm not seeing the output of the function in any buffer either, just temporarily in some kind of status line at the bottom. |
| 16:57 | jcromartie | so complex stuff kind of falls apart for me |
| 16:57 | brehaut | jcromartie: there are some currently unresolved issues with with relations; they always have to be related to the original entity (ie, from the select) and aggregates cause them some trouble |
| 16:57 | amalloy | chouser: i switch to the repl buffer to call the function |
| 16:58 | chouser | ah, right, ok. |
| 16:58 | raek | is there a good comparison of the db libs somewhere? |
| 16:58 | chouser | so next is: how do you fetch a previous repl expression so you can change it and try again? |
| 16:59 | brehaut | chouser: M-p |
| 16:59 | scottj | or scroll up to it (or isearch) and press enter on it |
| 16:59 | chouser | brehaut: perfect, thanks. |
| 16:59 | michael_campbell | M-n does next, also. |
| 16:59 | raek | ah, the Mostly Lazy podcast mentions some... |
| 16:59 | seancorfield | ctl-up works for me |
| 17:00 | zerokarmaleft | chouser: http://bc.tech.coop/blog/070424.html <= i haven't tried this, but it does exactly what you're wanting |
| 17:01 | zerokarmaleft | for demo purposes, so his audience has a better idea of what's explicitly getting sent to the repl |
| 17:02 | dnolen | chouser: yes being able to run the analyzer w/o the compiler would be ideal. |
| 17:03 | moogatronic | zerokarmaleft: nice. i wanted that too. =) |
| 17:05 | technomancy | chouser: usually help buffers like that can be dismissed with q |
| 17:07 | mjwhitt | oh no chouser is learning emacs, my "chouser uses vim" excuse is faltering |
| 17:09 | mjwhitt | I guess I could always try evil, but that's just seems wrong |
| 17:09 | cemerick | mjwhitt: You can always say that vim is the 2nd most frequently used Clojure editor… :-) |
| 17:09 | mjwhitt | good point, hehe |
| 17:15 | jcromartie | I really appreciate the fact that I can just drop in the c3p0 code from Korma and use it to create a data source for ClojureQL. |
| 17:15 | jcromartie | That's a testament to the underlying library philosophy of both :). |
| 17:16 | gtrak | jcromartie, a simple wrapper for bean properties? :-) |
| 17:17 | jcromartie | no, actually not quite |
| 17:17 | jcromartie | or is it? |
| 17:17 | jcromartie | I mean is that what clojure.java.jdbc uses |
| 17:18 | gtrak | that would be the obvious thing to do unless you have a reason otherwise |
| 17:18 | chouser | zerokarmaleft: interesting, thanks! |
| 17:19 | chouser | mjwhitt: it is a little wrong -- pretty clearly a stopgap measure, as it doesn't work properly out of the box in org-mode, slime buffer, inferior lisp buffer, etc. :-/ |
| 17:20 | cemerick | jcromartie: you should open a ticket on korma, FWIW |
| 17:21 | jcromartie | yah I guess I'm torn, really |
| 17:21 | jcromartie | ClojureQL seems to be a bit stale |
| 17:21 | jcromartie | but Korma has potential |
| 17:22 | ninjudd | technomancy: you're right. it looks like 'C-x o q' always does the right thing for dismissing a help buffer |
| 17:23 | ninjudd | jcromartie: i talked to ibdknox and bendlas at the Conj about the future of clojureql now that korma is here |
| 17:24 | ninjudd | bendlas may rewrite clojureql to use the same AST as korma |
| 17:25 | ninjudd | as it is right now, clojureql is more composable than korma, but korma generates better sql and is much simpler |
| 17:33 | jcromartie | ninjudd: ah ha, an insider :) |
| 17:34 | jcromartie | ninjudd: maybe korma could be built on clojureql |
| 17:34 | jcromartie | but yes, I find clojureql's composable nature a little more suited to my rat's nest of a db |
| 17:34 | jcromartie | and as far as "better SQL" what does that mean in practice? |
| 17:35 | Raynes | I highly doubt Korma would ever come near clojureql. |
| 17:35 | ninjudd | jcromartie: i absolutely think it makes sense for clojureql and korma to use the same backend. essentially, both would be built on a lower level layer that handles the SQL generation and deals with database platform idiosyncrasies |
| 17:36 | ninjudd | but it is more likely that the korma backend would be used, i think |
| 17:36 | jcromartie | hm |
| 17:36 | Raynes | Right. |
| 17:37 | ninjudd | though clojureql has done more work on db platform support, so that could possibly be extracted |
| 17:37 | Raynes | Judging by Chris's lightning talk, Korma's backend sounds great. |
| 17:37 | ninjudd | yes. the compiler for korma is much cleaner IMO |
| 17:38 | Raynes | And it is already totally detached from Korma, right? |
| 17:38 | ninjudd | though it would need some extension to support "infinite composability" |
| 17:38 | jcromartie | yeah |
| 17:38 | jcromartie | and Korma doesn't support open-ended aggregates or modifiers |
| 17:38 | jcromartie | like, if I want to add TOP for MS SQL Server |
| 17:38 | jcromartie | I can't do that in Korma |
| 17:39 | ninjudd | Raynes: you mean https://github.com/ibdknox/Korma/blob/master/src/korma/internal/sql.clj? |
| 17:40 | ninjudd | still part of korma, but could chris could easily make it a standalone library |
| 17:40 | Raynes | Right. |
| 17:40 | jcromartie | it seems like it's small, but fairly rigid |
| 17:40 | jcromartie | not like ClojureQL doesn't suffer from that in other areas... |
| 17:41 | ninjudd | jcromartie: yes, but i still think the architecture is a better starting point for compiling to SQL |
| 17:41 | TimMc | Merge all the libs! |
| 17:42 | ninjudd | that's the theme, isn't it ;) |
| 17:43 | ninjudd | in the case of clojureql and korma, i think it makes sense for both to exist, but they should take advantage of a shared backend |
| 17:44 | TimMc | RT.var("com.company.clj.file", "fn-name") is giving me an unbound var. How do I debug that? |
| 17:44 | raek | "By our powers combined..." |
| 17:44 | TimMc | Is there a way to check what all is in that namespace? |
| 17:44 | gtrak | raek, http://mustachify.me/?src=http://upload.wikimedia.org/wikipedia/en/thumb/e/e2/Captain_Planet.jpg/250px-Captain_Planet.jpg |
| 17:45 | jcromartie | you win |
| 17:45 | raek | TimMc: you can call ns-publics to get a map of the (non-private) vars in a namespace |
| 17:46 | raek | TimMc: did you require the ns before trying to access the var? |
| 17:46 | TimMc | yup |
| 17:46 | TimMc | And that succeeds. |
| 17:46 | TimMc | The fn is called "write", so there's no munging to speak of. |
| 17:46 | chouser | TimMc: FWIW, if you're in control of the Clojure that's being used by Java, I'd highly recommend exposing a class and/or interfaces from Clojure, rather than using RT.var... |
| 17:47 | TimMc | Debugging this from the Eclipse Display view is pretty painful. |
| 17:47 | cgray | how do you require a non-closure js library in cljs? |
| 17:47 | TimMc | chouser: AOT is not really an option at this point. |
| 17:47 | chouser | TimMc: Ah, pity. :-/ |
| 17:48 | chouser | TimMc: I'd be curious why, if you have a moment. |
| 17:48 | raek | TimMc: it seems like that you get the X is unbound error even if the namespace is not existing. have you double-checked the spelling of the ns name? |
| 17:49 | TimMc | raek: If I misspell the name it throws. :-) |
| 17:49 | raek | (RT/var "foo" "bar") returns an unbound var for me |
| 17:50 | chouser | TimMc: you can call .getMappings() on the namespace object |
| 17:50 | raek | TimMc: even for the RT.var call? |
| 17:50 | TimMc | raek: RT.var for nonexistent var returns an unbound var. |
| 17:51 | raek | ah, I see. thought you mean a not found on classpath exception for some reason :-) |
| 17:51 | TimMc | chouser: Big existing Maven-managed Java project. No Clojure yet in the codebase. I'm trying to use Enlive to replace some JSPs and string concatenation, but the data objects I would be taking apart are in the same project as the Java classes that would call the Clojure -- so I would need 2-step Java compilation. |
| 17:51 | chouser | TimMc: ok, got it. |
| 17:52 | TimMc | Java servlets compiled against Clojure AOT against common POJOs. |
| 17:52 | TimMc | This way I can just stick the Clojure in src/main/resources and be done with it, but for an RT.var().invoke(). |
| 17:54 | chouser | clojure.lang.Namespace.find(clojure.lang.Symbol.intern("your.namespace")).getMappings() |
| 17:55 | chouser | that should throw a NPE if the namespace wasn't loaded, otherwise return a Map of all symbols in that ns |
| 17:55 | ninjudd | TimMc: an alternative would be to split the Clojure code out into a separate library that compiles the Java code, and then the Clojure code that depends on it. then you could add that as a dependency of your main project |
| 17:57 | TimMc | Not sure if I can get away with that politically yet. |
| 17:57 | TimMc | That may depend on how well I can sell this use of Enlive. :-) |
| 17:58 | TimMc | (Also, I suck at Maven.) |
| 17:58 | ninjudd | me too ;) |
| 18:00 | TimMc | OK, time to blow away ./target... this is absurd. |
| 18:03 | TimMc | ...and now it works. -.- |
| 18:07 | cemerick | ninjudd: interested in a protocol design page in the nREPL project? |
| 18:07 | gtrak | TimMc, surely if you re-write the codebase in 1/10 the size they'll consider it? |
| 18:08 | TimMc | Maven automates my build process. Now I just need something to automate Maven's rm -rf ~/.m2/repository, rm -rf ./target, mvn, refresh Eclipse cycle. |
| 18:08 | TimMc | gtrak: inorite |
| 18:09 | TimMc | gtrak: It shouldn't be too hard, since some of the execs used to work at Symbolics. :-) |
| 18:09 | gtrak | ah great :-) |
| 18:10 | TimMc | Who I actually need to convince is the product lead. |
| 18:10 | gtrak | yea, we have a really conservative senior guy as well |
| 18:10 | gtrak | i think i might sneak it in in testing |
| 18:12 | TimMc | Hmmm. I see that stopping and starting the project is not enough to pick up changes to the clj files. |
| 18:13 | TimMc | Ah, right -- I need to repackage the clj files by running mvn. |
| 18:13 | gtrak | classpath resources |
| 18:13 | TimMc | yup |
| 18:15 | jodaro | oh no |
| 18:16 | jodaro | someone sent an xkcd link |
| 18:16 | jodaro | now i can't stop |
| 18:16 | gtrak | TimMc, |
| 18:16 | gtrak | how do you like enlive? |
| 18:16 | gtrak | i was using stringtemplate, but it seems like too much trouble |
| 18:16 | gtrak | jodaro, don't stop |
| 18:16 | TimMc | gtrak: It's pretty nice. Haven't gotten deeply into it, but it seems very flexible and reasonable. |
| 18:16 | jodaro | http://xkcd.com/974/ |
| 18:18 | TimMc | gtrak: This is where I have used it so far: https://github.com/timmc/seqs-and-colls (Warning: Content of generated page has not been sufficiently reviewed by people who know more about Clojure than I do.) |
| 18:20 | gtrak | TimMc, what's it do? |
| 18:21 | gtrak | some kind of table layout stuff based on clojure collections? |
| 18:22 | TimMc | gtrak: It generates the tables in http://www.brainonfire.net/files/seqs-and-colls/main.html |
| 18:22 | gtrak | ah cool |
| 18:22 | TimMc | gtrak: If you go into src/seqs/html/ you'll see the table template and the template for the rest of the page. |
| 18:23 | TimMc | The table is actually used as a snippet. |
| 18:23 | gtrak | I've been doing similar stuff with google's javascript api, i might release it in clojure |
| 18:23 | gtrak | have you seen that one? for their charts? |
| 18:23 | TimMc | nope |
| 18:24 | gtrak | i think i could knock it out pretty fast, they have a java api |
| 18:25 | TimMc | link? |
| 18:25 | clojurebot | your link is dead |
| 18:25 | TimMc | "Schrödinger's link is dead." |
| 18:26 | raek | TimMc: nice. |
| 18:26 | raek | (seqs-and-colls) |
| 18:26 | TimMc | (and WTF is wrong with my unicode) |
| 18:26 | TimMc | raek: Please feel free to review -- I'm writing it to understand the material better myself. |
| 18:27 | raek | looks like UTF-8 reinterpreted as Latin-1 and then recoded to UTF-8... |
| 18:27 | TimMc | No doubt. |
| 18:28 | tensorpudding | someone misspelled Schrödinger |
| 18:28 | TimMc | That was me. |
| 18:28 | ninjudd | cemerick: yes, that sounds good |
| 18:28 | TimMc | I can't tell whether my terminal, my desktop computer, ssh, screen, irssi, or my home server is screwing it up. |
| 18:28 | gtrak | TimMc, http://code.google.com/apis/ajax/playground/#json_data_table |
| 18:29 | raek | TimMc: it could be mentioned that (empty? x) is just (not (seq x)) |
| 18:29 | TimMc | Yeah. |
| 18:29 | TimMc | There are a lot of TODOs. |
| 18:29 | gtrak | TimMc, check out the charts |
| 18:29 | ninjudd | cemerick: here's the portal code in case you haven't looked at it yet https://github.com/flatland/portal |
| 18:30 | ninjudd | cemerick: i half finished a bash nREPL/portal client on the plane ride back |
| 18:30 | gtrak | TimMc, so I think I'll do that while I've got the library in my head, it has great possibilities |
| 18:30 | TimMc | gtrak: What do I do with that link? |
| 18:31 | gtrak | well you can play around with the different chart examples on the left |
| 18:31 | raek | TimMc: http://blog.crazyfraggle.com/2009/09/irssi-charset-issues.html |
| 18:31 | gtrak | they have a java library to generate the JSON used in the 'Edit Code" box |
| 18:31 | ninjudd | cemerick: would have taken way less time if i had been able to use google instead of the bash info page |
| 18:32 | raek | TimMc: 2. and 3. are the most important ones |
| 18:34 | raek | TimMc: sequences are not implemented as lists. ones implemented in clojure are usually built with cons'es, but then can be built with any ISeq object |
| 18:34 | raek | (I think the data structures have their own classes that implement ISeq) |
| 18:34 | mabes | is it possible to bind a var to a class and then use that var as a type hint? |
| 18:35 | mabes | I can't get it to work... |
| 18:35 | mabes | ,(let [my-type String string "foo" ] (.toUpperCase ^my-type string)) |
| 18:35 | clojurebot | #<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: my-type, compiling:(NO_SOURCE_PATH:0)> |
| 18:35 | raek | mabes: no |
| 18:35 | mabes | hrmm. |
| 18:35 | raek | the type hint is needed at compile time |
| 18:35 | TimMc | raek: PesistentList and LazySeq both use Cons cells though, right? |
| 18:36 | amalloy | TimMc: i think PL actually uses PL cells |
| 18:36 | raek | TimMc: a PersistentList cell and a Cons cell are very similar. I think it's just that the list is counted and the cons not that is the difference |
| 18:36 | TimMc | hmm |
| 18:36 | gtrak | cons implements ISeq but it's a different class |
| 18:36 | mabes | raek: well, so I am writing a macro that will extend a protocol over several Java classes.. they all have the same method signatures but I want to type hint them to avoid reflection. |
| 18:37 | raek | with cons I was refering to clojure.lang.Cons |
| 18:37 | raek | persistent lists also use cons cells, but another kind |
| 18:37 | amalloy | mabes: that is possible but you have to use a different syntax for it - ^foo is read-time metadata, whereas you want macroexpansion meta |
| 18:38 | raek | TimMc: a persistent list cons cell requires the rest to be a persistent list, but a seq cons cell only requires it to be a seq |
| 18:38 | TimMc | Ah! |
| 18:38 | TimMc | "Sequences are not implemented as lists, they just act a lot like them and are backed by similar data structures." |
| 18:38 | TimMc | *may be backed |
| 18:38 | amalloy | (defmacro hinted-length [s] `(.length ~(with-meta s {:tag `String}))) |
| 18:39 | raek | well, a list is also a seq... |
| 18:39 | Guest68238 | I want to be able to write: (map-fn [m a b c] ...body...) and have it evaluate to: (fn [map] (fn [m a b c] ...body...) map (:a map) (:b map) (:c map)). I'm trying to write a macro for this (and running into problems), but is there something clever I can do to just use a fn instead? |
| 18:39 | TimMc | A list *is* a seq? |
| 18:39 | TimMc | Hmm, that's right. |
| 18:39 | mabes | amalloy: thanks for the example, I'll see if I can get this to work :) |
| 18:39 | gtrak | both PList and Cons extend ASeq |
| 18:40 | amalloy | Guest68238: don't write a macro, write a function |
| 18:40 | TimMc | raek: Mainly I'm trying to figure out the ontology here. |
| 18:40 | duck1123 | Guest68238: try to avoid using "map" as a variable name. It'll bite you |
| 18:40 | gfredericks | amalloy: I think he asked how :) |
| 18:40 | amalloy | oh. i missed that |
| 18:40 | Guest68238 | duck1123: Ah, of course. Sorry, my actual problem is different. I was trying to make a simple example instead. |
| 18:40 | gfredericks | I probably would have missed it too if I was trying to answer it |
| 18:40 | amalloy | Guest68238: it's not clear what m and map are supposed to be in your example though |
| 18:41 | TimMc | raek: Would you say that seqs are a special type of coll? |
| 18:42 | raek | hrm |
| 18:42 | Guest68238 | amalloy: Yeah, it's hard to explain. Basically, I want to be able to write a fn that has params which are symbols of a map. But, when invoking the fn, it's just given a map. So, I basically want to generate a wrapper fn that destructures the map into the relevant keywords and passes the map vals to the fn I wrote. That probably makes no sense. |
| 18:42 | amalloy | TimMc: yes |
| 18:42 | raek | I usually think of the collections as one group of things and the seqs as another |
| 18:42 | raek | they intersect at PersistentList, though |
| 18:42 | arosequist | amalloy: Sorry, didn't realize I was guest. Changed my name. |
| 18:42 | TimMc | and LazySeq |
| 18:42 | duck1123 | (map #(% m) [:a :b :c]) |
| 18:43 | TimMc | ,((juxt coll? seq?) (range)) |
| 18:43 | raek | all the collections have at least one seq implementation |
| 18:43 | clojurebot | [true true] |
| 18:43 | amalloy | arosequist: you probably do need a macro for that, if your goal is to avoid typing {:keys [a b c] :as m} in the function impl |
| 18:43 | raek | (vector has two: (seq v) and (rseq v)) |
| 18:43 | raek | a list is its own seq |
| 18:43 | arosequist | amalloy: Yeah, that's my goal. It seems trivial, but there is a valid reason for it. I'll keep working on my macro. Just wanted to make sure a macro was necessary. |
| 18:44 | raek | you can think of a seq as an immutable variant of an iterator |
| 18:44 | gfredericks | (defmacro def-named-args-fn ...) |
| 18:44 | amalloy | arosequist: i think your easiest route is to have the macro just expand to a function with :keys destructuring |
| 18:45 | raek | hrm, so what exactly is a collection? something you can call conj and seq on? |
| 18:45 | gfredericks | (defmacro def-named-args-fn [name arg-names & body] `(defn ~name [{:keys [~@arg-names]}] ~@body)) |
| 18:45 | gfredericks | arosequist: ^ that there might even work |
| 18:45 | arosequist | amalloy: This might be a dumb question, but can that destructuring be done in the args list of fn itself? |
| 18:45 | amalloy | yes |
| 18:46 | TimMc | raek: coll? defines it as IPersistentCollection :-) |
| 18:46 | amalloy | gfredericks: feh. don't complect creating a function with def'ing it. macros that def are on the yucky side |
| 18:46 | arosequist | gfredericks: Wow, that looks like exactly what I wanted to do, except I just want fn (not defn). |
| 18:46 | amalloy | (defmacro map-fn [keyvec & body] `(fn [{:keys ~keyvec :as ~'m}] ~@body)) |
| 18:46 | arosequist | gfredericks: But that's easy to chang,e of course |
| 18:47 | raek | TimMc: also, don't forget the obscure PersistentQueue... :P |
| 18:47 | arosequist | amalloy: gfredericks: Thanks a ton. I spent way too long on this earlier. |
| 18:47 | gfredericks | amalloy: you're a wiser man than I. |
| 18:47 | TimMc | raek: Ooh, that's right -- I should raid the clojure.core repo for mentions of "IPersistentCollection", etc. |
| 18:48 | amalloy | gfredericks: it's easy to sound that way by repeating words rich has made up |
| 18:48 | gfredericks | amalloy: I thought you sounded that way _despite_ parroting rich :) |
| 18:48 | raek | ,(let [q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)] ((juxt #(conj % 0) pop peek seq) q)) |
| 18:48 | clojurebot | [#<PersistentQueue clojure.lang.PersistentQueue@e41ad39e> #<PersistentQueue clojure.lang.PersistentQueue@8d94bf51> 1 (1 2 3)] |
| 18:51 | gfredericks | "Macros that Def" would be a good name for something... |
| 18:53 | gtrak | an overtone band name |
| 18:53 | duck1123 | there are valid cases for macros that def though |
| 18:54 | duck1123 | some of my favorite macros also def |
| 18:54 | raek | indeed. but if there is no non-def'ing variant things get hard to compose. |
| 18:55 | amalloy | absolutely. i'm a big fan of defn and defmacro. but i'm glad fn and macrolet are around too |
| 18:56 | duck1123 | well, presumably with any macro that defs, there's no need to compose it. it's used only in places where def is used. (top level) |
| 18:56 | amalloy | s/need/ability? |
| 18:56 | gfredericks | duck1123: I think you just said "if you use them right, then you won't be using them wrong." |
| 18:56 | duck1123 | that's a good rule |
| 19:15 | gfredericks | the object returned from clojure.core/bean is rather dangerous I think :/ |
| 19:20 | gfredericks | I take it back. |
| 19:20 | alexbaranosky | I've got to say, ClojureBot's pretty cool |
| 19:21 | alexbaranosky | who created it? |
| 19:21 | cemerick | hiredman: you're being paged in #leiningen :-) |
| 19:21 | technomancy | alexbaranosky: I convinced hiredman to write it |
| 19:27 | Bahman | Hi all! |
| 19:27 | alexbaranosky | Bahman: hi |
| 19:41 | Bahman | I am about to start learning Clojure. I'm familiar with both Lisp and Java. I feel at home with Emacs/Eclipse/NetBeans. Which development environment do you people recommend? If I chose Emacs, could it help me with auto-completing and documentation of Java classes? |
| 19:42 | alexbaranosky | Bahman: 70% of Clojurians use Emacs |
| 19:42 | tensorpudding | emacs won't help you autocomplete java classes while writing clojure code |
| 19:42 | tensorpudding | it's possible to get it while writing Java if that's your thing |
| 19:42 | tensorpudding | though the java experience in emacs is probably much less pleasant than eclipse |
| 19:43 | Bahman | tensorpudding: No. I meant auto-complete when using Java classes inside Clojure code. |
| 19:43 | duck1123 | It'll autocomplete on classes, but ususally only if it's already seen it |
| 19:43 | Bahman | Yes...for Java I use Eclipse. |
| 19:43 | ihodes | Bahman: definitely emacs for the most functionality and using it with the cutting edge. its doc facilities are nice, and you can autocomplete clojure code with it, if necessary, of course. |
| 19:43 | tensorpudding | then what i said at first applies |
| 19:43 | Bahman | Alright...I'll go with Emacs. Thanks folks. |
| 19:44 | Bahman | I hope Clojure works with Slime. |
| 19:44 | tensorpudding | emacs will give you "documentation" of a kind |
| 19:44 | tensorpudding | with clojure |
| 19:44 | TimMc | Bahman: There's something similar to slime. |
| 19:44 | tensorpudding | slime works for clojure if you use swank-clojure |
| 19:45 | tensorpudding | the fact that errors lead to java stacktraces are a fly in the debugging ointment |
| 19:45 | cgray | Eek, a mouse! |
| 19:45 | tensorpudding | but otherwise slime is pretty much the same as it is in CL |
| 19:46 | Bahman | Would you please pass me a link on howto setup Emacs (with Slime?) for Clojure? |
| 19:46 | cgray | sorry, had to share :) |
| 19:46 | alexbaranosky | Bahman: I was pointed to this emacs code for setting my emacs up: https://github.com/samaaron/dot-emacs |
| 19:47 | technomancy | Bahman: there's a "getting started with Emacs" page on the official Clojure wiki, but the main thing to keep in mind is to stick with the official documentation of clojure-mode and swank-clojure rather than blog posts |
| 19:47 | TimMc | cgray: Actual mouse? |
| 19:48 | cgray | TimMc: yep. very small. |
| 19:48 | Bahman | Thanks folks. |
| 19:48 | bhenry | Bahman: this one is more basic without all sam's personal preferences https://github.com/overtone/live-coding-emacs works great out of the box |
| 19:49 | TimMc | cgray: Yay! Also, stop leaving food out. |
| 19:49 | cgray | TimMc: I know :( |
| 19:49 | tensorpudding | my advice is install emacs, the emacs-starter-kit, lein and swank-clojure |
| 19:49 | TimMc | They may be free pets, but they're impossible to litter-train. |
| 19:49 | Bahman | bhenry: I have Forth and Common Lisp setup in .emacs and .emacs.d ... can't use such solution. |
| 19:50 | cgray | TimMc: It's also getting cold here, so they're more likely to come inside to avoid freezing to death |
| 19:50 | TimMc | Bahman: Since you already have a working Emacs, just get clojure-mode etc. |
| 19:50 | tensorpudding | oh, you already have emacs configured |
| 19:50 | tensorpudding | get clojure-mode from marmalade |
| 19:50 | alexbaranosky | so since you know your way around Emacs well you may just be able to pilfer what you need from the link I posted from Sam Aaron's github account ? |
| 19:50 | TimMc | Bahman: Emacs 23, 24, or what? |
| 19:51 | Bahman | 23.3 |
| 19:51 | Bahman | alexbaranosky: That's a good approach! |
| 19:52 | TimMc | You might also poke around the emacs-starter-kit to pilfer from that. |
| 19:53 | TimMc | It has various clojure-related goodies. |
| 19:53 | tensorpudding | if you really like it you can fork it and alter it to your needs |
| 19:54 | goodieboy | anyone know how to create a custom 404 response in noir? |
| 19:58 | amalloy | {:status 404 :body {...}} |
| 20:00 | Raynes | amalloy, goodieboy: https://github.com/ibdknox/noir/blob/master/src/noir/response.clj#L32 |
| 20:01 | goodieboy | oh sorry... |
| 20:01 | goodieboy | I mean override the default/built-in one? |
| 20:01 | goodieboy | there is one for 404 and 500 |
| 20:02 | goodieboy | I think I found it actually? https://github.com/ibdknox/noir/blob/master/src/noir/statuses.clj#L15 |
| 20:02 | Raynes | goodieboy: Looks like it, yes. Good eye. |
| 20:03 | goodieboy | Cool, I'll give that a try! |
| 20:07 | tolstoy | And specifically: http://webnoir.org/autodoc/1.2.1/noir.statuses-api.html |
| 20:07 | tolstoy | Er, documentationally. |
| 20:23 | TimMc | OK, does this come across as o-with-umlaut? ö |
| 20:25 | Bahman | The latest swank-clojure is 1.3.3, right? |
| 20:26 | brehaut | TimMc: yes, but then it was followed by [incompatible encoding]; that could just be colloquay though |
| 20:26 | amalloy | TimMc: my client renders it as a question mark, and it usually gets unicode right |
| 20:29 | Bahman | The latest Clojure is 1.3...is it possible to tell Leiningen to use that instead of 1.2? |
| 20:30 | tolstoy | TimMc: Worked for me. Textual/MacOSX |
| 20:30 | technomancy | Bahman: you can change the version in your project's project.clj file |
| 20:31 | technomancy | you can't change the version leiningen itself uses though |
| 20:31 | tensorpudding | unless you build lein by hand |
| 20:31 | Bahman | technomancy: It's probably a naive question, but swank-clojure uses Clojure 1.2.1...does this mean that my REPL will use Clojure 1.2.1? |
| 20:32 | technomancy | Bahman: no, if you specify a different version in your project then it will take priority over swank's version |
| 20:32 | technomancy | as long as you're working inside a project |
| 20:32 | Bahman | I got it...thanks. |
| 20:35 | technomancy | Bahman: "lein help tutorial" covers a lot of this stuff if you get confused. |
| 20:35 | Bahman | Excellent! |
| 20:37 | moogatronic | technomancy: i'm pretty excited about the "joining of forces" between lein and cake. mostly for what it says about the nature of the clojure community. |
| 20:37 | moogatronic | props. |
| 20:37 | bhenry | what are the contrasts between refs and atoms (specifically in clojurescript if that makes a difference) |
| 20:37 | alexbaranosky | moogatronic: me too |
| 20:40 | scottj | bhenry: cljs doesn't have refs |
| 20:40 | bhenry | perfect. that makes the decision totally easy |
| 20:40 | TimMc | amalloy: Thanks, that's good to know. Everyone else's system is probably fixing it up at render-time. |
| 20:41 | technomancy | moogatronic: it's great. the #leiningen channel has seen more activity in this one day than the entire past year. |
| 20:43 | amalloy | hah, i'm glad to hear it's not like this all the time. i was thinking i might have to leave or else never get anything else done |
| 20:44 | Bahman | I think I've got clojure-mode, paredit-mode, lein and swank-clojure installed. But when I open a project file, there is no 'clojure-jack-in' command. What am I missing? |
| 20:46 | technomancy | Bahman: probably an old version of clojure-mode; you want 1.11.4 |
| 20:47 | Bahman | technomancy: That's right...it's 1.7.1 |
| 20:47 | technomancy | Bahman: maybe you have an old package.el that's hard-coded to only load from tromey.com? |
| 20:48 | Bahman | technomancy: I think that's the case. I installed the one on marmalade website. |
| 20:50 | technomancy | Bahman: if marmalade is giving you issues you can just install from git. it'll be easier once package.el is standardized in emacs 24 |
| 20:50 | technomancy | it used to be there were a lot of moving parts so installing by hand was discouraged, but now clojure-mode is the only necessary piece of elisp |
| 20:51 | Bahman | eval-buffer: Symbol's value as variable is void: package-archives |
| 20:51 | Bahman | I guess I better install it by hand. |
| 20:52 | technomancy | yeah, that's due to an old version of package.el |
| 20:56 | Bahman | technomancy: Should I uninstall package.el or let it be? |
| 20:56 | technomancy | Bahman: long-term you should upgrade it to http://bit.ly/pkg-el23, but short-term don't let it get in the way of learning clojure |
| 20:57 | Bahman | Will give upgrading a try. I hope it works. |
| 20:58 | gfredericks | Man there's like a whole pile of lein features I didn't know about. I'm going to start using test selectors right _now_. |
| 20:58 | alexbaranosky | gfredericks: are you looking at a webpage you could link to? |
| 20:59 | technomancy | lein help tutorial # should cover most of it |
| 20:59 | alexbaranosky | thx |
| 20:59 | technomancy | lein help sample # should get you the rest |
| 20:59 | technomancy | but it's a lot to wade through |
| 21:00 | gfredericks | alexbaranosky: I was reading `lein help tutorial` since technomancy mentioned it earlier |
| 21:01 | alexbaranosky | technomancy: just did a `lein help sample > lein-help-sample.clj `... this is serious business. I've not been using anywhere near this many of lein's features |
| 21:02 | technomancy | alexbaranosky: I certainly hope not. I would be terrified if anyone's actual project'clj file were that large. =) |
| 21:02 | alexbaranosky | I'm going to update Midje's project file to mention its mailing list, for example :) |
| 21:02 | technomancy | the mailing list actually makes it all the way into the pom |
| 21:03 | amalloy | technomancy: lancepantz showed me a project.clj that was about that big. some kind of horrible monstrosity but i forget what |
| 21:03 | technomancy | eep |
| 21:07 | Bahman | technomancy: I upgraded package.el and it seems to be working. How can I tell the version of Clojure from within REPL? |
| 21:07 | technomancy | ,*clojure-version* |
| 21:07 | clojurebot | {:major 1, :minor 3, :incremental 0, :qualifier nil} |
| 21:07 | technomancy | Bahman: ^ do that (without the comma) |
| 21:08 | Bahman | Excellent. Working like a charm. Thank you technomancy for your help and your great software :-) |
| 21:08 | technomancy | glad it's working for you =) |
| 21:09 | technomancy | can't wait for emacs 24 to be released; there's too much confusion with package.el |
| 21:10 | Bahman | Yes..I can't wait for it since it's supposed to support bidi text and right-to-left languages...It'd be wonderful to name the functions in your mother language :-D |
| 21:13 | gfredericks | technomancy: the best thing about clojurebot's comma is that you don't have to conciously omit it at the repl |
| 21:13 | Bahman | Something weird...perhaps it's a problem on my side...but I can't work with slime...the moment I start to type it gets disconnected and when I press ENTER it says "Not connected. Use M-x slime to start a lisp." |
| 21:14 | Bahman | What am I doing wrong? |
| 21:14 | Bahman | I connect with slime-connect and the same thing happens. |
| 21:18 | Bahman | This is the error log I suppose: error in process filter: Wrong type argument: listp, 0 |
| 21:18 | Bahman | Lisp connection closed unexpectedly: connection broken by remote peer |
| 21:19 | Bahman | Perhaps it's something with slime contribs I have loaded...checking... |
| 21:26 | scottj | Bahman: make sure you have a slime version compatible with swank-clojure |
| 21:27 | Bahman | scottj: It's something with slime contribs...I'm trying to figure it out but if I disable all of them, clojure works fine. |
| 21:27 | scottj | I use slime-fancy but ymmv |
| 21:29 | bhenry | any ideas on how to shuffle in clojurescript? |
| 21:30 | bhenry | or at least get me to the point of Math.random()? |
| 21:30 | bhenry | i don't know how to require that or make it work in cljs |
| 21:32 | Bahman | scottj: slime-fancy doesn't work..trying to activate one by one and see which ones cause failure. |
| 21:35 | bhenry | sweet found it. rand is still in. duh. |
| 21:40 | amalloy | bhenry: ACTUALLY you might want to borrow a lazy-shuffle from me |
| 21:40 | bhenry | i might, but i'm dealing with 6 items in an array and all of them will be consumed. |
| 21:40 | amalloy | specifically, line 38 of https://gist.github.com/1341292 - it assumes the collection you give it is already a vector, so wrap it with vec otherwise |
| 21:40 | bhenry | but that could come up in the future. |
| 21:41 | bhenry | wait that will work in clojurescript? |
| 21:42 | amalloy | oh, i guess cljs doesn't have transients, right? |
| 21:42 | bhenry | doubtful if they don't even have shuffle : P |
| 21:42 | amalloy | well, you can use pop/assoc instead, and drop the transient/persistent |
| 21:42 | amalloy | it all still works; transient was for perf |
| 21:43 | Bahman | scottj: Would you please send me your .emacs file? |
| 21:43 | bhenry | amalloy: i just did this for my smalltime case https://gist.github.com/b81c1b337e10b6712a13 |
| 21:44 | amalloy | whoa. that is like 0% to work right, isn't it? |
| 21:44 | bhenry | ? |
| 21:44 | amalloy | &((fn shuffle [seq] (map #(nth seq (rand-int (count seq))) seq)) (range 5)) |
| 21:44 | lazybot | clojure.lang.ArityException: Wrong number of args (1) passed to: sandbox11775$eval13910$shuffle--13911$fn |
| 21:45 | bhenry | the output looked good to me |
| 21:45 | amalloy | bhenry: if so it was unrelated to your input. there is no way this function does what you want |
| 21:46 | amalloy | map calls its function with one arg, and your #(...) accepts zero args only; that's one problem |
| 21:46 | bhenry | ah, well in javascript that doesn't matter. |
| 21:46 | bhenry | i can fix that though. |
| 21:46 | amalloy | the other is that you can wind up getting (say) 0 every time you call rand-int |
| 21:46 | scottj | Bahman: https://github.com/scottjad/dotfiles/blob/master/.emacs I use slime from oct 15 2009 |
| 21:47 | amalloy | so that (shuffle (range 5)) returns (0 0 0 0 0) |
| 21:47 | Bahman | scottj: Thanks. |
| 21:47 | bhenry | ooh. good point. for my case, i want to put the tiles back in the bag so repeats are okay |
| 21:47 | amalloy | &((fn shuffle [seq] (map (fn [_] (nth seq (rand-int (count seq)))) seq)) (range 5)) |
| 21:47 | lazybot | ⇒ (4 0 0 2 3) |
| 21:48 | amalloy | bhenry: that's fine, but don't call it shuffle :P |
| 21:48 | bhenry | yeah |
| 21:48 | amalloy | you're just implementing rand-nth |
| 21:48 | Bahman | scottj: Oh...mine is CVS version 11-09-28 :-D |
| 21:48 | bhenry | you're right. |
| 21:48 | scottj | Bahman: duh you can't use new slime! |
| 21:48 | alexbaranosky | amalloy: I talked to Creighton on the plane trip back from the Conj. He said soemthing about wanting to add test coverage to 4Clojure, is that right? I wouldn't mind helping |
| 21:48 | amalloy | alexbaranosky: yeah, none of us have any idea how to write tests for a clojure website |
| 21:49 | amalloy | (or how to use midje) |
| 21:49 | alexbaranosky | have you seen the RObozzle video? |
| 21:49 | Bahman | scottj: How "new"? |
| 21:49 | scottj | Bahman: last two years :) |
| 21:49 | Bahman | Doh! |
| 21:50 | alexbaranosky | amalloy: this video shows how to use Midje: http://vimeo.com/19404746 |
| 21:50 | scottj | Bahman: swank-clojure docs mention one date that's supported, I've had best luck with the date I mentioned earlier |
| 21:50 | alexbaranosky | I wonder if you could write checkers for checking rendered HTML |
| 21:51 | Bahman | Thanks scottj. |
| 21:51 | alexbaranosky | amalloy: say you have tests checking slightly below browser level, that don't touch the DB. You could then make assertions against the rendered HTML. Something like this........ <let me type something up> |
| 21:53 | xeqi | amalloy: for integration level tests check out clj-webdriver |
| 21:53 | alexbaranosky | xeqi: browser tests right? |
| 21:53 | xeqi | yeah |
| 21:57 | alexbaranosky | amalloy: you there? |
| 21:57 | amalloy | alexbaranosky: yeah, waiting on your <let me type something up> |
| 22:00 | alexbaranosky | amalloy: the way we usually test html/gui stuff at work is to use some very small amount of Selenium tests to make sure the code works end-to-end (could use webdriver for that), and then test most other details of HTML generation with lower-level tests |
| 22:00 | alexbaranosky | amalloy: those lower level tests would be on the layer that generates the templates for example. Then just parse them with a dom parsing library and make assertions with XPath |
| 22:00 | alexbaranosky | amalloy: <I gave up on the example> |
| 22:01 | amalloy | ugh. i don't like the idea of selenium tests. maybe that's just because i imagine it would be hard for every contributor to set up, though |
| 22:01 | alexbaranosky | When I get some time I'll look at 4Clojure to see if I can share something more concrete, but I don't know how 4clojure is set up so have to think on it |
| 22:02 | alexbaranosky | so don't use selenium |
| 22:02 | alexbaranosky | I hate them too :) |
| 22:02 | amalloy | *chuckle* |
| 22:02 | alexbaranosky | they're a pain in the rear |
| 22:02 | alexbaranosky | and fail for no reason sometimes, because of timeouts and timing errors with JS/AJAX etc |
| 22:02 | amalloy | i think the hard parts are (a) stubbing the db calls, and (b) figuring out how to either test or skip the html-generation part of the rendering |
| 22:04 | alexbaranosky | so stubbing DB *could* be simple with Midje, assuming the points of interaction with the DB are few |
| 22:04 | alexbaranosky | say you have a function (get-user-details ....) or whatever that secretly goes to the DB to get those details |
| 22:05 | amalloy | right |
| 22:05 | alexbaranosky | amalloy: then its a one line stub |
| 22:05 | spoon16 | anyone else having problems with maven/lein retrieving org.apache.maven:super-pom:jar:2.0? |
| 22:06 | alexbaranosky | where the test/fact is basically saying: when I do Foo, given the DB gives me Bar, then I get Baz back |
| 22:06 | spoon16 | https://gist.github.com/1366004 |
| 22:06 | alexbaranosky | amalloy: if you watch the Robozzle video I'd love to hear what you think of it |
| 22:07 | amalloy | alexbaranosky: i'll check it out when i get home |
| 22:09 | alexbaranosky | amalloy: I'm opening up 4Clojure on my machine now, I'll let you know if I get any relevant ideas |
| 22:29 | Bahman | Thanks scottj, I got it working with that version. |
| 22:30 | alexbaranosky | amalloy: how have you all liked using Mongo with Clojure? I'm excited at the ease of use of the Combo |
| 22:30 | amalloy | it's fantastically simple. i haven't really used anything else (eg jdbc) to compare with, though |
| 22:31 | PPaul | how hard is it to get clojurescript running? |
| 22:31 | amalloy | s/simple/easy, i guess, is more what i meant. i haven't evaluated whether it's simple :P |
| 22:31 | alexbaranosky | amalloy: Korma looks nice, but its still dealing with a more foreign way to represent data than Clojure uses |
| 22:32 | alexbaranosky | I've used Mongo at work for a smallish project, and I'm still weighing whether it is simple or easy as well |
| 22:32 | scottj | PPaul: not hard if you use cljs-watch |
| 22:32 | PPaul | can i use lien? |
| 22:33 | scottj | not really, I think there is a clojurescript artifact on clojars but it might be very outdated |
| 22:34 | PPaul | i had a hard time with clojure until i started using lien |
| 22:34 | scottj | I guess there are newer artifacts; don't recall exactly how to use them |
| 22:35 | scottj | maybe look at lein-clojurescript |
| 22:35 | scottj | remember cljs is alpha though and getting it setup will probably be the easiest part of doing something useful with it :) |
| 22:37 | alexbaranosky | amalloy: I like this (letfn .... def... def) idiom I see, though I ponder about using macro-do in cases like that |
| 22:37 | PPaul | ouch |
| 22:37 | PPaul | i was hoping that i could use it with backbone and jquery |
| 22:37 | PPaul | manipulating js objects/arrays is a pain |
| 22:38 | alexbaranosky | PPAul: there are folks using it with JQuery |
| 22:38 | amalloy | alexbaranosky: i try to avoid macro-do, like i mentioned earlier. if you can do it with functions, it's usually simpler. sometimes i go as far as using intern instead of def, but that's more questionable |
| 22:38 | PPaul | intern? |
| 22:38 | alexbaranosky | amalloy: I think I agree, but I have a new toy, and everything looks like it might work with macro-do now :-\ |
| 22:39 | amalloy | &(doc intern) |
| 22:39 | lazybot | java.lang.SecurityException: You tripped the alarm! intern is bad! |
| 22:39 | amalloy | ,(doc intern) |
| 22:39 | clojurebot | "([ns name] [ns name val]); Finds or creates a var named by the symbol name in the namespace ns (which can be a symbol or a namespace), setting its root binding to val if supplied. The namespace must exist. The var will adopt any metadata from the name symbol. Returns the var." |
| 22:39 | alexbaranosky | is this too complicated?: (macro-do [[name host]] |
| 22:39 | alexbaranosky | `(def ~name (get-in config [:hosts host])) |
| 22:39 | alexbaranosky | [static-host :static] |
| 22:39 | alexbaranosky | [dynamic-host :dynamic] |
| 22:39 | alexbaranosky | [redirect-hosts :redirects]) |
| 22:40 | alexbaranosky | amalloy: I guess the fact is that ANY macro is complicated, and that use of macro-do only saves a little code, so in production I probably wouldn't use it |
| 22:40 | amalloy | alexbaranosky: probably it is, because you got it wrong in your paste :) |
| 22:40 | alexbaranosky | amalloy: well, no tests to run it against |
| 22:40 | amalloy | touche |
| 22:40 | alexbaranosky | something funky with the ~name bit? |
| 22:40 | amalloy | (you missed the ~ in ~host) |
| 22:41 | alexbaranosky | ahhhh oops |
| 22:41 | alexbaranosky | I can have 4Clojure covered in 400 tests asap ;) |
| 22:41 | amalloy | sounds like a plan! i'm headed home now though |
| 22:42 | alexbaranosky | adios |
| 22:46 | alexbaranosky | anyone know how to fast-forward a fork on github? Can't find it on there, but a blog post says it is... maybe it has been taken off the interface? |
| 22:54 | alexbaranosky | technomancy: hey thanks for fixing lein int's exception bug - helps me out a lot |
| 23:04 | amalloy | alexbaranosky: some reason not to just do it with git? having github do it might be possible but seems silly |
| 23:04 | alexbaranosky | lazy |
| 23:09 | alexbaranosky | amalloy: thanks for kicking me in the lazy butt, just did it by hand |
| 23:13 | biallym | Hey! how would I access class.STATIC_CONST |
| 23:13 | biallym | namely I have a class and I can't seem to be able to get clojure to like the static variables declared in it |
| 23:14 | biallym | I have tried Class/STATIC and Class.Static |
| 23:20 | bhenry | biallym: did you try (.STATIC_CONST class) |
| 23:23 | scottj | is there a 4clojure workflow I'm missing that involves git checkout 4clojureproblems, filling in the code, running tests with clojure-test-mode, and M-x submit-solution? :) |
| 23:23 | biallym | that worked... which means the static must not live where I thought it did >.> |
| 23:25 | joeblow2006 | Hi, can I ask syntax related questions here? |
| 23:25 | scottj | joeblow2006: yes |
| 23:26 | joeblow2006 | Ok. I'm working on a simple Clojure program right now. I'm trying to work out the following function: |
| 23:26 | joeblow2006 | (defn fun3 [[x y z t]] (if (= x y z) (vector x y z t) (iterate fun2 [x y z t]))) |
| 23:27 | joeblow2006 | If I do something like (fun3 [10 10 10 1])) where the 1st 3 values are equal, the function returns the vector. |
| 23:27 | joeblow2006 | What I want to happen is to check for x=y=z each time fun2 returns. |
| 23:28 | joeblow2006 | instead of checkin only initially as it does now. |
| 23:28 | joeblow2006 | I'm thinking it's not possible to do this in one method, so I'm trying out fun4 which is as follows: (defn fun4 [[x y z t]] (take-while #(not= %1 %2 %3) (fun3 [x y z t]))) |
| 23:29 | brehaut | (defn fun3 [[a b c :as s]] (when (= a b c) s)) |
| 23:29 | joeblow2006 | I think I need to destructure the vector in order to test the components, but I can't seem to figure out that part. |
| 23:29 | joeblow2006 | OK, let me try that. |
| 23:30 | brehaut | or (defn fun3 [s] (when (apply = (take 3 s)) s)) |
| 23:30 | bhenry | brehaut, i think he wants fun2 to be in there when the first three aren't equal |
| 23:30 | brehaut | bhenry: ah, my bad |
| 23:30 | joeblow2006 | Exactly. It needs to check for equality and evaluate fun2 if it is not. |
| 23:31 | brehaut | then switch the when for an if ? |
| 23:32 | joeblow2006 | Isn't that what I have? (defn fun3 [[x y z t :as v]] (if (= x y z) (vector x y z t) (iterate fun2 [x y z t]))) |
| 23:33 | joeblow2006 | I can't replace the when with an if because I have no place to put the v |
| 23:40 | joeblow2006 | Oh I see. (when (= a b c) s)) returns s. My problem is different. |
| 23:40 | joeblow2006 | I think it's best to make a "dumb" fun3, just the following: (defn fun3 [[x y z t]] (iterate fun2 [x y z t])) |
| 23:41 | joeblow2006 | And then try to manipulate fun4: (defn fun4 [[x y z t]] (take-while #(not= %1 %2 %3) (fun3 [x y z t]))) |
| 23:43 | joeblow2006 | Scratch that... |
| 23:43 | joeblow2006 | (defn fun4 [[x y z t]] (take-while #(not= %1 %2 %3) (iterate fun2 [x y z t]))) |
| 23:44 | amalloy | scottj: someone has a lein 4clojure plugin, which does a fair chunk of that |
| 23:44 | scottj | amalloy: cool I'll check it out |
| 23:45 | joeblow2006 | The %1 stuff seems to be wrong. The problem is that fun2 returns a vector and I need to access the components of the vector to check equality. |
| 23:49 | amalloy | joeblow2006: simplest replacement function is (partial apply not=) |