#clojure logs

2010-09-02

00:03sleepynateugh.. classpaths. anyone use vimclojure? i'm trying to get the AOT compile of the pretty print thing in clojure-contrib
00:17technomancysleepynate: if you can at all avoid it, don't compile contrib yourself
00:17sleepynatetechnomancy: you're telling me :D
00:17sleepynatei always forget exactly how i get it working
00:17sleepynatethen i need to set it up again
00:17technomancywhy do you need to set it up?
00:18sleepynatehttp://kotka.de/projects/clojure/vimclojure.html <---
00:18sleepynatebut for now i just pipe it to a jline repl in tmux
00:18technomancysleepynate: do you know about http://build.clojure.org/releases ?
00:19sleepynatetechnomancy: i don't.. but that doesn't have this pretty printer mod, does it?
00:19technomancyoh, you're trying to add your own modifications to contrib
00:19technomancygotcha; that is one of the few legitimate reasons to build it yourself
00:20technomancymost people complaining about contrib build issues have no good reason to be trying in the first place.
00:20sleepynate Could not locate clojure/contrib/pprint__init.class or clojure/contrib/pprint.clj on classpath:
00:20sleepynatethis is the actual one i'm getting
00:20sleepynateand i know i've fixed it before :)
00:21sleepynateahh well.. i'll stick with my tmux pipe for now
00:21sleepynatejust nice to get slime-like functionality in a *cough*decent*cough* editor
00:21technomancytmux pwns
00:23sleepynateya
00:24sleepynatetechnomancy: well, if you use vim, check out tslime :)
00:24sleepynateit ferries stuff back and forth to tmux
00:24sleepynateit's just not form/s-expression aware
00:26technomancythanks but no thanks.
00:42BahmanHi all!
01:02replacasleepynate: what are your plans for pprint, out of curiousity
01:02replaca?
01:05sleepynatereplaca: none specifically, just vimclojure wants the one from contrib compiled
01:06replacasleepynate: ahh, that's probably cause vimclojure is using an old version of contrib
01:06replacasleepynate: pprint used to require compilation in 1.1
01:06sleepynateoh poop
01:07sleepynatei'm using 1.2 snap
01:07replacaso maybe you just want to grab a 1.1 contrib for vimclojure
01:07sleepynategit pull didn't yield anything new
01:07sleepynatefair enough
01:07replacain what sense? There were a bunch of changes.
01:08sleepynatereplaca: no no, no changes since i last compiled :D
01:08replacabut in 1.2, they should really be using clojure.pprint which is the new version
01:08sleepynatesure
01:08replacanot too many changes from c.c.pprint, though
01:09sleepynatemaybe later i'll look at the build script
01:09sleepynatefix it for him :D
01:10sleepynatebut that makes sense why i could before but not now
01:10replacacool. good luck!
01:11sleepynateheh. thanks? :)
01:12sleepynatehmm, what's the clojure equiv of "all" in haskell
01:12sleepynatetrue if all in collection meet conditions of predicate
01:13tomojevery?
01:13clojureboteverybody looks good in a sheinhardt
01:13sleepynate(all? (zero? %) (0 0 0 0 0 0 0 0 0 ))
01:13tomoj,(every? zero? [0 0 0])
01:13clojurebottrue
01:13sleepynatetomoj: thanks
01:13sleepynatetomoj: i knew it was something not far off :D
01:19rdeshpandehi all
01:23rubydiamondtechnomancy: hey
01:23rubydiamondwhat mode do you use for rhtml ?
01:23rubydiamondrdeshpande: hey
01:24rubydiamondwhich city ?
02:56LauJensenGood morning all
02:59RaynesMorning.
03:03LauJensenRaynes: What are you working on these days?
03:22RaynesLauJensen: Mostly sexpbot lately. That and Irclj.
03:22LauJensenAlright
03:22RaynesI have a little toy web development project that I've been neglecting, but plan to get back to soon.
03:23LauJensenWhats it about?
03:23RaynesPastebin-like thingy.
03:24RaynesIt's mostly a learning thing.
03:24LauJensenAh so you're doing some syntax highlighting? :)
03:24RaynesTry-clojure isn't really something I can cut my teeth on. I want to make it better, but I need experience for that.
03:25LauJensenPretty hefty project for your first web app
03:25RaynesActually, I've been considering that. I planned on highlighting with syntaxhighlighter, at least at first.
03:25LauJensenBut it turned out okay
03:25RaynesThanks to you.
03:25Raynes:p
03:25LauJensenha
04:21javeI have a little compojure project, that starts a jetty server in the background. when I reload the ns, the jetty is still running so it cant get the port and I get errors
04:22javeis there some idiomatic way of handling this? I thought maybe using a global singleton
04:22bobo_jave: defonce instead of def i think solves that.
04:22javeah
04:22bobo_on the jetty calling method
04:24Raynesjave: Yeah, defonce, or just put the code to run the jetty server in another ns.
04:24LauJensenusually it makes sense to have core/main start the server, and server/start-server to actually boot it
04:25javehmm ok
04:25javesomething like this should work at leas then? (defonce dummyserver (future (run-jetty (var unibet-dispatch-routes) {:port 9090})))
04:28Raynes-> (letfn [(U [f] (f f))] ((U (fn [f] (fn [n] (if (= 0 n) 1 (* n ((f f) (- n 1))))))) 5))
04:28sexpbot=> 120
04:28Raynes_fogus_: ^ Lovely monstrosity you got htere.
04:28Raynesthere*
04:28esjyou can also use atoms: http://github.com/swannodette/enlive-tutorial/blob/master/src/tutorial/template1.clj
04:28RaynesMakes me want a roast beef sandwich.
04:32esjRaynes: where on earth did you excavate that ?
04:32Raynesesj: Twitter. It's fogus'
04:32esjyou been messing with necromancy again ?
04:32esjoh, then its correct ;)
04:34esjalthough his partner is crime did try to destroy the universe yesterday...
04:41raekjave: don't forget to specify the handler function as "#'handler" and not "handler"
04:42raekthe latter takes the value that the #'handler var had at that time, and remembers that
04:42raekthe former lets the server remember the var itself
04:43LauJensenie. so you can redefine it at runtime
04:43raek(vars when used as functions do a deref on themselves and call that)
04:44jave(defonce dummyserver (future (run-jetty (var #'unibet-dispatch-routes) {:port 9090}))) ?
04:45javehmm or not even the (var .. )
04:45raekexactly.
04:45raekoh
04:45raek#'foo = (var foo)
04:46raek,(var (var inc))
04:46clojurebotjava.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Symbol
05:00javewhats the idiomatic way of writing a config file? a java properties file? a separate ~/app.clj file outside the uberjar?
05:01RaynesI usually do something similar to the latter. Most of my configuration is just a map in a file that I read-string in the application.
05:01kumarshantanujave: perhaps an external appconfig.clj and do an eval to get the properties?
05:01LauJensenjave: That comes up a lot, and it usually comes down to whatever makes the most sense for your ready
05:01bobo_i think lein does it nice?
05:01LauJensens/ready/reader/
05:01sexpbotjave: That comes up a lot, and it usually comes down to whatever makes the most sense for your reader
05:02LauJensenRaynes: That function should append the (name) of the one who said it for quicker reads
05:03RaynesLauJensen: Like <LauJensen> message here?
05:03RaynesThat makes sense.
05:03LauJensenyea
05:03RaynesGood idea.
05:04fliebeldo you guys keep logs of this channel somewhere?
05:04LauJensenThanks
05:04Raynesfliebel: Yessir.
05:04LauJensenclojure-log.n01se.net
05:04LauJensenclojurebot: where are the logs?
05:04clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
05:04LauJensenclojurebot: where is the log?
05:04clojurebotreverse psychology is even less rigorous than forward psychology
05:05LauJensenclojurebot: the log is at http://clojure-log.n01se.net
05:05clojurebotAlles klar
05:05LauJensenclojurebot: where is the log?
05:05clojurebotlogs is http://clojure-log.n01se.net/
05:05LauJensengood boy
05:06RaynesI really need to set up my bouncer. ._.
05:07Raynes$learn clojure-logs clojure-log.n01se.net
05:07sexpbotMy memory is more powerful than M-x butterfly. I wont forget it.
05:26kumarshantanurql looks interesting -- http://github.com/MrHus/rql
05:32ChousukeI don't like the bang functions.
05:32Chousukethey seem to be doing nothing more than (alter theref non-bang-fn args)
05:32Chousuke(in a dosync)
05:41LauJensenChousuke: which bang fns are you refering to ?
05:42Chousukethe ones in the rql library
05:42LauJensenoh ok- I thought you wanted swap! reset! etc to be removed :)
05:43Chousukeheh, nah. those have no trivial replacement :P
05:43ChousukeI just think hiding alters and especially dosyncs in trivial functions is unidiomatic in Clojure :P
05:43LauJensenno, but Im sure Rich would remove them right away if you werent comfortable with them :)
05:44Chousukeyes, I'm sure :P
05:48raekbangs for functions that are safe to use in transactions?
05:51Chousukeyeah, that too :P
05:51LauJensenHas anybody had this issue with Miglayout? http://migcalendar.com/miglayout/cheatsheet.html states that "gab 5px" is a valid component contraint, yet adding it to a single components gives me a Illegal Constraint: 'gab 5px' Unknown keyword called from 0: net.miginfocom.layout.ConstraintParser.parseComponentConstraint(Unknown Source)
05:51LauJensen
05:52Chousukegab? not gap?
05:52tomojseems a bit weird that the bang fns are called "persistent variants"
05:54LauJensenChousuke: Its a pleasure to have you on board, thanks for catching my typo :p
05:54ChousukeLauJensen: you need more coffee :P
05:54LauJensenHaha!
05:54LauJensencruel...
05:55fliebelLauJensen: Coffee diet?
05:55LauJensenhttp://bestinclass.dk/index.clj/2010/08/developer-productivity--the-red-pill.html
05:55LauJensen(for odd reasons, my most popular blogpost yet)
05:56LauJensenEven beating my Tribute to Steve Ballmer I think :)
05:56fliebel(not so odd at all…)
05:56LauJensenWell, I wrote it because I had promised to do so, I was feeling more inspired to blog about Clojure, so it felt like 'work' doing it, where many of the others have been pure fun
05:57raekClojure is all about pure fn for me ;)
05:59fliebelLauJensen: You read those articles about digg mafia and vote rings? It's all about getting the first 5 votes fast, which happened to you by accident by the kind people of #clojure. I'm sure that if you manage to get some other posts on the frontpage of HN, they'll be just as popular.
06:00LauJensenfliebel: Naah I haven't heard about them
06:00LauJensenBut yea, it was definitely lifted by #clojure
06:01fliebelraek: defnitely!
06:09javeload-file doesnt seem to be very good in a program, why is that?
06:09javeI wanted to load and eval a config file
06:13Raynes(doc load-file)
06:13clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
06:13RaynesIt seems to do the trick.
06:14LauJensenAs long as a hacker cant get to the config file, otherwise you're in a lot of trouble
06:15RaynesLauJensen: Couldn't a hacker just as easily modify the code of the Clojure application itself, assuming it isn't AOT compiled?
06:16LauJensen'assume'
06:17RaynesPeople rarely AOT compile their code. At least, I thought.
06:17RaynesIf you say 'thought', I'll come to Denmark and hunt you down.
06:17LauJensen'hunt'
06:17Raynes:-)
06:17LauJensenOn some projects, its not an option to deploy with the source
06:18RaynesFair enough.
06:18esjand some java interop requires AOT
06:18RaynesIt still isn't that common.
06:18esjyeh - izza pain in the bum
06:19RaynesMost of what I've seen AOT used for in open source projects is for a main class for executable jars.
06:19RaynesThere is a ticket to add a parameter to clojure.main to do something similar without AOT.
06:20RaynesI was hoping it would get into 1.2.
06:20LauJensenRaynes: You can do it yourself with Cake
06:21RaynesI'm not surprised.
06:21RaynesCake is pretty impressive.
06:22LauJensenYes Im thorougly impressed by it myself
06:22LauJensenAnd I dont even think I can spell that
06:22Raynesthroughly?
06:23LauJensenyea
06:23esji missed cake - that looks truly nice
06:23RaynesI've been using it for a while.
06:23LauJensenesj: The way it handles task dependencies is übercool
06:23RaynesI was actually supposed to work on lowering memory usage in that thing a bit tonight. I forgot about it. ._.
06:23LauJensenSo you can extend 'compile', 'uberjar' etc
06:23LauJensenRaynes: Just buy more RAM
06:24esjthat's really nice.
06:24RaynesLauJensen: RAM is costly on VPSs.
06:24esjI'm currently committed to learning Maven properly. One build tool at a time :)
06:24RaynesThey're going to switch to Ivy in cake soon.
06:25LauJensenesj: After that you should really learn QBasic as well, that another outdated technology
06:25LauJensenAnd then maybe... maybe try Pascal, the DOS version
06:25LauJensenThats awesome too
06:25esjLauJensen: this is a fair point
06:25RaynesLauJensen: What about FORTRAN?
06:25LauJensenTrue, you cant learn Maven and not Fortran
06:25bobo_except, maven isnt awesome
06:26esjmaven is nice because it has an ecosystem
06:26bobo_indeed
06:26esjso i can get a lot done with it chop-chop
06:26LauJensenesj: like a sweathy shoe after a good work-out, it also has a little ecosystem :)
06:26esjyummmmmmmm
06:30noidithere must be something wrong with me, but I actually quite like maven :)
06:31noidiI bit the bullet and tried it after reading this article, and after the steep learning curve it's been just fine http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer
06:31esjnoidi: yup, me too.
06:32LauJensenHmm. nice, so you actually get over the 10k lines of XML ?
06:32noidihehe, it's not that bad with nxml-mode :)
06:32bobo_my question is just why?
06:32bobo_leinigen is so easy, so much less text
06:33bobo_one good thing with maven is, that you can open the project in netbeans/eclipse/idea, but thats about it
06:33LauJensenbobo_: Dont compare with lein, compare with cake
06:34fliebelcake?
06:34clojurebotcheesecake is delicious.
06:34LauJensenI would say Maven would have been my choice for a cross platform build if Cake wasn't around
06:34bobo_oh, cake can cross platform?
06:34LauJensenfliebel: http://github.com/ninjudd/cake
06:34LauJensenbobo_: yea, amazingly simple
06:34bobo_i need to stop working, so i have time for everything
06:34esjcurrently I use it because it plays nicely with my CI, repositories etc
06:34LauJensenAnd I have one customer, who requires the build to run on a Windows server, so cake saved me from the XML
06:34LauJensenhttp://github.com/ninjudd/cake/wiki/Cake-on-Windows
06:35noidiwell, maven has plugins for pretty much everything
06:35LauJensennoidi: cake lets me do tasks in clojure, so I dont need your plugins
06:35esj(by repositories, I mean a local binary artifact repo)
06:36LauJensenesj: cake is no different, you can also install local artifacts
06:36noidimaven vs make-like systems (where you write your own tasks) is like word vs latex
06:36LauJensenwith a single command, and you dont need to spend 5 minutes writing up the xml documentation afterwards
06:36LauJensennoidi: please dont bring MS products into this
06:37esjLauJensen: I phrased that poorly, twice. Up late last night. I'm trying to say, Nexus.
06:37LauJensenAnyway, if you guys like your XML and you can actually find people who are happy to see you sit there and write out <start></stop> tags all day, Im happy for you, but if you get fed up, try Cake :)
06:38fliebelLauJensen: So Cake is like Nailgun for Leiningen? (they should add that to the thisisforthat site)
06:38esjLauJensen: I absolutely will, of course. But Maven does currently scratch my itches.
06:38LauJensenfliebel: thats part of it
06:39LauJensenAnother big part is the gem based install, another is their unique way to handle tasks and dependencies
06:39noidiI pretty much only modify my pom.xml manually when adding a new dependency
06:39LauJensenBut ready the github page, they did a good job of documenting
06:39noidiand even then I copy and paste the <dependency> tag from a web page, so it's really not painful
06:39LauJensen-y
06:39fliebelLauJensen: Strange thing to write a Clojure package manager in Ruby...
06:40LauJensenfliebel: Not strange at all. Its an expressive cross platform language
06:40LauJensenMakes a lot more sense than bash
06:40fliebelLauJensen: How about another nice language called Clojure? :P
06:40LauJensenfliebel: Most of it is written in Clojure
06:41LauJensenits the bootstrap and install stuff thats in ruby
06:41noidiI was just about to say that dismissing Maven for XML is like dismissing Cake for being written in Ruby ;D
06:41LauJensenthe same stuff thats in bash for lein
06:41fliebelLauJensen: Make sense… Ruby is strange though, tried to learn it yesterday…
06:41LauJensenstrange? its like python just with more syntax :)
06:42LauJensenpython is like PHP, just with less dollar signs :)
06:42LauJensenPHP is like a ... a free ride when you're already late? :)
06:42noidithe biggest difference between Python and Ruby are the cultures
06:42fliebelClojure is like Ruby, only with more parens, and IMMUTABLE stuff!
06:42noidiI prefer Ruby as a language but Python as a development cultrue :)
06:44fliebelActually, Clojure is the anti-Ruby, is Armageddon nearby?
06:44LauJensenIve always found Python to be the most clean language of the two
06:44mrBlissClojure is also a ****load faster than Ruby and Python
06:44LauJensenmrBliss: Naah, I dont think we can keep up with Python
06:44noidimrBliss, for long running tasks yes, but for things like the cake launcher, the startup cost of the JVM is prohibitive
06:45LauJensennoidi: not even for long running things, Python is blazing
06:45fliebelNailgun?
06:45LauJensenand mutating is a lot faster than path copying
06:45mrBlissshow me some benchmarks
06:45LauJensenhttp://bestinclass.dk/index.clj/2009/12/clojure-vs-ruby-scala-transient-newsgroups.html
06:45noidiwell, start a hello world in python and clojure
06:45noidi:)
06:45mrBlissbut without the startup time
06:45LauJensenAt the bottom, someone contributed a very nice Python solution, which blew all the other languages out of the water
06:46LauJensenI saw several attempts in F#, but ultimately nobody could produce a working program
06:46noidi+ Ruby and Python have loads of modules to make shell scripting type of stuff easy
06:47noidiI think Ruby is just about the best choice for writing the launcher for a cross-platform Clojure build tool
06:47AWizzArdIt seems python and ruby are supported natively on Android.
06:47LauJensennoidi: agreed
06:48noidiit would be a with Python, but the default Ruby install comes with Gems and Python's Setuptools need a separate install :)
06:48AWizzArdWhile Clojure can be introduced through some other ways. But it will run without jit and might not be very fast. Hopefully this will change soon.
06:48noidi*would be a tie
06:49noidicemerick, I just linked to your article about building Clojure projects with Maven. Thanks for writing it, I've been a happy Maven user since reading it 5 months ago :)
06:50cemerickglad to hear it :-)
06:50mrBlissI'm not talking about the best choice for a build tool, but Clojure is faster than Python.
06:50mrBlisshttp://shootout.alioth.debian.org/fastest-programming-language.php?java=on&amp;python=on&amp;python3=on&amp;yarv=on&amp;calc=chart
06:50mrBlissYou could say clojure is 1.5~3x slower than Java
06:51noidiI think the more relevant question is "is this language fast enough for my use case"
06:51noidiand 90% of the time any language will do
06:52mrBlissnoidi: you're right
06:52cemerickalioth numbers are here, so all our questions are answered :-P
06:53mrBlissit's only *a* benchmark, but still ;-)
06:55LauJensenmrBliss: Why do you keep saying that Clojure is faster than Python?
06:56AWizzArdLauJensen: he is talking about specific implementations of those langs, not the langs themselves
06:56LauJensenOk
06:56mrBlissIs Python interpreted?
06:57noidiyes
06:57mrBlissso it is slower than Clojure IMO
06:57mrBliss(not talking about the aptness as a build tool)
06:57esjno, as LauJensen points out, things like mutabality trump that.
06:58LauJensenhehe
06:58AWizzArdTho there are trillions of mutable containers for Clojure too.
06:58esjLauJensen: see, sometimes I can agree with you :)
06:59LauJensenesj: I know - Every time you're right about something :)
06:59esjtook the keystrokes right off my fingertips....
06:59fliebelSo, my super reliable benchmakr says Python is faster than clojure with printing hello world 1000000 times.
06:59mrBlissbtw Python has the GIL
06:59mrBlissfliebel: that's true
06:59LauJensenmrBliss: 1) Its being fixed rapidly, 2) You dont have to use it
07:00fliebelPython: 4.7540531158447266 Clojure: 32294.985
07:00fliebelWhy this huge difference?
07:00mrBlissJVM startup time
07:00AWizzArdfliebel: depends on how you measured
07:01fliebelPython: timeit.Timer('print "hello world"').timeit() Clojure: (time (dotimes [n 1000000] (println "hello world")))
07:02LauJensenThe benchmark on my site is good, because you see both numerical crunching, IO and multithreading
07:03mrBlissWhat I'm trying to say is: Java and also Clojure are closer to C/C++ in speed than Python/Ruby/Perl
07:03mrBlissLauJensen: I'll try to come up with a faster Clojure version ;-)
07:03AWizzArdfliebel: was this really your test? If yes then I don’t understand why this python code writes one mio hello worlds
07:03LauJensenmrBliss: Thats just silly
07:03fliebelmrBliss: So how do you explain things like JRuby?
07:03LauJensenYou cant compare the performance of Ruby with Python, they are completely different beasts
07:03LauJensenPython is much closer to C++ than Clojure
07:04mrBlissJRuby is something different
07:04fliebelAWizzArd: timeit defaults to that value.
07:04mrBlissLauJensen: Python also closer to C++ than Java?
07:05LauJensenmrBliss: In some cases - There's no one answer fits all with benchmarking
07:05LauJensenSometimes Java is faster than C++
07:05fliebelLauJensen: Where's the benchmark on your site?
07:05LauJensen http://bestinclass.dk/index.clj/2009/12/clojure-vs-ruby-scala-transient-newsgroups.html
07:06AWizzArdfliebel: what needs to be imported so that I can try your example?
07:06fliebelAWizzArd: improt timeit
07:06fliebel*improt
07:06fliebel*i-m-p-o-r-t
07:06AWizzArdand for you this runs in 4.75 milliseconds?
07:07LauJensenhttp://download-llnw.oracle.com/javase/tutorial/uiswing/lookandfeel/nimbus.html
07:07fliebelAWizzArd: seconds
07:07LauJensenAny idea what these Bevels are that they are using ?
07:18esjWhat do you fine gentlemen use for grids on webpages ? I'm currently use this: http://dhtmlx.com/docs/products/dhtmlxGrid/ but wonder what else out there is good ?
07:20AWizzArdfliebel: one reason I could think of: does the Python version flush after each print?
07:20AWizzArdFor me (time (dotimes [i 10000] (println "hello world"))) and (time (dotimes [i 10000] (println "hello world") (flush))) take the same amount of time.
07:21mrBlissprinting to stdout involves interrupts
07:24noidiesj, years ago, when I still did web stuff, our designers used this http://www.blueprintcss.org/
07:25esjnoidi: merci.
07:25noidiack, ignore that
07:25noidiI didn't check your link before pasting mine
07:26noidiI thought you meant this http://en.wikipedia.org/wiki/Grid_(page_layout)
07:26LauJensenDoes anybody have an exhaustive list of Swing Components with pictures?
07:26cemerickesj: I found http://960.gs the simplest, when I was looking some months ago.
07:27noidiphew, I wasn't the only one who made the same mistake ;)
07:28cemerickesj: hah, sorry :-) I don't think of tables as "grids".
07:28esjcemerick: :)
07:29cemerickesj: In that case, http://datatables.net/ :-)
07:29alienscienceesj: I used the ExtJs grid about a year ago and wasn't impressed
07:29esjalienscience: thanks.
07:30cemerickDatatables' API is not pleasant, but it's jquery interop makes up for it.
07:30LauJensenThanks for nothing : http://download.oracle.com/javase/tutorial/ui/features/components.html
07:38AWizzArdfliebel: Can you please import sys and see if timeit.Timer('print "hello world"; sys.stdout.flush()').timeit() makes any difference?
07:42fliebelAWizzArd: sure
07:43fliebel5.3126370906829834
07:44AWizzArdok, so only a mild difference
07:44fliebelAWizzArd: I did notice that Python prints one line at a time, while Clojure seems to print random(and smaller?) chunks
07:45defnfliebel: I just got your email and wrote a short response
07:45defnfliebel: I've been /really/ busy this week, my last week of work at this job, moving to a new apartment, and starting school
07:46RaynesDoes requiring namespaces with the :reload option have a tendency to build up memory?
07:46defnif you give me until Sunday I can respond on basecamp and we'll get started
07:46fliebeldefn: great :)
07:46fliebeldefn: Take as mutch time as you need, but just let me know what's up :)
07:46defnI'm excited to have some time to finally commit to it -- this job has been draining me :)
07:46defnfliebel: will do! now, time to move a couch!
07:47fliebel*gives defn a CouchDB*
07:47defn{:couch_location "other apartment"}
07:52AWizzArdfliebel: I think this comes from the Buffer that println uses. It contains, say, 1024 bytes, and then flushes, even if one line is not fully written.
07:53fliebelAWizzArd: So would it be faster to use other java output functions?
07:55AWizzArdI am not sure. If printing is really important one could use a StringBuilder into which one writes the hello worlds and then outputs that one.
07:56Licensermorgen
07:56fliebelLicenser: Moguh
07:57Licensermorgen fliebel
07:57AWizzArdfliebel: Probably Javas print methods do a good bit more extra work under the hood, but with some low level optimizations one should be able to reduce the time.
07:58fliebel(Licenser: Where are you from?)
07:58Licenserfliebel: germany
07:59fliebelAWizzArd: Let's focus on more interesting things...
08:00fliebelLicenser: Ah, I was hoping I had found another Dutch Clojurer. Well, it's at least the same continent.
08:01LicenserAh you're not that far away fliebel ;)
08:01mrBlissfliebel: I'm from Belgium!
08:02fliebelmrBliss: Even closer, language-wise :)
08:02mrBlissinderdaad
08:03fliebel*having thoughts about Clojure conferences and stuff*
08:05Licenserthe conference is too far away :(
08:05Licensereven so I'd love to go
08:05fliebelwhere is it?
08:05citizen428and i'm from austria. we should have a clojure conf somewhere around here :-)
08:06fliebelyea...
08:06Licenserfliebel: in the US
08:06fliebelOkay, lets do an EU conference! :)
08:07Licenserthat I'm all for, we thought about doing something in germany already
08:07Licenserlets come all to berlin :P it's a nice place
08:09fliebelSure :)
08:10fliebelOr how about Loenen? It's a bit small, but I know a school we could use :)
08:11bobo_we all know stockholm is the best place in europe
08:11fliebeluh… oh… really? Well, fine with me :)
08:11Licenserbobo_: berlin is!
08:12bobo_:-p
08:12noidiberlin's awesome :)
08:12bobo_berlin is probably the only town in germany i havent been in
08:13fliebelbobo_: So how can you teel stockholm is better?
08:13bobo_i live here?
08:14fliebelthen Loenen is equally good, if not better, because I live here and we have the highest waterfall of the whole netherlands, which is a good laugh.
08:14bobo_how big is it? =)
08:15fliebelbobo_: I think I'm the only Clojure programmer who lives here, and the same is probably true for a lot of things.
08:15fliebelBut thuse I'm also the best Clojure programmer in town :)
08:15Licenserfliebel: 2 meters?
08:15Licenserand I thought rick lives in the US
08:16fliebelLicenser: I'm about to fin out… we have NBS to keep track of those things.
08:16LicenserNBS?
08:16LicenserNetherland Broadcasting Service?
08:17fliebelCBS… Central office for statistics
08:17LicenserOh
08:18Licenserwell but yes we should do it in Loenen, might be the last chance before it gets flooded :P
08:18Licenserso on the other hand, yes we should really do a european clojure conference
08:19fliebelThere's 8000 people in Loenen I think.
08:19fliebelLicenser: Yea, we should :)
08:19Licenseryes but it is in the netherlands, you all will get flooded
08:20fliebelLicenser: Not in Loenen, we're on top of a hill, at least 4m above sea :D
08:20LicenserOh cool, then we might not have to do it there and can stay in Berlin :P
08:23fliebelLicenser: Okay… Will you organize everything?
08:23Licensergiven it happens when I am actually in Berlin I'd be glad to help :)
08:24bobo_i could most likely help asweel, whatever i can do from sunny sweden that is
08:24raekcount me in too!
08:24raek(+ what bobo_ said)
08:24fliebelbobo_: That sunny part sounds good, maybe we should do it in sweden? Only rain down here...
08:24Licenserwow sweedish clojurans
08:25bobo_Licenser: there are loads of sweedish clojurans!
08:25fliebelI only know sweedish cooks :)
08:25Licenser*snickers*
08:25bobo_about 15-20 people attending the stockholm clojure user group!
08:25LicenserI envie you bobo
08:26AWizzArdLicenser: soon we will manage this in Germany too :)
08:26LicenserAWizzArd: I hope
08:28fliebelAwesoe, didn't know that..: http://groups.google.com/group/amsterdam-clojurians
08:29fliebelBut yea, I also want to help + what bobo_ said
08:30krlLicenser: there's been some berlin lisp meetings with clojure involved
08:31LicenserI know there was one but I wasn't aware they were frequent
08:31krlwell. they're not very frequent :)
08:31Licenserkrl: you're from berlin?
08:31krlyeah
08:32krlor, i live there rather :)
08:32Licenserwooh a neighbour
08:32Licensersame thing, once you arrive here you get assimilated
08:32krlLicenser: http://netzhansa.com/mailman/listinfo/lisp-berlin
08:33krla bit dead
08:33Licensernice thanks :)
08:33Licenserberlin also has a erlang community I learned recently
08:34krlnext meet should be 7th sep
08:34fliebelSo, krl, Licenser, When's the first EU Clojure Conj?
08:35alienscienceAn EU Clojure conj would be supercool - I'm in Nuernberg
08:35Licensergood question, I'd say after the US one, we should not bundle them too tightly ^^
08:36raekis it ok to use a -jure name if you came up with it before technomancy's leiningen patch that prohibits it? :-)
08:36fliebelGood :)
08:38Licenserraek: you can stil do them just o lein new blajxre and then rename it :P
08:39fliebelLicenser: Or we do it at the exact same time, so we can have live video from one continent to the other, :D
08:39Licensernah that would be taking away people to go to the US not sure if that is good
08:39fliebelokay
08:40raekI know... but will people get angry if I do it? :-7
08:41alienscienceraek: I think it would be cool. From what I understand the jure thing wasn't done in that much seriousness.
08:42alienscienceIf you really wanted some fun you could right a newjure plugin for leiningen
08:42aliensciences/right/write/
08:42sexpbot<alienscience> If you really wanted some fun you could write a newjure plugin for leiningen
08:43RaynesOr use cake.
08:46esjRaynes: wait ! I know the answer to this one :)
08:55cemericktechnomancy: I'd be interested to hear what you have to say on this topic: http://bit.ly/cB8HtG
08:56raekis there anything like clojure.string/blank? that uses Character/isSpaceChar instead of Character/isWhitespace?
08:57raekraek: focus on the *real* problem. there isn't time to be a Unicode perfectionist all the time...
10:44pdk,(/ 1280 720)
10:44clojurebot16/9
10:45pdk,(/ 384 224)
10:45clojurebot12/7
10:52_na_ka_na_hey guys I have a question regarding clojure transactions.. suppose i have.. (dosync (when (= val @aref) (alter aref ...))) .. will clojure hold the lock on aref even if (not (= val @aref)) ?
10:53_na_ka_na_I want compare-and-swap kind of semantic for aref
10:53_na_ka_na_it has to be ref only . .can't use atom ..
10:55kumarshantanuany counterclockwise user here? I need to understand how auto-reload works
10:56_na_ka_na_i am
10:57kumarshantanu_na_ka_na_: the auto-reload feature is new in 0.62, which I don't understand how to use: http://code.google.com/p/counterclockwise/wiki/ReleaseNotes
10:57lpetitHi there
10:57lpetit_na_ka_na_: Maybe I can help
10:57_na_ka_na_ofc lpetit :)
10:57lpetitwhat's the question exactly ?
10:58_na_ka_na_i'm still at 0.0.60 ..
10:58kumarshantanulpetit: how can I run a file with auto-reload ON?
10:58kumarshantanuI am doing some web developoment using compojure, and need auto-reload to be ON
10:58lpetityou cannot
10:58lpetityou must start the Clojure JVM from the project's node.
10:59kumarshantanulpetit: when I run (use 'my.ns) in the repl, it works
10:59lpetitYou should see the builder do its stuff in the background, and all your namespaces will have been loaded for you in the Clojure VM
10:59kumarshantanulpetit: ah okay
10:59_na_ka_na_lpetit: are you not making release announcements anymore? i didn't even get a 0.0.60 release notice
11:00lpetitI've set the defaults along this rationale: you start the CVM (Clojure VM) from the project's node = you are in "project mode" => auto reload is ON. You start from anything else (specific file, specific editor) => auto reload is OFF.
11:01kumarshantanulpetit: so, do I need to (use 'my.ns) in the REPL to actually run my project?
11:01lpetit_na_ka_na_: you're right. 0.0.60 was shipped ~ 10 minutes before I went to holidays => quick release, no announcement. And 0.0.62 (I skipped by error a version number) was lazily shipped without release announcement. but I'll start again with good habits, I promise
11:02lpetitkumarshantanu: if you're doing "select the project node" > trigger the contextual menu > Run as Project Clojure VM, then no
11:03_na_ka_na_lpetit: okay - i stumbled upon 0.0.60 by mistake .. when installing ccw on my friend's m/c ..
11:03lpetitkumarshantanu: if you're doing "select myproject/src/my/ns.clj" > trigger the contextual menu > Run as Clojure VM with specified file loaded, then no. (but then you won't have auto-reload)
11:03kumarshantanulpetit: I got it, thanks
11:04kumarshantanulpetit: it's awesome
11:04lpetitkumarshantanu: if what I said above doesn't work for you, then there's a bug somewhere :)
11:05kumarshantanulpetit: it's working fine (project mode)
11:05lpetitfeww :)
11:06kumarshantanulpetit: I understand the project mode loads all namespaces (and keeps reloading)...is that right?
11:06lpetityes
11:06lpetitfrom the project > you want to load the project. And auto-load makes sense since you wanted to load everything at startup
11:06_na_ka_na_ooh 0.0.62 has cntl+click .. nice .. i've to check it out!
11:07lpetitfrom the file > you want to load the file, but just the file. auto-load as a default makes less sense, so it's off.
11:07kumarshantanulpetit: that's terrific for interactive development -- I am using compojure and ring-jetty-adapter and I can add routes dynamically and do whatever and it gets reflected on the browser
11:08lpetitkumarshantanu: you're on the side of people who like to save and forget -as I generally do- :)
11:08lpetit_na_ka_na_: and "documentation hover" is around the corner, 75% done locally :)
11:09lpetit_na_ka_na_: ctrl+click is pretty young feature, please test and report issues :-)
11:10_na_ka_na_lpetit: even though i would love to help with development of ccw .. i only have 24 hours in a day :( ... why don't you make a way so people can donate for ccw!
11:11lpetit_na_ka_na_: mmm, let's me think about it :)
11:13_na_ka_na_lpetit: btw i'm 'ka' who responds on ccw google groups (if you remember)
11:14lpetitoh yes, ok. If you change your nicks for every channel, it'll be difficult to follow :)
11:14kumarshantanulpetit: with all these features the CCW version can be easily bumped to 0.1 (if not higher) :-)
11:15_na_ka_na_kumarshantanu: maybe lpetit wants to remain modest :P
11:15kumarshantanu0.0.62 is injustice to the current CCW feature set
11:16_na_ka_na_do you know any people who think - oh its not even 0.1 ? i wont use it ?
11:17kumarshantanu_na_ka_na_: not really; even I have been using CCW since its early clojure-dev days
11:18lpetitkumarshantanu: I'm currently following the simple idea of correctly identifying versions. And since I do not intend to have several maintenance branches, it works just well. Insisting on just growing one number tries to make it clear that the number for itself means is nothing more than an identifier.
11:19lpetitBut you're right, someday I'll switch to the classical 0.65.0 so that it's easier to spot bugfix-only releases from feature(+possibly bugfix) releases
11:19_na_ka_na_lpetit: one suggestion .. can we have indent whole block .. i.e. I select a block and press tab or cntl+I .... it would be really useful
11:20_na_ka_na_currently it works only line by line
11:20lpetit_na_ka_na_: I know that :)
11:20lpetit_na_ka_na_: it's in my head already. If you want to add it as a separate entry in the issue tracker, you're welcome
11:22_na_ka_na_lpetit: its coz my project partner uses emacs with some wierd config ... which messes up the whole indentation for me (introduces tabs etc.) .. but it looks just ok on his emacs .. then i have to do it line by line
11:22_na_ka_na_i like that ccw has a single policy .. only 2 space config by default
11:22_na_ka_na_lpetit: i'll add to issue tracker
11:23lpetit_na_ka_na_: it's as it is partly because it's opinionated, partly because of lack of time for making it configurable :-p
11:23_na_ka_na_lpetit: that's ok, but the default shouldn't change from 2 spaces .. :)
11:25kumarshantanulpetit: _na_ka_na_ wants <Ctrl+Shift+F> (under "Source" menu in Java files) implemented it seems ;-)
11:25kumarshantanufor Clojure that is
11:26lpetithuh ? I thought I had disabled this feature ...
11:26_na_ka_na_lpetit: he means similar to the java one
11:26lpetitno it won't be "format block", but probably "reindent block"
11:26lpetitat least in a first release
11:26_na_ka_na_ya I want re-indent block
11:26simardwhat should I use as an array in clojure ? say I want to code... conway's game of life..
11:27lpetitSo it will be Ctrl+Shift+I I guess
11:28_na_ka_na_lpetit: I would also like code formatters like present for java projects :)
11:28lpetitBut I intend to make "indent line" more powerful first: it will not indent the line, but also all the children of the first form of the line, and also all the following siblings (and recursively the children of the siblings ...)
11:30_na_ka_na_lpetit: I'm not sure if that's a good thing .. coz some people might like to indent only one line ..
11:30_na_ka_na_lpetit: I'm getting ... Project Hosting is currently READ-ONLY for network maintenance.
11:31_na_ka_na_lpetit: maybe you can keep separate shortcuts .. tab/cntl+I for one line .. cntl+shift+I for a form
11:32lpetit_na_ka_na_: interesting, cntl+shift+I with no selection could have the above described behavior , indeed
11:33_na_ka_na_yup
11:33lpetit_na_ka_na_: I was in fact more thinking about auto-indent when adding a newline. I then almost always wish that it reindents correctly the sibling forms
11:34_na_ka_na_lpetit: maybe this .. keep separate shortcuts cntl+I (one line), cntl+shift+I (form) ... and make tab configurable either ident off or cntl+I or cntl+shift+I .. :D
11:40_na_ka_na_anyone answer my aref question from above?
11:42lpetit_na_ka_na_: it's sometimes pleasant to be able to be the person with the final choices in his hands :-)
11:42_na_ka_na_:)
11:43_na_ka_na_lpetit: only sometimes though :)
11:43lpetit:)
11:44_na_ka_na_one of the ted video is about this, I'm forgetting which one
11:56arkhis the syntax to dereference something in a defrecord '(deref (:thing record)))' ?
11:58lpetitarkh: sure. Think incrementally: record -> (:thing record) -> and if it is a ref, then just call deref / @
11:59arkhso this is ok too? @(:thing record)
12:01arkh,(let [sth {:keyword (atom true)}] (prn @(:keyword sth)))
12:01clojurebottrue
12:01arkhI guess I just hadn't seen that syntax before. lpetit: thanks
12:02_na_ka_na_lpetit: any remote chance your team works on #134 next ?
12:03lpetitNow is time to explain me what exactly #134 means. I'm not totally sure to know what the command does (I have several conflicting ideas in my mind)
12:04lpetitOK, I've got it.
12:04lpetitLittle chance for it to be next
12:05_na_ka_na_hmm
12:05lpetitsorry :-(
12:05_na_ka_na_no prob .. I'll just keep on searching for the var in the project till then
12:06_na_ka_na_lpetit: maybe you can answer my aref question from above, noone else seems to be around
12:07lpetit_na_ka_na_: I didn't see it, maybe you posted id before I connected
12:07_na_ka_na_suppose i have.. (dosync (when (= val @aref) (alter aref ...))) .. will clojure hold the lock on aref even if (not (= val @aref)) ?
12:07_na_ka_na_yes i did
12:07technomancycemerick: specifically about alt. swank clients? it was discussed and decided against in the past because swank-clojure was GPL'd, but I relicensed it to EPL, so it's an option. the gain would be iffy though if you're porting slime.el anyway; I wouldn't be surprised if it were easier to start from scratch.
12:07_na_ka_na_I want compare-and-swap kind of semantic for aref
12:08technomancythere's lots of baggage in the slime protocol; just steal the interesting bits from swank-clojure without taking the whole protocol with it
12:09cemericktechnomancy: Thanks. That's basically where I've landed as well.
12:09hiredman_na_ka_na_: the stm is implemented using locks, but they are transactions
12:09hiredmandon't worry about locks being held
12:10hiredmanthey are not some thin facade over locks
12:10cemerickI'd fundamentally like to see *all* Clojure environments using the same REPL backend, but that probably won't gain a lot of traction with the emacs crowd. :-)
12:10_na_ka_na_hiredman: that's right, I'm only asking if my code from above has compare-and-swap sematics
12:10hiredmanno, you asked if a lock was held
12:10technomancycemerick: I'm no fan of maintaining swank-clojure myself... but it's slightly easier than writing a bunch of brand-new elisp.
12:10_na_ka_na_hiredman: ok sorry I put my question wrongly
12:11hiredmantransactions as a whole are compare and swap
12:11technomancycemerick: once emacs is a clojure compilation target we can talk.
12:11cemerickheh
12:11cemericktechnomancy: surely there are the requisite hooks in slime to swap out the underlying protocol being used?
12:11hiredmanif the value of a ref touched by the transaction has changed by the commit point of the transaction the transaction is retried
12:12technomancycemerick: I doubt it, though it would probably be feasible to lift certain portions of UI code wholesale.
12:13technomancyelisp doesn't really have a strong engineering culture to say the least; there's no notion of modularity or componentization.
12:13cemerickheh, yeah, I figured that one out ;-)
12:14technomancykind of like JS in that regard; it's mostly just used for building UIs and talking to things that are smarter than it is.
12:14cemerickIn any case, my current goal is to make sure that at least ccw and enclojure are using the same REPL library.
12:14cemerickEven that is turning into more of a project than I thought though :-)
12:15cemerickAt the moment, I'm tempted to chuck it all and just have every server running on top of jetty.
12:15technomancywhat's the draw of HTTP apart from being able to get around firewalls?
12:16technomancyI don't really see myself using anything but SSH for remote repls.
12:18cemerickmanaging protocols is a crummy way to spend one's time. With HTTP, at least the wire is taken care of for us.
12:19arkhany recommendations on a simple db for use with clojure? I know there's quite a few options out there. My goal is fast implementation. K/V store vs. SQL doesn't matter. Performance is secondary right now.
12:20cemerickThat said, basic auth + SSL so that ssh could be avoided for many things would be very convenient.
12:20hiredmanarkh: http://db.apache.org/derby/
12:20arohnerarkh: mongodb, congomongo
12:20cemerickUsing HTTP introduces nontrivial dependencies though, which will be a problem for people.
12:20cemerickAnyway, we'll hopefully come to some agreement over the weekend, etc.
12:21_na_ka_na_hiredman: suppose the when part of code is running in one thread (T1) with val=15, it derefs aref and gets 10 .. now it starts making comparison .. at exactly the same time parallelly in another thread value of aref is updated to 15 (committed) .. in this case the transaction in T1 wont get re-started
12:21lpetitcemerick: plain socket. ssh tunneling with keys for people wanting to do so
12:21mrBliss_na_ka_na_: look at (doc ensure)
12:21cemericklpetit: Sure, ssh isn't always a problem, but when it's a problem, it's a *big* problem.
12:21hiredman_na_ka_na_: it will be if the ref is ever written to or as mrBliss suggests ensured
12:22cemerickIn any case, avoiding ssh is hardly my tenth reason to be considering HTTP. *shrug*
12:22_na_ka_na_mrBliss: that's exactly my question is ensure necessary for compare-and-swap semantics for ref?
12:23lpetitcemerick: do you imagine things other than clojure clients connecting to the future repl server ?
12:23_na_ka_na_(dosync (when (= val (ensure aref)) (alter aref ...)))
12:23_na_ka_na_is this necessary?
12:24lpetitcemerick: if not, then "HTTP the standard" does not buy a lot if along with the serverrepl a full clojure IDE-free dependency free client is shipped.
12:24cemericklpetit: Who knows? Not requiring Clojure on the client side wouldn't be a horrible thing, certainly. Consider ajaxy calls into a sandboxed REPL server running over HTTP...
12:24lpetitcemerick: any clojure implementation from dot net to javascript .. would then be able to connect to your server, and "HTTP the standard" becomes an implementation detail again.
12:24mrBliss_na_ka_na_: I think so, or you could use alter
12:24clojurebotalter is always correct
12:25lpetitcemerick: you're right
12:25cemericklpetit: There's no such thing as a "pure clojure" implementation of a wire protocol. You're always going to be touching the host for stuff like DataOutputStream et al.
12:25lpetithow did I miss that one
12:26cemerickThat's probably reason #2 for HTTP IMO. :-)
12:26cemerickEverything with an HTTP client API can play.
12:29lpetitlet's introduce some engineering in it: split the server code so that the serving protocol is interchangeable. HTTP when the project affords to add jetty dependency or even servlet-based service, something simple based on sockets.
12:29lpetitcemerick ^^
12:30hiredmanif you are doing that you may as well just use the socket version and have a jetty based client
12:31cemericklpetit: just to avoid the dependency?
12:31cemerickhiredman: a jetty-based *client*?
12:31cemericki.e. invert things like X does?
12:31KirinDavecemerick: I had a crazy idea last night in the gym shower. Rest easy, it did not involve anatomy.
12:32KirinDavecemerick: What if we...
12:32KirinDavecemerick: *wait for it*
12:32hiredmancemerick: the socket server for everyone and a client for the socket server that translates it to http
12:32KirinDavecemerick: Used thread locals and exceptions and some additional syntax to implement conditions and restarts?
12:32lpetitcemerick: it's probably not hard to create a protocol agnostic interface for a message-based "abstract" protocol. Then all the intelligent feature is behind the interface, and the real server part is configurable
12:33cemerickKirinDave: as in, error-kit?
12:33KirinDavecemerick: Does error-kit go all the way though?
12:33KirinDaveAnd register them?
12:33cemerickoh, you mean with slime? No idea, I don't do emacs. :-)
12:34KirinDaveNo
12:34KirinDaveI mean internally
12:34KirinDaveYeah I don't think error-kit is quite where I wanted to go.
12:34KirinDaveAnyways, I'll POC after my wedding and show it to you.
12:34KirinDavei think we can do everything
12:35lpetitcemerick: I've thought about inverting things and make ccw the server and the remote VM the client. But I don't believe in it.
12:35SirNickWhat happens if you put a (defmacro) inside a (defn) and call the defined function? Wouldn't that require macro expansion and compilation at runtime?
12:36lpetitcemerick: Not sure why I came to that conclusion, though. Maybe something to do with the fact that then remote VM has the responsibility to maintain the connection.
12:36lpetitcemerick: and it seems "silly" to expect some google app engine based application try to connect to my eclipse inside my enterprise :)
12:37cemerickhiredman: I think you just took all the usefulness of HTTP out of the mix :-)
12:37SirNick(hopefully that didn't send multiple times. I was having some connections problems)
12:37cemerickfeh, stupid wifi
12:37cemerickhiredman: I think you just took all the usefulness of HTTP out of the mix
12:37cemerick(not sure if that one got through)
12:38lpetitit did
12:38arohnerdoes anyone have slime-tramp working, so you can C-c C-l files on a remote box?
12:38lpetitSirNick: it won't
12:39SirNicklpetit: It wont require macro expansion and compilation, or it wont work?
12:39cemericklpetit: the handy thing about jetty as far as ccw is concerned is that it's already in eclipse :-)
12:40lpetitSirNick: not totally sure about the details, but it will macro expand, evaluate. During evaluation, fns are compiled. Calls to def are immediately emitted
12:40lpetitcemerick: which Eclipse :)
12:41cemericklpetit: in mine, anyway :-) I thought it came with the platform all the time?
12:42lpetitcemerick: maybe, I don't know. I wanted to spot that it may be an internal detail of Eclipse.
12:47lpetitcemerick: while I understand your wish to use HTTP, I would really like to keep it optional and have most simple protocol socket based . e.g. the command is one clojure sexp as a string (of course!), doubled by the length of the string. This can translate easily to an HTTP POST later. And the rest of the server code does not know about this and just receives the clojure sexp. I have made the server response in serverrepl.clj a litt
12:49lpetitoh, we lost cemerick
12:52lpetitcemerick: did you see my last message ?
12:52lpetitcemerick: while I understand your wish to use HTTP, I would really like to keep it optional and have most simple protocol socket based . e.g. the command is one clojure sexp as a string (of course!), doubled by the length of the string. This can translate easily to an HTTP POST later. And the rest of the server code does not know about this and just receives the clojure sexp. I have made the server response in serverrepl.clj a litt
12:52jfieldsis there anything in clojure like: (defn +? [& more]
12:52jfields (apply + (remove nil? more)))
12:53jfieldsi keep encountering this situation where I want to (update-in m [k1 k2] + 14) and it always fails if there is no current value.
12:53lpetit(doc fnil)
12:53clojurebot"([f x] [f x y] [f x y z]); Takes a function f, and returns a function that calls f, replacing a nil first argument to f with the supplied value x. Higher arity versions can replace arguments in the second and third positions (y, z). Note that the function f can take any number of arguments, not just the one(s) being nil-patched."
12:54lpetit,(update-in [] (fnil + 0) 14)
12:54clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: core$fnil$fn__5585
12:55lpetit,(update-in [] 0 (fnil + 0) 14)
12:55clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
12:55lpetit(doc update-in)
12:55clojurebot"([m [k & ks] f & args]); 'Updates' a value in a nested associative structure, where ks is a sequence of keys and f is a function that will take the old value and any supplied args and return the new value, and returns a new nested structure. If any levels do not exist, hash-maps will be created."
12:55jfields,(update-in {} [:a :b] (fnil + 0) 14)
12:55clojurebot{:a {:b 14}}
12:55edbondhow to reload enlive deftemplates on every compojure request?
12:55edbond
12:55lpetitjfields: yep
12:56jfieldslpetit, thanks. looks kind of meh, but if that's what I've got, I'll roll with it.
12:56lpetitcemerick: must leave, will let you answer (if you wish) by email. cu all
13:08_na_ka_na_mrBliss hiredman: I've been trying but haven't been able to reproduce a case where the code without ensure would not show compare and swap semantics ... ofc this doesn't mean it will always ..
13:35_na_ka_na_I should ask the question more precisely .. here's another attempt
13:35_na_ka_na_[1] (dosync
13:35_na_ka_na_[2] (if (= @a 10)
13:35_na_ka_na_[3] (ref-set a 20)
13:35_na_ka_na_[4] (..do something time consuming ..)))
13:35_na_ka_na_Is it guaranteed that Clojure will re-try the above transaction if 'a' is written to while [4] is executing?
13:37LauJensen_na_ka_na_: Yes, if a new value of 'a' is committed, this transaction will retry.
13:38_na_ka_na_LauJensen: thanks
13:39_na_ka_na_LauJensen: that's the case even if [4] is not trying to write to 'a', right?
13:39LauJensen_na_ka_na_: ref-set marks this transaction as affecting 'a' so yes.
13:40LauJensenThere is a great article on the commit process online somewhere, lemme see if I can find it
13:40LauJensenhttp://java.ociweb.com/mark/stm/article.html#STM
13:40LauJensenWorth reading
13:40_na_ka_na_LauJensen: that was my confusion, in the transaction since a is written conditionally .. does clojure optimize and write to 'a' only if it was really written to
13:41_na_ka_na_..reading now..
13:42_na_ka_na_oops .. that came out wrong ... *does clojure optimize and *retry the transaction* only if 'a' was really written to
13:42LauJensen_na_ka_na_: My memory is failing me... Try to read the article, otherwise we'll have to check the code. I think it actually only retries if the conditional is true
13:43_na_ka_na_LauJensen: hmm
13:43_na_ka_na_LauJensen: do you mean that's an implementation detail ?
13:44LauJensenyea I guess you could say that - but like I said, its been a few months since I looked at it
13:45kumarshantanuhow can I transform this? -- [:a 10 :b 20 :c 30] --> [:a 10] [:b 20] [:c 30]
13:46semperoszipper functionality?
13:46dnolen,(into [] (map vector (partition 2 [:a 10 :b 20 :c 30])))
13:46clojurebot[[(:a 10)] [(:b 20)] [(:c 30)]]
13:46dnolenoops
13:46noidi,(map vec (partition 2 [:a 10 :b 20 :c 30]))
13:46clojurebot([:a 10] [:b 20] [:c 30])
13:47dnolen,(into [] (map vec (partition 2 [:a 10 :b 20 :c 30])))
13:47clojurebot[[:a 10] [:b 20] [:c 30]]
13:47hiredmanbe sure to use partition-all
13:47dnolen,(doc partition-all)
13:47clojurebot"([n coll] [n step coll]); Returns a lazy sequence of lists like partition, but may include partitions with fewer than n items at the end."
13:47hiredman,(partition 2 [:a 10 :b])
13:47clojurebot((:a 10))
13:48hiredman,(partition-all 2 [:a 10 :b])
13:48clojurebot((:a 10) (:b))
13:48LauJensenor regular partition with padding
13:48kumarshantanunoidi: dnolen: hiredman: LauJensen: thanks
13:48hiredmanit's easier to add padding with a map after partition-all then it is before a partition
13:49LauJensen,(doc partition)
13:49clojurebot"([n coll] [n step coll] [n step pad coll]); Returns a lazy sequence of lists of n items each, at offsets step apart. If step is not supplied, defaults to n, i.e. the partitions do not overlap. If a pad collection is supplied, use its elements as necessary to complete last partition upto n items. In case there are not enough padding elements, return a partition with less than n items."
13:49LauJensennotice the 3rd arity hiredman
13:50hiredmanI see
13:50LauJensen, (partition 2 1 [9] [1 2 3])
13:50clojurebot((1 2) (2 3) (3 9))
14:05_na_ka_na_LauJensen: This kind of proves that Clojure will not re-try the transaction always .. http://gist.github.com/562631
14:09pjstadigwhen are we going to be able to register for the ClojureConj?
14:10LauJensen_na_ka_na_: Yea, I was assuming to find something in Ref.set which would show that the STM is alerted to the change, but its not there. I think your theory is correct though
14:12_na_ka_na_LauJensen: hmm ... so the way to correctly implement compare-and-set for ref is : (dosync (when (= val (ensure a)) (ref-set a ...)))
14:12LauJensen(on the phone)
14:14LauJensen_na_ka_na_: ensure is effectively a writer lock, is that what you want ?
14:14_na_ka_na_LauJensen: I want an atomic compare-and-set for ref ..
14:14LauJensen_na_ka_na_: Actually, this is probably parallel to an issue AWizzArd faced, which he ended up solving with Cells - AWizzArd got an oppinion on this?
14:15aavramtesting
14:38aavramI am using clojure.contrib.sql to talk to a netezza database. I have 2 sql queries, each of which run fine outside of clojure. The first query is a simple SELECT statement that returns data correctly via the with-query-results function. The second query is similar to the first but contains a GROUP BY statement and though valid, fails via clojure with the following error, "org.netezza.error.NzSQLException: Driver can process one query
14:38aavramtime (NO_SOURCE_FILE:1)" Any help appreciated :)
14:45aavramperhaps there is underlying concurrency that netezza is complaining about?
14:48kumarshantanucan anybody let me know how can I provide 1 docstring per variadic arg version of a function?
14:49hiredmancan't
14:49kumarshantanuhiredman: ah okay...any plans to include in a future Clojure version?
14:50hiredmannope
14:50hoeckaavram: maybe you forgot to close the first query before issuing the second one
14:51hoeckaavram: looks like your jdbc driver cannot handle more than one open query
14:52aavrami guess it is a driver issue, because if I start a new repl and try the group-by query alone, it still fails
14:54hoeckaavram: clojure.sql uses plain jdbc, basically in the same way as using it from java, only with less LOCs :)
14:55aavramI'm basically doing the same thing as step #4 here http://stackoverflow.com/questions/613929/how-do-i-connect-to-a-mysql-database-from-clojure but using Netezza connection info
14:58aavramhoeck: thanks for your help, hoping for a work-around :)
15:01hoeckaavram: never heard of netezza, and step #4 works for the first query?
15:02aavramhoeck: yes step #4 works for all simple queries involving only SELECT...FROM but no GROUP BY
15:02aavramNetezza is from netezza.com developed from postgres i believe
15:04aavramI suppose I could do the group-by step in clojure... but when the data is large that may be unwise. It would be better if the database would do what it normally does and pass results to clojure...
15:06hoeckaavram: mhh, even a group-by is just a plain ResultSet from a jdbc point of view
15:08aavramok, not sure how to debug further though.
15:09hoeckaavram: to be 100% shure wether its a clojure or jdbc thing, you could download sql-workbench/j and try the select-group-by there
15:09hoeckhttp://www.sql-workbench.net/index.html
15:09aavramhoeck: thanks for the link, I'll check it out :)
15:09hoeckused it once to test my own clojure jdbc driver
15:10aavramcool.
15:13LauJensenDoes anyone know if the Swingset 3 source is available?
15:19hoeckLauJensen: you mean this: https://swingset3.dev.java.net/source/browse/swingset3/ ?
15:20LauJensenI think thats the one hoeck, thanks a lot
15:27_fogus_cemerick: I didn't understand your tweet :-(
15:29LauJensen_fogus_: What are you doing here man? You're supposed to be out hating on all those coding in poor style :(
15:31cemerick_fogus_: oh, just giving you a hard time about adopting stranded languages :-)
15:34_fogus_cemerick: Well, it was either langs or defunct OSes, but I thought the former was a little more reasonable. ;-)
15:34_fogus_LauJensen: My days as paren-police are over
15:36cemerick_fogus_: Qi (on top of Clojure, of course) would probably be where I'd go first, but I'm in no position to be expanding my language tinkering.
15:36_fogus_Qi is coming to Clojure
15:37_fogus_(well, next gen Qi)
15:37cemerickdo you know of news in that regard? I remember it being talked about, but the fork of it seemed to go dead.
15:38_fogus_cemerick: You'll notice however that I totally passed the buck to the Twitter-verse. I have enough defunct languages on my hands :-p
15:38dnolenTarver's been posting every couple weeks about the progress of Shen on the Qi ML, seems like the core is done.
15:40_fogus_http://groups.google.co.uk/group/qilang/browse_thread/thread/fe07f6a5032d5d47
15:46arohnerso what's the point of Qi now that clojure is taking off?
15:52cemerickThe optional static typing and pattern matching stuffs AFAIK.
15:54mcavIs there a recommended way to deploy compojure apps? Some tutorials use uberjar, some use rsync, and others recommend deploying to a WAR file. Any reason to prefer one way over another?
15:55ordnungswidrighia ll
15:56LauJensenhi
15:57LauJensenmcav: war files for tomcat/jboss, rsync when you dont want to precompile, uberjars when you just want a single jar-file (with or without source)
15:57cemerickmcav: Compojure webapps are java webapps, so all the same rules apply -- e.g. deploying using a .war file is far preferable in almost every case IMO.
15:58mcavthanks, makes sense. Having had no java experience, I'm just now learning what Java apps do for deployment as well.
15:59cemerickmcav: FWIW, war packaging is built-in to maven, if you happen to be using it for your builds.
15:59cemerickI think there's a war file plugin for lein
16:00LauJensen..and cake
16:00LauJensenmcav: There are 2 Clojure based build tools you might want to have a look at, one is Leiningen (lein) the other is Cake
16:00ordnungswidrigall those j2ee stuff... Did anybody some EJB3 with clojure? If yes, I assume it was done for fun.
16:00mcavI'm using leiningen
16:00ordnungswidrighuh, cake?
16:01mcavhave only heard about cake once or twice recently
16:01cemerickI'm surprised so many people are recommending cake so soon.
16:01LauJensencemerick: Cake is fantastic
16:01alexykthere used to be a -Dclojure.jar=... option to maven building clojure-contrib; no longer mentioned in README.txt there. Looks like mvn compile downloads clojure-1.2.0, even when in a git checkout of clojure-contrib-1.3.0-master-SNAPSHOT. Is it OK to just mvn install for use with clojure master?
16:01LauJensenIve done my most recent builds with cake, and have been constantly impressed with it
16:02alexykLauJensen: constantly or instantly? :)
16:02cemerickI'm quite done with task-based build tools.
16:02ordnungswidrigso cake is ruby?
16:02LauJensenalexyk: constantly. Whenever something comes up that I need to work out, I get impressed by its design and the authors personal commitment to it
16:03LauJensenordnungswidrig: Where lein is bash/clojure, cake is ruby/clojure
16:03ordnungswidrighuh?
16:03LauJensenordnungswidrig: Where lein is bash/clojure, cake is ruby/clojure
16:03alexykLauJensen: agreed, I was aware of cake when it was only a closed beta! :)
16:03ordnungswidrigLauJensen: ok, I got it.
16:03LauJensenalexyk: I was aware when it was semi-closed alpha :) !
16:04LauJensenordnungswidrig: haha, you did? :)
16:04ordnungswidrigLauJensen:
16:04LauJensenOne of the really nice things with Cake, is that its cross platform, so both on unix, mac and Windows, just hit 'gem install cake' and you're all set
16:04alexykLauJensen: I saw it as an embryo in ninjudd's mind!
16:04ordnungswidrigLauJensen: I already slept and wake up again, so bare with me.
16:04LauJensenwell, on Windows its 'gem install win32-process' then 'gem install cake'
16:04alexykcake says it runs on Commodore 64 too
16:04ordnungswidrigLauJensen:
16:04ordnungswidrig*doh*
16:05ordnungswidrigLauJensen: windows is a corner case
16:05LauJensenordnungswidrig: I know you love highlighting me, but please... :)
16:05ordnungswidrigLauJensen: no offense :-)
16:05LauJensenIm just saying: If you guys havent tried to base a build off cake, you're missing something
16:05LauJensenAnd the task/deps system is off the hook, I've really enjoyed working with it
16:06ordnungswidrigLauJensen: can I expect it to be a drop-in replacement for lein?
16:06alexykso, how do we build clojure-contrib using the clojure-1.3.0-master-SNAPSHOT.jar from github build locally?
16:06ordnungswidrigLauJensen: or some reconfiguration needed?
16:06LauJensenordnungswidrig: yea, unless you're using personal plugins, then you need to rewrite
16:06LauJensenotherwise its a drop-in thing
16:06LauJensenanyway, thats it for my commercial break, back to work :)
16:06cemerickLauJensen: "off the hook"? :-D
16:06ordnungswidrigLauJensen: i'll check. If it isn't I'll keep highlighting you :)
16:07LauJensenordnungswidrig: fantastic :)
16:07LauJensencemerick: No such thing? :)
16:07cemerickheh .. there is, but I think it was more in vogue circa 2005-ish, at least in the U.S. ;-)
16:08cemerickDefinitely made me smile, though!
16:08LauJensenthen it was worth it :)
16:16kencauseyI'm using emacs/slime/swank. I start up the day and (use 'myproject.myfile) in the repl for quick testing, experiments. This is fine until I add a new function. I can C-c C-c (compile-defun) it and there are no complaints, but the new definition is not available at the REPL. What's the proper way to keep the loop going?
16:16LauJensenthen it was worth it :)
16:16raekyou'll have to run use again, or do a (in-ns 'myproject.myfile)
16:17LauJensenoops, M-p, I thought I was in the REPL :)
16:17raek(probably the latter)
16:17raek,(doc in-ns)
16:17clojurebot"([name]); Sets *ns* to the namespace named by the symbol, creating it if needed."
16:18raekit makes the repl eval things inside that namespace, anyway...
16:20kencauseyBut by using 'use the 'myproject.myfile becomes part of 'user, I can see in the results of (all-ns)
16:20kencauseys/see in/see it in/
16:20sexpbot<kencausey> But by using 'use the 'myproject.myfile becomes part of 'user, I can see it in the results of (all-ns)
16:21nickikstupid question but how do i make a newline in a string (str "line1" ..... "line2") <-- what goes here ......?
16:21raekuse only adds the public vars that are available at the point when use is ran
16:22raekit doesn't make any automatic connection between the namespaces
16:22kencauseyHowever I will admit that (in-ns) does work, I just would have thought it would be no different than (use) in this
16:22kencauseyOK, I see
16:23kencauseythanks
16:26hoecknickik: \newline
16:28nickikthx
16:30raekthe recommended way of calling use is by listing all the vars one intend to utilize: (use '[foo.bar :only [x y z]])
16:31cemerickraek: use is usually recommended *against*, at least for general use
16:31ordnungswidrigcemerick: no use for use in general?
16:31raekyeah, a namespace alias is always safer, right?
16:32hiredmancemerick: what is wrong with :use and :only?
16:32cemerickordnungswidrig: one should not use use for almost any use case ;-)
16:32ordnungswidrigcemerick: what is the replacement for :only then?
16:32cemerickraek: right
16:32ordnungswidrigcemerick: require :as ?
16:33cemerickhiredman: fundamentally, nothing, except that it's far simpler to simply recommend against using use
16:33cemerickordnungswidrig: yes, (:require (some.optional.prefix [ns-name :as local-name]))
16:33hiredmancemerick: ok, I'll just ignore your recomendations then
16:33ordnungswidrighiredman: *g*
16:34alienscienceI use :use all the time
16:34alienscienceIs it really that bad?
16:34hiredmancan someone please set the mode on this channel so I can change my nick from hiredman_ to hiredman without having to part/join
16:34cemerickhiredman: fair enough. irc is not a good place for nuanced explanations.
16:34ordnungswidrigwhile switching to 1.2 my uses of use used to drop badly on my foot
16:35hiredmancemerick: you have a marvelous proof but these margins are too narrow?
16:35ordnungswidrighiredman: there is no nick hiredman_
16:35cemerickalienscience: namespace pollution is an issue, and is what prompted the last-var-(mostly)-wins behaviour.
16:35ordnungswidrigcemerick:
16:35ordnungswidrigcemerick: I like the "mostly"-part best :)
16:35hiredmanordnungswidrig: my client reconnected for some reason and the server still had a zombie connection as hiredman so my client picked the nick hiredman_
16:36cemerickhiredman: proof? margins?
16:36ordnungswidrighiredman: I see you as "hiredman" here
16:36hiredmanI just had to part/join to change it back because the mode on this channel doesn't allow nick changes
16:36hiredmanordnungswidrig: it was five minutes ago
16:36hiredmanpay attention
16:36ordnungswidrighiredman: I see. Gosh it's late at my place
16:36hiredmancemerick: fermat?
16:37hiredmancemerick: http://en.wikipedia.org/wiki/Fermat's_Last_Theorem#Fermat.27s_conjecture
16:37ordnungswidrigbtw, what's the state on the P!=NP prove?
16:37jolyI'm curious about the :use recommendation too. I just used it in a file meant to be in a DSL, where I'd rather not have the users doing (parse/menu "abc" (parse/item "123")) etc.
16:38hiredmanjoly: you're fine
16:38ordnungswidrigsays hiredman. now back to cemerick:
16:38jolycool, glad to hear it. :) This is my first time using clojure "for real"
16:39hiredmanI hope he's still busy with the wikipedia article
16:39hiredmanclojurebot: ping?
16:39clojurebotPONG!
16:39LauJensenFermats last theoreom took 9 years to complete IIRC, and Fermat himself noted in the margin of his book "I have a funny little proof for this theorom" in the 1600s :)
16:39cemerickjoly: yeah, you're fine since you know what you're doing. 'use' is a longer length of rope than require is all.
16:40aavramhi, what is the best way to turn a sequence of maps (as returned from a database query) into an incanter "dataset" ?
16:40hiredmanLauJensen: 9 years for the guy who finally solved it, people have been trying since fermat's time
16:40cemerickhiredman: lovely reference. Shit, you know I'm a mostly skill-less code monkey, right? ;-)
16:41LauJensenhiredman: right
16:41LauJensenand 2 of those years were debugging :)
16:42hiredmanI had some non-clojure related news over lunch that's left me a little more combative than normal I expect
16:42technomancyjust don't challenge stuart S to a duel; he's a trained swordsman
16:42LauJensenhiredman: you? combative? noooo :)
16:43pjstadigstuart S ? i'm confused
16:43raekthe other suart... :)
16:43raek*stuart
16:44pjstadigi know who stuart S is...i was confused about how he entered the convo
16:45technomancypjstadig: he's not a guy you want to get combative with is all.
16:45pjstadigtechnomancy: duly noted
16:46hiredmanyou just feint for the chin, he's very protective of it
17:42brw314test
18:02scottjIs there an easy way with compojure/slime to have clj-stacktrace used to print all stacktraces that appear in the terminal?
18:02technomancyscottj: you can re-def clojure.stacktrace/print-stack-trace to clj-stacktrace/pst if you're OK with a heinous monkeypatch.
18:06replacafor some reason "]
18:06replaca :dev-dependencies [[swank-clojure "1.2.1"]])
18:06replacaack, retry
18:06replacafor some reason: [org.apache.xmlrpc/xmlrpc "3.1.3"] fails to get the right library even though I see it on central
18:07replacawhen I run lein deps
18:09replacaI get this: http://gist.github.com/563043, which is not helping me
18:09replacaany ideas?
18:12scottjtechnomancy: don't think that works. have you actually done it?
18:14hiredmanscottj: yes he has
18:14scottj(in-ns 'clojure.stacktrace) (clojure.core/require 'clj-stacktrace.repl) (def print-stack-trace clj-stacktrace.repl/pst) ?
18:15hiredmanyou'll have to ask him
18:16replacahmm, it seems like if I depend on xmlrpc-client it works OK, but the meta project doesn't get pulled right
18:16replacaoh well
18:16scottjAre C-M-x and C-c C-c kind of redundant? Does C-c C-c give any better file line info than C-M-x? Anyone rebound C-M-x to do eval the eval only the most immediate parent form?
18:19technomancy (into (sorted-map)
18:19technomancy (zipmap (vals secs-in-units)
18:19technomancy (keys secs-in-units))))]
18:19technomancy [(float (/ secs i)) units])))
18:19technomancy(defn unit-time [secs coll]
18:19technomancy (let [[i units] (first coll)
18:19technomancy secs-rem (- secs (* (secs-in-units units) (Math/floor i)))]
18:19technomancy (if (> (count coll) 1)
18:19technomancy (cons [(int (Math/floor i)) units]
18:19technomancy (unit-time secs-rem (apply-secs secs-rem)))
18:19technomancy [[(int i) units]])))
18:20technomancy(defn human-time [secs]
18:20hiredmanuh, phil?
18:20technomancy (apply str
18:20technomancy (interpose " "
18:20technomancy (map #(format "%s%s" (first %) (second %))
18:20technomancy (unit-time secs (apply-secs secs))))))
18:20technomancy(defn copy-to-uniq-file [dir stream prefix suffix]
18:20danlarkinoh. my. god.
18:20technomancy (.mkdirs dir)
18:20technomancy (let [file (File/createTempFile prefix suffix dir)]
18:20technomancy (with-open [outs (FileOutputStream. file)]
18:20technomancy (copy stream outs))
18:20technomancy (.getCanonicalPath file)))
18:20scottjgotta love consistent reliable copy paste in nix
18:20technomancy(defmacro tap->> [name & body]
18:20technomancy `((fn [~name]
18:20technomancy ~@(butlast body)
18:20technomancy ~name)
18:20technomancy ~(last body)))
18:20technomancy(defmacro accumulate
18:20technomancy "map:for :: reduce:accumulate"
18:20technomancy ([accum bindings body]
18:20technomancy `(reduce (fn ~[(first accum) (first bindings)] ~body)
18:21dnolenprobably accidental paste into erc
18:21technomancy ~(second accum) ~(second bindings)))
18:21technomancy ([[name value] body]
18:21technomancy `(let [[init# & more#] ~value]
18:21technomancy (accumulate [~'% init#] [~name more#] ~body))))
18:21technomancydammit
18:21dnolentechnomancy: you pasted into your irc client
18:21technomancypaste misfire
18:21technomancyneed to set up a way to get ERC to prevent that
18:21technomancywhat I meant to say was http://p.hagelb.org/clj-monkey.html
18:22technomancyscottj: that's how to use clj-stacktrace
18:32sleepynatetechnomancy: the most powerful irc client in the world. if only it could edit text ;)
18:35scottjtechnomancy: well you're lucky that works for you. sure isn't working on compojure stack traces for me
18:37technomancyscottj: oh, I missed the compojure part. I only use it for slime.
20:05auserhola
20:05auserany hints on where to start if I want to write a parser in clojure?
20:05auseror a web scraper, really
20:10hiredmanhtmlunit is nice
20:11hiredmanwell
20:11auseroh yeah?
20:11hiredmanfor scraping you need tagsoup + clojure.xml + tree-seq
20:11hiredmanhtmlunit is more for automation
20:11auserI guess I need to really understand clojure at a deeper level first, i'm following tutorials and it's still going over my head, at least for now
20:11ausertagsoup, you say
20:11hiredmanyes
20:12ausercool
20:12RaynesFor parsers, there is fnparse and another Clojure-based parser that I can't remember the name of.
20:12auserany hints on a good tutorial for someone coming from ruby/erlang?
20:12auserheh
20:12RaynesThere is also Brian Carper's ANTLR in Clojure tutorial.
20:12auserjust in general
20:12hiredmanRaynes: he doesn't really want a "parser"
20:12auserI've seen some templating
20:13auserwell... eventually I want to parse the scraped material
20:13auserof course
20:13hiredmanhe's not writing an html parser
20:13Rayneshiredman: He might eventually. Now he knows about parsers.
20:13auserhe appreciates the discussion
20:13hiredmanhttp://github.com/nathell/clj-tagsoup might be what you want
20:14auserlemme look
20:14auserah that's nice
20:14hiredmanno
20:14hiredmanno one wants to parse html
20:14hiredmanEVER
20:16hiredmanwhen people say "I want to parse html" they mean "I want a library to parse html and make it less dirty"
20:16hiredmanwhich is why tagsoup exists
20:16auseryou're right, I want to parse html in a semantic way, I don't want to do the parsing myself
20:17hiredmanright, anything with tagsoup in it will do you well
20:17hiredmanchouser has an example somewhere of using tagsoup + clojure.xml/parse which is what I have used in the past
20:17ausernow I just have to figure out how to use it
20:17RaynesI didn't actually know about tagsoup.
20:20auserman, in comparison, clojure runs super slow in development (because of the JVM, I'm assuming) to erlang, even though both are compiled languages
20:21hiredmanhuh?
20:21hiredmanhow do you figure?
20:22auserwell, it's not a fair statement to make considering I don't know clojure that well yet
20:22auserso I probably should hold off on saying that
20:22RaynesWhat do you mean by "super slow in development"?
20:22RaynesYou aren't talking about start-up time, right? That's a whole different beast entirely.
20:23auserbrb, work calls
20:23auserI'm talking about compiling
20:23hiredmanwhy are you compiling?
20:23RaynesYou shouldn't be compiling.
20:23danlarkinsomething something compiling
20:24RaynesUnless you need certain Java interop features that require AOT, there are rarely reasons to compile to Java bytecode. Especially during development.
20:24RaynesWell, to class files.
20:26auserI don't need to compile?
20:26auserokay
20:26auserhm
20:26ausermaybe I am misunderstanding then
20:27auserI guess I'm trying to use tagsoup
20:27auserhow do I use the method "parse")
20:27ausererp, no ')'
20:28hiredmanthe method?
20:28auserin tagsoup
20:28hiredmanon what class?
20:28auserI'm just looking at this: http://github.com/nathell/clj-tagsoup
20:33Raynesauser: Are you using Leiningen for this project?
20:33Rayneshttp://github.com/technomancy/leiningen
20:34auserI am yes
20:34auserwell, trying to
20:37RaynesIf you have a Leiningen project set up, you'll want to add [clj-tagsoup "0.1.2"] to your :depedencies in your project.clj.
20:37RaynesAnd then, you'll want to run "lein deps" to pull it down.
20:38RaynesThe jar will be on the classpath if you run "lein repl" or swank or whatever, so you should be able to use or require the namespace with the parse function and use it.
20:42seangroveHey all, I'm having a bit of a tough time understanding the recur example
20:42seangrovehttp://clojure.org/special_forms#Special Forms--(loop [bindings* ] exprs*)
20:43seangroveAh, nevermind
20:43seangroveHaha, got it now
20:43seangroveThanks for being my rubber ducky, #clojure
20:44notsonerdysunnyis there a way to pipe the command line output for further processing .. ?
20:45Raynesseancorfield: Quack.
20:45notsonerdysunnyIf let us say (dir ns) returned a list of member funcs I could map doc on each element of the list ....
20:45notsonerdysunnybut unfortunately (dir ns ) just prints it to the prompt instead of say returning a list .. does anybody have a suggestion?
20:46notsonerdysunnyideally I would like to do something like ... (for [i (dir clojure.zip)] (doc i)
20:46notsonerdysunny,(for [i (dir clojure.zip)] (doc i))
20:46clojurebotjava.lang.Exception: Unable to resolve symbol: dir in this context
20:47seangrove,(cons '(3 7) '(10))
20:47clojurebot((3 7) 10)
20:47seangroveHow do I get that to be (3 7 10) ?
20:47seangrove(cons '(3 7) 10)
20:48seangrove,(cons '(3 7) 10)
20:48clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
20:48seangroveNot like that :P
20:51seangrove,(flatten (cons '(3 7) 10))
20:51clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer
20:51seangrove,(flatten (cons '(3 7) '(10)))
20:51clojurebot(3 7 10)
20:51seangroveThat seems wasteful...
20:51hiredmanno
20:51hiredmanread the docstring for cron
20:52hiredmansorry
20:52hiredmancons
20:52seangroveThought that might be it :)
20:52RaynesAw.
20:52RaynesAnd here I was looking for the cron function. :(
20:53hiredmanwikipedia may even have an entry on cons
20:53hiredman~goolge Cons
20:54seangroveOh, I went through all this in beginning cs a few years ago, just don't remember it off the top of my head
20:54clojurebotPardon?
20:54Raynes$wikipedia cons
20:54hiredman~google Cons
20:54clojurebotFirst, out of 2590000 results is:
20:54clojurebotConverse Skateboarding | CONS Fall 09 Skateboarding Shoes ...
20:54clojurebothttp://www.converseskateboarding.com/cons_product.html
20:54hiredmanhuh
20:54Raynes$wiki cons
20:54sexpbotFirst out of 9930 results is: cons - Wikipedia, the free encyclopedia
20:54sexpbothttp://en.wikipedia.org/wiki/Cons
20:54RaynesIf you had attached site:en.wikipedia.org to it, it would have been right.
20:55seangrovedoh
20:55seangrove,(cons 10 '(3 7))
20:55clojurebot(10 3 7)
20:56seangroveYes, makes sense..
20:56Raynes-> (concat '(3 7) '(10))
20:56sexpbot=> (3 7 10)
20:56chouser,(class (cons 10 '(3 7)))
20:56clojurebotclojure.lang.Cons
20:56chouser,(counted? (cons 10 '(3 7)))
20:56clojurebotfalse
20:56Rayneschouser: Hai there.
20:57chouser,(counted? (conj 10 '(3 7)))
20:57clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection
20:57chouser,(counted? (conj '(3 7) 10))
20:57clojurebottrue
20:57chouserRaynes: hi
20:58RaynesI was just thinking about you. Well, I was actually thinking about geniuses in general.
20:59notsonerdysunnyis there a way to pipe the printed output for further processing .. ?
20:59notsonerdysunnyIf let us say (dir ns) returned a list of member funcs I could map doc on each element of the list ....
20:59notsonerdysunnyideally I would like to do something like ... (for [i (dir clojure.zip)] (doc i)
20:59notsonerdysunnybut unfortunately (dir ns ) just prints it to the prompt instead of say returning a list .. does anybody have a suggestion?
20:59notsonerdysunny,(for [i (dir clojure.zip)] (doc i))
20:59clojurebotjava.lang.Exception: Unable to resolve symbol: dir in this context
21:00notsonerdysunnyofcourse dir is not available in the general namespace .. but it does exist in the repl..
21:01notsonerdysunny,(doc counted?)
21:01clojurebot"([coll]); Returns true if coll implements count in constant time"
21:03chouserRaynes: haha
21:04seangroveAlright, so I'm wondering about lazy sequences and next
21:04seangroveif I define: (def random-stream (repeatedly #(rand-int 10)))
21:05seangroveHow can I get the next item of random-stream repeatedly?
21:05seangrove(println (next random-stream)) just keeps going forever...
21:06chousernotsonerdysunny: use (source dir) to see that it uses dir-fn
21:07chouser,(count (clojure.repl/dir-fn 'user))
21:07clojurebot0
21:07chouser,(count (clojure.repl/dir-fn 'clojure.core))
21:08clojurebot546
21:08chouser(doseq [s (clojure.repl/dir-fn 'user)] (print-doc (resolve s)))
21:09clojurebotis not infinity +1!
21:09chousernotsonerdysunny: something like that
21:09chouserseangrove: you want (second random-stream) ?
21:09chouserseangrove: next and rest return everything after first.
21:09seangroveAh, they're synonyms?
21:09chousernot quite
21:10chouserbut closely related
21:10Raynes-> (next [])
21:10sexpbot=> nil
21:10Raynes-> (rest [])
21:10sexpbot=> ()
21:10seangroveAh, great
21:10seangroveSo that lazy-seq will go on forever, so next will continually return
21:11chouserright, on a lazy seq, rest and next act the same
21:11chouserwell
21:11chouserthat's still not quite right.
21:12chousernext has to look one step further ahead to see if the seq is done, compared to rest.
21:13seangroveThank you, good to know
21:14seangroveAnd it seems like random-stream always remembers what's in position 1, position 2, etc.
21:14seangroveDoes that mean it's holding it all in memory for each take-nth ?
21:15chouserseangrove: yes, lazy seqs cache their values.
21:15seangrovegreat
21:20Rayneschouser: Do you ever post on the mailing list?
21:22chouserRaynes: yeah, why?
21:22thunk,(cons 'foo 'bar)
21:22clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
21:22RaynesJust curious. I'm not sure I've seen any of your posts in a while.
21:22RaynesBut, I don't follow the mailing list much anyway.
21:23thunkClojure doesn't allow non-seq values in the rest cell of a cons, right?
21:23technomancythunk: right, no "improper" lists
21:23thunktechnomancy: Thanks
21:23technomancybasically: you don't need alists since there are non-half-assed associative data types
21:24technomancy(can you tell I'm biased?)
21:24Raynesalists are fun
21:24technomancywell calling seq on a map basically gets you an alist
21:24technomancyif you're into that sort of thing
21:25thunkIt'll take a little mental reorganization, but I think I'll come to like it quite a bit.
21:25chouserRaynes: there was a time I read every message, but that was several thousand messages ago.
21:25RaynesHehe.
21:26technomancynothing kills your enthusiasm for elisp like getting used to a rich set of persistent data structures with convenient literals.
21:26chouserthunk: cons requires and rest promises to return an ISeq
21:26technomancylisp-2-ness aside
21:26Rayneschouser: If you get a couple of minutes, check this out and tell me what you think: http://groups.google.com/group/clojure/browse_thread/thread/4a2243a1453499a1#
21:26thunkchouser: Aha. That must be why:
21:26thunk(first nil)
21:26thunk,(first nil)
21:26clojurebotnil
21:26thunk,(rest nil)
21:26clojurebot()
21:27Raynestechnomancy: I've yet to be able to bring myself to use elisp for anything.
21:27RaynesOther people are really good at doing it for me.
21:27technomancyRaynes: the key is to learn it before learning clojure.
21:27RaynesToo late.
21:28thunkRaynes: Elisp is great. It's the lisp that doesn't take itself seriously.
21:28technomancywell then the key is to write a clojure-to-elisp compiler.
21:28technomancythunk: I like that. it could work, as a tag line.
21:29technomancythe Brendan Fraser of lisp dialects.
21:29thunk"Elisp: srsly?"
21:30chouserRaynes: there.
21:30technomancyor maybe jim carrey
21:31thunkBrendan Fraser's a good analog.
21:32thunkJim Carrey can actually be ... really good.
21:33s450r1He was an excellent Count Olaf.
21:33thunkYes, he was.
21:34Raynestechnomancy: Don't be dissing Jim.
21:35technomancyearly Jim Carrey?
21:35notsonerdysunnychouser: thanks .. that helps .. I was away from my comp for a while ..
21:36Rayneschouser: Thanks for your input. I'll play with the profilers later tonight.
21:37technomancyfor the record, if you are in Seattle and not headed to Seajure RIGHT NOW, you are missing out.
21:38technomancyunless you live right next door, in which case you can just walk over a few minutes before 7.
21:39s450r1hmmm, how did Seajure make it past leiningen?
21:48technomancys450r1: it's been around since mid-January. grandfathered in. =)
21:48technomancyplus it's bad-on-purpose, which gets a pass for irony's sake.
21:51bortrebwhat's the best way to do vector math in clojure
21:51bortrebpreferbly using actual clojure vectors of vector-ofs or something nice
21:51bortrebI want to do (- [2 2 2] [1 2 3]) etc
21:52qbgCantor?
21:52qbghttp://github.com/ztellman/cantor
21:54bortrebexcellent.
21:54bortrebthank you very much qbg
22:27thunkIf I search for "swank" on clojars, swank-clojure is a result. But if I search for "swank-clojure" is doesn't come up. Is there something I'm missing, or is this a bug?
22:50ihodesi came here to vent for a moment.
22:51ihodesi wrote the Game of Life, for funsies, using a sparse array and cool stuff in about 20 minutes or less, about 30 lines of code and all sorts of fun functional awesomeness.
22:52ihodesbut then i start up a new buffer, in the ns gol.gui. that's when things got bad. the mindset you get into writing functional code != the mindset you need when dealing with swing. it's like going from zen meditation to running zig-zags through a minefield while singing Amazing Grace backwards. it's awful.
23:05technomancythunk: clojars search is not so hot
23:06technomancydefinitely needs work
23:06technomancythunk: that would actually be a great place to send patches, if you're looking for projects
23:06thunktechnomancy: Excellent. I'll take a look.
23:07technomancythunk: hop on the clojars-maintainers mailing list; be sure if you do some hacking you build on kotarak's work
23:08thunktechnomancy: Ok, will do
23:08technomancyproblem with clojars is the maintainer is rather unresponsive =\
23:10thunkHrm. Maybe I'll make myself annoying :)
23:12technomancyit's a valid strategy
23:12ihodestechnomancy: any news re: new clojars server?
23:12ihodesnothing new on the mailing list.
23:12technomancyihodes: nothing. =(
23:26ihodestechnomancy: sadface :( i may not have time to get acquainted with everything once the term begins
23:40Rayneschouser: Indeed. Class count is rising every time.