#clojure log - Dec 06 2010

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

0:00 Derander: pdk: was it any good?

0:00 I've been wanting to learn ocaml

0:00 pdk: the guy who wrote purely functional data structures insisted on using standard ml and haskell for his code examples

0:00 i need to pick it up again, i stopped around the basic chapter 2-3 stuff

0:00 yknow how it's always

0:00 "this is what a number looks like

0:00 p_l|home: pdk: technically, both are from the same time, as the work on LoL started as expansion of "Casting SPELs in Lisp", a contemporary to appearance of _why's guide

0:00 pdk: "this is 2+2

0:01 though elementary standard ml makes it a big point to explain why stuff is the way it is

0:01 so it might illuminate things a bit more for a cs student than your average introductory programming language book

0:01 one goofy thing about it though

0:02 these guys use ~ for negative numbers OH LORDY

0:02 Derander: haha

0:02 that's unique

0:02 pdk: i think i may have heard of casting spels like once

0:02 not really ringin a bell though

0:03 reading kindle on pc is sorta okay

0:03 wyrg: I have a doubt about class proxies.

0:03 pdk: though i hate how it doesn't remember all your viewing options and it has this bug

0:03 p_l|home: pdk: LoL was supposed to be an expansion on it, and some people might have encountered old "republic of Haskell" comic

0:03 wyrg: I'm trying to proxy java.awt.image.ImageObserver.imageUpdate for the class JPanel.

0:03 pdk: where it goes "saving last read position" and the taskbar icon for kindle in 7 keeps flashing for ages

0:03 yknow how in 7 with aero

0:03 wyrg: Do I have to use proxy-super?

0:03 pdk: it can show you progress bars in the taskbar

0:04 since it seems to say "saving last read position" nonstop get ready to see that thing flash a lot

0:04 p_l|home: pdk: Kindle is however quite old format (it's just a single-bit flipped from the old Mobipocket format, with Amazon purposely acting like a dick to everyone who invested in Mobipocket ebooks)

0:04 pdk: does lol still have all the intended stuff from when it was a spels sequel

0:05 so you could wager someone went and cracked it

0:05 cky: pdk: It's already done.

0:05 wyrg: Anyway, the paste is in: http://codepad.org/fT6wHZhZ

0:05 cky: pdk: Google for "I love cabbages".

0:05 You'll know what to do.

0:06 p_l|home: pdk: in case of LoL, it's IMHO better to find the original PDF release of LoL rather than the kindle one :)

0:06 wyrg: I want to redefine imageUpdate, but it doesn't seem to work.

0:06 pdk: i'm getting the down low on phreaking in #clojure folks

0:06 will the pdf release be free or do i buy it off the publisher

0:06 p_l|home: pdk: it's available from nostarch press

0:06 without DRM, iirc

0:07 * p_l|home is not going to help anyone find unofficial downloads, the only copies I distributed were to people who are waiting for the paper copy to arrive :P

0:07 pdk: how much does the pdf run

0:08 cky: pdk: It would have been a lot cheaper during the O'Reilly Cyber Monday sale. :-P (Which covered No Starch titles.)

0:08 pdk: hm first thing i get on google is a link to the spels pdf

0:08 is that still worth reading if you get lol

0:08 hm

0:08 $25 is ok

0:08 p_l|home: pdk: Casting SPELs is very short tutorial

0:08 pdk: naturally amazon tacks on another $5

0:08 so it tells me nothing lol won't

0:11 does it touch on popular libraries for writing games in cl

0:11 p_l|home: pdk: afaik no, though the only really popular library is lispbuilder-sdl

0:11 pdk: actually what level of game does it stop at as well, does it touch on some 3d stuff a bit or am i basically gonna make NES zelda after reading the book

0:11 p_l|home: (all the rest are common libs used in many projects)

0:11 wyrg: Well, thank you anyway.

0:11 pdk: hmmm

0:12 actually where does clisp stand on the totem pole of cl implementations

0:12 p_l|home: pdk: it is more in the style of '80s when it comes to games

0:12 pdk: i know folks are like "OMG SBCL PLEASE" but clisp is definitely the most convenient windows option

0:12 p_l|home: as for CLISP... well, it's easy to get running, but I don't recommend it even on windows

0:12 pdk: if the headway is there to take knowledge from other sources and expand to more modern/ambitious stuff then hey

0:13 bit annoying how they don't keep up to date windows sbcl builds

0:13 p_l|home: pdk: it uses simple games like the ones kids would write on their micros to describe programming concepts, including functional programming

0:13 pdk: especially if you wanna redistribute unless it's that good at making windows binaries out of your programs

0:13 cky: I mean to see if it's possible to use Debian's mingw packages to make Windows SBCL binaries.

0:13 slyrus: I think the idea with SBCL is that you're s'posta build your own

0:13 pdk: there was some stupid trick i had to google to make windows binaries of programs in clisp

0:13 p_l|home: pdk: for Windows the stable solution is CCL

0:13 pdk: and it'd be like

0:13 multiple megs for a hello world app

0:13 p_l|home: SBCL/win32 isn't supported

0:13 pdk: and i was like "what is this shit"

0:14 p_l|home: pdk: if you try to distribute a combined executable of a clojure "hello, world", I suspect you'd get similar size :>

0:14 slyrus: heh

0:14 pdk: ccl turns up a bunch of odd results, is there a site for the one you're referring to

0:14 well yeah

0:14 cky: www.clozure.com, probably.

0:14 slyrus: p_l|home: don't forget about the du -sk ~/.m2

0:14 p_l|home: 111MB after decompressing is what Java 6 32bit takes on linux :> (that's JRE, not JDK)

0:15 slyrus: aka "that thingy that tries to make a mirror of internet before compiling hello world"?

0:15 pdk: is this thing available open source/freeware without crippling

0:15 p_l|home: pdk: CCL is licensed similarly to LGPL (with some extra clauses to make it less restrictive), SBCL is public domain (mostly)

0:16 slyrus: p_l|home: http://slyrus.github.com/2010/12/05/maven-madness.html

0:16 pdk: that's badass

0:17 p_l|home: pdk: ECL provides quite small binaries and I didn't have many problems getting it to run on win64 some time ago, but I heard it regressed a little. It has the problem that it's much worse for developement.

0:17 Main issue with CLISP is its poor SLIME integration

0:17 pdk: i should try learning that stuff again

0:17 actually see what goes down with incremental dev/modifying code on the fly

0:19 p_l|home: slyrus: ... that dependency list looked quite sane compared to what I got trying to compile a maven-only java Emacs mode :>

0:35 technomancy: p_l|home: for the record the kindle can read mobipocket books just fine

0:35 that's all I use mine for

0:41 I wonder if they bumped the next clojure release to 2.0 instead of 1.3 (since it's rather backwards-incompatible) if it would be a good time to make :use default to :only [] instead of bringing in everything and deprecate :require.

0:42 it seems like that would be the simplest way to clean up the mess

0:42 jk_: slyrus: all that maven "madness" is the result of following all the transitive dependencies. getting that right manually, without maven, is the true way to madness

0:43 pdk: did you guys say land of lisp has a clojure chapter

0:45 p_l|home: technomancy: not everyone is interested in getting a kindle reader, though, and the installable variants aren't available on many platforms

0:45 Symbian S60 with a 2" screen had been my best reading platform, actually :D

0:46 slyrus: jk_: no, a dependency list that long is madness, if you ask me

0:46 technomancy: p_l|home: ok, I was just reacting to your statement that Amazon was somehow being a dick by dropping support

0:46 p_l|home: pdk: it at least shows it in appendix... can't find a whole chapter, so I guess it got dropped

0:47 technomancy: the hardware department is distinct from the business of selling DRM-infected content

0:47 jk_: slyrus: if it's real, you have no choice. and the libraries are the one declaring their dependencies on other libraries. welcome to the world of code sharing

0:47 slyrus: it's not a function of maven, it's a function of those libraries using other libraries

0:47 p_l|home: technomancy: there was a nice overview of the whole thing sometime ago, and how amazon's practices effect mobipocket market

0:48 jk_: slyrus: if you didn't have maven sorting out the transitive dependencies for you, you'd basically just be lucky if you got it to work manually downloading who knows what version of those dependencies when you found missing classes at run-time

0:50 slyrus: jk_: yeah, yeah... I hear what you're saying and the pom.xml for clojure-contrib looks reasonable, but, next thing you know I'm downloading 248 different pom and jar files. where is all that crap coming from?

0:50 jk_: slyrus: besides, the beauty of using maven is that the libs are only downloaded one time and cached in your local repo. all projects resolving to the same version of that dependency just point to the cache. no more storing jars with every project in your source repo

0:51 slyrus: jk_: I never said the alternative was storing jars with every project in your source repo

0:51 jk_: slyrus: sure, a lot of those jars are for the maven infrastructure itself but they will only ever be downloaded just one time

0:52 slyrus: it's certainly not perfect, but look at how ASDF2 (for common lisp) handles it's dependencies for another perspective on the problem

0:52 ok, but, still, why do I need all this crap even once? my view of a dependency tracking system is that it should be pretty lightweight and self-contained.

0:52 jk_: slyrus: well.. if you do end up dl'ing 248 different jars, it's the fault of the libs themselves being dependent on other libs, or at least declaring themselves to be so

0:53 slyrus: I get that this isn't the commonly held perception in the java world

0:53 jk_: maven is just making sure they are available and resolved properly

0:54 slyrus: when you start working on a lot of large java-based apps, believe me, it's a LOT easier managing those dependencies with maven than the alternative (no good ones)

0:56 p_l|home: the dependency hell partially comes from lack of easily-composable code IMHO

0:57 jk_: slyrus: a lot of those maven specific jars are for doing more than just tracking deps though, i'll grant you that. so no, strictly speaking you don't need all of that stuff even once. however, it's over now - you have the files in your cache :)

0:59 p_l|home: it's more from version-specific dependencies. if ring makes some breaking changes in its API's that compojure wants to use, compojure has to bump its version and declare a dependency on the new version. if you were doing that manually and just upgraded your ring jar, you'd break compojure (for example)

0:59 and yet, they compose just fine from a functional language perspective (as long as you have the right version of the api!)

1:00 p_l|home: jk_: yeah, I recall suggesting separate versioning information for library and API in ASDF

1:00 to partially avoid such situations

1:04 (as well as better :depends-on that would support versioned deps.)

1:05 slyrus: jk_: oh, I have no intention of working on large java-based apps :)

1:05 technomancy: oh man it's a good thing cemerick isn't here

1:05 he'd have a fit seeing that people are even debating this

1:05 jk_: slyrus: well if you're gonna be doing clojure, you kinda are :-p

1:05 slyrus: that's an implementation detail

1:05 you could make the same argument for ABCL, but I wouldn't

1:06 * slyrus longs for a java-free clojure

1:06 jk_: clojure is designed to have tight integration with java though, and really nice, easy use of java directly (and all those zillions of libs)

1:06 slyrus: (and, no, don't suggest CLR)

1:06 yeah, yeah, yeah :)

1:08 jk_: slyrus: why not just use a different lisp rather than deal with the java stuff that clojure brings with it? i'm just curious.

1:08 slyrus: I like what rhickey has done with the language

1:09 cleaning up the ANSI crap, destructuring, immutable data, lazy-seqs, etc...

1:09 cleaning up isn't the phrase I was looking for

1:09 ignoring, perhaps

1:09 starting fresh

1:10 technomancy: deprecating =)

1:10 slyrus: yeah, for some things

1:10 and keeping the good stuff

1:10 technomancy: GCing is probably the best way to put it

1:10 that's a pretty good tag line, actually

1:11 Clojure: Lisp, garbage collected.

1:11 * p_l|home admits to being put out by frivolent use of []

1:11 thunk: nice

1:11 p_l|home: (and {})

1:12 seen ))))]))])) once and got a BURN MAIM KILL response ;-)

1:12 though I guess it's a matter of being used to

1:12 technomancy: wait, you actually see that?

1:12 slyrus: p_l|home: I dunno, I've kinda gotten used to it

1:13 try looking at some (setf (gethash ...) ...) forms you start to appreciate clojure's syntactic sugar

1:13 technomancy: it's just fnords to me

1:13 slyrus: not to mention the nice treatment of lists, vectors, maps, seqs, etc...

1:13 thunk: just what?

1:13 p_l|home: slyrus: I'll admit gethash isn't too nice, but SETF machinery is very :)

1:14 (even better on a lisp with locatives)

1:14 slyrus: p_l|home: that may be true, but I'm willing to try things out rhickey's way with immutable data for a while and see where that gets us

1:14 technomancy: thunk: http://en.wikipedia.org/wiki/Fnord

1:14 thunk: "<technomancy> it's just to me"

1:14 slyrus: my brain thinks a bit differently writing clojure code than it does writing CL code

1:14 thunk: :)

1:14 technomancy: thunk: oh, oops. =)

1:21 jk_: slyrus: i'm hoping to slip in some clojure code into a project or two at work. add the plugins to the POM on some big java project, add an out of the way clojure src dir and i'm on my way!

1:36 ismarc: ok, I hope someone can help steer me in the right direction here. I'm using lein test (along with clojure.test) in order to run tests over my code, and it takes a good 30 seconds before it even begins running the different tests each time

1:37 now, I really don't think that whole time is just the JVM (but have no basis for that belief). I do have some potentially intensive to set up fixtures for each suite of tests. Does it set the fixtures up when it goes to run the tests for a namespace, or does it set all the fixtures up at the beginning?

1:39 dmead: hi channel

1:39 is there a way in eclipse to get the line number of where an exception was thrown?

1:39 slyrus: jk_: ok, more power to you. clojure allows me to slip in some java libraries in an otherwise lispy way of doing things (e.g. CDK, the chemistry development kit)

1:40 dmead: i keep getting "Don't know how to create ISeq from: clojure.lang.Symbol (repl-1:5)"

1:40 and it won't show a line number

1:45 anyone?

1:45 clojurebot: Please do not ask if anyone uses, knows, is good with, can help you with <some program or library>. Instead, ask your real question and someone will answer if they can help.

1:45 dmead: xD

1:47 ismarc: dmead: So, I have no idea about eclipse, but when I get exceptions, they look like: java.lang.Exception: No such namespace: str-utils (user.clj:29)

1:47 where user.clj is my own source file and it's line 29

1:48 occasionally I have to look further down the stack trace to find where my code initiated the problem, though

1:48 rather than it being obvious and on the first line

1:48 dmead: i'm not getting a stack track :s

1:48 cky: That reminds me...whenever I see exception messages that say "java.lang.Exception", I wish that the constructors for Throwable, Error, Exception, and RuntimeException were all protected.

1:50 ismarc: dmead: Well, unfortunately we have exhausted my knowledge in this area :)

1:51 raek: if

1:52 dmead: if you require the file from the repl, I think you should get line numbers

1:54 I would check the defn forms, especially the ordering of the first arguments

1:55 dmead: check for what?

1:56 raek: something like (defn foo symbol-instead-of-arglist ...) might cause it

1:57 dmead: i've got defn blah blah [args like this]

1:57 in square brackets

1:59 raek: two symbols between the 'defn' and the square brackets?

1:59 dmead: nope

1:59 just the function name

1:59 defn blah [a b c d..]

2:00 so i've defined my namespace at the top of this file

2:00 do i need to do anything else besides (ns somename)

2:00 ?

2:15 raek: no

2:16 dmead: could you paste the code on gist.github.com?

2:16 dmead: also, what IDE do you use?

2:16 dmead: eclipse

2:16 sure, sec

2:17 raek, https://gist.github.com/729976

2:17 replaca: Q: is there a preferred form for (nil? (seq foo)) to test for nil-or-empty?

2:17 it's late, but I feel like there is

2:18 dmead: raek, try calling (match-and-sub '(4 5 6) '(xs) '(1 2 3 xs))

2:18 raek, it's erring on the second cond clause in mreplace but i can't tell exactly where

2:18 raek: dmead: you don't get the exception when you try to eval the definitions, but when you call the function?

2:19 dmead: exactly

2:19 clizzin: Is there a function like some but which returns the item for which the predicate was true instead of the result of the predicate itself?

2:19 dmead: it's only on execution for the first cond clause of mreplace

2:22 raek: dmead: you should be able to get a more detailed stack trace than only one line

2:23 maybe you have to look at the stacktrace for the cause of the exception, but the info should be there somewhere

2:23 replaca: clizzin: filter

2:24 zztr: i'm getting started with emacs/paredit and i'm liking it a lot except i'm fighting the indenter all the time

2:24 raek: dmead: does lookup return a sequence?

2:24 zztr: anyone know a quick fix for making the auto-indentation sane?

2:24 cky: zztr: It's already sane. What are you trying to fight?

2:25 dmead: raek, no i guess it' just a list

2:25 clizzin: replaca: well, that would return a seq, so i would have to use first to get the first elem i want, right?

2:25 zztr: cky: it's all over the place. like i start a let block and suddenly my code is in the middle of the page

2:25 raek: lists are sequences...

2:26 zztr: cky: i just want two spaces per indent strictly

2:26 dmead: raek, (list ..) and (seq ...) are identical?

2:27 raek: no, lists implements the sequence interface

2:27 dmead: ah

2:27 raek: ,(append 'foo '(1 2 3))

2:27 clojurebot: java.lang.Exception: Unable to resolve symbol: append in this context

2:27 cky: zztr: That's not in keeping with the standard indentation style, which uses two spaces in some contexts only. In other contexts, it's supposed to line up with the last subform on the previous line.

2:28 raek: ,(concat 'foo '(1 2 3))

2:28 clojurebot: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol

2:28 cky: zztr: If you find your code being "in the middle of the line" all the time, you may need to restructure your code.

2:28 raek: dmead: I think your code results in something like that

2:29 zztr: cky: ok i need to paste you something

2:29 raek: also, null = nil?, var-p = symbol?, append = concat

2:29 dmead: null is defined in the file

2:30 yea at some point it's tryng to concat a non list to a list

2:30 raek: also, when doing recursive tail calls, use 'recur' rather than the function name

2:30 dmead: kk

2:30 raek: the stack trace should tell you where that call is made

2:31 unfortunately, I'm not accustomed to clojure + the eclipse IDE

2:31 dmead: :S

2:31 i still can't get to the ST

2:32 zztr: http://dark-code.bulix.org/qpqd9d-78919

2:32 raek: try (.printStackTrace *e) in the repl

2:32 cky: *reads*

2:33 dmead: that works

2:33 thanks

2:33 cky: zztr: Why would you put a newline right after the "["?

2:33 That's just...unusual.

2:33 ismarc: zztr: use ;; for the comment

2:34 zztr: I fought with that forever, it tries to line up ; with something, but I'm not sure what

2:34 cky: ismarc: end-of-line comments should use ;, not ;;.

2:34 zztr: why not use whitespace to separate comments to their own line

2:35 ismarc: cky: the comment he has on there isn't an end of line comment, it's on it's own line for some reason

2:35 cky: ismarc: I see. Fair enough.

2:35 zztr: i was using jedit before and was pretty happy with just having two spaces for every indent

2:35 it's a long comment, so it gets its own line...

2:35 cky: zztr: Still, putting a newline after an opening ( or [ is just wrong.

2:36 zztr: cky: why?

2:36 cky: You should either move the ( or [ to a new line, or at least have one opening form before the new line.

2:37 zztr: sounds like no one hates this as much as i do, or no one knows how to turn off this alignment-with-nothing behavior...

2:37 cky: I can't speak about Clojure specifically, but in Lisp, code is about the indentation, not about the brackets. Having the opening brackets at ends of lines, or closing brackets at the start of lines, makes the brackets stand out more than they should.

2:38 tomoj: indeed

2:38 cky: zztr: No one formats code the way you do, that's why.

2:38 tomoj: I have never seen a ( or [ at the end of a line and would get rid of it if I saw it

2:38 cky: tomoj: Agree.

2:39 zztr: To experienced Lispers, the brackets are _invisible_.

2:39 zztr: do you guys put your comments *after* your let declarations then?

2:39 cky: Do new variable bindings even need comments?

2:39 ismarc: Even when working with C++, I see people move the parenthesis/brackets to the next line as well rather than leaving them bare (now '{' is different, though)

2:39 cky: Usually a doc comment at the start of a function should suffice.

2:40 ismarc: Indeed.

2:40 zztr: i like putting more text in the middle, myself

2:40 tomoj: comments at the end of a form are an acceptable exception to the "no bare closing parens at the end of a line" rule

2:40 * cky prefers to use comments only when they're useful. And in most cases, when your code is clear, the only useful place for comments is doc comments.

2:40 tomoj: not opening parens though, in actual style, I think

2:41 cky: tomoj: I still prefer to avoid bare closing brackets, in general, because they're still too visible that way.

2:41 tomoj: http://mumble.net/~campbell/scheme/style.txt

2:41 talios: 'lo cky

2:42 cky: tomoj: Indeed. :-D

2:42 talios: Heya!

2:42 tomoj: you can also use comment to get around it

2:43 huh

2:43 there they say it is acceptable to have a bare opening bracket before a list

2:43 for ease of version control of long lists

2:43 (every entry looks the same)

2:44 * talios sniggers at "parentheses grow lonely" :)

2:45 cky: tomoj: That's a very limited exception, though. And I don't think it applies to the bindings list of a let.

2:45 talios: :-)

2:45 tomoj: cky: right

2:46 cky: talios: Riastradh has quite a sense of humour. :-P

2:46 talios: "If a file exceeds five hundred twelve lines, begin to consider splitting it into multiple files." 5-12? Not 500? :)

2:47 Darn byte lenghts

2:47 cky: talios: What self-respecting geek works with round decimal numbers rather than round hex numbers? :-P

2:48 talios: those who need the computer to do their calcs for them in the first place.

2:48 cky: Hah.

2:48 replaca: clizzin: yes, that's correct

2:48 ismarc: anyone mind critiquing some code of mine? I hadn't written any lisp (or FP) code in like, 3+ years, and decided to pick up Clojure like 60 hours ago and implemented a web service to run on GAE this weekend

2:49 so I'd like to get some feedback prior to moving further forward on other aspects for what I might be doing oddly

2:49 cky: GAE supports Clojure? I can finally hope that I can make SISC work on GAE too, then. :-P

2:49 * cky 's loyalties are showing a little. :-P

2:50 ismarc: cky: Someone made appengine-magic that provides a nice wrapper for the Java calls

2:50 * talios ponders flagging actually 'editing' this podcast and just slapping the bumper on it and posting away.

2:50 cky: talios: Hahahahaha.

2:50 ismarc: Nice.

2:51 talios: cky: thankfully on this show we don't wander too much into tangents, so no real editing required

2:51 ismarc: cky: I wanted to get into FP again, had an idea for a web service and wanted to use GAE since it's familiar to me and removes sysadmin needs

2:51 * talios is still amused that a) our listeners came up with a drinking game based on the podcast, but b) one of them implemented it as a webapp

2:51 cky: talios: Make it all uncensored, like the US diplomatic cables! :-P

2:51 talios: jvmleaks!

2:52 cky: Hehehehehe.

2:52 talios: jvmleaks just give OOMs tho :(

2:52 arbscht: talios: hey

2:52 cky: Hehehe, awww.

2:52 talios: 'lo arbscht

2:53 arbscht: talios: btw http://lisp.geek.nz is alive

2:53 cky: Wow, another Kiwi? Nice.

2:53 arbscht: cky: I just live here =)

2:53 cky: Heh. I'm just a New Zealander, albeit not living in New Zealand at the moment. :-P

2:54 talios: arbscht: nice :) I guess this is what happens when I drop the ball and only have 2 JVM meetups in a year :)

2:55 arbscht: talios: the lisp group has been a long time coming... I have a roster of about 15 people in auckland who are interested in various dialects

2:55 talios: nice

2:56 arbscht: talios: we'll probably have a social meet in the next couple of weeks -- I'll keep you updated -- and start with actual presentations and whatnot next year

2:56 cky: I'd love to see such a group in the Triangle (of meetups of diverse Lispers).

2:56 * cky will attend the Auckland meetups in spirit. :-P

2:57 cky: arbscht: Any Schemers in your Auckland group?

2:57 arbscht: cky: let us know when you're in town next!

2:57 cky: sure, at least three

2:57 cky: arbscht: That will be a long time coming, but sure thing. :-D

2:57 talios: cky: still keep in contact with daniel and co?

2:57 cky: arbscht: Nice. (/me is primarily a Schemer, but learning Clojure a little here.)

2:57 talios: Not really, except lightly on Facebook.

2:57 talios: more then me then :)

2:58 cky: TBH, probably half of them already defriended me; I don't really go around checking my friend lists. :-P

2:59 talios: heh - i'm amused by watching my twitter de-followers - all these social media people I don't know leaving ;p

2:59 cky: Well, you kind of want them to leave, though. Right?

3:00 talios: true - not that it matters as I don't follow them back, so never see any drivell they might write

3:00 cky: :-)

4:45 bsteuber: Wouldn't it be nice to have ^"foo" be a shortcut for ^{:doc "foo"} like keywords and types are a shortcut for tag?

4:45 Raynes: XML-RPC: Half conquered: https://gist.github.com/730070

4:48 bsteuber: oh, keywords don't expand into tag, but anyways

7:48 AWizzArd: Guys, does http 1.1 allow *requests* to be gziped? I know how to gzip the response from my server (jetty via Compojure), and have the client side (Apache HttpClient) handle it. But I would like to send a huge body in a POST (or PUT) request, which can be very well gziped.

8:31 jcromartie: AWizzArd: no, i don't think so

8:34 AWizzArd: Yeah, probably this is only for one direction, from Server to Client. Anyway, then I will have to do my own gzip compression manually, and have the C/S both expect certain POSTs to be packed.

8:42 Raynes: apgwoz: That gist *is* from gist.el :p

8:42 apgwoz: I gisted it for a friend who was wondering how to make private gists.

9:24 jcromartie: Are there any clojure libs for making interactive command-line interfaces?

9:24 I might just cannibalize some of my MUD game code :)

9:45 apgwoz: Raynes: ah, cool. I assumed you knew about gist.el, just thought it was interesting to see a function for it :)

9:48 cloture: hello. Quick question related to enlive. I've got it working okay, but I was wondering if in order to have a <h2> in a template, do I need that in the actual HTML template, or can I add it to the content of another tag in the HTML?

10:03 ah. it seems what I'm trying to do is usually done by Hiccup

10:07 _na_ka_na_: hellos, what's the easiest way to get the last element of a vector in constant time ?

10:07 cloture: someone please correct me if I'm wrong, but it appears that you can only modify HTML content that already exists in an HTML template using Enlive, you can't actually generate HTML

10:07 _na_ka_na_: (get vect (dec (count vect))) is too verbose

10:09 cloture: _na_ka_na_: (last (vector 1 2)) ?

10:09 _na_ka_na_: cloture: that's O(n) i believe

10:10 cloture: okay, I thought that might be the case

10:10 _na_ka_na_: there should be something like last-vect imo

10:10 fogus`: ,(first (rseq [1 2 3]))

10:10 clojurebot: 3

10:11 fogus`: _na_ka_na_: ^^^

10:12 _na_ka_na_: fogus`, hmm better

10:17 chouser: ,(pop [1 2 3])

10:17 clojurebot: [1 2]

10:17 chouser: ,(peek [1 2 3])

10:17 clojurebot: 3

10:18 * fogus` humbled

10:19 chouser: so, peek not pop. :-P

10:19 rseq should be O(1) as well

10:20 fogus`: This exchange was a microcosm of JoC's writing process. ;-)

10:20 Raynes: &(binding [pop peek] (pop [1 2 3]))

10:20 sexpbot: ⟹ 3

10:20 chouser: gah!

10:37 AWizzArd: Translation from Java to Clojure: we have a for loop that loops through a collection and checks for each element if it has a specific property. As soon this is met the loop ends with a 'return' statement. This is search for an element. Is there a better translation than find-first or (first (filter ...))?

10:38 joegallo: filter is lazy, so that seems like a pretty great translation.

10:42 AWizzArd: Could be wrapped into a dofor macro maybe.

10:43 joegallo: dofor?

10:46 jcromartie: AWizzArd: what about filter and first?

10:46 oh wait

10:46 you wanted something better

10:46 find-first sounds like a perfect match

10:46 chouser: AWizzArd: some

10:47 Raynes: AWizzArd: some

10:47 chouser: Damn it!

10:47 * chouser bows

10:47 Raynes: chouser: I decided to take a drink of my water before typing it. :<

10:47 chouser: heh

10:47 Raynes: Thirsty bird loses the worm.

10:48 jcromartie: but some returns the value of the pred, not the element

10:49 ,(some :foo [{:foo nil} {:foo :bar}])

10:49 clojurebot: :bar

10:49 jcromartie: ,(first (find :foo [{:foo nil} {:foo :bar}]))

10:49 clojurebot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map

10:49 jcromartie: whoop

10:49 Raynes: jcromartie: #(and pred %)

11:05 AWizzArd: some, nice

11:26 chouser and Raynes: although some returns the result of the predicate, while find-first will return the element for which the predicate was true.

11:27 So in this respect Clojures some is very much like CLs some, only that CLs some can take (like 'map') multiple sequences. And find-first in Clojure is like CLs find-if, but unfortunately find-first is not available in core.

11:30 KirinDave: AWizzArd: Find-first is unnecessary.

11:30 raek: would (find-first pred coll) be equivalent to (first (filter pred coll))?

11:30 KirinDave: raek: Exactly what I was going to say

11:30 raek: :)

11:31 I guess having lazy sequences makes it less important

11:31 KirinDave: raek: Although I suppose maybe not?

11:31 Chunked seqs, etc.

11:31 raek: true.

11:31 KirinDave: You could end up doing a lot more work.

11:31 I haven't seen finalizations of chunking policy in 1.3, but I haven't been paying the closest attention to 1.3

11:31 Is it there?

11:33 Raynes: AWizzArd: I tend to do stuff like (some #(and (pred %) %) ...). However, the example raek shown above is a very nice solution to this problem.

11:55 jcromartie: what's the state-of-the-art with printing stack traces in Clojure 1.2?

11:56 Raynes: $google clj-stacktrace

11:56 sexpbot: First out of 348 results is: mmcgrana's clj-stacktrace at master - GitHub

11:56 https://github.com/mmcgrana/clj-stacktrace

11:56 Raynes: That's pretty hot these days.

11:59 fliebel: What is the status of clojure-in-clojure? It seems like an interesting idea, but the only thing I can find about it is the same old blogpost where I read about it years ago.

12:04 tonyl: I asked about CiC here a few weeks ago. I don't think it is an essential milestone AFAIK

12:05 which kind of sucks, I think it would be interesting to increase the CiC percentage

12:06 cemerick: cinc will probably never be a milestone of its own. It's too complex of a concept.

12:06 tonyl: so a fork?

12:06 cemerick: It's been in the background of many of the most significant language changes and additions over the past 1.5 or so.

12:06 1.5 years*

12:06 AWizzArd: KirinDave: find-first is just (first (filter pred coll)). But why is that unnecessary?

12:07 cemerick: tonyl: no, a fork doesn't make sense -- cinc isn't a feature, it's a reorientation of the premises of the Clojure runtime.

12:07 tonyl: yeah, which is in itself a overhaul of implementation

12:08 cemerick: overhaul of implementation of what?

12:08 tonyl: to use clojure to reimplement the its runtime

12:09 all I am saying it is a heavy work to implement all at once

12:10 fliebel: cemerick: But with deftype and all in place, what is the next step?

12:12 hiredman: http://dev.clojure.org/display/design/Compiler+in+Clojure

12:12 jcromartie: is clojure.contrib.sql the best way to access a jdbc database?

12:12 tonyl: jcromartie: you can try clojureql

12:13 jcromartie: I take it that this means "superior to clojure.contrib.sql?" then "ClojureQL is superior SQL integration"

12:13 cemerick: fliebel: Other large pieces include clojure implementations of an analyzer and compiler, reader, a reflection API, probably protocolization of a variety of key interfaces (ISeq for example).

12:13 tonyl: I haven't use c.c.sql though so I am just going for what I've played with

12:14 jcromartie: very neat

12:14 c.c.sql is dead simple

12:14 clojureql looks much more sophisticated, though

12:14 cemerick: People have done spikes of some of those over the years, of course.

12:31 jcromartie: is there any connection pooling available with clojureql?

12:31 because it seems to take a really long time for each operation

12:32 AWizzArd: I would also be interested if it offers an easy access to cursors, to allow queries that return massive amounts of data.

12:32 jcromartie: I need to update lots of individual rows

12:33 and if it takes a 1/4 second each time, it would take days

12:34 tonyl: jcromartie: I think you are looking for (open-global ...)

12:35 jcromartie: thanks tonyl

12:36 tonyl: AWizzard: I read something about dealing with big queried data, let me see if I can dig it out

12:36 jcromartie: awesome

12:37 <3

12:38 raek: does someone happen knwo where you can get the source of PircBot?

12:40 hiredman: ~google pircbot

12:40 clojurebot: First, out of 850 results is:

12:40 PircBot - Java IRC Bot Framework (Java IRC API for Bots)

12:40 http://www.jibble.org/pircbot.php

12:45 raek: turns out it was in the jar afterall

12:49 fliebel: Hm, cinc backends: Java source. Huh? Except that you could do GWT with it, what is the point?

12:54 hiredman: fliebel: for rebootstrapping? clojure src -clojurec-> java src -javac-> bytecode

12:58 chouser: sometimes you have to deal with mutable things (thread pools, streams, etc.) and sometimes from multiple threads. In these cases, Clojure doesn't seem to provide much to help avoid complexity.

13:01 lucian: chouser: it lets you isolate mutable state easily

13:02 chouser: how?

13:02 clojurebot: with style and grace

13:03 hiredman: clojurebot: botsnack

13:03 clojurebot: thanks; that was delicious. (nom nom nom)

13:03 hiredman: chouser: well, uh, it seems like threadpools should be thread safe to begin with...

13:04 chouser: you'd think

13:04 hiredman: you could wrap your threadpool in an agent... :|

13:05 you can use locking

13:07 dnolen: anybody tried YourKit 9.5.2 with any Clojure 1.3.0 alphas?

13:08 fliebel: Some of the design pages have an issue named "Wait for new compiler" What's this about?

13:43 jave: hello

13:43 I'm trying to make a hello-world clojure applet

13:44 but I'm getting reflection errors and the like

13:45 ive found some clojure some working clojure demo applets so its possible, but they dont come with a build structure, so I think I have some type of building problem

13:48 chouser: you must get rid of all reflection for an applet to work

13:48 jave: yes

13:49 chouser: set *warn-on-reflection* to true, and hint absolutely everything that needs it

13:49 jave: basically I'm following this howto:http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet

13:49 and it explains the need to warn for reflection

13:49 so I'm doing that

13:50 (set! *warn-on-reflection* true)

13:50 chouser: so you've gotten rid of all reflection warnings?

13:51 jave: I dont get any reflection warnings when compiling, only when trying to run the applet

13:51 chouser: weird

13:51 oh

13:52 there could be reflection in clojure.core

13:52 jave: but maybe ive missunderstood where the "set!" goes? I put it in the src clj file

13:52 hiredman: or some other lib you depend on

13:52 chouser: yeah, put it in the src clj, before your (ns ...) form

13:53 that should find reflection in any deps

13:53 but not core

13:53 jave: but I looked at your tree.jar (Thanks btw) and you seem to do the same as me, build a fat jar of clojure and your code

13:54 wouldnt you then get reflection errors from core as well?

13:54 chouser: yes, but reflection is a runtime thing -- if you call a function that I don't, you could trigger an error I never saw

13:54 jave: hmm the hello world I copied used japplet as base not applet like you do

13:55 and its also type hintefd

13:56 chouser: it's probably not useful to guess about what might need to be hinted. you've got to generate a warning or track an error to the actual un-hinted line.

13:57 jave: well, I'm not geting any compile warnings

13:58 heres the error btw:https://gist.github.com/730733

13:59 chouser: that's not a reflection error

13:59 it looks like you're not including clojure.core in your .jar

14:00 jave: there is a reflection error in the middle of the trace

14:00 core__init.class is included in the jar

14:01 tonyl: FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath

14:01 it looks like it can't find it

14:01 jave: yes seems so, but its there. so I assumed it couldnt because of the reflection error

14:02 tonyl: i don't know about applets

14:02 how are you running the applet?

14:02 chouser: I see NullPointerException and FileNotFoundException -- no security error from trying to use the Reflection class

14:02 jave: at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)


14:03 tonyl: ive tried chrome, firefox and appletviewer

14:03 chouser: when using firefox to test, be aware of potential browser caching of your .jar

14:03 tonyl: I mean the clojure/java instance

14:04 jave: chouser: when trying appletviewer I do get: Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)

14:04 chouser: ah

14:04 *that* sounds like reflection. :-)

14:04 jave: tonyl: how do you mean?

14:04 tonyl: i mean the java -cp clojure.jar ...

14:04 chouser: jave: can you paste that trace?

14:04 jave: chouser: hmm jar caching might be an issue

14:04 tonyl: no its an applet, so the browser starts it

14:05 tonyl: oh yeah, I am seeing the clojurebook link now

14:06 jave: https://gist.github.com/730746

14:07 tonyl: your code looks exactly like the code in that example link?

14:07 I am going to try it

14:08 chouser: jave: flib.downloadapplet is yours?

14:09 jave: yes

14:09 chouser: you've AOT-compiled everything?

14:09 Raynes: Oh man.

14:09 Applets.

14:09 Security nightmares.

14:09 jave: I can upload the pom.xml

14:11 https://gist.github.com/730755

14:12 Raynes: well, I just wanted to revisit applets for a hobby intranet of mine. last applet I did was in the 90:s I think. ahem.

14:12 chouser: jave: it looks like it's failing to find a core clojure .class file, and is trying to fall back on loading the .clj which trips the security error

14:13 jave: hmm your tree.jar doesnt contain any .clj files at all right? but mine does, so maybe that fcks up things

14:14 chouser: there's not point in having any .clj files in your applet jar, unless you're signing it. Unsigned applet can't load .clj

14:14 you must AOT-compile everything to .class files, and all required .class files have to be in that one .jar

14:15 jave: its a signed jar. and its all AOT compiled. however, the shade plugin includes the .clj files also. ill try to exclude them now.

14:15 technomancy: anyone know if it's by design that deleting the .class files corresponding to a protocol causes code that uses the protocol to fail rather than falling back to the JIT protocol?

14:15 Raynes: technomancy: ohai

14:15 technomancy: I has a request.

14:15 technomancy: hello

14:16 Raynes: technomancy: How do you feel about aliasing :dependencies and :dev-dependencies to :deps and :dev-deps respectively? I added such functionality to cake a couple of days ago.

14:17 In order to be consistent with Leiningen project.clj files, I thought I'd ask how you feel about doing the same in Leiningen.

14:17 technomancy: sure; I'm all about keeping things under 80 columns.

14:17 Raynes: Great. If you want, I can see if I can find the relevant code in a little while and submit a patch.

14:18 technomancy: either way. it won't land until Lein 2.0, which is a long long way out.

14:18 Raynes: No hurry.

14:19 Any particular reason though?

14:19 It isn't a breaking change.

14:19 technomancy: any reason for what?

14:19 Raynes: For it to not be included into 2.0.

14:19 technomancy: no, I meant it would be in 2.0, but 2.0 is going to take a long time.

14:20 Raynes: s/into/until/

14:20 sexpbot: <Raynes> For it to not be included until 2.0.

14:20 technomancy: that's the next release

14:20 Raynes: Oh.

14:20 I haven't kept up with your versioning antics.

14:23 technomancy: Submitting that patch would make me eligible for stickers, right?

14:24 technomancy: naturally

14:25 jave: aargh! if I simply excluded all the .clj files the applet works!

14:25 in appletviewer at least

14:25 chouser: jave: you saw what I said about .clj file never working in applets?

14:26 jave: yes

14:26 so Thanks

14:26 chouser: oh, ok.

14:26 jave: I just assumed since I had the .class files, it wouldnt try to load the .clj files

14:26 chouser: so just AOT compile all those .clj's, and put the resulting .class files in the .jar instead

14:26 ah

14:27 jave: but firefox still complains, but that might be a cache error

14:28 chouser: boo. resources supplied by maven aren't updated without rebuilding. :-(

14:28 ugh, what a pain.

14:29 cemerick: chouser: "resources"?

14:29 chouser: src/main/resources/my/ns/foo.html

14:30 cemerick: is that a result of autodoc, etc?

14:31 chouser: the classpath maven builds for me could include that file, but it doesn't, it includes a copy of that file in the target directory instead, so my changes to the original are not available to my running app.

14:31 cemerick: no, hand written.

14:31 I guess I can save to both places every time I save

14:32 cemerick: This is with your app running via clojure:repl, or otherwise?

14:33 chouser: yeah. actually running via clojure:run and my own main class now

14:34 writing to the file's location in target works

14:34 of course writing *only* there will likely cause me to lose my edits later

14:34 cemerick: is this a webapp?

14:34 chouser: yes

14:35 hm, I bet a vim one-liner macro would let me work around this deficiency in maven.

14:35 ;-)

14:35 cemerick: chouser: I suggest using maven-jetty-plugin (running your webapp via jetty:run), and then you can add arbitrary stuffs to the classpath: https://github.com/cemerick/clojure-web-deploy-conj/blob/master/pom.xml#L52

14:36 The config there allows me to update assets and code in those source dirs. I then connect to the running app, and load code as I go along.

14:37 I'm not sure how that interacts with vim though...

14:37 chouser: cemerick: will those extraClasspath items be inclued in the built jar?

14:37 cemerick: nope, only in jetty:run invocations

14:38 chouser: ok, I don't think that's what I want

14:38 cemerick: To do the code-loading thing, you need to be remote-REPL-capable, e.g. via nREPL or swank-clojure.

14:38 chouser: I only have a couple static files for demoing what is otherwise an API service

14:39 cemerick: So you're looking for assets to be loaded preferentially from src/main/resources?

14:39 chouser: I'd like to be able to deliver a simple jar that is sufficient for providing the service, plus serving these couple static files (probably inefficiently) from within the .jar

14:40 cemerick: hrm

14:40 isn't that called a .war?

14:40 chouser: beats me. is it?

14:40 cemerick: heh :-)

14:41 war files are jar files with a standard internal layout suitable for deployment in servlet containers, such as jetty, tomcat, et al.

14:41 chouser: hm. I dunno

14:42 I might, eventually. on the other hand, something that allows someone to get an instance running by saying: java -jar uberthing.jar sounds pretty attractive at the moment.

14:42 which is what I think I have right now

14:42 cemerick: chouser: if you grab https://github.com/cemerick/clojure-web-deploy-conj and build it (mvn package), you'll find a .war in target that includes a static resource (an image) that is served up by whatever container you deploy it in.

14:42 technomancy: java -jar pacifist.jar

14:42 jcromartie: clojureql is my new best friend

14:42 and enemy

14:43 but mostly friend

14:44 I'm building a data masking utility

14:44 it's tricky stuff

14:44 cemerick: chouser: That's orthogonal. My first thought would be to bundle jetty (which I assume you're doing already), and then point it at the .war that you java -jar'ed.

14:45 chouser: cemerick: so ... my .jar would have jetty and a .war in it, and a class to point one at the other?

14:46 cemerick: Indeed. Hudson's .war is a variation of this (they actually unpack the .war to ~/.hudson, and run the app from there).

14:48 I *think* that unpacking is an artifact of the app container they bundle (winstone instead of jetty)…?

14:49 chouser: ok. so, I think I'll postpone that for now. Thanks for the tip, though.

15:06 ,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))

15:06 clojurebot: java.lang.IllegalArgumentException: More than one matching method found: schedule

15:06 chouser: any suggestions?

15:06 hiredman: .schedule can take a callabale or a runnable

15:06 chouser: I assumed hinting the fn to either Runnable or Callable would do it

15:06 hiredman: right

15:06 chouser: ,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s ^Runnable (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))

15:06 clojurebot: java.lang.IllegalArgumentException: More than one matching method found: schedule

15:07 hiredman: try runnable

15:07 er

15:07 callable

15:07 chouser: ,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s ^Callable (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))

15:07 clojurebot: java.lang.IllegalArgumentException: More than one matching method found: schedule

15:07 hiredman: huh

15:08 I have a scheduledexceutorservice in clojurebot

15:08 uh, scratch that

15:08 scheduledthreadpool

15:08 https://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj

15:09 chouser: same object, but you're not calling .schedule

15:09 hiredman: ah

15:09 chouser: .scheduleAtFixedRate has no overload

15:10 just takes a Runnable

15:11 hiredman: ,(fn [^java.util.concurrent.ScheduledExecutorService s ^Callable c] (.schedule s c (long 5) java.util.concurrent.TimeUnit/SECONDS))

15:12 clojurebot: #<sandbox$eval431$fn__432 sandbox$eval431$fn__432@133badd>

15:12 hiredman: clojurebot isn't on 1.3

15:12 err

15:12 that wouldn't matter

15:12 dunno, type hint wasn't taking...

15:13 maybe the macro expansion of fn thrashes type hints

15:13 chouser: hm!

15:15 ,(binding [*print-meta* true] (prn (macroexpand '^Integer (fn []))))

15:15 clojurebot: ^Integer (fn* ([]))

15:15 chouser: nice thought, but no

15:15 oh. does the hint there mean the function returns an Integer?

15:16 hiredman: oh

15:16 yeah

15:16 another good reason to move function return hints to the arglist

15:16 chouser: ^Runnable (first [(fn ...)]) works. :-P

15:17 jcromartie: LauJensen: ping

15:18 hiredman: (let [^Callable c (fn [] ...)] ...)

15:19 chouser: hiredman: yeah, that does too, which surprises me a bit

15:20 hiredman: type hint on the name vs. the function object

15:21 or, the expression which yields the function object

15:21 hmm

15:51 jcromartie: I'm looking for an idiomatic way to apply a map of functions to another map, in order to transform certain keys

15:52 so, say I have a map {:foo identity :bar #(* 2 %)} and {:foo 5 :bar 9} I want {:foo 5 :bar 18}

15:53 I currently have: (into {} (map (fn [[k f]] [k (f (k record))]) col-transforms))

15:53 tonyl: jcromartie: do you want to capture the results of those fn calls? or just to call them on those values

15:53 jcromartie: I want to return a new map

15:53 brehaut: merge-with ?

15:54 jcromartie: no I don't think so

15:54 brehaut: ,(merge-with #(%1 %2) {:foo identity :bar #(* 2 %)} {:foo 1 :bar 3})

15:54 clojurebot: {:foo 1, :bar 6}

15:55 jcromartie: hm, nice

15:55 tonyl: it works if the keys come in order like that

15:56 my bad, merge-with deals with the keys

15:57 jcromartie: that's perfect

15:57 (merge-with #(%1 %2) col-transforms record)

15:57 pretty readable

15:58 great :) this data masking is coming along nicely

15:58 brehaut: im a little suprised you cant use apply as the function

15:58 oh

15:59 no im not

15:59 jcromartie: I'm confused as to why that doesn't work

16:00 oh wait

16:00 right

16:00 :P

16:00 brehaut: (source apply)

16:00 will tell you :P

16:07 LauJensen: jcromartie: pong

16:08 jcromartie: LauJensen: hi, thanks :)

16:08 I had some ClojureQL questions

16:08 particularly extending it

16:08 say, for instance, I have a function that creates predicates

16:08 LauJensen: jcromartie: Sometimes you can get help in #clojureql, even if Im not there

16:09 jcromartie: oh cool

16:10 hmm, now I'm not sure exactly what I had in mind

16:12 LauJensen: jcromartie: what was the question again? :)

16:13 jcromartie: well, so what I want to do is select a bunch of records, and then update them, using the original record as a sort of predicate

16:13 so I made a function to create a (where ...) predicate from a record

16:13 so that it matches exactly

16:14 just not sure if there's a clean way to "extend" clojureql with that kind of thing

16:14 I'm new to protocol/record programming

16:14 so I might be able to answer my question by reading the code :)

16:15 LauJensen: What is missing from the Predicate protocol since you need to extend it?

16:17 jcromartie: well in my case I'm updating tables without knowing the primary keys ahead of time, so I'm extracting the primary keys which make each row unique, if there are any, and selecting those values

16:17 so each record identifies a row in the table

16:17 and so what I need is to match those exactly, so I am building the predicate dynamically

16:18 like this https://gist.github.com/79667390ab7e2887d065

16:29 LauJensen: jcromartie: comment on the gist

16:30 jcromartie: that looks good

16:31 I guess I'm over-complicating my thinking :)

16:31 what's the and* syntax?

16:32 LauJensen: jcromartie: The only reason 'where' exists, is to convert = to =*, or to or*, and to and* etc etc. Its just sugar. You should read https://github.com/LauJensen/clojureql/blob/master/src/clojureql/predicates.clj, its quite simple

16:33 jcromartie: ah, cool, thanks that's very helpful

16:33 LauJensen: np

16:40 rata_: hi all

16:40 $({0 1} 0.0)

16:40 &({0 1} 0.0)

16:40 sexpbot: ⟹ nil

16:41 rata_: why is that?

16:41 tonyl: &[(type 0.0) (type 0)]

16:41 sexpbot: ⟹ [java.lang.Double java.lang.Integer]

16:42 tonyl: they are different types

16:42 jarpiain: &(map hash [1 1.0])

16:42 sexpbot: ⟹ (1 1072693248)

16:42 tonyl: that would be my guess

16:42 rata_: mmmm... but shouldn't the key comparison fn be = ?

16:42 jcromartie: uh oh, my baby is to the point where she wants to type on the keyboard like daddy

16:42 chouser: &(= 0 0.0)

16:42 sexpbot: ⟹ true

16:43 chouser: rata_: this is changing in 1.3, will use =, but (= 0 0.0) will be false

16:43 zerokarmaleft: jcromartie: http://www.hanselman.com/babysmash/

16:43 tonyl: hashmaps use hashcode as they key comparison

16:44 technomancy: jcromartie: time for a decoy keyboard

16:44 jcromartie: zerokarmaleft: awesome :)

16:45 rata_: mmmmm... bad thing, because numbers change so easily their type

16:45 LauJensen: jcromartie: I pushed a fix, so the code I gisted will work on MASTER

16:46 technomancy: it's not the number's type, it's precise vs imprecise IIUC

16:49 chouser: equality on floating point numbers is lousy anyway, even if fixed-point numbers aren't involved at all.

16:54 bortreb: hey, is there a version of iterate that will run n times and only n times with no lazy seqs possibly causing the function to be executed too many times?

16:56 chouser: (doall (take n (iterate ...))) will happen exactly n times

16:56 or you can loop/recur

16:56 bortreb: will it really? I thought lazy sequences sometimes "chunked" and calculated more than they strictly have to

16:57 chouser: yes, but it depends on the source of the seq. vectors, for example, can produce chunked seqs, as can 'range'. But 'iterate' doesn't.

16:58 bortreb: oh ok

16:58 chouser: but if it makes you nervous, and you really need *no* laziness, loop/recur seems reasonable

17:02 jcromartie: is there a paredit command to move the expression at the point forward or backward?, like turn (foo |bar bat) into (foo bat |bar)

17:02 or something

17:05 arbscht: jcromartie: what about transpose?

17:06 jcromartie: thanks, that's what I was looking for

17:06 C-M-t

17:06 paredit and clojure are making me happy today

17:06 arbscht: I think that's a builtin emacs thing

17:08 jcromartie: oh cool

17:08 edw: On Ubuntu, what JDK is recommended for Clojure?

17:09 jcromartie: then Emacs, paredit, and Clojure :)

17:09 maacl: Is there a function that flips keys and values in a map?

17:09 brehaut: edw: openjdk6 ?

17:09 bortreb: java version "1.6.0_20"

17:09 jcromartie: ,(into {} (map reverse {:foo :bar :bat :baz}))

17:09 clojurebot: java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry

17:09 jcromartie: whee

17:09 bortreb: is what i'm running on ubuntu and it works great

17:10 edw: When I install openjdk6 I got this error: "Warning: problem requiring hooks: java.lang.IllegalAccessError: extract-javac-tasks is not public".

17:11 bortreb: type java -version

17:11 you might be not actually running sun's version

17:11 edw: java version "1.6.0_20"

17:11 "OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1~10.04.1)"

17:11 bortreb: yeah

17:11 edw: "OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)"

17:11 bortreb: you're running the IcedTea

17:11 version

17:12 mrBliss`: maacl: clojure.set/map-invert

17:12 bortreb: which I've never found all too reliable

17:12 edw: Umm, that means nothing to me. I'm a FreeBSD/Mac guy, I'm clueless about this.

17:12 technomancy: openjdk works great with Clojure

17:12 edw: How do I get Sun's version?

17:12 brehaut: edw: openjdk is suns version

17:12 edw: Ah.

17:12 maacl: mrBliss`: thanks

17:12 bortreb: sudo update-alternatives --config java

17:13 and you can change versions to sun's

17:13 edw: There is only one alternative, it says.

17:15 brehaut: edw i have openjdk-6-jdk, openjdk-6-jre, openjdk-6-jre-headless, openjdk-6-lib installed on my linux virtual machine in ubuntu 10.04 machine and have had no problem with running clojure

17:17 edw: Hmm, it may be Hadoop that's not liking the OpenJDK; an empty lein project REPLs just fine...

17:40 OK, I jumped through a lot of hoops and am now installing the Sun JDK.

17:48 tscheibl: with-bindings vs binding ???

17:50 brehaut: tscheibl: it depends on your needs?

17:51 tscheibl: i think binding is more common though

17:51 tscheibl: brehaut: what exactly is the difference?

17:52 brehaut: one takes a map as its first arg, the other a vector of vars and expressions

17:52 tscheibl: brehaut: that's it?

17:52 brehaut: appears to be

17:53 tscheibl: brehaut: quite redundant then.. isn't it?

17:54 brehaut: with-bindings was added in 1.1 ...does that mean it could be an improvement in style?

17:54 brehaut: tscheibl: well, i think it means you can build the map up programmatically without need for macros

17:54 tonyl: i think with-binding doesn't create a new thread binding, it just replaces the current val bounded to that var

17:55 tscheibl: ... h,mm could be

17:55 tonyl: then it pops out that new binding

17:55 jave: chouser: do you remember which clojure.jar you embedded in your tree.jar example?

17:56 tonyl: but that is what I take from reading the source

17:56 brehaut: tonyl: i thinkyou are right

17:57 tscheibl: ~(with-bindings {a 42} a)

17:57 clojurebot: Excuse me?

17:58 chouser: jave: I don't, but I'm sure it was 1.1, 1.0, or even lower.

18:04 jave: ok

18:04 jcromartie: hm

18:04 I thought clojure.string/join was a real thing

18:05 jave: I'm able to piggy back my classes in your jar and then it works also in firefox. so somehow my clojure packaging is broken. but I only get it from maven central so I'm not sure what is happening

18:05 jcromartie: I was just using it, but then I quit the REPL and restarted it, and now it says "java.lang.ClassNotFoundException: clojure.string"

18:06 started from lein repl each time

18:06 heh, it's always fun to restart your repl and find what code breaks

18:06 technomancy: jcromartie: clojure.string is not loaded until you ask for it

18:06 jcromartie: yeah

18:07 technomancy: if you have any code that uses it, you must require it in the ns form

18:08 jcromartie: yeah, I had just been using it in files loaded from a repl where I must have require'd it

18:08 I didn't ever have a require directive in the files themselves

18:10 ddonnell: is there a way to get the count of the queue an agent uses to process it's tasks?

18:16 found the answer in the source

18:17 (.getQueueCount a)

18:27 tscheibl: ~(with-bindings {(def i) 42} i)

18:27 clojurebot: danlarkin uses jrockit

18:27 danlarkin: what the heck

18:29 technomancy: clojurebot: libelous statements like that are dangerous.

18:29 clojurebot: Gabh mo leithscéal?

18:32 tscheibl: ..I'm beginning to understand...

18:33 tonyl: I didn

18:33 I didn't know def returned something

18:33 Raynes: Everything returns something.

18:33 tscheibl: returns a var

18:34 obviously

18:40 to be precise a clojure.lang.Var

18:41 with 'binding' you would have to def the var in advance

19:35 gn8

20:01 joshua__: How do I select and deindent blocks of clojure comments in emacs?

20:01 I'm using clojure mode.

20:05 Or how can I do the reverse?

20:07 technomancy: joshua__: M-; toggles commentedness of the region

20:13 pdk: sounds like he wants to keep them commented but reindent them

20:15 * technomancy <= not paying attention

20:15 technomancy: M-x reindent-region

20:26 jcromartie: what's the story with startup .clj files? like, something that will load automatically when I run lein repl?

20:27 durrr

20:27 Set the :repl-init-script key in project.clj to point to a file if you want code executed inside your project.

21:40 dnolen: hmm YourKit 8 works but not 9.

22:05 * aav will be in NY for the next 8 days. any clojure people there? beer?

22:28 will_l: I'm new to clojure, and I cant figure out why this is throwing a null pointer exception: https://gist.github.com/731409

22:29 kevinjq: i'm wondering why i cannot do the following: (def (symbol "a") "something"), i was given java.lang.Exception: First argument to def must be a Symbol. dosn't (symbol "a") create a symbol?

22:29 hiredman: def is not a function

22:30 there are a number of ways to understand what is going on there, by far the best is to write a lisp interpreter

22:31 kevinjq: is there a way to sort of "dynamically" create a var?

22:33 sorry, accidentally went offline...

22:36 jcromartie: is clojure.inspector dead?

22:36 the buttons don't seem to do anything

22:36 been that way for a long time

22:38 dnolen: will_l: ah the dreaded null pointer exception inside of a lazy sequence.

22:38 will_l: dnolen: dreaded doesn't sound good

22:39 dnolen: will_l: you probably have an unexpected nil somewhere.

22:39 ,(instance? nil 'a)

22:39 clojurebot: java.lang.NullPointerException

22:39 dnolen: ,(instance? Object 'a)

22:39 clojurebot: true

22:39 will_l: oh, it's probably then (first (intersection set1 set2)) being nil

22:39 i'll look there, thanks

22:41 dnolen: kevinjq: you can do what you want, but it requires many things that are not encouraged. You should try to solve your problem in another way. If it's just a thought exercise you always have eval.

22:42 kevinjq: dnolen, searching around, i found this http://stackoverflow.com/questions/2486752/in-clojure-how-to-define-a-variable-named-by-a-string

23:02 joshua__: OMG I've been struggling with trying to figure out the null pointer exception I was having all freaking day. Thank you so much for randomly giving me a clue as to what might be wrong.

23:04 UPDATE: I figured it out! Turns out that item 154 in the sequence was trying to perform an operation on a nil.

23:04 dnolen: I could kiss you, but since your not a girl I won't.

23:05 *would even

23:05 dnolen: Thank you so so much.

23:05 dnolen: joshua__: heh, yeah, once you get burned by that one, you start knowing what to look for.

23:06 joshua__: (I think its sorta hilarious how fast I found it after being given that clue after hours of ... nil)

23:09 dnolen: How long ago did you talk to will_l about the null pointer exception?

23:09 will_l: it was 20 min ago. I got it figured out :)

23:16 joshua__: You know I'm thinking about this bug and it just occurred to me that one of the coders from Code Complete had it completely right. If there is a bug it is in the last place you made a change. It just sucked that I made multiple changes at once. =(

23:19 Another question: Is there a site where people will critique your code to see if your doing things *the right way*. Sort of like a code review site? I look at my Clojure code and it seems so ugly some of the time in comparison to say my python code and I wonder if it is just because I'm not doing things right. Like maybe I'm fighting the language or something?

23:27 dnolen: joshua__: as far as 1) I've gotten somewhat religious about version control, even for small projects. for 2) it takes time to understand how to write things properly in Clojure. I've been at for 2+ years and I'm still learning. Doesn't help that rhickey keeps adding cool new stuff. Eventually you'll wish you could write those nice pretty things in Python, and ... you'll find yourself on the other side of the fence.

23:40 cky: joshua__: http://refactormycode.com/

23:44 coldhead: joshua__: i think you're better off learning good habits and right ways and idioms through reading code by other people

23:47 cky: coldhead: I think there's a place for both.

23:48 joshua__: coldhead: Your probably right. cky: Thanks that site is exactly the sort of thing I was thinking of. dnolen: at which point you start using jython so you can interop to clojure =p

23:48 cky: coldhead: Sometimes, learning by osmosis isn't enough. :-)

Logging service provided by n01se.net