#clojure logs

2010-06-17

00:06danlarkindon't think that's possible?
00:06technomancydanlarkin: someone was talking about adding a way to do that, but I guess that'll be a future version.
00:07danlarkinIIRC steve's import rewrite was able to get a DAG of namespace deps and do appropriate things
00:07danlarkinor maybe that was for requiring, not compiling
00:07danlarkinmaybe it applied to both
00:08technomancyit was just for requiring, but it would probably make the compiling change easier.
00:27technomancybehold--the new Leiningen tutorial: http://github.com/technomancy/leiningen/blob/master/TUTORIAL.md
00:27technomancyfeedback welcomed
00:29ohpauleeztechnomancy: I'll check it out in a little bit and shoot you a message for sure
00:30technomancythanks!
00:30dnolentechomancy: you should say something about install no? Easiest way hack on other people's libs.
00:31dnolentechnomancy: oh I see it. you do mention it.
00:36ohpauleeztechnomancy: looks awesome.
00:36ohpauleezIs there a difference between :namespaces and :aot
00:37remledufftechnomancy: If you've got a SNAPSHOT version, does it actually go out and check every time you run lein deps, or just once per day?
00:43technomancyohpauleez: no, no difference
00:43ohpauleezcool
00:44technomancyremleduff: oh, it's once a day. I will mention that.
02:06vIkSiThmm, whats the best way to read a file till its EOF with this approach : http://paste.lisp.org/display/111521 ?
02:06vIkSiTthis only ends up reading each line..
02:10tomojthat looks strange
02:10tomojthe prn will return nil, so you're calling nil as a function?
03:10LauJensenMorning team
03:22simloovoogood morning
04:17LauJensenlpetit: !!
04:18lpetitLauJensen: hello Lau. Why '!!' ?
04:19LauJensenBecause I just installed a fresh Eclipse and CCW on my Arch box, and there's no auto indent! You promised Laurent, you promised me I wouldnt have to indent all my code manually anymore!
04:22lpetitthere is auto indent, I didn't lie.
04:22lpetitauto indent is automatically triggered when you hit Enter. And you can also trigger it "manually" by hitting the Tab key from anywhere in the current line
04:22lpetitBut
04:23lpetit(there's a but)
04:23lpetitthe feature (as well as other features in the editor) works only if you have a well structured text in the editor (basically : correctly closed literal strings, correctly balanced parens / square brackets / ... )
04:24lpetitWhich version of CCW are you using ?
04:24eevar2eclipse is evil
04:24lpetitBTW: I made no promise, I informed you, that is :-p
04:24eevar2really, go with any other ide
04:24LauJensenlpetit: Im just joking, Im not upset, I just wanted to get your attention :)
04:24LauJensen(defn disappointment
04:24LauJensen []
04:24LauJensen(+ 2 2))])
04:24clojurebot4
04:25LauJensenI didnt add that final square bracket
04:25lpetitsorry I don't understand
04:25LauJensenOh wait, yes I did
04:25LauJensenWhen you write (defn x [. Do you guys then hit right-arrow to step past the closing ] in the argument list?
04:26tomojjust hit ]
04:27TweyYeah, I was about to say…
04:27LauJensenThats what I did, causing that extra ] at the last line
04:27tomojnot emacs?
04:27tomojwait, hmm
04:27lpetitLau: if you're accustomed to paredit in emacs, you should switch from the "default" mode to the "advanced" mode (I myself always am using the advanced mode)
04:27TweyAre you using electric-parens or something?
04:27LauJensenlpetit: hot key for that?
04:28tomojoh, eclipse, I see :P
04:28Chousukelpetit: what's the difference? :/
04:28lpetitLauJensen: Yes. For switching the edition mode just for the current editor : Alt + D (D as "Default")
04:28LauJensentomoj: Yea just checking out Laurents progress :)
04:28LauJensenok, thanks lpetit
04:29lpetitLauJensen: if you want to have all your editors open in advanced mode in the future, go to the Window > Preferences page, then Clojure > then Editor smth, then see where in the conf page it's talking about structural edition mode, then change the default
04:30LauJensenk
04:30lpetitLauJensen: you can see the current mode of the editor in the status bar. Notice the tooltip explanation when the mouse hovers over the corresponding text. Notice you can also double click on this text to swith the mode for the editor which is currently selected
04:31LauJensenStrict mode is much better
04:31lpetitLauJensen: I agree, I'm now accustomed to it ! I introduced default mode with the intent to not break "newbies" habits.
04:32LauJensenlpetit: I am strongly pursuaded that newbie-habits should be broken at all costs :)
04:32LauJensenI've never understood this crazy desire to stoop to the lowest level possible in order to bring in the horde
04:32LauJensenBut perhaps thats just me
04:32lpetitLauJensen: note that some keyword shortcuts are not the same as in emacs. I had to adapt to what Eclipse already offers, and had to not overlap with eclipse existing ones
04:33lpetitLauJensen: activate the help when in the editor (F1 on Windows, Ctrl +F1 on Ubuntu, Help keyboard key on Mac). You'll have the whole story about provided keyboard shortcuts
04:34LauJensenCool, that'll come in handy. I assume Arch is similar to Ubuntu in that regard
04:35lpetitLauJensen: my favorite ones : Alt + R for raising the selection (or the form just after the cursor) over its parent: it's then veeery easy to switch from (spy (my expr)) to (my expr). Place the cursor before the opening paren of (my expr), hit Alt + R, "et voilà" !
04:36lpetitLauJensen: second favorite : structural selection. Shift+Alt+ ... RIGHT_ARROW: expand to right sibling, ... LEFT_ARROW: guess that one, ... UP_ARROW: expand to enclosing form, .... DOWN_ARROW: undo previous selection expansion
04:36zmilawhat is the difference between the modes, lpetit?
04:37LauJensenlpetit: Ah ok
04:38LauJensenlpetit: It seems like your paredit mode, doesnt recover if there has been a structural error, and that is then removed
04:38lpetitzmila: default tries to not introduce "editor behaviour" which may "force" user to have prior knowledge to be able to continue its work. e.g. "default mode" does not prevent the user from deleting a single paren in a pair. "default mode" does not jump after the closing paren/square bracket/... because people accustomed with other editors in Eclipse would be somewhat lost
04:38lpetitLauJensen: disagree. Currently the editor's content is always reparsed after each keystroke, so there's no state accumulation.
04:38LauJensenlpetit: Then I think you have a bug
04:39zmilawhich mode to use, when i habit to type both parens: [], your editor always adds the second []]
04:39lpetitLauJensen: much more viable option. Corner case ? What exactly did you do ?
04:39LauJensenlemme see, sec
04:40hoecklpetit: btw, good work, I just tried ccw out of curiosity this morning and, as a total eclipse noob, I was able to get ccw and a clojure repl running
04:40lpetitzmila: you're right, in default mode I should not add the closing one. Would you please file an issue for that ?
04:41lpetithoeck: and when you'll be (maybe) doing both java projects and clojure projects, you'll see that ccw respects the "projects semantics" of eclipse well.
04:42LauJensenlpetit: "(defn i-miss-emacs []" that will then produce "[]]", push that extra bracket ahead of the cursor as you move to the next line and write "(+ 2 2)", and will then not be indented. Remove the excess bracket, and ENTER down to the next like "(+ 2 2)" that will not be indented either, but now there are no errors. Only happens in default-mode.
04:42lpetitzmila: switch and try the advanced mode.
04:42zmilayea, i prefer the strict mode
04:42hoeckI'm shure that I won't leave emacs anytime soon, but how knows what will happen when I finish university
04:43lpetitzmila: yeah. What I also like about it is that when you hit the closing paren, it will also e.g. remove spaces between this paren and the previous closing one, somehow cleaning up the code at the same time
04:43zmilalpetit, how about code folding?
04:44lpetitzmila: currently not identified as a top priority
04:45zmilaand refactoring? select sexpr - press C-A-m - extract function, or extract binding - if inside (let [] ...)
04:45lpetitI'm considering that currently ccw has "the minimal survival stuff" I wanted to provide as quickly as possible (though there is a missing part: history in the REPL). And I'm currently refactoring the "structural edition" code so that it will accept to work with an incremental parser. Hopefully this incremental parser will lay out the foundations for having real static code analysis in ccw.
04:47lpetitzmila: ^^^ will be the building block required for being able to go fast concerning all static analysis features: refactoring,
04:47lpetitetc.
04:47zmilaok
04:49lpetitLauJensen: oh sorry, I almost missed your last entry ^^
04:49lpetitLauJensen: but you don't have the closing paren ?
04:51LauJensenlpetit: well, it compiled
04:51LauJensenSo I think I did
04:51lpetitLauJensen: ah. Was just reacting to the example you posted.
04:52lpetitLauJensen: still have the bad code around in the editor ?
04:52LauJensenyea
04:52LauJensenquery
04:52lpetitLauJensen: go to the offending line, and hit Tab to see what happens
04:53LauJensenNothing - I think its because when you hit enter on a line thats not indented correctly, then the indenting is not fixed, causing all lines below to have the same bad indentation
04:58lpetitLauJensen: yes the indentation is automatically "fixed" for the new line, not for the existing line
04:59lpetitmust leave the area, thanks for the chat, and don't go back to emacs ;-)
04:59LauJensenlpetit: I never left :)
04:59lpetit:)
04:59LauJensenlpetit: one last thing
04:59LauJensenHow do you tab between the windows, ie move focus to the repl ?
05:07zmilaCtrl+F7
05:07LauJensenthx
05:08zmilaCF
05:08zmilaC+F7 - between window and Console (REPL), C+F6 - between editing windows
05:23RaynesWhat is the separating of words by hyphens in Clojure called? Assuming it has a name, like camelcase.
05:24ceptorialwould someone mind enlightening me on exactly what something like (defn foo [& args] ...) means, as far as the & args? i'm having trouble finding good documentation on that
05:25ceptorialdoes it mean that (foo 1 2 3) will put '(1 2 3) in args or something like that?
05:25ceptorialor does it mean optional?
05:25Raynes& args means "put the rest of the args in args". If you do (foo 1 2 3), in foo, args will be a sequence containing those args.
05:25ceptorialor that there can be multiple values? or what, exactly...
05:26Raynes$(letfn [(foo [a b & rest] (apply + a b rest))] (foo 1 2 3 4 5 6))
05:26sexpbot=> 21
05:27RaynesIt's just a way of letting a function take an arbitrary number of arguments. It can be even more useful with destructuring, especially the new optional keyword argument destructuring in 1.2 that allows for you to do default argument-like stuff.
05:29Raynes$(letfn [(foo [a b & [x y & rest]] (+ a b (apply * x y rest)))] (foo 1 2 3 4 5 6))
05:29sexpbot=> 363
05:29ceptorialwoah
05:30ceptorialis :as for function arguments only 1.2?
05:30LauJensen,(clojure-version)
05:30clojurebot"1.2.0-master-SNAPSHOT"
05:30LauJensen$(clojure-version)
05:30sexpbot=> "1.2.0-master-SNAPSHOT"
05:30LauJensenhmm, dunno
05:30LauJensenDont think so
05:30ceptorialright i didnt think so
05:31ceptorialRaynes that was very helpful, thx
05:31Raynes:as works in 1.1, I believe.
05:35LauJensenClojure> (let [{:ke­ys [a b :as c]} {:a 5 :b 10}] c)
05:35LauJensenjava.lang.Exception: Unsupported binding form: :as
05:35LauJensenClojure> (clojure-v­ersion)
05:35LauJensen"1.1.0"
05:35LauJensenfrom: http://tryclj.licenser.net/
05:36ceptorialinteresting -- same thing for functions?
05:36LauJensenits the same code being run, so yes
05:36ceptorialcool
05:40RaynesLauJensen: The try-clojure.org domain isn't down, is it? :o
05:40LauJensenNope
05:40RaynesThey both point to the same thing.
05:41LauJensenDidnt know
05:41Raynes<3
05:46Licenserwhat where ?
05:46LicenserLauJensen: http://try-clojure.org/ is the official domain now :P
05:46LauJensenok - you guys going to wrap up that tutorial and throw it on HN ?
05:47RaynesLauJensen: It was on HN ages ago.
05:47LauJensenWould be great if you made the REPL graphical, do stuff like (slurp* "http://bestinclass.dk/logo.png&quot;) :)
05:47Licenserwatis hn?
05:47LauJensenhttp://news.ycombinator.com
05:47Licenserah
05:47RaynesAs for the tutorial, it's stagnated right this second. I'm going to talk to defn about maybe doing some sort of learnyouaclojure with embedded tryclojure.
05:47LauJensenRaynes: Im not saying that it wasnt on HN, Im just saying improve it a little and do it all over again
05:48LicenserI like the syntax highlighting :P
05:48LauJensenAlso would be great if you could tap into html5's audio, and have Raynes do his thing with the Banjo in the background
05:48RaynesIf that doesn't work out, the tutorial will be revamped, wrapped up, and other stuff will be done.
05:48LauJensen(set! raynes :playing)
05:48RaynesThat was a clever one.
05:49Licenserand then we use html5 video and have defn dance in the background to it?
05:49LauJensenLicenser: Thats the stuff that sells tickets
05:49RaynesAbsolutely.
05:50Licenserhmm but we don't sell stuff on try-clojure, it is totally a bad deal there :P
05:50RaynesBut yeah, I'll know where to go with the tutorial in a couple of days. defn was interested a while back in being a part of a artsy Clojure tutorial (with dolphins nonetheless), so if he's interested in something like that now, we may go in an entirely different direction.
05:51Licenserand you didn't liked me texts *cries*
05:51RaynesSure I did. I just haven't touched that thing in ages.
05:51RaynesProcrastination is a disease with no cure. ;)
05:52Licenseryea sure I'll fly to the us just to put a fart pillow under your chair!
05:52LauJensenRaynes: I think the trick is, to unleash enough power that new-comers will really see how hard of a punch a few lines of Clojure packs. Like parsing the logs for the try-clojure.org site in a couple of lines would be cool.
05:52LicenserLauJensen: we have logs? :P
05:52LauJensenLicenser: eh?
05:52RaynesNo logs, but that would be impressive.
05:53LauJensenApache? :±
05:53LicenserLauJensen: yes of cause, apache 2
05:54LauJensenAnyway, you can loot from bestinclass.dk if you want, I have a few lines that do some cool stats on an access.log - of course thats a log from a proper webserver
05:54LauJensennot a slow outdated outperformed ancient and antique beast such as apache
05:54LauJensenLicenser: You meant a Virtual Host XML entry?
05:55Licenserwell not exactly they are on different hosts, the host try-clojure runs on isn't connected via anything but ssh to the interwebs
05:55Licensertecnically apache2 is running as a proxy
05:57LicenserLauJensen: btw http://bestinclass.dk/logo.png is a 404
05:57LauJensenLicenser: ok :)
05:57Licenserit does not do squat itself
05:57Licenserand to be frank I know how apache works better then I know how any other webservery thing works :P
05:57Licenserand the comparable high memory footprint isn't an issue at the moment
05:58LauJensenIts been about a year since I last had my hands in the engine room of an Apache - My life got easier after I switched to ngin
05:58LauJensenx
05:58LauJensennginx
05:58LauJensen:)
06:00Licenserin what respects is nginx better? I'm not at all opposed to switch
06:00Licenserapache is like the H-Bomb amongst the webservers o.O
06:01Licenseractually I'm always for trying out new nifty crazy stuff :P
06:02LauJensenLicenser: Its very simple to set up, has a simple yet powerful and extendable config language. The server itself is slim and high performant and incredibly reliable - I've never had it slowdown or crash on any installation.
06:02LauJensenAnd you'll find that red thread in almost all tools I use: Simplicity, simplicity, simplicity
06:02Licenserheh
06:03Licenserhmm I'll look into that
06:03LicenserLauJensen: trust me I am all for simpleicity :P
06:03LauJensenhttp://www.joeandmotorboat.com/2008/02/28/apache-vs-nginx-web-server-performance-deathmatch/
06:03LauJensenjust some perf benchmarks
06:04LauJensenLicenser: I have a pretty complex rewrite which allows my old wordpress links to still work on the clojure driven bestinclass.dk, took a very short amount of time to make the rewrite in nginx
06:05Licenserneat
06:06LauJensenrewrite ^(.+)(\.php)(.+)$ http://www.bestinclass.dk$1.clj$3.html last;
06:07RaynesLauJensen: Impressive work on bestinclass, by the way.
06:08LauJensenRaynes: Thanks a lot :)
06:10unfo-hoom! you opensourced the blog-stuff. Interesting *strokes beard*
06:11unfo-ooooh and you do euler too!
06:15unfo-LauJensen, never-ever did I think of using matrices for fibonacci (re: ruby euler 25) thanks for this :)
07:59LauJensenunfo-: np :)
08:28jarturGood night everyone.
08:28LauJensenNight :)
08:29jarturDoes anybody participate in ICFP PC?
08:29jarturI mean going to =)
08:45LauJensennaah, too easy with Clojure
08:46bobo_icfp?
08:46bobo_ah
08:50jarturLauJensen: you don't know the problem yet =) It may be something difficult independent of the language
08:51LauJensenjartur: Naah, Im sure there's a function for it
08:51jarturLauJensen: Heh, some functions are damn hard to come up with.
08:51LauJensen(jarthur Im just kidding, I hope you know)
08:52lpetithi, anybody has more info on GWT-clojure than what can be found on the blog entry ?
08:52jarturI think I'll spend two days solo on the problem if I like it. But I don't think I'll be able to solve it anyway. Just have a mental exersise.
08:52clojurebotPeople have a problem and think "Hey! I'll use a regular expression!". Now they have two problems....
08:52LauJensenExactly clojurebot
08:53LauJensenlpetit: Last I heard it wasnt usable
08:54jarturAre there any GUI frameworks for Clojure in the works? Just curious.
08:54bobo_GWT-clojure? that sounds interesting?
08:55_fogus_jartur: I've been mulling over a Shoes-like GUI framework, but like many things it's just a seed at this point
08:55jarturMaybe something like XAML without XML. Though it's not a small task probably.
08:56LauJensenjartur: Swing, AWT work well. Qt works OK, Web is my preferred UI
08:56jartur_fogus_: Shoes-like is good. Especially when you need a relatively simple GUI.
08:57jarturLauJensen: I mean some abstractions over Swing. Like they build interesting stuff in Haskell world.
08:57LauJensenhehe
08:57jarturSomething declarative would be nice.
08:57_fogus_jartur: I had the start of it in the book, but I would love to explore it further.
08:58jartur_fogus_: What book?
08:58cemerickGWT seems magical, but isn't it sorta bad just on spec?
09:00eevar2hmm... the icfp scoreboard for 2009 doesn't list languages?
09:00eevar2and 2008 was won by a Java team :p
09:01jartureevar2: icfp pc 2009 was kinda badly organised. I hope this year would be better.
09:01jarturAnd icfp is usually won by c/c++ teams.
09:01jarturIt's "oh teh irony".
09:01_fogus_jartur: http://joyofclojure.com
09:01eevar2for some reason i thought ocaml always took the first X spots
09:01LauJensenjartur: Its not ironic. Only employed developers have time for ICFP :)
09:02LauJensens/employed/unemployed/
09:02sexpbotjartur: Its not ironic. Only unemployed developers have time for ICFP :)
09:02jarturLauJensen: Also C++ hardcore programmers are usually VERYhardcore
09:02LauJensenYea, harcore++
09:02LauJensensigh
09:02LauJensens/harcore++/hardcore++/
09:02sexpbotsigh
09:02jarturLauJensen: And most of 'sport' coders are on C++. With strong bg in algorithms and so on
09:03jartur_fogus_: Ah, didn't read it yet. Does it worth buying in your honest and not opitionated opinion? =)
09:04LauJensenjartur: I would say its definitely worth buying
09:04rysit's not just unemployed devs. me and my friends take the Friday and Monday off over the ICFP weekend to do it
09:04rhickeyso, I've got a build of Clojure and contrib here with .equals based equality
09:05rhickeythe biggest problem I see is not with the collection equality, no one seems to care if (= [1 2 3] [1.0 2.0 3.0])
09:06rhickeypeople frequently seem to expect (= 2 2.0)
09:06LauJensenSo whats the biggest problem ?
09:06jarturrhickey: that's bad for them
09:07jarturrhickey: because you can't test floats for equality at all
09:07rhickeyall such code would have to become (== 2 2.0)
09:07LauJensenah, so you're introducing a new operator
09:07cemerickno, == has been around almost forever
09:07cemerickrhickey: so = would literally just be an .equals call?
09:08rhickeycemerick: with a nil branch
09:08cemerickright
09:08rhickeythat's how it used to be
09:08cemerickbefore equiv and such, you mean?
09:08rhickeyright
09:08cemerickwas that in 1.0?
09:09rhickeyno, way back
09:09cemerickthe memory fades :-)
09:09rhickeycould be before your time
09:10cemerickProbably not :-)
09:10cemerickwell, maybe, depending on whether you added equiv before clojure was made public
09:10cemerickanyway -- backing off to hosty = is a big deal
09:11LauJensenrhickey: Whats the motivation for this change?
09:11jarturHmm, what is the semantics of (= 2 2.0) or (== 2 2.0) in code?
09:11rhickeycemerick: how is that hosty? equiv is .equals for the vast majority of cases
09:12rhickeyhttp://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/Util.java
09:12rhickeyit really is strictly about numbers
09:13jarturWhy would people want to test floating point numbers for equality?
09:13cemerickright -- the improved sanity of numerics is a big deal
09:13rhickeynow, with uniform boxing, you rarely see 2 different boxed representations of 42
09:13rhickeycemerick: which is more sane?
09:14rhickeyand all different representations look different: 42 42N 42M 42.0
09:14cemerickrhickey: well, the jury's out, I suspect. (= 3 <any float>) is just a little crazy if you know what floats are built with.
09:15cemerickAnyone who isn't versed in that stuff at all will think (= 3 3.0) should work (despite the host's semantics)
09:15cemerick(just look at all the people using floats for financial calculations)
09:16rhickeywell, the big problem is that this is a significantly breaking change, given that usage
09:16cemerickright
09:17LauJensenIn a dynamic language, I'd say (= 2 2.0) is true, makes the most sense
09:17cemerickIf == retains equiv semantics, then it's reasonable to argue that people should have been using that all along.
09:17jarturLauJensen: how so?
09:17cemerickLauJensen: floats are floats, dynamic language or not.
09:17LauJensenjartur: I dont care if they are ints or float, just of they equal "two"
09:17rhickeycemerick: that's how I feel when looking at the breaking code
09:18jarturLauJensen: (= 2 1.9999999999998) is also true?
09:18jarturLauJensen: When you write 2.0 it's not what you will end up in memory
09:18cemerickrhickey, dragging people into CS by the collar, one by one ;-)
09:18jarturLauJensen: If it's not BigDecimal of course
09:19rhickeycemerick: the thing is, up to this point, everything in prim/num is highly backward-compatible
09:19cemerickrhickey: this is to aid prim/num and such, or are you just trying to simplify stuff
09:20rhickeycemerick: simplify
09:21rhickeynot just implementation or call-path complexity, but subtlety of equiv/equals pokes its head out often
09:21cemerickright
09:21jarturI hope we will not end up with = eq equal eqv ==
09:21rhickeyjartur: we won't
09:21eevar2meh. force people to round their floats before comparing
09:22cemerickrhickey: so, my point about calling it hosty was that another host that has different numeric semantics than the jvm, or perhaps already provides some variant of equiv in its .equals will get messy.
09:22jarturor use Decimal types
09:22dsophmm clojure dies if I try to get the 100th element of lazy seq that is recursive defined using a simple function
09:23Chousukedsop: show the code if you want help :)
09:24dsopChousuke: http://gist.github.com/442107
09:24rhickeycemerick: I can always add the type distinction on that host. Now we're paying to remove it all the time
09:26Chousukedsop: looks fine to me. it runs out of memory or what?
09:26cemerickrhickey: Not sure I follow. If = -> .equals, and Host X's .equals performs some equivalency tests on numerics, are you then saying that the clojure impl for that host would catch those numeric types in the impl for =, handle them differently to match jvm semantics, and then pass on to the host's .equals?
09:26dsopChousuke: it takes forever to calculate
09:27rhickeythe big risk of moving equiv to == is that there may be pressure to introduce the 'test' for functions that do = internally
09:27dsopChousuke: and i wonder why http://gist.github.com/442107 doesn't work
09:27Chousukedsop: partial returns a function
09:28rhickeycemerick: yes. I am not saying that = *is* host .equals, just that numeric = will include type. That happens to match Java
09:28Chousukedsop: maybe the ratios are slowing you down
09:28Chousukedsop: try using doubles
09:29jarturdsop: Chousuke may be right. You will have enormous numbers on 30th iteration.
09:30Chousukeratios get really slow when they grow big. or small
09:34cemerickrhickey: And CLR, and "native" hosts will likely follow the jvm's semantics, or be made to fairly trivially. Seems good to me.
09:35jarturBefore clojure I would never use emacs. Today I'm in IRC with ERC... Though I still think that emacs is full of legacy.
09:35rhickeymeh, several Incanter tests fail due to (= 2 2.0) => false
09:35cemerickrhickey: that's not a regression, they're bad tests ;-)
09:36rhickeybut the rest of argos passes just fine
09:36cemerickThe only issue might be opaque equality checks, where you really don't know what types you might be working with.
09:36rhickeycemerick: that's what == will cover
09:37cemerickrhickey: I mean where you might have non-numerics flowing through too.
09:37LauJensenIf people generally have used = where they (we) should have used ==, isnt this a sed// fix ?
09:37rhickeycemerick: right, that's where the whole 'pass the test fn' problem seeps in
09:37_fogus_rhickey: So only an Incanter test fails? I wonder if that represents actual expectation
09:37jarturBtw, does anybody work on CLR support? Just sayin'
09:37cemerick(= a b) => (or (= a b) (and (number? a) (number? b) (== a b)))
09:38rhickey_fogus_: I looked now, now of the fail comparisons are in Incanter lib code, only in the test code itself, so, yes, could just be weak tests
09:38cemerickjartur: David Miller is the point man for that. I don't think he's in the channel much.
09:38rhickeynone of
09:39rhickeycemerick: the order is swapped, plus collections of same
09:42rhickeywhatever the correctness of this new semantic, it remains a difficult change due to the undetectable breakage. People shouldn't in fact be switching to == everywhere, but become more cognizant of the numeric types in play
09:43rhickeyI really like the current world where you just use = everywhere
09:44LauJensenYea that makes two of us
09:45rhickeybut code that does (= 42 (some-fn-that-returns-a-float)) is just lazy and wrong, but currently works
09:47cemerickrhickey: I think a strong case could me made that current = behaviour is a huge help for most programmers.
09:47rhickey20080213 Release 'made = use equiv for Numbers' http://groups.google.com/group/clojure/browse_thread/thread/3e4fb7cfc458b31e/d1e3e02d5b677ef2?q=equiv+group:clojure
09:47jarturAs I thought with CLR working with generics is a problem. And I suppose a huge one.
09:48dsopChousuke: any way to avoid them? i probably should use doubles instead? thanks for the hint ill try it!
09:48cemerickrhickey: OK, ever so slightly before my time :-)
09:51rhickeycemerick: yes, currently they only trip up when using numbers as keys, and most of those will be fixed due to consistent boxing. Few people complain about =
09:52rhickeybut = is used often and the current logic is pretty heavy for such an important thing
09:52rhickeyeven dropping the collection special handling would help things, but muddy the semantics
09:55LauJensenrhickey: are you considering making the change, or looking for way to make an easier transition ?
09:56Raynes_fogus_: Interesting interview questions. The zombie vs vampire one was *tough*. ;)
09:56rhickeyLauJensen: I'll probably push to yet another branch, so people can evaluate that change separately from the work in num, but it's all done
09:57LauJensenOk great
09:57LauJensenrhickey: Have you decided on what constitutes 1.2 yet ?
09:57LauJensens/constitutes/goes into/
09:57sexpbotrhickey: Have you decided on what goes into 1.2 yet ?
09:57rhickeyLauJensen: I'm going to write up all this work and solicit feedback
09:57LauJensenk
09:57_fogus_Raynes: ;-)
09:57rhickeyI gave a talk last night on prim/num, was well received
09:58LauJensenrhickey: video/mp3 up somewhere?
09:58rhickeyno
10:03pjstadigrhickey: when will you learn? you must video every talk you give :)
10:03pjstadigyou're a rock star now
10:04rhickeypjstadig: since I wrote the talk on the car ride on the way to the city, would have been a bit plucky to record it :)
10:05anarsyou aware if anyone else recorded it?
10:05rhickeyanars: no
10:07rhickeyso, no one has complained about the loss of auto-promotion
10:08cemerickN and M syntax along with autopromotion helps
10:11raekhow will I know when to use 1 and 1N in my functions?
10:11raekdoesn't that depend on how large numbers the caller needs?
10:41jwr7rhickey: just wanted to say that the num branch is a Big Deal for some of us (like myself), even though we stay quiet most of the time. Now, if only somebody implemented efficient sparse vectors and sparse matrices...
10:52rhickeyjwr7: great!
10:53rhickeyraek: if the caller has passed you a bigint, doing arithmetic with it and 1 will yield a bigint
10:54rhickeyraek: polymorphic math is still there
11:13raekrhickey: ah, I see... then I have no problem with the loss of auto-promotion
11:33raekrhickey: my factorial function yields a negative value when I give it 26N or greater: http://gist.github.com/442269
11:33raekrhickey: is this a bug?
11:35rhickeyraek: yes
11:36bagucodeWhat is a good way to get the class that a symbol represents if you have the symbol? eg. getting java.lang.String from the symbol String. (eval 'String) works but seems a litte yucky
11:41raekclojure.lang.RT/classForName is used in clojure.contrib.core/new-by-name
11:41raekhttp://github.com/richhickey/clojure-contrib/blob/9f448420b082ce8a6e577696df5203a405f4e8d4/src/main/clojure/clojure/contrib/core.clj#L71
11:42yacinhow big of a file would you need to see a performance benefit from using mmap/slurp over clojure.core/slurp?
11:51bagucoderaek: Was that classForName tip for me? It doesn't work :( It works the same as regular java Class/forName. What I want is a way to get the class from a single symbol. I already figured out that eval works so I was curious if there is a better way.
11:52hoeckyacin: "For most operating systems, mapping a file into memory is more expensive than reading or writing a few tens of kilobytes of data via the usual read and write methods. From the standpoint of performance it is generally only worth mapping relatively large files into memory."
11:53hoeckyacin: from http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html
11:54raekbagucode: have you tried passing the symbol through (name)?
11:54raek(Class/forName (name 'java.lang.String)) <-- this works for me
11:55yacinhoeck: thanks
11:57bagucoderaek: Yes that works, but that's not what I want. I have a symbol that is a single word which corresponds to an imported class so I don't have the whole class name available. Otherwise (name ) or (str ) would work
11:57bagucoderaek: (Class/forName (str 'String)) will not work
12:01bagucodeWhen I think about it maybe I don't really mind using eval in this situation. I want the symbol evaluated after all.
12:07raekbagucode: ah, ok. now I see what you mean
12:08canderabagucode: does ns-map help?
12:09candera,((ns-map *ns*) 'Thread)
12:09clojurebotjava.lang.Thread
12:10candera,(type ((ns-map *ns*) 'Thread))
12:10clojurebotjava.lang.Class
12:10bagucodecandera: Yeah, that's what I was looking for. (eval 'String) is shorter though ;) but there is that eval smell coming from it
12:11canderas/eval/evil/
12:11sexpbot,(type ((ns-map *ns*) 'Thread))
12:11clojurebotjava.lang.Class
12:11candera:)
12:12Hoornethello!
12:12HoornetI am new here (and new in Clojure)
12:12canderaHoornet: Welcome!
12:12HoornetIs clojurebot returning libraries?
12:13HoornetThank you
12:13canderaHoornet: if you're asking what clojurebot does, one of the things it does is to evaluate expressions that are prefixed by a comma:
12:13candera,(str "example")
12:13clojurebot"example"
12:13Hoornetaha!
12:13Hoornettnx
12:13canderaNP
12:14bagucodecandera: Switched to the ns-map solution. Can't stand eval in the code :)
12:14Hoornetso it's like a one line only REPL
12:14Hoornet?
12:14canderabagucode: Yeah, I would feel dirty, too. :)
12:15raekbtw, is the #=(...code...) reader macro deprecated?
12:15raekI don't see it on the clojure.org/reader page any more
12:15canderaHoornet: Well, since Clojure doesn't use newlines as delimiters, I'm not sure the "one line only" distinction matters. But it reads, evaluates, and prints an expression, yes.
12:15cemerickHoornet: yeah, good to show examples to people, etc. without opening a gist
12:16Hoorneta very nice touch :)
12:16alpheus,(str
12:16clojurebotEOF while reading
12:16alpheus"example")
12:17alpheusheh
12:17Hoornetthat's what I meant with one-liner
12:17Hoornet:)
12:17canderaHoornet: yeah, I understood eventually. I'm a little slow.
12:17candera:)
12:19HoornetHmm. I'm traing to get into functional programming but really just can't decide how to start. There is soo much really good stuff here I didn't even know existed!
12:19HoornetClojure, Scheme, Haskell
12:19hamzaguys, I am having some problems with multimethods they don't work across namespaces, http://bit.ly/alLhvA
12:20hamzaanyone have any ideas?
12:20HoornetSo like a madman I'm sqwitching among all of them tryind to decide which one to really lern first :)
12:21dnolenHoornet: you've got your homework cut out for you :) Clojure, Scheme, and Haskell are all pretty different
12:21cemerickouch. That doesn't sound fun. :-)
12:22cemerickScheme and clojure at the same time is particularly difficult. I did that for a few weeks once.
12:22raekhamza: double-colon keywords get the namespace of the current namespace
12:22raek,::foo
12:22clojurebot:sandbox/foo
12:22Hoornetyes! That's why I can't decide. They are all very interesting though.
12:22raekin another namespace, you would need to type :sandbox/foo in this case
12:24raekif you have an alias to the other namespace, say (ns ... (:require [sandbox :as s])), you can also write ::s/fo
12:24raek* ::s/foo
12:24raek,(alias 'core 'clojure.core)
12:24clojurebotnil
12:24cemerickHoornet: They're all useful paths to take.
12:24cemerickI'll hazard to say that Clojure is the most "practical" of them, insofar as its at home anywhere a JVM is.
12:24raek,::core/foo
12:24clojurebot:clojure.core/foo
12:25hamzaraek: damm thanks since namespaces names begin with same prefix I missed that now it words. I need to get some sleep.
12:25hamza*works
12:25Hoornetyes, but that is also a little repulsive (java theater, i mean).
12:26cemerickRight, it depends on what your tastes are and context is.
12:26HoornetThere is no context (yet), except I wanna learn the damn thing :)
12:26rhickeyso, another decision point. Currently, recur to prim with object throws, this to highlight the fac tthat you lost 'primitiveness' in intervening ops. In num branch, that will be less likely, and prim locals are automatic, i.e. (let [x 1] ...) makes x a long. In order to facilitate (loop [x 1] ... (recur (:foo bar)) I currently do silent safe convert to prim, with warning when *warn-on-reflection*. Would people prefer the error? It would re
12:26rhickey(loop [x (num1)] ...) if you are going to possibly recur with a boxed number.
12:27HoornetClojure really does look very nice. But so does Haskell. But I believ C,lojure has a more practicle chances
12:28AWizzArdrhickey: Hi! Yesterday your internet conn was not so stable, so I don't know if you got this message:
12:28AWizzArd,[(= 0.5M 0.5 1/2) (= 0.5 1/2 0.5M)]
12:28clojurebot[true false]
12:28Hoornetto use work with as a programmer
12:28AWizzArdbecause of:
12:28rhickeyAWizzArd: fixed already, thanks
12:28AWizzArdah ok
12:28dnolenHoornet: comparing Haskell and Clojure and their comparative usefulness seems like an exercise in futility.
12:28cemerickHoornet: I learned haskell for three weeks or so. It was pretty painful, but good to get a sight of that side of FP.
12:28AWizzArdgood
12:29dnolenHoornet: I think at the end of the day it boils down to 1) taste 2) project requirements
12:29AWizzArdAnd another thing which might be or not be fixed:
12:29AWizzArd,(binding [*print-dup* true] (println (first {1 2})))
12:29clojurebot#=(clojure.lang.MapEntry/create [1 2])
12:29AWizzArdbut
12:29AWizzArd,(clojure.lang.MapEntry/create [1 2])
12:29clojurebotjava.lang.IllegalArgumentException: No matching method: create
12:30raekrhickey: you first line ended with "(...) error? It would re" . I think the IRC server trunkated it.
12:31rhickey. Would people prefer the error? It would require (loop [x (num1)] ...) if you are going to possibly recur with a boxed number.
12:31cemerickdnolen: I think community is a big factor, perhaps bigger than taste. *shrug*
12:31bigwavejakei'm new to clojure. i've got lein installed, but when i run lein deps on a new lein project, i get an error about "Unable to resolve artifact...". I thought lein deps would download and install clojure. Am I wrong?
12:32dnolenrhickey: so if if we go with error do we need explicit cast?
12:32cemerickrhickey: as long as the conversion is safe, then that seems like a no-brainer compared to an error.
12:33dnolenbigwavejake: 90% probably a typo in your project.clj
12:33raekbigwavejake: which dependency?
12:33bigwavejake :dependencies [[org.clojure/clojure "1.1.0"]
12:34rhickeydnolen: well, you have to fix it somehow, either make the local non-primitive or cast yourself on recur
12:35rhickeydnolen: with the warning option (to check yourself), I think the conversion is better
12:35bigwavejakeall i've done was "lein new myapp" and then "cd myapp; lein deps"
12:35cemerickrhickey: what is the warning for? A boxed number doesn't do anyone any good anyways....
12:36rhickeycemerick: you have a primitive loop local, you are recurring with a non-primitive, it could be what you intended or represent an un-noticed inefficiency, masked by the auto-conversion
12:37raekbigwavejake: can you post the complete error message somewhere?
12:37rhickeycemerick: boxed numbers frequently already exist and unboxing them is perfectly efficient
12:37cemerickrhickey: right, but if you're silently converting them, and there's no loss of info, then why a warning at all?
12:38rhickeycemerick: if you've created one accidentally in your local calculation, that might be a mistake you care about fixing
12:39bigwavejakeraek, http://pastebin.com/cuYqJwHZ
12:39rhickeycurrently, the error on recur catches a lot of optimization mistakes
12:40bagucodeI would certainly care about a performance issue due to a mistake I made. But I don't know if I have a preference for warning or error. What I know is I do want one of them.
12:41raekstrange... you can download the jars files from http://build.clojure.org/releases/org/clojure/ and put them in the lib/ directory
12:41raekbut you should not have to do this
12:41rhickeyraek: fixed, thanks. Note that if you want an accumulator that can accommodate bigints you need a boxed ini like this: http://gist.github.com/442269#comments
12:41rhickeyboxed init
12:42rhickeyraek: because 1 is a long
12:51bigwavejakeraek, how should i proceed?
12:51raekI'm afraid that I don't know
12:52raekmaybe you could try to clear your ~/.m2 directory
12:52raekand reinstall leiningen
12:53bigwavejakeok
12:53raekthere is a #leiningen channel, maybe they can help you
12:54bigwavejakethat fixed it!
12:54bigwavejakeweird
12:54bigwavejakeraek, thanks for your help!
12:54raekclearing ~/.m2 ?
12:54bigwavejakeclearing ~/.m2 and lein self-install
13:16rhickeyequal branch available for the intrepid: http://github.com/richhickey/clojure/tree/equal, includes all of prim and num
13:30raekwhat is the rationale of boxed numbers to be non-= ?
13:41technomancybigwavejake: I suspect it was a network hiccup.
14:09rhickeyraek: they have different semantics when used, at least between fixed integers, arbitrary-precision integers, floating point and bigdecimal
14:10rhickeywithin fixed precision integers, different boxed types is an artifact of the host, and uniform boxing should hide that
14:12sclvquick question -- does anybody have any sample code illustrating using clojure with Thrift
14:29technomancywhat ever happened to that =? equality predicate-maker function that was proposed?
14:30rhickeytechnomancy: which was that?
14:31technomancyISTR talk of (=? :foo) returning a predicate for equality to :foo
14:31technomancymaybe that was just idle brainstorming though?
14:31rhickeyah that, didn't go anywhere
14:32technomancybecause #(= :foo %) is short enough?
14:32rshI have a hashmap with a nested hashmap for some key. I want to assoc something to the inner map and return the outer+inner map with the change made...is there a way to do this?
14:32rshan idiomatic way that is
14:32rhickeytechnomancy: no, just not urgent, no consensus as to utility
14:33technomancyrhickey: right, probably better to focus on 1.2 right now. =)
14:33rhickey,(doc update-in)
14:33clojurebot"([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."
14:33rhickeytechnomancy: yeah
14:33rshthanks
14:44cemerickwow, for is gnarly
14:44cemerickdoes it hold onto head?
14:44rhickeycemerick: shouldn't
14:48cemerickmmm, nope, it doesn't.
14:56dnolencemerick: gnarly? I would describe it as pretty cool :)
14:57cemerickdnolen: Indeed it is....but still gnarly enough that it's faster for me to ask about it holding head here rather than just reading the code. :-)
15:07danlarkinI just think of for as doseq, but keeping a list of results
15:08cemerickright...there was a time when for (and others, I think) held onto the head of the sequence being acted upon.
15:08rhickeycemerick: no
15:09rhickeyfor being lazy was always a feature
15:09cemerickno? I seem to distinctly remember that being the case at some point.
15:10cemericklazy, yes -- but none of them should hold onto elements for which a result has already been produced (or reacted to, in doseq's case)
15:10rhickeydoseq and for are completely different
15:11rhickeyfor produced a lazy sequence, and like all lazy seq fns, didn't hold onto the head unless the user did
15:19dnolenso does future always create new thread?
15:21danlarkinit uses the clojure.lang.Agent threadpool iirc
15:22danlarkinugh, but I seem to always be wrong about these things, sooooo maybe it's the complete opposite of what I just said
15:26dnolendanlarking: mostly curious if is at all possible to achieve something like coroutines with future?
15:26dnolendanlarkin: ^
15:28danlarkinmaybe with promise/deliver? Not sure
15:43LauJensen It was mentioned that the * prefix for a function, was not idiomatic for denoting that the function was the driver of a macro or something similar, but did people ever agree on another standard?
15:49yacincan you do :pre and :post with functions defined like clojure.core/+?
15:49yacin([arg1]) ([arg1 arg2]) ([arg1 arg2 & more])
15:52sclvtotal beginner clojure question here -- if I have java object and want to introspect it to see its methods, etc from the repl, what's the easiest way to do so?
15:53sclvI assume there's something nicer than the standard java intospection api
15:57yacinsclv: not sure if it's built-in (probably is) but check this out: http://travis-whitton.blogspot.com/2009/06/method-introspection.html
15:58sclvyacin: thanks. that looks about right.
15:59tomojclojure.contrib.repl-utils has show
15:59tomoj(require '[clojure.contrib.repl-utils :as repl]) (repl/show 3)
16:00islonhow do I set a static java field?
16:00islon"Config.LoggerProvider = LoggerProvider.DISABLED;"
16:01LauJensensclv: C-c I, from the SLIME/REPL
16:01LauJensenGives you a great introspection tool for both Java and Clojure objects and classes
16:01sclveven better :-)
16:02yacinC-c I is niiiiiiice
16:03LauJensenWaaay nice :)
16:03tomojhave to inspect the class to see instance methods, I guess?
16:03LauJensenYea
16:03raekislon: you can use the set! special form
16:03LauJensenOr an instantiation
16:04islonraek: thanks!
16:04raekhttp://clojure.org/java_interop#Java%20Interop-The%20Dot%20special%20form-%28set!%20%28.%20instance-expr%20instanceFieldName-symbol%29%20expr%29
16:09serp_how do I use write-json with an OutputStream?
16:09serp_wrapping it in a (reader) doesn't work
16:10rhickeySome docs for prim/num/equal branches: https://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
16:10rhickeyfeedback welcome
16:19dnolenrhickey: well I saw those notes in person yesterday, great stuff! better to get it in sooner then latter :D especially since Clojure community keeps growing, the later changes like that get in the more painful.
16:20raekserp_: wrap it in a (writer)
16:20dnolenI feel jealous for the newbies if this gets in 1.2, way more sane.
16:20dnolenthey'll never know how we much we roughed it.
16:21hiredmanrhickey: I vaguely recall some traffic about using weakrefs for keywords instead of the current concurrenthashmap, and was wondering if you would be interested in a patch to switch to a weakhashmap of symbols to weakrefs
16:21serp_raek: I meant that I wrapped it in (writer), of course :)
16:21sclvOk I'm confused. I'm trying to create a new instance of a static inner class and failing terribly. Anything to watch out for?
16:21serp_but it doesn't work: java.lang.RuntimeException: java.lang.ClassCastException: java.io.BufferedWriter cannot be cast to java.io.PrintWriter
16:21hiredmanor maybe just rehashing why it wasn't a good idea
16:21sclvoh wait -- I think I have a lead
16:22sclvIt needed to be declared fully qualified.
16:22sclvwhich is mildly irritating.
16:23raekah, then you could use (java.io.PrintWriter. (writer out-stream))
16:25tomojsclv: you have to import the inner class too
16:25tomojif you don't want to fully qualify
16:25serp_hrm!
16:26sclvtomoj -- gotcha. I was expecting if I had OuterClass then I would get OuterClass$InnerClass automatically
16:26tomojyeah, I ran into that too
16:30rhickeyhiredman: maybe, I'm always cautious about weakrefs
16:43yacinwonder why clojure.contrib.math doesn't have log/ln/lg
16:48hiredmanrhickey: so just send the patch to -dev and rfc?
16:59rhickeyhiredman: sure
16:59rhickeythanks
17:17raekwhich thread pool are futures executed in?
17:21raekthe "send" or "send-off" pool?
17:21rhickeyraek: send-off
17:25raekok, thanks!
17:36TakeVSo, :gen-class and proxie are both out of date? What do I use instead of them?
17:41raekyou might be thinking of reify
17:42raekhttp://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/reify
17:42tomojgen-class and proxy aren't out of date.. are they?
17:43kotarakno
17:43TakeVtomoj: I was told so last time I asked about them in here. :\
17:43kotarakthey are not.
17:43raekbut their usage overlap somewhat
17:44kotarakwith reify you can't have superclasses, you can only implement interfaces.
17:44kotarakwith proxy you can have superclass.
17:44raekreify has support for closures, which proxy lack, right?
17:46kotarakno, proxy methods are plain function, ie. closures
17:46raekah, yes
17:46raekproxy is implemented with a map of functions, IIRC
17:52raeksome background: http://www.assembla.com/wiki/show/clojure/Datatypes http://www.assembla.com/wiki/show/clojure/New_new
18:58dnolenhmm
18:58dnolenanyone tried to compile Clojure on an OS X box over ssh?
19:00tomojwhy should it matter whether it's over ssh?
19:01dnolentomoj: I'm getting a could not connect to winder server.
19:01dnolenI always wondered by ant on OS X need to launch a GUI
19:01dnolennow I'm getting bitten by it over ssh.
19:01tomojoh, I see
19:01wwmorgandnolen: try enabling X forwarding (-X or -Y on your ssh)
19:02tomojthe little java icon that shows up in the dock, I guess?
19:03dnolentomoj: in the app switcher
19:05dnolenwwmorgan: thx for that tip, but it looks like I need to setup X11 forwarding perms first
19:07wwmorgandnolen: if you enable X forwarding, do you still get a "cannot connect to window server" error message?
19:08dnolenwwmorgan: yeah
19:08wwmorganhm. Try setting your DISPLAY environment variable to ":0.0" before you invoke ant, if it isn't set already
19:20cemerickrhickey: prim is *nice* :-)
19:24cemerickdnolen: try setting -Djava.awt.headless=true in your ANT_OPTS (or in the build.xml) -- that should avoid any X requirements (and should probably be there by default anyway)
19:24cemerickwwmorgan: howdy :-)
19:25wwmorganhi cemerick, getting up to speed with clojure since about 1.0
19:25cemerickyeah, there's been a lot going on
19:25cemerickAll good, of course.
19:28dnolencemerick: hmm, still no go, I've set that in my .profile
19:30cemerickdnolen: you might have to just add the system property to each <java> invocation in the build.xml depending on whether they're forking or not
19:31dnolencemerick: <sysproperty key="-Djava.awt.headless" value="true" /> ?
19:31cemerickdnolen: FWIW, java.awt.headless isn't an env variable, it's a java system property
19:31cemerickdnolen: sound right :-)
19:31cemericksounds*
19:32cemerickdnolen: and just for kicks, add a fork="true" to the <java> element too, to make sure it's free from whatever ant is actually running with.
19:33dnoleni see what the problem is
19:33dnolenit's all the ui stuff
19:33dnolenthat should be configurable
19:33dnolenant no-ui
19:33cemerickright, the inspector and such
19:33cemerickwell, that's what the headless system property controls
19:34dnolenbut that should just be a build option, right? that stuff is less useful on the server anyway.
19:35cemerickyou mean whether to include it? I wouldn't think so.
19:35cemerickJust about any server-side apps should be run with headless=true for just this sort of thing.
19:36dnolencemerick: yeah but you need to compile clojure first right? why shouldn't there be knobs for that?
19:37dnolenagain clearly not an issue if running on unbuntu in my experience, but I'm setting up a colocated mac mini
19:37cemerickdnolen: building clojure's just another (set of) java invocation, so the headless property should have the intended effect.
19:37cemerickI'll give it a shot on a server, and see what happens
19:37dnolencemerick: but I need to edit build.xml by hand, lame
19:38cemerickheh
19:38cemerickwell, OK, but I suspect this isn't a frequent requirement -- building in a headless environment
19:40hiredmanbuild.clojure.org runs X now?
19:40dnolencemerick: hmm, I guess clojure-contrib needs some fixing in this regard as well.
19:41cemerickhiredman: stuff like the inspector loads swing and such, so that's an AWT thread
19:41dnolencemerick: test_miglayout.clj also givin me trouble in contrib
19:42cemerickdnolen: OK, nevermind, just built clojure HEAD on a headless ubuntu server
19:42cemerickno errors, no build.xml modifications needed
19:42cemerick(which I'm a little confused by, but there it is)
19:43dnolencemerick: it's known OS X issue
19:43cemerickah, OS X only; I didn't catch that.
19:43dnolenyou can't call into AWT classes without triggering a permissions problem
19:43dnolensome of them anyways
19:43cemerickdnolen: link?
19:44dnolencemerick: http://lists.apple.com/archives/webobjects-dev//2005/Jul/msg00582.html
19:44cemerickyeesh, 2005
19:45cemerickokay, that's totally outside of what the headless mode will fix
19:46cemerickdnolen: or, so I thought: http://lists.apple.com/archives/webobjects-dev//2005/Jul/msg00596.html
19:46cemerickheadless fixed it for the next fellow down
19:46dnolencemerick: "plus changes in the code"
19:46cemerick*shrug*
19:47cemerickcan you paste your modified build.xml?
19:48dnolencemerick I just commented out clojure.inspector and clojure.java.browse-ui from compile-clojure target
19:48dnoleneverything works then
19:49cemerickwell, yes, though that's obviously not a fix :-)
19:49dnolencemerick: setting headless didn't work
20:06rustemsunievis there any better way to filter a map? (filter #(and (= (get % :x) 1) (= (get % :y) 3) ) [{:x 1 :y 1} {:x 1 :y 2} {:x 1 :y 3}])
20:26rhickeycemerick: are you trying them in order? prim/num/equal
20:29TakeVHow do I actually use clojure-contrib? :use clojure-contrib?
20:31hamzaguys, how can I add some text to the main index.html created from autodoc? been searching through the docs but no mention yet clojures api docs does it..
20:43nDuffTakeV, do you want something to put in your ns declaration, or to use standalone? For an example of the latter -- some of my code calls (require '(clojure.contrib [mmap :as mmap])), and later uses (mmap/mmap file)
20:43TakeVnDuff: I'm not sure what the distinction is.
20:44nDuffTakeV, ...functionally, there isn't necessarily one. AFAIK it's an aesthetics choice.
20:44nDuff(but AFAIK isn't very far)
20:45TakeVnDuff: Well, then which is easier to manage/use? :P
20:45nDuffI do my requires standalone for easier cut-and-pasting into interactive interpreters.
20:49TeXnomancyTakeV: you use clojure-contrib one namespace at a time. See the ns form at the top of this file where it uses clojure.contrib.io: http://github.com/richhickey/clojure-contrib/blob/master/src/test/clojure/clojure/contrib/test_io.clj
21:21redalastorIf I want the latest clojure, which of the git branches should I be following?
21:24lancepantzmaster
21:24lancepantzthe others are experiments
21:25redalastorIt seems there are lots of experiments lately.
21:26redalastorAre we getting close to 1.2?
21:27rhickeyredalastor: there is a direct line - master->prim->num->equal, not a bunch of true divergent branches
21:28rhickeyjust a question now if people are interested enough in the num stuff to want it in 1.2
21:28redalastorIs there somewhere I can read about the num stuff?
21:28rhickeyhttps://www.assembla.com/wiki/show/clojure/Enhanced_Primitive_Support
21:31redalastorIt sounds very good.
21:39cemerickrhickey: no, I jumped straight to num
21:39rhickeycemerick: ah, you said prim
21:40TakeVSo I'm looking for a good graphics library for Clojure. Does one exist?
21:40cemerickrhickey: I just (sloppily) think of the whole batch of changes as primitive-related
21:40rhickeycemerick: but you didn't go all the way to equal?
22:04bortrebHi, does anyone know what happens when you future-cancel a future? specifically, I'm wondering why (let [fut (future (do (Thread/sleep 5000) (println "Got to here.")))] (future-cancel fut) ) returns true immediately and doesn't print anything, but (let [fut (vector (future (do (Thread/sleep 5000) (println "Got to here."))))] (map future-cancel fut) ) returns (true) immediately but then...
22:04bortreb...STILL prints 5 seconds later?
22:05nDuffdoesn't map return a lazy sequence?
22:05bortrebyes but even putting a doall or dorun causes the same bahaviour; also the REPL should realize the sequence anyway to print it
22:08nDuff...actually, I can't reproduce that behavior.
22:08wwmorganI can't reproduce it either
22:08nDuffon clojure 1.1.0, behavior is what you (bortreb) expect.
22:08bortrebwith or without the dorun?
22:09nDuffcut+pasted exactly as you provide
22:11bortrebthat's weird as I have 1.1.0 as well...
22:14ceptorialhi all.. does clojure.contrib.sql have a way to grab last autoincrement id from the most recent insert?
22:16bortrebI'm sure everyone knows this, but the international functional programming contest starts tomorrow (http://icfpcontest.org/).
22:16bortrebanyone looking to start a team?
22:17lancepantzceptorial: you have to use with-query-results with a sql statement with a RETURNING clause
22:17ceptorialRETURNING?
22:18lancepantzinsert into x ... values ... returning id;
22:20lancepantzceptorial: http://gist.github.com/443115
22:20lancepantzceptorial: that's a function i have that uses the pattern
22:21ceptorialgot it.. but is that supported by mysql? i guess i could just do a separate select last_insert_id();
22:22lancepantzah, i'm not 100% there, we use postgresql
22:24ceptorialgot it.. ok cool, thx
22:24lancepantzdid you find a mysql equivalent?
22:25ceptorialno i think you have to do a separate select last_insert_id();
22:25lancepantzlame
22:26ceptoriali wonder what contrib.sql does if i do with-query-results "insert ... ; select last_insert_id();"
22:26ceptorialalthough maybe it's jdbc that determines that
22:27lancepantzdunno
23:12cemerickbizarre -- I've got a try/finally (with a recur in the try body), where the finally is not being run
23:13cemerickpulling the recur out allows the finally to run :-/
23:15rhickeyIf you have opinions on the enhanced primitive support, please chime in on: http://groups.google.com/group/clojure/browse_thread/thread/c8c850595c91cc11
23:34hiredmancemerick: well, recur is a goto
23:36cemerickhiredman: essentially yeah, but finally is supposed to be run, no matter what happens in the try
23:36cemericke.g. https://gist.github.com/80c5c990b66bf8f04147
23:49hiredmancemerick: but I don't believe finally really exists
23:49cemerickheh
23:49cemerickexistentially?
23:50hiredmanI mean it doesn't exist in bytecode, it's simulated
23:50cemerickright
23:50hiredmaneither way, it's a bug
23:50cemerickyeah, I'm trying to narrow things down
23:55redalastorAfter reading about the num branch, I now want a Haskell target for clojure-in-clojure to get decent types :)
23:57hiredmanhttp://gist.github.com/443208