2010-05-17
| 00:06 | defn | anyone here do anything like put jruby and clojure together? |
| 00:07 | defn | im interested in using clojure's concurrency semantics via jruby |
| 00:09 | technomancy | defn: http://github.com/technomancy/clojure-gem |
| 00:10 | defn | technomancy: yeah i saw that, is that still working? |
| 00:10 | technomancy | I think it's hard-coded to 1.0 |
| 00:10 | defn | technomancy: do you have any example code anywhere? |
| 00:10 | technomancy | and transaction retries break because JRuby wraps the exceptions in a Ruby object, so Clojure is unable to catch them |
| 00:10 | technomancy | but the data structures work great |
| 00:10 | underdev | technomancy: clojure-mode 1.7.1 updated in elpa, but clojure-test-mode remains at 1.3 fyi |
| 00:11 | technomancy | defn: more like "feel free to take the whole thing it over" |
| 00:11 | defn | haha, technomancy is it worth the effort? |
| 00:11 | defn | technomancy: i think it's mostly me just wishing ruby was, in fact, clojure |
| 00:12 | technomancy | defn: if you have a reason to use ruby still then it's definitely worth it |
| 00:12 | defn | technomancy: yeah im working with a rails shop now and want to try and slowly mix clojure into things to persuade them to switch :) |
| 00:13 | technomancy | underdev: weird; I see 1.4 in M-x package-list-packages |
| 00:13 | technomancy | defn: talk to headius about the way that JRuby wraps exceptions and prevents them from getting caught by Java code |
| 00:14 | technomancy | defn: I asked him about it at JRubyConf, and he said he would add a way to turn that off |
| 00:14 | underdev | yeah, it's there now. sorry. |
| 00:15 | technomancy | cool |
| 00:16 | technomancy | defn: I don't know if it's possible to work around yet, it might take some prodding Charlie |
| 00:16 | defn | technomancy: Mr. Nutter, I presume? |
| 00:16 | technomancy | that's the one |
| 00:17 | defn | cool. well thanks for the headstart. ill fork and start perusing. |
| 00:17 | technomancy | defn: I haven't really touched Ruby in over a year (and I wrote clojure-gem half a year ago) |
| 00:17 | defn | technomancy: same here, been obsessed with clojure |
| 00:19 | technomancy | good luck. I hope it can be a gateway drug to get more rubyists into clojure |
| 00:23 | defn | technomancy: i think we already have a hook in |
| 00:24 | defn | technomancy: 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:24 | defn | i think it's only a matter of time |
| 00:25 | defn | speaking of which, totally loaded question: is there enough clojure consultancy work out there for small clojure shops to survive? |
| 00:26 | defn | I remember hearing S. Halloway's shop was doing something like 30% clojure, but this was a year ago |
| 00:26 | defn | ive been thinking about trying to start a small 1-3 person thing |
| 00:26 | albino | yeah, but is that because he's steering his customers to use that technology? |
| 00:26 | defn | albino: tough to know, stu is a helluva salesman |
| 00:27 | defn | a rational salesman whom i quite appreciate |
| 00:27 | defn | but a salesman at times, nontheless |
| 00:27 | albino | my 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:27 | defn | the web stuff just isn't there with clojure yet which i hope gets remedied |
| 00:27 | defn | huge chasm of documentation for compojure |
| 00:28 | defn | honestly my chief concern with clojure in general is lack of documentation |
| 00:30 | Raynes | I'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:30 | defn | it reminds me of _why the lucky stiff's comments on the state of teaching programming |
| 00:30 | Raynes | style tutorials. Is anyone opposed to this approach? |
| 00:30 | Raynes | I think people will like it when I'm finished. |
| 00:30 | defn | Raynes: i have some weird off-hand suggestions |
| 00:31 | defn | Raynes: choose your own adventure REPL |
| 00:31 | Raynes | If 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:31 | Raynes | Eh? |
| 00:32 | defn | Raynes: im sort of a code romantic, but why the lucky stiff's methods for teaching programming were revolutionary in my eye |
| 00:32 | defn | have you ever read the poignant guide? |
| 00:33 | Raynes | The 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:33 | defn | my general suggestion is: get weird with it. quit being 100% rational. make the tutorial artsy, weird, crazy even. |
| 00:33 | defn | it makes it memorable, it makes it interesting |
| 00:33 | Raynes | defn: Yes, I've read most of the poignant guide. I never cared for it. |
| 00:34 | Raynes | His stories got odd to the point of being pointless and dragged on and on, eventually I lost interest. |
| 00:34 | Raynes | But that's just me. |
| 00:34 | defn | Raynes: 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:34 | defn | it would have been worse i think |
| 00:35 | Raynes | I don't really think it was all that good. :\ |
| 00:35 | Raynes | Maybe I just need to read it again. |
| 00:35 | defn | Raynes: 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:35 | Raynes | The stories were just a bit too much for my taste. |
| 00:35 | defn | he created a book for non-programmers to approach real programming through the narrative |
| 00:36 | defn | a memorable narrative that sticks to your brain |
| 00:36 | defn | it's the method to his madness that should be examined |
| 00:36 | Raynes | I guess. :\ |
| 00:36 | defn | not the result |
| 00:36 | defn | because, honestly, it worked |
| 00:37 | defn | do you know how many lines of code were run at the tryruby repl? |
| 00:37 | defn | something like 75, 80 million |
| 00:37 | Raynes | Anyway, 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:38 | Raynes | I 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:38 | Raynes | defn: 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:38 | defn | what i think id like to do, if it were my project |
| 00:39 | defn | is vary the methods that i present information in |
| 00:39 | defn | having a repl on the side, next to a tutorial which gives some recipes |
| 00:39 | defn | to facilitate exploration |
| 00:40 | defn | for people who wants recipes, they have them, for people who want a bit of adventure, they have the REPL |
| 00:40 | Raynes | defn: 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:40 | Raynes | Just like the other tutorials. |
| 00:40 | Raynes | Anyway, we'll talk about this later. I've got to run. |
| 00:40 | defn | Raynes: im rather opinionated on this so i dont mean to sound critical |
| 00:40 | Raynes | Bai. |
| 00:41 | defn | but just like the other tutorials is what irks me :) |
| 00:41 | defn | Raynes: seeya |
| 01:22 | underdev | wow- 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:22 | underdev | must be fate |
| 02:19 | jColeChanged | I'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:40 | somnium | jColeChanged: 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:52 | jColeChanged | somnium: Didn't know about either of those methods, thanks. Also, is there any contains? like function which isn't linear time? |
| 02:56 | LauJensen | Morning team |
| 02:56 | replaca | morning Lau |
| 03:00 | jColeChanged | Hi again LauJensen. |
| 03:11 | esj | Salut |
| 03:16 | vIkSiT | hmm whats the link to the protocols video again? |
| 03:16 | vIkSiT | ah here. http://vimeo.com/11236603 |
| 03:16 | sexpbot | "Clojure 1.2 Protocols on Vimeo" |
| 04:44 | Raynes | LauJensen: 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:45 | LauJensen | 10.04? |
| 04:45 | Raynes | Yes. |
| 04:45 | LauJensen | Odd, that what Im running as well |
| 04:46 | Raynes | When I was on Hardy, it was really heavy. |
| 04:48 | rava | i just have to say, destructuring is my new favorite thing. ever. |
| 04:48 | rava | Its 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:51 | LauJensen | :) |
| 05:11 | G0SUB | when 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:12 | G0SUB | any idea how this can be fixed? I am setting warn-on-reflection in some files |
| 05:17 | rdsr | GOSUB: I think you have to use something like this |
| 05:17 | rdsr | (binding [*warn-on-reflection* true] |
| 05:17 | rdsr | ...) |
| 05:25 | Raynes | warn-on-reflection can only be set in the REPL. |
| 05:25 | Raynes | It doesn't make sense elsewhere. |
| 05:26 | tomoj | is it really the repl, or just the top thread? |
| 05:27 | Raynes | Probably. Someone in here was talking about it a while back. |
| 05:29 | tomoj | probably which? |
| 05:30 | Raynes | Probably just the top thread. |
| 05:30 | Raynes | I'm not certain. |
| 05:31 | npoektop | hi! 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:32 | Raynes | $(get {:key nil} :key "no key in map") |
| 05:32 | sexpbot | result: |
| 05:32 | Raynes | $(get {:key nil} :ke "no key in map") |
| 05:32 | sexpbot | result: no key in map |
| 05:32 | Raynes | Eh. |
| 05:32 | Raynes | I still haven't fixed the don't-print-nil bug. |
| 05:33 | Raynes | I've been slacking. |
| 05:33 | Raynes | Damn tryclojure. |
| 05:33 | Raynes | npoektop: The first result: was actually nil. get is what you're looking for. |
| 05:34 | npoektop | Raynes, thank you |
| 05:36 | GeoffSK | I can't get one source to successfully include another file, both have namespaces. Any examples/tutorials? |
| 05:36 | spariev | ,(get {:key nil} :key "no key in map") |
| 05:36 | clojurebot | nil |
| 05:37 | rava | GeoffSK: checked your classpaths? |
| 05:37 | tomoj | GeoffSK: what do you mean "include"? |
| 05:37 | tomoj | you want to call functions from one in the other? |
| 05:37 | GeoffSK | sorry i mean :import |
| 05:37 | GeoffSK | http://pastebin.com/1xGispcD |
| 05:37 | Raynes | You want to use require. |
| 05:37 | GeoffSK | tomoj: yes. |
| 05:37 | tomoj | :import is for java classes |
| 05:37 | Raynes | Or use. |
| 05:37 | Raynes | Probably use. |
| 05:38 | Raynes | (:use namespace.of.file) |
| 05:38 | npoektop | if 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:38 | tomoj | (:use [com.gsk.a :only (aname)]) |
| 05:38 | tomoj | or (:require [com.gsk.a :as foo]) will let you call foo/aname |
| 05:39 | rava | npoektop: Would a struct make sense for it? |
| 05:39 | GeoffSK | java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword (b.clj:1) |
| 05:40 | rava | npoektop: you can define the keys in a defstruct, then when initing structs any non epxlicitly referenced keys will have nil as their val |
| 05:40 | GeoffSK | tomoj: http://pastebin.com/mY5Wp42K |
| 05:41 | GeoffSK | tomoj sorry changed to symbols. |
| 05:41 | rava | ,(defstruct astr :a :b :c) |
| 05:41 | clojurebot | DENIED |
| 05:41 | rava | or not.. |
| 05:41 | rava | lol |
| 05:41 | npoektop | rava, 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:41 | G0SUB | Raynes, thanks for the tip. |
| 05:42 | G0SUB | when I quit slime, the swank server quits too. I remember there was a variable to toggle that behaviour. can anyone remind me? |
| 05:42 | GeoffSK | tomoj: thanks. sorted it out. |
| 05:43 | G0SUB | :dont-close |
| 05:43 | rava | npoektop: http://pastebin.com/bbR8EVJn |
| 05:43 | Raynes | GeoffSK: 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:44 | Raynes | G0SUB: That's it, I believe. |
| 05:44 | tomoj | apparently pastie has clojure now too |
| 05:44 | GeoffSK | raynes: thanks. |
| 05:44 | G0SUB | Raynes, yeah, but how do I tell lein to use that option when starting the server? |
| 05:44 | rava | GeoffSK: and if you go with gist, and use emacs, there is an emacs extension that ties into gist |
| 05:45 | Raynes | G0SUB: I never successfully managed to do that. Instead, I made my own swank-server startup file for sexpbot. Want me to gist it? |
| 05:45 | rava | http://github.com/defunkt/gist.el |
| 05:45 | npoektop | rava, well, it's ok, but still not what i'm looking for. Thank you anyway) |
| 05:45 | G0SUB | Raynes, I would appreciate that. thanks. |
| 05:45 | rava | npoektop: np, still new to clj so not very helpful yet :) |
| 05:46 | Raynes | G0SUB: http://gist.github.com/403600 |
| 05:46 | GeoffSK | rava: i am using intellij, does emacs do better formatting of clojure? |
| 05:46 | G0SUB | Raynes, exactly what I needed. thanks. |
| 05:47 | rava | GeoffSK: 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:47 | Raynes | G0SUB: Make sure you have the newest swank-clojure for that. 1.1.0 wont work. |
| 05:47 | rava | even tempted to get a coffee machine that has an ethernet jack so i can have emacs send my coffee requests :D |
| 05:47 | G0SUB | Raynes, yeah, I have the new one. 1.2.1 |
| 05:48 | rava | http://www.emacswiki.org/emacs/CoffeeMode |
| 05:48 | sexpbot | "EmacsWiki: Coffee Mode" |
| 05:48 | GeoffSK | rava: Yep. i am a little used to the DrScheme and its formatting. |
| 05:56 | npoektop | how to print a func which i define within a macro? (str #(string? %)) does not print what i want |
| 05:56 | npoektop | i'd like to get "#(string? %)" |
| 05:57 | opqdonut | you probably want to use macroexpand-1 |
| 05:57 | opqdonut | or you need a level of additional quoting |
| 05:57 | opqdonut | (str (quote #(string? %))) |
| 05:58 | opqdonut | err |
| 05:58 | opqdonut | ,(str (quote #(string? %))) |
| 05:58 | clojurebot | "(fn* [p1__16631] (string? p1__16631))" |
| 05:58 | opqdonut | there :) |
| 05:58 | npoektop | opqdonut, cool. thanks |
| 06:00 | Chousuke | that doesn't actually print the function though. |
| 06:01 | Chousuke | just the form that evaluates to a function |
| 06:01 | G0SUB | Raynes, on the repl ,<quit> still quits the server. M-x slime-disconnect doesn't. how do you disconnect usually? |
| 06:01 | tomoj | what counts as "actually" printing something? |
| 06:02 | Chousuke | tomoj: printing it :P |
| 06:03 | Chousuke | tomoj: I think it is important to keep the concept of forms separate from the values they evaluate to |
| 06:03 | rava | I'm missing something here..could someone show me usage of (val) ? |
| 06:04 | Chousuke | ,(val (first {:k 'v})) |
| 06:04 | clojurebot | v |
| 06:04 | Fossi | :p |
| 06:04 | tomoj | Chousuke: ok, but what would make the choice of using the fn* form as the printed representation for a fn somehow fake-printing? |
| 06:04 | Chousuke | tomoj: no |
| 06:05 | rava | groovy, thanks. for some reason I just couldn't grok the doc string's explination. |
| 06:05 | Chousuke | or well. yes it would |
| 06:05 | tomoj | oh, well, the fn never arises there, so.. |
| 06:05 | Chousuke | unless you take care to replicate the lexical environment as wel |
| 06:05 | Chousuke | l |
| 06:05 | tomoj | ah, heh |
| 06:06 | tomoj | if you lose information, it's fake-printing? |
| 06:06 | Chousuke | pretty much :P |
| 06:06 | tomoj | so e.g. we can't print structs (or can we now? haven't tried lately) |
| 06:06 | Chousuke | or pretty-printing, but hm |
| 06:07 | Chousuke | in this case it's just that printing forms produces something that looks like a function but is not one |
| 06:08 | tomoj | eh |
| 06:08 | tomoj | I think your metaphysics of printing is beyond me :) |
| 06:08 | Chousuke | I just don't think printing functions makes sense. |
| 06:09 | Chousuke | except the way it's done right now, which is just a "visual token" kind of thing. |
| 06:09 | tomoj | I hadn't thought about the lexical env when looking at technomancy's trick |
| 06:09 | tomoj | do there actually exist any implementations of HTCPCP? |
| 06:10 | Raynes | G0SUB: I usually exit manually in the terminal. |
| 06:20 | rava | Rest easy everyone. |
| 06:55 | LauJensen | When you guys subscribe to some blog, do you expect the feed to have all posts, or just the 10 most recent or so ? |
| 06:56 | Licenser | tomoj: I was told you found some odd behavior in the sandbox? |
| 06:56 | tomoj | just a security hole |
| 06:56 | tomoj | Raynes fixed it, I think |
| 06:57 | Raynes | No, I didn't. |
| 06:58 | tomoj | well, someone who used your github keys did, then |
| 06:58 | Licenser | tomoj: can you tell me what it was? :) |
| 06:59 | Raynes | tomoj: Nosir. |
| 06:59 | Raynes | tomoj: Nobody has committed anything to clj-sandbox but Heinz in several days. |
| 06:59 | Licenser | not true |
| 06:59 | Raynes | I've been too busy with tryclojure to work on clj-sandbox. |
| 06:59 | Licenser | you removed some fn's from the save list |
| 06:59 | tomoj | wat? |
| 06:59 | clojurebot | For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888 |
| 07:00 | tomoj | am I living in some parallel universe? |
| 07:00 | Raynes | Oh yeah. |
| 07:00 | Raynes | Oh, I did fix it. |
| 07:00 | Licenser | on the 14th |
| 07:00 | Licenser | :P |
| 07:00 | Raynes | tomoj: I'm sorry, dude, the last couple of days have been a whirlwind. |
| 07:00 | Licenser | tomoj: aren't we all? |
| 07:00 | Raynes | ._. |
| 07:00 | Raynes | But yeah, those functions were the problems. |
| 07:01 | Licenser | but tomoj thanks for finding the hole! |
| 07:03 | tomoj | $(tomoj) |
| 07:03 | sexpbot | result: Hello, world! |
| 07:04 | tomoj | Raynes: no problem |
| 07:04 | Licenser | neat :) |
| 07:05 | Raynes | Licenser: When you start working on the def* workaround, you might want to jump to 0.4.0-SNAPSHOT. |
| 07:06 | Raynes | Following semver rules, anyway. |
| 07:06 | Licenser | Raynes: when I find any useful workaround I will but I could not dig a way up yet :( |
| 07:07 | tomoj | I was perusing the source to see if the set bug caused a vulnerability and accidentally found an unrelated issue |
| 07:10 | tomoj | brilliant |
| 07:10 | tomoj | that would go a long way towards making my emacs-hating coworkers jealous |
| 07:10 | tcrayford | :) |
| 07:10 | tcrayford | it needs some more work, but its getting there |
| 07:12 | tcrayford | and is seriously quite cool |
| 07:12 | tcrayford | uses a reporting thing like clojure-test-mode |
| 07:14 | Licenser | tomoj: *nods* You really have put some work in that, thanks amn! |
| 07:14 | Chousuke | is this part of the emacs refactoring thing? |
| 07:14 | tcrayford | nope |
| 07:15 | tcrayford | though the next branch will yoink some code from that |
| 07:17 | tcrayford | I should probably extract the helper functions to a common package so both can use them |
| 07:18 | tomoj | Licenser: really my first independently discovered exploit.. so it was fun |
| 07:19 | Licenser | I can imagine :) |
| 07:20 | tomoj | not that I could do anything to your machine except make it print "hello world" when it wasn't supposed to... |
| 07:21 | tomoj | I suppose I could have made sexpbot insult people in #clojure or something |
| 07:21 | esj | guys, what's the practice of putting * after some function names. Just a marker that 'this is slightly different' ? |
| 07:21 | tcrayford | yeah, that's it usually |
| 07:21 | tomoj | sometimes it's a helper function for implementing the *-less version, too, I think |
| 07:22 | tomoj | or some simpler version on which the *-less version expansd |
| 07:22 | Chousuke | if used in macros, it's usually the "driver" |
| 07:23 | Chousuke | as regular functions, it's often just "variant" |
| 07:23 | Chousuke | eg. list, list* |
| 07:24 | Licenser | tomoj: well with that you could about do anything |
| 07:24 | Chousuke | then there's bound-fn* (function), bound-fn (macro), and fn/fn* (where the latter is an implementation detail) |
| 07:24 | Licenser | once you can eval stuff you're free :P |
| 07:25 | Raynes | $eval #{1 2 3} |
| 07:25 | sexpbot | result: #{1 2 3} |
| 07:25 | Raynes | Joy! |
| 07:25 | tomoj | but only in clojure-land, the jvm security stuff still protects your box, right? |
| 07:26 | Licenser | tomoj: yes but that is bad enough :P |
| 07:26 | Licenser | you could totally mess up stuff |
| 07:30 | esj | merci, dudes |
| 07:32 | Licenser | Raynes: jvm security does not seem to cover memory :( it seems that there is no real way to do that darn it! |
| 07:39 | d2dchat | Is it possible to grab a dependency automatically from a bitbucket repo using lein? |
| 07:39 | d2dchat | I'm trying to grab this: |
| 07:39 | d2dchat | http://bitbucket.org/jonjlee/riak-java-client/wiki/Home |
| 07:39 | sexpbot | "jonjlee / riak-java-client / wiki / Home — bitbucket.org" |
| 07:39 | d2dchat | but it keeps erroring out |
| 07:39 | tcrayford | iirc it has to be a maven repo |
| 07:40 | d2dchat | tcrayford: isn't that a maven repo? |
| 07:43 | Raynes | That is a Mercurial repo. |
| 07:52 | Raynes | dnolen: Have you seen the new tryclojure design by any chance? |
| 07:53 | dnolen | Raynes: yes, looks good! my only suggestion now would be perhaps some work on the logo. |
| 07:53 | Raynes | dnolen: There is no logo. :p |
| 07:54 | rsynnott | well, there's a title |
| 07:54 | Raynes | dnolen: Do you mean the header? That's the least of my worries right now, but fair enough. |
| 07:54 | Raynes | :p |
| 07:54 | Raynes | The font does render pretty badly for some people. |
| 07:54 | Raynes | I'm going to replace the header with an image in the next version. |
| 07:54 | dnolen | Raynes: yeah, the title. but it's really coming together. only a matter of time. |
| 07:55 | dnolen | by "coming together" i mean the look, the functionality is of course fantastic. |
| 07:55 | Raynes | I'm happy you like it now. Thank LauJensen for tons of help with CSS and such. <3 |
| 07:55 | rsynnott | Raynes: do you plan to let people define things at some point? |
| 07:56 | Raynes | rsynnott: Ask Licenser. ;) This one is beyond my control. |
| 07:56 | rsynnott | Though I suppose it'd be tricky to make that safe |
| 07:57 | tcrayford | ,(def a 1) |
| 07:57 | clojurebot | DENIED |
| 07:57 | Raynes | It's safe. The problem is memory control. You can def something gigantic and blow the world up. |
| 07:57 | tcrayford | what are people using as imagehosts atm? |
| 07:58 | Raynes | imgur |
| 07:58 | rsynnott | Raynes: that's what I mean, yep :) |
| 07:58 | rsynnott | presumably some sort of clever sandboxing thing would be needed |
| 07:59 | rsynnott | though presumably you could do that in the current one, too, with let |
| 07:59 | tcrayford | so, duplication highlighting in emacs: http://i.imgur.com/7Z76F.png |
| 08:00 | tcrayford | if you highlight the text and press a key combo you get what var that bit duplicates with |
| 08:02 | Licenser | rsynnott: the short answer is yes the longer one, it will take some time |
| 08:03 | Licenser | rsynnott: 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:03 | tomoj | tcrayford: does it do more than look for common substrings? |
| 08:04 | tcrayford | it looks for common subsequences atm |
| 08:04 | tcrayford | I can fix that problem pretty easily though, as refactoring-mode has a load of stuff about discovering and renaming bindings in a node |
| 08:04 | Licenser | tcrayford: ideally variable names should not matter :P but that is a high sandard I know |
| 08:04 | tcrayford | they won' |
| 08:04 | tcrayford | t |
| 08:05 | tcrayford | after I finish the next bit, which I already know how to do |
| 08:05 | tomoj | I suppose extract-function is on the way? |
| 08:05 | tcrayford | I already did that |
| 08:05 | Licenser | :) |
| 08:05 | tcrayford | it breaks occasionally though |
| 08:06 | tcrayford | but still, useful |
| 08:07 | tcrayford | refactoring mode has a load more than that as well, like auto-constructing let-bindings out of a block you have selected |
| 08:07 | tomoj | so it seems we can now hack emacs in clojure? |
| 08:07 | tomoj | :D |
| 08:07 | tcrayford | :/ |
| 08:07 | tomoj | s/now/for quite a while/ |
| 08:07 | sexpbot | :/ |
| 08:07 | tcrayford | this is done using lein and swank |
| 08:07 | tomoj | google fails me for refactoring mode |
| 08:08 | tcrayford | http://github.com/tcrayford |
| 08:08 | tcrayford | and then somewhere |
| 08:08 | tomoj | your clojure-refactoring is the first result |
| 08:08 | tcrayford | its scary how easy this stuff is to write |
| 08:08 | tcrayford | just manipulating some lists and spitting em back out |
| 08:09 | tcrayford | also, refactoring-mode needs some emacs hackery to make it actually work |
| 08:09 | tomoj | do I get it right that refactoring-mode is some external dependency you're using? |
| 08:09 | tcrayford | clojure_refactoring is a clojars project that I wrote |
| 08:10 | tcrayford | refactoring-mode is just my own bit of (terrible) elisp |
| 08:10 | tomoj | ah, I see |
| 08:10 | tcrayford | its not that good as of now, but its exam revision time, so it should get better when umbrella is working how I want |
| 08:12 | tcrayford | I need to license both projects under some liberal license as well, just not sure which one |
| 08:12 | tomoj | oh, umbrella is the duplication highlighting, and "refactoring-mode" refers to the stuff in clojure-refactoring-mode.el ? |
| 08:12 | tcrayford | yes |
| 08:12 | tomoj | I have been awake too long :( |
| 08:12 | tcrayford | hah |
| 08:13 | tcrayford | do you have any reccomendations on open source licenses? |
| 08:13 | rsynnott | tcrayford: MIT/modern BSD are simple |
| 08:14 | tcrayford | they look good enough |
| 08:15 | tcrayford | I might just use eclipse, seeing as clojure uses it (and a load of other clj projects) |
| 08:15 | tomoj | hmm |
| 08:15 | tomoj | I am imagining pretty ridiculous possibilities |
| 08:15 | tcrayford | shoot |
| 08:15 | tcrayford | I have a lot of free time at the moment, and am all open to ideas |
| 08:16 | tomoj | I don't know what "extract local" already does |
| 08:16 | tomoj | but suppose you do it, then you have the opportunity to hit a few extra keys to decide on a possible alternative |
| 08:16 | tcrayford | like what? |
| 08:16 | tomoj | if there's a let around point already, it defaults to adding the binding there |
| 08:16 | tcrayford | currently, you select a sexp inside a defn, and give it a name, then it adds it |
| 08:16 | tcrayford | yeah |
| 08:17 | tomoj | if not, it creates a let, and you can cycle the scope up and down |
| 08:17 | tcrayford | it does that if there's a let at the toplevel |
| 08:17 | tomoj | or hit some other key to make it a when-let or whatevel |
| 08:17 | tcrayford | cycling the scope is an interesting idea |
| 08:17 | tomoj | basically, vanilla clojure-mode : paredit :: paredit :: my dreams |
| 08:18 | tomoj | er, paredit : my dreams |
| 08:18 | tcrayford | yeah, roughly gotcha |
| 08:18 | tomoj | no longer is the editor just aware of micro-level syntax, it can be aware of macro-level semantics |
| 08:18 | tcrayford | it can be now, given some time |
| 08:19 | tomoj | yes, very exciting |
| 08:19 | tomoj | and I'm glad it doesn't have to all be written in elisp |
| 08:19 | tcrayford | hopefully clojure-in-clojure will add some more possibilities in this directions as well |
| 08:19 | tomoj | howso? |
| 08:20 | tcrayford | if 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:21 | tcrayford | and the compiler has to do something like that anyway |
| 08:22 | tcrayford | (some-fn '(defn a [b] (+ 1 b)) '(+ 1 b)) ;; => #{b} |
| 08:22 | tcrayford | ie it'd tell you what bound vars are in a scope |
| 08:22 | tomoj | ah, I see |
| 08:22 | tcrayford | that'd be much better than searching stuff how I do now |
| 08:23 | tcrayford | currently I just look for forms that I *know* are binding forms |
| 08:23 | tcrayford | like let, for ,doseq etc |
| 08:23 | tcrayford | and then extract the bindings out of them |
| 08:23 | tcrayford | but if clojure could give me that, it'd be damn useful |
| 08:24 | Licenser | memory is the arch nemesis of sandboxes :( |
| 08:25 | chouser | tcrayford: you may be able to use clojure's Compiler class for that. |
| 08:25 | tcrayford | as of now? |
| 08:26 | chouser | yes |
| 08:26 | tcrayford | ooh |
| 08:26 | chouser | it's not the prettiest thing, and of course will change with c-c-in-c, but it may be doable. |
| 08:26 | chouser | and more likely accurate (if it works) than rolling one's own. |
| 08:26 | tcrayford | it's still nicer than blind recursion |
| 08:26 | tcrayford | yeah |
| 08:27 | tcrayford | and it might work with anaphoric macros (which mine won't at all) |
| 08:27 | chouser | yeah. The entrypoint you want is (clojure.lang.Compiler/analyze ...) |
| 08:29 | chouser | ,(clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL nil) |
| 08:29 | clojurebot | #<NilExpr clojure.lang.Compiler$NilExpr@927ec1> |
| 08:30 | tcrayford | awesome |
| 08:30 | tcrayford | cheers |
| 08:30 | chouser | then 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:30 | tcrayford | yeah |
| 08:31 | tcrayford | one of the reasons I wrote refactoring-mode was to learn more about (= code data) |
| 08:31 | Licenser | tcrayford: 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:32 | tcrayford | I've been meaning to extract some parts of refactoring-mode to a clj-analysis thing |
| 08:32 | tcrayford | Licenser: what namespace should I start with? |
| 08:32 | npoektop | how to do this: (defmacro testmacro [] `{:a 'a (comment :b 'b here on some condition)})? |
| 08:32 | Licenser | top of net.licenser.sandbox |
| 08:33 | Licenser | fn-seq for example |
| 08:33 | tcrayford | tree-map is useful |
| 08:33 | Licenser | *nods* |
| 08:36 | Licenser | you might also want to look at dot-replace (or something like that) since it is pretty much refactoring |
| 08:37 | tcrayford | yeah |
| 08:37 | npoektop | i have (defmacro testmacro [] `{~(if true :a) ~(if true ''a)}). How to run that if only once? |
| 08:38 | tcrayford | refactoring-mode never does anything with java interop atm |
| 08:38 | Licenser | npoektop: ~@ is your friend thre |
| 08:38 | Licenser | (defmacro testmacro [] `{~@(if true [:a ''a])}) |
| 08:39 | npoektop | ,java.lang.ArrayIndexOutOfBoundsException: 1 |
| 08:39 | clojurebot | Invalid token: java.lang.ArrayIndexOutOfBoundsException: |
| 08:39 | Licenser | tcrayford: I know but replacing the . form is techically refactoring |
| 08:39 | npoektop | ,(defmacro testmacro [] `{~@(if true [:a ''a])}) |
| 08:39 | clojurebot | 1 |
| 08:39 | npoektop | Licenser, it does not work ( |
| 08:39 | tcrayford | Licenser: what does expand-and-quote actually do? |
| 08:39 | emh | I 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:40 | Licenser | ~@ you mean? |
| 08:40 | clojurebot | @ has nothing to do with whether sth is evaluated or not |
| 08:40 | npoektop | Licenser, it says java.lang.ArrayIndexOutOfBoundsException: 1 |
| 08:40 | Licenser | it takes a list and inserts the element in stead |
| 08:40 | Licenser | not sure what you want to do with ''a so |
| 08:40 | tcrayford | ,(quote (quote a)) |
| 08:40 | clojurebot | (quote a) |
| 08:40 | npoektop | ,(defmacro testmacro [] `{~@(if true [:a 'a])}) |
| 08:40 | clojurebot | 1 |
| 08:41 | Licenser | (defmacro testmacro [] `(hash-map ~@(if true [:a ''a]))) |
| 08:41 | tcrayford | (testmacro) |
| 08:41 | Licenser | ,(defmacro testmacro [] `(hash-map ~@(if true [:a ''a]))) |
| 08:41 | clojurebot | DENIED |
| 08:41 | Licenser | can'T do it here |
| 08:41 | chouser | ,(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:41 | clojurebot | java.lang.IllegalArgumentException: No matching field found: expr for class clojure.lang.Compiler$FnExpr |
| 08:42 | chouser | bah |
| 08:42 | Licenser | tcrayford: look at the hash-map version |
| 08:42 | Licenser | it works |
| 08:42 | tcrayford | chouser: that only fails here because of the dot expansion clj-sandbox does |
| 08:42 | tcrayford | man thanks |
| 08:42 | emh | ah. ofc, java.lang.Number |
| 08:42 | tcrayford | *many |
| 08:43 | tcrayford | if I'm ever ~wherever-you-live I owe you a beer or two |
| 08:43 | Licenser | I hate bear :P and don't worry ;) |
| 08:43 | tomoj | hmm |
| 08:43 | chouser | but note you get all the macro-generated locals that users rarely see |
| 08:43 | tomoj | ,(->> (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL '(let [a 3 b 4] a)) .fexpr .methods first .locals keys (map #(.sym %))) |
| 08:43 | clojurebot | (b a fn__16708) |
| 08:43 | tcrayford | yeah, which isn't good |
| 08:43 | Licenser | We all would be poor from buying all the beer we own otheres here |
| 08:43 | tomoj | oh, I missed your better attempt |
| 08:43 | chouser | romanb: nice! |
| 08:43 | npoektop | Licenser, thanks! |
| 08:43 | chouser | er |
| 08:43 | chouser | tomoj: nice! |
| 08:44 | Licenser | I 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:44 | Licenser | save for people like chou* who know everything |
| 08:44 | tomoj | no idea why I have a FnExpr.. |
| 08:45 | tomoj | but I wonder how we point to a specific part of a form and ask for only the locals there |
| 08:45 | Licenser | anyway see you later people I've to return a case that is broken |
| 08:45 | tcrayford | yeah |
| 08:45 | tcrayford | that's a harder part |
| 08:45 | tomoj | maybe you can just trim the form so that it's only the path to the leaf you want? |
| 08:45 | tcrayford | I can definitely do that |
| 08:45 | tcrayford | it currently looks like this: |
| 08:45 | tcrayford | it looks like this currently: |
| 08:45 | tomoj | would that give good results, though, I wonder? |
| 08:46 | tcrayford | (defn find-bindings-above-node |
| 08:46 | tcrayford | "Returns all binding forms above expr in node." |
| 08:46 | tcrayford | ([node expr] (find-bindings-above-node node expr [])) |
| 08:46 | tcrayford | ([node expr bnd-syms] |
| 08:46 | tcrayford | (unique-vec |
| 08:46 | tcrayford | (flatten |
| 08:46 | tcrayford | (if (more-than-one seq? node) |
| 08:46 | tcrayford | (map #(find-bindings-above-node % expr bnd-syms) |
| 08:46 | tcrayford | (filter #(and (seq? %) |
| 08:46 | tcrayford | (rec-contains? % expr)) node)) |
| 08:46 | tcrayford | (if (last-binding-form? node) |
| 08:46 | tcrayford | (add-binding-form node bnd-syms) |
| 08:46 | tcrayford | (if (binding-node? node) |
| 08:46 | tcrayford | (find-bindings-above-node (rest node) |
| 08:46 | tcrayford | expr |
| 08:46 | tcrayford | (add-binding-form node bnd-syms)) |
| 08:46 | tcrayford | (if (seq? (first node)) |
| 08:46 | tcrayford | (find-bindings-above-node (first node) expr bnd-syms) |
| 08:46 | tcrayford | (find-bindings-above-node (rest node) expr bnd-syms))))))))) |
| 08:46 | tcrayford | so fixing that'd be nice |
| 08:47 | tcrayford | (there's lots of stuff in there that relies on other functions, but its still horrible) |
| 08:48 | tcrayford | thankfully I have tests for a lot of stuff, so I can rework it pretty safely |
| 08:48 | tomoj | Compiler.java is... |
| 08:49 | tomoj | terrifying |
| 08:49 | chouser | doomed |
| 08:49 | tcrayford | I've tried reading the clojure source before |
| 08:49 | tomoj | how can such a beautiful language be built from something so ugly? |
| 08:49 | tcrayford | its pretty difficult |
| 08:49 | tcrayford | heh |
| 08:49 | tcrayford | have you seen the source for arc? |
| 08:49 | Licenser | tcrayford: hint: github |
| 08:49 | tomoj | nope |
| 08:49 | tcrayford | its really very nice |
| 08:49 | tcrayford | given that its all in scheme/arc |
| 08:50 | tcrayford | yeah Licenser, I realised that was a stupid thing to paste after I did it |
| 08:50 | Licenser | :P |
| 08:50 | tcrayford | http://github.com/tcrayford/clojure-refactoring/blob/master/src/clojure_refactoring/core.clj#L89 |
| 08:51 | tcrayford | its still *really* ugly |
| 08:51 | tcrayford | tomoj: also I have code that can do that trimming out already |
| 08:52 | tomoj | cool |
| 08:52 | tcrayford | just a simple case of postwalk with recursive-contains? |
| 08:53 | tcrayford | (I think that fn is actually called rec-contains currently, but eh) |
| 08:55 | tomoj | chouser: that was 1.1? |
| 08:55 | tomoj | doesn't work in 1.2.. this will be a painful approach, I think |
| 08:55 | chouser | tomoj: my example? 1.2-ish |
| 08:55 | chouser | hm. |
| 08:55 | tomoj | Compiler's interface might change within versions, too, I bet.. |
| 08:55 | tomoj | oh |
| 08:55 | chouser | yeah |
| 08:55 | tomoj | your example was specific to the kind of form you passed, I guess? |
| 08:56 | chouser | yeah, it assumes the outer is a fn |
| 08:56 | chouser | you can generally write a fn around a user-supplied expr |
| 08:56 | tomoj | yeah |
| 09:00 | tcrayford | I'm off now, cheers for the help you two |
| 09:01 | tomoj | I 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:03 | tomoj | every compile is probably not often enough |
| 10:18 | dmiller2718 | rhickey: Did you see my e-mail on the interview possibility? |
| 10:19 | rhickey | dmiller2718: yes, just wading through my email after getting back from prag studio |
| 10:20 | rhickey | dmiller2718: I think you should be able to do the interview just fine |
| 10:20 | rhickey | dmiller2718: you can point to the Channel 9 one I did for more in depth on Clojure itself |
| 10:21 | cemerick | rhickey: "welcome back", as it were. :-) |
| 10:21 | rhickey | cemerick: thnks |
| 10:21 | rhickey | thanks |
| 10:21 | AWizzArd | hi rhickey *wave* |
| 10:30 | dmiller2718 | rhickey: thanks for the vote of confidence. Figured that on the e-mail. |
| 10:30 | dmiller2718 | rhickey: I'll have to go remind myself of why clojure is important and fun. |
| 10:30 | dmiller2718 | rhickey: Mostly it just looks like a pile of C# code to me. :) |
| 10:31 | rhickey | dmiller2718: 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:33 | Licenser | welcome back rhickey |
| 10:43 | tcrayford | rhickey: thankyou so much for including :line and :file metadata on vars. |
| 11:32 | mefesto | I'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:36 | chouser | (let [p (Person.)] (set! (.fname p) "Test") p) |
| 11:36 | mefesto | chouser: thanks! |
| 11:39 | Licenser | hmm couldn't doto make (.fname= "Test") to (set! (.fname p) "Test") ? |
| 11:40 | Licenser | I think you are not allowed to have fnction or field names like ...= in java |
| 11:48 | jfields | what's the easiest way to convert [:a 1 :b 2] to {:a 1 :b 2}? |
| 11:50 | replaca | ,(into {} (partition 2 [:a 1 :b 2])) |
| 11:50 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry |
| 11:51 | jfields | ,(reduce (fn [r [x y]] (assoc r x y)) {} (partition 2 [:a 1 :b 2])) |
| 11:51 | clojurebot | {:b 2, :a 1} |
| 11:51 | jfields | seems awfully verbose though. |
| 11:51 | lpetit | ,(apply hash-map [:a 1 :b 2]) |
| 11:51 | clojurebot | {:a 1, :b 2} |
| 11:52 | replaca | lpetit: much better! |
| 11:52 | lpetit | jfields: ^^^ |
| 11:52 | jfields | lpetit: exactly what I was looking for. thanks. |
| 11:52 | tomoj | I'm surprised into doesn't work without map vec |
| 11:53 | tomoj | into after partition 2, I mean |
| 11:56 | replaca | yeah, me too |
| 11:56 | chouser | Clojure's MapEntries are a kind of vector, not a kind of list. |
| 11:57 | chouser | ,(vector? (first {:a 1})) |
| 11:57 | clojurebot | true |
| 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:57 | replaca | chouser: it would be nice if into would take care of that for you |
| 11:58 | replaca | chouser: where it would just look for pairs of any kind |
| 11:58 | stuarthalloway | replaca: just the person I was hoping to find |
| 11:58 | stuarthalloway | replaca: any idea what object in pprint might be held by something across reloads? |
| 11:59 | replaca | stuarthalloway: not only no idea - I don't exactly understand the question |
| 11:59 | stuarthalloway | if you (use :reload-all ...) a bunch of things, over and over, the class objects themselves are never freed |
| 12:00 | stuarthalloway | causing you to run out of PermGen space quickly |
| 12:00 | replaca | stuarthalloway: my first guess would be the compiled formats |
| 12:00 | stuarthalloway | ,(use :reload-all 'clojure.contrib.pprint) |
| 12:00 | clojurebot | nil |
| 12:00 | stuarthalloway | if I did that ten more times I could kill the clojurebot |
| 12:00 | replaca | wow, that's fast |
| 12:01 | replaca | I'll take a look |
| 12:01 | stuarthalloway | ...assuming its memory footprint is similar to my laptop's |
| 12:01 | stuarthalloway | let me give you some code to help out |
| 12:01 | replaca | What causes the PermGen space prob? classes or something else? |
| 12:01 | stuarthalloway | classes |
| 12:02 | replaca | ok |
| 12:02 | replaca | I haven't seen that before |
| 12:02 | stuarthalloway | but if, for example, a namespace registered an instance of one of its classes with a collection in clojure.core, that instance would: |
| 12:02 | stuarthalloway | ... hold onto its class |
| 12:02 | stuarthalloway | ... which would hold its classloader |
| 12:02 | stuarthalloway | ... which would hold all other classes held by the loader |
| 12:03 | replaca | what does "registered an ... clojure.core" mean? |
| 12:03 | technomancy | heh; "the clojurebot"... sounds like "the batman" |
| 12:03 | stuarthalloway | e.g. stuffing an instance into a mutable collection owned by core |
| 12:03 | stuarthalloway | this is unlikely in general, and esp. so in Clojure |
| 12:03 | Borkdude | chouser: just posted some comments/typo corrections on the TjoC forum |
| 12:03 | stuarthalloway | but something is doing it |
| 12:04 | chouser | Borkdude: thanks! |
| 12:04 | Borkdude | np :) |
| 12:04 | rhickey | stuarthalloway: and you're sure not just the DynamicClassLoader cache? |
| 12:04 | stuarthalloway | replaca: check out http://paste.lisp.org/display/99346 |
| 12:05 | stuarthalloway | rhickey: 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:05 | npoektop | i 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:05 | replaca | hmmm, what mutable collections are there in core that I could even get my grubby little hands on? |
| 12:05 | stuarthalloway | if you run it with pprint (or anything that uses pprint) no :live-classes *ever* get collected, and it fails fast |
| 12:06 | stuarthalloway | oh, and the gf macro is irrelevant -- left over from testing raw classloading to make sure that wasn't the culprit |
| 12:06 | Licenser | npoektop: tere are more then one way :) |
| 12:06 | stuarthalloway | replaca: I have no idea! Registering a callback with some IO system in Java itself would also do it |
| 12:07 | npoektop | Licenser, i mean it was a very simple way |
| 12:07 | replaca | stuarthalloway: don't think I do that, but I'll look more closely |
| 12:07 | replaca | stuarthalloway: thanks for the pointer |
| 12:07 | Licenser | npoektop: that wold be a function :) |
| 12:07 | rhickey | stuarthalloway: always 464? |
| 12:07 | Licenser | http://gist.github.com/390080 |
| 12:08 | Licenser | look at those functions |
| 12:08 | stuarthalloway | replaca: you don't seem to be doing anything of the sort. I read through all of pprint before asking |
| 12:08 | Licenser | most interesting the last one combiner |
| 12:08 | replaca | stuarthalloway: you're a brave man |
| 12:08 | Licenser | that allows you to convert a vector to a string in a nice and customizable way |
| 12:08 | stuarthalloway | bravery is often the lack of wit to recognize danger |
| 12:08 | replaca | stuarthalloway: something with my proxies, maybe? |
| 12:09 | npoektop | Licenser, thank you ) |
| 12:09 | stuarthalloway | if one of them is permanently passed off, yes, but at a quick glance the usages seemed scoped |
| 12:09 | Licenser | npoektop: welcome :) |
| 12:10 | hiredman | clojurebot: exceptions? |
| 12:10 | clojurebot | http://paste.lisp.org/display/74305 |
| 12:10 | replaca | npoektop: you can do that with cl-format: (cl-format true "~{~a~^, ~}~%" [1 2 3 4 5]) |
| 12:10 | stuarthalloway | rhickey: 464 what? |
| 12:11 | chouser | is there no way to tell which classes are being held? |
| 12:11 | stuarthalloway | rhickey, replaca: use -XX:MaxPermSize=32m to make the problem happen sooner |
| 12:11 | stuarthalloway | the default is 64m |
| 12:11 | replaca | stuarthalloway: thanks |
| 12:11 | stuarthalloway | chouser: with some memory debugger tool, perhaps |
| 12:12 | npoektop | replaca, wow! thank you |
| 12:12 | rhickey | stuarthalloway: leak of 464 each iteration |
| 12:13 | stuarthalloway | rhickey: yes. I assume it is the exact number of classes in pprint |
| 12:13 | replaca | rhickey: I bet that's all the classes in pprint |
| 12:13 | stuarthalloway | btw, it is *not* simply a leak in protocols. multimethods, or types. I tried them all standing alon and they are fine |
| 12:14 | tomoj | chouser: still, clojure doesn't usually complain about that sort of thing |
| 12:14 | replaca | stuarthalloway, 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:15 | replaca | It'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:45 | tcrayford | chouser/tomoj: ping |
| 12:46 | tomoj | ello |
| 12:46 | tcrayford | that compiler trickery earlier won't work for defexprs |
| 12:46 | tcrayford | (expressions that begin with def something |
| 12:47 | tcrayford | was wondering if you could think up a better way to do that part, because that's the only bit I need atm |
| 12:48 | emh | what'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:48 | tcrayford | yes |
| 12:48 | tcrayford | (use-fixtures :once #((def a 1) (%) (def a nil))) |
| 12:48 | tcrayford | you can't use let though, has to be def (I think) |
| 12:49 | tcrayford | though tryin wrapping the (%) call with a let |
| 12:50 | emh | what's wrong with (defmacro s [] (for [x ['c 'd]] `(def ~x 8))) ? |
| 12:50 | emh | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn (NO_SOURCE_FILE:0) |
| 12:50 | tomoj | tcrayford: it doesn't work for fns either, does it? |
| 12:51 | tomoj | I mean, fns that are inside other fns |
| 12:51 | tcrayford | tomoj: havn't tried |
| 12:52 | emh | tcrayford: 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:52 | tcrayford | emh: use macroexpand |
| 12:52 | emh | tcrayford: k. ofc |
| 12:52 | tcrayford | or use binding and declare |
| 12:52 | tcrayford | ((def c 8) (def d 8)) |
| 12:52 | tcrayford | is what I get with macroexpansion |
| 12:52 | tcrayford | so you end up trying to call (8 8) |
| 12:52 | tcrayford | and hence the error |
| 12:52 | tcrayford | tomoj: you tried nested fns yet? |
| 12:52 | tomoj | yeah, no luck |
| 12:53 | tcrayford | :( |
| 12:53 | tcrayford | is there any way around this? |
| 12:53 | tcrayford | (guess I can wait and ask rich next time he's around) |
| 12:54 | tomoj | I think it just needs a different path |
| 12:54 | tcrayford | aye? |
| 12:54 | tcrayford | I couldn't see any methods that'd lead to another expr (using show on defexpr) |
| 12:55 | tcrayford | this might be much nicer once c-in-c comes around :/ |
| 12:57 | tcrayford | fogus: the earlier compiler hackery won't work for expressions involving def |
| 13:00 | chouser | tcrayford: in what way does it not work? |
| 13:00 | chouser | you want to know about the 'def' names too? |
| 13:01 | fogus_ | tcrayford: I'm sorry I dropped off and am not sure what you're talking about |
| 13:01 | tcrayford | oh chouser |
| 13:01 | tcrayford | fails |
| 13:01 | tcrayford | yeah |
| 13:01 | tcrayford | I can't figure them out |
| 13:01 | tcrayford | I get confused sometimes with you two :/ |
| 13:02 | Licenser | Raynes: FYI since I read your mail www.try-clojure.org is the same host as tryclj.licenser.net so you can deploy yourself |
| 13:02 | tcrayford | better, if you can tell me how you're figuring them out I can do the rest myself |
| 13:04 | tcrayford | then I'll just write a multimethod dispatching on the class of the analyze&eval calls |
| 13:05 | dnolen | technomancy: so installation of swank-clojure via ELPA broken right now? |
| 13:07 | stuarthalloway | replaca, rhickey: the PermGen issue occurs with pre-proxy pprint too |
| 13:09 | Luyt | stuarthalloway: I'm afraid I found a typo in your book. It didn't deter me from reading further, tho ;-) |
| 13:10 | stuarthalloway | Luyt: Sorry about that. Please post it to http://www.pragprog.com/titles/shcloj/errata |
| 13:10 | sexpbot | "The Pragmatic Bookshelf | Errata for Programming Clojure" |
| 13:13 | Luyt | stuarthalloway: 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:17 | rdsr | Is there something similar to immigrate (which create vars in the public namespace for each public var in the provided namespaces) for java classes??? |
| 13:18 | stuarthalloway | rdsr: no. How would it work? |
| 13:20 | rdsr | StuartHalloway: I just thought that I could import all the necessary classes, without the user needing to import them explicitly |
| 13:21 | stuarthalloway | but how would it know which ones you want? Remember that you can say "import" at any time in Clojure |
| 13:32 | tcrayford | ,(#{`def `defn `defstruct |
| 13:32 | tcrayford | `defrecord `defmacro `deftype `defprotocol} 'defn) |
| 13:32 | clojurebot | EOF while reading |
| 13:32 | tcrayford | ,(#{`def `defn `defstruct |
| 13:32 | tcrayford | `defrecord `defmacro `deftype `defprotocol} 'defn) |
| 13:32 | clojurebot | EOF while reading |
| 13:32 | tcrayford | heh |
| 13:33 | tcrayford | that works locally |
| 13:33 | tcrayford | (it returns nil though, which puzzles me) |
| 13:33 | chouser | you're splitting the line |
| 13:33 | chouser | ,(#{`def `defn `defstruct `defrecord `defmacro `deftype `defprotocol} 'defn) |
| 13:33 | clojurebot | DENIED |
| 13:34 | tcrayford | locally that shouln't matter though right? |
| 13:34 | tcrayford | I still get a nil even if I don't split the line |
| 13:34 | chouser | right |
| 13:35 | chouser | ,[`map 'map] |
| 13:35 | clojurebot | [clojure.core/map map] |
| 13:35 | chouser | ,(= `map 'map) |
| 13:35 | clojurebot | false |
| 13:35 | tcrayford | hah |
| 13:35 | tcrayford | had them the wrong way round |
| 13:35 | tcrayford | cheers |
| 13:35 | chouser | ,(#{`map} 'map) |
| 13:35 | clojurebot | nil |
| 13:35 | chouser | ,(#{'map} `map) |
| 13:35 | clojurebot | nil |
| 13:35 | chouser | ,(#{`map} `map) |
| 13:35 | clojurebot | clojure.core/map |
| 13:36 | tcrayford | yeah, gotcha |
| 13:36 | tcrayford | was trying to use that to get around the whole not knowing the names for getting at the exprs of a defn |
| 13:38 | tcrayford | and then just using :arglists to get at the ones inside the def block |
| 13:38 | chouser | seems ... fragile |
| 13:38 | tcrayford | yeah :( |
| 13:38 | tcrayford | I can't figure out getting at the vars from a defn node though |
| 13:39 | tcrayford | using the compiler anyway |
| 13:41 | tcrayford | got it, I think |
| 13:43 | chouser | defn, Licenser: are you the guys working on the sandbox stuff for tryclojure, watson, etc? |
| 13:43 | tcrayford | (->> |
| 13:43 | tcrayford | '(defn a [] 1) |
| 13:43 | tcrayford | (analyze) |
| 13:43 | tcrayford | (.init) |
| 13:43 | tcrayford | (.target) |
| 13:43 | tcrayford | (.methods) |
| 13:43 | Licenser | chouser: I am defn isn't and Raynes is also helping out with the sandbox |
| 13:43 | tcrayford | (first) |
| 13:43 | tcrayford | (.locals) |
| 13:44 | tcrayford | (keys) |
| 13:44 | tcrayford | (map #(.sym %))) |
| 13:44 | tcrayford | dang |
| 13:44 | tcrayford | ,(->> '(defn a [] 1) (analyze) (.init) (.target) (.methods) (first) (.locals) (keys) (map #(.sym %))) |
| 13:44 | clojurebot | DENIED |
| 13:44 | chouser | tcrayford: please use paste for multi-line posts |
| 13:45 | tcrayford | yeah I'm dumb |
| 13:45 | tcrayford | sorry |
| 13:45 | chouser | Licenser: are you trying to work in some way to allow 'def'? Have you considered throw-away namespaces? |
| 13:45 | Raynes | chouser: 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:45 | Raynes | All three of those projects use licenser. |
| 13:46 | Licenser | chouser: 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:46 | Licenser | problem is as soon as you add some kind of def there is a way to flood the memory |
| 13:46 | chouser | surely you can temporarily flood memory anyway. |
| 13:46 | Raynes | When I say "use licenser" I mean, because he knows more about security than either of us, and both projects use clj-sandbox. |
| 13:46 | Licenser | or it makes it so horribly uncompfortable to use the sandbox that you'd not like to do it |
| 13:46 | Raynes | <3 Licenser |
| 13:47 | Licenser | chouser: not with the current sandbox |
| 13:47 | Raynes | Not with timeouts anyway. |
| 13:47 | Raynes | If you set the timeouts to something sane, there shouldn't be a way to flood memory. |
| 13:47 | chouser | right, timeouts -- why not on timeout clear the namespace? |
| 13:48 | Licenser | chouser: I'm not 100% sure if that even help |
| 13:48 | Licenser | +s |
| 13:48 | Raynes | Because then you could prevent it from timing out, but keep defing things until memory is flooded. |
| 13:48 | chouser | delete it, even. Give each form you want to eval a fresh new namespace to play in, and delete it when they're done. |
| 13:48 | chouser | how could you prevent it from timing out? |
| 13:49 | technomancy | dnolen: works for me. but you don't really need swank-clojure.el anymore, see the latest swank-clojure readme. |
| 13:49 | Licenser | plus the fact that if the timeout is shourt enough to have it die def is no use |
| 13:49 | Raynes | Don't do any computations that make it timeout. |
| 13:49 | Licenser | allowing def only makes sense if you allow it to be persistant for the entire session |
| 13:49 | Licenser | that means a lifetime that is extended by every following request |
| 13:50 | chouser | are you sure that's true? |
| 13:50 | chouser | it 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:51 | Licenser | chouser: 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:51 | Licenser | since they don't have 'one file' but rather 'one session' |
| 13:51 | chouser | if 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:52 | Raynes | I'm not sure that would make such sense. |
| 13:52 | Raynes | I'm not sure how that would help, anyway. |
| 13:53 | chouser | one 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:53 | Licenser | chouser: hmm that isn't a bad idea |
| 13:53 | Licenser | but that is a application solution not a library one |
| 13:53 | chouser | you could at least solve that problem. |
| 13:53 | Licenser | sorry I'm so critic, I want to find a good solution that is rather unviersal and suited to be taken into a library |
| 13:54 | Raynes | Oh, I see. |
| 13:54 | Raynes | Sorry, I've been up a long time. I had to read chouser's message 10 times to get what he was saying. |
| 13:54 | Raynes | :( |
| 13:55 | Raynes | That is indeed an option, but it would be slow. |
| 13:55 | Raynes | Could have an "enable def (slower)" option. |
| 13:56 | chouser | slower than what? |
| 13:57 | Licenser | chouser: 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:57 | Raynes | chouser: If you have to reload every send, it would take a little while for everyting to re-run. |
| 13:57 | Licenser | hmm the sandbox could actually hold that history |
| 13:57 | Licenser | but then that would be bad in some way since you don#t expect it but you could make a flag |
| 13:57 | Licenser | *thinks* |
| 13:59 | Raynes | Blah. |
| 13:59 | Licenser | it technically does not solve the problem but it is a workaround untill there is a good solution |
| 14:00 | Licenser | Raynes: why blah? |
| 14:00 | Raynes | I accidentally logged out. |
| 14:00 | Licenser | but chouser will deleting a namespace force everything to be GC'ed in there? |
| 14:00 | chouser | you'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:00 | Raynes | Anyway, if you re-run the "file" on every send, of course it will be slower. |
| 14:01 | chouser | so delete the namespace and that ought to do it. |
| 14:01 | chouser | Raynes: slower than what? re-running a 'let' with eveything in it each time? |
| 14:01 | Licenser | chouser: what is wtih (def a (ref '())) (def b (ref (list a))) (dosync (alter a conj b))? |
| 14:01 | Raynes | chouser: Slower than a normal REPL. |
| 14:02 | Licenser | Raynes: everyting web based is slower then the normal repl :P |
| 14:02 | chouser | Raynes: well sure -- normal trading of space for speed. |
| 14:03 | chouser | Licenser: JVM GC handles reference loops just fine. once both a and b are gone, it shouldn't be a problem. |
| 14:03 | Licenser | cool |
| 14:05 | Licenser | chouser: I'll try a version of sandbox that tears down the namespace after each run and save everyting successfull |
| 14:05 | Licenser | but that will cause the sandbox to time out real quick :( |
| 14:05 | Licenser | so this is no real good solution either I fear :( |
| 14:06 | chouser | you think that creating or deleting a namespace will be very slow? |
| 14:07 | Licenser | no but running the entire history will |
| 14:08 | Licenser | hmm one could just single out the defs and save them |
| 14:08 | tcrayford | if I have a seq of vecs of the form ([k v]), how can I turn that seq into a map? |
| 14:08 | Licenser | that is a compomise |
| 14:10 | Borkdude | tcrayford: (into {} [[1 2] [3 4]]) ? |
| 14:11 | tcrayford | that works |
| 14:11 | tcrayford | cheers |
| 14:13 | Licenser | chouser: thanks anyway :) I'll look into that |
| 14:19 | Borkdude | any ideas for default metasyntactic variable names in Clojure, or foo, bar, baz still going strong? |
| 14:26 | defn | dog, cat, fish |
| 14:26 | defn | :D |
| 14:27 | chouser | if you check rhickey slides I think you'll see a lot of fred, ethyl, ricky, lucy |
| 14:28 | tcrayford | chouser: got the defn stuff working now, cheers for the help earlier today |
| 14:28 | Borkdude | Python 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:28 | chouser | tcrayford: sure. Maybe someday I can use your work. |
| 14:28 | arkahn | Programming Clojure was reviewed on slashdot.org ^^ |
| 14:30 | Borkdude | chouser: maybe names from the great persons in computer science history? Turing, McCarthy, Hickey? :P |
| 14:32 | Borkdude | chouser: obviously those names you mention are from some TV series I don't know.. I googled for it |
| 14:32 | cemerick | ricky and lucy I knew -- fred and ethyl didn't ring any bells |
| 14:33 | rhickey | ethel |
| 14:33 | rhickey | I Love Lucy |
| 14:33 | cemerick | my first guess re: fred & ethel were the honeymooners |
| 14:34 | chouser | Ricky and Lucy's friends. |
| 14:34 | Borkdude | ethyl is something that can get you warm also though |
| 14:34 | cemerick | chouser: thank goodness for google |
| 14:35 | cemerick | rhickey is either laughing his ass off or facepalming right now :-) |
| 14:36 | chouser | Which 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:36 | cemerick | bah, I *almost* get that joke. |
| 14:36 | chouser | cemerick: Am I not younger than you? |
| 14:37 | cemerick | chouser: no idea -- recently turned 30 here |
| 14:37 | chouser | we seem to be on the wrongs sides of this conversation. |
| 14:37 | chouser | ah, indeed. So I guess maybe the 4 years I have on you is enough to up my awareness of ancient TV shows. |
| 14:38 | cemerick | I've never watched much TV, so most pop culture reference go right over my head. |
| 14:38 | cemerick | Cosby was the first sitcom that I have any comprehensive memory of. |
| 14:38 | cemerick | or maybe the A-Team |
| 14:39 | Borkdude | chouser: you may also be geographically advantaged in your knowledge of this series? |
| 14:39 | chouser | Borkdude: probably not compared to cemerick |
| 14:39 | jkkramer | anyone 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:39 | cemerick | geography plays into this? |
| 14:40 | chouser | though 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:40 | Borkdude | cemerick: of course, why would I know an ancient American series? |
| 14:40 | jkkramer | i tried deleting ~/.emacs.d/elpa altogether and starting fresh, no luck |
| 14:40 | cemerick | Borkdude: oh, I thought you were comparing east coast vs. the interior. |
| 14:41 | tcrayford | jkkrammer: are you using OSX and deleting the files with the finder? |
| 14:41 | Borkdude | cemerick: I had no idea where you both were from, but now I know you are either from the coast or interior |
| 14:41 | jkkramer | i'm using osx but deleting the files with rm -rf |
| 14:41 | tcrayford | weird then |
| 14:41 | cemerick | Pop culture has historically taken some time to migrate to the interior, at least that's been my impression when traveling. |
| 14:41 | cemerick | Borkdude: I'm in Massachusetts. |
| 14:41 | tcrayford | have you tried `cat ~/.emacs.d/elpa/clojure-mode-1.7.1/clojure-mode.el |
| 14:42 | Borkdude | cemerick: ah |
| 14:42 | jkkramer | tcrayford: the file is there, and looks normal |
| 14:43 | tcrayford | weird |
| 14:43 | jkkramer | starting 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:43 | jkkramer | this is using aquamacs, btw |
| 14:44 | jkkramer | maybe i should bite the bullet and use regular emacs |
| 14:44 | drewr | no bullet-biting required; it's the sensible choice |
| 14:44 | tcrayford | there's a good cocoa fork somewhere about on github that has proper fullscreen support |
| 14:44 | technomancy | jkkramer: I've fixed that bug in package.el, but it hasn't been patched upstream yet. =( |
| 14:44 | tcrayford | (which I've been using for months) |
| 14:45 | tcrayford | technomancy: umbrella nearly works without caring about variable names |
| 14:45 | jkkramer | technomancy: ah, shucks. is the patch somewhere i can get to, then apply it manually? |
| 14:45 | lancepantz | i had not problem with aquamacs and the aquamacs-starter-kit |
| 14:47 | technomancy | jkkramer: check my package.el repo on github |
| 14:48 | jkkramer | technomancy: thanks |
| 14:49 | bmason | anyone else got this error with clojure.contrib.sql, calling "transaction"? |
| 14:49 | bmason | No matching method found: println for class swank.util.io.proxy$java.io.StringWriter$0 |
| 14:49 | hugod | tcrayford: how do you get fullscreen with the cocoa port - I couldn't find a way of getting rid of the apple menu... |
| 14:50 | tcrayford | hugod: using a patched version I found on github, that has ns-toggle-fullscreen as a builtin |
| 14:50 | bmason | I see this in the backtrace: 2: clojure.contrib.sql.internal$print_update_counts__2085.invoke(internal.clj:132) |
| 14:52 | stuarthalloway | bmason: that should be fixed on edge clojure |
| 14:53 | bmason | I'm running snapshot 1.2 right now |
| 14:53 | polypus | 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:53 | bmason | is that different from edge? |
| 14:53 | hugod | tcrayford: thanks, found it |
| 14:53 | lancepantz | polypus: netbeans has paredit? |
| 14:54 | stuarthalloway | bmason: shouldn't be... checking |
| 14:54 | bmason | lein deps should pull down most recent right? |
| 14:54 | cemerick | polypus: both have very limited support; counterclockwise (eclipse) is ahead on that count, but not by much AFAIK |
| 14:55 | polypus | lancepantz: 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:55 | lancepantz | ah, that'd be cool |
| 14:55 | polypus | cemerick: ty. which do you prefer? |
| 14:55 | stuarthalloway | bmason: how recent is your snapshot? There is a May 7 commit that should fix that |
| 14:55 | cemerick | polypus: enclojure (netbeans) |
| 14:56 | bmason | hmm... not sure how to check that |
| 14:56 | bmason | I just ran lein deps... I was assuming that would pick up latest |
| 14:56 | cemerick | polypus: very brief impressions of the various environments are at the bottom here: http://bit.ly/bvjSts |
| 14:56 | sexpbot | "The Ideal Clojure Development Environment - Chas Emerick - Muck and Brass" |
| 14:57 | polypus | cemerick: ty. reading now |
| 14:57 | stuarthalloway | bmason: lein deps doesn't clean out old stuff unless you run "lein clean" first |
| 14:57 | bmason | stuarthalloway: clojure-contrib-1.2.0-20100507.230536-107.jar |
| 14:58 | bmason | kk, I'll do clean |
| 14:59 | bmason | ok, after that it seems to have pulled the same jar |
| 14:59 | bmason | it didn't pull updates from the server it just copied from the local cache |
| 15:01 | jkkramer | technomancy: your package.el worked. the new versions of clojure-mode et al are awesome, thanks! |
| 15:01 | stuarthalloway | bmason: what is the name of contrib in your project.clj? |
| 15:02 | tcrayford | cemerick: does netbeans/etc have a decent clojure debugging experience? |
| 15:02 | bmason | stuarthalloway: [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] |
| 15:02 | cemerick | tcrayford: in what sense? |
| 15:03 | stuarthalloway | bmason: hmm, sounds right |
| 15:03 | stuarthalloway | it is the *clojure* jar that has the bugfix, btw |
| 15:03 | polypus | cemerick: does enclojure do auto-indentation, rainbow parens, and barfage/slurpage? |
| 15:03 | bmason | ah |
| 15:03 | cemerick | polypus: yes, no, and....what? :-) |
| 15:04 | lancepantz | hahahaha |
| 15:04 | tcrayford | cemerick: as in, better than you get from a repl etc |
| 15:04 | bmason | stuarthalloway: now, my clojure dep is written as [org.clojure/clojure "1.2.0-master-SNAPSHOT"] |
| 15:04 | Borkdude | polypus: barfage/slurpage is that paredit functionality? |
| 15:04 | stuarthalloway | bmason: also sounds right -- does it get you a build later than May 7? |
| 15:04 | bmason | and the jar is clojure-1.2.0-master-20100507.230258-69.jar |
| 15:05 | polypus | cemerick & Borkdude: yeah when you pull in or spit out stuff from a sexp. i use that a lot |
| 15:05 | cemerick | tcrayford: 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:06 | polypus | also splice and raise |
| 15:06 | cemerick | That may have already been improved since the last time I used the debugger, tho. |
| 15:06 | polypus | are indespensable |
| 15:06 | lancepantz | polypus: i think paredit is emacs only, there was something about limited similar functionality in vim a few weeks ago |
| 15:06 | cemerick | polypus: I largely have no idea what you're talking about. :-) Sorry. These are paredit terms? |
| 15:06 | Borkdude | polypus: I recently discovered that, it's very useful indeed |
| 15:06 | polypus | cemerick: yeah |
| 15:07 | lancepantz | i recently discovered paredit too, pretty great |
| 15:07 | Borkdude | cemerick: I think some paredit things are in Counter Clockwise |
| 15:07 | Borkdude | but it's unclear to me how far they/he got |
| 15:07 | cemerick | OK. Well, CCW seems to focus more on that. Enclojure has good selection/navigation shortcuts, but nothing that modifies code. |
| 15:08 | cemerick | I'm not familiar with paredit at all, so I'm not in a position to say much more than that. |
| 15:08 | tcrayford | I'm not sure I can even imagine editing lisp these days without paredit :/ |
| 15:08 | polypus | cemerick: cool, thanks for the info |
| 15:09 | bmason | yeah, an IDE without paredit functionality might be a dealbreaker for me too |
| 15:09 | cemerick | heh, everyone has their 80/20 :-) |
| 15:09 | bmason | I've been looking at moving to netbeans but not having paredit would be a significant loss |
| 15:10 | polypus | tcrayford: 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:10 | Borkdude | cemerick: what is the JVM tooling you meant on Twitter? |
| 15:10 | tcrayford | I'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:10 | tcrayford | seeing as I already know how to do ~90% of the stuff in cmerick's post |
| 15:11 | chouser | interesting. not netbeans? |
| 15:11 | cemerick | Borkdude: debugging, profiling, code coverage tools, and then all the simpler stuff that you'd expect in a Java dev environment. |
| 15:12 | tcrayford | chouser: not sure if I'd get commercial support with netbeans |
| 15:12 | chouser | ah |
| 15:12 | tcrayford | it'd be an interesting summer project or summat |
| 15:12 | cemerick | NetBeans appears to be a JavaFx-only zone these days w.r.t. new dev. |
| 15:13 | cemerick | That's harsh and a little disingenuous, but that's my overall impression atm. |
| 15:13 | tcrayford | and like you said, Intellij already commercially supports la clojure development |
| 15:13 | cemerick | tcrayford: Its pace seems to suggest that it's decidedly a part-time thing for the one guy they've got on it. *shrug* |
| 15:15 | alexyk | is there a version of get-in which returns a default? |
| 15:15 | tcrayford | cemerick: I'm just wondering if they'd be willing to support me (just food) to hack on it remotely over a summer. |
| 15:15 | cemerick | tcrayford: seems like it's worth a shot in any case :-) |
| 15:15 | tcrayford | unfortunately it'd have to be the summer after the coming one, already got an apprenticeship lined up |
| 15:16 | alexyk | tcrayford: I'd ask for shelter and good sex as well while at it. Stellar code is worth it. |
| 15:16 | Borkdude | alexyk: (or (get-in [:a "foo"] [:b]) "default") ? |
| 15:16 | bmason | what's the naming scheme on the clojure & clojure.contrib jars? |
| 15:17 | alexyk | Borkdude: yeah, I can or it myself for sire, but was wondering for a built-in |
| 15:17 | bmason | is there a way to figure out from clojure-1.2.0-master-20100507.230258-69.jar what date it was modified? |
| 15:18 | stuarthalloway | bmason: the bit after -master is the date |
| 15:18 | alexyk | bmason: I guess this is when it's built by the integration server after a push, so should coincide |
| 15:18 | lancepantz | heheh |
| 15:18 | bmason | ah ok |
| 15:18 | bmason | yeah I guess it is 2010 :) |
| 15:19 | Licenser | 2010/05/07? |
| 15:19 | stuarthalloway | bmason: you are back ten days compared to http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/ |
| 15:19 | sexpbot | "Index of /snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/" |
| 15:19 | alexyk | stuarthalloway: what's the state of the last-var-wins battle? Are you holding the fort? |
| 15:19 | bmason | ah, that makes sense |
| 15:19 | alexyk | stuarthalloway: against cemerick's cavalry? |
| 15:19 | stuarthalloway | alexyk: may turn it back off, undecided |
| 15:20 | Licenser | alexyk: the last var won |
| 15:20 | alexyk | stuarthalloway: perhaps a command-line option? |
| 15:20 | alexyk | making a warning an error if desired or vice versa |
| 15:20 | tcrayford | stuarthalloway: to throw in my two-cents (as a user), I like it |
| 15:20 | stuarthalloway | alexyk: this and other forms of added complexity have been discussed |
| 15:21 | cemerick | alexyk: heh, just trying to keep things as simple as possible |
| 15:22 | alexyk | cemerick: 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:22 | alexyk | ruins |
| 15:22 | bmason | technomancy: any ideas why "lein clean && lein deps" would still leave me on a 10 day old snapshot? |
| 15:22 | Borkdude | alexyk: 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:23 | alexyk | Borkdude: yeah, and would be consistent with get. |
| 15:23 | cemerick | alexyk: a good argument for not using use of course :-) |
| 15:23 | tcrayford | are there any scalars in clojure that allow metadata (apart from vars) |
| 15:23 | alexyk | bmason: do you have the snapshot repos in project.clj? |
| 15:24 | bmason | alexyk: 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:24 | opqdonut | tcrayford: symbols? |
| 15:24 | tcrayford | opqdonut: cheers |
| 15:24 | bmason | alexyk: [org.clojure/clojure "1.2.0-master-SNAPSHOT"] |
| 15:24 | bmason | [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] |
| 15:24 | alexyk | bmason: I guess stuarthalloway dislikes complexity. Then optimizing for lowest overall complexity of the Universe becomes hard :) |
| 15:24 | hiredman | vars are "scalars"? |
| 15:24 | bmason | :-D |
| 15:25 | tcrayford | ish |
| 15:25 | tcrayford | well they aren't |
| 15:25 | alexyk | which I agree with and it needs a bunch of gurus to estimate the expected perceived complexity |
| 15:25 | chouser | tcrayford: symbols |
| 15:25 | tcrayford | symbols work fine though |
| 15:25 | opqdonut | I guess he meant "non-collections" |
| 15:25 | tcrayford | yeah |
| 15:26 | alexyk | bmason: you need to specify the repos where the snapshots come from separately |
| 15:26 | hiredman | scalar seems like such an arbitrary distiction |
| 15:26 | bmason | alexyk: what do you mean? |
| 15:26 | tcrayford | google definitions has the following (amongst others) under scalar: a variable quantity that cannot be resolved into components |
| 15:26 | alexyk | oh wait, lein's supposed to know about them |
| 15:26 | bmason | yeah, lein comes with 4 standard repos |
| 15:27 | bmason | I wonder if I need the org.clojure/ qualifier... |
| 15:27 | alexyk | bmason: right, specifying -SNAPSHOT should be enough as lein knows about the usual suspect repos. Unless you have a very old one. |
| 15:27 | hiredman | clojure numbers can be bigdecimals, which technicalling are composed of two parts |
| 15:27 | alexyk | you can specify your own repos like, :repositories {"incanter" "http://repo.incanter.org"} |
| 15:27 | hiredman | so then numbers aren't scalars? |
| 15:27 | hiredman | or only are sometimes? |
| 15:28 | alexyk | bmason: looks right to me |
| 15:28 | hiredman | scalarness is an abstraction leak |
| 15:28 | Borkdude | hiredman: maybe only 1 and 0 are scalars |
| 15:29 | alexyk | bmason: http://build.clojure.org/job/clojure/ |
| 15:29 | sexpbot | "clojure [Hudson]" |
| 15:29 | hiredman | Borkdude: how so? |
| 15:29 | alexyk | they just built a new one 24 minutes ago |
| 15:29 | alexyk | first time after 5/7 |
| 15:29 | bmason | hehe |
| 15:29 | bmason | maybe things just haven't updated yet |
| 15:29 | Borkdude | because every other thing in memory seems to be composed from them |
| 15:29 | alexyk | http://build.clojure.org/ has all |
| 15:29 | sexpbot | "Dashboard [Hudson]" |
| 15:29 | hiredman | 1 and 0 don't exist, just varying levels of electrical current |
| 15:30 | hiredman | just 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:30 | alexyk | hipertracker: heads and tails do exist! (throws a coin) |
| 15:31 | alexyk | hiredman I meant |
| 15:31 | Borkdude | hiredman: maybe then look for a fifth mutable thing in Clojure, that is smallar than an atom? |
| 15:31 | tcrayford | hiredman: I was asking syntactically more than anything |
| 15:31 | hiredman | tcrayford: what do scalars have to do with syntax? |
| 15:32 | bmason | so... it sounds like caches probably just haven't updated yet for the new build |
| 15:32 | tcrayford | was looking for something that wasn't a literal collection, but yet still supported metadata |
| 15:32 | Borkdude | hiredman: hmm, if it would be the most atomic thing, would it still be mutable? |
| 15:32 | hiredman | anyway, "scalars" just rubs me the wrong way |
| 15:32 | hiredman | Borkdude: what do scalars have to do with mutability? |
| 15:32 | tcrayford | it does now I've thought about it |
| 15:32 | Borkdude | hiredman: since you went into the electronical world, I was thinking electrons |
| 15:33 | Borkdude | and atoms clearly exist in Clojure |
| 15:33 | Borkdude | never mind ;) |
| 15:33 | hiredman | is a long a scalar on 32 bit machines? |
| 15:33 | hiredman | they can call the chapter whatever they want |
| 15:34 | tcrayford | and then they cover all the non-collection types in there |
| 15:34 | hiredman | it doesn't make "scalars" less annoying |
| 15:34 | tcrayford | aye |
| 15:34 | turbofail | that's what we need... a book on clojure written in the style of james joyce |
| 15:34 | tcrayford | that was where I thought of that name for what I was trying to express |
| 15:34 | tcrayford | but it doesn't really work |
| 15:35 | hiredman | if symbols are implemented as records via defcrecord, are they still "scalars" ? |
| 15:36 | hiredman | are ratios really scalars? |
| 15:36 | Borkdude | hiredman: is something that can contain metadata still a scalar? |
| 15:36 | chouser | hiredman: the book's not in print. we're open to suggestions. |
| 15:37 | stuarthalloway | chouser: I think you should indeed print it :-) |
| 15:37 | chouser | stuarthalloway: heh |
| 15:37 | Borkdude | I printed it partly today |
| 15:37 | tcrayford | anybody got a decent setup with lein with regards to where you put integration tests? |
| 15:37 | tcrayford | guess I can nest them under ./test |
| 15:38 | hiredman | chouser: "On things not usually considered to be a collection of other things" |
| 15:38 | chouser | heh, nice. |
| 15:39 | Borkdude | On simple types? |
| 15:39 | tcrayford | who says that maps aren't simple |
| 15:40 | Borkdude | tcrayford: they are pretty simple to use, hmm, point taken |
| 15:43 | Borkdude | On single value data types? |
| 15:43 | tcrayford | misleading, numbers aren't a single value data type (if they were there could only be one number) |
| 15:43 | Borkdude | tcrayford: strings are in that sense also a composite of chars |
| 15:43 | Borkdude | so yes, hmm |
| 15:44 | tcrayford | arc calls them "atoms" :P |
| 15:44 | tcrayford | I've used (def lone? (complement coll?)) before |
| 15:44 | Borkdude | Maybe scalar isn't so bad after all ;) |
| 15:47 | hiredman | tcrayford: well, are java collections scalars? |
| 15:47 | hiredman | because coll? is only true for clojure collections |
| 15:48 | tcrayford | you could probably adapt lone? so that it works for the type of things we're talking about |
| 15:48 | tcrayford | still not sure what to call them though |
| 15:49 | Borkdude | Non-persistent bastards |
| 15:53 | hiredman | Borkdude: 1 is pretty persistent, as long as it's not auto promoted to BigDecimal at some point |
| 15:57 | metaperl_ | 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:57 | fogus_ | I was hoping people would read that chapter as "On Scala" :p |
| 16:00 | Borkdude | fogus_: no but you got me interested a little more in Haskell as I progress |
| 16:01 | fogus_ | Borkdude: That makes two of us |
| 16:02 | arkahn | why does (if-let [x nil] ...) bomb out? : / I thought it was supposed to go to an 'else' condition |
| 16:02 | Borkdude | ,(doc if-let) |
| 16:02 | clojurebot | "([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:03 | Chousuke | oldform? :/ |
| 16:03 | Chousuke | ~def if-let |
| 16:03 | Borkdude | ,(if-let [x nil] "true" "false") |
| 16:03 | clojurebot | "false" |
| 16:04 | Chousuke | eh, what's wrong with the def lookup :( |
| 16:04 | arkahn | oh... at my repl, it bombs |
| 16:04 | arkahn | 1.1.0 |
| 16:04 | Borkdude | ,(clojure-version) |
| 16:04 | clojurebot | "1.1.0-master-SNAPSHOT" |
| 16:04 | tcrayford | works here at 1.2 |
| 16:04 | Chousuke | what does the exception message say? |
| 16:04 | Borkdude | arkahn: maybe paste the whole expression? |
| 16:05 | tcrayford | clojurebot: why are you so slow looking up the if-let definition |
| 16:05 | clojurebot | It's greek to me. |
| 16:05 | hiredman | and I ended up at the wrong line number |
| 16:05 | Chousuke | ah, right, oldform is backwards "compatibility" :P |
| 16:05 | hiredman | could just be github being dumb too |
| 16:06 | Chousuke | if-let used to be (if-let x foo ...) |
| 16:06 | arkahn | wait ... now it works ... looking.... |
| 16:07 | arkahn | ugh .. sorry, I guess the repl doesn't like multiline input |
| 16:07 | arkahn | that was my problem |
| 16:09 | tcrayford | I need a better name for "replacing all symbols that could be bound to something with fixed symbols" |
| 16:16 | replaca | stuarthalloway: you there? |
| 16:16 | stuarthalloway | sorta :-) |
| 16:16 | replaca | stuarthalloway: so you deleted pprint_base and dispatch altogether, right? |
| 16:17 | stuarthalloway | replace: I removed files being loaded at the top pprint to isolate cl_format |
| 16:18 | stuarthalloway | then deleted code from the bottom of cl_format working up |
| 16:19 | replaca | cool, so you still had both pprint_base and cl_format, right? |
| 16:20 | replaca | I have no idea why just loading that fn could cause a problem |
| 16:20 | replaca | but I can do a bunch more stuff to simplify and also look at what a profiler tells me |
| 16:21 | bmason | ,(parse (java.io.StringReader. "<foo><bar /></foo>")) |
| 16:21 | clojurebot | java.lang.Exception: Unable to resolve symbol: parse in this context |
| 16:22 | stuarthalloway | replaca: I suspect the problem is nonlocal to the symptom |
| 16:22 | bmason | hmm... getting No matching method found: parse for class com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl |
| 16:22 | replaca | stuarthalloway: do you see this problem with the new clojure.pprint as well? |
| 16:23 | bmason | am I doing something wrong? |
| 16:25 | stuarthalloway | replaca: did not try it |
| 16:25 | replaca | stuarthalloway: ok, I'll try that flavor too. I won't get to it until tonight |
| 16:25 | alexyk | when trying to prepend an element to a vector with cons, I get a thing which looks right, but has a type Cons: |
| 16:25 | alexyk | ,(type (cons 1 [2 3])) |
| 16:25 | clojurebot | clojure.lang.Cons |
| 16:26 | alexyk | ,(cons 1 [2 3]) |
| 16:26 | clojurebot | (1 2 3) |
| 16:26 | alexyk | ,(type (cons 1 '(2 3))) |
| 16:26 | clojurebot | clojure.lang.Cons |
| 16:26 | alexyk | ,(cons 1 '(2 3)) |
| 16:26 | clojurebot | (1 2 3) |
| 16:26 | phobbs | I'm having trouble setting up slime |
| 16:26 | alexyk | what have we here? |
| 16:27 | phobbs | it won't bring up a *slime* buffer, but it does bring up an inferior-lisp buffer |
| 16:27 | replaca | alexyk: it would appear we have a cons :-) |
| 16:28 | alexyk | replaca: yeah :) |
| 16:28 | bozhidar | phobbs: are you using slime from ELPA? |
| 16:28 | alexyk | what's the fastest way to prepend an element to a vector and have a vector as the result? |
| 16:29 | stuarthalloway_ | alexyk: you should generally not do that |
| 16:30 | stuarthalloway_ | by "fastest" are you talking developer ease or execution speed |
| 16:30 | alexyk | stuarthalloway_: true... but say I want to? |
| 16:30 | alexyk | stuarthalloway_: execution |
| 16:30 | phobbs | yes, using ELPA |
| 16:30 | phobbs | I've tried it emacs -q and it works |
| 16:30 | LauJensen | Im done cooking: http://www.bestinclass.dk/index.clj/2010/05/refresh-your-cache--best-in-class-has-been-baked.html |
| 16:30 | sexpbot | "Best In Class: Refresh your cache - Best In Class has been baked" |
| 16:30 | phobbs | so something in my config is supressing it |
| 16:32 | ninjudd | alexy: why not just use a list? those are optimized for prepending |
| 16:34 | stuarthalloway | alexy: idiomatically, use (into [] ...) |
| 16:34 | ninjudd | alexy: then just do (vec list) at the end when you want a vector |
| 16:35 | alexyk | ninjudd: 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:35 | Licenser | LauJensen: I personally like fried things a lot |
| 16:35 | Licenser | or grilled |
| 16:35 | alexyk | I destructure as [x & tail] and would glue back x*, the modified x, to tail |
| 16:37 | alexyk | I 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:37 | alexyk | or I need an automagical vectorizer or listorizer |
| 16:42 | notostraca | alexyk: are you trying continuation-passing style? that sounds like what you are talking about |
| 16:42 | Chousuke | alexyk: don't destructure, just read the first parameter, and assoc the modified one to the first index? |
| 16:42 | Chousuke | alexyk: you don't need to construct a whole new vector that way. |
| 16:42 | Chousuke | though that's what probably happens anyway, if it's a small vector :P |
| 16:42 | technomancy | phobbs: 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:42 | alexyk | notostraca: am not intentionally, link to what you mean! :) |
| 16:43 | phobbs | technomancy: 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:43 | alexyk | Chousuke: makes sense |
| 16:44 | Chousuke | alexyk: or, you can destructure with the :as directive |
| 16:44 | technomancy | phobbs: 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:45 | Chousuke | ,(let [[a & bs :as v] [1 2 3]] [a bs v]) I think it goes something like this :P |
| 16:45 | clojurebot | [1 (2 3) [1 2 3]] |
| 16:45 | phobbs | technomancy: OK, thanks. |
| 16:45 | alexyk | Chousuke: yep |
| 16:46 | jkkramer | LauJensen: your comment button gives a 404 error |
| 16:47 | alexyk | ,(assoc [1 2 3] 0 4) |
| 16:47 | clojurebot | [4 2 3] |
| 16:47 | alexyk | scary |
| 16:48 | LauJensen | jkkramer: sec |
| 16:49 | LauJensen | jkkramer: better? |
| 16:49 | jkkramer | LauJensen: yup, shows up now |
| 16:49 | LauJensen | jkkramer: great, thanks a lot for staying sharp |
| 16:50 | alexyk | LauJensen: you're gotta get some flak for the political turtle payground :) |
| 16:50 | jkkramer | LauJensen: looking forward to seeing the blog code, btw. i was going to write a baked clojure blog, now i may not need to |
| 16:50 | LauJensen | alexyk: huh? |
| 16:50 | LauJensen | oh, you mean the persecutors at 90 degrees and the persecuted at 120? |
| 16:50 | alexyk | LauJensen: the turtle playground post shows politically charged symbols in sequence :) |
| 16:51 | LauJensen | jkkramer: Most of it is very reuseable, so mostly you'll just need to handle design |
| 16:52 | jkkramer | LauJensen: are you handling clojure syntax highlighting on the fly, or just pasting in html from elsewhere? |
| 16:52 | Borkdude | LauJensen: very cool, but I hope I don't have to turn on cookies? |
| 16:53 | alexyk | LauJensen: ah, see your disclaimer below the graphics. too late :) |
| 16:56 | LauJensen | Borkdude: no cookies |
| 16:56 | LauJensen | jkkramer: SH is just M-x htmlize |
| 16:57 | Borkdude | LauJensen: just kidding btw |
| 17:25 | phobbs | I'm getting "File mode specification error: (error "Invalid timer") |
| 17:25 | phobbs | cancel-timer: Invalid timer" when I try to install swank-clojure from elpa |
| 17:25 | phobbs | this is from a fresh emacs-starter-kit installation |
| 17:31 | chouser | ,(key nil) |
| 17:31 | clojurebot | java.lang.NullPointerException |
| 17:31 | chouser | why? should that just return nil? |
| 17:38 | dakrone | chouser: isn't it doing that because it's trying to do a look up the key of a nil map? |
| 17:38 | Borkdude | chouser: just thinking. (map key {:a :b}) => (:a), (map key {}) => () ? |
| 17:38 | tcrayford | ,(clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL (read-string "(defn a [b c] (+ b c))")) |
| 17:38 | clojurebot | #<DefExpr clojure.lang.Compiler$DefExpr@c6ebd5> |
| 17:38 | tcrayford | interesting |
| 17:38 | tcrayford | that breaks for me here |
| 17:39 | tcrayford | can somebody else on 1.2 check that for me? |
| 17:39 | chouser | 'key' expects a MapEntry, but I expect it to fail gracefully. Like meta does. |
| 17:39 | chouser | ,(meta nil) |
| 17:39 | clojurebot | nil |
| 17:39 | AWizzArd | ,*clojure-version* |
| 17:39 | clojurebot | {:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"} |
| 17:40 | dakrone | tcrayford: #<DefExpr clojure.lang.Compiler$DefExpr@31e46a68> |
| 17:40 | tcrayford | dakrone: was that on 1.2? |
| 17:40 | dakrone | yes |
| 17:40 | tcrayford | interesting |
| 17:40 | tcrayford | it works here outside of the repl as well |
| 17:41 | hiredman | I should really restart clojurebot to pick up a newer clojure version |
| 17:43 | tcrayford | is there a decent way to reset a mulitimethod? |
| 17:46 | AWizzArd | tcrayford: (find-doc "method") reveals remove-all-methods |
| 17:49 | tcrayford | AWizzard: 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:50 | AWizzArd | yes, plus find-doc is your friend (: |
| 17:54 | alexyk | is there a shorter way to destructure a map into renamed keys: |
| 17:54 | alexyk | ,(let [[aa bb] (let [{:keys [a b]} {:a 1 :b 2}] [a b])] [aa bb]) |
| 17:55 | tcrayford | tranform the map first? |
| 17:56 | Chousuke | ,(let [{aa :a bb :b} {:a 1 :b 2}] [aa bb]) |
| 17:56 | manniche | LauJensen: http://bestinclass.dk/index.clj/ has a redirect loop and the redirect link from http://blog.bestinclass.dk/ gives a 404 |
| 17:56 | Chousuke | $(let [{aa :a bb :b} {:a 1 :b 2}] [aa bb]) |
| 17:56 | sexpbot | result: [1 2] |
| 17:57 | alexyk | hah! |
| 17:57 | LauJensen | manniche: Good catch, thanks |
| 17:57 | alexyk | clojurebot: envy sexpbot |
| 17:57 | Chousuke | the :keys form is a shortcut for the most common case :P |
| 17:58 | manniche | LauJensen: no, thank you for maintaining a great blog. Keep it up! |
| 17:58 | KirinDave | :\ |
| 17:58 | KirinDave | Is tail recursion so arcane? |
| 17:58 | alexyk | Chousuke: cool, thx |
| 17:59 | Chousuke | KirinDave: arcane? :/ |
| 17:59 | alexyk | $(print "bow before me, clojurebot weakling!") |
| 17:59 | sexpbot | result: bow before me, clojurebot weakling! |
| 18:00 | KirinDave | Chousuke: 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:00 | Chousuke | heh. |
| 18:00 | alexyk | KirinDave: is ipadding an act of banging on somebody's head with an ipad? |
| 18:00 | Chousuke | well, it's a bit difficut to tell sometimes I guess |
| 18:00 | KirinDave | alexyk: No, it's laboriously typing lisp on an ipad. |
| 18:01 | KirinDave | I hope I didn't make any egregious errors. -_- |
| 18:01 | Chousuke | but at least with clojure you get an error instead of accidental non-tail recursion :P |
| 18:01 | LauJensen | KirinDave: If you've paid for an ipad, you deserve some pain |
| 18:01 | LauJensen | :) |
| 18:01 | alexyk | KirinDave: that gonna hurt |
| 18:01 | KirinDave | LauJensen: At least when typing lisp. |
| 18:01 | alexyk | before they make that keyboard stand |
| 18:01 | alexyk | unless they did already |
| 18:01 | KirinDave | They did. |
| 18:01 | KirinDave | I have it, just not here with me. |
| 18:01 | alexyk | I furiously weigh the need for an ipad to sync my papers with Papers, but it seems smallish and now you carry 3 things. |
| 18:02 | KirinDave | Papers is uh-maaayyyy-zing. |
| 18:02 | hiredman | when you launche lein swank, is src/ not on the classpath? |
| 18:02 | alexyk | KirinDave: can you read 2-column on ipad? |
| 18:02 | KirinDave | I didn't buy an iPad because of it. But after I saw it I felt much better about my decision. |
| 18:02 | KirinDave | alexyk: Yes. |
| 18:02 | KirinDave | alexyk: Esp now that they have a fullscreen reader mode with no controls. Just a few % more magnification made all the difference. |
| 18:03 | alexyk | KirinDave: can you zoom to one column easily in preset amount or you always have to tune it and scroll? |
| 18:03 | KirinDave | Yes. |
| 18:03 | alexyk | loovely |
| 18:03 | KirinDave | Although the tuning is sorta automagical and not always correct. |
| 18:03 | KirinDave | Doube-tap TRIES to estimate, but doesn't always get it right. |
| 18:03 | alexyk | well it'll get better I'm sure. Too bad Amazon didn't let them do a Kindle app yet |
| 18:04 | KirinDave | ??? |
| 18:04 | KirinDave | They got shut down on that? |
| 18:04 | KirinDave | Oh well, the Kindle is a miserable PDF reader. |
| 18:04 | alexyk | they talked to Amazon to get Papers onto Kindle, but I guess Amazon is not there with any apps at all yet |
| 18:04 | KirinDave | Yeah, well no great loss |
| 18:04 | KirinDave | I have a Kindle DX. I would not use it for reading PDFs over my iPad. |
| 18:05 | alexyk | Kindle 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:05 | alexyk | and double-columns suck on DX |
| 18:06 | KirinDave | Yes, it lacks the resolution. |
| 18:07 | KirinDave | I was very disappointed with my DX. |
| 18:07 | KirinDave | I'm hoping to resell it. |
| 18:07 | alexyk | KirinDave: you can do it in horizontal, but then you have to scroll up and down like crazy |
| 18:07 | alexyk | for books it's OK though |
| 18:07 | KirinDave | It's also just lacking in resolution. |
| 18:07 | KirinDave | And for programming books with code samples it often fails, badly. |
| 18:07 | KirinDave | Frequently the syntax highlight gets reproduced as illegibility on the DX. |
| 18:08 | KirinDave | Or so is my experience with pragprog books on that device |
| 18:08 | alexyk | KirinDave: 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:09 | alexyk | Stu's book is OK in mobi |
| 18:09 | KirinDave | yes. My kindle 2 I still use, periodically. |
| 18:09 | KirinDave | So are there any clojure luminaries who are NOT currently wrapped up in book authoring? |
| 18:09 | KirinDave | I was asked to check around. |
| 18:10 | alexyk | KirinDave: how'd you compare Stu's book in PDF on iPad vs .mobi on DX? |
| 18:10 | KirinDave | alexyk: In general the iPad does a much better job. |
| 18:10 | KirinDave | That's to be expected. |
| 18:10 | alexyk | KirinDave: but specifically? :) |
| 18:10 | KirinDave | Specifically in this case, a much better job. |
| 18:10 | KirinDave | Color, better zoom, etc. |
| 18:10 | alexyk | :) |
| 18:10 | KirinDave | If the screen doesn't give you issues with its glossiness, the iPad is a superior reader in nearly every dimension. |
| 18:11 | KirinDave | But then, I read only infrequently in super-bright conditions. |
| 18:11 | alexyk | KirinDave: I don't believe you can read as long without straining your eyes and hands |
| 18:11 | alexyk | gotta compare with 2 red-eye flights, one device all the way each way |
| 18:12 | alexyk | a pragprog book each way :) |
| 18:12 | KirinDave | alexyk: I stare at a computer monitor all day. |
| 18:13 | KirinDave | Why would looking at an ipad tire my eyes anymore than my led-backlit monitor? |
| 18:14 | KirinDave | I am catching up on the clojure mailing list after a month or so of neglect |
| 18:14 | KirinDave | Man, there are some truly painful threads on there. |
| 18:14 | KirinDave | For example, lauding http://pchiusano.blogspot.com/2010/01/actors-are-not-good-concurrency-model.html |
| 18:14 | sexpbot | "Prettt-tty, pretty, pretty good!: Actors are not a good concurrency model" |
| 18:14 | alexyk | KirinDave: Kindle strains the eyes less than a monitor for sure |
| 18:15 | KirinDave | alexyk: I've only found marginal benefits there. It depends strongly on the lighting. |
| 18:15 | alexyk | true |
| 18:18 | alexyk | KirinDave: 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:18 | alexyk | but I tried Scala actors out of the box and they are annoying |
| 18:18 | KirinDave | alexyk: I think it's an erlang rant? |
| 18:19 | alexyk | after that Clojure shines on a multi-core box |
| 18:19 | alexyk | KirinDave: no, Paul is a Boston Scala guy |
| 18:19 | KirinDave | What an unfortunate person. Misinformed and lacking good taste. |
| 18:19 | alexyk | I'd rather use Scala and Clojure in an interop mode, instead of Java for speed |
| 18:21 | alexyk | for certain tasks Scala will be faster; and both signify FP progress. So the best modus operandi is to root for both IIMHO |
| 18:37 | bendlas | Hi folks |
| 18:38 | hiredman | ping? |
| 18:38 | scgilardi | pong |
| 18:38 | danlarkin | zap |
| 18:39 | KirinDave | whoop |
| 18:52 | emh | I'm having trouble defining multimethods with variable arity. is this supported? any examples out there? |
| 18:55 | emh | there. I got it, finally |
| 19:49 | hiredman | ,*clojure-version* |
| 19:49 | hiredman | hmmm |
| 19:50 | hiredman | ping? |
| 19:51 | hiredman | ping? |
| 19:51 | _mst | pong! |
| 19:51 | hiredman | ,*clojure-version* |
| 19:51 | hiredman | ,*clojure-version* |
| 19:51 | clojurebot | {:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"} |
| 19:52 | hiredman | clojurebot: go away |
| 19:52 | clojurebot | Titim gan éirí ort. |
| 20:08 | kyleburton | ,(find-doc "send-off") |
| 20:08 | clojurebot | ------------------------- 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:22 | mmarczyk | is Leiningen HEAD unusable with Clojure 1.1 projects? |
| 20:23 | technomancy | mmarczyk: who knows, man... who knows? |
| 20:24 | technomancy | mmarczyk: seriously, it should work. |
| 20:28 | mmarczyk | technomancy: well, for some reason a Clojure 1.1 project I'm testing exhibits weird behaviour with lein repl from HEAD |
| 20:29 | mmarczyk | namely two repl prompts are printed with no trailing newline, then control returns to the shell |
| 20:29 | mmarczyk | in contrast, lein-stable (1.1.0) works fine |
| 20:29 | technomancy | mmarczyk: ah, that's a bug in the repl task, yeah. haven't been able to reproduce it recently |
| 20:29 | mmarczyk | http://stackoverflow.com/questions/2851011/wrong-number-of-args-passed-to-replrepl |
| 20:29 | sexpbot | "Wrong number of args passed to: repl$repl - Stack Overflow" |
| 20:29 | mmarczyk | I was thinking of writing a comprehensive answer :-) |
| 20:30 | mmarczyk | there's a link to this "hello world" tutorial for Compojure, http://weavejester.github.com/compojure/docs/getting-started.html |
| 20:31 | technomancy | mmarczyk: post it to the lein mailing list and I'll try to take a look at it when I have some time later |
| 20:31 | mmarczyk | ok |
| 20:34 | lancepantz | ≈≈≈≈≈≈≈ |
| 20:37 | tufflax | I have clojure.jar on my classpath, and I'm unable to run "java clojure.main", shouldn't I be able to do that? |
| 20:39 | rhudson | tufflax: what's the error you see? |
| 20:39 | tufflax | Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main |
| 20:40 | mmarczyk | tufflax: what makes you think you've got clojure.jar on your classpath? |
| 20:40 | technomancy | tufflax: probably don't have your classpath set quite right. java doesn't know how to expand ~ => $HOME, for instance. |
| 20:41 | tufflax | I 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:41 | mmarczyk | tufflax: actually, never mind that, but if you mean something like $CLASSPATH, a "global" classpath is asking for trouble, just use -cp |
| 20:42 | tufflax | And I think that classpath is fine, yes? |
| 20:43 | mmarczyk | um, 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:43 | tufflax | heh |
| 20:44 | tufflax | both works when I provide the -cp argument |
| 20:47 | mmarczyk | and if you used just "C:\Documents and Settings\oskarkv\Desktop\clojure-1.1.0\clojure.jar" as your global (brrr!) classpath? |
| 20:47 | tufflax | well, let's see |
| 20:50 | tufflax | No, doesn't work |
| 20:51 | mmarczyk | :-( |
| 20:52 | mmarczyk | no idea then |
| 20:52 | mmarczyk | though you should probably use something like Leiningen to set up a project-specific cp for you anyway |
| 20:52 | mmarczyk | so I'm not sure if it's really worth your while to pursue this particular issue |
| 20:53 | tufflax | Maybe not |
| 20:53 | mmarczyk | surprising nonetheless |
| 21:12 | powr-toc | Does anyone here use Enclojure? |
| 21:16 | MadWombat | Hello |
| 22:24 | mmarczyk | any reason why a void method coming from an interface might need an explicit type hint in deftype (and not in reify)? |
| 22:25 | mmarczyk | asking in connection with this SO question: |
| 22:25 | mmarczyk | http://stackoverflow.com/questions/2854041/how-can-i-define-a-clojure-type-that-implements-the-servlet-interface |
| 22:25 | sexpbot | "How can I define a clojure type that implements the servlet interface? - Stack Overflow" |
| 22:29 | etate | man the ^void syntax was a brilliant decision |
| 22:32 | mmarczyk | it was, wasn't it :-) |
| 22:32 | mmarczyk | just goes to show how important the little things really are ;-) |
| 22:33 | arohner | mmarczyk: because by default, clojure methods have a java signature that take Objects and return Objects |
| 22:33 | arohner | mmarczyk: apparently the servlet interface has an API that requires returning void |
| 22:33 | mmarczyk | arohner: 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:34 | mmarczyk | arohner: 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:34 | mmarczyk | arohner: apparently the void type is inferred there, which is in line with deftype's docstring... how's Servlet different? |
| 22:36 | arohner | mmarczyk: hrm. I don't know |
| 22:36 | arohner | mmarczyk: that sounds like a fun reason to dig through the sources, but I don't have time right now |
| 22:37 | alexyk | I 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:38 | mmarczyk | arohner: same here |
| 22:39 | alexyk | hmm, 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:39 | mmarczyk | ,(loop [[x y] (range 10)] [x y]) |
| 22:39 | clojurebot | [0 1] |
| 22:39 | mmarczyk | so apparently you can destructure |
| 22:39 | arohner | "loop is exactly like let" |
| 22:39 | alexyk | mmarczyk: how'd you recur? |
| 22:40 | alexyk | in the recur, would you have to assign x and y? |
| 22:40 | alexyk | how does recur know to match a nested binding in loop? |
| 22:40 | dnolen | ,(loop [[x y :as foo] (range 10)] [x y foo]) |
| 22:40 | clojurebot | [0 1 (0 1 2 3 4 5 6 7 8 9)] |
| 22:40 | alexyk | dnolen: same as let, no recur |
| 22:41 | alexyk | show me how yo keep matching x and y |
| 22:43 | mmarczyk | alexyk: you'd have to provide whatever you want to go in place of (range 10) at the next iteration |
| 22:43 | mmarczyk | alexyk: if it's sth like (next ...), use :as xs in the destructuring vector |
| 22:44 | mmarczyk | ,(loop [[x y :as xs] (range 10) acc 0] (if y (recur (next xs) (+ acc x y)))) |
| 22:44 | clojurebot | nil |
| 22:44 | mmarczyk | ,(loop [[x y :as xs] (range 10) acc 0] (if y (recur (next xs) (+ acc x y)) acc)) |
| 22:44 | clojurebot | 81 |
| 22:44 | chouser | but loop/recur is hardly ever needed |
| 22:45 | alexyk | chouser: I verify sortedness of a graph and need early bail from unsorted |
| 22:45 | alexyk | chouser: is it ok? :) |
| 22:46 | mmarczyk | ,(some > (partition 2 1 (range 10))) |
| 22:46 | clojurebot | true |
| 22:46 | mmarczyk | um, wait, wrong |
| 22:46 | chouser | alexyk: no. :-) |
| 22:47 | alexyk | chouser: :( what's the right way then? |
| 22:47 | mmarczyk | ,(some #(apply > %) (partition 2 1 (range 10))) |
| 22:47 | clojurebot | nil |
| 22:47 | chouser | I mean, it's ok but there are more succinct solutions |
| 22:47 | mmarczyk | ,(some #(apply > %) (partition 2 1 [1 2 3 4 5 7 6 8 9)) |
| 22:47 | clojurebot | Unmatched delimiter: ) |
| 22:47 | mmarczyk | ,(some #(apply > %) (partition 2 1 [1 2 3 4 5 7 6 8 9])) |
| 22:47 | clojurebot | true |
| 22:48 | chouser | ,(let [s [1 2 3 4 5 4 5 6 7 6 7 8]] (map > s (cons 0 s))) |
| 22:48 | clojurebot | (true true true true true false true true true false true true) |
| 22:48 | mmarczyk | alexyk: that's one way to walk a sequence until the first point where there are two consecutive numbers which are not <-sorted |
| 22:48 | chouser | ,(let [s [1 2 3 4 5 4 5 6 7 6 7 8]] (every? true? (map > s (cons 0 s)))) |
| 22:48 | clojurebot | false |
| 22:49 | mmarczyk | um, maybe (map >= s (cons (first s) s)) |
| 22:49 | mmarczyk | :-) |
| 22:49 | chouser | mmarczyk: ah, better. |
| 22:49 | alexyk | I don't want to compute any pairs after the one which fails, i.e. assume tests are expensive and structures are large. |
| 22:49 | mmarczyk | alexyk: you won't, sequence operations tend to be lazy |
| 22:49 | chouser | alexyk: yes. every? will bail |
| 22:49 | mmarczyk | every? and some are |
| 22:50 | chouser | map is lazy |
| 22:50 | alexyk | ok |
| 22:50 | alexyk | good |
| 22:51 | mmarczyk | map will actually go 32 elements at a time, but every? and some will stop as soon as the value is determined |
| 22:51 | alexyk | nice! |
| 22:52 | chouser | map will only go 32 elements on a chunked seq |
| 22:53 | mmarczyk | ,(first (map println [1 2 3])) |
| 22:53 | clojurebot | 1 2 3 |
| 22:53 | mmarczyk | a lot of things are chunked seqs, though |
| 22:53 | chouser | ,(chunked-seq? (seq [1 2 3])) |
| 22:53 | clojurebot | true |
| 22:55 | mmarczyk | chouser: 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:56 | mmarczyk | (or I can recap) |
| 22:56 | alexyk | still, can loop/recur be nested, and how do they match then? |
| 22:56 | mmarczyk | alexyk: recur always goes to the innermost loop / fn |
| 22:57 | chouser | is there more than one method with the same name? |
| 22:57 | mmarczyk | chouser: not that I can see |
| 22:58 | chouser | oh, he should just have no type hints at all |
| 22:58 | chouser | (deftype servlet [] javax.servlet.Servlet (service [this request response] nil)) |
| 22:58 | alexyk | mmarczyk: I seem to get an error about the number of recur arguments mismatched hinting it binds wrong |
| 22:58 | chouser | if you hint any part of a deftype (or defrecord) method, you must hint every arg and the return |
| 22:58 | mmarczyk | chouser: that's what he tried to do and it doesn't work |
| 22:58 | chouser | ,(deftype servlet [] javax.servlet.Servlet (service [this request response] nil)) |
| 22:58 | clojurebot | java.lang.RuntimeException: java.lang.ClassNotFoundException: javax.servlet.Servlet |
| 22:58 | mmarczyk | chouser: which I verified at the repl |
| 22:58 | chouser | worked for me |
| 22:59 | mmarczyk | chouser: really? where do you get your javax.servlet.Servlet from? |
| 22:59 | chouser | I don't see an attempt to use no type hints |
| 22:59 | chouser | javax.servlet.Servlet is just an interface that comes with the JRE, right? Not a particular implementation? |
| 23:00 | chouser | oh, I guess that's not right. hm. |
| 23:00 | hiredman | it doesn't come with the jre |
| 23:00 | mmarczyk | chouser: ohhhhh |
| 23:00 | mmarczyk | chouser: ok, got it now: the ^void is needed if ^ServletRequest is provided (for example) |
| 23:00 | mmarczyk | right? |
| 23:00 | rhudson | Servlet comes with Java EE |
| 23:00 | chouser | right |
| 23:00 | mmarczyk | wow |
| 23:01 | chouser | never hint unless you have to. |
| 23:01 | chouser | :-) |
| 23:01 | mmarczyk | fair enough :-) |
| 23:01 | mmarczyk | however, there's *nothing* in deftype's docs to suggest this behaviour, IMO |
| 23:01 | mmarczyk | it says that type hints should be reserved for disambiguation |
| 23:02 | mmarczyk | so presumably you should be able to use them some places and not others... |
| 23:02 | mmarczyk | ok, here's my semi-official complaint about the docs then ;-) |
| 23:02 | mmarczyk | thanks a lot for the answer |
| 23:02 | mmarczyk | care to post it on SO? |
| 23:04 | mmarczyk | alexyk: can you paste an example somewhere? |
| 23:04 | chouser | "If not supplied, they will be inferred, so type hints should be reserved for disambiguation." |
| 23:05 | alexyk | mmarczyk: http://paste.pocoo.org/show/215106/ sorry this is a one-liner from repl, that's how I develop :) |
| 23:05 | alexyk | first I'll make it work with loop to see how destructuring works right in loop, then rewrite with every? to make chouser proud! |
| 23:06 | mmarczyk | chouser: 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:07 | chouser | right |
| 23:07 | alexyk | hmm, chrome on mac can't size its own textbox properly to scroll right |
| 23:07 | alexyk | have to click raw to see the line wrapped |
| 23:09 | chouser | "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:09 | sexpbot | "Datatypes | Clojure | Assembla" |
| 23:09 | mmarczyk | chouser: ok, so now I think I should have known better ;-) |
| 23:09 | alexyk | ah ok I missed one, sorry |
| 23:09 | mmarczyk | chouser: still, the docstring should probably include this info |
| 23:11 | mmarczyk | chouser: not that I'm really complaining, this is unreleased stuff of course... |
| 23:11 | mmarczyk | alexyk: got it working? |
| 23:12 | alexyk | mmarczyk: well I feed it a map of maps, and it complained nth not supported on this type: PersistentHashMap |
| 23:12 | mmarczyk | alexyk: btw, how about rearranging things a bit and using cond instead of nested ifs? |
| 23:12 | alexyk | Normally 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:13 | mmarczyk | alexyk: go ahead and try ;-) |
| 23:13 | alexyk | mmarczyk: cond sounds good |
| 23:16 | alexyk | ninjudd: ping |
| 23:17 | ms4720 | night all |
| 23:17 | mmarczyk | chouser: 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:18 | mmarczyk | alexyk: 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:18 | alexyk | mmarczyk: exactly |
| 23:19 | mmarczyk | alexyk: then it doesn't make sense to pass a hash map in |
| 23:19 | alexyk | mmarczyk: dreps is a hash map, but I take a seq of it |
| 23:19 | chouser | mmarczyk: I just posted to SO |
| 23:19 | clojurebot | map is lazy |
| 23:19 | mmarczyk | chouser: oh good :-) |
| 23:20 | alexyk | clojurebot: om mani padme hum map is lazy shanti shanti shanti |
| 23:20 | clojurebot | 'Sea, mhuise. |
| 23:20 | mmarczyk | alexyk: but that seq will come out in essentially random order |
| 23:20 | chouser | mmarczyk: I'm not suggesting that the docs couldn't be any better, just mentioning places that such information could be gleaned. |
| 23:20 | mmarczyk | alexyk: 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:21 | mmarczyk | alexyk: (depending on whether resizing happens etc.) |
| 23:21 | mmarczyk | chouser: perhaps the docstring could be shortened, with a list of links to extensive documentation, yeah |
| 23:22 | alexyk | mmarczyk: 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:22 | mmarczyk | chouser: 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:24 | mmarczyk | alexyk: ok, in that case maybe do a (into (sorted-map) ...) or sth similar when deserialising |
| 23:24 | alexyk | mmarczyk: yeah |
| 23:24 | alexyk | mmarczyk: or I'll ping ninjudd and ask him to add that to jiraph! :) |
| 23:26 | mmarczyk | jiraph? :-) |
| 23:29 | lancepantz | alexyk: he's talked about adding sorted-maps |
| 23:33 | alexyk | lancepantz: yeah! |
| 23:34 | alexyk | mmarczyk: jiraph is a clojure serialization with tokyo cabinet on github |
| 23:34 | alexyk | and google protocol buffers |
| 23:34 | mmarczyk | alexyk: googled for it already :-) |