#clojure logs

2011-11-14

00:05amalloyno
00:08klauernok
00:35seancorfieldin a lein project file, how can i have code to build the dependencies and then specify that in the :dependencies entry?
00:44amalloyseancorfield: "code to build the dependencies"?
00:59seancorfieldamalloy: 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:00seancorfieldback 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:00seancorfieldso i want to have a main list and then conj on just the things that change...
01:35amalloyseancorfield: 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:40amalloyseancorfield: yes, that works
01:40amalloydefproject is a macro, but it politely looks inside its body to see if you've unquoted anything, and evals that
01:41amalloyso (defproject foo "1.0.0" :dependencies ~(into [...] (for [x whatever] ...)))
01:58antares_seancorfield: hi. I would love your opinion on https://github.com/michaelklishin/monger
03:31licenserso are macros actually working in cljs or is that a rumor? I've not gotten one to work yet :(
03:46Blktgood morning everyone
03:51leo2007In slime C-c C-m does not seem to expand, for example, #(.toLowerCase %)
04:19robermannhello
04:41tsdhHi robermann
05:08wtfcoderfor 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:08wtfcoderthe relevants libraries exist for Java so i dont technically that it will be a problem
05:09wtfcoderis 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:10wtfcoderim thinking the best way is high-level, should i start with say (defn sqlserver2couchdb [dbReader, couchPublisher] ) where dbReader and couchPublisher are functions?
05:49fliebelduck1123: How is OStatus doing?
06:17jowagwhat was Rich's talk at conj about?
06:21fliebeljowag: Hm, I had hoped it would be here. https://github.com/relevance/clojure-conj/tree/master/2011-slides
06:27fliebelDid Rich do a talk at all? I can;t find any mention of itl.
06:40jowaghe should have had a keynote on Friday, 04:40 - 05:40pm, according to http://clojure-conj.org/schedule#fri
08:13jcromartiedoes ClojureQL support transactions across several inserts/updates?
08:28gfredericksjcromartie: I might be crazy, but you might be able to use the transaction macro from clojure.data.sql
08:30jcromartiegfredericks: you may be crazy, indeed
08:31jcromartieif ClojureQL uses c.c.sql underneath
08:31jcromartieoh clojure.data.sql? has it moved?
08:32gfredericksyeah
08:32gfredericksthough clojureql may still point to c.c.sql
08:32jcromartieit must have only moved in an unreleased version
08:32gfredericksI'm sorry
08:32jcromartiethere's no documentation of c.d.sql
08:32gfredericksclojure.java.jdbc
08:32gfredericksis what I should have said
08:33gfredericksbut anyhow, clojureql does use c.j.jdbc
08:33gfrederickstherefore, unless you know otherwise, I stick with my assertion that you could maybe use the transaction macro from c.j.jdbc
08:34antares_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:34gfredericksI 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:34jcromartieyes
08:34jcromartielooks like it would work
08:34jcromartieI saw Korma last week
08:34jcromartielooks nice
08:35jcromartieat the moment, I might just need to use something lower level though
08:35jcromartieI'm trying to adapt a very old badly-designed db
08:35jcromartieand it's MSSQL
08:35jcromartieso certain things are just slightly weird enough and unsupported in ClojureQL or Korma
08:35jcromartieOK but riddle me this
08:35jcromartiehas clojure.contrib.sql become clojure.java.jdbc or what?
08:36antares_jcromartie: yes
08:38jcromartieit's hard to keep up sometimes
08:38jcromartie:P but... mental note added!
08:42jcromartiethe problem is all the old cruft on Google
08:42jcromartieI think I just need a good "starting point" for canonical information on this sort of thing
08:43jcromartieclojure.org is a good one :)
08:44pyrjcromartie: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
08:44licenseraloa :)
08:44licensersince the conference is over perhaps i get some smart people: Question is: has anyone used macros in clojurescript beyond very trivial things?
08:45licenserbecause 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:47Fossii thought macros were pretty special in that they don't really work runtime
08:47licenserFossi: yap they run at 'compile' time but for me they keep breaking things :(
08:48Fossiso, what's the problem? the code they generate doesnt run?
08:49Fossior does the compile fail?
08:49licenserfrom what I figured is that cljs does not go along with the way macros resolve names
08:49Fossii'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:50licenserfor example from (. ~context (save)) it makes "(. 1 (clgl.macros/save))" with context 1
08:50licenserwhich is ewww
08:50licenserbut that is a general problem in my macro I fear
08:51licenserI had something evil with bindings, since the binding arguments always got full namespace names :(
08:55jcromartieah
08:55licenseror perhaps I am doing it horribly wrong o.o
08:55licenserhi jcromartie
08:55jcromartielicenser: hi
08:59jcromartieI guess [clojureql "1.0.2"] is not ready on clojars yet
08:59jcromartieLauJensen: FYI
09:20jcromartieyarg
09:21jcromartieI guess I need to use ClojureQL from source to use it with Clojure 1.3
09:30adamhv/win 2
09:41michael_campbellMorning #clojurians.
09:42AWizzArd|work$seen lpetit
09:42lazybotlpetit was last seen quitting 1 week ago.
09:42jcromartieok 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:43jcromartieerr
09:43jcromartiehold on
09:43jcromartienever mind
09:52jcromartieI am afraid Korma is not quite up to the challenge of our DB structure :)
09:52jcromartieit has some of the weirdest joins and relationships
09:52jcromartiethings that really make no sense
09:54jcromartieit can get us halfway there
09:55jcromartiebut the idea of an entity mapping to one table is pretty much out the window here
09:55bhenryjcromartie: i thought he made it so that you could write your own abstractions for the weird stuff.
09:56jcromartiebhenry: maybe... I am sure I could mix it in with raw c.j.jdbc
09:57ejacksonjcromartie: You're already into clojureQL ? Perhaps my funky join generator (https://github.com/ejackson/relation) could help you ?
09:57jcromartieORM-ish :) yeah that's where we're at
09:57jcromartieORM falls apart
09:57jcromartiebut -ish might be right
09:58ejacksonits maintains a hierarchy of relationships between tables (nexus.clj) and then chains of joins (chain.clj)
09:58jcromartieinteresting
09:58ejacksonyeah, its not yet released, but I'm using it
09:59duck1123I'm still waiting for the ORM-ish abstraction for Korma
09:59ejacksonan 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:00duck1123I 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:00jcromartieI am really just trying to put a nice API on top of a really nasty DB
10:01jcromartiethe ideas going on in the DB are not really what I want to be using in my application
10:01jcromartieso, yeah...
10:01duck1123sometimes there's no helping the really odd structures
10:01ejacksonyeah, I've got a similar thing. transactions and joins to the rescue.
10:02BorkdudeWhat would be suited material for students to begin with Clojure? (most of em are on Windows)
10:02BorkdudeAlso IDE: I think teaching them Emacs first is not an option...
10:04ejacksonBorkdude: Counterclockwise in Eclipse.
10:04cemerickBorkdude: and if you run into problems, you can bug me. ;-)
10:04cemerickejackson: Hi! :-D Pleasant flight back?
10:05Borkdudecemerick: deal :)
10:05ejacksoncemerick: oh yes... AA is a delight.
10:05Borkdudecemerick: I already thought about it, because they have used Eclipse bfore
10:05cemerickBorkdude: there is a google group though, which is fairly active.
10:06cemerickejackson: sarcasm, surely? ;-)
10:06Borkdudecemerick: how are dependencies handled, can you use lein in combination with ccw?
10:06TimMcBorkdude: Let 'em get a little experience with CLI.
10:06ejacksonBy blocking out *all* sensory input I found it delightful...
10:07TimMcejackson: Full anaesthesia?
10:07jcromartieat least give them rlwrap
10:09ejacksonTimMc: Just about :)
10:10Borkdudejcromartie: gotta check that out then
10:10cemerickBorkdude: 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:12Borkdudecemerick: what is the normal way of getting dependencies then in ccw/eclipse? maven?
10:14Borkdudecemerick: or getting them with lein deps and then manually adding them to the classpath in eclipse?
10:14raekI know that some people run lein deps and add the jars that appear in lib/ to the classpath in eclipse
10:16jcromartieI think maybe Korma or ClojureQL can get us halfway there
10:16jcromartiebut the hope is to create a modern API on top of the DB and then migrate the old structure away
10:16jcromartieso that it is sane
10:16cemerickBorkdude: 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:17cemerickLeiningen integration in ccw is definitely 'coming soon', for some short definition of 'soon'.
10:20jcromartieis the developer of Korma on here?
10:22cemerickjcromartie: wait an hour or two, ibdknox is on PST.
10:22jcromartieI see
10:33chouserAaaaa... I thought I knew clojure, but now I see I don't know anything.
10:33TimMccemerick: Hapen to know if there are any lein plugins that set up .classpath and .project files?
10:33cemerickTimMc: That's what https://github.com/abrenk/lein-eclipse is.
10:34TimMcsweet
10:34TimMcAlthough I guess the lein pom + m2e trick would do that too.
10:34cemerickdisclaimer: I've never used it, but it's apparently worked well for others.
10:34cemerickTimMc: That's what I do with leiningen projects currently.
10:35TimMcI'm trying to wedge some Clojure into a project at work, you see. :-)
10:35cemerickSure, totally understand. Ping back if you hit issues.
10:36cemerickchouser: I still don't get it myself, but do share… ;-)
10:36chousertrying to switch from home-made vim/maven/etc. setup to emacs/lein/slime ...I have no idea what's going on anymore.
10:36zerokarmaleftchouser: you didn't lose a finger, did you?
10:37cemerickchouser: Ah, the hive mind envelops.
10:38drewrchouser: as a longtime user of lein+swank I often have the same feeling
10:39drewrI typically upgrade in a moment of weakness and then spend some amount of time fixing whatever breaks
10:39zerokarmalefti can't remember who opened their talk with that weird enlightenment metaphor
10:39drewrzerokarmaleft: fogus
10:39hhutchi missed that
10:40hhutchi'm waiting for the video to hear the whole thing
10:40michael_campbellI missed most of what Fogus said, and I was 15' away from him.
10:40cemerickhah
10:40michael_campbellThe scala DSL of Basic I understood... at least the output.
10:41chouserdrewr: well, that's encouraging. :-P
10:42tensorpuddingswitching from vim to emacs is hard enough, without having to migrate to slime at the same time
10:42drewrit's (usually) worth it :-)
10:42drewrtensorpudding++
10:43tensorpuddingoh, it's definitely worth it
10:43drewrfor me it was 10 years ago and wanting gnus
10:43tensorpuddingto me gnus was a fancy way of crashing emacs
10:43drewroh, my other comment was directed at chouser
10:43tensorpuddingbecause that's what it did every time i tried
10:45drewrtensorpudding: custom emacs build?
10:45tensorpuddingno?
10:45drewror emacs23, notoriously unstable for a release
10:45tensorpuddingit was in the days of emacs 23
10:45drewrprobably wasn't gnus's fault
10:45michael_campbellGnus was much nicer when Lars started rewriting it as Ding. And the doc was fabulously funny, too.
10:46drewrmichael_campbell: I showed up shortly after
10:47michael_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:48tensorpuddingi like thunderbird for mail well enough
10:50drewrmichael_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:51michael_campbellgnus or emacs?
10:52drewrwell, both, but I was specifically referring to gnus
10:53michael_campbellgotcha.
10:56michael_campbellnice, codebass' conj flickr album is up.
11:01gtrakany word on the lectures videos?
11:01michael_campbellThat they were filmed I can confirm. Timing for release... no idea.
11:03gtraki especially want the overtone one :-)
11:03bhenrygtrak: follow @confreaks for video release info
11:03gtrakthanks
11:04bhenryi also can't wait to show that one to everyone
11:04michael_campbellI 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:05gtrakit was pretty priceless, i think i overheard rich hickey say 'frightening' :-)
11:07cemerickgtrak: Rich's first comment to Sam after his talk was "You're badass!".
11:07gtrakawesome
11:07cemerickWhich is quite true. :-)
11:07gtrakyea, it was much more involved than his other videos
11:08gtrakand music was rich's thing, right?
11:08cemerickI 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:09gtrakshould hook up overtone to core.logic next
11:10gtrakthat could be truly frightening
11:12TimMc$google clojure overtone
11:12lazybot[rosejn/overtone - GitHub] https://github.com/rosejn/overtone
11:13TimMcAh, supercollider.
11:13Rayneshttp://github.com/overtone/overtone
11:13gtrakTimMc, with lambdas and macros
11:14TimMc$google algorithms are thoughts, chainsaws are tools
11:14lazybot[Algorithms are Thoughts, Chainsaws are Tools on Vimeo] http://vimeo.com/9790850
11:14TimMc^ anything like that?
11:14gtrakyea, looks similar
11:15duck1123using just clojure.test / midje, is there a good way to focus on a particular test?
11:16duck1123I know you can do it with lazytest
11:17gtrakTimMc, yea, it was like that, except he also used some external input and explained all the thought behind it
11:17TimMcnice
11:18hhutchgtrak: Sam Aaron was already rewriting overtone to use core.logic and core.match at the conj
11:18hhutchsmall parts of it
11:18gtrakhhutch, oh really?
11:18hhutchyeah, actually you could see it in his talk
11:18gtraklike generative music programs?
11:18hhutchno, i just mean the overtone code base itself
11:19hhutchhe had a use for core.match
11:19gtrakah
11:19hhutchi have a feeling i will end up over using core.match for a while because it is so handy
11:19gtraki think byrd's and friedman's reverse programs and genetic algos could be pretty awesome for music
11:28TimMcreverse programs?
11:29ejacksonTimMc: 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:29ejacksonFriedman demo'd this at the conj, it was spectucular.
11:33jcromartiehm, clojure.java.jdbc works fine to run a query, but the same query fails with Korma
11:38jcromartiehm
11:38jcromartieapparently whatever method Korma is using requires me to specify the full database.schema.table name
11:38jcromartiewhile clojure.java.jdbc does not
11:39gtrakTimMc, the generated programs were more amusing than useful at this point, but you can add constraints
11:39duck1123jcromartie: is this for adhoc queries /
11:40jcromartieno
11:40jcromartieduck1123: I have a defentity
11:40jcromartiein Korma
11:40jcromartieand an ad-hoc query in c.j.jdbc
11:40jcromartiebut the query generated by Korma works fine in c.j.jdbc, just not in Korma
11:40jcromartie...
11:41duck1123and I assume the connection spec is the same in both cases?
11:43jcromartieyup
11:43duck1123I 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:43jcromartieI don't think that' sit.
11:43jcromartiethe SQL Server driver is complaining that there's no such thing as <table name>
11:43jcromartielet me paste the example
11:45dnolengtrak: TimMc: to clear, the program they showed was an interpreter embedded into miniKanren. So it could run programs, generate programs, and check programs.
11:47jcromartieduck1123: https://gist.github.com/a518bece0b38b23ab226
11:50duck1123jcromartie: I don't know much about SQL server, but is the table actually named tblEmployees
11:50jcromartieyes
11:52duck1123what happens if you change :subname to include the db-name, that's how I had to do it in mysql
11:57jcromartiehm
12:00jcromartieKorma just uses clojure.java.jdbc anyway, though
12:10jkdufaircan 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:11jkdufairhere's what i have so far: http://pastebin.com/z9j49kvi
12:11joegallogenerate a seq of calls to shuffle, and then filter out shufflings where the constraints don't apply
12:11joegalloget the first result that wasn't removed
12:12jkdufairyeah i thought of that. kind of brute force but for such a quick util that would work. thx!
12:12joegalloyeah, computers are fast, you'll be fine ;)
12:13joegalloconsider (zip-map (shuffle kids) kids) for that
12:14jkdufairyes indeed
12:28Raynesjkdufair: To pair the kids, you're pulling them out two at a time?
12:28jkdufairMayDaniel: yes
12:28jkdufairHehe. sorry
12:29RaynesJust curious. I'm playing around with it.
12:29jkdufairthanks. brute force not working super well
12:33michael_campbelljkdufair: 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:34jkdufairmichael_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:34michael_campbellhah, I bet. Still, the abstractions in the cascalog interface might give you some ideas.
12:34ejacksonbut, to take michael_campbell's statement one further, you could try logic programming :)
12:35jkdufairyeah, it seems to boil down to a CSP. i'll take a look at cascalog
12:35michael_campbelland... 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:36ejacksoncascalog requires, I think, that you install all of hadoop, which is overkill
12:36jkdufairhehe. though i've been looking for an excuse to learn hadoop.
12:36ejacksoni think core.logic can solve this for you
12:36michael_campbellDunno; the examples at the conj were against normal flat files I thought?
12:37ejacksonyes, but remember all the processing, i think that was dispatching jobs to a local hadoop.
12:37michael_campbellI 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:37michael_campbellejackson: that could be; I think you're right, in fact.
12:38michael_campbellnow that you say it, it looks like this is a good sized entry project for some core.logic spelunking.
12:39jcromartiehooray
12:39jcromartieKorma is working for me now, BTW... duck1123
12:39ejacksonbeware of the Mad Hatter :)
12:39jcromartieduck1123: I followed your subname advice
12:40duck1123jcromartie: good to hear
12:40jcromartienow to get into Korma proper
12:42fliebelI'm probably looking at a spelling mistake here... any ideas? http://pastebin.com/gbTWDKsM
12:43fliebelduck1123: How is OStatus doing?
12:43duck1123fliebel: I absolutely hate the Salmon protocol
12:44Raynestechnomancy: ping
12:46fliebelduck1123: Yea, I've heard that before. They do some weird custom security encryption bit twidling, right?
12:47duck1123fliebel: 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:49jcromartiefliebel: did you get it?
12:49fliebelduck1123: How monolithic is your implementation? In other words, can I reuse some components?
12:49fliebeljcromartie: ?
12:49jcromartiefliebel: the :refer-clojure problem
12:50fliebeljcromartie: no :( It looks alright to me, but it does not work.
12:50jcromartieafter quitting and restarting the REPL?
12:51duck1123fliebel: 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:51fliebeljcromartie: yea, cake kill & cake repl, (use...
12:51fliebelduck1123: What do you think about activitystreams in json?
12:53duck1123fliebel: I have serialization as json working, but I am not yet parsing json activity streams
12:54fliebelduck1123: 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:55fliebel*mvc
12:56duck1123lol, it's a bit intimidating. I just pushed out a dev branch that has my un-cleaned up work from this weekend
12:58fliebelsolution for the refer problem: do not overwrite core fns
13:03TimMcfliebel: The problem is a (defn assoc-in ...) in the same file as that snippet?
13:03technomancyRaynes: what's up?
13:03fliebelTimMc: yes.
13:04jcromartieloving the Korma so far... pretty early on though
13:04TimMcOK, should be easy for me to test locally then.
13:05Raynestechnomancy: 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:06RaynesIf any of that made sense, please congratulate me.
13:06technomancyRaynes: once you get one accepted pull request you can have commit access, but potentially destabilizing stuff needs to be done on branches, naturally.
13:06RaynesOf course.
13:07technomancythe 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:07TimMcfliebel: It is working for me...
13:08TimMccopy/pasted
13:08fliebelTimMc: Weird... Thanks.
13:09Raynestechnomancy: Gotcha.
13:09TimMcClearly, the problem is... "Nullified Parameter Destabilisation"
13:09technomancyRaynes: what did you have in mind specifically besides spawn?
13:10Raynestechnomancy: Well, I don't really know yet.
13:10technomancyalso, have you seen https://github.com/technomancy/leiningen/wiki/VersionTwo ? I expanded it a fair bit on my flight yesterday
13:10fliebelTimMc: Uh? So should I flip the input of the bloom array smoke screens?
13:11TimMcNo! That will destabilize the redundant fitler drive.
13:11TimMc*filter
13:11TimMcand then you'll have two problems
13:11fliebeltechnomancy: I read a tweet or two about a cake + lein effort, what's what all about?
13:12TimMcSeriously though, your computer is insane.
13:12technomancyRaynes: 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:12technomancyif it's just additional defproject entries (which may affect classpath) then it's conceptually pretty simple.
13:12Raynesfliebel: 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:13fliebelRaynes: Ok, so Leiningen it is. Maybe that also solves my refer-clojure problem :)
13:13technomancyfliebel: http://devinewines.ca/eventAuctions/auctionImages/powers_combined.jpg
13:14Raynestechnomancy: 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:14wastrelso hi folks
13:14RaynesOr maybe I just don't understand why it is so important.
13:15technomancyoh, this one's not bad either: http://images.cheezburger.com/completestore/2009/9/8/128969149726151424.jpg
13:15wastrelsemi 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:15fliebeltechnomancy: I have photoshop...
13:15wastrelany idea where i can find that again?
13:16technomancyfliebel: there are surprisingly few good captain planet image macros readily searchable
13:16wastrelcaptain planet is/was godawful
13:17gtrakwe're the planeteers, you can be one too, cuz saving our planet is the thing to do
13:17technomancyfliebel: basically a bunch of kids summon an environmental superhero with their magic rings; the catchprase was "by our powers combined..."
13:17technomancyalso he had a mullet
13:17gtrakhe was a lot like macgyver
13:18fliebel"Leiningen and the Cake" or "The ants are a lie"
13:19technomancywow, Jeff Goldblum briefly voiced a Captain Planet villain‽
13:21cemericktechnomancy: Your meme prowess astonishes. :-)
13:21technomancyI been practicin'.
13:22cemerickThe first thing I saw upon walking into the hotel bar on Wednesday night was pimp my ride on all screens, which was hilarious.
13:23jcromartieis "doc" gone from Clojure 1.3
13:23gtraki always thought acid rain was pretty cool
13:23raekjcromartie: no, it moved to clojure.repl/doc
13:23jcromartieah
13:23jcromartiethat's kind of noob-hostile, isn't it?
13:23cemerickjcromartie: nearly all REPLs (including Clojure's command-line one) use it in all namespaces implicitly.
13:24cemerickso, it should be available as before
13:24michael_campbellI just tried it in a repl; worked for me
13:24jcromartiehm
13:24jcromartiewell after I (in-ns 'foo) in lein repl
13:24jcromartieI don't have it
13:24michael_campbellmind you, at this stage in my clojurification, I *LIVE* in "doc".
13:24jcromartiebut maybe that's not the right way to do it?
13:25jcromartiewhen I'm developing I typically do: (require 'my-ns.core :reload) (in-ns 'my-ns.core)
13:25jcromartiefor convenience
13:25cemerickjcromartie: 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:26jcromartieso, what's a better way to do it
13:26jcromartie(ns dev (:use my-ns.core :reload))
13:26technomancycemerick: oh wow, you mean clojure.repl comes along for the ride with refer-clojure if it detects you're in a repl?
13:26cemericktechnomancy: provided by clojure.main/repl, IIRC
13:27jcromartiehm
13:27jcromartie(ns ...) doesn't include clojure.repl :)
13:27cemerickjcromartie: do you have doc available immediately upon starting your repl?
13:27jcromartiewhen I'm in lein repl
13:27jcromartielet's find out
13:27jcromartieyeah
13:28cemerickoh, I see what's happening
13:29cemerickhrm, maybe not
13:29jcromartieI'm using Clojure 1.3.0 if it makes a difference
13:30technomancyyeah, I don't think new nses get it
13:31eftatehow much memory does a sequence use per element
13:32cemerickah, I get the repl/pprint/etc refers automatically in every namespace because nREPL uses a new clojure.main/repl invocation for each expression.
13:32cemerickNot sure if that's a good thing or not. :-/
13:33eftatemight be a bad idea for me to read a file through a sequence of tokens
13:33cemerickeftate: however much memory each element requires
13:34eftateby my calculation sequence adds 40 bytes per element
13:34eftateor 32 if it's not lazy one
13:34eftatebut since a lot of core functions return lazy ones...
13:38eftateso 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:40eftateor on 64 bit system sequence element takes up 80 bytes + 44 for string element + string length * 2
13:40eftatehm... better stick with java char arrays
13:50jkdufairthanks for the help with the xmas gfit algorithm folks. my simple solution: http://pastebin.com/Ls4aqz95
13:52tsdhHi technomancy
13:52tsdhIs it possible to run leiningen with clojure 1.3?
13:53amalloyjkdufair: you can simplify is-sibling? and related functions a fair bit
13:53technomancytsdh: 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:54amalloy(defn siblings? [& kids] (apply = (map :family-name) kids)), for example
13:54tsdhtechnomancy: Thanks, I'll look it up.
13:54technomancytsdh: https://github.com/technomancy/leiningen/blob/master/doc/PLUGINS.md <- see the "Clojure Version" heading
13:54amalloyer, misbalanced parens there but i hope you get the idea
13:55tsdhtechnomancy: That's exactly my use case. :-)
13:56technomancytsdh: for clojurescript?
13:56jkdufairamalloy: do tell
13:56jkdufairoh thx!
13:56amalloyanyway, 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:56cemericktechnomancy: are different authentication bits in e.g. ~/.lein/init.clj considered "config files"?
13:57cemerickin VersionTwo, that is, sorry
13:57jkdufaircool. thk you
13:57tsdhtechnomancy: 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:57technomancycemerick: 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:58jkdufairamalloy: what does the & in the fxn arg mean?
13:58cemericktechnomancy: that's actually my #1 usage of profiles in maven-land.
13:58tsdhjkdufair: It's a varargs function.
13:58jkdufairoh ok
13:58technomancytsdh: in that case you should probably use eval-in-project with the actual project, not a dummy project. =)
13:58technomancycemerick: interesting; good to know.
13:59cemerick+1 to generating pom.xml w/o maven itself, FWIW
13:59tsdhtechnomancy: Yep. Do I put that simply into the definition of the leiningen plugin?
13:59technomancycemerick: oh, how so? for more reasons than just trimming the deps? =)
14:00cemerickWho wants to be the one to maintain leiningen.pom when some new bit of config should get surfaced in the XML? ;-)
14:01technomancytsdh: yeah, you can see the test task for an example of running code in the project's classpath
14:02tsdhtechnomancy: Great, thanks.
14:04TimMcOK, 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:04TimMcAny good example projects I can look at?
14:05gtrakyou shouldn't need to invoke if you're gen'ing a class, right?
14:05gtrakyou can create an arbitrary facade
14:05TimMcThe Clojure is included as source -- I need to call RT to find them.
14:05TimMcI don't have the luxury of a separate project compiling to a jar.
14:06gtrakuhh, so you're going to create a class dynamically and load it?
14:06gtrakand have java code reference a dynamically loaded class?
14:06TimMcWell, something like this I guess: http://stackoverflow.com/questions/2181774/calling-clojure-from-java/6410926#6410926
14:07gtrakyou still need to get clojure.jar to compile your namespaces
14:07gtrakbut i suppose that will work
14:07amalloyTimMc: if the code isn't being AOT-compiled i don't believe you can use gen-class
14:08gtrakyea, gen-class makes no sense with that technique
14:08TimMcHmm, right.
14:08amalloyso you more or less have to use RT.var to find whatever functions and invoke them
14:08TimMcSo raek's example there on Stack Overflow is still appropriate?
14:08amalloyyes, that is what i would do
14:09amalloy(in what i understand your situation to be)
14:09TimMcAnd the "namespace" of com/company/ui/index.clj would be "com.company.ui.index", yeah?
14:10TimMc(I'm trying to use Enlive to generate HTML for this Java project.)
14:10amalloy*nod*
14:11gtrakdoes it automatically compile for you when you do it that way?
14:12TimMcI think so?
14:12amalloygtrak: when you require it
14:12gtrakoh I see, there's a Compiler.load( that he calls
14:13gtraknot raek, but the other one
14:14TimMchell yes
14:14TimMcTotally works.
14:14tsdhtechnomancy: 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:16technomancytsdh: gilardi scenario'd!
14:16tsdhtechnomancy: 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:16technomancyyou should read this: http://technomancy.us/143
14:17technomancybasically you have to require the namespaces you need in another form with the init arg
14:24TimMcPreferred method for setting up a new Emacs for Clojure work?
14:24TimMcMy old el-get script is not quite working.
14:26tsdhtechnomancy: Argh. Then it doesn't find the leiningen.compile namespace. Does that mean that I have to add leiningen to the :dependencies?
14:27technomancytsdh: eh, you're trying to configure an AOT compilation from inside the project?
14:28tsdhtechnomancy: 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:28technomancyoh, I see. yeah, you need to keep things in separate namespaces.
14:29technomancythe task goes in leiningen.mytask, but the code that needs to run in the project should be in a different namespace
14:29technomancyswank-clojure actually might be a better example here
14:29technomancysrc/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:30tsdhOk, then I'll check that out.
14:37amalloychouser: i seem to be listed as the project lead for DXML on jira. would you like to hold that lofty position instead?
14:40tsdhtechnomancy: Yay, that does the trick!
14:41TimMcargggh "Symbol's function definition is void: paredit-mode"
14:42technomancytsdh: if you have suggestions on how the documentation could be clearer I'm interested
14:46TimMcSetting up Emacs is the most frustrating thing ever.
14:46yazirianIt isn't so much an installation as a lifestyle choice.
14:46TimMcIt isn't so much an installation as oh god what does anything mean.
14:47TimMcOr, why doesn't anything work in this otherwise identical setup.
14:47TimMcIs el-get a bad idea? That's what I'm trying to use to get paredit-mode.
14:47cemerickyazirian: that's cute
14:47technomancyI have no idea what the point of el-get is
14:47yazirian:)
14:48tsdhtechnomancy: 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:48cemerick"emacs is a lifestyle choice" is apparently a common phrase/notion, though I hadn't noticed it before
14:48yazirianI've only ever either used package-install, or done it by hand.
14:49TimMcThe guy who set me up with a .emacs on my laptop used el-get.
14:50yazirianThis 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:50TimMcIs it worth upgrading to Emacs 24 (from 23) or is that going to be another rat pit?
14:50technomancytsdh: 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:50technomancyI've found 24 to be more stable than 23
14:53mefestoemacs24 available on ubuntu? i glanced through the software center but didn't see it
14:53TimMcOog, dependency hell.
14:54technomancymefesto: http://emacs.naquadah.org/ is the only source I know of for .debs
14:54mefestotechnomancy: thanks
14:54TimMcNot gonna work on Linux Mint (not my idea).
14:55technomancyit's not bad to build from source as long as you get it from a git mirror rather than bzr
14:56TimMcThat might not help with the dependencies.
14:56TimMcI don't want to install only to find out a week later that it *really needs* that version of ImageMagick, etc.
14:56technomancyyeah, you have to do a build-dep first, but build-dep of emacs23 gets you what you need to build 24
14:56technomancyno idea how to do that without apt though
14:57TimMcAutomatic package management is only nice if you live on the cutting edge.
14:57technomancyhuh?
14:57TimMcWell, if something keeps you from being at the latest release of a distro, everything goes to hell.
14:58TimMcUbuntu is terrible about making backports, and my understanding is that's not unusual.
14:58technomancyoh, for system libraries; I see
14:59TimMc...and I'm on some godawful Ubuntu derivative called "Mint" which is even further removed from the latest repos.
14:59amalloyTimMc: 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:00yaziriantrying 24 now... it did some weird thing where it sent the initial frame to a different desktop
15:00yazirianbut nyan-mode works, so i think we can be friends
15:01technomancyI'm telling you, lexical scope changes everything.
15:01TimMcSo... `git clone https://github.com/technomancy/emacs-starter-kit.git .emacs.d` ?
15:02yazirianwhoa... 24 has lexical? if i had known i would've been on it the day after they merged that
15:02technomancyTimMc: it's changed a bit with version 2; see the readme
15:02TimMctechnomancy: Can't use v2, I'm on 23.
15:03technomancyTimMc: right; you will need to switch to the master branch then; the v2 branch is default now
15:03TimMcaha, I see the problem
15:04TimMc*bam*
15:05scottjdoes lein's :shell-wrapper actually work?
15:05technomancyscottj: it's certainly lightly-tested
15:06technomancyand it doesn't work on Java 1.5
15:06scottjtechnomancy: is it created on lein jar or lein uberjar, and it appears in ~/.lein/bin?
15:07technomancythe jar task just puts it in the jar; only the 2-argument version of lein install places it in ~/.lein/bin
15:07TimMcWHat is the emacs-starter-kit way of getting Clojure mode, paredit, paren coloring, etc.?
15:07technomancyscottj: probably an oversight if the in-project version of lein install doesn't do it
15:07scottjtechnomancy: what command actually creates the shell script?
15:08technomancyscottj: "lein install swank-clojure 1.3.3" should do it
15:08technomancyoh, maybe lein plugin install too
15:12TimMcI see, package.el
15:15gtrakis dynamic binding gone now?
15:15technomancygtrak: in elisp? it's still default; you have to opt-in to lexical scope since otherwise you'd break tons of stuff.
15:15gtrakTimMc, I got fed up with ubuntu for a few years, and now I love Arch, I use ubuntu for VMs though
15:16dnolengtrak: no, you just need to declare which things will be dynamic with ^:dynamic
15:16gtrakah, dnolen i meant in emacs, sorry :-)
15:18scottjis there a command to pr-str maps, vectors, keywords etc with their meta data in a way that works with read-string?
15:18scottj(or maybe it's not pr-str that I want)
15:20technomancyscottj: pr-str with *print-metadata* bound, I think
15:20gtrakprint-dup?
15:23amalloy*print-meta*
15:23technomancythat's the one
15:23amalloy&(binding [*print-meta* true] (pr-str (with-meta [] {:foo 1})))
15:23lazybotjava.lang.SecurityException: You tripped the alarm! pop-thread-bindings is bad!
15:24amalloy,(binding [*print-meta* true] (pr-str (with-meta [] {:foo 1})))
15:24clojurebot"^{:foo 1} []"
15:24amalloyRaynes: wait, does lazybot not allow any bindings at all now? if so that sounds like a mistake
15:24scottjcool thanks!
15:24Raynesamalloy: He hasn't allowed for bindings since like 10 months ago.
15:25RaynesNot that I exactly know why. I'm sure I had a reason.
15:25amalloyi guess maybe because binding is a macro expanding to push/pop of threadbindings, and you can't allow people to push without popping?
15:26RaynesSeems like pop was a problem.
15:26amalloyeither direction would be
15:26mefestoupgrade to emacs24 went surprisingly smooth :)
15:27Iceland_jackmefesto: :)
15:28brehautapparently i am connected to the internet via a yoyo today
15:29gtrakif pushed or popped, individually, that sounds bad, but if both, why not? any weirdness would be caught by other guards
15:30Raynesgtrak: 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:33gtrakdoes binding have to be a macro?
15:34gtrakor 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:35gtrakactually, the more i think about it, the worse it seems :-)
15:36gtrakhow about resetting the bindings for each executed form? too slow?
15:36gtrakor only if one of those were called
15:39mefestogtrak: would with-bindings* work?
15:39gtraksame problem, right?
15:39mefesto,(doc with-bindings*)
15:39clojurebot"([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:39mefestoit's a function
15:40gtrakthe issue is it's hard to check if the user did the right thing, since we're not doing any static analysis
15:40amalloygtrak: 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:40gtrakamalloy, directly to java?
15:40gtraklooking at it right now: static final ThreadLocal<Frame> dvals = new ThreadLocal<Frame>(){
15:41gtrakthe user can break the clojure vars that have the macros :-), but resetting them through java would have the same effect, no?
15:42gtrakand since it's thread-local, it shouldn't affect anyone else
15:43gtrakha, what if he runs another thread and does it there? :-)
15:43gtraksay, in an agent
15:48amalloygtrak: threads are pooled anyway, so thread-localness isn't really relevant
15:48amalloysomeone else will wind up wanting to reuse the future he's broken
15:49gtrakyea exactly
15:49gtrakah, didn't know futures were pooled
15:49gtrakbut same issue there
15:55cemerickInteresting that rest is called more in ISeq.
16:02amalloycemerick: a lot of weirdness in general, on the java side
16:07dnolencemerick: yeah I always found that a bit odd, fixed in CLJS
16:15TimMcWhy do the .java files in clojure.lang have no Javadocs?
16:15RaynesIt was just officially announced that Leiningen and Cake are joining forces: https://groups.google.com/d/msg/clojure-cake/GG7DbCQmmW4/Uh7IdWNFmdwJ
16:15TimMcMakes interop hard from the Java side.
16:17cemerickRaynes, ninjudd, amalloy, lancepantz, et al.: seems like a win-win for everyone. Thank you. :-)
16:17dnolenexciting stuff
16:18gtrakawesome
16:18jolygreat news
16:19cemerickhow often do "competing" open source projects "merge"? Must be a first. :-P
16:19licenserRaynes: awesome!
16:20amalloycemerick: 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:20pnicholsoncemerick: rails + merb
16:20cemerickamalloy: 'tis true. OK, a second instance of the phenomenon.
16:20cemerick:-P
16:20fliebelWill Lein 2 have anything to do with nREPL?
16:21cemerickfliebel: 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:22tomojdoes that mean lein gets ruby?
16:22cemerickI can't imagine.
16:22Raynestomoj: It isn't a 'merge'.
16:22RaynesI hope people don't start throwing that word around.
16:23cemerickRaynes: sorry, I think I'm the one that threw that around.
16:23tomojwonder if this is why clojure-cake.org is down
16:23RaynesIt 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:23cemerick(in quotes for a reason, FWIW)
16:24gtraka people not code-merge
16:24michael_campbellcemerick: Struts2 also subsumed WebWork in the java UI framework world.
16:24cemerickmichael_campbell: people still use struts, or any derivation thereof? :-O
16:24fliebelPyramid did something aweful to Pylons and... whatever
16:24amalloytomoj: 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:25Raynescemerick: No worries, just don't want it to be taken too literally. :p
16:25moogatroniccemerick: god help them, but yes. in fact, I consult on a struts 1 project even.
16:25michael_campbellcemerick: Tis true. My company does. Hence my casual throwing around of describing my day to day existence as "soul crushing" at the conj.
16:25cemerickSeriously.
16:25moogatronicthe code even goes into CVS. =)
16:25cemerickRaynes: I'll from now on refer to it as The Goodness™.
16:25michael_campbell<- svn here.
16:25Raynesamalloy: 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:26RaynesSo maybe it is related. ;)
16:26michael_campbellThis combining of efforts seems only but good, no?
16:26moogatronici tried for SVN, but then I was tasksed with producing proof on why SVN was better in the form of a giant manual.
16:26moogatronicLMGTFY wasn't sufficient
16:26michael_campbellmoogatronic: "atomic commits" usually gets some attention.
16:26moogatronicyeah, i tried that.
16:26moogatronic=)
16:27michael_campbellmoogatronic: 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:27moogatronicthe problem was the dinosaur chair-warming programmers who still wanted to go back to RCS
16:27moogatroniceven though they mostly watch youtube videos all day instead of do any work.
16:27michael_campbelloh god.
16:28michael_campbellSCCS...
16:28michael_campbellDVCS... <shudder>
16:28michael_campbellerr, PVCS, rather
16:28jolyI got to interact with RCS, SCCS, and PVCS through recursive makefiles. I was glad to see the end of that "fun"
16:29moogatronicneedless to say, git was out of the question as an upgrade option. =)
16:29seancorfieldback
16:29moogatronicthankfully 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:30michael_campbellthat's because it is.
16:30chouserI'm going to apologize in advance, because but I'm going to go ahead and pretend this is #emacs
16:30michael_campbellI 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:31chouserwhat's the appropriate way to dismiss a buffer such as *Help* that has popped up in front of what I want?
16:31moogatronicI kill it.
16:31cemerickJust click on the…oh, nevermind.
16:31michael_campbellC-x k
16:31chouserC-x k *Help* seems brutal and clumsy
16:31chouseroh
16:31chouserok
16:32gtrakthe 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:32chouserbrutal and clumsy it is, then. :-)
16:32brehautchouser: 'brutal and clumsy' is the emacs way isnt it?
16:32michael_campbellIf it's the current buffer, just return.
16:32jcromartiehm, 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:32michael_campbellOr C-x b to switch to another buffer.
16:32jcromartieif I just want a little bit of extra info on 1K things, that's 1K queries
16:32chouserok, thanks.
16:32michael_campbelland just let *Help* sit in the back.
16:32moogatronicchouser: on my mac cmd-k kills it.
16:32moogatronici just think of it as 'close'
16:32moogatronic=)
16:32michael_campbellOr... M-x bury-buffer to make it go WAY back.
16:32amalloychouser: usually it also pops up a recommendation in the minibuffer like C-x 1 or C-x 4 C-o RET
16:32TimMcchouser: Your window has divided into two buffers, yes?
16:33jcromartiejcromartie: it would be better if the db lib would do the join and "roll up" the records on the PK
16:33jcromartieinstead of a subquery
16:33TimMcchouser: Expand the current buffer using C-x 1 or the other using C-x 0.
16:33michael_campbelljcromartie: I havent played w/Korma yet but can you not specify the entire query? (including joins)?
16:34chouserI 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:34gtrakdnolen, this a-la-carte type system idea is an awesome one
16:34jcromartiemichael_campbell: if you specify joins along relations, for instance, (select vendors (with accounts) ...) Korma will issue a separate account query for each vendor
16:35jcromartieit's the classic 1+N query problem
16:35jcromartien + 1 selects
16:35amalloychouser: that's a reasonable thing to do. emacs recommends C-x 4 C-o RET
16:36amalloybut just killing help isn't crazy, since that command is absurdly long
16:36brehautjcromartie: have you looked at join as well as with ?
16:36jcromartieno
16:36jcromartieit's not mentioned in the docs
16:36chouserI guess I was hoping for something that would hide or kill the most recently opened buffer.
16:36brehautjcromartie: http://sqlkorma.com/api/0.2.0/korma.core-api.html#korma.core/join
16:36jcromartiehm
16:36amalloychouser: C-x 4 C-o RET is it, sadly. you can bind that function to a less stupid sequence
16:37jcromartieyeah at this point I may as well look back to ClojureQL
16:37michael_campbellchouser: 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:37dnolengtrak: yes, tho rhickey took that idea a bit further in his talk.
16:38brehautsyntax hilighting question: do people prefer the symbols for marcos, special forms and functions to be highlight differently or the all the same?
16:38michael_campbellchouser: if you have multiple panes, C-x k <return> should kill whatever buffer in which the cursor is currently active.
16:38gtrakdnolen, yea, is there any groups thread for the static analysis idea or is it too fresh?
16:39michael_campbellbrehaut: Good catch; I can't imagine Chris would have left out something as basic as joins. =)
16:39gtrakhe doesn't seem like one to propose something that won't get done
16:40cemerickbrehaut: you can't tell between the two statically, so symbols in fn position should be colored uniformly IMO.
16:40cemericke.g. a macro whitelist is really just a "clojure.core whitelist"
16:40cemericks/e.g./i.e.
16:40brehautcemerick: thats what im leaning towards too; the idea of writing an inferencer in javascript is not appealing ;)
16:40chousercemerick: I aussme you mean "if you can't tell ... statically" ;-)
16:41chouserassume. *sigh*
16:41brehautcemerick: and having the highlighter guess incorrectly (or omiting things) could be quite annoying
16:41cemerickchouser: he's in javascript for the syntaxhighlighter brush, so…he can't. ;-)
16:41dnolengtrak: most of those ideas were things he wasn't planning on taking on himself.
16:41cemerickbrehaut: yeah, don't even try. Ow. :-)
16:42gtrakdnolen, yea it's a lot of work, I'm just interested in it and I want to know more :-)
16:42brehautcemerick: lol :)
16:42dnolengtrak: not much prior discussion that I know of, but Will Byrd also seem pretty interested in the ideas as well.
16:42dnolengtrak: cool!
16:42brehautcemerick: the repo now has a scruffy demo page in it btw
16:42cemericknice
16:43jcromartieLauJensen: ping?
16:44cemerickonce 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:44cemerickand we can have some serious highlighting for the syntaxhighlighter brush
16:44dnolengtrak: 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:44brehautcemerick: that would be fantastic :)
16:45chouserheh
16:45chouserI'm learning emacs. That's about all I can imagine accomplishing for the next 6 months or so.
16:45cemerickbrehaut: your brush would be *big*, even if that worked.
16:45jcromartiechouser: give yourself a little more credit
16:46seancorfieldsomeone at the conj said the first ten years were the hardest, then emacs gets easier...
16:46brehautcemerick: i think its already the largest brush for the syntax highlighter :P
16:46cemerickjcromartie: chouser should give emacs more credit; it'll fight for longer than 6 months to yield up its jewels.
16:47jcromartiehah
16:47raekwhat convention does db-specs follow in Korma? the same as clojure.java.jdbc uses?
16:47jcromartieraek: yes
16:47chouserOk, C-M-x works to eval a form, but the results show up in a line at the bottom of the screen
16:47jcromartieraek: clojure.java.jdbc (neé clojure.contrib.sql) is the standard for SQL connections and execution
16:47chouseris there some way to send them to the repl buffer instead?
16:47jcromartielike Ring for SQL :P
16:48gtrakdnolen, 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:48chouser*slime-repl clojure*, specifically? Hopefully with both the expression and its results showing up?
16:48raekjcromartie: terrific. I'm currently checking out how smoothly sqlite works with Korma...
16:49moogatronicchouser: C-c C-e at the end of a s-exp?
16:50amalloychouser: i don't think so. usually you send stuff "silently"
16:50chousermoogatronic: that prompts for a expression, the results of which still end up as a single line at the bottom of the screen.
16:50moogatronicyeah, nevermind. =) i thoguht i saw it down there before, but i must have hallucinated
16:50chouseramalloy: :-(
16:51moogatronicselect, C-x o, paste, enter
16:51moogatronic=)
16:51jcromartieraek: I've spent the day in Korma, and I have to say... I'm going back to ClojureQL for now
16:51michael_campbellchouser, I've been "learning emacs" for 20+ years now.
16:51dnolengtrak: I could be wrong but I think we can plug into the analyzer phase and store facts about forms as they are encountered.
16:51gtrakdnolen, 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:52amalloychouser: fwiw moogatronic meant C-x C-e, but that isn't what you want either
16:52chouserdnolen: either that or run the analyzer and consume its output entirely independantly of the normal compiler
16:53moogatronicamalloy: yes, thanks. =)
16:53gtrakdnolen, yes, so first you have to describe what constitutes a fact, then build rules that infer other facts
16:53chouserok, so the slime usage pattern seems a bit different from inferior-lisp
16:53chouserlike you're expected to perhaps load a whole file, but then switch to the slime buffer to actually try things interactively.
16:54raekjcromartie: what did you not like about it?
16:54amalloychouser: 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:54raekI head something about table and column names not being quoted (and also read that there is no standard way of doing that)
16:54chouseramalloy: so you go along with no handy record fo what you've been trying?
16:55jcromartieraek: 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:56amalloychouser: 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:56jcromartieraek: 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:56jcromartieflat tables
16:57jcromartieand you have to specify things explicitly again, instead of using the has-one has-many
16:57jcromartiethere's also no has-many-through, that I can see
16:57raekoh.
16:57chouseramalloy: 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:57jcromartieso complex stuff kind of falls apart for me
16:57brehautjcromartie: 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:57amalloychouser: i switch to the repl buffer to call the function
16:58chouserah, right, ok.
16:58raekis there a good comparison of the db libs somewhere?
16:58chouserso next is: how do you fetch a previous repl expression so you can change it and try again?
16:59brehautchouser: M-p
16:59scottjor scroll up to it (or isearch) and press enter on it
16:59chouserbrehaut: perfect, thanks.
16:59michael_campbellM-n does next, also.
16:59raekah, the Mostly Lazy podcast mentions some...
16:59seancorfieldctl-up works for me
17:00zerokarmaleftchouser: http://bc.tech.coop/blog/070424.html <= i haven't tried this, but it does exactly what you're wanting
17:01zerokarmaleftfor demo purposes, so his audience has a better idea of what's explicitly getting sent to the repl
17:02dnolenchouser: yes being able to run the analyzer w/o the compiler would be ideal.
17:03moogatroniczerokarmaleft: nice. i wanted that too. =)
17:05technomancychouser: usually help buffers like that can be dismissed with q
17:07mjwhittoh no chouser is learning emacs, my "chouser uses vim" excuse is faltering
17:09mjwhittI guess I could always try evil, but that's just seems wrong
17:09cemerickmjwhitt: You can always say that vim is the 2nd most frequently used Clojure editor… :-)
17:09mjwhittgood point, hehe
17:15jcromartieI 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:15jcromartieThat's a testament to the underlying library philosophy of both :).
17:16gtrakjcromartie, a simple wrapper for bean properties? :-)
17:17jcromartieno, actually not quite
17:17jcromartieor is it?
17:17jcromartieI mean is that what clojure.java.jdbc uses
17:18gtrakthat would be the obvious thing to do unless you have a reason otherwise
17:18chouserzerokarmaleft: interesting, thanks!
17:19chousermjwhitt: 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:20cemerickjcromartie: you should open a ticket on korma, FWIW
17:21jcromartieyah I guess I'm torn, really
17:21jcromartieClojureQL seems to be a bit stale
17:21jcromartiebut Korma has potential
17:22ninjuddtechnomancy: you're right. it looks like 'C-x o q' always does the right thing for dismissing a help buffer
17:23ninjuddjcromartie: i talked to ibdknox and bendlas at the Conj about the future of clojureql now that korma is here
17:24ninjuddbendlas may rewrite clojureql to use the same AST as korma
17:25ninjuddas it is right now, clojureql is more composable than korma, but korma generates better sql and is much simpler
17:33jcromartieninjudd: ah ha, an insider :)
17:34jcromartieninjudd: maybe korma could be built on clojureql
17:34jcromartiebut yes, I find clojureql's composable nature a little more suited to my rat's nest of a db
17:34jcromartieand as far as "better SQL" what does that mean in practice?
17:35RaynesI highly doubt Korma would ever come near clojureql.
17:35ninjuddjcromartie: 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:36ninjuddbut it is more likely that the korma backend would be used, i think
17:36jcromartiehm
17:36RaynesRight.
17:37ninjuddthough clojureql has done more work on db platform support, so that could possibly be extracted
17:37RaynesJudging by Chris's lightning talk, Korma's backend sounds great.
17:37ninjuddyes. the compiler for korma is much cleaner IMO
17:38RaynesAnd it is already totally detached from Korma, right?
17:38ninjuddthough it would need some extension to support "infinite composability"
17:38jcromartieyeah
17:38jcromartieand Korma doesn't support open-ended aggregates or modifiers
17:38jcromartielike, if I want to add TOP for MS SQL Server
17:38jcromartieI can't do that in Korma
17:39ninjuddRaynes: you mean https://github.com/ibdknox/Korma/blob/master/src/korma/internal/sql.clj?
17:40ninjuddstill part of korma, but could chris could easily make it a standalone library
17:40RaynesRight.
17:40jcromartieit seems like it's small, but fairly rigid
17:40jcromartienot like ClojureQL doesn't suffer from that in other areas...
17:41ninjuddjcromartie: yes, but i still think the architecture is a better starting point for compiling to SQL
17:41TimMcMerge all the libs!
17:42ninjuddthat's the theme, isn't it ;)
17:43ninjuddin 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:44TimMcRT.var("com.company.clj.file", "fn-name") is giving me an unbound var. How do I debug that?
17:44raek"By our powers combined..."
17:44TimMcIs there a way to check what all is in that namespace?
17:44gtrakraek, http://mustachify.me/?src=http://upload.wikimedia.org/wikipedia/en/thumb/e/e2/Captain_Planet.jpg/250px-Captain_Planet.jpg
17:45jcromartieyou win
17:45raekTimMc: you can call ns-publics to get a map of the (non-private) vars in a namespace
17:46raekTimMc: did you require the ns before trying to access the var?
17:46TimMcyup
17:46TimMcAnd that succeeds.
17:46TimMcThe fn is called "write", so there's no munging to speak of.
17:46chouserTimMc: 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:47TimMcDebugging this from the Eclipse Display view is pretty painful.
17:47cgrayhow do you require a non-closure js library in cljs?
17:47TimMcchouser: AOT is not really an option at this point.
17:47chouserTimMc: Ah, pity. :-/
17:48chouserTimMc: I'd be curious why, if you have a moment.
17:48raekTimMc: 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:49TimMcraek: If I misspell the name it throws. :-)
17:49raek(RT/var "foo" "bar") returns an unbound var for me
17:50chouserTimMc: you can call .getMappings() on the namespace object
17:50raekTimMc: even for the RT.var call?
17:50TimMcraek: RT.var for nonexistent var returns an unbound var.
17:51raekah, I see. thought you mean a not found on classpath exception for some reason :-)
17:51TimMcchouser: 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:51chouserTimMc: ok, got it.
17:52TimMcJava servlets compiled against Clojure AOT against common POJOs.
17:52TimMcThis way I can just stick the Clojure in src/main/resources and be done with it, but for an RT.var().invoke().
17:54chouserclojure.lang.Namespace.find(clojure.lang.Symbol.intern("your.namespace")).getMappings()
17:55chouserthat should throw a NPE if the namespace wasn't loaded, otherwise return a Map of all symbols in that ns
17:55ninjuddTimMc: 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:57TimMcNot sure if I can get away with that politically yet.
17:57TimMcThat may depend on how well I can sell this use of Enlive. :-)
17:58TimMc(Also, I suck at Maven.)
17:58ninjuddme too ;)
18:00TimMcOK, time to blow away ./target... this is absurd.
18:03TimMc...and now it works. -.-
18:07cemerickninjudd: interested in a protocol design page in the nREPL project?
18:07gtrakTimMc, surely if you re-write the codebase in 1/10 the size they'll consider it?
18:08TimMcMaven 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:08TimMcgtrak: inorite
18:09TimMcgtrak: It shouldn't be too hard, since some of the execs used to work at Symbolics. :-)
18:09gtrakah great :-)
18:10TimMcWho I actually need to convince is the product lead.
18:10gtrakyea, we have a really conservative senior guy as well
18:10gtraki think i might sneak it in in testing
18:12TimMcHmmm. I see that stopping and starting the project is not enough to pick up changes to the clj files.
18:13TimMcAh, right -- I need to repackage the clj files by running mvn.
18:13gtrakclasspath resources
18:13TimMcyup
18:15jodarooh no
18:16jodarosomeone sent an xkcd link
18:16jodaronow i can't stop
18:16gtrakTimMc,
18:16gtrakhow do you like enlive?
18:16gtraki was using stringtemplate, but it seems like too much trouble
18:16gtrakjodaro, don't stop
18:16TimMcgtrak: It's pretty nice. Haven't gotten deeply into it, but it seems very flexible and reasonable.
18:16jodarohttp://xkcd.com/974/
18:18TimMcgtrak: 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:20gtrakTimMc, what's it do?
18:21gtraksome kind of table layout stuff based on clojure collections?
18:22TimMcgtrak: It generates the tables in http://www.brainonfire.net/files/seqs-and-colls/main.html
18:22gtrakah cool
18:22TimMcgtrak: If you go into src/seqs/html/ you'll see the table template and the template for the rest of the page.
18:23TimMcThe table is actually used as a snippet.
18:23gtrakI've been doing similar stuff with google's javascript api, i might release it in clojure
18:23gtrakhave you seen that one? for their charts?
18:23TimMcnope
18:24gtraki think i could knock it out pretty fast, they have a java api
18:25TimMclink?
18:25clojurebotyour link is dead
18:25TimMc"Schrödinger's link is dead."
18:26raekTimMc: nice.
18:26raek(seqs-and-colls)
18:26TimMc(and WTF is wrong with my unicode)
18:26TimMcraek: Please feel free to review -- I'm writing it to understand the material better myself.
18:27raeklooks like UTF-8 reinterpreted as Latin-1 and then recoded to UTF-8...
18:27TimMcNo doubt.
18:28tensorpuddingsomeone misspelled Schrödinger
18:28TimMcThat was me.
18:28ninjuddcemerick: yes, that sounds good
18:28TimMcI can't tell whether my terminal, my desktop computer, ssh, screen, irssi, or my home server is screwing it up.
18:28gtrakTimMc, http://code.google.com/apis/ajax/playground/#json_data_table
18:29raekTimMc: it could be mentioned that (empty? x) is just (not (seq x))
18:29TimMcYeah.
18:29TimMcThere are a lot of TODOs.
18:29gtrakTimMc, check out the charts
18:29ninjuddcemerick: here's the portal code in case you haven't looked at it yet https://github.com/flatland/portal
18:30ninjuddcemerick: i half finished a bash nREPL/portal client on the plane ride back
18:30gtrakTimMc, so I think I'll do that while I've got the library in my head, it has great possibilities
18:30TimMcgtrak: What do I do with that link?
18:31gtrakwell you can play around with the different chart examples on the left
18:31raekTimMc: http://blog.crazyfraggle.com/2009/09/irssi-charset-issues.html
18:31gtrakthey have a java library to generate the JSON used in the 'Edit Code" box
18:31ninjuddcemerick: would have taken way less time if i had been able to use google instead of the bash info page
18:32raekTimMc: 2. and 3. are the most important ones
18:34raekTimMc: 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:34raek(I think the data structures have their own classes that implement ISeq)
18:34mabesis it possible to bind a var to a class and then use that var as a type hint?
18:35mabesI can't get it to work...
18:35mabes,(let [my-type String string "foo" ] (.toUpperCase ^my-type string))
18:35clojurebot#<CompilerException java.lang.IllegalArgumentException: Unable to resolve classname: my-type, compiling:(NO_SOURCE_PATH:0)>
18:35raekmabes: no
18:35mabeshrmm.
18:35raekthe type hint is needed at compile time
18:35TimMcraek: PesistentList and LazySeq both use Cons cells though, right?
18:36amalloyTimMc: i think PL actually uses PL cells
18:36raekTimMc: 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:36TimMchmm
18:36gtrakcons implements ISeq but it's a different class
18:36mabesraek: 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:37raekwith cons I was refering to clojure.lang.Cons
18:37raekpersistent lists also use cons cells, but another kind
18:37amalloymabes: that is possible but you have to use a different syntax for it - ^foo is read-time metadata, whereas you want macroexpansion meta
18:38raekTimMc: 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:38TimMcAh!
18:38TimMc"Sequences are not implemented as lists, they just act a lot like them and are backed by similar data structures."
18:38TimMc*may be backed
18:38amalloy(defmacro hinted-length [s] `(.length ~(with-meta s {:tag `String})))
18:39raekwell, a list is also a seq...
18:39Guest68238I 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:39TimMcA list *is* a seq?
18:39TimMcHmm, that's right.
18:39mabesamalloy: thanks for the example, I'll see if I can get this to work :)
18:39gtrakboth PList and Cons extend ASeq
18:40amalloyGuest68238: don't write a macro, write a function
18:40TimMcraek: Mainly I'm trying to figure out the ontology here.
18:40duck1123Guest68238: try to avoid using "map" as a variable name. It'll bite you
18:40gfredericksamalloy: I think he asked how :)
18:40amalloyoh. i missed that
18:40Guest68238duck1123: Ah, of course. Sorry, my actual problem is different. I was trying to make a simple example instead.
18:40gfredericksI probably would have missed it too if I was trying to answer it
18:40amalloyGuest68238: it's not clear what m and map are supposed to be in your example though
18:41TimMcraek: Would you say that seqs are a special type of coll?
18:42raekhrm
18:42Guest68238amalloy: 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:42amalloyTimMc: yes
18:42raekI usually think of the collections as one group of things and the seqs as another
18:42raekthey intersect at PersistentList, though
18:42arosequistamalloy: Sorry, didn't realize I was guest. Changed my name.
18:42TimMcand LazySeq
18:42duck1123(map #(% m) [:a :b :c])
18:43TimMc,((juxt coll? seq?) (range))
18:43raekall the collections have at least one seq implementation
18:43clojurebot[true true]
18:43amalloyarosequist: 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:43raek(vector has two: (seq v) and (rseq v))
18:43raeka list is its own seq
18:43arosequistamalloy: 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:44raekyou can think of a seq as an immutable variant of an iterator
18:44gfredericks(defmacro def-named-args-fn ...)
18:44amalloyarosequist: i think your easiest route is to have the macro just expand to a function with :keys destructuring
18:45raekhrm, so what exactly is a collection? something you can call conj and seq on?
18:45gfredericks(defmacro def-named-args-fn [name arg-names & body] `(defn ~name [{:keys [~@arg-names]}] ~@body))
18:45gfredericksarosequist: ^ that there might even work
18:45arosequistamalloy: This might be a dumb question, but can that destructuring be done in the args list of fn itself?
18:45amalloyyes
18:46TimMcraek: coll? defines it as IPersistentCollection :-)
18:46amalloygfredericks: feh. don't complect creating a function with def'ing it. macros that def are on the yucky side
18:46arosequistgfredericks: Wow, that looks like exactly what I wanted to do, except I just want fn (not defn).
18:46amalloy(defmacro map-fn [keyvec & body] `(fn [{:keys ~keyvec :as ~'m}] ~@body))
18:46arosequistgfredericks: But that's easy to chang,e of course
18:47raekTimMc: also, don't forget the obscure PersistentQueue... :P
18:47arosequistamalloy: gfredericks: Thanks a ton. I spent way too long on this earlier.
18:47gfredericksamalloy: you're a wiser man than I.
18:47TimMcraek: Ooh, that's right -- I should raid the clojure.core repo for mentions of "IPersistentCollection", etc.
18:48amalloygfredericks: it's easy to sound that way by repeating words rich has made up
18:48gfredericksamalloy: I thought you sounded that way _despite_ parroting rich :)
18:48raek,(let [q (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)] ((juxt #(conj % 0) pop peek seq) q))
18:48clojurebot[#<PersistentQueue clojure.lang.PersistentQueue@e41ad39e> #<PersistentQueue clojure.lang.PersistentQueue@8d94bf51> 1 (1 2 3)]
18:51gfredericks"Macros that Def" would be a good name for something...
18:53gtrakan overtone band name
18:53duck1123there are valid cases for macros that def though
18:54duck1123some of my favorite macros also def
18:54raekindeed. but if there is no non-def'ing variant things get hard to compose.
18:55amalloyabsolutely. i'm a big fan of defn and defmacro. but i'm glad fn and macrolet are around too
18:56duck1123well, 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:56amalloys/need/ability?
18:56gfredericksduck1123: I think you just said "if you use them right, then you won't be using them wrong."
18:56duck1123that's a good rule
19:15gfredericksthe object returned from clojure.core/bean is rather dangerous I think :/
19:20gfredericksI take it back.
19:20alexbaranoskyI've got to say, ClojureBot's pretty cool
19:21alexbaranoskywho created it?
19:21cemerickhiredman: you're being paged in #leiningen :-)
19:21technomancyalexbaranosky: I convinced hiredman to write it
19:27BahmanHi all!
19:27alexbaranoskyBahman: hi
19:41BahmanI 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:42alexbaranoskyBahman: 70% of Clojurians use Emacs
19:42tensorpuddingemacs won't help you autocomplete java classes while writing clojure code
19:42tensorpuddingit's possible to get it while writing Java if that's your thing
19:42tensorpuddingthough the java experience in emacs is probably much less pleasant than eclipse
19:43Bahmantensorpudding: No. I meant auto-complete when using Java classes inside Clojure code.
19:43duck1123It'll autocomplete on classes, but ususally only if it's already seen it
19:43BahmanYes...for Java I use Eclipse.
19:43ihodesBahman: 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:43tensorpuddingthen what i said at first applies
19:43BahmanAlright...I'll go with Emacs. Thanks folks.
19:44BahmanI hope Clojure works with Slime.
19:44tensorpuddingemacs will give you "documentation" of a kind
19:44tensorpuddingwith clojure
19:44TimMcBahman: There's something similar to slime.
19:44tensorpuddingslime works for clojure if you use swank-clojure
19:45tensorpuddingthe fact that errors lead to java stacktraces are a fly in the debugging ointment
19:45cgrayEek, a mouse!
19:45tensorpuddingbut otherwise slime is pretty much the same as it is in CL
19:46BahmanWould you please pass me a link on howto setup Emacs (with Slime?) for Clojure?
19:46cgraysorry, had to share :)
19:46alexbaranoskyBahman: I was pointed to this emacs code for setting my emacs up: https://github.com/samaaron/dot-emacs
19:47technomancyBahman: 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:47TimMccgray: Actual mouse?
19:48cgrayTimMc: yep. very small.
19:48BahmanThanks folks.
19:48bhenryBahman: 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:49TimMccgray: Yay! Also, stop leaving food out.
19:49cgrayTimMc: I know :(
19:49tensorpuddingmy advice is install emacs, the emacs-starter-kit, lein and swank-clojure
19:49TimMcThey may be free pets, but they're impossible to litter-train.
19:49Bahmanbhenry: I have Forth and Common Lisp setup in .emacs and .emacs.d ... can't use such solution.
19:50cgrayTimMc: It's also getting cold here, so they're more likely to come inside to avoid freezing to death
19:50TimMcBahman: Since you already have a working Emacs, just get clojure-mode etc.
19:50tensorpuddingoh, you already have emacs configured
19:50tensorpuddingget clojure-mode from marmalade
19:50alexbaranoskyso 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:50TimMcBahman: Emacs 23, 24, or what?
19:51Bahman23.3
19:51Bahmanalexbaranosky: That's a good approach!
19:52TimMcYou might also poke around the emacs-starter-kit to pilfer from that.
19:53TimMcIt has various clojure-related goodies.
19:53tensorpuddingif you really like it you can fork it and alter it to your needs
19:54goodieboyanyone know how to create a custom 404 response in noir?
19:58amalloy{:status 404 :body {...}}
20:00Raynesamalloy, goodieboy: https://github.com/ibdknox/noir/blob/master/src/noir/response.clj#L32
20:01goodieboyoh sorry...
20:01goodieboyI mean override the default/built-in one?
20:01goodieboythere is one for 404 and 500
20:02goodieboyI think I found it actually? https://github.com/ibdknox/noir/blob/master/src/noir/statuses.clj#L15
20:02Raynesgoodieboy: Looks like it, yes. Good eye.
20:03goodieboyCool, I'll give that a try!
20:07tolstoyAnd specifically: http://webnoir.org/autodoc/1.2.1/noir.statuses-api.html
20:07tolstoyEr, documentationally.
20:23TimMcOK, does this come across as o-with-umlaut? ö
20:25BahmanThe latest swank-clojure is 1.3.3, right?
20:26brehautTimMc: yes, but then it was followed by [incompatible encoding]; that could just be colloquay though
20:26amalloyTimMc: my client renders it as a question mark, and it usually gets unicode right
20:29BahmanThe latest Clojure is 1.3...is it possible to tell Leiningen to use that instead of 1.2?
20:30tolstoyTimMc: Worked for me. Textual/MacOSX
20:30technomancyBahman: you can change the version in your project's project.clj file
20:31technomancyyou can't change the version leiningen itself uses though
20:31tensorpuddingunless you build lein by hand
20:31Bahmantechnomancy: 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:32technomancyBahman: no, if you specify a different version in your project then it will take priority over swank's version
20:32technomancyas long as you're working inside a project
20:32BahmanI got it...thanks.
20:35technomancyBahman: "lein help tutorial" covers a lot of this stuff if you get confused.
20:35BahmanExcellent!
20:37moogatronictechnomancy: 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:37moogatronicprops.
20:37bhenrywhat are the contrasts between refs and atoms (specifically in clojurescript if that makes a difference)
20:37alexbaranoskymoogatronic: me too
20:40scottjbhenry: cljs doesn't have refs
20:40bhenryperfect. that makes the decision totally easy
20:40TimMcamalloy: Thanks, that's good to know. Everyone else's system is probably fixing it up at render-time.
20:41technomancymoogatronic: it's great. the #leiningen channel has seen more activity in this one day than the entire past year.
20:43amalloyhah, 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:44BahmanI 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:46technomancyBahman: probably an old version of clojure-mode; you want 1.11.4
20:47Bahmantechnomancy: That's right...it's 1.7.1
20:47technomancyBahman: maybe you have an old package.el that's hard-coded to only load from tromey.com?
20:48Bahmantechnomancy: I think that's the case. I installed the one on marmalade website.
20:50technomancyBahman: 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:50technomancyit 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:51Bahmaneval-buffer: Symbol's value as variable is void: package-archives
20:51BahmanI guess I better install it by hand.
20:52technomancyyeah, that's due to an old version of package.el
20:56Bahmantechnomancy: Should I uninstall package.el or let it be?
20:56technomancyBahman: 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:57BahmanWill give upgrading a try. I hope it works.
20:58gfredericksMan 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:58alexbaranoskygfredericks: are you looking at a webpage you could link to?
20:59technomancylein help tutorial # should cover most of it
20:59alexbaranoskythx
20:59technomancylein help sample # should get you the rest
20:59technomancybut it's a lot to wade through
21:00gfredericksalexbaranosky: I was reading `lein help tutorial` since technomancy mentioned it earlier
21:01alexbaranoskytechnomancy: 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:02technomancyalexbaranosky: I certainly hope not. I would be terrified if anyone's actual project'clj file were that large. =)
21:02alexbaranoskyI'm going to update Midje's project file to mention its mailing list, for example :)
21:02technomancythe mailing list actually makes it all the way into the pom
21:03amalloytechnomancy: lancepantz showed me a project.clj that was about that big. some kind of horrible monstrosity but i forget what
21:03technomancyeep
21:07Bahmantechnomancy: I upgraded package.el and it seems to be working. How can I tell the version of Clojure from within REPL?
21:07technomancy,*clojure-version*
21:07clojurebot{:major 1, :minor 3, :incremental 0, :qualifier nil}
21:07technomancyBahman: ^ do that (without the comma)
21:08BahmanExcellent. Working like a charm. Thank you technomancy for your help and your great software :-)
21:08technomancyglad it's working for you =)
21:09technomancycan't wait for emacs 24 to be released; there's too much confusion with package.el
21:10BahmanYes..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:13gfrederickstechnomancy: the best thing about clojurebot's comma is that you don't have to conciously omit it at the repl
21:13BahmanSomething 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:14BahmanWhat am I doing wrong?
21:14BahmanI connect with slime-connect and the same thing happens.
21:18BahmanThis is the error log I suppose: error in process filter: Wrong type argument: listp, 0
21:18BahmanLisp connection closed unexpectedly: connection broken by remote peer
21:19BahmanPerhaps it's something with slime contribs I have loaded...checking...
21:26scottjBahman: make sure you have a slime version compatible with swank-clojure
21:27Bahmanscottj: It's something with slime contribs...I'm trying to figure it out but if I disable all of them, clojure works fine.
21:27scottjI use slime-fancy but ymmv
21:29bhenryany ideas on how to shuffle in clojurescript?
21:30bhenryor at least get me to the point of Math.random()?
21:30bhenryi don't know how to require that or make it work in cljs
21:32Bahmanscottj: slime-fancy doesn't work..trying to activate one by one and see which ones cause failure.
21:35bhenrysweet found it. rand is still in. duh.
21:40amalloybhenry: ACTUALLY you might want to borrow a lazy-shuffle from me
21:40bhenryi might, but i'm dealing with 6 items in an array and all of them will be consumed.
21:40amalloyspecifically, 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:40bhenrybut that could come up in the future.
21:41bhenrywait that will work in clojurescript?
21:42amalloyoh, i guess cljs doesn't have transients, right?
21:42bhenrydoubtful if they don't even have shuffle : P
21:42amalloywell, you can use pop/assoc instead, and drop the transient/persistent
21:42amalloyit all still works; transient was for perf
21:43Bahmanscottj: Would you please send me your .emacs file?
21:43bhenryamalloy: i just did this for my smalltime case https://gist.github.com/b81c1b337e10b6712a13
21:44amalloywhoa. that is like 0% to work right, isn't it?
21:44bhenry?
21:44amalloy&((fn shuffle [seq] (map #(nth seq (rand-int (count seq))) seq)) (range 5))
21:44lazybotclojure.lang.ArityException: Wrong number of args (1) passed to: sandbox11775$eval13910$shuffle--13911$fn
21:45bhenrythe output looked good to me
21:45amalloybhenry: if so it was unrelated to your input. there is no way this function does what you want
21:46amalloymap calls its function with one arg, and your #(...) accepts zero args only; that's one problem
21:46bhenryah, well in javascript that doesn't matter.
21:46bhenryi can fix that though.
21:46amalloythe other is that you can wind up getting (say) 0 every time you call rand-int
21:46scottjBahman: https://github.com/scottjad/dotfiles/blob/master/.emacs I use slime from oct 15 2009
21:47amalloyso that (shuffle (range 5)) returns (0 0 0 0 0)
21:47Bahmanscottj: Thanks.
21:47bhenryooh. good point. for my case, i want to put the tiles back in the bag so repeats are okay
21:47amalloy&((fn shuffle [seq] (map (fn [_] (nth seq (rand-int (count seq)))) seq)) (range 5))
21:47lazybot⇒ (4 0 0 2 3)
21:48amalloybhenry: that's fine, but don't call it shuffle :P
21:48bhenryyeah
21:48amalloyyou're just implementing rand-nth
21:48Bahmanscottj: Oh...mine is CVS version 11-09-28 :-D
21:48bhenryyou're right.
21:48scottjBahman: duh you can't use new slime!
21:48alexbaranoskyamalloy: 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:48amalloyalexbaranosky: yeah, none of us have any idea how to write tests for a clojure website
21:49amalloy(or how to use midje)
21:49alexbaranoskyhave you seen the RObozzle video?
21:49Bahmanscottj: How "new"?
21:49scottjBahman: last two years :)
21:49BahmanDoh!
21:50alexbaranoskyamalloy: this video shows how to use Midje: http://vimeo.com/19404746
21:50scottjBahman: swank-clojure docs mention one date that's supported, I've had best luck with the date I mentioned earlier
21:50alexbaranoskyI wonder if you could write checkers for checking rendered HTML
21:51BahmanThanks scottj.
21:51alexbaranoskyamalloy: 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:53xeqiamalloy: for integration level tests check out clj-webdriver
21:53alexbaranoskyxeqi: browser tests right?
21:53xeqiyeah
21:57alexbaranoskyamalloy: you there?
21:57amalloyalexbaranosky: yeah, waiting on your <let me type something up>
22:00alexbaranoskyamalloy: 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:00alexbaranoskyamalloy: 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:00alexbaranoskyamalloy: <I gave up on the example>
22:01amalloyugh. 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:01alexbaranoskyWhen 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:02alexbaranoskyso don't use selenium
22:02alexbaranoskyI hate them too :)
22:02amalloy*chuckle*
22:02alexbaranoskythey're a pain in the rear
22:02alexbaranoskyand fail for no reason sometimes, because of timeouts and timing errors with JS/AJAX etc
22:02amalloyi 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:04alexbaranoskyso stubbing DB *could* be simple with Midje, assuming the points of interaction with the DB are few
22:04alexbaranoskysay you have a function (get-user-details ....) or whatever that secretly goes to the DB to get those details
22:05amalloyright
22:05alexbaranoskyamalloy: then its a one line stub
22:05spoon16anyone else having problems with maven/lein retrieving org.apache.maven:super-pom:jar:2.0?
22:06alexbaranoskywhere the test/fact is basically saying: when I do Foo, given the DB gives me Bar, then I get Baz back
22:06spoon16https://gist.github.com/1366004
22:06alexbaranoskyamalloy: if you watch the Robozzle video I'd love to hear what you think of it
22:07amalloyalexbaranosky: i'll check it out when i get home
22:09alexbaranoskyamalloy: I'm opening up 4Clojure on my machine now, I'll let you know if I get any relevant ideas
22:29BahmanThanks scottj, I got it working with that version.
22:30alexbaranoskyamalloy: how have you all liked using Mongo with Clojure? I'm excited at the ease of use of the Combo
22:30amalloyit's fantastically simple. i haven't really used anything else (eg jdbc) to compare with, though
22:31PPaulhow hard is it to get clojurescript running?
22:31amalloys/simple/easy, i guess, is more what i meant. i haven't evaluated whether it's simple :P
22:31alexbaranoskyamalloy: Korma looks nice, but its still dealing with a more foreign way to represent data than Clojure uses
22:32alexbaranoskyI've used Mongo at work for a smallish project, and I'm still weighing whether it is simple or easy as well
22:32scottjPPaul: not hard if you use cljs-watch
22:32PPaulcan i use lien?
22:33scottjnot really, I think there is a clojurescript artifact on clojars but it might be very outdated
22:34PPauli had a hard time with clojure until i started using lien
22:34scottjI guess there are newer artifacts; don't recall exactly how to use them
22:35scottjmaybe look at lein-clojurescript
22:35scottjremember cljs is alpha though and getting it setup will probably be the easiest part of doing something useful with it :)
22:37alexbaranoskyamalloy: I like this (letfn .... def... def) idiom I see, though I ponder about using macro-do in cases like that
22:37PPaulouch
22:37PPauli was hoping that i could use it with backbone and jquery
22:37PPaulmanipulating js objects/arrays is a pain
22:38alexbaranoskyPPAul: there are folks using it with JQuery
22:38amalloyalexbaranosky: 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:38PPaulintern?
22:38alexbaranoskyamalloy: I think I agree, but I have a new toy, and everything looks like it might work with macro-do now :-\
22:39amalloy&(doc intern)
22:39lazybotjava.lang.SecurityException: You tripped the alarm! intern is bad!
22:39amalloy,(doc intern)
22:39clojurebot"([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:39alexbaranoskyis this too complicated?: (macro-do [[name host]]
22:39alexbaranosky `(def ~name (get-in config [:hosts host]))
22:39alexbaranosky [static-host :static]
22:39alexbaranosky [dynamic-host :dynamic]
22:39alexbaranosky [redirect-hosts :redirects])
22:40alexbaranoskyamalloy: 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:40amalloyalexbaranosky: probably it is, because you got it wrong in your paste :)
22:40alexbaranoskyamalloy: well, no tests to run it against
22:40amalloytouche
22:40alexbaranoskysomething funky with the ~name bit?
22:40amalloy(you missed the ~ in ~host)
22:41alexbaranoskyahhhh oops
22:41alexbaranoskyI can have 4Clojure covered in 400 tests asap ;)
22:41amalloysounds like a plan! i'm headed home now though
22:42alexbaranoskyadios
22:46alexbaranoskyanyone 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:54alexbaranoskytechnomancy: hey thanks for fixing lein int's exception bug - helps me out a lot
23:04amalloyalexbaranosky: some reason not to just do it with git? having github do it might be possible but seems silly
23:04alexbaranoskylazy
23:09alexbaranoskyamalloy: thanks for kicking me in the lazy butt, just did it by hand
23:13biallymHey! how would I access class.STATIC_CONST
23:13biallymnamely I have a class and I can't seem to be able to get clojure to like the static variables declared in it
23:14biallymI have tried Class/STATIC and Class.Static
23:20bhenrybiallym: did you try (.STATIC_CONST class)
23:23scottjis 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:23biallymthat worked... which means the static must not live where I thought it did >.>
23:25joeblow2006Hi, can I ask syntax related questions here?
23:25scottjjoeblow2006: yes
23:26joeblow2006Ok. I'm working on a simple Clojure program right now. I'm trying to work out the following function:
23:26joeblow2006(defn fun3 [[x y z t]] (if (= x y z) (vector x y z t) (iterate fun2 [x y z t])))
23:27joeblow2006If I do something like (fun3 [10 10 10 1])) where the 1st 3 values are equal, the function returns the vector.
23:27joeblow2006What I want to happen is to check for x=y=z each time fun2 returns.
23:28joeblow2006instead of checkin only initially as it does now.
23:28joeblow2006I'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:29brehaut(defn fun3 [[a b c :as s]] (when (= a b c) s))
23:29joeblow2006I think I need to destructure the vector in order to test the components, but I can't seem to figure out that part.
23:29joeblow2006OK, let me try that.
23:30brehautor (defn fun3 [s] (when (apply = (take 3 s)) s))
23:30bhenrybrehaut, i think he wants fun2 to be in there when the first three aren't equal
23:30brehautbhenry: ah, my bad
23:30joeblow2006Exactly. It needs to check for equality and evaluate fun2 if it is not.
23:31brehautthen switch the when for an if ?
23:32joeblow2006Isn'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:33joeblow2006I can't replace the when with an if because I have no place to put the v
23:40joeblow2006Oh I see. (when (= a b c) s)) returns s. My problem is different.
23:40joeblow2006I 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:41joeblow2006And then try to manipulate fun4: (defn fun4 [[x y z t]] (take-while #(not= %1 %2 %3) (fun3 [x y z t])))
23:43joeblow2006Scratch that...
23:43joeblow2006(defn fun4 [[x y z t]] (take-while #(not= %1 %2 %3) (iterate fun2 [x y z t])))
23:44amalloyscottj: someone has a lein 4clojure plugin, which does a fair chunk of that
23:44scottjamalloy: cool I'll check it out
23:45joeblow2006The %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:49amalloyjoeblow2006: simplest replacement function is (partial apply not=)