#clojure log - May 17 2010

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

0:06 defn: anyone here do anything like put jruby and clojure together?

0:07 im interested in using clojure's concurrency semantics via jruby

0:09 technomancy: defn: http://github.com/technomancy/clojure-gem

0:10 defn: technomancy: yeah i saw that, is that still working?

0:10 technomancy: I think it's hard-coded to 1.0

0:10 defn: technomancy: do you have any example code anywhere?

0:10 * defn steals your line: "patches welcome"

0:10 technomancy: and transaction retries break because JRuby wraps the exceptions in a Ruby object, so Clojure is unable to catch them

0:10 but the data structures work great

0:10 underdev: technomancy: clojure-mode 1.7.1 updated in elpa, but clojure-test-mode remains at 1.3 fyi

0:11 technomancy: defn: more like "feel free to take the whole thing it over"

0:11 defn: haha, technomancy is it worth the effort?

0:11 technomancy: i think it's mostly me just wishing ruby was, in fact, clojure

0:12 technomancy: defn: if you have a reason to use ruby still then it's definitely worth it

0: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 :)

0:13 technomancy: underdev: weird; I see 1.4 in M-x package-list-packages

0:13 defn: talk to headius about the way that JRuby wraps exceptions and prevents them from getting caught by Java code

0:14 defn: I asked him about it at JRubyConf, and he said he would add a way to turn that off

0:14 underdev: yeah, it's there now. sorry.

0:15 technomancy: cool

0:16 defn: I don't know if it's possible to work around yet, it might take some prodding Charlie

0:16 defn: technomancy: Mr. Nutter, I presume?

0:16 technomancy: that's the one

0:17 defn: cool. well thanks for the headstart. ill fork and start perusing.

0:17 technomancy: defn: I haven't really touched Ruby in over a year (and I wrote clojure-gem half a year ago)

0:17 defn: technomancy: same here, been obsessed with clojure

0:19 technomancy: good luck. I hope it can be a gateway drug to get more rubyists into clojure

0:23 defn: technomancy: i think we already have a hook in

0:24 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

0:24 i think it's only a matter of time

0:25 speaking of which, totally loaded question: is there enough clojure consultancy work out there for small clojure shops to survive?

0:26 I remember hearing S. Halloway's shop was doing something like 30% clojure, but this was a year ago

0:26 ive been thinking about trying to start a small 1-3 person thing

0:26 albino: yeah, but is that because he's steering his customers to use that technology?

0:26 defn: albino: tough to know, stu is a helluva salesman

0:27 a rational salesman whom i quite appreciate

0:27 but a salesman at times, nontheless

0: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

0:27 defn: the web stuff just isn't there with clojure yet which i hope gets remedied

0:27 huge chasm of documentation for compojure

0:28 honestly my chief concern with clojure in general is lack of documentation

0: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-

0:30 defn: it reminds me of _why the lucky stiff's comments on the state of teaching programming

0:30 Raynes: style tutorials. Is anyone opposed to this approach?

0:30 I think people will like it when I'm finished.

0:30 defn: Raynes: i have some weird off-hand suggestions

0:31 Raynes: choose your own adventure REPL

0: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.

0:31 Eh?

0:32 defn: Raynes: im sort of a code romantic, but why the lucky stiff's methods for teaching programming were revolutionary in my eye

0:32 have you ever read the poignant guide?

0: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.

0:33 defn: my general suggestion is: get weird with it. quit being 100% rational. make the tutorial artsy, weird, crazy even.

0:33 it makes it memorable, it makes it interesting

0:33 Raynes: defn: Yes, I've read most of the poignant guide. I never cared for it.

0:34 His stories got odd to the point of being pointless and dragged on and on, eventually I lost interest.

0:34 But that's just me.

0: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

0:34 it would have been worse i think

0:35 Raynes: I don't really think it was all that good. :\

0:35 Maybe I just need to read it again.

0: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

0:35 Raynes: The stories were just a bit too much for my taste.

0:35 defn: he created a book for non-programmers to approach real programming through the narrative

0:36 a memorable narrative that sticks to your brain

0:36 it's the method to his madness that should be examined

0:36 Raynes: I guess. :\

0:36 defn: not the result

0:36 because, honestly, it worked

0:37 do you know how many lines of code were run at the tryruby repl?

0:37 something like 75, 80 million

0: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.

0:38 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.

0:38 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.

0:38 defn: what i think id like to do, if it were my project

0:39 is vary the methods that i present information in

0:39 having a repl on the side, next to a tutorial which gives some recipes

0:39 to facilitate exploration

0:40 for people who wants recipes, they have them, for people who want a bit of adventure, they have the REPL

0: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.

0:40 Just like the other tutorials.

0:40 Anyway, we'll talk about this later. I've got to run.

0:40 defn: Raynes: im rather opinionated on this so i dont mean to sound critical

0:40 Raynes: Bai.

0:41 defn: but just like the other tutorials is what irks me :)

0:41 Raynes: seeya

1: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*

1:22 must be fate

2: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

2: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))

2:52 jColeChanged: somnium: Didn't know about either of those methods, thanks. Also, is there any contains? like function which isn't linear time?

2:56 LauJensen: Morning team

2:56 replaca: morning Lau

3:00 jColeChanged: Hi again LauJensen.

3:11 esj: Salut

3:16 vIkSiT: hmm whats the link to the protocols video again?

3:16 ah here. http://vimeo.com/11236603

3:16 sexpbot: "Clojure 1.2 Protocols on Vimeo"

4: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

4:45 LauJensen: 10.04?

4:45 Raynes: Yes.

4:45 LauJensen: Odd, that what Im running as well

4:46 Raynes: When I was on Hardy, it was really heavy.

4:48 rava: i just have to say, destructuring is my new favorite thing. ever.

4:48 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.

4:51 LauJensen: :)

5: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"

5:12 any idea how this can be fixed? I am setting warn-on-reflection in some files

5:17 rdsr: GOSUB: I think you have to use something like this

5:17 (binding [*warn-on-reflection* true]

5:17 ...)

5:25 Raynes: warn-on-reflection can only be set in the REPL.

5:25 It doesn't make sense elsewhere.

5:26 tomoj: is it really the repl, or just the top thread?

5:27 Raynes: Probably. Someone in here was talking about it a while back.

5:29 tomoj: probably which?

5:30 Raynes: Probably just the top thread.

5:30 I'm not certain.

5: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?

5:32 Raynes: $(get {:key nil} :key "no key in map")

5:32 sexpbot: result:

5:32 Raynes: $(get {:key nil} :ke "no key in map")

5:32 sexpbot: result: no key in map

5:32 Raynes: Eh.

5:32 I still haven't fixed the don't-print-nil bug.

5:33 I've been slacking.

5:33 Damn tryclojure.

5:33 npoektop: The first result: was actually nil. get is what you're looking for.

5:34 npoektop: Raynes, thank you

5:36 GeoffSK: I can't get one source to successfully include another file, both have namespaces. Any examples/tutorials?

5:36 spariev: ,(get {:key nil} :key "no key in map")

5:36 clojurebot: nil

5:37 rava: GeoffSK: checked your classpaths?

5:37 tomoj: GeoffSK: what do you mean "include"?

5:37 you want to call functions from one in the other?

5:37 GeoffSK: sorry i mean :import

5:37 http://pastebin.com/1xGispcD

5:37 Raynes: You want to use require.

5:37 GeoffSK: tomoj: yes.

5:37 tomoj: :import is for java classes

5:37 Raynes: Or use.

5:37 Probably use.

5:38 (:use namespace.of.file)

5: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?

5:38 tomoj: (:use [com.gsk.a :only (aname)])

5:38 or (:require [com.gsk.a :as foo]) will let you call foo/aname

5:39 rava: npoektop: Would a struct make sense for it?

5:39 GeoffSK: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword (b.clj:1)

5: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

5:40 GeoffSK: tomoj: http://pastebin.com/mY5Wp42K

5:41 tomoj sorry changed to symbols.

5:41 rava: ,(defstruct astr :a :b :c)

5:41 clojurebot: DENIED

5:41 rava: or not..

5:41 lol

5: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.

5:41 G0SUB: Raynes, thanks for the tip.

5:42 when I quit slime, the swank server quits too. I remember there was a variable to toggle that behaviour. can anyone remind me?

5:42 GeoffSK: tomoj: thanks. sorted it out.

5:43 G0SUB: :dont-close

5:43 rava: npoektop: http://pastebin.com/bbR8EVJn

5: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.

5:44 G0SUB: That's it, I believe.

5:44 tomoj: apparently pastie has clojure now too

5:44 GeoffSK: raynes: thanks.

5:44 G0SUB: Raynes, yeah, but how do I tell lein to use that option when starting the server?

5:44 rava: GeoffSK: and if you go with gist, and use emacs, there is an emacs extension that ties into gist

5: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?

5:45 rava: http://github.com/defunkt/gist.el

5:45 npoektop: rava, well, it's ok, but still not what i'm looking for. Thank you anyway)

5:45 G0SUB: Raynes, I would appreciate that. thanks.

5:45 rava: npoektop: np, still new to clj so not very helpful yet :)

5:46 Raynes: G0SUB: http://gist.github.com/403600

5:46 GeoffSK: rava: i am using intellij, does emacs do better formatting of clojure?

5:46 G0SUB: Raynes, exactly what I needed. thanks.

5: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

5:47 Raynes: G0SUB: Make sure you have the newest swank-clojure for that. 1.1.0 wont work.

5:47 rava: even tempted to get a coffee machine that has an ethernet jack so i can have emacs send my coffee requests :D

5:47 G0SUB: Raynes, yeah, I have the new one. 1.2.1

5:48 rava: http://www.emacswiki.org/emacs/CoffeeMode

5:48 sexpbot: "EmacsWiki: Coffee Mode"

5:48 GeoffSK: rava: Yep. i am a little used to the DrScheme and its formatting.

5:56 npoektop: how to print a func which i define within a macro? (str #(string? %)) does not print what i want

5:56 i'd like to get "#(string? %)"

5:57 opqdonut: you probably want to use macroexpand-1

5:57 or you need a level of additional quoting

5:57 (str (quote #(string? %)))

5:58 err

5:58 ,(str (quote #(string? %)))

5:58 clojurebot: "(fn* [p1__16631] (string? p1__16631))"

5:58 opqdonut: there :)

5:58 npoektop: opqdonut, cool. thanks

6:00 Chousuke: that doesn't actually print the function though.

6:01 just the form that evaluates to a function

6:01 G0SUB: Raynes, on the repl ,<quit> still quits the server. M-x slime-disconnect doesn't. how do you disconnect usually?

6:01 tomoj: what counts as "actually" printing something?

6:02 Chousuke: tomoj: printing it :P

6:03 tomoj: I think it is important to keep the concept of forms separate from the values they evaluate to

6:03 rava: I'm missing something here..could someone show me usage of (val) ?

6:04 Chousuke: ,(val (first {:k 'v}))

6:04 clojurebot: v

6:04 Fossi: :p

6: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?

6:04 Chousuke: tomoj: no

6:05 rava: groovy, thanks. for some reason I just couldn't grok the doc string's explination.

6:05 Chousuke: or well. yes it would

6:05 tomoj: oh, well, the fn never arises there, so..

6:05 Chousuke: unless you take care to replicate the lexical environment as wel

6:05 l

6:05 tomoj: ah, heh

6:06 if you lose information, it's fake-printing?

6:06 Chousuke: pretty much :P

6:06 tomoj: so e.g. we can't print structs (or can we now? haven't tried lately)

6:06 Chousuke: or pretty-printing, but hm

6:07 in this case it's just that printing forms produces something that looks like a function but is not one

6:08 tomoj: eh

6:08 I think your metaphysics of printing is beyond me :)

6:08 Chousuke: I just don't think printing functions makes sense.

6:09 except the way it's done right now, which is just a "visual token" kind of thing.

6:09 tomoj: I hadn't thought about the lexical env when looking at technomancy's trick

6:09 do there actually exist any implementations of HTCPCP?

6:10 Raynes: G0SUB: I usually exit manually in the terminal.

6:20 rava: Rest easy everyone.

6: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 ?

6:56 Licenser: tomoj: I was told you found some odd behavior in the sandbox?

6:56 tomoj: just a security hole

6:56 Raynes fixed it, I think

6:57 Raynes: No, I didn't.

6:58 tomoj: well, someone who used your github keys did, then

6:58 Licenser: tomoj: can you tell me what it was? :)

6:59 Raynes: tomoj: Nosir.

6:59 tomoj: Nobody has committed anything to clj-sandbox but Heinz in several days.

6:59 Licenser: not true

6:59 Raynes: I've been too busy with tryclojure to work on clj-sandbox.

6:59 Licenser: you removed some fn's from the save list

6:59 tomoj: wat?

6:59 clojurebot: For Jswat: start clojure with -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8888

7:00 tomoj: am I living in some parallel universe?

7:00 Raynes: Oh yeah.

7:00 Oh, I did fix it.

7:00 Licenser: on the 14th

7:00 :P

7:00 Raynes: tomoj: I'm sorry, dude, the last couple of days have been a whirlwind.

7:00 Licenser: tomoj: aren't we all?

7:00 Raynes: ._.

7:00 But yeah, those functions were the problems.

7:01 Licenser: but tomoj thanks for finding the hole!

7:03 tomoj: $(tomoj)

7:03 sexpbot: result: Hello, world!

7:04 tomoj: Raynes: no problem

7:04 Licenser: neat :)

7:05 Raynes: Licenser: When you start working on the def* workaround, you might want to jump to 0.4.0-SNAPSHOT.

7:06 Following semver rules, anyway.

7:06 Licenser: Raynes: when I find any useful workaround I will but I could not dig a way up yet :(

7:07 tomoj: I was perusing the source to see if the set bug caused a vulnerability and accidentally found an unrelated issue

7:08 * tcrayford is nearly done with the first version of an emacs/swank plugin that highlights repetition in code

7:10 tomoj: brilliant

7:10 * tcrayford loves clojure for letting me write stuff like this

7:10 tomoj: that would go a long way towards making my emacs-hating coworkers jealous

7:10 tcrayford: :)

7:10 it needs some more work, but its getting there

7:12 and is seriously quite cool

7:12 uses a reporting thing like clojure-test-mode

7:14 Licenser: tomoj: *nods* You really have put some work in that, thanks amn!

7:14 Chousuke: is this part of the emacs refactoring thing?

7:14 tcrayford: nope

7:15 though the next branch will yoink some code from that

7:17 I should probably extract the helper functions to a common package so both can use them

7:18 tomoj: Licenser: really my first independently discovered exploit.. so it was fun

7:19 Licenser: I can imagine :)

7:20 tomoj: not that I could do anything to your machine except make it print "hello world" when it wasn't supposed to...

7:21 I suppose I could have made sexpbot insult people in #clojure or something

7:21 esj: guys, what's the practice of putting * after some function names. Just a marker that 'this is slightly different' ?

7:21 tcrayford: yeah, that's it usually

7:21 tomoj: sometimes it's a helper function for implementing the *-less version, too, I think

7:22 or some simpler version on which the *-less version expansd

7:22 Chousuke: if used in macros, it's usually the "driver"

7:23 as regular functions, it's often just "variant"

7:23 eg. list, list*

7:24 Licenser: tomoj: well with that you could about do anything

7:24 Chousuke: then there's bound-fn* (function), bound-fn (macro), and fn/fn* (where the latter is an implementation detail)

7:24 Licenser: once you can eval stuff you're free :P

7:25 Raynes: $eval #{1 2 3}

7:25 sexpbot: result: #{1 2 3}

7:25 Raynes: Joy!

7:25 tomoj: but only in clojure-land, the jvm security stuff still protects your box, right?

7:26 Licenser: tomoj: yes but that is bad enough :P

7:26 you could totally mess up stuff

7:30 esj: merci, dudes

7:32 Licenser: Raynes: jvm security does not seem to cover memory :( it seems that there is no real way to do that darn it!

7:39 d2dchat: Is it possible to grab a dependency automatically from a bitbucket repo using lein?

7:39 I'm trying to grab this:

7:39 http://bitbucket.org/jonjlee/riak-java-client/wiki/Home

7:39 sexpbot: "jonjlee / riak-java-client / wiki / Home — bitbucket.org"

7:39 d2dchat: but it keeps erroring out

7:39 tcrayford: iirc it has to be a maven repo

7:40 d2dchat: tcrayford: isn't that a maven repo?

7:43 Raynes: That is a Mercurial repo.

7:52 dnolen: Have you seen the new tryclojure design by any chance?

7:53 dnolen: Raynes: yes, looks good! my only suggestion now would be perhaps some work on the logo.

7:53 Raynes: dnolen: There is no logo. :p

7:54 rsynnott: well, there's a title

7:54 Raynes: dnolen: Do you mean the header? That's the least of my worries right now, but fair enough.

7:54 :p

7:54 The font does render pretty badly for some people.

7:54 I'm going to replace the header with an image in the next version.

7:54 dnolen: Raynes: yeah, the title. but it's really coming together. only a matter of time.

7:55 by "coming together" i mean the look, the functionality is of course fantastic.

7:55 Raynes: I'm happy you like it now. Thank LauJensen for tons of help with CSS and such. <3

7:55 rsynnott: Raynes: do you plan to let people define things at some point?

7:56 Raynes: rsynnott: Ask Licenser. ;) This one is beyond my control.

7:56 rsynnott: Though I suppose it'd be tricky to make that safe

7:57 tcrayford: ,(def a 1)

7:57 clojurebot: DENIED

7:57 Raynes: It's safe. The problem is memory control. You can def something gigantic and blow the world up.

7:57 tcrayford: what are people using as imagehosts atm?

7:58 Raynes: imgur

7:58 rsynnott: Raynes: that's what I mean, yep :)

7:58 presumably some sort of clever sandboxing thing would be needed

7:59 though presumably you could do that in the current one, too, with let

7:59 tcrayford: so, duplication highlighting in emacs: http://i.imgur.com/7Z76F.png

8:00 if you highlight the text and press a key combo you get what var that bit duplicates with

8:02 Licenser: rsynnott: the short answer is yes the longer one, it will take some time

8:03 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

8:03 tomoj: tcrayford: does it do more than look for common substrings?

8:04 tcrayford: it looks for common subsequences atm

8:04 I can fix that problem pretty easily though, as refactoring-mode has a load of stuff about discovering and renaming bindings in a node

8:04 Licenser: tcrayford: ideally variable names should not matter :P but that is a high sandard I know

8:04 tcrayford: they won'

8:04 t

8:05 after I finish the next bit, which I already know how to do

8:05 tomoj: I suppose extract-function is on the way?

8:05 tcrayford: I already did that

8:05 Licenser: :)

8:05 tcrayford: it breaks occasionally though

8:06 but still, useful

8:07 refactoring mode has a load more than that as well, like auto-constructing let-bindings out of a block you have selected

8:07 tomoj: so it seems we can now hack emacs in clojure?

8:07 :D

8:07 tcrayford: :/

8:07 tomoj: s/now/for quite a while/

8:07 sexpbot: :/

8:07 tcrayford: this is done using lein and swank

8:07 tomoj: google fails me for refactoring mode

8:08 tcrayford: http://github.com/tcrayford

8:08 and then somewhere

8:08 tomoj: your clojure-refactoring is the first result

8:08 tcrayford: its scary how easy this stuff is to write

8:08 just manipulating some lists and spitting em back out

8:09 also, refactoring-mode needs some emacs hackery to make it actually work

8:09 * tcrayford should really fix that

8:09 tomoj: do I get it right that refactoring-mode is some external dependency you're using?

8:09 tcrayford: clojure_refactoring is a clojars project that I wrote

8:10 refactoring-mode is just my own bit of (terrible) elisp

8:10 tomoj: ah, I see

8: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

8:11 * tcrayford wonders why all his good programming is done when he's meant to be revising

8:12 tcrayford: I need to license both projects under some liberal license as well, just not sure which one

8:12 tomoj: oh, umbrella is the duplication highlighting, and "refactoring-mode" refers to the stuff in clojure-refactoring-mode.el ?

8:12 tcrayford: yes

8:12 tomoj: I have been awake too long :(

8:12 tcrayford: hah

8:13 do you have any reccomendations on open source licenses?

8:13 rsynnott: tcrayford: MIT/modern BSD are simple

8:14 tcrayford: they look good enough

8:15 I might just use eclipse, seeing as clojure uses it (and a load of other clj projects)

8:15 tomoj: hmm

8:15 I am imagining pretty ridiculous possibilities

8:15 tcrayford: shoot

8:15 I have a lot of free time at the moment, and am all open to ideas

8:16 tomoj: I don't know what "extract local" already does

8:16 but suppose you do it, then you have the opportunity to hit a few extra keys to decide on a possible alternative

8:16 tcrayford: like what?

8:16 tomoj: if there's a let around point already, it defaults to adding the binding there

8:16 tcrayford: currently, you select a sexp inside a defn, and give it a name, then it adds it

8:16 yeah

8:17 tomoj: if not, it creates a let, and you can cycle the scope up and down

8:17 tcrayford: it does that if there's a let at the toplevel

8:17 tomoj: or hit some other key to make it a when-let or whatevel

8:17 tcrayford: cycling the scope is an interesting idea

8:17 tomoj: basically, vanilla clojure-mode : paredit :: paredit :: my dreams

8:18 er, paredit : my dreams

8:18 tcrayford: yeah, roughly gotcha

8:18 tomoj: no longer is the editor just aware of micro-level syntax, it can be aware of macro-level semantics

8:18 tcrayford: it can be now, given some time

8:19 tomoj: yes, very exciting

8:19 and I'm glad it doesn't have to all be written in elisp

8:19 tcrayford: hopefully clojure-in-clojure will add some more possibilities in this directions as well

8:19 tomoj: howso?

8: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

8:21 and the compiler has to do something like that anyway

8:22 (some-fn '(defn a [b] (+ 1 b)) '(+ 1 b)) ;; => #{b}

8:22 ie it'd tell you what bound vars are in a scope

8:22 tomoj: ah, I see

8:22 tcrayford: that'd be much better than searching stuff how I do now

8:23 currently I just look for forms that I *know* are binding forms

8:23 like let, for ,doseq etc

8:23 and then extract the bindings out of them

8:23 but if clojure could give me that, it'd be damn useful

8:24 Licenser: memory is the arch nemesis of sandboxes :(

8:25 chouser: tcrayford: you may be able to use clojure's Compiler class for that.

8:25 tcrayford: as of now?

8:26 chouser: yes

8:26 tcrayford: ooh

8:26 chouser: it's not the prettiest thing, and of course will change with c-c-in-c, but it may be doable.

8:26 and more likely accurate (if it works) than rolling one's own.

8:26 tcrayford: it's still nicer than blind recursion

8:26 yeah

8:27 and it might work with anaphoric macros (which mine won't at all)

8:27 chouser: yeah. The entrypoint you want is (clojure.lang.Compiler/analyze ...)

8:29 ,(clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL nil)

8:29 clojurebot: #<NilExpr clojure.lang.Compiler$NilExpr@927ec1>

8:30 tcrayford: awesome

8:30 cheers

8: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

8:30 tcrayford: yeah

8:31 one of the reasons I wrote refactoring-mode was to learn more about (= code data)

8: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

8:32 tcrayford: I've been meaning to extract some parts of refactoring-mode to a clj-analysis thing

8:32 Licenser: what namespace should I start with?

8:32 npoektop: how to do this: (defmacro testmacro [] `{:a 'a (comment :b 'b here on some condition)})?

8:32 Licenser: top of net.licenser.sandbox

8:33 fn-seq for example

8:33 tcrayford: tree-map is useful

8:33 Licenser: *nods*

8:36 you might also want to look at dot-replace (or something like that) since it is pretty much refactoring

8:37 tcrayford: yeah

8:37 npoektop: i have (defmacro testmacro [] `{~(if true :a) ~(if true ''a)}). How to run that if only once?

8:38 tcrayford: refactoring-mode never does anything with java interop atm

8:38 Licenser: npoektop: ~@ is your friend thre

8:38 (defmacro testmacro [] `{~@(if true [:a ''a])})

8:39 npoektop: ,java.lang.ArrayIndexOutOfBoundsException: 1

8:39 clojurebot: Invalid token: java.lang.ArrayIndexOutOfBoundsException:

8:39 Licenser: tcrayford: I know but replacing the . form is techically refactoring

8:39 npoektop: ,(defmacro testmacro [] `{~@(if true [:a ''a])})

8:39 clojurebot: 1

8:39 npoektop: Licenser, it does not work (

8:39 tcrayford: Licenser: what does expand-and-quote actually do?

8: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?

8:40 Licenser: ~@ you mean?

8:40 clojurebot: @ has nothing to do with whether sth is evaluated or not

8:40 npoektop: Licenser, it says java.lang.ArrayIndexOutOfBoundsException: 1

8:40 Licenser: it takes a list and inserts the element in stead

8:40 not sure what you want to do with ''a so

8:40 tcrayford: ,(quote (quote a))

8:40 clojurebot: (quote a)

8:40 npoektop: ,(defmacro testmacro [] `{~@(if true [:a 'a])})

8:40 clojurebot: 1

8:41 Licenser: (defmacro testmacro [] `(hash-map ~@(if true [:a ''a])))

8:41 tcrayford: (testmacro)

8:41 Licenser: ,(defmacro testmacro [] `(hash-map ~@(if true [:a ''a])))

8:41 clojurebot: DENIED

8:41 Licenser: can'T do it here

8: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)))

8:41 clojurebot: java.lang.IllegalArgumentException: No matching field found: expr for class clojure.lang.Compiler$FnExpr

8:42 chouser: bah

8:42 Licenser: tcrayford: look at the hash-map version

8:42 it works

8:42 tcrayford: chouser: that only fails here because of the dot expansion clj-sandbox does

8:42 man thanks

8:42 emh: ah. ofc, java.lang.Number

8:42 tcrayford: *many

8:43 if I'm ever ~wherever-you-live I owe you a beer or two

8:43 Licenser: I hate bear :P and don't worry ;)

8:43 tomoj: hmm

8:43 chouser: but note you get all the macro-generated locals that users rarely see

8:43 tomoj: ,(->> (clojure.lang.Compiler/analyze clojure.lang.Compiler$C/EVAL '(let [a 3 b 4] a)) .fexpr .methods first .locals keys (map #(.sym %)))

8:43 clojurebot: (b a fn__16708)

8:43 tcrayford: yeah, which isn't good

8:43 Licenser: We all would be poor from buying all the beer we own otheres here

8:43 tomoj: oh, I missed your better attempt

8:43 chouser: romanb: nice!

8:43 npoektop: Licenser, thanks!

8:43 chouser: er

8:43 tomoj: nice!

8: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

8:44 save for people like chou* who know everything

8:44 tomoj: no idea why I have a FnExpr..

8:45 but I wonder how we point to a specific part of a form and ask for only the locals there

8:45 Licenser: anyway see you later people I've to return a case that is broken

8:45 tcrayford: yeah

8:45 that's a harder part

8:45 tomoj: maybe you can just trim the form so that it's only the path to the leaf you want?

8:45 tcrayford: I can definitely do that

8:45 it currently looks like this:

8:45 it looks like this currently:

8:45 tomoj: would that give good results, though, I wonder?

8:46 tcrayford: (defn find-bindings-above-node

8:46 "Returns all binding forms above expr in node."

8:46 ([node expr] (find-bindings-above-node node expr []))

8:46 ([node expr bnd-syms]

8:46 (unique-vec

8:46 (flatten

8:46 (if (more-than-one seq? node)

8:46 (map #(find-bindings-above-node % expr bnd-syms)

8:46 (filter #(and (seq? %)

8:46 (rec-contains? % expr)) node))

8:46 (if (last-binding-form? node)

8:46 (add-binding-form node bnd-syms)

8:46 (if (binding-node? node)

8:46 (find-bindings-above-node (rest node)

8:46 expr

8:46 (add-binding-form node bnd-syms))

8:46 (if (seq? (first node))

8:46 (find-bindings-above-node (first node) expr bnd-syms)

8:46 (find-bindings-above-node (rest node) expr bnd-syms)))))))))

8:46 so fixing that'd be nice

8:47 (there's lots of stuff in there that relies on other functions, but its still horrible)

8:48 thankfully I have tests for a lot of stuff, so I can rework it pretty safely

8:48 tomoj: Compiler.java is...

8:49 terrifying

8:49 chouser: doomed

8:49 tcrayford: I've tried reading the clojure source before

8:49 tomoj: how can such a beautiful language be built from something so ugly?

8:49 tcrayford: its pretty difficult

8:49 heh

8:49 have you seen the source for arc?

8:49 Licenser: tcrayford: hint: github

8:49 tomoj: nope

8:49 tcrayford: its really very nice

8:49 given that its all in scheme/arc

8:50 yeah Licenser, I realised that was a stupid thing to paste after I did it

8:50 Licenser: :P

8:50 * Licenser hands a cookie and is gone now

8:50 tcrayford: http://github.com/tcrayford/clojure-refactoring/blob/master/src/clojure_refactoring/core.clj#L89

8:51 its still *really* ugly

8:51 tomoj: also I have code that can do that trimming out already

8:52 tomoj: cool

8:52 tcrayford: just a simple case of postwalk with recursive-contains?

8:53 (I think that fn is actually called rec-contains currently, but eh)

8:55 tomoj: chouser: that was 1.1?

8:55 doesn't work in 1.2.. this will be a painful approach, I think

8:55 chouser: tomoj: my example? 1.2-ish

8:55 hm.

8:55 tomoj: Compiler's interface might change within versions, too, I bet..

8:55 oh

8:55 chouser: yeah

8:55 tomoj: your example was specific to the kind of form you passed, I guess?

8:56 chouser: yeah, it assumes the outer is a fn

8:56 you can generally write a fn around a user-supplied expr

8:56 tomoj: yeah

9:00 tcrayford: I'm off now, cheers for the help you two

9: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

9:03 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 dmiller2718: I think you should be able to do the interview just fine

10:20 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 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 rhickey: I'll have to go remind myself of why clojure is important and fun.

10:30 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 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 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 ,(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 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 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 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 I'll take a look

12:01 stuarthalloway: ...assuming its memory footprint is similar to my laptop's

12:01 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 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 ... hold onto its class

12:02 ... which would hold its classloader

12:02 ... 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 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 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 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 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 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 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 * stuarthalloway back in 20 min

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 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 (expressions that begin with def something

12:47 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 (use-fixtures :once #((def a 1) (%) (def a nil)))

12:48 you can't use let though, has to be def (I think)

12:49 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 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 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 ((def c 8) (def d 8))

12:52 is what I get with macroexpansion

12:52 so you end up trying to call (8 8)

12:52 and hence the error

12:52 tomoj: you tried nested fns yet?

12:52 tomoj: yeah, no luck

12:53 tcrayford: :(

12:53 is there any way around this?

12:53 (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 I couldn't see any methods that'd lead to another expr (using show on defexpr)

12:55 this might be much nicer once c-in-c comes around :/

12:57 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 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 fails

13:01 * tcrayford fails

13:01 tcrayford: yeah

13:01 I can't figure them out

13:01 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 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 `defrecord `defmacro `deftype `defprotocol} 'defn)

13:32 clojurebot: EOF while reading

13:32 tcrayford: ,(#{`def `defn `defstruct

13:32 `defrecord `defmacro `deftype `defprotocol} 'defn)

13:32 clojurebot: EOF while reading

13:32 tcrayford: heh

13:33 that works locally

13:33 (it returns nil though, which puzzles me)

13:33 chouser: you're splitting the line

13:33 ,(#{`def `defn `defstruct `defrecord `defmacro `deftype `defprotocol} 'defn)

13:33 clojurebot: DENIED

13:33 * chouser sighs

13:34 tcrayford: locally that shouln't matter though right?

13:34 I still get a nil even if I don't split the line

13:34 chouser: right

13:35 ,[`map 'map]

13:35 clojurebot: [clojure.core/map map]

13:35 chouser: ,(= `map 'map)

13:35 clojurebot: false

13:35 tcrayford: hah

13:35 had them the wrong way round

13:35 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 was trying to use that to get around the whole not knowing the names for getting at the exprs of a defn

13:38 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 I can't figure out getting at the vars from a defn node though

13:39 using the compiler anyway

13:41 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 '(defn a [] 1)

13:43 (analyze)

13:43 (.init)

13:43 (.target)

13:43 (.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 (.locals)

13:44 (keys)

13:44 (map #(.sym %)))

13:44 dang

13:44 ,(->> '(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 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 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 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 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 +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 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 that means a lifetime that is extended by every following request

13:50 chouser: are you sure that's true?

13:50 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 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 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 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 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 :(

13:55 That is indeed an option, but it would be slow.

13:55 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 but then that would be bad in some way since you don#t expect it but you could make a flag

13:57 *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 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 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 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 chouser: I'll try a version of sandbox that tears down the namespace after each run and save everyting successfull

14:05 but that will cause the sandbox to time out real quick :(

14:05 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 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 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 :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 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 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 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 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 Cosby was the first sitcom that I have any comprehensive memory of.

14:38 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 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 this is using aquamacs, btw

14:44 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 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 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 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 kk, I'll do clean

14:59 ok, after that it seems to have pulled the same jar

14:59 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 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 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 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 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 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 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 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 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 [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 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 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 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 first time after 5/7

15:29 bmason: hehe

15:29 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 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 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 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 and atoms clearly exist in Clojure

15:33 never mind ;)

15:33 hiredman: is a long a scalar on 32 bit machines?

15:33 * tcrayford glances at the Joyce of Clojure's chapter titles ("On Scalars")

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 but it doesn't really work

15:35 hiredman: if symbols are implemented as records via defcrecord, are they still "scalars" ?

15:36 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 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 * alexyk prints books by copying them to the kindle

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 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 so yes, hmm

15:44 tcrayford: arc calls them "atoms" :P

15:44 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 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 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 ~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 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 ugh .. sorry, I guess the repl doesn't like multiline input

16:07 that was my problem

16:08 * tcrayford debates writing a transmogrify monad

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 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 I have no idea why just loading that fn could cause a problem

16:20 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 ,(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 by "fastest" are you talking developer ease or execution speed

16:30 alexyk: stuarthalloway_: true... but say I want to?

16:30 stuarthalloway_: execution

16:30 phobbs: yes, using ELPA

16:30 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 or grilled

16:35 alexyk: I destructure as [x & tail] and would glue back x*, the modified x, to tail

16:36 * alexyk got a giant box of baked dansk cookies yesterday

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 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 alexyk: you don't need to construct a whole new vector that way.

16:42 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 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 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 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 cancel-timer: Invalid timer" when I try to install swank-clojure from elpa

17:25 this is from a fresh emacs-starter-kit installation

17:27 * arohner would really like a built-in fn to create a defrecord instance from a map

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 that breaks for me here

17:39 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 ,(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 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 ,(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 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 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 :)

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 unless they did already

18:01 KirinDave: They did.

18:01 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 alexyk: Yes.

18:02 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 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 They got shut down on that?

18:04 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 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 and double-columns suck on DX

18:06 KirinDave: Yes, it lacks the resolution.

18:07 I was very disappointed with my DX.

18:07 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 for books it's OK though

18:07 KirinDave: It's also just lacking in resolution.

18:07 And for programming books with code samples it often fails, badly.

18:07 Frequently the syntax highlight gets reproduced as illegibility on the DX.

18:08 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 Stu's book is OK in mobi

18:09 KirinDave: yes. My kindle 2 I still use, periodically.

18:09 So are there any clojure luminaries who are NOT currently wrapped up in book authoring?

18:09 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 That's to be expected.

18:10 alexyk: KirinDave: but specifically? :)

18:10 KirinDave: Specifically in this case, a much better job.

18:10 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 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 gotta compare with 2 red-eye flights, one device all the way each way

18:12 a pragprog book each way :)

18:12 KirinDave: alexyk: I stare at a computer monitor all day.

18:13 Why would looking at an ipad tire my eyes anymore than my led-backlit monitor?

18:14 I am catching up on the clojure mailing list after a month or so of neglect

18:14 Man, there are some truly painful threads on there.

18:14 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 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 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 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 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 there. I got it, finally

19:49 hiredman: ,*clojure-version*

19:49 hmmm

19:50 ping?

19:51 ping?

19:51 _mst: pong!

19:51 hiredman: ,*clojure-version*

19:51 ,*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 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 namely two repl prompts are printed with no trailing newline, then control returns to the shell

20:29 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 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 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 No, doesn't work

20:51 mmarczyk: :-(

20:52 no idea then

20:52 though you should probably use something like Leiningen to set up a project-specific cp for you anyway

20:52 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 asking in connection with this SO question:

22:25 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 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 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 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 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 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 in the recur, would you have to assign x and y?

22:40 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 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 alexyk: if it's sth like (next ...), use :as xs in the destructuring vector

22:44 ,(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 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 :-)

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 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 * alexyk will make a point of showing up periodically and chanting that map is lazy :)

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 (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 (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 javax.servlet.Servlet is just an interface that comes with the JRE, right? Not a particular implementation?

23:00 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 chouser: ok, got it now: the ^void is needed if ^ServletRequest is provided (for example)

23:00 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 :-)

23:01 mmarczyk: fair enough :-)

23:01 however, there's *nothing* in deftype's docs to suggest this behaviour, IMO

23:01 it says that type hints should be reserved for disambiguation

23:02 so presumably you should be able to use them some places and not others...

23:02 ok, here's my semi-official complaint about the docs then ;-)

23:02 thanks a lot for the answer

23:02 care to post it on SO?

23:04 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 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 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 chouser: not that I'm really complaining, this is unreleased stuff of course...

23:11 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 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 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 alexyk: (depending on whether resizing happens etc.)

23:21 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 alexyk: ok, in that case maybe do a (into (sorted-map) ...) or sth similar when deserialising

23:24 alexyk: mmarczyk: yeah

23:24 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 mmarczyk: jiraph is a clojure serialization with tokyo cabinet on github

23:34 and google protocol buffers

23:34 mmarczyk: alexyk: googled for it already :-)

Logging service provided by n01se.net