#clojure logs

2010-12-06

00:00Deranderpdk: was it any good?
00:00DeranderI've been wanting to learn ocaml
00:00pdkthe guy who wrote purely functional data structures insisted on using standard ml and haskell for his code examples
00:00pdki need to pick it up again, i stopped around the basic chapter 2-3 stuff
00:00pdkyknow how it's always
00:00pdk"this is what a number looks like
00:00p_l|homepdk: 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
00:00pdk"this is 2+2
00:01pdkthough elementary standard ml makes it a big point to explain why stuff is the way it is
00:01pdkso it might illuminate things a bit more for a cs student than your average introductory programming language book
00:01pdkone goofy thing about it though
00:02pdkthese guys use ~ for negative numbers OH LORDY
00:02Deranderhaha
00:02Deranderthat's unique
00:02pdki think i may have heard of casting spels like once
00:02pdknot really ringin a bell though
00:03pdkreading kindle on pc is sorta okay
00:03wyrgI have a doubt about class proxies.
00:03pdkthough i hate how it doesn't remember all your viewing options and it has this bug
00:03p_l|homepdk: LoL was supposed to be an expansion on it, and some people might have encountered old "republic of Haskell" comic
00:03wyrgI'm trying to proxy java.awt.image.ImageObserver.imageUpdate for the class JPanel.
00:03pdkwhere it goes "saving last read position" and the taskbar icon for kindle in 7 keeps flashing for ages
00:03pdkyknow how in 7 with aero
00:03wyrgDo I have to use proxy-super?
00:03pdkit can show you progress bars in the taskbar
00:04pdksince it seems to say "saving last read position" nonstop get ready to see that thing flash a lot
00:04p_l|homepdk: 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)
00:04pdkdoes lol still have all the intended stuff from when it was a spels sequel
00:05pdkso you could wager someone went and cracked it
00:05ckypdk: It's already done.
00:05wyrgAnyway, the paste is in: http://codepad.org/fT6wHZhZ
00:05ckypdk: Google for "I love cabbages".
00:05ckyYou'll know what to do.
00:06p_l|homepdk: in case of LoL, it's IMHO better to find the original PDF release of LoL rather than the kindle one :)
00:06wyrgI want to redefine imageUpdate, but it doesn't seem to work.
00:06pdki'm getting the down low on phreaking in #clojure folks
00:06pdkwill the pdf release be free or do i buy it off the publisher
00:06p_l|homepdk: it's available from nostarch press
00:06p_l|homewithout DRM, iirc
00:07pdkhow much does the pdf run
00:08ckypdk: It would have been a lot cheaper during the O'Reilly Cyber Monday sale. :-P (Which covered No Starch titles.)
00:08pdkhm first thing i get on google is a link to the spels pdf
00:08pdkis that still worth reading if you get lol
00:08pdkhm
00:08pdk$25 is ok
00:08p_l|homepdk: Casting SPELs is very short tutorial
00:08pdknaturally amazon tacks on another $5
00:08pdkso it tells me nothing lol won't
00:11pdkdoes it touch on popular libraries for writing games in cl
00:11p_l|homepdk: afaik no, though the only really popular library is lispbuilder-sdl
00:11pdkactually 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
00:11p_l|home(all the rest are common libs used in many projects)
00:11wyrgWell, thank you anyway.
00:11pdkhmmm
00:12pdkactually where does clisp stand on the totem pole of cl implementations
00:12p_l|homepdk: it is more in the style of '80s when it comes to games
00:12pdki know folks are like "OMG SBCL PLEASE" but clisp is definitely the most convenient windows option
00:12p_l|homeas for CLISP... well, it's easy to get running, but I don't recommend it even on windows
00:12pdkif the headway is there to take knowledge from other sources and expand to more modern/ambitious stuff then hey
00:13pdkbit annoying how they don't keep up to date windows sbcl builds
00:13p_l|homepdk: it uses simple games like the ones kids would write on their micros to describe programming concepts, including functional programming
00:13pdkespecially if you wanna redistribute unless it's that good at making windows binaries out of your programs
00:13ckyI mean to see if it's possible to use Debian's mingw packages to make Windows SBCL binaries.
00:13slyrusI think the idea with SBCL is that you're s'posta build your own
00:13pdkthere was some stupid trick i had to google to make windows binaries of programs in clisp
00:13p_l|homepdk: for Windows the stable solution is CCL
00:13pdkand it'd be like
00:13pdkmultiple megs for a hello world app
00:13p_l|homeSBCL/win32 isn't supported
00:13pdkand i was like "what is this shit"
00:14p_l|homepdk: if you try to distribute a combined executable of a clojure "hello, world", I suspect you'd get similar size :>
00:14slyrusheh
00:14pdkccl turns up a bunch of odd results, is there a site for the one you're referring to
00:14pdkwell yeah
00:14ckywww.clozure.com, probably.
00:14slyrusp_l|home: don't forget about the du -sk ~/.m2
00:14p_l|home111MB after decompressing is what Java 6 32bit takes on linux :> (that's JRE, not JDK)
00:15p_l|homeslyrus: aka "that thingy that tries to make a mirror of internet before compiling hello world"?
00:15pdkis this thing available open source/freeware without crippling
00:15p_l|homepdk: CCL is licensed similarly to LGPL (with some extra clauses to make it less restrictive), SBCL is public domain (mostly)
00:16slyrusp_l|home: http://slyrus.github.com/2010/12/05/maven-madness.html
00:16pdkthat's badass
00:17p_l|homepdk: 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.
00:17p_l|homeMain issue with CLISP is its poor SLIME integration
00:17pdki should try learning that stuff again
00:17pdkactually see what goes down with incremental dev/modifying code on the fly
00:19p_l|homeslyrus: ... that dependency list looked quite sane compared to what I got trying to compile a maven-only java Emacs mode :>
00:35technomancyp_l|home: for the record the kindle can read mobipocket books just fine
00:35technomancythat's all I use mine for
00:41technomancyI 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.
00:42technomancyit seems like that would be the simplest way to clean up the mess
00:42jk_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
00:43pdkdid you guys say land of lisp has a clojure chapter
00:45p_l|hometechnomancy: not everyone is interested in getting a kindle reader, though, and the installable variants aren't available on many platforms
00:45p_l|homeSymbian S60 with a 2" screen had been my best reading platform, actually :D
00:46slyrusjk_: no, a dependency list that long is madness, if you ask me
00:46technomancyp_l|home: ok, I was just reacting to your statement that Amazon was somehow being a dick by dropping support
00:46p_l|homepdk: it at least shows it in appendix... can't find a whole chapter, so I guess it got dropped
00:47technomancythe hardware department is distinct from the business of selling DRM-infected content
00:47jk_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
00:47jk_slyrus: it's not a function of maven, it's a function of those libraries using other libraries
00:47p_l|hometechnomancy: there was a nice overview of the whole thing sometime ago, and how amazon's practices effect mobipocket market
00:48jk_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
00:50slyrusjk_: 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?
00:50jk_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
00:51slyrusjk_: I never said the alternative was storing jars with every project in your source repo
00:51jk_slyrus: sure, a lot of those jars are for the maven infrastructure itself but they will only ever be downloaded just one time
00:52slyrusit's certainly not perfect, but look at how ASDF2 (for common lisp) handles it's dependencies for another perspective on the problem
00:52slyrusok, 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.
00:52jk_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
00:53slyrusI get that this isn't the commonly held perception in the java world
00:53jk_maven is just making sure they are available and resolved properly
00:54jk_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)
00:56p_l|homethe dependency hell partially comes from lack of easily-composable code IMHO
00:57jk_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 :)
00:59jk_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)
00:59jk_and yet, they compose just fine from a functional language perspective (as long as you have the right version of the api!)
01:00p_l|homejk_: yeah, I recall suggesting separate versioning information for library and API in ASDF
01:00p_l|hometo partially avoid such situations
01:04p_l|home(as well as better :depends-on that would support versioned deps.)
01:05slyrusjk_: oh, I have no intention of working on large java-based apps :)
01:05technomancyoh man it's a good thing cemerick isn't here
01:05technomancyhe'd have a fit seeing that people are even debating this
01:05jk_slyrus: well if you're gonna be doing clojure, you kinda are :-p
01:05slyrusthat's an implementation detail
01:05slyrusyou could make the same argument for ABCL, but I wouldn't
01:06jk_clojure is designed to have tight integration with java though, and really nice, easy use of java directly (and all those zillions of libs)
01:06slyrus(and, no, don't suggest CLR)
01:06slyrusyeah, yeah, yeah :)
01:08jk_slyrus: why not just use a different lisp rather than deal with the java stuff that clojure brings with it? i'm just curious.
01:08slyrusI like what rhickey has done with the language
01:09slyruscleaning up the ANSI crap, destructuring, immutable data, lazy-seqs, etc...
01:09slyruscleaning up isn't the phrase I was looking for
01:09slyrusignoring, perhaps
01:09slyrusstarting fresh
01:10technomancydeprecating =)
01:10slyrusyeah, for some things
01:10slyrusand keeping the good stuff
01:10technomancyGCing is probably the best way to put it
01:10technomancythat's a pretty good tag line, actually
01:11technomancyClojure: Lisp, garbage collected.
01:11thunknice
01:11p_l|home(and {})
01:12p_l|homeseen ))))]))])) once and got a BURN MAIM KILL response ;-)
01:12p_l|homethough I guess it's a matter of being used to
01:12technomancywait, you actually see that?
01:12slyrusp_l|home: I dunno, I've kinda gotten used to it
01:13slyrustry looking at some (setf (gethash ...) ...) forms you start to appreciate clojure's syntactic sugar
01:13technomancyit's just fnords to me
01:13slyrusnot to mention the nice treatment of lists, vectors, maps, seqs, etc...
01:13thunkjust what?
01:13p_l|homeslyrus: I'll admit gethash isn't too nice, but SETF machinery is very :)
01:14p_l|home(even better on a lisp with locatives)
01:14slyrusp_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
01:14technomancythunk: http://en.wikipedia.org/wiki/Fnord
01:14thunk"<technomancy> it's just to me"
01:14slyrusmy brain thinks a bit differently writing clojure code than it does writing CL code
01:14thunk:)
01:14technomancythunk: oh, oops. =)
01:21jk_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!
01:36ismarcok, 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
01:37ismarcnow, 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?
01:39dmeadhi channel
01:39dmeadis there a way in eclipse to get the line number of where an exception was thrown?
01:39slyrusjk_: 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)
01:40dmeadi keep getting "Don't know how to create ISeq from: clojure.lang.Symbol (repl-1:5)"
01:40dmeadand it won't show a line number
01:45dmeadanyone?
01:45clojurebotPlease 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.
01:45dmeadxD
01:47ismarcdmead: 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)
01:47ismarcwhere user.clj is my own source file and it's line 29
01:48ismarcoccasionally I have to look further down the stack trace to find where my code initiated the problem, though
01:48ismarcrather than it being obvious and on the first line
01:48dmeadi'm not getting a stack track :s
01:48ckyThat 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.
01:50ismarcdmead: Well, unfortunately we have exhausted my knowledge in this area :)
01:51raekif
01:52raekdmead: if you require the file from the repl, I think you should get line numbers
01:54raekI would check the defn forms, especially the ordering of the first arguments
01:55dmeadcheck for what?
01:56raeksomething like (defn foo symbol-instead-of-arglist ...) might cause it
01:57dmeadi've got defn blah blah [args like this]
01:57dmeadin square brackets
01:59raektwo symbols between the 'defn' and the square brackets?
01:59dmeadnope
01:59dmeadjust the function name
01:59dmeaddefn blah [a b c d..]
02:00dmeadso i've defined my namespace at the top of this file
02:00dmeaddo i need to do anything else besides (ns somename)
02:00dmead?
02:15raekno
02:16raekdmead: could you paste the code on gist.github.com?
02:16raekdmead: also, what IDE do you use?
02:16dmeadeclipse
02:16dmeadsure, sec
02:17dmeadraek, https://gist.github.com/729976
02:17replacaQ: is there a preferred form for (nil? (seq foo)) to test for nil-or-empty?
02:17replacait's late, but I feel like there is
02:18dmeadraek, try calling (match-and-sub '(4 5 6) '(xs) '(1 2 3 xs))
02:18dmeadraek, it's erring on the second cond clause in mreplace but i can't tell exactly where
02:18raekdmead: you don't get the exception when you try to eval the definitions, but when you call the function?
02:19dmeadexactly
02:19clizzinIs there a function like some but which returns the item for which the predicate was true instead of the result of the predicate itself?
02:19dmeadit's only on execution for the first cond clause of mreplace
02:22raekdmead: you should be able to get a more detailed stack trace than only one line
02:23raekmaybe you have to look at the stacktrace for the cause of the exception, but the info should be there somewhere
02:23replacaclizzin: filter
02:24zztri'm getting started with emacs/paredit and i'm liking it a lot except i'm fighting the indenter all the time
02:24raekdmead: does lookup return a sequence?
02:24zztranyone know a quick fix for making the auto-indentation sane?
02:24ckyzztr: It's already sane. What are you trying to fight?
02:25dmeadraek, no i guess it' just a list
02:25clizzinreplaca: well, that would return a seq, so i would have to use first to get the first elem i want, right?
02:25zztrcky: it's all over the place. like i start a let block and suddenly my code is in the middle of the page
02:25raeklists are sequences...
02:26zztrcky: i just want two spaces per indent strictly
02:26dmeadraek, (list ..) and (seq ...) are identical?
02:27raekno, lists implements the sequence interface
02:27dmeadah
02:27raek,(append 'foo '(1 2 3))
02:27clojurebotjava.lang.Exception: Unable to resolve symbol: append in this context
02:27ckyzztr: 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.
02:28raek,(concat 'foo '(1 2 3))
02:28clojurebotjava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
02:28ckyzztr: If you find your code being "in the middle of the line" all the time, you may need to restructure your code.
02:28raekdmead: I think your code results in something like that
02:29zztrcky: ok i need to paste you something
02:29raekalso, null = nil?, var-p = symbol?, append = concat
02:29dmeadnull is defined in the file
02:30dmeadyea at some point it's tryng to concat a non list to a list
02:30raekalso, when doing recursive tail calls, use 'recur' rather than the function name
02:30dmeadkk
02:30raekthe stack trace should tell you where that call is made
02:31raekunfortunately, I'm not accustomed to clojure + the eclipse IDE
02:31dmead:S
02:31dmeadi still can't get to the ST
02:32zztrhttp://dark-code.bulix.org/qpqd9d-78919
02:32raektry (.printStackTrace *e) in the repl
02:32cky*reads*
02:33dmeadthat works
02:33dmeadthanks
02:33ckyzztr: Why would you put a newline right after the "["?
02:33ckyThat's just...unusual.
02:33ismarczztr: use ;; for the comment
02:34ismarczztr: I fought with that forever, it tries to line up ; with something, but I'm not sure what
02:34ckyismarc: end-of-line comments should use ;, not ;;.
02:34zztrwhy not use whitespace to separate comments to their own line
02:35ismarccky: the comment he has on there isn't an end of line comment, it's on it's own line for some reason
02:35ckyismarc: I see. Fair enough.
02:35zztri was using jedit before and was pretty happy with just having two spaces for every indent
02:35zztrit's a long comment, so it gets its own line...
02:35ckyzztr: Still, putting a newline after an opening ( or [ is just wrong.
02:36zztrcky: why?
02:36ckyYou should either move the ( or [ to a new line, or at least have one opening form before the new line.
02:37zztrsounds like no one hates this as much as i do, or no one knows how to turn off this alignment-with-nothing behavior...
02:37ckyI 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.
02:38tomojindeed
02:38ckyzztr: No one formats code the way you do, that's why.
02:38tomojI have never seen a ( or [ at the end of a line and would get rid of it if I saw it
02:38ckytomoj: Agree.
02:39ckyzztr: To experienced Lispers, the brackets are _invisible_.
02:39zztrdo you guys put your comments *after* your let declarations then?
02:39ckyDo new variable bindings even need comments?
02:39ismarcEven 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)
02:39ckyUsually a doc comment at the start of a function should suffice.
02:40ckyismarc: Indeed.
02:40zztri like putting more text in the middle, myself
02:40tomojcomments at the end of a form are an acceptable exception to the "no bare closing parens at the end of a line" rule
02:40tomojnot opening parens though, in actual style, I think
02:41ckytomoj: I still prefer to avoid bare closing brackets, in general, because they're still too visible that way.
02:41tomojhttp://mumble.net/~campbell/scheme/style.txt
02:41talios'lo cky
02:42ckytomoj: Indeed. :-D
02:42ckytalios: Heya!
02:42tomojyou can also use comment to get around it
02:43tomojhuh
02:43tomojthere they say it is acceptable to have a bare opening bracket before a list
02:43tomojfor ease of version control of long lists
02:43tomoj(every entry looks the same)
02:45ckytomoj: That's a very limited exception, though. And I don't think it applies to the bindings list of a let.
02:45ckytalios: :-)
02:45tomojcky: right
02:46ckytalios: Riastradh has quite a sense of humour. :-P
02:46talios"If a file exceeds five hundred twelve lines, begin to consider splitting it into multiple files." 5-12? Not 500? :)
02:47taliosDarn byte lenghts
02:47ckytalios: What self-respecting geek works with round decimal numbers rather than round hex numbers? :-P
02:48taliosthose who need the computer to do their calcs for them in the first place.
02:48ckyHah.
02:48replacaclizzin: yes, that's correct
02:48ismarcanyone 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
02:49ismarcso I'd like to get some feedback prior to moving further forward on other aspects for what I might be doing oddly
02:49ckyGAE supports Clojure? I can finally hope that I can make SISC work on GAE too, then. :-P
02:50ismarccky: Someone made appengine-magic that provides a nice wrapper for the Java calls
02:50ckytalios: Hahahahaha.
02:50ckyismarc: Nice.
02:51talioscky: thankfully on this show we don't wander too much into tangents, so no real editing required
02:51ismarccky: 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
02:51ckytalios: Make it all uncensored, like the US diplomatic cables! :-P
02:51taliosjvmleaks!
02:52ckyHehehehehe.
02:52taliosjvmleaks just give OOMs tho :(
02:52arbschttalios: hey
02:52ckyHehehe, awww.
02:52talios'lo arbscht
02:53arbschttalios: btw http://lisp.geek.nz is alive
02:53ckyWow, another Kiwi? Nice.
02:53arbschtcky: I just live here =)
02:53ckyHeh. I'm just a New Zealander, albeit not living in New Zealand at the moment. :-P
02:54taliosarbscht: nice :) I guess this is what happens when I drop the ball and only have 2 JVM meetups in a year :)
02:55arbschttalios: 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
02:55taliosnice
02:56arbschttalios: 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
02:56ckyI'd love to see such a group in the Triangle (of meetups of diverse Lispers).
02:57ckyarbscht: Any Schemers in your Auckland group?
02:57arbschtcky: let us know when you're in town next!
02:57arbschtcky: sure, at least three
02:57ckyarbscht: That will be a long time coming, but sure thing. :-D
02:57talioscky: still keep in contact with daniel and co?
02:57ckyarbscht: Nice. (/me is primarily a Schemer, but learning Clojure a little here.)
02:57ckytalios: Not really, except lightly on Facebook.
02:57taliosmore then me then :)
02:58ckyTBH, probably half of them already defriended me; I don't really go around checking my friend lists. :-P
02:59taliosheh - i'm amused by watching my twitter de-followers - all these social media people I don't know leaving ;p
02:59ckyWell, you kind of want them to leave, though. Right?
03:00taliostrue - not that it matters as I don't follow them back, so never see any drivell they might write
03:00cky:-)
04:45bsteuberWouldn't it be nice to have ^"foo" be a shortcut for ^{:doc "foo"} like keywords and types are a shortcut for tag?
04:45RaynesXML-RPC: Half conquered: https://gist.github.com/730070
04:48bsteuberoh, keywords don't expand into tag, but anyways
07:48AWizzArdGuys, 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.
08:31jcromartieAWizzArd: no, i don't think so
08:34AWizzArdYeah, 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.
08:42Raynesapgwoz: That gist *is* from gist.el :p
08:42Raynesapgwoz: I gisted it for a friend who was wondering how to make private gists.
09:24jcromartieAre there any clojure libs for making interactive command-line interfaces?
09:24jcromartieI might just cannibalize some of my MUD game code :)
09:45apgwozRaynes: ah, cool. I assumed you knew about gist.el, just thought it was interesting to see a function for it :)
09:48cloturehello. 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:03clotureah. 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:07cloturesomeone 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:09cloture_na_ka_na_: (last (vector 1 2)) ?
10:09_na_ka_na_cloture: that's O(n) i believe
10:10clotureokay, I thought that might be the case
10:10_na_ka_na_there should be something like last-vect imo
10:10fogus`,(first (rseq [1 2 3]))
10:10clojurebot3
10:11fogus`_na_ka_na_: ^^^
10:12_na_ka_na_fogus`, hmm better
10:17chouser,(pop [1 2 3])
10:17clojurebot[1 2]
10:17chouser,(peek [1 2 3])
10:17clojurebot3
10:19chouserso, peek not pop. :-P
10:19chouserrseq should be O(1) as well
10:20fogus`This exchange was a microcosm of JoC's writing process. ;-)
10:20Raynes&(binding [pop peek] (pop [1 2 3]))
10:20sexpbot⟹ 3
10:20chousergah!
10:37AWizzArdTranslation 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:38joegallofilter is lazy, so that seems like a pretty great translation.
10:42AWizzArdCould be wrapped into a dofor macro maybe.
10:43joegallodofor?
10:46jcromartieAWizzArd: what about filter and first?
10:46jcromartieoh wait
10:46jcromartieyou wanted something better
10:46jcromartiefind-first sounds like a perfect match
10:46chouserAWizzArd: some
10:47RaynesAWizzArd: some
10:47Rayneschouser: Damn it!
10:47Rayneschouser: I decided to take a drink of my water before typing it. :<
10:47chouserheh
10:47RaynesThirsty bird loses the worm.
10:48jcromartiebut some returns the value of the pred, not the element
10:49jcromartie,(some :foo [{:foo nil} {:foo :bar}])
10:49clojurebot:bar
10:49jcromartie,(first (find :foo [{:foo nil} {:foo :bar}]))
10:49clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map
10:49jcromartiewhoop
10:49Raynesjcromartie: #(and pred %)
11:05AWizzArdsome, nice
11:26AWizzArdchouser and Raynes: although some returns the result of the predicate, while find-first will return the element for which the predicate was true.
11:27AWizzArdSo 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:30KirinDaveAWizzArd: Find-first is unnecessary.
11:30raekwould (find-first pred coll) be equivalent to (first (filter pred coll))?
11:30KirinDaveraek: Exactly what I was going to say
11:30raek:)
11:31raekI guess having lazy sequences makes it less important
11:31KirinDaveraek: Although I suppose maybe not?
11:31KirinDaveChunked seqs, etc.
11:31raektrue.
11:31KirinDaveYou could end up doing a lot more work.
11:31KirinDaveI haven't seen finalizations of chunking policy in 1.3, but I haven't been paying the closest attention to 1.3
11:31KirinDaveIs it there?
11:33RaynesAWizzArd: I tend to do stuff like (some #(and (pred %) %) ...). However, the example raek shown above is a very nice solution to this problem.
11:55jcromartiewhat's the state-of-the-art with printing stack traces in Clojure 1.2?
11:56Raynes$google clj-stacktrace
11:56sexpbotFirst out of 348 results is: mmcgrana's clj-stacktrace at master - GitHub
11:56sexpbothttps://github.com/mmcgrana/clj-stacktrace
11:56RaynesThat's pretty hot these days.
11:59fliebelWhat 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:04tonylI asked about CiC here a few weeks ago. I don't think it is an essential milestone AFAIK
12:05tonylwhich kind of sucks, I think it would be interesting to increase the CiC percentage
12:06cemerickcinc will probably never be a milestone of its own. It's too complex of a concept.
12:06tonylso a fork?
12:06cemerickIt's been in the background of many of the most significant language changes and additions over the past 1.5 or so.
12:06cemerick1.5 years*
12:06AWizzArdKirinDave: find-first is just (first (filter pred coll)). But why is that unnecessary?
12:07cemericktonyl: no, a fork doesn't make sense -- cinc isn't a feature, it's a reorientation of the premises of the Clojure runtime.
12:07tonylyeah, which is in itself a overhaul of implementation
12:08cemerickoverhaul of implementation of what?
12:08tonylto use clojure to reimplement the its runtime
12:09tonylall I am saying it is a heavy work to implement all at once
12:10fliebelcemerick: But with deftype and all in place, what is the next step?
12:12hiredmanhttp://dev.clojure.org/display/design/Compiler+in+Clojure
12:12jcromartieis clojure.contrib.sql the best way to access a jdbc database?
12:12tonyljcromartie: you can try clojureql
12:13jcromartieI take it that this means "superior to clojure.contrib.sql?" then "ClojureQL is superior SQL integration"
12:13cemerickfliebel: 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:13tonylI haven't use c.c.sql though so I am just going for what I've played with
12:14jcromartievery neat
12:14jcromartiec.c.sql is dead simple
12:14jcromartieclojureql looks much more sophisticated, though
12:14cemerickPeople have done spikes of some of those over the years, of course.
12:31jcromartieis there any connection pooling available with clojureql?
12:31jcromartiebecause it seems to take a really long time for each operation
12:32AWizzArdI would also be interested if it offers an easy access to cursors, to allow queries that return massive amounts of data.
12:32jcromartieI need to update lots of individual rows
12:33jcromartieand if it takes a 1/4 second each time, it would take days
12:34tonyljcromartie: I think you are looking for (open-global ...)
12:35jcromartiethanks tonyl
12:36tonylAWizzard: I read something about dealing with big queried data, let me see if I can dig it out
12:36jcromartieawesome
12:37jcromartie<3
12:38raekdoes someone happen knwo where you can get the source of PircBot?
12:40hiredman~google pircbot
12:40clojurebotFirst, out of 850 results is:
12:40clojurebotPircBot - Java IRC Bot Framework (Java IRC API for Bots)
12:40clojurebothttp://www.jibble.org/pircbot.php
12:45raekturns out it was in the jar afterall
12:49fliebelHm, cinc backends: Java source. Huh? Except that you could do GWT with it, what is the point?
12:54hiredmanfliebel: for rebootstrapping? clojure src -clojurec-> java src -javac-> bytecode
12:58chousersometimes 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:01lucianchouser: it lets you isolate mutable state easily
13:02chouserhow?
13:02clojurebotwith style and grace
13:03hiredmanclojurebot: botsnack
13:03clojurebotthanks; that was delicious. (nom nom nom)
13:03hiredmanchouser: well, uh, it seems like threadpools should be thread safe to begin with...
13:04chouseryou'd think
13:04hiredmanyou could wrap your threadpool in an agent... :|
13:05hiredmanyou can use locking
13:07dnolenanybody tried YourKit 9.5.2 with any Clojure 1.3.0 alphas?
13:08fliebelSome of the design pages have an issue named "Wait for new compiler" What's this about?
13:43javehello
13:43javeI'm trying to make a hello-world clojure applet
13:44javebut I'm getting reflection errors and the like
13:45javeive 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:48chouseryou must get rid of all reflection for an applet to work
13:48javeyes
13:49chouserset *warn-on-reflection* to true, and hint absolutely everything that needs it
13:49javebasically I'm following this howto:http://en.wikibooks.org/wiki/Clojure_Programming/Examples/Creating_an_Applet
13:49javeand it explains the need to warn for reflection
13:49javeso I'm doing that
13:50jave(set! *warn-on-reflection* true)
13:50chouserso you've gotten rid of all reflection warnings?
13:51javeI dont get any reflection warnings when compiling, only when trying to run the applet
13:51chouserweird
13:51chouseroh
13:52chouserthere could be reflection in clojure.core
13:52javebut maybe ive missunderstood where the "set!" goes? I put it in the src clj file
13:52hiredmanor some other lib you depend on
13:52chouseryeah, put it in the src clj, before your (ns ...) form
13:53chouserthat should find reflection in any deps
13:53chouserbut not core
13:53javebut 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:54javewouldnt you then get reflection errors from core as well?
13:54chouseryes, but reflection is a runtime thing -- if you call a function that I don't, you could trigger an error I never saw
13:54javehmm the hello world I copied used japplet as base not applet like you do
13:55javeand its also type hintefd
13:56chouserit'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:57javewell, I'm not geting any compile warnings
13:58javeheres the error btw:https://gist.github.com/730733
13:59chouserthat's not a reflection error
13:59chouserit looks like you're not including clojure.core in your .jar
14:00javethere is a reflection error in the middle of the trace
14:00javecore__init.class is included in the jar
14:01tonylFileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath
14:01tonylit looks like it can't find it
14:01javeyes seems so, but its there. so I assumed it couldnt because of the reflection error
14:02tonyli don't know about applets
14:02tonylhow are you running the applet?
14:02chouserI see NullPointerException and FileNotFoundException -- no security error from trying to use the Reflection class
14:02jave at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
14:02jave
14:03javetonyl: ive tried chrome, firefox and appletviewer
14:03chouserwhen using firefox to test, be aware of potential browser caching of your .jar
14:03tonylI mean the clojure/java instance
14:04javechouser: when trying appletviewer I do get: Caused by: java.lang.RuntimeException: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader)
14:04chouserah
14:04chouser*that* sounds like reflection. :-)
14:04javetonyl: how do you mean?
14:04tonyli mean the java -cp clojure.jar ...
14:04chouserjave: can you paste that trace?
14:04javechouser: hmm jar caching might be an issue
14:04javetonyl: no its an applet, so the browser starts it
14:05tonyloh yeah, I am seeing the clojurebook link now
14:06javehttps://gist.github.com/730746
14:07tonylyour code looks exactly like the code in that example link?
14:07tonylI am going to try it
14:08chouserjave: flib.downloadapplet is yours?
14:09javeyes
14:09chouseryou've AOT-compiled everything?
14:09RaynesOh man.
14:09RaynesApplets.
14:09RaynesSecurity nightmares.
14:09javeI can upload the pom.xml
14:11javehttps://gist.github.com/730755
14:12javeRaynes: 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:12chouserjave: 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:13javehmm your tree.jar doesnt contain any .clj files at all right? but mine does, so maybe that fcks up things
14:14chouserthere's not point in having any .clj files in your applet jar, unless you're signing it. Unsigned applet can't load .clj
14:14chouseryou must AOT-compile everything to .class files, and all required .class files have to be in that one .jar
14:15javeits a signed jar. and its all AOT compiled. however, the shade plugin includes the .clj files also. ill try to exclude them now.
14:15technomancyanyone 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:15Raynestechnomancy: ohai
14:15Raynestechnomancy: I has a request.
14:15technomancyhello
14:16Raynestechnomancy: 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:17RaynesIn order to be consistent with Leiningen project.clj files, I thought I'd ask how you feel about doing the same in Leiningen.
14:17technomancysure; I'm all about keeping things under 80 columns.
14:17RaynesGreat. If you want, I can see if I can find the relevant code in a little while and submit a patch.
14:18technomancyeither way. it won't land until Lein 2.0, which is a long long way out.
14:18RaynesNo hurry.
14:19RaynesAny particular reason though?
14:19RaynesIt isn't a breaking change.
14:19technomancyany reason for what?
14:19RaynesFor it to not be included into 2.0.
14:19technomancyno, I meant it would be in 2.0, but 2.0 is going to take a long time.
14:20Rayness/into/until/
14:20sexpbot<Raynes> For it to not be included until 2.0.
14:20technomancythat's the next release
14:20RaynesOh.
14:20RaynesI haven't kept up with your versioning antics.
14:23Raynestechnomancy: Submitting that patch would make me eligible for stickers, right?
14:24technomancynaturally
14:25javeaargh! if I simply excluded all the .clj files the applet works!
14:25javein appletviewer at least
14:25chouserjave: you saw what I said about .clj file never working in applets?
14:26javeyes
14:26javeso Thanks
14:26chouseroh, ok.
14:26javeI just assumed since I had the .class files, it wouldnt try to load the .clj files
14:26chouserso just AOT compile all those .clj's, and put the resulting .class files in the .jar instead
14:26chouserah
14:27javebut firefox still complains, but that might be a cache error
14:28chouserboo. resources supplied by maven aren't updated without rebuilding. :-(
14:28chouserugh, what a pain.
14:29cemerickchouser: "resources"?
14:29chousersrc/main/resources/my/ns/foo.html
14:30cemerickis that a result of autodoc, etc?
14:31chouserthe 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:31chousercemerick: no, hand written.
14:31chouserI guess I can save to both places every time I save
14:32cemerickThis is with your app running via clojure:repl, or otherwise?
14:33chouseryeah. actually running via clojure:run and my own main class now
14:34chouserwriting to the file's location in target works
14:34chouserof course writing *only* there will likely cause me to lose my edits later
14:34cemerickis this a webapp?
14:34chouseryes
14:35chouserhm, I bet a vim one-liner macro would let me work around this deficiency in maven.
14:35chouser;-)
14:35cemerickchouser: 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:36cemerickThe 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:37cemerickI'm not sure how that interacts with vim though...
14:37chousercemerick: will those extraClasspath items be inclued in the built jar?
14:37cemericknope, only in jetty:run invocations
14:38chouserok, I don't think that's what I want
14:38cemerickTo do the code-loading thing, you need to be remote-REPL-capable, e.g. via nREPL or swank-clojure.
14:38chouserI only have a couple static files for demoing what is otherwise an API service
14:39cemerickSo you're looking for assets to be loaded preferentially from src/main/resources?
14:39chouserI'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:40cemerickhrm
14:40cemerickisn't that called a .war?
14:40chouserbeats me. is it?
14:40cemerickheh :-)
14:41cemerickwar files are jar files with a standard internal layout suitable for deployment in servlet containers, such as jetty, tomcat, et al.
14:41chouserhm. I dunno
14:42chouserI 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:42chouserwhich is what I think I have right now
14:42cemerickchouser: 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:42technomancyjava -jar pacifist.jar
14:42jcromartieclojureql is my new best friend
14:42jcromartieand enemy
14:43jcromartiebut mostly friend
14:44jcromartieI'm building a data masking utility
14:44jcromartieit's tricky stuff
14:44cemerickchouser: 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:45chousercemerick: so ... my .jar would have jetty and a .war in it, and a class to point one at the other?
14:46cemerickIndeed. Hudson's .war is a variation of this (they actually unpack the .war to ~/.hudson, and run the app from there).
14:48cemerickI *think* that unpacking is an artifact of the app container they bundle (winstone instead of jetty)…?
14:49chouserok. so, I think I'll postpone that for now. Thanks for the tip, though.
15:06chouser,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))
15:06clojurebotjava.lang.IllegalArgumentException: More than one matching method found: schedule
15:06chouserany suggestions?
15:06hiredman.schedule can take a callabale or a runnable
15:06chouserI assumed hinting the fn to either Runnable or Callable would do it
15:06hiredmanright
15:06chouser,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s ^Runnable (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))
15:06clojurebotjava.lang.IllegalArgumentException: More than one matching method found: schedule
15:07hiredmantry runnable
15:07hiredmaner
15:07hiredmancallable
15:07chouser,(fn [^java.util.concurrent.ScheduledExecutorService s] (.schedule s ^Callable (fn [] (prn :hi)) (long 5) java.util.concurrent.TimeUnit/SECONDS))
15:07clojurebotjava.lang.IllegalArgumentException: More than one matching method found: schedule
15:07hiredmanhuh
15:08hiredmanI have a scheduledexceutorservice in clojurebot
15:08hiredmanuh, scratch that
15:08hiredmanscheduledthreadpool
15:08hiredmanhttps://github.com/hiredman/clojurebot/blob/master/src/hiredman/schedule.clj
15:09chousersame object, but you're not calling .schedule
15:09hiredmanah
15:09chouser.scheduleAtFixedRate has no overload
15:10chouserjust takes a Runnable
15:11hiredman,(fn [^java.util.concurrent.ScheduledExecutorService s ^Callable c] (.schedule s c (long 5) java.util.concurrent.TimeUnit/SECONDS))
15:12clojurebot#<sandbox$eval431$fn__432 sandbox$eval431$fn__432@133badd>
15:12hiredmanclojurebot isn't on 1.3
15:12hiredmanerr
15:12hiredmanthat wouldn't matter
15:12hiredmandunno, type hint wasn't taking...
15:13hiredmanmaybe the macro expansion of fn thrashes type hints
15:13chouserhm!
15:15chouser,(binding [*print-meta* true] (prn (macroexpand '^Integer (fn []))))
15:15clojurebot^Integer (fn* ([]))
15:15chousernice thought, but no
15:15chouseroh. does the hint there mean the function returns an Integer?
15:16hiredmanoh
15:16hiredmanyeah
15:16hiredmananother good reason to move function return hints to the arglist
15:16chouser^Runnable (first [(fn ...)]) works. :-P
15:17jcromartieLauJensen: ping
15:18hiredman(let [^Callable c (fn [] ...)] ...)
15:19chouserhiredman: yeah, that does too, which surprises me a bit
15:20hiredmantype hint on the name vs. the function object
15:21hiredmanor, the expression which yields the function object
15:21hiredmanhmm
15:51jcromartieI'm looking for an idiomatic way to apply a map of functions to another map, in order to transform certain keys
15:52jcromartieso, say I have a map {:foo identity :bar #(* 2 %)} and {:foo 5 :bar 9} I want {:foo 5 :bar 18}
15:53jcromartieI currently have: (into {} (map (fn [[k f]] [k (f (k record))]) col-transforms))
15:53tonyljcromartie: do you want to capture the results of those fn calls? or just to call them on those values
15:53jcromartieI want to return a new map
15:53brehautmerge-with ?
15:54jcromartieno I don't think so
15:54brehaut,(merge-with #(%1 %2) {:foo identity :bar #(* 2 %)} {:foo 1 :bar 3})
15:54clojurebot{:foo 1, :bar 6}
15:55jcromartiehm, nice
15:55tonylit works if the keys come in order like that
15:56tonylmy bad, merge-with deals with the keys
15:57jcromartiethat's perfect
15:57jcromartie(merge-with #(%1 %2) col-transforms record)
15:57jcromartiepretty readable
15:58jcromartiegreat :) this data masking is coming along nicely
15:58brehautim a little suprised you cant use apply as the function
15:58brehautoh
15:59brehautno im not
15:59jcromartieI'm confused as to why that doesn't work
16:00jcromartieoh wait
16:00jcromartieright
16:00jcromartie:P
16:00brehaut(source apply)
16:00brehautwill tell you :P
16:07LauJensenjcromartie: pong
16:08jcromartieLauJensen: hi, thanks :)
16:08jcromartieI had some ClojureQL questions
16:08jcromartieparticularly extending it
16:08jcromartiesay, for instance, I have a function that creates predicates
16:08LauJensenjcromartie: Sometimes you can get help in #clojureql, even if Im not there
16:09jcromartieoh cool
16:10jcromartiehmm, now I'm not sure exactly what I had in mind
16:12LauJensenjcromartie: what was the question again? :)
16:13jcromartiewell, 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:13jcromartieso I made a function to create a (where ...) predicate from a record
16:13jcromartieso that it matches exactly
16:14jcromartiejust not sure if there's a clean way to "extend" clojureql with that kind of thing
16:14jcromartieI'm new to protocol/record programming
16:14jcromartieso I might be able to answer my question by reading the code :)
16:15LauJensenWhat is missing from the Predicate protocol since you need to extend it?
16:17jcromartiewell 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:17jcromartieso each record identifies a row in the table
16:17jcromartieand so what I need is to match those exactly, so I am building the predicate dynamically
16:18jcromartielike this https://gist.github.com/79667390ab7e2887d065
16:29LauJensenjcromartie: comment on the gist
16:30jcromartiethat looks good
16:31jcromartieI guess I'm over-complicating my thinking :)
16:31jcromartiewhat's the and* syntax?
16:32LauJensenjcromartie: 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:33jcromartieah, cool, thanks that's very helpful
16:33LauJensennp
16:40rata_hi all
16:40rata_$({0 1} 0.0)
16:40rata_&({0 1} 0.0)
16:40sexpbot⟹ nil
16:41rata_why is that?
16:41tonyl&[(type 0.0) (type 0)]
16:41sexpbot⟹ [java.lang.Double java.lang.Integer]
16:42tonylthey are different types
16:42jarpiain&(map hash [1 1.0])
16:42sexpbot⟹ (1 1072693248)
16:42tonylthat would be my guess
16:42rata_mmmm... but shouldn't the key comparison fn be = ?
16:42jcromartieuh oh, my baby is to the point where she wants to type on the keyboard like daddy
16:42chouser&(= 0 0.0)
16:42sexpbot⟹ true
16:43chouserrata_: this is changing in 1.3, will use =, but (= 0 0.0) will be false
16:43zerokarmaleftjcromartie: http://www.hanselman.com/babysmash/
16:43tonylhashmaps use hashcode as they key comparison
16:44technomancyjcromartie: time for a decoy keyboard
16:44jcromartiezerokarmaleft: awesome :)
16:45rata_mmmmm... bad thing, because numbers change so easily their type
16:45LauJensenjcromartie: I pushed a fix, so the code I gisted will work on MASTER
16:46technomancyit's not the number's type, it's precise vs imprecise IIUC
16:49chouserequality on floating point numbers is lousy anyway, even if fixed-point numbers aren't involved at all.
16:54bortrebhey, 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:56chouser(doall (take n (iterate ...))) will happen exactly n times
16:56chouseror you can loop/recur
16:56bortrebwill it really? I thought lazy sequences sometimes "chunked" and calculated more than they strictly have to
16:57chouseryes, but it depends on the source of the seq. vectors, for example, can produce chunked seqs, as can 'range'. But 'iterate' doesn't.
16:58bortreboh ok
16:58chouserbut if it makes you nervous, and you really need *no* laziness, loop/recur seems reasonable
17:02jcromartieis there a paredit command to move the expression at the point forward or backward?, like turn (foo |bar bat) into (foo bat |bar)
17:02jcromartieor something
17:05arbschtjcromartie: what about transpose?
17:06jcromartiethanks, that's what I was looking for
17:06jcromartieC-M-t
17:06jcromartieparedit and clojure are making me happy today
17:06arbschtI think that's a builtin emacs thing
17:08jcromartieoh cool
17:08edwOn Ubuntu, what JDK is recommended for Clojure?
17:09jcromartiethen Emacs, paredit, and Clojure :)
17:09maaclIs there a function that flips keys and values in a map?
17:09brehautedw: openjdk6 ?
17:09bortrebjava version "1.6.0_20"
17:09jcromartie,(into {} (map reverse {:foo :bar :bat :baz}))
17:09clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.util.Map$Entry
17:09jcromartiewhee
17:09bortrebis what i'm running on ubuntu and it works great
17:10edwWhen I install openjdk6 I got this error: "Warning: problem requiring hooks: java.lang.IllegalAccessError: extract-javac-tasks is not public".
17:11bortrebtype java -version
17:11bortrebyou might be not actually running sun's version
17:11edwjava version "1.6.0_20"
17:11edw"OpenJDK Runtime Environment (IcedTea6 1.9.2) (6b20-1.9.2-0ubuntu1~10.04.1)"
17:11bortrebyeah
17:11edw"OpenJDK Client VM (build 19.0-b09, mixed mode, sharing)"
17:11bortrebyou're running the IcedTea
17:11bortrebversion
17:12mrBliss`maacl: clojure.set/map-invert
17:12bortrebwhich I've never found all too reliable
17:12edwUmm, that means nothing to me. I'm a FreeBSD/Mac guy, I'm clueless about this.
17:12technomancyopenjdk works great with Clojure
17:12edwHow do I get Sun's version?
17:12brehautedw: openjdk is suns version
17:12edwAh.
17:12maaclmrBliss`: thanks
17:12bortrebsudo update-alternatives --config java
17:13bortreband you can change versions to sun's
17:13edwThere is only one alternative, it says.
17:15brehautedw 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:17edwHmm, it may be Hadoop that's not liking the OpenJDK; an empty lein project REPLs just fine...
17:40edwOK, I jumped through a lot of hoops and am now installing the Sun JDK.
17:48tscheiblwith-bindings vs binding ???
17:50brehauttscheibl: it depends on your needs?
17:51brehauttscheibl: i think binding is more common though
17:51tscheiblbrehaut: what exactly is the difference?
17:52brehautone takes a map as its first arg, the other a vector of vars and expressions
17:52tscheiblbrehaut: that's it?
17:52brehautappears to be
17:53tscheiblbrehaut: quite redundant then.. isn't it?
17:54tscheiblbrehaut: with-bindings was added in 1.1 ...does that mean it could be an improvement in style?
17:54brehauttscheibl: well, i think it means you can build the map up programmatically without need for macros
17:54tonyli think with-binding doesn't create a new thread binding, it just replaces the current val bounded to that var
17:55tscheibl... h,mm could be
17:55tonylthen it pops out that new binding
17:55javechouser: do you remember which clojure.jar you embedded in your tree.jar example?
17:56tonylbut that is what I take from reading the source
17:56brehauttonyl: i thinkyou are right
17:57tscheibl~(with-bindings {a 42} a)
17:57clojurebotExcuse me?
17:58chouserjave: I don't, but I'm sure it was 1.1, 1.0, or even lower.
18:04javeok
18:04jcromartiehm
18:04jcromartieI thought clojure.string/join was a real thing
18:05javeI'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:05jcromartieI was just using it, but then I quit the REPL and restarted it, and now it says "java.lang.ClassNotFoundException: clojure.string"
18:06jcromartiestarted from lein repl each time
18:06jcromartieheh, it's always fun to restart your repl and find what code breaks
18:06technomancyjcromartie: clojure.string is not loaded until you ask for it
18:06jcromartieyeah
18:07technomancyif you have any code that uses it, you must require it in the ns form
18:08jcromartieyeah, I had just been using it in files loaded from a repl where I must have require'd it
18:08jcromartieI didn't ever have a require directive in the files themselves
18:10ddonnellis there a way to get the count of the queue an agent uses to process it's tasks?
18:16ddonnellfound the answer in the source
18:17ddonnell(.getQueueCount a)
18:27tscheibl~(with-bindings {(def i) 42} i)
18:27clojurebotdanlarkin uses jrockit
18:27danlarkinwhat the heck
18:29technomancyclojurebot: libelous statements like that are dangerous.
18:29clojurebotGabh mo leithscéal?
18:32tscheibl..I'm beginning to understand...
18:33tonylI didn
18:33tonylI didn't know def returned something
18:33RaynesEverything returns something.
18:33tscheiblreturns a var
18:34tscheiblobviously
18:40tscheiblto be precise a clojure.lang.Var
18:41tscheiblwith 'binding' you would have to def the var in advance
19:35tscheiblgn8
20:01joshua__How do I select and deindent blocks of clojure comments in emacs?
20:01joshua__I'm using clojure mode.
20:05joshua__Or how can I do the reverse?
20:07technomancyjoshua__: M-; toggles commentedness of the region
20:13pdksounds like he wants to keep them commented but reindent them
20:15technomancyM-x reindent-region
20:26jcromartiewhat's the story with startup .clj files? like, something that will load automatically when I run lein repl?
20:27jcromartiedurrr
20:27jcromartie Set the :repl-init-script key in project.clj to point to a file if you want code executed inside your project.
21:40dnolenhmm YourKit 8 works but not 9.
22:28will_lI'm new to clojure, and I cant figure out why this is throwing a null pointer exception: https://gist.github.com/731409
22:29kevinjqi'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:29hiredmandef is not a function
22:30hiredmanthere are a number of ways to understand what is going on there, by far the best is to write a lisp interpreter
22:31kevinjqis there a way to sort of "dynamically" create a var?
22:33kevinjqsorry, accidentally went offline...
22:36jcromartieis clojure.inspector dead?
22:36jcromartiethe buttons don't seem to do anything
22:36jcromartiebeen that way for a long time
22:38dnolenwill_l: ah the dreaded null pointer exception inside of a lazy sequence.
22:38will_ldnolen: dreaded doesn't sound good
22:39dnolenwill_l: you probably have an unexpected nil somewhere.
22:39dnolen,(instance? nil 'a)
22:39clojurebotjava.lang.NullPointerException
22:39dnolen,(instance? Object 'a)
22:39clojurebottrue
22:39will_loh, it's probably then (first (intersection set1 set2)) being nil
22:39will_li'll look there, thanks
22:41dnolenkevinjq: 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:42kevinjqdnolen, searching around, i found this http://stackoverflow.com/questions/2486752/in-clojure-how-to-define-a-variable-named-by-a-string
23:02joshua__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:04joshua__UPDATE: I figured it out! Turns out that item 154 in the sequence was trying to perform an operation on a nil.
23:04joshua__dnolen: I could kiss you, but since your not a girl I won't.
23:05joshua__*would even
23:05joshua__dnolen: Thank you so so much.
23:05dnolenjoshua__: heh, yeah, once you get burned by that one, you start knowing what to look for.
23:06joshua__(I think its sorta hilarious how fast I found it after being given that clue after hours of ... nil)
23:09joshua__dnolen: How long ago did you talk to will_l about the null pointer exception?
23:09will_lit was 20 min ago. I got it figured out :)
23:16joshua__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:19joshua__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:27dnolenjoshua__: 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:40ckyjoshua__: http://refactormycode.com/
23:44coldheadjoshua__: i think you're better off learning good habits and right ways and idioms through reading code by other people
23:47ckycoldhead: I think there's a place for both.
23:48joshua__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:48ckycoldhead: Sometimes, learning by osmosis isn't enough. :-)