#clojure logs

2010-05-17

00:06defnanyone here do anything like put jruby and clojure together?
00:07defnim interested in using clojure's concurrency semantics via jruby
00:09technomancydefn: http://github.com/technomancy/clojure-gem
00:10defntechnomancy: yeah i saw that, is that still working?
00:10technomancyI think it's hard-coded to 1.0
00:10defntechnomancy: do you have any example code anywhere?
00:10technomancyand transaction retries break because JRuby wraps the exceptions in a Ruby object, so Clojure is unable to catch them
00:10technomancybut the data structures work great
00:10underdevtechnomancy: clojure-mode 1.7.1 updated in elpa, but clojure-test-mode remains at 1.3 fyi
00:11technomancydefn: more like "feel free to take the whole thing it over"
00:11defnhaha, technomancy is it worth the effort?
00:11defntechnomancy: i think it's mostly me just wishing ruby was, in fact, clojure
00:12technomancydefn: if you have a reason to use ruby still then it's definitely worth it
00:12defntechnomancy: yeah im working with a rails shop now and want to try and slowly mix clojure into things to persuade them to switch :)
00:13technomancyunderdev: weird; I see 1.4 in M-x package-list-packages
00:13technomancydefn: talk to headius about the way that JRuby wraps exceptions and prevents them from getting caught by Java code
00:14technomancydefn: I asked him about it at JRubyConf, and he said he would add a way to turn that off
00:14underdevyeah, it's there now. sorry.
00:15technomancycool
00:16technomancydefn: I don't know if it's possible to work around yet, it might take some prodding Charlie
00:16defntechnomancy: Mr. Nutter, I presume?
00:16technomancythat's the one
00:17defncool. well thanks for the headstart. ill fork and start perusing.
00:17technomancydefn: I haven't really touched Ruby in over a year (and I wrote clojure-gem half a year ago)
00:17defntechnomancy: same here, been obsessed with clojure
00:19technomancygood luck. I hope it can be a gateway drug to get more rubyists into clojure
00:23defntechnomancy: i think we already have a hook in
00:24defntechnomancy: 4/5 of the guys i work with are obsessed with Enumerable, .tap, anything that can make ruby more functional they seem to love
00:24defni think it's only a matter of time
00:25defnspeaking of which, totally loaded question: is there enough clojure consultancy work out there for small clojure shops to survive?
00:26defnI remember hearing S. Halloway's shop was doing something like 30% clojure, but this was a year ago
00:26defnive been thinking about trying to start a small 1-3 person thing
00:26albinoyeah, but is that because he's steering his customers to use that technology?
00:26defnalbino: tough to know, stu is a helluva salesman
00:27defna rational salesman whom i quite appreciate
00:27defnbut a salesman at times, nontheless
00:27albinomy guess is he's got a lot of cusomters who are like "we don't care what you build it in" and he chooses clojure
00:27defnthe web stuff just isn't there with clojure yet which i hope gets remedied
00:27defnhuge chasm of documentation for compojure
00:28defnhonestly my chief concern with clojure in general is lack of documentation
00:30RaynesI'm going to start heavy work on the tryclojure tutorial soon. The tutorial will be example-based and simple like the other ones, but it will not be integrated into the REPL so much that you have to type expressions to move along. Instead, I tend to make most of the tutorial generally useless unless you're trying out the examples for yourself. It will be below the REPL like the other ones, but click-through. I've never really cared for the TryHaskell-
00:30defnit reminds me of _why the lucky stiff's comments on the state of teaching programming
00:30Raynesstyle tutorials. Is anyone opposed to this approach?
00:30RaynesI think people will like it when I'm finished.
00:30defnRaynes: i have some weird off-hand suggestions
00:31defnRaynes: choose your own adventure REPL
00:31RaynesIf people don't like it, it shouldn't be very hard for someone to go ahead and force REPL-usage, but I don't really care for that idea.
00:31RaynesEh?
00:32defnRaynes: im sort of a code romantic, but why the lucky stiff's methods for teaching programming were revolutionary in my eye
00:32defnhave you ever read the poignant guide?
00:33RaynesThe idea here is to keep the REPL the REPL and keep the tutorial the tutorial. Give the users the tutorial and the REPL to try stuff out with right there on the same page. The integrated type-to-move-on tutorials seemed awkward to me.
00:33defnmy general suggestion is: get weird with it. quit being 100% rational. make the tutorial artsy, weird, crazy even.
00:33defnit makes it memorable, it makes it interesting
00:33Raynesdefn: Yes, I've read most of the poignant guide. I never cared for it.
00:34RaynesHis stories got odd to the point of being pointless and dragged on and on, eventually I lost interest.
00:34RaynesBut that's just me.
00:34defnRaynes: i see sort of where you're coming from, but here's the thing... if he had held back, i dont think it would have been as good
00:34defnit would have been worse i think
00:35RaynesI don't really think it was all that good. :\
00:35RaynesMaybe I just need to read it again.
00:35defnRaynes: i dont know, im just sort of a teacher IRL, and what he did in that book was not create a programming book for programmers
00:35RaynesThe stories were just a bit too much for my taste.
00:35defnhe created a book for non-programmers to approach real programming through the narrative
00:36defna memorable narrative that sticks to your brain
00:36defnit's the method to his madness that should be examined
00:36RaynesI guess. :\
00:36defnnot the result
00:36defnbecause, honestly, it worked
00:37defndo you know how many lines of code were run at the tryruby repl?
00:37defnsomething like 75, 80 million
00:37RaynesAnyway, if nobody is opposed to my approach, great. I'll continue towards that direction. I think people will like it enough to not bother with tryhaskell style repl-integration.
00:38RaynesI don't think it's necessary to force REPL usage, because it's kind of useless without using the REPL anyway. I just want to decouple these things.
00:38Raynesdefn: I'm not a very creative person. I can't write why-style stuff, especially when I don't even like his stuff very much. I don't think I'm the guy for that sort of thing.
00:38defnwhat i think id like to do, if it were my project
00:39defnis vary the methods that i present information in
00:39defnhaving a repl on the side, next to a tutorial which gives some recipes
00:39defnto facilitate exploration
00:40defnfor people who wants recipes, they have them, for people who want a bit of adventure, they have the REPL
00:40Raynesdefn: This tutorial isn't supposed to be rocket science. It's supposed to be a simple 15 minute tutorial to get people exploring Clojure. It will walk through some examples, have you try them out with various input, explain a few things, and put you on your way.
00:40RaynesJust like the other tutorials.
00:40RaynesAnyway, we'll talk about this later. I've got to run.
00:40defnRaynes: im rather opinionated on this so i dont mean to sound critical
00:40RaynesBai.
00:41defnbut just like the other tutorials is what irks me :)
00:41defnRaynes: seeya
01:22underdevwow- what a coincidence. I just decided to implement my current project in clojure, after failing to find decent java integration in any of the jvm schemes. I .tar.gz'ed my .emacs.d started fresh- had no idea all that stuff in elpa got upgraded *today*
01:22underdevmust be fate
02:19jColeChangedI'm going through project euler to learn clojure and wanted to be idiomatic if possible. If your not busy, let me know if you see any things I'm doing improperly: http://pastebin.org/243146
02:40somniumjColeChanged: instead of (map f (map g xs)) two alternatives are (map (comp f g) xs) and (->> xs (map f) (map g)). You may want to memoize triangle? too (some is O(n))
02:52jColeChangedsomnium: Didn't know about either of those methods, thanks. Also, is there any contains? like function which isn't linear time?
02:56LauJensenMorning team
02:56replacamorning Lau
03:00jColeChangedHi again LauJensen.
03:11esjSalut
03:16vIkSiThmm whats the link to the protocols video again?
03:16vIkSiTah here. http://vimeo.com/11236603
03:16sexpbot"Clojure 1.2 Protocols on Vimeo"
04:44RaynesLauJensen: Remember how we were talking about how horribly Arial Black was rendering when we used it for the tryclojure header? I'm running Lucid Lynx now, and it's rendering perfectly. :o
04:45LauJensen10.04?
04:45RaynesYes.
04:45LauJensenOdd, that what Im running as well
04:46RaynesWhen I was on Hardy, it was really heavy.
04:48ravai just have to say, destructuring is my new favorite thing. ever.
04:48ravaIts one of those things that you don't know how much you want it until you have it and then have to make do with out.
04:51LauJensen:)
05:11G0SUBwhen I try to build a jar of my code with lein and execute the jar I get this error - "java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set"
05:12G0SUBany idea how this can be fixed? I am setting warn-on-reflection in some files
05:17rdsrGOSUB: I think you have to use something like this
05:17rdsr(binding [*warn-on-reflection* true]
05:17rdsr ...)
05:25Rayneswarn-on-reflection can only be set in the REPL.
05:25RaynesIt doesn't make sense elsewhere.
05:26tomojis it really the repl, or just the top thread?
05:27RaynesProbably. Someone in here was talking about it a while back.
05:29tomojprobably which?
05:30RaynesProbably just the top thread.
05:30RaynesI'm not certain.
05:31npoektophi! if i have a map and nil associated to a key {:key nil}, is there a way to distinguish this situation from situation when there is no :key in map?
05:32Raynes$(get {:key nil} :key "no key in map")
05:32sexpbotresult:
05:32Raynes$(get {:key nil} :ke "no key in map")
05:32sexpbotresult: no key in map
05:32RaynesEh.
05:32RaynesI still haven't fixed the don't-print-nil bug.
05:33RaynesI've been slacking.
05:33RaynesDamn tryclojure.
05:33Raynesnpoektop: The first result: was actually nil. get is what you're looking for.
05:34npoektopRaynes, thank you
05:36GeoffSKI can't get one source to successfully include another file, both have namespaces. Any examples/tutorials?
05:36spariev,(get {:key nil} :key "no key in map")
05:36clojurebotnil
05:37ravaGeoffSK: checked your classpaths?
05:37tomojGeoffSK: what do you mean "include"?
05:37tomojyou want to call functions from one in the other?
05:37GeoffSKsorry i mean :import
05:37GeoffSKhttp://pastebin.com/1xGispcD
05:37RaynesYou want to use require.
05:37GeoffSKtomoj: yes.
05:37tomoj:import is for java classes
05:37RaynesOr use.
05:37RaynesProbably use.
05:38Raynes(:use namespace.of.file)
05:38npoektopif i make a map {:key val, :optional-key nil}, how to skip association of :optional-key there. I can do (if (nil? ...) {} {:optional-key ...}), but is there a better way?
05:38tomoj(:use [com.gsk.a :only (aname)])
05:38tomojor (:require [com.gsk.a :as foo]) will let you call foo/aname
05:39ravanpoektop: Would a struct make sense for it?
05:39GeoffSKjava.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword (b.clj:1)
05:40ravanpoektop: you can define the keys in a defstruct, then when initing structs any non epxlicitly referenced keys will have nil as their val
05:40GeoffSKtomoj: http://pastebin.com/mY5Wp42K
05:41GeoffSKtomoj sorry changed to symbols.
05:41rava,(defstruct astr :a :b :c)
05:41clojurebotDENIED
05:41ravaor not..
05:41ravalol
05:41npoektoprava, no, it's ok that i will always have :optional-key even if nil in my map, but i'd like to know if there is a way to skip association of key/nil pairs.
05:41G0SUBRaynes, thanks for the tip.
05:42G0SUBwhen I quit slime, the swank server quits too. I remember there was a variable to toggle that behaviour. can anyone remind me?
05:42GeoffSKtomoj: thanks. sorted it out.
05:43G0SUB:dont-close
05:43ravanpoektop: http://pastebin.com/bbR8EVJn
05:43RaynesGeoffSK: Unrelated, but worth pointing out: gist.github.com (and a couple of others) have Clojure specific highlighting. gist.github.com is specifically helpful because every paste is actually a git repository that people can clone, change, and push, so it's useful for helping people out with code snippets.
05:44RaynesG0SUB: That's it, I believe.
05:44tomojapparently pastie has clojure now too
05:44GeoffSKraynes: thanks.
05:44G0SUBRaynes, yeah, but how do I tell lein to use that option when starting the server?
05:44ravaGeoffSK: and if you go with gist, and use emacs, there is an emacs extension that ties into gist
05:45RaynesG0SUB: I never successfully managed to do that. Instead, I made my own swank-server startup file for sexpbot. Want me to gist it?
05:45ravahttp://github.com/defunkt/gist.el
05:45npoektoprava, well, it's ok, but still not what i'm looking for. Thank you anyway)
05:45G0SUBRaynes, I would appreciate that. thanks.
05:45ravanpoektop: np, still new to clj so not very helpful yet :)
05:46RaynesG0SUB: http://gist.github.com/403600
05:46GeoffSKrava: i am using intellij, does emacs do better formatting of clojure?
05:46G0SUBRaynes, exactly what I needed. thanks.
05:47ravaGeoffSK: The formatting is good in emacs, but I use it namely because I don't ever have to leave it while i'm working. I can: chk email, talk on irc/aim (as i am now), run repls/shells (python and clj and bash right now), and edit code
05:47RaynesG0SUB: Make sure you have the newest swank-clojure for that. 1.1.0 wont work.
05:47ravaeven tempted to get a coffee machine that has an ethernet jack so i can have emacs send my coffee requests :D
05:47G0SUBRaynes, yeah, I have the new one. 1.2.1
05:48ravahttp://www.emacswiki.org/emacs/CoffeeMode
05:48sexpbot"EmacsWiki: Coffee Mode"
05:48GeoffSKrava: Yep. i am a little used to the DrScheme and its formatting.
05:56npoektophow to print a func which i define within a macro? (str #(string? %)) does not print what i want
05:56npoektopi'd like to get "#(string? %)"
05:57opqdonutyou probably want to use macroexpand-1
05:57opqdonutor you need a level of additional quoting
05:57opqdonut(str (quote #(string? %)))
05:58opqdonuterr
05:58opqdonut,(str (quote #(string? %)))
05:58clojurebot"(fn* [p1__16631] (string? p1__16631))"
05:58opqdonutthere :)
05:58npoektopopqdonut, cool. thanks
06:00Chousukethat doesn't actually print the function though.
06:01Chousukejust the form that evaluates to a function
06:01G0SUBRaynes, on the repl ,<quit> still quits the server. M-x slime-disconnect doesn't. how do you disconnect usually?
06:01tomojwhat counts as "actually" printing something?
06:02Chousuketomoj: printing it :P
06:03Chousuketomoj: I think it is important to keep the concept of forms separate from the values they evaluate to
06:03ravaI'm missing something here..could someone show me usage of (val) ?
06:04Chousuke,(val (first {:k 'v}))
06:04clojurebotv
06:04Fossi:p
06:04tomojChousuke: ok, but what would make the choice of using the fn* form as the printed representation for a fn somehow fake-printing?
06:04Chousuketomoj: no
06:05ravagroovy, thanks. for some reason I just couldn't grok the doc string's explination.
06:05Chousukeor well. yes it would
06:05tomojoh, well, the fn never arises there, so..
06:05Chousukeunless you take care to replicate the lexical environment as wel
06:05Chousukel
06:05tomojah, heh
06:06tomojif you lose information, it's fake-printing?
06:06Chousukepretty much :P
06:06tomojso e.g. we can't print structs (or can we now? haven't tried lately)
06:06Chousukeor pretty-printing, but hm
06:07Chousukein this case it's just that printing forms produces something that looks like a function but is not one
06:08tomojeh
06:08tomojI think your metaphysics of printing is beyond me :)
06:08ChousukeI just don't think printing functions makes sense.
06:09Chousukeexcept the way it's done right now, which is just a "visual token" kind of thing.
06:09tomojI hadn't thought about the lexical env when looking at technomancy's trick
06:09tomojdo there actually exist any implementations of HTCPCP?
06:10RaynesG0SUB: I usually exit manually in the terminal.
06:20ravaRest easy everyone.
06:55LauJensenWhen you guys subscribe to some blog, do you expect the feed to have all posts, or just the 10 most recent or so ?
06:56Licensertomoj: I was told you found some odd behavior in the sandbox?
06:56tomojjust a security hole
06:56tomojRaynes fixed it, I think
06:57RaynesNo, I didn't.
06:58tomojwell, someone who used your github keys did, then
06:58Licensertomoj: can you tell me what it was? :)
06:59Raynestomoj: Nosir.
06:59Raynestomoj: Nobody has committed anything to clj-sandbox but Heinz in several days.
06:59Licensernot true
06:59RaynesI've been too busy with tryclojure to work on clj-sandbox.
06:59Licenseryou removed some fn's from the save list
06:59tomojwat?
06:59clojurebotFor Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888
07:00tomojam I living in some parallel universe?
07:00RaynesOh yeah.
07:00RaynesOh, I did fix it.
07:00Licenseron the 14th
07:00Licenser:P
07:00Raynestomoj: I'm sorry, dude, the last couple of days have been a whirlwind.
07:00Licensertomoj: aren't we all?
07:00Raynes._.
07:00RaynesBut yeah, those functions were the problems.
07:01Licenserbut tomoj thanks for finding the hole!
07:03tomoj$(tomoj)
07:03sexpbotresult: Hello, world!
07:04tomojRaynes: no problem
07:04Licenserneat :)
07:05RaynesLicenser: When you start working on the def* workaround, you might want to jump to 0.4.0-SNAPSHOT.
07:06RaynesFollowing semver rules, anyway.
07:06LicenserRaynes: when I find any useful workaround I will but I could not dig a way up yet :(
07:07tomojI was perusing the source to see if the set bug caused a vulnerability and accidentally found an unrelated issue
07:10tomojbrilliant
07:10tomojthat would go a long way towards making my emacs-hating coworkers jealous
07:10tcrayford:)
07:10tcrayfordit needs some more work, but its getting there
07:12tcrayfordand is seriously quite cool
07:12tcrayforduses a reporting thing like clojure-test-mode
07:14Licensertomoj: *nods* You really have put some work in that, thanks amn!
07:14Chousukeis this part of the emacs refactoring thing?
07:14tcrayfordnope
07:15tcrayfordthough the next branch will yoink some code from that
07:17tcrayfordI should probably extract the helper functions to a common package so both can use them
07:18tomojLicenser: really my first independently discovered exploit.. so it was fun
07:19LicenserI can imagine :)
07:20tomojnot that I could do anything to your machine except make it print "hello world" when it wasn't supposed to...
07:21tomojI suppose I could have made sexpbot insult people in #clojure or something
07:21esjguys, what's the practice of putting * after some function names. Just a marker that 'this is slightly different' ?
07:21tcrayfordyeah, that's it usually
07:21tomojsometimes it's a helper function for implementing the *-less version, too, I think
07:22tomojor some simpler version on which the *-less version expansd
07:22Chousukeif used in macros, it's usually the "driver"
07:23Chousukeas regular functions, it's often just "variant"
07:23Chousukeeg. list, list*
07:24Licensertomoj: well with that you could about do anything
07:24Chousukethen there's bound-fn* (function), bound-fn (macro), and fn/fn* (where the latter is an implementation detail)
07:24Licenseronce you can eval stuff you're free :P
07:25Raynes$eval #{1 2 3}
07:25sexpbotresult: #{1 2 3}
07:25RaynesJoy!
07:25tomojbut only in clojure-land, the jvm security stuff still protects your box, right?
07:26Licensertomoj: yes but that is bad enough :P
07:26Licenseryou could totally mess up stuff
07:30esjmerci, dudes
07:32LicenserRaynes: jvm security does not seem to cover memory :( it seems that there is no real way to do that darn it!
07:39d2dchatIs it possible to grab a dependency automatically from a bitbucket repo using lein?
07:39d2dchatI'm trying to grab this:
07:39d2dchathttp://bitbucket.org/jonjlee/riak-java-client/wiki/Home
07:39sexpbot"jonjlee / riak-java-client / wiki / Home — bitbucket.org"
07:39d2dchatbut it keeps erroring out
07:39tcrayfordiirc it has to be a maven repo
07:40d2dchattcrayford: isn't that a maven repo?
07:43RaynesThat is a Mercurial repo.
07:52Raynesdnolen: Have you seen the new tryclojure design by any chance?
07:53dnolenRaynes: yes, looks good! my only suggestion now would be perhaps some work on the logo.
07:53Raynesdnolen: There is no logo. :p
07:54rsynnottwell, there's a title
07:54Raynesdnolen: Do you mean the header? That's the least of my worries right now, but fair enough.
07:54Raynes:p
07:54RaynesThe font does render pretty badly for some people.
07:54RaynesI'm going to replace the header with an image in the next version.
07:54dnolenRaynes: yeah, the title. but it's really coming together. only a matter of time.
07:55dnolenby "coming together" i mean the look, the functionality is of course fantastic.
07:55RaynesI'm happy you like it now. Thank LauJensen for tons of help with CSS and such. <3
07:55rsynnottRaynes: do you plan to let people define things at some point?
07:56Raynesrsynnott: Ask Licenser. ;) This one is beyond my control.
07:56rsynnottThough I suppose it'd be tricky to make that safe
07:57tcrayford,(def a 1)
07:57clojurebotDENIED
07:57RaynesIt's safe. The problem is memory control. You can def something gigantic and blow the world up.
07:57tcrayfordwhat are people using as imagehosts atm?
07:58Raynesimgur
07:58rsynnottRaynes: that's what I mean, yep :)
07:58rsynnottpresumably some sort of clever sandboxing thing would be needed
07:59rsynnottthough presumably you could do that in the current one, too, with let
07:59tcrayfordso, duplication highlighting in emacs: http://i.imgur.com/7Z76F.png
08:00tcrayfordif you highlight the text and press a key combo you get what var that bit duplicates with
08:02Licenserrsynnott: the short answer is yes the longer one, it will take some time
08:03Licenserrsynnott: and no you can't do it in the current one with let, since the data will be GC'ed at the end of let
08:03tomojtcrayford: does it do more than look for common substrings?
08:04tcrayfordit looks for common subsequences atm
08:04tcrayfordI can fix that problem pretty easily though, as refactoring-mode has a load of stuff about discovering and renaming bindings in a node
08:04Licensertcrayford: ideally variable names should not matter :P but that is a high sandard I know
08:04tcrayfordthey won'
08:04tcrayfordt
08:05tcrayfordafter I finish the next bit, which I already know how to do
08:05tomojI suppose extract-function is on the way?
08:05tcrayfordI already did that
08:05Licenser:)
08:05tcrayfordit breaks occasionally though
08:06tcrayfordbut still, useful
08:07tcrayfordrefactoring mode has a load more than that as well, like auto-constructing let-bindings out of a block you have selected
08:07tomojso it seems we can now hack emacs in clojure?
08:07tomoj:D
08:07tcrayford:/
08:07tomojs/now/for quite a while/
08:07sexpbot:/
08:07tcrayfordthis is done using lein and swank
08:07tomojgoogle fails me for refactoring mode
08:08tcrayfordhttp://github.com/tcrayford
08:08tcrayfordand then somewhere
08:08tomojyour clojure-refactoring is the first result
08:08tcrayfordits scary how easy this stuff is to write
08:08tcrayfordjust manipulating some lists and spitting em back out
08:09tcrayfordalso, refactoring-mode needs some emacs hackery to make it actually work
08:09tomojdo I get it right that refactoring-mode is some external dependency you're using?
08:09tcrayfordclojure_refactoring is a clojars project that I wrote
08:10tcrayfordrefactoring-mode is just my own bit of (terrible) elisp
08:10tomojah, I see
08:10tcrayfordits not that good as of now, but its exam revision time, so it should get better when umbrella is working how I want
08:12tcrayfordI need to license both projects under some liberal license as well, just not sure which one
08:12tomojoh, umbrella is the duplication highlighting, and "refactoring-mode" refers to the stuff in clojure-refactoring-mode.el ?
08:12tcrayfordyes
08:12tomojI have been awake too long :(
08:12tcrayfordhah
08:13tcrayforddo you have any reccomendations on open source licenses?
08:13rsynnotttcrayford: MIT/modern BSD are simple
08:14tcrayfordthey look good enough
08:15tcrayfordI might just use eclipse, seeing as clojure uses it (and a load of other clj projects)
08:15tomojhmm
08:15tomojI am imagining pretty ridiculous possibilities
08:15tcrayfordshoot
08:15tcrayfordI have a lot of free time at the moment, and am all open to ideas
08:16tomojI don't know what "extract local" already does
08:16tomojbut suppose you do it, then you have the opportunity to hit a few extra keys to decide on a possible alternative
08:16tcrayfordlike what?
08:16tomojif there's a let around point already, it defaults to adding the binding there
08:16tcrayfordcurrently, you select a sexp inside a defn, and give it a name, then it adds it
08:16tcrayfordyeah
08:17tomojif not, it creates a let, and you can cycle the scope up and down
08:17tcrayfordit does that if there's a let at the toplevel
08:17tomojor hit some other key to make it a when-let or whatevel
08:17tcrayfordcycling the scope is an interesting idea
08:17tomojbasically, vanilla clojure-mode : paredit :: paredit :: my dreams
08:18tomojer, paredit : my dreams
08:18tcrayfordyeah, roughly gotcha
08:18tomojno longer is the editor just aware of micro-level syntax, it can be aware of macro-level semantics
08:18tcrayfordit can be now, given some time
08:19tomojyes, very exciting
08:19tomojand I'm glad it doesn't have to all be written in elisp
08:19tcrayfordhopefully clojure-in-clojure will add some more possibilities in this directions as well
08:19tomojhowso?
08:20tcrayfordif I could find out local-vars in a sub-form of an outer-form, as opposed to having to find them using recursion, it'd be pretty neat
08:21tcrayfordand the compiler has to do something like that anyway
08:22tcrayford(some-fn '(defn a [b] (+ 1 b)) '(+ 1 b)) ;; => #{b}
08:22tcrayfordie it'd tell you what bound vars are in a scope
08:22tomojah, I see
08:22tcrayfordthat'd be much better than searching stuff how I do now
08:23tcrayfordcurrently I just look for forms that I *know* are binding forms
08:23tcrayfordlike let, for ,doseq etc
08:23tcrayfordand then extract the bindings out of them
08:23tcrayfordbut if clojure could give me that, it'd be damn useful
08:24Licensermemory is the arch nemesis of sandboxes :(
08:25chousertcrayford: you may be able to use clojure's Compiler class for that.
08:25tcrayfordas of now?
08:26chouseryes
08:26tcrayfordooh
08:26chouserit's not the prettiest thing, and of course will change with c-c-in-c, but it may be doable.
08:26chouserand more likely accurate (if it works) than rolling one's own.
08:26tcrayfordit's still nicer than blind recursion
08:26tcrayfordyeah
08:27tcrayfordand it might work with anaphoric macros (which mine won't at all)
08:27chouseryeah. The entrypoint you want is (clojure.lang.Compiler/analyze ...)
08:29chouser,(clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL nil)
08:29clojurebot#<NilExpr clojure.lang.Compiler$NilExpr@927ec1>
08:30tcrayfordawesome
08:30tcrayfordcheers
08:30chouserthen you need to dig into the resulting Expr tree which is a bit complicated and completely undocumented. But it understanding it is a path to enlightenment
08:30tcrayfordyeah
08:31tcrayfordone of the reasons I wrote refactoring-mode was to learn more about (= code data)
08:31Licensertcrayford: if you want look at what clj-sandbox does to analyze code, it might help you even so it is not using the compiler stuff
08:32tcrayfordI've been meaning to extract some parts of refactoring-mode to a clj-analysis thing
08:32tcrayfordLicenser: what namespace should I start with?
08:32npoektophow to do this: (defmacro testmacro [] `{:a 'a (comment :b 'b here on some condition)})?
08:32Licensertop of net.licenser.sandbox
08:33Licenserfn-seq for example
08:33tcrayfordtree-map is useful
08:33Licenser*nods*
08:36Licenseryou might also want to look at dot-replace (or something like that) since it is pretty much refactoring
08:37tcrayfordyeah
08:37npoektopi have (defmacro testmacro [] `{~(if true :a) ~(if true ''a)}). How to run that if only once?
08:38tcrayfordrefactoring-mode never does anything with java interop atm
08:38Licensernpoektop: ~@ is your friend thre
08:38Licenser(defmacro testmacro [] `{~@(if true [:a ''a])})
08:39npoektop,java.lang.ArrayIndexOutOfBoundsException: 1
08:39clojurebotInvalid token: java.lang.ArrayIndexOutOfBoundsException:
08:39Licensertcrayford: I know but replacing the . form is techically refactoring
08:39npoektop,(defmacro testmacro [] `{~@(if true [:a ''a])})
08:39clojurebot1
08:39npoektopLicenser, it does not work (
08:39tcrayfordLicenser: what does expand-and-quote actually do?
08:39emhI want to type hint so that bit functions are resolved without reflection, but I want the function to work on Integer, Long and BigInteger. is there a number type hint or should I generate three versions of the function with different type hints or what?
08:40Licenser~@ you mean?
08:40clojurebot@ has nothing to do with whether sth is evaluated or not
08:40npoektopLicenser, it says java.lang.ArrayIndexOutOfBoundsException: 1
08:40Licenserit takes a list and inserts the element in stead
08:40Licensernot sure what you want to do with ''a so
08:40tcrayford,(quote (quote a))
08:40clojurebot(quote a)
08:40npoektop,(defmacro testmacro [] `{~@(if true [:a 'a])})
08:40clojurebot1
08:41Licenser(defmacro testmacro [] `(hash-map ~@(if true [:a ''a])))
08:41tcrayford(testmacro)
08:41Licenser,(defmacro testmacro [] `(hash-map ~@(if true [:a ''a])))
08:41clojurebotDENIED
08:41Licensercan'T do it here
08:41chouser,(let [code '(fn [] (let [a 0 b 1]))] (for [method (-> (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL code) .expr .methods) local (-> method .locals keys)] (-> local .name symbol)))
08:41clojurebotjava.lang.IllegalArgumentException: No matching field found: expr for class clojure.lang.Compiler$FnExpr
08:42chouserbah
08:42Licensertcrayford: look at the hash-map version
08:42Licenserit works
08:42tcrayfordchouser: that only fails here because of the dot expansion clj-sandbox does
08:42tcrayfordman thanks
08:42emhah. ofc, java.lang.Number
08:42tcrayford*many
08:43tcrayfordif I'm ever ~wherever-you-live I owe you a beer or two
08:43LicenserI hate bear :P and don't worry ;)
08:43tomojhmm
08:43chouserbut note you get all the macro-generated locals that users rarely see
08:43tomoj,(->> (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL '(let [a 3 b 4] a)) .fexpr .methods first .locals keys (map #(.sym %)))
08:43clojurebot(b a fn__16708)
08:43tcrayfordyeah, which isn't good
08:43LicenserWe all would be poor from buying all the beer we own otheres here
08:43tomojoh, I missed your better attempt
08:43chouserromanb: nice!
08:43npoektopLicenser, thanks!
08:43chouserer
08:43chousertomoj: nice!
08:44LicenserI think the rule of thumb is buy it yourself :P since in the end you have to buy others beer and other others have to buy you bear so if everyone just buys their own it's pretty fair
08:44Licensersave for people like chou* who know everything
08:44tomojno idea why I have a FnExpr..
08:45tomojbut I wonder how we point to a specific part of a form and ask for only the locals there
08:45Licenseranyway see you later people I've to return a case that is broken
08:45tcrayfordyeah
08:45tcrayfordthat's a harder part
08:45tomojmaybe you can just trim the form so that it's only the path to the leaf you want?
08:45tcrayfordI can definitely do that
08:45tcrayfordit currently looks like this:
08:45tcrayfordit looks like this currently:
08:45tomojwould that give good results, though, I wonder?
08:46tcrayford(defn find-bindings-above-node
08:46tcrayford "Returns all binding forms above expr in node."
08:46tcrayford ([node expr] (find-bindings-above-node node expr []))
08:46tcrayford ([node expr bnd-syms]
08:46tcrayford (unique-vec
08:46tcrayford (flatten
08:46tcrayford (if (more-than-one seq? node)
08:46tcrayford (map #(find-bindings-above-node % expr bnd-syms)
08:46tcrayford (filter #(and (seq? %)
08:46tcrayford (rec-contains? % expr)) node))
08:46tcrayford (if (last-binding-form? node)
08:46tcrayford (add-binding-form node bnd-syms)
08:46tcrayford (if (binding-node? node)
08:46tcrayford (find-bindings-above-node (rest node)
08:46tcrayford expr
08:46tcrayford (add-binding-form node bnd-syms))
08:46tcrayford (if (seq? (first node))
08:46tcrayford (find-bindings-above-node (first node) expr bnd-syms)
08:46tcrayford (find-bindings-above-node (rest node) expr bnd-syms)))))))))
08:46tcrayfordso fixing that'd be nice
08:47tcrayford(there's lots of stuff in there that relies on other functions, but its still horrible)
08:48tcrayfordthankfully I have tests for a lot of stuff, so I can rework it pretty safely
08:48tomojCompiler.java is...
08:49tomojterrifying
08:49chouserdoomed
08:49tcrayfordI've tried reading the clojure source before
08:49tomojhow can such a beautiful language be built from something so ugly?
08:49tcrayfordits pretty difficult
08:49tcrayfordheh
08:49tcrayfordhave you seen the source for arc?
08:49Licensertcrayford: hint: github
08:49tomojnope
08:49tcrayfordits really very nice
08:49tcrayfordgiven that its all in scheme/arc
08:50tcrayfordyeah Licenser, I realised that was a stupid thing to paste after I did it
08:50Licenser:P
08:50tcrayfordhttp://github.com/tcrayford/clojure-refactoring/blob/master/src/clojure_refactoring/core.clj#L89
08:51tcrayfordits still *really* ugly
08:51tcrayfordtomoj: also I have code that can do that trimming out already
08:52tomojcool
08:52tcrayfordjust a simple case of postwalk with recursive-contains?
08:53tcrayford(I think that fn is actually called rec-contains currently, but eh)
08:55tomojchouser: that was 1.1?
08:55tomojdoesn't work in 1.2.. this will be a painful approach, I think
08:55chousertomoj: my example? 1.2-ish
08:55chouserhm.
08:55tomojCompiler's interface might change within versions, too, I bet..
08:55tomojoh
08:55chouseryeah
08:55tomojyour example was specific to the kind of form you passed, I guess?
08:56chouseryeah, it assumes the outer is a fn
08:56chouseryou can generally write a fn around a user-supplied expr
08:56tomojyeah
09:00tcrayfordI'm off now, cheers for the help you two
09:01tomojI wonder if you did a checkpoint every time you compile, and then diff the sexps, whether you could pick up on common edit patterns
09:03tomojevery compile is probably not often enough
10:18dmiller2718rhickey: Did you see my e-mail on the interview possibility?
10:19rhickeydmiller2718: yes, just wading through my email after getting back from prag studio
10:20rhickeydmiller2718: I think you should be able to do the interview just fine
10:20rhickeydmiller2718: you can point to the Channel 9 one I did for more in depth on Clojure itself
10:21cemerickrhickey: "welcome back", as it were. :-)
10:21rhickeycemerick: thnks
10:21rhickeythanks
10:21AWizzArdhi rhickey *wave*
10:30dmiller2718rhickey: thanks for the vote of confidence. Figured that on the e-mail.
10:30dmiller2718rhickey: I'll have to go remind myself of why clojure is important and fun.
10:30dmiller2718rhickey: Mostly it just looks like a pile of C# code to me. :)
10:31rhickeydmiller2718: I had a couple of people in the class that were interested in the CLR version specifically. Hopefully they'll contact you to help out
10:33Licenserwelcome back rhickey
10:43tcrayfordrhickey: thankyou so much for including :line and :file metadata on vars.
11:32mefestoI'm trying to set a public instance field to a value in a java object but getting a "no method found". What am I doing wrong? ex: (doto (Person.) (.fname "Test"))
11:36chouser(let [p (Person.)] (set! (.fname p) "Test") p)
11:36mefestochouser: thanks!
11:39Licenserhmm couldn't doto make (.fname= "Test") to (set! (.fname p) "Test") ?
11:40LicenserI think you are not allowed to have fnction or field names like ...= in java
11:48jfieldswhat's the easiest way to convert [:a 1 :b 2] to {:a 1 :b 2}?
11:50replaca,(into {} (partition 2 [:a 1 :b 2]))
11:50clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
11:51jfields,(reduce (fn [r [x y]] (assoc r x y)) {} (partition 2 [:a 1 :b 2]))
11:51clojurebot{:b 2, :a 1}
11:51jfieldsseems awfully verbose though.
11:51lpetit,(apply hash-map [:a 1 :b 2])
11:51clojurebot{:a 1, :b 2}
11:52replacalpetit: much better!
11:52lpetitjfields: ^^^
11:52jfieldslpetit: exactly what I was looking for. thanks.
11:52tomojI'm surprised into doesn't work without map vec
11:53tomojinto after partition 2, I mean
11:56replacayeah, me too
11:56chouserClojure's MapEntries are a kind of vector, not a kind of list.
11:57chouser,(vector? (first {:a 1}))
11:57clojurebottrue
11:57_brian2_trying new compojure not sure what I'm doing wrong, but I created a lein new, put [compojure "0.4.0-SNAPSHOT"] in project file , then lein deps, then try to run example in repl and get Could not locate ring/adapter/jetty__init.class
11:57replacachouser: it would be nice if into would take care of that for you
11:58replacachouser: where it would just look for pairs of any kind
11:58stuarthallowayreplaca: just the person I was hoping to find
11:58stuarthallowayreplaca: any idea what object in pprint might be held by something across reloads?
11:59replacastuarthalloway: not only no idea - I don't exactly understand the question
11:59stuarthallowayif you (use :reload-all ...) a bunch of things, over and over, the class objects themselves are never freed
12:00stuarthallowaycausing you to run out of PermGen space quickly
12:00replacastuarthalloway: my first guess would be the compiled formats
12:00stuarthalloway,(use :reload-all 'clojure.contrib.pprint)
12:00clojurebotnil
12:00stuarthallowayif I did that ten more times I could kill the clojurebot
12:00replacawow, that's fast
12:01replacaI'll take a look
12:01stuarthalloway...assuming its memory footprint is similar to my laptop's
12:01stuarthallowaylet me give you some code to help out
12:01replacaWhat causes the PermGen space prob? classes or something else?
12:01stuarthallowayclasses
12:02replacaok
12:02replacaI haven't seen that before
12:02stuarthallowaybut if, for example, a namespace registered an instance of one of its classes with a collection in clojure.core, that instance would:
12:02stuarthalloway... hold onto its class
12:02stuarthalloway... which would hold its classloader
12:02stuarthalloway... which would hold all other classes held by the loader
12:03replacawhat does "registered an ... clojure.core" mean?
12:03technomancyheh; "the clojurebot"... sounds like "the batman"
12:03stuarthallowaye.g. stuffing an instance into a mutable collection owned by core
12:03stuarthallowaythis is unlikely in general, and esp. so in Clojure
12:03Borkdudechouser: just posted some comments/typo corrections on the TjoC forum
12:03stuarthallowaybut something is doing it
12:04chouserBorkdude: thanks!
12:04Borkdudenp :)
12:04rhickeystuarthalloway: and you're sure not just the DynamicClassLoader cache?
12:04stuarthallowayreplaca: check out http://paste.lisp.org/display/99346
12:05stuarthallowayrhickey: if you run the code I just pasted with some random small namespace, the :dead-classes grow over time (expected) but the live classes all get collected
12:05npoektopi saw somewhere how to print a vector [a b c d e] like this "a, b, c, d, e". Does anyone know how to do that?
12:05replacahmmm, what mutable collections are there in core that I could even get my grubby little hands on?
12:05stuarthallowayif you run it with pprint (or anything that uses pprint) no :live-classes *ever* get collected, and it fails fast
12:06stuarthallowayoh, and the gf macro is irrelevant -- left over from testing raw classloading to make sure that wasn't the culprit
12:06Licensernpoektop: tere are more then one way :)
12:06stuarthallowayreplaca: I have no idea! Registering a callback with some IO system in Java itself would also do it
12:07npoektopLicenser, i mean it was a very simple way
12:07replacastuarthalloway: don't think I do that, but I'll look more closely
12:07replacastuarthalloway: thanks for the pointer
12:07Licensernpoektop: that wold be a function :)
12:07rhickeystuarthalloway: always 464?
12:07Licenserhttp://gist.github.com/390080
12:08Licenserlook at those functions
12:08stuarthallowayreplaca: you don't seem to be doing anything of the sort. I read through all of pprint before asking
12:08Licensermost interesting the last one combiner
12:08replacastuarthalloway: you're a brave man
12:08Licenserthat allows you to convert a vector to a string in a nice and customizable way
12:08stuarthallowaybravery is often the lack of wit to recognize danger
12:08replacastuarthalloway: something with my proxies, maybe?
12:09npoektopLicenser, thank you )
12:09stuarthallowayif one of them is permanently passed off, yes, but at a quick glance the usages seemed scoped
12:09Licensernpoektop: welcome :)
12:10hiredmanclojurebot: exceptions?
12:10clojurebothttp://paste.lisp.org/display/74305
12:10replacanpoektop: you can do that with cl-format: (cl-format true "~{~a~^, ~}~%" [1 2 3 4 5])
12:10stuarthallowayrhickey: 464 what?
12:11chouseris there no way to tell which classes are being held?
12:11stuarthallowayrhickey, replaca: use -XX:MaxPermSize=32m to make the problem happen sooner
12:11stuarthallowaythe default is 64m
12:11replacastuarthalloway: thanks
12:11stuarthallowaychouser: with some memory debugger tool, perhaps
12:12npoektopreplaca, wow! thank you
12:12rhickeystuarthalloway: leak of 464 each iteration
12:13stuarthallowayrhickey: yes. I assume it is the exact number of classes in pprint
12:13replacarhickey: I bet that's all the classes in pprint
12:13stuarthallowaybtw, it is *not* simply a leak in protocols. multimethods, or types. I tried them all standing alon and they are fine
12:14tomojchouser: still, clojure doesn't usually complain about that sort of thing
12:14replacastuarthalloway, rhickey: I don't use protocols or types (yet) in that code. I just converted the gen-class to proxy in my 1.1 version to KISS
12:15replacaIt's my plan to rewrite that whole proxy part to be more functional and less O-O, but that's still a couple of months away, I think
12:45tcrayfordchouser/tomoj: ping
12:46tomojello
12:46tcrayfordthat compiler trickery earlier won't work for defexprs
12:46tcrayford(expressions that begin with def something
12:47tcrayfordwas wondering if you could think up a better way to do that part, because that's the only bit I need atm
12:48emhwhat's a good way to bind a bunch of variables to be used by several tests, using let style? can you do that with a fixture?
12:48tcrayfordyes
12:48tcrayford(use-fixtures :once #((def a 1) (%) (def a nil)))
12:48tcrayfordyou can't use let though, has to be def (I think)
12:49tcrayfordthough tryin wrapping the (%) call with a let
12:50emhwhat's wrong with (defmacro s [] (for [x ['c 'd]] `(def ~x 8))) ?
12:50emhjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0)
12:50tomojtcrayford: it doesn't work for fns either, does it?
12:51tomojI mean, fns that are inside other fns
12:51tcrayfordtomoj: havn't tried
12:52emhtcrayford: I was thinking of using "binding", but then the variables have to be defined, so I was trying to make a macro that defined them all
12:52tcrayfordemh: use macroexpand
12:52emhtcrayford: k. ofc
12:52tcrayfordor use binding and declare
12:52tcrayford((def c 8) (def d 8))
12:52tcrayfordis what I get with macroexpansion
12:52tcrayfordso you end up trying to call (8 8)
12:52tcrayfordand hence the error
12:52tcrayfordtomoj: you tried nested fns yet?
12:52tomojyeah, no luck
12:53tcrayford:(
12:53tcrayfordis there any way around this?
12:53tcrayford(guess I can wait and ask rich next time he's around)
12:54tomojI think it just needs a different path
12:54tcrayfordaye?
12:54tcrayfordI couldn't see any methods that'd lead to another expr (using show on defexpr)
12:55tcrayfordthis might be much nicer once c-in-c comes around :/
12:57tcrayfordfogus: the earlier compiler hackery won't work for expressions involving def
13:00chousertcrayford: in what way does it not work?
13:00chouseryou want to know about the 'def' names too?
13:01fogus_tcrayford: I'm sorry I dropped off and am not sure what you're talking about
13:01tcrayfordoh chouser
13:01tcrayfordfails
13:01tcrayfordyeah
13:01tcrayfordI can't figure them out
13:01tcrayfordI get confused sometimes with you two :/
13:02LicenserRaynes: FYI since I read your mail www.try-clojure.org is the same host as tryclj.licenser.net so you can deploy yourself
13:02tcrayfordbetter, if you can tell me how you're figuring them out I can do the rest myself
13:04tcrayfordthen I'll just write a multimethod dispatching on the class of the analyze&eval calls
13:05dnolentechnomancy: so installation of swank-clojure via ELPA broken right now?
13:07stuarthallowayreplaca, rhickey: the PermGen issue occurs with pre-proxy pprint too
13:09Luytstuarthalloway: I'm afraid I found a typo in your book. It didn't deter me from reading further, tho ;-)
13:10stuarthallowayLuyt: Sorry about that. Please post it to http://www.pragprog.com/titles/shcloj/errata
13:10sexpbot"The Pragmatic Bookshelf | Errata for Programming Clojure"
13:13Luytstuarthalloway: Roger that. Page 39, (#body) instead of #(body).
13:17_brian2_noob question > trying the new compojure not sure what I'm doing wrong, but I created a lein new, put [compojure "0.4.0-SNAPSHOT"] in project file , then lein deps, then try to run example in repl and get Could not locate ring/adapter/jetty__init.class
13:17rdsrIs there something similar to immigrate (which create vars in the public namespace for each public var in the provided namespaces) for java classes???
13:18stuarthallowayrdsr: no. How would it work?
13:20rdsrStuartHalloway: I just thought that I could import all the necessary classes, without the user needing to import them explicitly
13:21stuarthallowaybut how would it know which ones you want? Remember that you can say "import" at any time in Clojure
13:32tcrayford,(#{`def `defn `defstruct
13:32tcrayford `defrecord `defmacro `deftype `defprotocol} 'defn)
13:32clojurebotEOF while reading
13:32tcrayford,(#{`def `defn `defstruct
13:32tcrayford `defrecord `defmacro `deftype `defprotocol} 'defn)
13:32clojurebotEOF while reading
13:32tcrayfordheh
13:33tcrayfordthat works locally
13:33tcrayford(it returns nil though, which puzzles me)
13:33chouseryou're splitting the line
13:33chouser,(#{`def `defn `defstruct `defrecord `defmacro `deftype `defprotocol} 'defn)
13:33clojurebotDENIED
13:34tcrayfordlocally that shouln't matter though right?
13:34tcrayfordI still get a nil even if I don't split the line
13:34chouserright
13:35chouser,[`map 'map]
13:35clojurebot[clojure.core/map map]
13:35chouser,(= `map 'map)
13:35clojurebotfalse
13:35tcrayfordhah
13:35tcrayfordhad them the wrong way round
13:35tcrayfordcheers
13:35chouser,(#{`map} 'map)
13:35clojurebotnil
13:35chouser,(#{'map} `map)
13:35clojurebotnil
13:35chouser,(#{`map} `map)
13:35clojurebotclojure.core/map
13:36tcrayfordyeah, gotcha
13:36tcrayfordwas trying to use that to get around the whole not knowing the names for getting at the exprs of a defn
13:38tcrayfordand then just using :arglists to get at the ones inside the def block
13:38chouserseems ... fragile
13:38tcrayfordyeah :(
13:38tcrayfordI can't figure out getting at the vars from a defn node though
13:39tcrayfordusing the compiler anyway
13:41tcrayfordgot it, I think
13:43chouserdefn, Licenser: are you the guys working on the sandbox stuff for tryclojure, watson, etc?
13:43tcrayford(->>
13:43tcrayford '(defn a [] 1)
13:43tcrayford (analyze)
13:43tcrayford (.init)
13:43tcrayford (.target)
13:43tcrayford (.methods)
13:43Licenserchouser: I am defn isn't and Raynes is also helping out with the sandbox
13:43tcrayford (first)
13:43tcrayford (.locals)
13:44tcrayford (keys)
13:44tcrayford (map #(.sym %)))
13:44tcrayforddang
13:44tcrayford,(->> '(defn a [] 1) (analyze) (.init) (.target) (.methods) (first) (.locals) (keys) (map #(.sym %)))
13:44clojurebotDENIED
13:44chousertcrayford: please use paste for multi-line posts
13:45tcrayfordyeah I'm dumb
13:45tcrayfordsorry
13:45chouserLicenser: are you trying to work in some way to allow 'def'? Have you considered throw-away namespaces?
13:45Rayneschouser: Licenser is the primary developer, but I help out every now and then (on clj-sandbox). I'm the developer of tryclojure, and defn is the developer of walton.
13:45RaynesAll three of those projects use licenser.
13:46Licenserchouser: yes and yes. I have a blog post on the issue to finish that describes the issues there since I found in all my research no satisfying solution yet
13:46Licenserproblem is as soon as you add some kind of def there is a way to flood the memory
13:46chousersurely you can temporarily flood memory anyway.
13:46RaynesWhen I say "use licenser" I mean, because he knows more about security than either of us, and both projects use clj-sandbox.
13:46Licenseror it makes it so horribly uncompfortable to use the sandbox that you'd not like to do it
13:46Raynes<3 Licenser
13:47Licenserchouser: not with the current sandbox
13:47RaynesNot with timeouts anyway.
13:47RaynesIf you set the timeouts to something sane, there shouldn't be a way to flood memory.
13:47chouserright, timeouts -- why not on timeout clear the namespace?
13:48Licenserchouser: I'm not 100% sure if that even help
13:48Licenser+s
13:48RaynesBecause then you could prevent it from timing out, but keep defing things until memory is flooded.
13:48chouserdelete it, even. Give each form you want to eval a fresh new namespace to play in, and delete it when they're done.
13:48chouserhow could you prevent it from timing out?
13:49technomancydnolen: works for me. but you don't really need swank-clojure.el anymore, see the latest swank-clojure readme.
13:49Licenserplus the fact that if the timeout is shourt enough to have it die def is no use
13:49RaynesDon't do any computations that make it timeout.
13:49Licenserallowing def only makes sense if you allow it to be persistant for the entire session
13:49Licenserthat means a lifetime that is extended by every following request
13:50chouserare you sure that's true?
13:50chouserit seems to me it'd be useful to have several def's, defn's etc as you do in a normal clojure file, then run them all at once and be done.
13:51Licenserchouser: ah you want them to be persistant over a file, but that won't be too much help for something like try-clojure or the bot
13:51Licensersince they don't have 'one file' but rather 'one session'
13:51chouserif you wanted to give an impression of a more stable session without requiring sever-side storage resources, why not rebuild the session (re-run the entire page of code) for each send to the server.
13:52RaynesI'm not sure that would make such sense.
13:52RaynesI'm not sure how that would help, anyway.
13:53chouserone of the problems with disallowing def is that code I normally write in a file cannot be used. it has to be re-structured into a standalone expression using let or whatever.
13:53Licenserchouser: hmm that isn't a bad idea
13:53Licenserbut that is a application solution not a library one
13:53chouseryou could at least solve that problem.
13:53Licensersorry I'm so critic, I want to find a good solution that is rather unviersal and suited to be taken into a library
13:54RaynesOh, I see.
13:54RaynesSorry, I've been up a long time. I had to read chouser's message 10 times to get what he was saying.
13:54Raynes:(
13:55RaynesThat is indeed an option, but it would be slow.
13:55RaynesCould have an "enable def (slower)" option.
13:56chouserslower than what?
13:57Licenserchouser: true so we could store the history of (non exeption stuff) in the session and the try-clojure side could have a working def :)
13:57Rayneschouser: If you have to reload every send, it would take a little while for everyting to re-run.
13:57Licenserhmm the sandbox could actually hold that history
13:57Licenserbut then that would be bad in some way since you don#t expect it but you could make a flag
13:57Licenser*thinks*
13:59RaynesBlah.
13:59Licenserit technically does not solve the problem but it is a workaround untill there is a good solution
14:00LicenserRaynes: why blah?
14:00RaynesI accidentally logged out.
14:00Licenserbut chouser will deleting a namespace force everything to be GC'ed in there?
14:00chouseryou'd want to double-check, but I think so. The only thing pointing to the values will be the vars, and the only thing point to the vars will be the namespace.
14:00RaynesAnyway, if you re-run the "file" on every send, of course it will be slower.
14:01chouserso delete the namespace and that ought to do it.
14:01chouserRaynes: slower than what? re-running a 'let' with eveything in it each time?
14:01Licenserchouser: what is wtih (def a (ref '())) (def b (ref (list a))) (dosync (alter a conj b))?
14:01Rayneschouser: Slower than a normal REPL.
14:02LicenserRaynes: everyting web based is slower then the normal repl :P
14:02chouserRaynes: well sure -- normal trading of space for speed.
14:03chouserLicenser: JVM GC handles reference loops just fine. once both a and b are gone, it shouldn't be a problem.
14:03Licensercool
14:05Licenserchouser: I'll try a version of sandbox that tears down the namespace after each run and save everyting successfull
14:05Licenserbut that will cause the sandbox to time out real quick :(
14:05Licenserso this is no real good solution either I fear :(
14:06chouseryou think that creating or deleting a namespace will be very slow?
14:07Licenserno but running the entire history will
14:08Licenserhmm one could just single out the defs and save them
14:08tcrayfordif I have a seq of vecs of the form ([k v]), how can I turn that seq into a map?
14:08Licenserthat is a compomise
14:10Borkdudetcrayford: (into {} [[1 2] [3 4]]) ?
14:11tcrayfordthat works
14:11tcrayfordcheers
14:13Licenserchouser: thanks anyway :) I'll look into that
14:19Borkdudeany ideas for default metasyntactic variable names in Clojure, or foo, bar, baz still going strong?
14:26defndog, cat, fish
14:26defn:D
14:27chouserif you check rhickey slides I think you'll see a lot of fred, ethyl, ricky, lucy
14:28tcrayfordchouser: got the defn stuff working now, cheers for the help earlier today
14:28BorkdudePython has names from Monty Python, what would be suited for Clojure... funny java class names from the past, or Common Lisp car,cdr antiquities?
14:28chousertcrayford: sure. Maybe someday I can use your work.
14:28arkahnProgramming Clojure was reviewed on slashdot.org ^^
14:30Borkdudechouser: maybe names from the great persons in computer science history? Turing, McCarthy, Hickey? :P
14:32Borkdudechouser: obviously those names you mention are from some TV series I don't know.. I googled for it
14:32cemerickricky and lucy I knew -- fred and ethyl didn't ring any bells
14:33rhickeyethel
14:33rhickeyI Love Lucy
14:33cemerickmy first guess re: fred & ethel were the honeymooners
14:34chouserRicky and Lucy's friends.
14:34Borkdudeethyl is something that can get you warm also though
14:34cemerickchouser: thank goodness for google
14:35cemerickrhickey is either laughing his ass off or facepalming right now :-)
14:36chouserWhich is fine until we have some new reference type named 'lucy' that claims to change it's state over time, but is actually just lying about it.
14:36cemerickbah, I *almost* get that joke.
14:36chousercemerick: Am I not younger than you?
14:37cemerickchouser: no idea -- recently turned 30 here
14:37chouserwe seem to be on the wrongs sides of this conversation.
14:37chouserah, indeed. So I guess maybe the 4 years I have on you is enough to up my awareness of ancient TV shows.
14:38cemerickI've never watched much TV, so most pop culture reference go right over my head.
14:38cemerickCosby was the first sitcom that I have any comprehensive memory of.
14:38cemerickor maybe the A-Team
14:39Borkdudechouser: you may also be geographically advantaged in your knowledge of this series?
14:39chouserBorkdude: probably not compared to cemerick
14:39jkkrameranyone know why elpa keeps telling me "File exists: /Users/xxx/.emacs.d/elpa/clojure-mode-1.7.1/clojure-model.el" and then just sits there when i try to install clojure-test-mode or swank-clojure?
14:39cemerickgeography plays into this?
14:40chouserthough I was under the impression Lucy was more popular in Europe than it was here. But I don't know where I picked up that idea.
14:40Borkdudecemerick: of course, why would I know an ancient American series?
14:40jkkrameri tried deleting ~/.emacs.d/elpa altogether and starting fresh, no luck
14:40cemerickBorkdude: oh, I thought you were comparing east coast vs. the interior.
14:41tcrayfordjkkrammer: are you using OSX and deleting the files with the finder?
14:41Borkdudecemerick: I had no idea where you both were from, but now I know you are either from the coast or interior
14:41jkkrameri'm using osx but deleting the files with rm -rf
14:41tcrayfordweird then
14:41cemerickPop culture has historically taken some time to migrate to the interior, at least that's been my impression when traveling.
14:41cemerickBorkdude: I'm in Massachusetts.
14:41tcrayfordhave you tried `cat ~/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el
14:42Borkdudecemerick: ah
14:42jkkramertcrayford: the file is there, and looks normal
14:43tcrayfordweird
14:43jkkramerstarting from scratch, clojure-mode installs normally, but then clojure-test-mode fails. if i do clojure-test-mode first, it seems to install clojure-mode, slime, and slime-repl, but not swank-clojure. trying to install swank-clojure then fails
14:43jkkramerthis is using aquamacs, btw
14:44jkkramermaybe i should bite the bullet and use regular emacs
14:44drewrno bullet-biting required; it's the sensible choice
14:44tcrayfordthere's a good cocoa fork somewhere about on github that has proper fullscreen support
14:44technomancyjkkramer: I've fixed that bug in package.el, but it hasn't been patched upstream yet. =(
14:44tcrayford(which I've been using for months)
14:45tcrayfordtechnomancy: umbrella nearly works without caring about variable names
14:45jkkramertechnomancy: ah, shucks. is the patch somewhere i can get to, then apply it manually?
14:45lancepantzi had not problem with aquamacs and the aquamacs-starter-kit
14:47technomancyjkkramer: check my package.el repo on github
14:48jkkramertechnomancy: thanks
14:49bmasonanyone else got this error with clojure.contrib.sql, calling "transaction"?
14:49bmasonNo matching method found: println for class swank.util.io.proxy$java.io.StringWriter$0
14:49hugodtcrayford: how do you get fullscreen with the cocoa port - I couldn't find a way of getting rid of the apple menu...
14:50tcrayfordhugod: using a patched version I found on github, that has ns-toggle-fullscreen as a builtin
14:50bmasonI see this in the backtrace: 2: clojure.contrib.sql.internal$print_update_counts__2085.invoke(internal.clj:132)
14:52stuarthallowaybmason: that should be fixed on edge clojure
14:53bmasonI'm running snapshot 1.2 right now
14:53polypus gearing up to give netbeans and eclipse another go. curious as to how much of paredit features are implemented in their respective clojure plugins?
14:53bmasonis that different from edge?
14:53hugodtcrayford: thanks, found it
14:53lancepantzpolypus: netbeans has paredit?
14:54stuarthallowaybmason: shouldn't be... checking
14:54bmasonlein deps should pull down most recent right?
14:54cemerickpolypus: both have very limited support; counterclockwise (eclipse) is ahead on that count, but not by much AFAIK
14:55polypuslancepantz: that's what i'm trying to find out. i read that ccw has paredit-like features, but google code seems to be down, so can't try
14:55lancepantzah, that'd be cool
14:55polypuscemerick: ty. which do you prefer?
14:55stuarthallowaybmason: how recent is your snapshot? There is a May 7 commit that should fix that
14:55cemerickpolypus: enclojure (netbeans)
14:56bmasonhmm... not sure how to check that
14:56bmasonI just ran lein deps... I was assuming that would pick up latest
14:56cemerickpolypus: very brief impressions of the various environments are at the bottom here: http://bit.ly/bvjSts
14:56sexpbot"The Ideal Clojure Development Environment - Chas Emerick - Muck and Brass"
14:57polypuscemerick: ty. reading now
14:57stuarthallowaybmason: lein deps doesn't clean out old stuff unless you run "lein clean" first
14:57bmasonstuarthalloway: clojure-contrib-1.2.0-20100507.230536-107.jar
14:58bmasonkk, I'll do clean
14:59bmasonok, after that it seems to have pulled the same jar
14:59bmasonit didn't pull updates from the server it just copied from the local cache
15:01jkkramertechnomancy: your package.el worked. the new versions of clojure-mode et al are awesome, thanks!
15:01stuarthallowaybmason: what is the name of contrib in your project.clj?
15:02tcrayfordcemerick: does netbeans/etc have a decent clojure debugging experience?
15:02bmasonstuarthalloway: [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
15:02cemericktcrayford: in what sense?
15:03stuarthallowaybmason: hmm, sounds right
15:03stuarthallowayit is the *clojure* jar that has the bugfix, btw
15:03polypuscemerick: does enclojure do auto-indentation, rainbow parens, and barfage/slurpage?
15:03bmasonah
15:03cemerickpolypus: yes, no, and....what? :-)
15:04lancepantzhahahaha
15:04tcrayfordcemerick: as in, better than you get from a repl etc
15:04bmasonstuarthalloway: now, my clojure dep is written as [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
15:04Borkdudepolypus: barfage/slurpage is that paredit functionality?
15:04stuarthallowaybmason: also sounds right -- does it get you a build later than May 7?
15:04bmasonand the jar is clojure-1.2.0-master-20100507.230258-69.jar
15:05polypuscemerick & Borkdude: yeah when you pull in or spit out stuff from a sexp. i use that a lot
15:05cemericktcrayford: well, you can set breakpoints in clojure code, and step around as you'd expect. Last time I used it, the variables console didn't show "pretty" versions of clojure values, which is its main shortcoming. The NetBeans-default toString representation is pretty reasonable.
15:06polypusalso splice and raise
15:06cemerickThat may have already been improved since the last time I used the debugger, tho.
15:06polypusare indespensable
15:06lancepantzpolypus: i think paredit is emacs only, there was something about limited similar functionality in vim a few weeks ago
15:06cemerickpolypus: I largely have no idea what you're talking about. :-) Sorry. These are paredit terms?
15:06Borkdudepolypus: I recently discovered that, it's very useful indeed
15:06polypuscemerick: yeah
15:07lancepantzi recently discovered paredit too, pretty great
15:07Borkdudecemerick: I think some paredit things are in Counter Clockwise
15:07Borkdudebut it's unclear to me how far they/he got
15:07cemerickOK. Well, CCW seems to focus more on that. Enclojure has good selection/navigation shortcuts, but nothing that modifies code.
15:08cemerickI'm not familiar with paredit at all, so I'm not in a position to say much more than that.
15:08tcrayfordI'm not sure I can even imagine editing lisp these days without paredit :/
15:08polypuscemerick: cool, thanks for the info
15:09bmasonyeah, an IDE without paredit functionality might be a dealbreaker for me too
15:09cemerickheh, everyone has their 80/20 :-)
15:09bmasonI've been looking at moving to netbeans but not having paredit would be a significant loss
15:10polypustcrayford: same, but some things about emacs annoy me. my ideal environment would be a simple text editor like textmate with full repl and paredit support
15:10Borkdudecemerick: what is the JVM tooling you meant on Twitter?
15:10tcrayfordI'm debating applying to jetbrains and seeing if they'll support me writing proper refactoring support + all the tooling I've done for emacs for intellij
15:10tcrayfordseeing as I already know how to do ~90% of the stuff in cmerick's post
15:11chouserinteresting. not netbeans?
15:11cemerickBorkdude: debugging, profiling, code coverage tools, and then all the simpler stuff that you'd expect in a Java dev environment.
15:12tcrayfordchouser: not sure if I'd get commercial support with netbeans
15:12chouserah
15:12tcrayfordit'd be an interesting summer project or summat
15:12cemerickNetBeans appears to be a JavaFx-only zone these days w.r.t. new dev.
15:13cemerickThat's harsh and a little disingenuous, but that's my overall impression atm.
15:13tcrayfordand like you said, Intellij already commercially supports la clojure development
15:13cemericktcrayford: Its pace seems to suggest that it's decidedly a part-time thing for the one guy they've got on it. *shrug*
15:15alexykis there a version of get-in which returns a default?
15:15tcrayfordcemerick: I'm just wondering if they'd be willing to support me (just food) to hack on it remotely over a summer.
15:15cemericktcrayford: seems like it's worth a shot in any case :-)
15:15tcrayfordunfortunately it'd have to be the summer after the coming one, already got an apprenticeship lined up
15:16alexyktcrayford: I'd ask for shelter and good sex as well while at it. Stellar code is worth it.
15:16Borkdudealexyk: (or (get-in [:a "foo"] [:b]) "default") ?
15:16bmasonwhat's the naming scheme on the clojure & clojure.contrib jars?
15:17alexykBorkdude: yeah, I can or it myself for sire, but was wondering for a built-in
15:17bmasonis there a way to figure out from clojure-1.2.0-master-20100507.230258-69.jar what date it was modified?
15:18stuarthallowaybmason: the bit after -master is the date
15:18alexykbmason: I guess this is when it's built by the integration server after a push, so should coincide
15:18lancepantzheheh
15:18bmasonah ok
15:18bmasonyeah I guess it is 2010 :)
15:19Licenser2010/05/07?
15:19stuarthallowaybmason: you are back ten days compared to http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/
15:19sexpbot"Index of /snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/"
15:19alexykstuarthalloway: what's the state of the last-var-wins battle? Are you holding the fort?
15:19bmasonah, that makes sense
15:19alexykstuarthalloway: against cemerick's cavalry?
15:19stuarthallowayalexyk: may turn it back off, undecided
15:20Licenseralexyk: the last var won
15:20alexykstuarthalloway: perhaps a command-line option?
15:20alexykmaking a warning an error if desired or vice versa
15:20tcrayfordstuarthalloway: to throw in my two-cents (as a user), I like it
15:20stuarthallowayalexyk: this and other forms of added complexity have been discussed
15:21cemerickalexyk: heh, just trying to keep things as simple as possible
15:22alexykcemerick: I was often befuddled when I do a use and just one puny conflict rukins it for me. Then I go into ns-magic to find the var and unalias it like a dirty var it is. So there last var would help... but it is unclean. Hard to decide!
15:22alexykruins
15:22bmasontechnomancy: any ideas why "lein clean && lein deps" would still leave me on a 10 day old snapshot?
15:22Borkdudealexyk: hmm the get-in doesn't take a default value, maybe it would be nice if it could do: (reduce #(get %1 %2 "default") {:a "foo"} [:b]) indeed
15:23alexykBorkdude: yeah, and would be consistent with get.
15:23cemerickalexyk: a good argument for not using use of course :-)
15:23tcrayfordare there any scalars in clojure that allow metadata (apart from vars)
15:23alexykbmason: do you have the snapshot repos in project.clj?
15:24bmasonalexyk: what if the functionality were configurable, so you could say wipe out the old vars when I'm in my dev environment but not in production?
15:24opqdonuttcrayford: symbols?
15:24tcrayfordopqdonut: cheers
15:24bmasonalexyk: [org.clojure/clojure "1.2.0-master-SNAPSHOT"]
15:24bmason[org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
15:24alexykbmason: I guess stuarthalloway dislikes complexity. Then optimizing for lowest overall complexity of the Universe becomes hard :)
15:24hiredmanvars are "scalars"?
15:24bmason:-D
15:25tcrayfordish
15:25tcrayfordwell they aren't
15:25alexykwhich I agree with and it needs a bunch of gurus to estimate the expected perceived complexity
15:25chousertcrayford: symbols
15:25tcrayfordsymbols work fine though
15:25opqdonutI guess he meant "non-collections"
15:25tcrayfordyeah
15:26alexykbmason: you need to specify the repos where the snapshots come from separately
15:26hiredmanscalar seems like such an arbitrary distiction
15:26bmasonalexyk: what do you mean?
15:26tcrayfordgoogle definitions has the following (amongst others) under scalar: a variable quantity that cannot be resolved into components
15:26alexykoh wait, lein's supposed to know about them
15:26bmasonyeah, lein comes with 4 standard repos
15:27bmasonI wonder if I need the org.clojure/ qualifier...
15:27alexykbmason: right, specifying -SNAPSHOT should be enough as lein knows about the usual suspect repos. Unless you have a very old one.
15:27hiredmanclojure numbers can be bigdecimals, which technicalling are composed of two parts
15:27alexykyou can specify your own repos like, :repositories {"incanter" "http://repo.incanter.org&quot;}
15:27hiredmanso then numbers aren't scalars?
15:27hiredmanor only are sometimes?
15:28alexykbmason: looks right to me
15:28hiredmanscalarness is an abstraction leak
15:28Borkdudehiredman: maybe only 1 and 0 are scalars
15:29alexykbmason: http://build.clojure.org/job/clojure/
15:29sexpbot"clojure [Hudson]"
15:29hiredmanBorkdude: how so?
15:29alexykthey just built a new one 24 minutes ago
15:29alexykfirst time after 5/7
15:29bmasonhehe
15:29bmasonmaybe things just haven't updated yet
15:29Borkdudebecause every other thing in memory seems to be composed from them
15:29alexykhttp://build.clojure.org/ has all
15:29sexpbot"Dashboard [Hudson]"
15:29hiredman1 and 0 don't exist, just varying levels of electrical current
15:30hiredmanjust because it is possible to represent something as a single unit it memory, do we want to call it a scalar and lock ourselves into that?
15:30alexykhipertracker: heads and tails do exist! (throws a coin)
15:31alexykhiredman I meant
15:31Borkdudehiredman: maybe then look for a fifth mutable thing in Clojure, that is smallar than an atom?
15:31tcrayfordhiredman: I was asking syntactically more than anything
15:31hiredmantcrayford: what do scalars have to do with syntax?
15:32bmasonso... it sounds like caches probably just haven't updated yet for the new build
15:32tcrayfordwas looking for something that wasn't a literal collection, but yet still supported metadata
15:32Borkdudehiredman: hmm, if it would be the most atomic thing, would it still be mutable?
15:32hiredmananyway, "scalars" just rubs me the wrong way
15:32hiredmanBorkdude: what do scalars have to do with mutability?
15:32tcrayfordit does now I've thought about it
15:32Borkdudehiredman: since you went into the electronical world, I was thinking electrons
15:33Borkdudeand atoms clearly exist in Clojure
15:33Borkdudenever mind ;)
15:33hiredmanis a long a scalar on 32 bit machines?
15:33hiredmanthey can call the chapter whatever they want
15:34tcrayfordand then they cover all the non-collection types in there
15:34hiredmanit doesn't make "scalars" less annoying
15:34tcrayfordaye
15:34turbofailthat's what we need... a book on clojure written in the style of james joyce
15:34tcrayfordthat was where I thought of that name for what I was trying to express
15:34tcrayfordbut it doesn't really work
15:35hiredmanif symbols are implemented as records via defcrecord, are they still "scalars" ?
15:36hiredmanare ratios really scalars?
15:36Borkdudehiredman: is something that can contain metadata still a scalar?
15:36chouserhiredman: the book's not in print. we're open to suggestions.
15:37stuarthallowaychouser: I think you should indeed print it :-)
15:37chouserstuarthalloway: heh
15:37BorkdudeI printed it partly today
15:37tcrayfordanybody got a decent setup with lein with regards to where you put integration tests?
15:37tcrayfordguess I can nest them under ./test
15:38hiredmanchouser: "On things not usually considered to be a collection of other things"
15:38chouserheh, nice.
15:39BorkdudeOn simple types?
15:39tcrayfordwho says that maps aren't simple
15:40Borkdudetcrayford: they are pretty simple to use, hmm, point taken
15:43BorkdudeOn single value data types?
15:43tcrayfordmisleading, numbers aren't a single value data type (if they were there could only be one number)
15:43Borkdudetcrayford: strings are in that sense also a composite of chars
15:43Borkdudeso yes, hmm
15:44tcrayfordarc calls them "atoms" :P
15:44tcrayfordI've used (def lone? (complement coll?)) before
15:44BorkdudeMaybe scalar isn't so bad after all ;)
15:47hiredmantcrayford: well, are java collections scalars?
15:47hiredmanbecause coll? is only true for clojure collections
15:48tcrayfordyou could probably adapt lone? so that it works for the type of things we're talking about
15:48tcrayfordstill not sure what to call them though
15:49BorkdudeNon-persistent bastards
15:53hiredmanBorkdude: 1 is pretty persistent, as long as it's not auto promoted to BigDecimal at some point
15:57metaperl_broken link on this page ( http://clojure.org/getting_started ) --- """Also, Sean Devlin has put together a series of screencasts showing how to install several Clojure editing modes. Thanks to all!"""
15:57fogus_I was hoping people would read that chapter as "On Scala" :p
16:00Borkdudefogus_: no but you got me interested a little more in Haskell as I progress
16:01fogus_Borkdude: That makes two of us
16:02arkahnwhy does (if-let [x nil] ...) bomb out? : / I thought it was supposed to go to an 'else' condition
16:02Borkdude,(doc if-let)
16:02clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
16:03Chousukeoldform? :/
16:03Chousuke~def if-let
16:03Borkdude,(if-let [x nil] "true" "false")
16:03clojurebot"false"
16:04Chousukeeh, what's wrong with the def lookup :(
16:04arkahnoh... at my repl, it bombs
16:04arkahn1.1.0
16:04Borkdude,(clojure-version)
16:04clojurebot"1.1.0-master-SNAPSHOT"
16:04tcrayfordworks here at 1.2
16:04Chousukewhat does the exception message say?
16:04Borkdudearkahn: maybe paste the whole expression?
16:05tcrayfordclojurebot: why are you so slow looking up the if-let definition
16:05clojurebotIt's greek to me.
16:05hiredmanand I ended up at the wrong line number
16:05Chousukeah, right, oldform is backwards "compatibility" :P
16:05hiredmancould just be github being dumb too
16:06Chousukeif-let used to be (if-let x foo ...)
16:06arkahnwait ... now it works ... looking....
16:07arkahnugh .. sorry, I guess the repl doesn't like multiline input
16:07arkahnthat was my problem
16:09tcrayfordI need a better name for "replacing all symbols that could be bound to something with fixed symbols"
16:16replacastuarthalloway: you there?
16:16stuarthallowaysorta :-)
16:16replacastuarthalloway: so you deleted pprint_base and dispatch altogether, right?
16:17stuarthallowayreplace: I removed files being loaded at the top pprint to isolate cl_format
16:18stuarthallowaythen deleted code from the bottom of cl_format working up
16:19replacacool, so you still had both pprint_base and cl_format, right?
16:20replacaI have no idea why just loading that fn could cause a problem
16:20replacabut I can do a bunch more stuff to simplify and also look at what a profiler tells me
16:21bmason,(parse (java.io.StringReader. "<foo><bar /></foo>"))
16:21clojurebotjava.lang.Exception: Unable to resolve symbol: parse in this context
16:22stuarthallowayreplaca: I suspect the problem is nonlocal to the symptom
16:22bmasonhmm... getting No matching method found: parse for class com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
16:22replacastuarthalloway: do you see this problem with the new clojure.pprint as well?
16:23bmasonam I doing something wrong?
16:25stuarthallowayreplaca: did not try it
16:25replacastuarthalloway: ok, I'll try that flavor too. I won't get to it until tonight
16:25alexykwhen trying to prepend an element to a vector with cons, I get a thing which looks right, but has a type Cons:
16:25alexyk,(type (cons 1 [2 3]))
16:25clojurebotclojure.lang.Cons
16:26alexyk,(cons 1 [2 3])
16:26clojurebot(1 2 3)
16:26alexyk,(type (cons 1 '(2 3)))
16:26clojurebotclojure.lang.Cons
16:26alexyk,(cons 1 '(2 3))
16:26clojurebot(1 2 3)
16:26phobbsI'm having trouble setting up slime
16:26alexykwhat have we here?
16:27phobbsit won't bring up a *slime* buffer, but it does bring up an inferior-lisp buffer
16:27replacaalexyk: it would appear we have a cons :-)
16:28alexykreplaca: yeah :)
16:28bozhidarphobbs: are you using slime from ELPA?
16:28alexykwhat's the fastest way to prepend an element to a vector and have a vector as the result?
16:29stuarthalloway_alexyk: you should generally not do that
16:30stuarthalloway_by "fastest" are you talking developer ease or execution speed
16:30alexykstuarthalloway_: true... but say I want to?
16:30alexykstuarthalloway_: execution
16:30phobbsyes, using ELPA
16:30phobbsI've tried it emacs -q and it works
16:30LauJensenIm done cooking: http://www.bestinclass.dk/index.clj/2010/05/refresh-your-cache--best-in-class-has-been-baked.html
16:30sexpbot"Best In Class: Refresh your cache - Best In Class has been baked"
16:30phobbsso something in my config is supressing it
16:32ninjuddalexy: why not just use a list? those are optimized for prepending
16:34stuarthallowayalexy: idiomatically, use (into [] ...)
16:34ninjuddalexy: then just do (vec list) at the end when you want a vector
16:35alexykninjudd: yeah; what I do is drag a vector of parameters [x y z u v] across functions. Now I modify x and glue the rest to pass on. If I were to keep itr as a list, have to remember to change all []s to ()s... and it may glue things in a wrong way if I forget.
16:35LicenserLauJensen: I personally like fried things a lot
16:35Licenseror grilled
16:35alexykI destructure as [x & tail] and would glue back x*, the modified x, to tail
16:37alexykI guess i'd have to add a precondition to make sure I have the right structure for the parameters to make sure a conj works right
16:37alexykor I need an automagical vectorizer or listorizer
16:42notostracaalexyk: are you trying continuation-passing style? that sounds like what you are talking about
16:42Chousukealexyk: don't destructure, just read the first parameter, and assoc the modified one to the first index?
16:42Chousukealexyk: you don't need to construct a whole new vector that way.
16:42Chousukethough that's what probably happens anyway, if it's a small vector :P
16:42technomancyphobbs: check the latest swank-clojure readme and see if you can launch your swank server separately and then connect with M-x slime-connect. it's generally much more foolproof.
16:42alexyknotostraca: am not intentionally, link to what you mean! :)
16:43phobbstechnomancy: I've also tried that, that's worse since it still doesn't create a slime buffer and it doesn't even make an inferior lisp buffer
16:43alexykChousuke: makes sense
16:44Chousukealexyk: or, you can destructure with the :as directive
16:44technomancyphobbs: if you can describe the steps you tried for M-x slime-connect and send them to the mailing list I can look into it when I've got some time.
16:45Chousuke,(let [[a & bs :as v] [1 2 3]] [a bs v]) I think it goes something like this :P
16:45clojurebot[1 (2 3) [1 2 3]]
16:45phobbstechnomancy: OK, thanks.
16:45alexykChousuke: yep
16:46jkkramerLauJensen: your comment button gives a 404 error
16:47alexyk,(assoc [1 2 3] 0 4)
16:47clojurebot[4 2 3]
16:47alexykscary
16:48LauJensenjkkramer: sec
16:49LauJensenjkkramer: better?
16:49jkkramerLauJensen: yup, shows up now
16:49LauJensenjkkramer: great, thanks a lot for staying sharp
16:50alexykLauJensen: you're gotta get some flak for the political turtle payground :)
16:50jkkramerLauJensen: looking forward to seeing the blog code, btw. i was going to write a baked clojure blog, now i may not need to
16:50LauJensenalexyk: huh?
16:50LauJensenoh, you mean the persecutors at 90 degrees and the persecuted at 120?
16:50alexykLauJensen: the turtle playground post shows politically charged symbols in sequence :)
16:51LauJensenjkkramer: Most of it is very reuseable, so mostly you'll just need to handle design
16:52jkkramerLauJensen: are you handling clojure syntax highlighting on the fly, or just pasting in html from elsewhere?
16:52BorkdudeLauJensen: very cool, but I hope I don't have to turn on cookies?
16:53alexykLauJensen: ah, see your disclaimer below the graphics. too late :)
16:56LauJensenBorkdude: no cookies
16:56LauJensenjkkramer: SH is just M-x htmlize
16:57BorkdudeLauJensen: just kidding btw
17:25phobbsI'm getting "File mode specification error: (error "Invalid timer")
17:25phobbscancel-timer: Invalid timer" when I try to install swank-clojure from elpa
17:25phobbsthis is from a fresh emacs-starter-kit installation
17:31chouser,(key nil)
17:31clojurebotjava.lang.NullPointerException
17:31chouserwhy? should that just return nil?
17:38dakronechouser: isn't it doing that because it's trying to do a look up the key of a nil map?
17:38Borkdudechouser: just thinking. (map key {:a :b}) => (:a), (map key {}) => () ?
17:38tcrayford,(clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL (read-string "(defn a [b c] (+ b c))"))
17:38clojurebot#<DefExpr clojure.lang.Compiler$DefExpr@c6ebd5>
17:38tcrayfordinteresting
17:38tcrayfordthat breaks for me here
17:39tcrayfordcan somebody else on 1.2 check that for me?
17:39chouser'key' expects a MapEntry, but I expect it to fail gracefully. Like meta does.
17:39chouser,(meta nil)
17:39clojurebotnil
17:39AWizzArd,*clojure-version*
17:39clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
17:40dakronetcrayford: #<DefExpr clojure.lang.Compiler$DefExpr@31e46a68>
17:40tcrayforddakrone: was that on 1.2?
17:40dakroneyes
17:40tcrayfordinteresting
17:40tcrayfordit works here outside of the repl as well
17:41hiredmanI should really restart clojurebot to pick up a newer clojure version
17:43tcrayfordis there a decent way to reset a mulitimethod?
17:46AWizzArdtcrayford: (find-doc "method") reveals remove-all-methods
17:49tcrayfordAWizzard: cheers. I hacked a solution around (used a defn to redefine the var, then re-evalled the multimethod stuff), but its nice to know there' a proper way of doing it
17:50AWizzArdyes, plus find-doc is your friend (:
17:54alexykis there a shorter way to destructure a map into renamed keys:
17:54alexyk,(let [[aa bb] (let [{:keys [a b]} {:a 1 :b 2}] [a b])] [aa bb])
17:55tcrayfordtranform the map first?
17:56Chousuke,(let [{aa :a bb :b} {:a 1 :b 2}] [aa bb])
17:56mannicheLauJensen: http://bestinclass.dk/index.clj/ has a redirect loop and the redirect link from http://blog.bestinclass.dk/ gives a 404
17:56Chousuke$(let [{aa :a bb :b} {:a 1 :b 2}] [aa bb])
17:56sexpbotresult: [1 2]
17:57alexykhah!
17:57LauJensenmanniche: Good catch, thanks
17:57alexykclojurebot: envy sexpbot
17:57Chousukethe :keys form is a shortcut for the most common case :P
17:58mannicheLauJensen: no, thank you for maintaining a great blog. Keep it up!
17:58KirinDave:\
17:58KirinDaveIs tail recursion so arcane?
17:58alexykChousuke: cool, thx
17:59ChousukeKirinDave: arcane? :/
17:59alexyk$(print "bow before me, clojurebot weakling!")
17:59sexpbotresult: bow before me, clojurebot weakling!
18:00KirinDaveChousuke: I just ipad'd out a question answer on clojure about tail calls. Someone was complaining that their obviously-not-tail-call was not tail-calling.
18:00Chousukeheh.
18:00alexykKirinDave: is ipadding an act of banging on somebody's head with an ipad?
18:00Chousukewell, it's a bit difficut to tell sometimes I guess
18:00KirinDavealexyk: No, it's laboriously typing lisp on an ipad.
18:01KirinDaveI hope I didn't make any egregious errors. -_-
18:01Chousukebut at least with clojure you get an error instead of accidental non-tail recursion :P
18:01LauJensenKirinDave: If you've paid for an ipad, you deserve some pain
18:01LauJensen:)
18:01alexykKirinDave: that gonna hurt
18:01KirinDaveLauJensen: At least when typing lisp.
18:01alexykbefore they make that keyboard stand
18:01alexykunless they did already
18:01KirinDaveThey did.
18:01KirinDaveI have it, just not here with me.
18:01alexykI furiously weigh the need for an ipad to sync my papers with Papers, but it seems smallish and now you carry 3 things.
18:02KirinDavePapers is uh-maaayyyy-zing.
18:02hiredmanwhen you launche lein swank, is src/ not on the classpath?
18:02alexykKirinDave: can you read 2-column on ipad?
18:02KirinDaveI didn't buy an iPad because of it. But after I saw it I felt much better about my decision.
18:02KirinDavealexyk: Yes.
18:02KirinDavealexyk: Esp now that they have a fullscreen reader mode with no controls. Just a few % more magnification made all the difference.
18:03alexykKirinDave: can you zoom to one column easily in preset amount or you always have to tune it and scroll?
18:03KirinDaveYes.
18:03alexykloovely
18:03KirinDaveAlthough the tuning is sorta automagical and not always correct.
18:03KirinDaveDoube-tap TRIES to estimate, but doesn't always get it right.
18:03alexykwell it'll get better I'm sure. Too bad Amazon didn't let them do a Kindle app yet
18:04KirinDave???
18:04KirinDaveThey got shut down on that?
18:04KirinDaveOh well, the Kindle is a miserable PDF reader.
18:04alexykthey talked to Amazon to get Papers onto Kindle, but I guess Amazon is not there with any apps at all yet
18:04KirinDaveYeah, well no great loss
18:04KirinDaveI have a Kindle DX. I would not use it for reading PDFs over my iPad.
18:05alexykKindle DX's PDF is OK and it's big enough. For any prolonged reading I'd prefer it for single-columns, but have to compare to ipad of course
18:05alexykand double-columns suck on DX
18:06KirinDaveYes, it lacks the resolution.
18:07KirinDaveI was very disappointed with my DX.
18:07KirinDaveI'm hoping to resell it.
18:07alexykKirinDave: you can do it in horizontal, but then you have to scroll up and down like crazy
18:07alexykfor books it's OK though
18:07KirinDaveIt's also just lacking in resolution.
18:07KirinDaveAnd for programming books with code samples it often fails, badly.
18:07KirinDaveFrequently the syntax highlight gets reproduced as illegibility on the DX.
18:08KirinDaveOr so is my experience with pragprog books on that device
18:08alexykKirinDave: yeas, it's iffy, while mostly OK for me. Yet you get to buy $10 bestsellers and any kinds of non-programming books OK.
18:09alexykStu's book is OK in mobi
18:09KirinDaveyes. My kindle 2 I still use, periodically.
18:09KirinDaveSo are there any clojure luminaries who are NOT currently wrapped up in book authoring?
18:09KirinDaveI was asked to check around.
18:10alexykKirinDave: how'd you compare Stu's book in PDF on iPad vs .mobi on DX?
18:10KirinDavealexyk: In general the iPad does a much better job.
18:10KirinDaveThat's to be expected.
18:10alexykKirinDave: but specifically? :)
18:10KirinDaveSpecifically in this case, a much better job.
18:10KirinDaveColor, better zoom, etc.
18:10alexyk:)
18:10KirinDaveIf the screen doesn't give you issues with its glossiness, the iPad is a superior reader in nearly every dimension.
18:11KirinDaveBut then, I read only infrequently in super-bright conditions.
18:11alexykKirinDave: I don't believe you can read as long without straining your eyes and hands
18:11alexykgotta compare with 2 red-eye flights, one device all the way each way
18:12alexyka pragprog book each way :)
18:12KirinDavealexyk: I stare at a computer monitor all day.
18:13KirinDaveWhy would looking at an ipad tire my eyes anymore than my led-backlit monitor?
18:14KirinDaveI am catching up on the clojure mailing list after a month or so of neglect
18:14KirinDaveMan, there are some truly painful threads on there.
18:14KirinDaveFor example, lauding http://pchiusano.blogspot.com/2010/01/actors-are-not-good-concurrency-model.html
18:14sexpbot"Prettt-tty, pretty, pretty good!: Actors are not a good concurrency model"
18:14alexykKirinDave: Kindle strains the eyes less than a monitor for sure
18:15KirinDavealexyk: I've only found marginal benefits there. It depends strongly on the lighting.
18:15alexyktrue
18:18alexykKirinDave: yeah, using isolated Scala rants to support Clojure is iffy. AKKA kernel is not a small thing and shows Scala's modular nature too.
18:18alexykbut I tried Scala actors out of the box and they are annoying
18:18KirinDavealexyk: I think it's an erlang rant?
18:19alexykafter that Clojure shines on a multi-core box
18:19alexykKirinDave: no, Paul is a Boston Scala guy
18:19KirinDaveWhat an unfortunate person. Misinformed and lacking good taste.
18:19alexykI'd rather use Scala and Clojure in an interop mode, instead of Java for speed
18:21alexykfor certain tasks Scala will be faster; and both signify FP progress. So the best modus operandi is to root for both IIMHO
18:37bendlasHi folks
18:38hiredmanping?
18:38scgilardipong
18:38danlarkinzap
18:39KirinDavewhoop
18:52emhI'm having trouble defining multimethods with variable arity. is this supported? any examples out there?
18:55emhthere. I got it, finally
19:49hiredman,*clojure-version*
19:49hiredmanhmmm
19:50hiredmanping?
19:51hiredmanping?
19:51_mstpong!
19:51hiredman,*clojure-version*
19:51hiredman,*clojure-version*
19:51clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
19:52hiredmanclojurebot: go away
19:52clojurebotTitim gan éirí ort.
20:08kyleburton,(find-doc "send-off")
20:08clojurebot------------------------- clojure.core/send-off ([a f & args]) Dispatch a potentially blocking action to an agent. Returns the agent immediately. Subsequently, in a separate thread, the state of the agent will be set to the value of: (apply action-fn state-of-agent args) ------------------------- clojure.core/set-error-mode! ([a mode-keyword]) Sets the error-mode of agent a to mode-keyword, which must be either :fail or :c
20:22mmarczykis Leiningen HEAD unusable with Clojure 1.1 projects?
20:23technomancymmarczyk: who knows, man... who knows?
20:24technomancymmarczyk: seriously, it should work.
20:28mmarczyktechnomancy: well, for some reason a Clojure 1.1 project I'm testing exhibits weird behaviour with lein repl from HEAD
20:29mmarczyknamely two repl prompts are printed with no trailing newline, then control returns to the shell
20:29mmarczykin contrast, lein-stable (1.1.0) works fine
20:29technomancymmarczyk: ah, that's a bug in the repl task, yeah. haven't been able to reproduce it recently
20:29mmarczykhttp://stackoverflow.com/questions/2851011/wrong-number-of-args-passed-to-replrepl
20:29sexpbot"Wrong number of args passed to: repl$repl - Stack Overflow"
20:29mmarczykI was thinking of writing a comprehensive answer :-)
20:30mmarczykthere's a link to this "hello world" tutorial for Compojure, http://weavejester.github.com/compojure/docs/getting-started.html
20:31technomancymmarczyk: post it to the lein mailing list and I'll try to take a look at it when I have some time later
20:31mmarczykok
20:34lancepantz≈≈≈≈≈≈≈
20:37tufflaxI have clojure.jar on my classpath, and I'm unable to run "java clojure.main", shouldn't I be able to do that?
20:39rhudsontufflax: what's the error you see?
20:39tufflaxException in thread "main" java.lang.NoClassDefFoundError: clojure/main
20:40mmarczyktufflax: what makes you think you've got clojure.jar on your classpath?
20:40technomancytufflax: probably don't have your classpath set quite right. java doesn't know how to expand ~ => $HOME, for instance.
20:41tufflaxI made java program that printed my classpath to make sure, and its .;"C:\Program Files\clojure-1.1.0\clojure-1.1.0\";"C:\Documents and Settings\oskarkv\Desktop\clojure-1.1.0\clojure.jar"
20:41mmarczyktufflax: actually, never mind that, but if you mean something like $CLASSPATH, a "global" classpath is asking for trouble, just use -cp
20:42tufflaxAnd I think that classpath is fine, yes?
20:43mmarczykum, I'd expect the " " to go around the whole thing, not individual components, but I'm not on Windows and wouldn't really know... so maybe I'm speaking nonsense now
20:43tufflaxheh
20:44tufflaxboth works when I provide the -cp argument
20:47mmarczykand if you used just "C:\Documents and Settings\oskarkv\Desktop\clojure-1.1.0\clojure.jar" as your global (brrr!) classpath?
20:47tufflaxwell, let's see
20:50tufflaxNo, doesn't work
20:51mmarczyk:-(
20:52mmarczykno idea then
20:52mmarczykthough you should probably use something like Leiningen to set up a project-specific cp for you anyway
20:52mmarczykso I'm not sure if it's really worth your while to pursue this particular issue
20:53tufflaxMaybe not
20:53mmarczyksurprising nonetheless
21:12powr-tocDoes anyone here use Enclojure?
21:16MadWombatHello
22:24mmarczykany reason why a void method coming from an interface might need an explicit type hint in deftype (and not in reify)?
22:25mmarczykasking in connection with this SO question:
22:25mmarczykhttp://stackoverflow.com/questions/2854041/how-can-i-define-a-clojure-type-that-implements-the-servlet-interface
22:25sexpbot"How can I define a clojure type that implements the servlet interface? - Stack Overflow"
22:29etateman the ^void syntax was a brilliant decision
22:32mmarczykit was, wasn't it :-)
22:32mmarczykjust goes to show how important the little things really are ;-)
22:33arohnermmarczyk: because by default, clojure methods have a java signature that take Objects and return Objects
22:33arohnermmarczyk: apparently the servlet interface has an API that requires returning void
22:33mmarczykarohner: yeah, sure, but (reify javax.servlet.Servlet (service [this req res])) works and you can call .service on it (with nils for req and res)
22:34mmarczykarohner: also, as the SO OP points out, java.util.Set gives no such problems with .clear -- you can implement it in deftype without a hint
22:34mmarczykarohner: apparently the void type is inferred there, which is in line with deftype's docstring... how's Servlet different?
22:36arohnermmarczyk: hrm. I don't know
22:36arohnermmarczyk: that sounds like a fun reason to dig through the sources, but I don't have time right now
22:37alexykI need to loop through a seq. Am now doing things like, (loop [user ((comp second first) data) users (rest data)] ... (recur ((comp second first) users) (rest users))). Is there a way to destructure in loop and recur, or I'd have to do an enclosing let for it? Something like let-loop... somebody will suggest a macro! :)
22:38mmarczykarohner: same here
22:39alexykhmm, can we have a nested (loop ... (loop ... (recur ...) ...) ... (recur ...)) ? I get an error hinting the first recur wants to bind to the outer loop
22:39mmarczyk,(loop [[x y] (range 10)] [x y])
22:39clojurebot[0 1]
22:39mmarczykso apparently you can destructure
22:39arohner"loop is exactly like let"
22:39alexykmmarczyk: how'd you recur?
22:40alexykin the recur, would you have to assign x and y?
22:40alexykhow does recur know to match a nested binding in loop?
22:40dnolen,(loop [[x y :as foo] (range 10)] [x y foo])
22:40clojurebot[0 1 (0 1 2 3 4 5 6 7 8 9)]
22:40alexykdnolen: same as let, no recur
22:41alexykshow me how yo keep matching x and y
22:43mmarczykalexyk: you'd have to provide whatever you want to go in place of (range 10) at the next iteration
22:43mmarczykalexyk: if it's sth like (next ...), use :as xs in the destructuring vector
22:44mmarczyk,(loop [[x y :as xs] (range 10) acc 0] (if y (recur (next xs) (+ acc x y))))
22:44clojurebotnil
22:44mmarczyk,(loop [[x y :as xs] (range 10) acc 0] (if y (recur (next xs) (+ acc x y)) acc))
22:44clojurebot81
22:44chouserbut loop/recur is hardly ever needed
22:45alexykchouser: I verify sortedness of a graph and need early bail from unsorted
22:45alexykchouser: is it ok? :)
22:46mmarczyk,(some > (partition 2 1 (range 10)))
22:46clojurebottrue
22:46mmarczykum, wait, wrong
22:46chouseralexyk: no. :-)
22:47alexykchouser: :( what's the right way then?
22:47mmarczyk,(some #(apply > %) (partition 2 1 (range 10)))
22:47clojurebotnil
22:47chouserI mean, it's ok but there are more succinct solutions
22:47mmarczyk,(some #(apply > %) (partition 2 1 [1 2 3 4 5 7 6 8 9))
22:47clojurebotUnmatched delimiter: )
22:47mmarczyk,(some #(apply > %) (partition 2 1 [1 2 3 4 5 7 6 8 9]))
22:47clojurebottrue
22:48chouser,(let [s [1 2 3 4 5 4 5 6 7 6 7 8]] (map > s (cons 0 s)))
22:48clojurebot(true true true true true false true true true false true true)
22:48mmarczykalexyk: that's one way to walk a sequence until the first point where there are two consecutive numbers which are not <-sorted
22:48chouser,(let [s [1 2 3 4 5 4 5 6 7 6 7 8]] (every? true? (map > s (cons 0 s))))
22:48clojurebotfalse
22:49mmarczykum, maybe (map >= s (cons (first s) s))
22:49mmarczyk:-)
22:49chousermmarczyk: ah, better.
22:49alexykI don't want to compute any pairs after the one which fails, i.e. assume tests are expensive and structures are large.
22:49mmarczykalexyk: you won't, sequence operations tend to be lazy
22:49chouseralexyk: yes. every? will bail
22:49mmarczykevery? and some are
22:50chousermap is lazy
22:50alexykok
22:50alexykgood
22:51mmarczykmap will actually go 32 elements at a time, but every? and some will stop as soon as the value is determined
22:51alexyknice!
22:52chousermap will only go 32 elements on a chunked seq
22:53mmarczyk,(first (map println [1 2 3]))
22:53clojurebot1 2 3
22:53mmarczyka lot of things are chunked seqs, though
22:53chouser,(chunked-seq? (seq [1 2 3]))
22:53clojurebottrue
22:55mmarczykchouser: would you have any idea what goes on with the ^void type hints in deftype discussed ~20 minutes ago (~2 screens upward in the log for me)?
22:56mmarczyk(or I can recap)
22:56alexykstill, can loop/recur be nested, and how do they match then?
22:56mmarczykalexyk: recur always goes to the innermost loop / fn
22:57chouseris there more than one method with the same name?
22:57mmarczykchouser: not that I can see
22:58chouseroh, he should just have no type hints at all
22:58chouser(deftype servlet [] javax.servlet.Servlet (service [this request response] nil))
22:58alexykmmarczyk: I seem to get an error about the number of recur arguments mismatched hinting it binds wrong
22:58chouserif you hint any part of a deftype (or defrecord) method, you must hint every arg and the return
22:58mmarczykchouser: that's what he tried to do and it doesn't work
22:58chouser,(deftype servlet [] javax.servlet.Servlet (service [this request response] nil))
22:58clojurebotjava.lang.RuntimeException: java.lang.ClassNotFoundException: javax.servlet.Servlet
22:58mmarczykchouser: which I verified at the repl
22:58chouserworked for me
22:59mmarczykchouser: really? where do you get your javax.servlet.Servlet from?
22:59chouserI don't see an attempt to use no type hints
22:59chouserjavax.servlet.Servlet is just an interface that comes with the JRE, right? Not a particular implementation?
23:00chouseroh, I guess that's not right. hm.
23:00hiredmanit doesn't come with the jre
23:00mmarczykchouser: ohhhhh
23:00mmarczykchouser: ok, got it now: the ^void is needed if ^ServletRequest is provided (for example)
23:00mmarczykright?
23:00rhudsonServlet comes with Java EE
23:00chouserright
23:00mmarczykwow
23:01chousernever hint unless you have to.
23:01chouser:-)
23:01mmarczykfair enough :-)
23:01mmarczykhowever, there's *nothing* in deftype's docs to suggest this behaviour, IMO
23:01mmarczykit says that type hints should be reserved for disambiguation
23:02mmarczykso presumably you should be able to use them some places and not others...
23:02mmarczykok, here's my semi-official complaint about the docs then ;-)
23:02mmarczykthanks a lot for the answer
23:02mmarczykcare to post it on SO?
23:04mmarczykalexyk: can you paste an example somewhere?
23:04chouser"If not supplied, they will be inferred, so type hints should be reserved for disambiguation."
23:05alexykmmarczyk: http://paste.pocoo.org/show/215106/ sorry this is a one-liner from repl, that's how I develop :)
23:05alexykfirst I'll make it work with loop to see how destructuring works right in loop, then rewrite with every? to make chouser proud!
23:06mmarczykchouser: yeah, that doesn't imply that if I hint two args, the non-hinted type of the return value will no longer be inferred
23:07chouserright
23:07alexykhmm, chrome on mac can't size its own textbox properly to scroll right
23:07alexykhave to click raw to see the line wrapped
23:09chouser"if you supply any hints at all, no inference is done, so all hints (or default of Object) must be correct, for both arguments and return type" -- http://www.assembla.com/wiki/show/clojure/Datatypes
23:09sexpbot"Datatypes | Clojure | Assembla"
23:09mmarczykchouser: ok, so now I think I should have known better ;-)
23:09alexykah ok I missed one, sorry
23:09mmarczykchouser: still, the docstring should probably include this info
23:11mmarczykchouser: not that I'm really complaining, this is unreleased stuff of course...
23:11mmarczykalexyk: got it working?
23:12alexykmmarczyk: well I feed it a map of maps, and it complained nth not supported on this type: PersistentHashMap
23:12mmarczykalexyk: btw, how about rearranging things a bit and using cond instead of nested ifs?
23:12alexykNormally I can call map over a map and it'll seq it for me; can I do next on it, or I have to make a seq out of it explicitly?
23:13mmarczykalexyk: go ahead and try ;-)
23:13alexykmmarczyk: cond sounds good
23:16alexykninjudd: ping
23:17ms4720night all
23:17mmarczykchouser: do you think you'll want to post an answer to that SO q? I guess I need to do sth with mine, either update or remove
23:18mmarczykalexyk: is your function meant to walk along dreps and stop with a false return value if some pair of consecutive items doesn't match your sorting criteria?
23:18alexykmmarczyk: exactly
23:19mmarczykalexyk: then it doesn't make sense to pass a hash map in
23:19alexykmmarczyk: dreps is a hash map, but I take a seq of it
23:19chousermmarczyk: I just posted to SO
23:19clojurebotmap is lazy
23:19mmarczykchouser: oh good :-)
23:20alexykclojurebot: om mani padme hum map is lazy shanti shanti shanti
23:20clojurebot'Sea, mhuise.
23:20mmarczykalexyk: but that seq will come out in essentially random order
23:20chousermmarczyk: I'm not suggesting that the docs couldn't be any better, just mentioning places that such information could be gleaned.
23:20mmarczykalexyk: I mean, it'll be the same if you call seq twice on the same map, but if you add a new key, all bets are off
23:21mmarczykalexyk: (depending on whether resizing happens etc.)
23:21mmarczykchouser: perhaps the docstring could be shortened, with a list of links to extensive documentation, yeah
23:22alexykmmarczyk: dreps contains adjacency lists; it is the nested lists I care about. They are in turn maps of form day value, and the days must be sorted as it's originally a sorted-map. But it was flushed into disk with protocol buffers and reloaded, and apprently that didn't rebuild the sorted-map...
23:22mmarczykchouser: but if it's going to stay as long as it is, it could include a mention of the fact that inference is an all-or-nothing deal
23:24mmarczykalexyk: ok, in that case maybe do a (into (sorted-map) ...) or sth similar when deserialising
23:24alexykmmarczyk: yeah
23:24alexykmmarczyk: or I'll ping ninjudd and ask him to add that to jiraph! :)
23:26mmarczykjiraph? :-)
23:29lancepantzalexyk: he's talked about adding sorted-maps
23:33alexyklancepantz: yeah!
23:34alexykmmarczyk: jiraph is a clojure serialization with tokyo cabinet on github
23:34alexykand google protocol buffers
23:34mmarczykalexyk: googled for it already :-)