#clojure logs

2010-03-14

00:00psykoticin that example you posted, i don't see how readability is improved
00:04somniumhmm, not much I agree, but it saves 5 parens or so :)
00:04somniumanyway, just a random thought. not something I plan on using atm
00:07psykotici think the unrolled plist-style that clojure uses for conds, lets, etc, but not a big fan of 'unstructured' separators like that
00:07psykotics/i think/i really like/
00:12somniumI think I like the separators better than so-called sweet-expressions, if there were reader macros they could be newlines. sometimes I just get a kick out of just playing with syntax
04:03vyHow can we submit issues to http://github.com/technomancy/slime project? It's the SLIME distributed with ELPA, ain't?
04:03vybitbckt:
04:33kwertiivy: there's an issue tracker at that page
04:36vykwertii: Would you mind telling me where it is, please?
04:37kwertiivy: ahh, that's a fork. you have to go to the original
04:37kwertiiit says "forked from nablaone/slime" .. go there... and then there's a button that says "issues"
04:37kwertiibut that fork doesn't seem to belong to the original author
04:38kwertii"unofficial repository, updated daily (import from CVS) "
04:38kwertiilooking at the README in the archive, there is a mailing list at http://common-lisp.net/mailman/listinfo/slime-devel that might be what you want
04:44vyHrm... No, I want to submit issues for technomancy's fork.
05:22psykoticmmm, (run-seq (mfilter (const [false true]) [1 2 3 4]))
07:33TDThey all. I've been trying to get clojure working for about a week now. I really am trying to get it to work in swank/slime and have had mixed results. I've followed about 5-6 different blog posts on various ways of setting it up. Is there a good definitive source that's fairly recent on getting this setup? I'm specifically running into an issue saying that swank/swank.clj is not in my classpath - but kinda feel like starting over
07:33TDTand trying again.
07:38LauJensenTDT: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/
07:39ttmrichterWhat is swank/slime?
07:39ttmrichterQuick glanceover with Google makes it look like an emacs thing. Is that right?
07:40arbschtttmrichter: yes
07:40ttmrichterAh. Thanks.
07:40TDTLauJensen: Thanks, I watched another video that tended to be out of date in the end, I'll take a look at this one. Thanks for the link.
07:40LauJensenTDT Np - The good thing is, that if the install 'just works', then you're done in a couple of minutes, if it breaks, I show you how to fix it - If you run into trouble let me know
07:51TDTLauJensen: Using the ELPA is something I've done in the past as well, this worked out well - I removed all my previous installations of clojure/etc as well as my setup for common lisp, and this worked well. I'd like to try and get it working hand in hand with my current common lisp stuff, but what I may just do for now is pull this all to its own config, and load package.el and battle the coexistence problem later.
07:52TDTLauJensen: Thanks for the video, that di dhelp - going to watch the rest of it to see the problems you mentioned earlier but for now it works.
07:53LauJensenTDT: http://nakkaya.com/2010/02/07/using-multiple-lisps-with-inferior-lisp/
07:53LauJensenThat might help you with the CL issue - Glad the video helped
07:54psykoticre: ELPA, auto-install is more useful at the moment because of how few packages are on ELPA, but auto-install is a bit too anarchaic
07:54psykotici mean, damn, the standard use case is to set an emacswiki url as a source. that's too exploitable with eval injections it's not even funny, heh.
07:55TDTLauJensen: Looks like that post directly talks about clojure as well, as long as swank-clojure-project correctly picks the right slime it should work fine. I'll give that a try after finishing the video.
07:56LauJensenpsykotic: Emacs will automatically detect any evil intentions and erase the harddrive of the guilty party
07:57psykoticLauJensen: yeah, i saw that in the latest cvs head :)
07:59psykoticLauJensen: i have a few emacs projects i hack on from time to time--one of them is a simple slideshow app. it looks surprisingly good since truetype fonts are available!
08:00LauJensenWhat kind of slideshow?
08:00psykotici mean like powerpoint, keynote
08:00psykoticactually, it's written as an org-mode exporter.
08:00psykoticso i piggyback on their mark up and structure
08:00psykoticorg-mode already has a beamer/latex exporter for slides, but i thought it would be fun to have it be live and in emacs itself :)
08:02psykotici'm entirely too infatuated with org-mode
08:02ChousukeI should use org-mode more, but...
08:06LauJensenhehe
08:07LauJensenChousuke: Put it in your TODO list
08:07psykoticdoh! :)
08:08Chousuke:P
08:13LauJensenpsykotic: Although the idea sounds nice, how about just doing a 1:1 port of Keynote and Open Sourcing it ?
08:13ChousukeLauJensen: Delivered with a complimentary pony, obviously
08:13psykoticsomeone actually did a web app that's almost like that (the cappucino guys), but not open source
08:15psykoticLauJensen: 99% of the keynote slides i've seen have all used the default template with hardly any fancy stuff, except maybe some nice antialiased, rounded graphs
08:15TDTLauJensen: Do you use lein for your project management within clojure?
08:15psykoticor maybe it's that i wouldn't recognize keynote slides that don't use the default template :)
08:15LauJensenYou're the odd-ball - Slides need to be pretty and catchy
08:15LauJensenTDT: Clojuresque and Lein
08:16psykoticpretty and catchy usually means simple
08:16psykoticlittle clutter, lots of whitespace. i don't think the tech part of it factors heavily into it.
08:17psykotici used to work at a big company where everyone did slide-based presos all the time, it was hell
08:17psykotic99% of them were engineers, and they liked to stuff 10 items into each slide. the worst feature in the world is powerpoint's autoshrinking font size feature, where you can just keep adding items and they will fit in the slide
08:17psykoticthe mere absence of that feature in keynote is a large part of why keynote slides are better
08:51callenshould I just use ClojureX?
08:51callencontrib is being cantankerous for both emacs and on my side.
08:52callen"build.xml does not exist" yeah thanks. the maven build worked fine though, but emacs isn't smart enough to try that.
08:57TDTLauJensen: One last question if you don't mind. I worked off your .emacs file and created a project, lein new test-proj, cded into that directory and ran lein deps, then in emacs ran swank-clojure-project, pointed it to the root of that directory, and swank started. It's trying to do a (require 'swank.swank), which is failing saying that swank/swank.clj isn't there. I found the file in my .emacs.d/swank-clojure/src, so I added it to
08:57TDTthe my swank-clojure-classpath at the end: "~/.emacs.d/swank-clojure/src/*", but am still getting this error. Have you encountered t his issue before?
09:00LauJensenTDT I've never experienced that
09:02TDTAh ok, I'll tinker a lot more then, slime, by itself, runs fine..I have a feeling it has to do with elpa since I'm not requiring slime earlier. I disabled elpa, required slime and stuff broke so I just need to pull wht elpa is doing out likely.
09:03LauJensenTDT - Make sure that your lein project has swank as a dev-dependency and that you're run 'lein deps'
09:03LauJensenYou can find the 'Reddit Clone in 90 lines of clojure' post on my site for a quick demo of how to set it all up
09:03LauJensen(as well as a cloneable git repo)
09:05TDTgood catch you're right the swank wasn't as a dependency. In your .emacs config, did you move away from using elpa in the end or are you still using whatever it gives you in conjunction with your customizations in your post?
09:05LauJensenStill using the same setup
09:06rhickeythis looks like it could use some help, type hints, modern interop style etc - http://www.paullegato.com/blog/yahoo-finance-clojure/
09:06TDTLauJensen: k, I'll stick with it then as well. Thanks
09:07LauJensennp
09:46callencoming to clojure from python, when I'm dealing with a java date object, how can I see the methods that the object has?
09:46callenpreviously, ipython provided tab completion to see all the available methods, metadata, class variables, etc.
09:50rhickeycallen: if you use enclojure it will do completion for both Clojure and Java stuff
09:51rhickeyLa Clojure w/IntelliJ probably will as well
09:51callenrhickey: excellent, thank you. Due to not being a java coder I'm having to learn what goes to what, and basically learn two languages at once.
09:53etatecallen: i'd focus on using what you can from clojure before resorting to Java, though for date stuff incanter has a chronos lib which binds to joda time :)
09:53callenrhickey: is there a way to have method completion, without departing slime or the repl?
09:53callenrhickey: is there just some object metadata that I can invoke?
09:53callenrhickey: python equivalent being _meta
09:53rhickeycallen: also, repl-utils from contrib will give you the show and javadoc functions - http://richhickey.github.com/clojure-contrib/repl-utils-api.html
09:54callenbecause ipython introspects using standard metadata attached to the objects at runtime, tool agnostic that way.
09:54callenoh bugger, contrib. I don't think that's in my class-path yet.
09:58callenaha, contrib is on my cp now.
09:58RaynesWhat is the best way to check if a element is in a sequence? For example (any? \x coll).
10:01callenare there any paste services that accommodate clojure?
10:01callenn/m, got one.
10:02psykoticRaynes: (some #(= x) coll)
10:02callenhttp://www.dpaste.org/E7I6/ <- http://richhickey.github.com/clojure-contrib/repl-utils-api.html
10:02psykoticerr, make that (some #(= x %) coll)
10:02Raynescallen: gist.github.com, hpaste.org (I think), programble.co.uk/paste, paste.pocoo.org, snipt.org, etc.
10:02callenRaynes: already got one. see above for paste.
10:03callenRaynes: dpaste supports it.
10:03psykoticgist has stolen my heart.
10:03psykotici doubt i'll ever use another patebin
10:03Chousukegist is fun in that you can actually clone the gists :P
10:03Chousukeand push to them
10:03Raynes http://www.acidrayne.net/wiki/doku.php?id=pastebins I keep a list here.
10:03RaynesNot that all of them support Clojure, but most of them do.
10:03callenthat's pretty cool @ gist. I might switch to it.
10:04callenanyone have any idea Re: my error?
10:04psykoticit's especially nice if you already have a gist account
10:04psykoticerr, github account
10:04callenclojure-contrib is on the classpath.
10:04Raynespsykotic: Thanks.
10:04ChousukeClojurebot started as a gist, but then I cloned it and pushed it into a proper github repo
10:04psykoticRaynes: fwiw, there should still be a builtin for that idiom
10:04Chousukethat's why the first commit messages aren't very informative :P
10:04psykotici'm sure there is in contrib but imo it should be in core
10:04Raynespsykotic: Agreed.
10:05psykoticRaynes: btw a nice thing about some is that it doesn't just return 'false' or 'true' but it turns the first logically true entry
10:05ChousukeI also like M-x gist-buffer
10:05RaynesEh.
10:05callencannot create ISeq from clojure.lang.Symbol after attempting to create a namespace with require repl-utils.
10:05callenWat.
10:05callenoh hoh.
10:05callenit works in a repl
10:06callenbut not in slime.
10:06callen#!@$
10:06psykotic,(some :b [{:a 1} {:b 2} {:c 3}])
10:06clojurebot2
10:06callenpsykotic: is cljbot isolated safely?
10:06psykoticrhickey: since you seem to be here, is there any reason you didn't make every? symmetric with some?
10:07psykoticadmittedly the use case for every is less useful, but it's an odd asymmetry
10:08psykoticChousuke: auto-install.el even has support for installing from gist!
10:12Rayneshttp://gist.github.com/331995
10:12RaynesEh, wrong channel.
10:12callenugh.
10:13rhickeypsykotic: it's some, not some? and that is the difference. some returns the return value of the test fn, not necessarily true/false
10:14psykoticrhickey: i said some. the ? was a question indicator. :)
10:14rhickeyok, well, same answer
10:14rhickey:)
10:14psykoticwell, my point is that and : or :: some : every?, or well, that's the natural symmetry
10:14Raynescallen: clojurebot is sandboxed.
10:15rhickeybut some does more than t/f
10:15psykoticjust as (and true x) returns x, i'd expect every to return the last logically true element if all preceding ones were logically true
10:15callenthe tutorial I'm reading doesn't appear to have described how to make comments in clojure. google was similarly unhelpful (clojure.org/api, oh come on.)
10:16callenhow do I make a comment?
10:16rhickey;comment
10:16Raynescallen: ;
10:16Raynescallen: And (comment ..)
10:16callenI saved a class path printer. And thank you.
10:16Raynes(doc comment)
10:16clojurebot"([& body]); Ignores body, yields nil"
10:18rhickeypsykotic: ah. so you want every like some, could do, not sure about the utility of that value though
10:18callenrhickey: I was reading a paper on programming paradigms, explained type safety, expressiveness, their relationship, etc. With respect to concurrency, it praised the model you use in clojure.
10:18callenit seemed to think STM was the future.
10:19rhickeycallen: where was that?
10:19callen(without explicitly mentioning clojure, I don't think clojure existed when the paper was written)
10:19psykoticrhickey: i agree it's less useful but it just seems like an unexpected asymmetry. principle of least astonishment and all that.
10:19callenrhickey: it was a "least you should know about programming paradigms" or some-such, I'll look it up.
10:19callenrhickey: it did a good job of explaining why I don't like haskell, indirectly. (again without naming names, really.)
10:20psykotichaskell is pretty pluralistic about concurrency.
10:20callenaha, 2009.
10:20callenpsykotic: I'm referring less to concurrency when I speak of haskell
10:20callenpsykotic: and more to it being the BDSM of programming languages.
10:20callenhttp://lambda-the-ultimate.org/node/3465
10:20psykotichardly
10:20callen2009, I was wrong, clojure was extant.
10:21callenpsykotic: tch. I'm here for a reason. anyway, linkage above.
10:21psykoticpascal is more bdsm than haskell. in pascal the types are just sitting there as pences.
10:21callenrhickey: ^^
10:21psykotic*fences
10:21callenpsykotic: pascal at least didn't pretend it wasn't being executed by a computer. pascal's type system was horrid, but that's another matter.
10:21psykoticin haskell you have things like type-directed dispatch via type classes and how it interacts with type inference. it has a pretty good bang to buck ratio, even if you're not a type fan.
10:21rhickeypsykotic: least astonishment depends on where you come from - http://www.lispworks.com/documentation/HyperSpec/Body/f_everyc.htm#every
10:22callenrhickey: have you seen the paper I linked to above before?
10:22rhickeycallen: yes, thanks
10:22callennp.
10:22psykoticrhickey: cl's standard library is pretty horrible, i'm not sure it's much of a yardstick :)
10:22callenit more or less summarized the 'ick' I was experiencing.
10:22Raynes#letsargueabouthaskell
10:23callenRaynes: yeah I'd rather not.
10:23callenanyway.
10:23psykotici often wonder how cl would have changed if they had adopted richard waters's streams proposal
10:23psykoticit lets you program in a style very similar to lazy sequences in clojure
10:23rhickeypsykotic: I disagree
10:23callenhttp://gist.github.com/332001 <--- clojure-contrib is in the class path, what gives?
10:23psykotics/streams/series/
10:23rhickeyIt may be limited, but not horrible
10:23rhickeysome of it very well considered
10:24psykoticrhickey: fair enough, yeah
10:24callenI think having good judgment with respect to libraries is more important than making it expansive.
10:24callen.NET and python are good examples of what can go wrong there.
10:24psykoticits paucity is a good example of why it's important to have a very strong and versatile standard library though. despite their being good extension libraries around, some quite widespread, a lot of programmers stick to the standard library and make their code much less expressive for it.
10:24rhickeypsykotic: an interesting exercise would be - define every (no ?) as you describe. Would anyone prefer it to every? ?
10:25callendid guido *ever* sit in #python and respond to people?
10:25psykoticcallen: probably in 93 :)
10:25rhickeypsykotic: agreed, but there I would say the main liability of CL lib is age, not design. For its age, a great design
10:25callenpsykotic: I'd be surprised if he did. He doesn't seem the type to actually care to talk to anyone.
10:26psykoticrhickey: well, i have some bones to pick with it. a lot of it is very "first-order". things like loop and format.
10:27psykoticit's interesting to read steele's comments on that aspect.
10:27psykotiche attributes it to a lack of practical experience with that programming style among lispers--which is probably true.
10:27rhickeypsykotic: but being a Lisp-2, that is the style. There was Scheme for the other style, after all. What matters is consistency
10:27psykoticrhickey: you know the standard appendix with the SERIES proposal, right?
10:27vyrhickey: I still couldn't understand how CL commitee managed to miss the networking (and threading) stuff in the standard. Sometimes I'm wondering if they ever would have made such a stupid mistake as imagining a software future without networking?
10:27psykoticit's much higher-order.
10:28rhickeyGiven all that CL had on its plate, I think they did a great job
10:28psykoticoh sure
10:28psykoticit's amazingly good
10:28psykotici'm just not sure using it as a model for 2010 is necessarily the way to go. you seem to have liberally broken with convention and tradition where it made sense.
10:29rhickeySERIES is neat, but a lot of macrology to enable the inlining. I wouldn't consider it really higher order, but I'm not too familiar
10:29callenpsykotic: given that I know more scheme than CLOS, this doesn't hurt me.
10:29psykoticright, i should say it gives a similar STYLE to higher-order programming but it's first-order by design.
10:30psykoticthe whole compiling thing is pretty crazy but an obvious artifact of the performance obsessiveness of the lisp heads at the time.
10:30rhickeypsykotic: the test for every is as I said about - would people prefer and use a non-predicate every vs every? I think the would instead argue for a predicate some?
10:30rhickeythey would
10:30psykotici don't disagree. actually, i think what bothers me most is the visual asymmetry :)
10:31psykoticthe semantics are a corollary, or vice versa, heh
10:31psykotici also think any/all are prettier, shorter and more symmetric, but again that's a haskell vs cl heritage thing
10:38callenokay, I've tried loading the class path from the manual install, and from clojurex.
10:39callenit cannot find clojure.contrib nor clojure.contrib.repl-utils
10:39callenclojure appears to otherwise function.
10:40callenhttp://gist.github.com/332001
10:40callenis there some procedure for testing/dealing with class loading issues?
10:41psykoticrhickey: srfi-1's every seems to have the semantics i mentioned. http://srfi.schemers.org/srfi-1/srfi-1.html#Searching
10:48callencannot validate pom.xml in mvn package attempt for latest git clone of clojure-contrib.
10:49calleneven using the distro default install of clojure does not seem to be able to load my clojure contrib.
10:52psykotici had problems building clojure-contrib a few days ago from the github head. try switching to the 1.1.0 branch or something.
10:52callenpsykotic: I've got 4 installs of clojure running around, all in an attempt to get clojure.contrib to work.
10:52callenpsykotic: your name is illustrative of my state of mind in trying to get this to work.
10:53psykotici'll take your slight of haskell as the ravings of a madman, then :)
10:53callenI'd be delighted if we didn't bring that discussion up again.
10:53callenI'm here for clojure, not Simon.
10:54psykoticso you're sure you have clojure-contrib.jar in your -cp?
10:54callenpsykotic: as I said before, it was in the list, right before the clojure.jar
10:55psykoticdude, you're typing (:require ...)
10:55callencargo cult. got it from the repl-utils page.
10:55psykotic,(doc require)
10:55clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Cloju
10:55callenI'm in the shotgun blast and pick apart the remnants stage of learning the language.
10:55psykoticyou're typing it as a keyword.
10:56psykotic,(:require {:require 42})
10:56clojurebot42
10:56callenpsykotic: okay, how do I invoke the stuff in repl-utils?
10:56callenbecause it says none of the stuff in there exists.
10:56psykoticfor a start, use require rather than :require
10:56chouserrepl-utils is one of the rare cases that I recommend a naked 'use'
10:56callenClassNotFoundException for (require clojure.contrib.repl-utils)
10:56rhickeycallen: (require 'clojure.contrib.repl-utils)
10:57callensymbol.
10:57callenbugger.
10:57psykoticif you looked at (doc require) it has a straight-up example
10:57callenthrows a verify error, no idea if that indicates anything meaningful.
10:58callenpsykotic: what does that colon do?
10:58callenit makes doc fail, for one.
10:58callenso obviously it's syntactically significant.
10:59psykotic,(class :x)
10:59clojurebotclojure.lang.Keyword
10:59psykotic,(class 'x)
10:59clojurebotclojure.lang.Symbol
10:59psykoticit's the difference between specifying a keyword and a symbol
10:59callenokay but with respect to require?
10:59psykotickeywords in operator position act as lookup operations
11:00psykoticthe standalone require doesn't use it. you're probably thinking of (ns foo (:require ...))
11:00callenright.
11:00callenwhy is it needed as part of a namespace (lookup operation?)
11:00psykoticthere it's acting as a 'key'. it's not a function in itself, it's interpreted by the ns macro
11:00callenah.
11:00callenso it's a way of passing it unevaluated to the macro?
11:00callenmuch like symbol, but for...other things.
11:00callen*twitches* I think?
11:01rhickeykeywords evaluate to themselves
11:02callenso what is its purpose as before a require in the operator area for a namespace?
11:02psykoticin the case of macros, i think it's mostly just a convention. it's possible to use symbols there.
11:02callenis it just a way of creating a reference that the macro can use without executing the require statement?
11:02rhickeycallen: ns is a macro and has its own internal syntax, which uses keywords. it is not a block of code, parts of which you could take out and use elsewhere
11:03callenwell I gathered that it was a macro, I'm just trying to understand where the keyword fits into that. Am I correct in my summarization above?
11:03callenugly word, summary.
11:05rhickeyno, a macro just takes forms as data and interprets them as it sees fit. It is a little program that takes data structures and returns other data structures. So, it takes lists and vectors and symbols and keywords and assigns its own meaning to them. It is not leveraging a special property of keywords
11:06rhickeyns need not evaluate any of the data forms it is passed
11:06callenwell, you pass a require into a namespace in order to make use of what the library provides in a sanitary area, right?
11:06callenI guess what I'm wondering is why you're keywording the require.
11:07rhickeyso it doesn't look, to a more experienced Clojure programmer, like a call to the require function, because ns is not a code block
11:07psykotici.e. it's convention
11:08callenah, okay. thank you.
11:08callensorry to be such a pain, but I very much want to understand what's going on.
11:08rhickeyelse they would be tempted to put other function calls in there, which won't make sense to ns
11:08callenI don't like riding on cargo.
11:10callenokay, I can get repl-uitls to require.
11:10callennone of the relevant public stuff seems to work though.
11:10callennothing in this context.
11:10callenunable to resolve symbol.
11:11rhickeycallen: are you just winging it without a book or tutorial?
11:11rhickeyor reading the online docs?
11:11callenonline docs.
11:11callenand tutorials.
11:11callenwent through one tutorial, it covered the basics of the data types, operations, etc. I'd done scheme before, nothing unfamiliar there so far.
11:12rhickeyrequire will load the library but not pull all of its names into your ns
11:12callenthat's the kind of thing the tutorials I've read have not covered.
11:12psykoticrhickey: i'm looking at the yahoo finance guy's clojure code and there are some funny java slips
11:12rhickeyyou could do that, at some cost of pollution, by using 'use' instead
11:12psykoticrhickey: like in his big (str ...) call to construct an url by concatenation, there's a + between two elements :)
11:12callenrhickey: how do I reference the namespace/path to the library? Or better yet, where can I find a book/tutorial that teaches me these kinds of things.
11:13callenI swear to god, I read another tutorial that can be boiled down to, "LOL PREFIX NOTATION" I'm going to get stabby.
11:14rhickeya cleaner way is to use an alias for the namespace with require :as - (require '[clojure.contrib.repl-utils :as repl])
11:14rhickeythen (repl/javadoc String)
11:14callenaha, just like python. excellent.
11:14callenseriously though, is there a book/tutorial that'll go more in-depth than what I've found so far?
11:14callenI don't really want to keep pinging the channel like this.
11:15rhickeyhttp://pragprog.com/titles/shcloj/programming-clojure
11:15callenis the pragprog book on.....I was just about to ask.
11:15callendid Halloway do a good job?
11:16rhickeyyes
11:17callenexcellent. thank you.
11:17rhickeypeople have liked this also: http://java.ociweb.com/mark/clojure/article.html
11:17rhickeyhttp://stackoverflow.com/questions/599519/which-tutorial-on-clojure-is-best
11:19callenI'd found that before.
11:19callenI don't do video, it's too slow.
11:19rhickeyfaster than IRC sometimes :)
11:20callenI'd already said I didn't like pinging you guys. :(
11:20rhickeycallen: we don't mind really
11:21callenrhickey: fsm bless you.
11:21rhickeyand the ns stuff is the trickiest bit, that and classpaths
11:21callenrhickey: somehow I managed to trip over both right off the git.
11:22callenwait a tic. has anyone used clojure on android yet?
11:22callenoh hoh, there's a framework.
11:22callencool. #_#
11:36remleduffI've heard that the dalvik vm is bad at both jit and gc, which are two things that closure uses heavily
11:36callenrhickey: what guided many of your decisions wrt language design? I'd like to read the same material, perhaps understand your mindset better.
11:38callenremleduff: dalvik sucks period.
11:39AWizzArdcallen: also take in mind that Rich is an exceptional talent and has very much experience. I think this adds to and trancends reading books alone.
11:40callenAWizzArd: I can't download experience. I took that part for granted. All I can do is look to his personal library.
11:40rhickeycallen: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH
11:40RaynesI believe someone asked the same question a while back. I don't think it was books that inspired Clojure, as much as it was personal experience over time.
11:40callenAWizzArd: unless you're aware of some esoteric goat sacrifice ritual for me to download his years of laerning, I'm left to resort to reading.
11:40Raynescallen: I don't think he was trying to be a smartass.
11:41callenThen why say it?
11:41RaynesBecause he's right.
11:41callenI know he's got lots of experience. I read several interviews.
11:41callenRaynes: it was an unconstructive statement for reasons I laid out above.
11:41AWizzArdcallen: we are working on the part of downloading knowledge, but I think we are still 2-4 decades away from that.
11:41RaynesEh, I'm not so sure about that.
11:41callendeconstructing an attempt at learning without providing an alternative is pointless and nihilistic.
11:41RaynesMaybe he'll write a book about it all one day.
11:42callenwonderful. Until then, the bookshelf he linked to will be very helpful.
11:42RaynesAnd then you can go into your magical corner where everything is in books. :D
11:42callenRaynes: provide an alternative.
11:42callenRaynes: I function on what I can do *right now* and what I can do *right now* is read.
11:42callenand code.
11:42callenthat's about it.
11:43callenRaynes: I can't even compare my lisp experiences to his because I come from scheme, rather than LW // CLOS
11:43RaynesWell, you could ask questions about what you're wondering about, to fill in the blanks.
11:43rhickeyok, let's not argue
11:44callenagreed.
11:44RaynesI'm not arguing. I just don't appreciate the attitude. I'll slip on out the back now. ;)
11:44callenRaynes: there's no specificity in my curiosity.
11:44callenRaynes: that's why I asked for general sources of reading. I'm curious about everything. I just want to absorb mass amounts of material.
11:44callenI know the rationale for STM, so need to ask about that specifically.
11:44callenI know the rationale for Lisp, so no need to ask there either.
11:45callenThere's nothing at all to scope any particular query with. So I might as well just ask for general purpose reading. *shrugs*
11:47callenRaynes: does that explain where I'm coming from?
11:47callenif I sounded hostile previously, I'm sorry, I didn't mean to.
11:47rhickeycallen: I think they were just pointing out that your original question "what guided ... I'd like to read same" includes a presumption that the decisions were driven by things you could read. Some were, some weren't and were experience-driven.
11:48RaynesIt's all good. I don't hold grudges.
11:48etatecallen: have you watched the clojure vids on blip?
11:48callenI wouldn't ever presume a language to be guided entirely by book learning, one that I would learn anyway.
11:48callenetate: Don't do video.
11:48etatecallen: the two vids specifically targetted at Common Lispers are really informative and explain a lot of the design decisions
11:49callenetate: schemer. I don't like listening to people talk, it's distracting. I multi-task quite a bit.
11:49callenetate: speech is slow.
11:49remleduffI know the list says "In no particular order" but SICP at the very bottom of the list? ;)
11:49AWizzArdcallen: You are denying yourself input channels that may transport useful information.
11:50callenAWizzArd: I'm glad you think so, but my work-style doesn't really mesh with video very well. I only watch a video if it's extremely important or if I'm not doing anything else.
11:50callenI *hate* it when my friends send me pointless videos. *hate*
11:50rhickeycallen: well, there is a lot of good stuff in the videos, and they're the primary way that I personally have communicated about Clojure
11:50rhickeyin talks etc
11:51callenit forces me to stop 100 things I have spooled up and going in order to sit and pay attention to one thing for minutes/hours at a time for no reason.
11:51callenrhickey: is there a transcript? :(
11:51remleduffcallen: I actually watched the videos while doing other work, for some reason that was pretty much enough attention to get started
11:51RaynesI don't think I can read and watch television at the same time.
11:51rhickeyhttp://clojure.googlegroups.com/web/clojure-for-lispers-transcript.txt
11:51callenremleduff: once the linguistic portion of my mind is forced to focus on words, I'm unable to multitask.
11:52callenrhickey: :D thank you.
11:52callenremleduff: I'm almost physically incapable of working/coding without music.
11:52rhickeyone of the few for which there is
11:52etatecallen: they are really worth watching, even if they take you out of your busy schedule for an hour
11:52callenremleduff: the only thing I can do without music is tests.
11:52callenetate: have transcript, unnecessary.
11:52callenHickey's voice is delightful but unrelated to the material.
11:52etatecallen: and rhickeys voice is soothing
11:53callenetate: ^^
11:53etate:D
11:53RaynesI put on a Rich Hickey talk when I have trouble sleeping at night.
11:53RaynesIt helps me sleep, and I dream of parentheses.
11:53etatehaha
11:55rhickeycallen: http://clojure.googlegroups.com/web/Clojure-Boston-Lisp-Part-1-Audience-Questions.txt goes with that
11:56rhickeyand the slides: http://clojure.googlegroups.com/web/clojureforlispers.pdf
11:59callenall very helpful, thank you.
12:00Raynesrhickey: Where are the slides for the first transcript?
12:01rhickeyRaynes: are they not ^^
12:01rhickey?
12:01RaynesOh. I thought those were for a different talk.
12:02callennope. they're for the talk.
12:14remleduffIf I'm typing a sexp, and I'm done with it, is there a quick key to get to the end of it (I'm using paredit-mode). I can type C-M-f, but just wondered if I was missing a better way to do it.
12:14remleduffThere should be a question mark there
12:14remleduffArgh, meant that for #emacs
12:15Raynesremleduff: A quick glance at my cheetsheet just shows C-M-f
12:24LauJensenrhickey: The implication of your quote "When you get hit by lightning, who's behaving? There is no behavior?" was that simply to say that the notion of behavior is also a derrived term from seeing a series of states?
12:25TDTHmm...for C-u M-x slime, I have my implementation for sbcl working fine now - and just running M-x slime works perfectly fine , but for the C-u M-x slime, what is clojure called. Looking at swank-clojure, it appears that they may not have been able to define it the normal way.
12:38remleduffWhen using swank-clojure, if I do C-x C-e to evaluate, where does the result end up? If I evaluate (def x 1), x doesn't exist in my slime repl after evaluating, unless I'm doing something wrong.
12:40Chousukeremleduff: are you sure you have the correct namespace in the repl?
12:40remleduffArgh, I must have been doing something wrong
12:40Chousukeif you have a (ns ...) form in the top of the file you're evaluating, all evals are done in it
12:40Chousukeand the slime repl defaults to the user namespace
12:41Chousukeyou can do (in-ns 'foo.bar) to switch the namespace in the repl
12:41remleduffI had (client ["ping"]) and ended up evaluation ["ping"] instead of the whole thing accidentally
12:41Chousukeheh
12:44remleduffHow would I, using paredit, change "id" to :id?
12:46dnolenremleduff: hmm, probably simpler to just replace-string right?
12:47remleduffIt's weird, it won't let me delete the quotes, but it won't let me "barf" the thing inside the quotes
12:47psykoticLauJensen: i remember trying to decipher that quote too.
12:47LauJensenYea - I'm just wondering if there's more to it
12:48psykoticLauJensen: i thought it was maybe a stab at the OO people who see every event as an asymmetric something-happening-to-an-object kind of thing.
12:48LauJensenCould be
12:48remleduff"If a tree falls in a forest, who's behaving?" ;)
12:48LauJensen"State - Who's behaving?" :)
12:49psykoticregarding the whole 'sequence of states' thing, it reminded me of david hume's investigation of causality.
12:49LauJensenI'm unfamiliar with his study
12:50remleduffI highly recommend the "Giants of Philosophy" audiobooks for listening while jogging :)
12:50psykoticwell, it's the whole problem of trying to figure out what causation means. he ends up with a definition of it as 'invariant sequence'. in other words, A causes B if whenever you see B, A immediately precedes it. the problem with this is the problem of induction--there's no way you can know whether A always precedes B from a finite set of data.
12:51psykoticfortunately, in functional programming, we have data flow :)
12:51psykoticlife is simple
12:51LauJensensimple(r)
12:53psykotici really enjoyed that talk of rich's, it's rare to see talks that go into that level of things.
12:53LauJensenI think Rich is one of the few who starts out by saying "I've made a language, based on these philosophers view of time"
12:54psykotici'm not sure the causality is that strict, but they certainly seem to have informed his views
12:55LauJensenTrue - I dont know the sequence of events, but Clojure has certainly inspired me to go out of the 'code box' to consider solutions more than anything else in the past
12:55remleduffAnyone using FleetDB at the moment?
12:55LauJensenremleduff: Meikel has implemented a backend for ClojureQL for FleetDB now and he seems pretty psyched about it
12:56psykoticmy one reversation is that he seems a bit too committed to the idea that there is a 'right metaphysics' for this kind of thing.
12:56RaynesIs there a function to get a random element of a list?
12:56RaynesOr to randomize a list, or something similar?
12:56psykotic*reservation
12:56LauJensenpsykotic: Can you elaborate on your concern ?
12:56RaynesI know it's easy to just generate a random number the size of the sequence and then nth it, but still.
12:56psykoticfor example, he says that the world 'really doesn't work like message passing'.
12:56remleduffIt has a requirement that every item entered has a unique "id". I'm wondering how a client is supposed to guarantee that it's inserting unique IDs
12:56RaynesA random number between 0 and the size of the seq*
12:56psykotici think this whole idea that we can figure out what the world 'really is' is misguided. what we have are more or less useful models, and their usefulness is context dependent.
12:56remleduffWell, it will get an exception if it inserts a duplicate, but how is it supposed to know what the next free id is
12:57etateLauJensen: which talk is the one with that quote?
12:57psykoticso, i don't think imperative programming is bad (when it is) because the world 'doesn't work like that'.
12:57LauJensen"Are we there yet?" JVM Keynote
12:57LauJensen@etate
12:58LauJensenpsykotic: Thats a big talk - I think I agree with you so far that as the years go by, me might learn more and more paradigmes of which we were unaware when implementing current features/solutions, but from a pragmatic standpoint we get a lot of mileage from the current approach
12:58LauJensenI'm not sure this isn't just the natural evolution of paradigmes
12:58psykoticand i think his dismissal of message passing as the default is really a pragmatic one. if he had wanted to take the idea of semblance to reality seriously, i think message passing might stand a better chance of winning.
12:59psykotici.e. everything is mediated by particles.
12:59psykoticthe notion of a consistent snapshot doesn't really make sense from a pure physical point of view
12:59LauJensenYou mean as the medium of observance?
12:59LauJensenpsykotic: Sure it does, in the sense that your mind makes this snapshots, he's referring to the sensory/mental process
12:59psykoticright
13:00etateLauJensen: thanks checking it out now :D
13:00psykoticwell, first, i think that gets into issues we don't really know very much about
13:00LauJensenpsykotic: Even message passing in its current form does not match particle passing, as there's the 2-way quality check
13:00psykoticLauJensen: the actor model was directly modeled on physics, btw.
13:00psykoticif you go read carl hewitt's original paper
13:01psykotic2-way quality check?
13:01LauJensenpsykotic: I haven't read it. But when the particles fly off the screen to my eye - My eye doesn't send them back to confirm that I got the right data
13:01psykoticthe actor model doesn't either
13:01psykoticyou can do that - but it's pure protocol, like any kind of handshaking, not intrinsic to the model
13:01LauJensenI remember looking at one implementation which does, Erlangs perhaps
13:02sproustClj newbie has a question; listening to RHickey's interview on Channel9 (very interesting).
13:02LauJensenI dont see how you could do with out. In distributed computing there's no assurance of sound transmission without such a check?
13:02sproustBecause the data structures are immutable, copies are beign made of "values" eveywehre.
13:02LauJensensproust: link?
13:02psykoticLauJensen: right, you usually end up doing something like that at some point.
13:02sproustThese copies "must" be made atomically, no? if that is the case, whare are the performance characteristics of the atomic mechanisms? Is it using mutex'es? Or atomic ops?
13:03LauJensenpsykotic: Sure, so its not a model which translate well from physics to computing
13:03LauJensensproust: There are more than 1 way of doing it in Clojure, check this out for great detail: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
13:03psykoticLauJensen: well, you have to distinguish different levels here. in this analogy, the basic actor model (one-way, fire-and-forget asynchronous message passing) is physics. things like handshaking, acks, etc would be akin to biology--more complex systems with simple underpinnings.
13:03sprousthttp://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/
13:04LauJensenthanks
13:04psykoticor perhaps chemistry vs physics, or something, e.g. molecules are a good example of 'handskaking'
13:04LauJensenpsykotic: But weren't we talking about the physics level, and how you didn't think it was viable to think like Rich did? :)
13:04psykoticLauJensen: no, i'm saying he's switching levels, and now you are too.
13:05psykoticyour argument about consistent snapshots concerned the brain, a biological, very complex system
13:06LauJensensure, but the connection to the sensory system is still valid. Where your models doesn't seem to be, in that its inherently insecure
13:06psykotici think trying to model common sense ideas about perception make for good design, but unsound philosophy :)
13:07psykoticand in his discussion he's jumping between the two as if they were the same
13:07LauJensenI'll give you that
13:08LauJensenAnd an interesting observation
13:08remleduffsproust: There actually aren't all that many copies being done with clojure's data structures, that's the meaning of "persistent" the way Clojure uses it. They share structure as much as possible.
13:09psykoticLauJensen: i think in general it's good to be cognizant of how much we are really speaking in metaphor when we think we are directly addressing reality.
13:10psykoticso, in the philosophy of science, there are all these discussions about the concept of realism--in what sense are things like electrons 'real', and so on. are they only useful abstractions that let us build useful stuff?
13:10sproustremleduff: I understand much of the data structures are shared, and so you may not have to lock an existing old version of a value in order to construct a new one at all, but I'm guessing there must be a few cases were CAS operations are being used (thus locking the memory bus), or even some locks... I'm interested in the low-level detail, w.r.t. to building a low-latency system with such a language.
13:11LauJensensproust: Check out the link I sent you, there's STM, CAS, Agents explained there
13:11sproustremleduff; or perhaps there AREN'T any locks nor CAS used at all in constructing new data structures! That would be a wonderful thing.
13:11psykotici guess what i'm proposing is a kind of similar distinction with programming semantics. some metaphorical relationship to everyday concepts and notions may be a good guiding light, but ultimately it's the usefulness, the instrumentalism that determines whether it's garbage or whether it's good.
13:11sproustLauJensen: I will, thanks :-)
13:11LauJensenpsykotic: the instrumentalism?
13:12psykoticinstrumentalism is the guy that the validity of ideas should be judged by how useful tools/instruments they are
13:12psykoticerr, /is the guy/is the idea/
13:13LauJensenSo its pragmatism ?
13:13psykoticwell, pragmatism is a kind of extreme instrumentalism :)
13:13LauJensenNo wait, I see the distinction
13:13psykoticwhere they apply it to everything
13:13remleduffsproust: Well, the old lisp cons, wouldn't require locking the old list to construct a new list, and I believe the goal was to create an analogy of that for every persistent data structure
13:13remleduffsproust: You do need some kind of concurrency construct when you alter what an identity is looking at
13:14psykoticLauJensen: there was actually a mostly american school of philosophy called the pragmatists, who argued that a belief is true when it is useful. which leads to a lot of silliness. :)
13:15remleduffsproust: so (assoc {} :a 1) shouldn't require locking, but (def a {}) (dosync (alter a assoc {:a 1}) obviously involves locking
13:15LauJensenpsykotic: Indeed, since fundamental truth then is determined by the user/perceiver
13:16sproustremleduff: so you're saying that ALL of the synchronization is always explicit, in the form of (swap) (alter) etc. ?
13:17psykoticLauJensen: i'm reading some of your older blog posts (e.g. the beautiful code manifesto). you really like comparing different algorithms between languages and pretending it's a 1-to-1 comparison, don't you? :)
13:17Chousukesproust: I think seqs have some synchronised methods
13:17remleduffsproust: That's my understanding, I hope I'm not leading you astray
13:18remleduffDarn it, I knew if I hit enter someone would contradict me
13:18Chousukesproust: but you shouldn't care about the underlying implementation.
13:18LauJensenpsykotic: No I always say whats going on - The thing I'm tend to do, which upsets the teens, is that I use examples as people publish them. I recognize that you can do solid multithreading in Assembly, but I think its more fair to show the examples where people get in trouble for trying
13:18Chousukesproust: it might change at any time and you wouldn't (shouldn't) notice :)
13:18LauJensens/I'm/I
13:18sproustRight; Chousuke: I'm curious about those special cases.
13:19Chousukesproust: I suppose you need to go read the java code then
13:19psykoticLauJensen: you are being disingenuous and condescending. the people who object to that kind of tactic aren't "teens".
13:19LauJensenpsykotic: Agreed - Those that get upset probably are
13:19psykoticgetting upset at what seems like self-serving dishonesty is childish?
13:20sproustChousuke: depending on the performance characteristics of the system you're building, my experience is that you will eventually need to get into the nitty gritty. For high-level operations I'm with you, we care more about the quality of the abstractions, but for the inner loop I'm sure you'd want to use a well-known subset of operations were you know exactly what's going on behind the scenes.
13:20psykoticyou're obviously a damn good programmer and a good writer, so i feel it detracts from your points.
13:20psykoticyou don't really need to do that.
13:21LauJensenpsykotic: If you find dishonesty on the site let me know and I'll remove it. I do take it as a sign of immaturity when people are hurling accusations in capital letters at me - But I know that there are exceptions of course
13:21clojurebot/summon rhickey
13:22psykoticsorry, off topic
13:22LauJensennp
13:22ChousukeI think most of the so called "dishonesty" is just LauJensen not paying enough attention to the implications of his statements.
13:24Licenserwow bindings are a evil thing, they really can bite you in the behind o.O
13:25psykoticchousuke: i give lau's intelligence more credit than that, but i've gone too far off topic already, and apologize
13:26LauJensenI hear what you guys are saying, and I retract the 'teen' comment and appologize whilst hoping that we can get back to talking Clojure! :D
13:26Chousukepsykotic: I think it has more to do with experience than with intelligence.
13:26Chousukebut yeah, I'll go do something else now.
13:29SynrGwhat reference doc exists for clojure for offline reading?
13:29SynrGa recursive wget of clojure.org/Reference fails. not sure why. the robots.txt file didn't look like it would exclude it ...
13:29LauJensenSynrG: (doc ...) from the REPL works great
13:30SynrGfair enough. and i have been using that ...
13:30SynrGit's just a little awkward to browse.
13:30StartsWithKSynrG, wget -krmnp -E -X/page,/message --no-check-certificate -P <target> https://clojure.org
13:30SynrGStartsWithK: thanks
13:30remleduffsproust: If you grep for synchronized in the clojure java code, the only instances are in the reference types and in the compiler, {Lazy, Iterator, Enumeration}Seq, Delay, Stream and MultiFn. Stream and MultiFn can basically be ignored.
13:30LicenserIs there a way to indentify a anonymous FN?
13:31LicenserLike can I attatck a meta something to it do that the trace says 'this is function X/Y/Z?
13:31Chousukefns support metadata in master
13:31Chousukebut not in earlier versions of clojure
13:34Licenserdarn too sad but thanks Chousuke
13:34SynrGbeing fairly java-illiterate, i wanted some java reference doc too, but the openjdk-6-doc package is ~260M unpacked! a bit much
13:35chouseranonymous functions can have names that show up in their classname
13:35chouserbends the term "anonymous" a bit, doesn't it.
13:35remleduffWhy doesn't the following cause some kind of error? (dosync alter a assoc :a 1)
13:35remleduffI'm missing the parens around the alter form
13:35chousereach of those is a valid expression
13:35chouser,alter
13:35clojurebot#<core$alter__4925 clojure.core$alter__4925@189471a>
13:35chouser,assoc
13:35Licenserchouser: I don't know it's very handy to know where it was created :P
13:35clojurebot#<core$assoc__4268 clojure.core$assoc__4268@11d8ca6>
13:35chouser,:a
13:35clojurebot:a
13:36SynrGi stumble on things like "clojure strings are java strings" because i don't know the latter
13:36Licenser,(fn [a] (+ a a))
13:36clojurebot#<sandbox$eval__5928$fn__5930 sandbox$eval__5928$fn__5930@93b096>
13:36chouser,(fn adder-thing [a] (+ a a))
13:36clojurebot#<sandbox$eval__5934$adder_thing__5936 sandbox$eval__5934$adder_thing__5936@1c342bd>
13:36Licenser,#{:name "my-fn"}(fn [a] (+ a a))
13:36clojurebot#{"my-fn" :name}
13:36Licenserwait chouser this is great!
13:36Licenser#
13:36LicenserI love you! Well platonaically spoken
13:36chouser;-)
13:37Licenserit his horribly usefull since I juggle with fn's in fn's in fn's that come out of fn chains themselfs
13:38remleduffWhat's the advantage of using the metadata reader magic to set the name over the (fn name ...) style ?
13:38chouseryep, and the classname generally has the full lexical context of the fn
13:39dnolenSynrG: Finding documentation on Java strings is pretty easy. http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html. You also might want to look at clojure.contrib.str-utils2 to see if what you're looking for isn't already there.
13:39chouser,(class (((fn foo [] (fn bar [] (fn baz []))))))
13:39clojurebotsandbox$eval__5942$foo__5944$bar__5945$baz__5946
13:40noidiis there a complement for nil? in clojure? #(not (nil? %)) seems a bit wordy for what I'd think would be a commonly used piece of code...
13:40The-Kennynoidi: just use %
13:40StartsWithKnoidi, (complement nil?)
13:40chousernoidi: nil? itself is pretty rarely used
13:41noidiThe-Kenny, ah, of course :)
13:41chousernoidi: usually, nil and false are lumped together as The-Kenny suggests
13:41noidiI just need to filter out nils from a seq, so (filter identity ...) is probably the way to go
13:41noidi...or is it? :)
13:41StartsWithK,(filter identity [1 2 nil 3])
13:41clojurebot(1 2 3)
13:42chouseryes, that's a common idiom
13:42bsteubernoidi: also for and :when can often be used
13:42Chousukeyou might also like (remove nil? ...)
13:43StartsWithKis clojurebot configured to deny access to certan things only by using java security, or is there some kind of whitelist of names too?
13:43ChousukeStartsWithK: there's actually a blacklist ;/
13:43ChousukeStartsWithK: which of course means it has holes
13:43StartsWithKwhat about memory consumation?
13:43StartsWithKi will not try, just asking
13:44StartsWithKwhat if you create realy large array
13:44Chousukethe JVM it runs on is limited to a 64MB heap I think
13:46StartsWithKi see, but in general its safe? you can't access nothing from filesystem, open a socket or exit the jvm
13:46Chousukeyeah
13:47LicenserI really really love clojure :=
13:49remleduffStartsWithK: You might be interested in http://github.com/hiredman/clojurebot/blob/master/hiredman/sandbox.clj
13:49remleduffBad link, sorry
13:50StartsWithKremleduff, thanks
13:51remleduffhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot.clj
13:51remleduffI mean: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj
13:52remleduffNever C&P when you're in a hurry to leave
13:52AWizzArdI think Licenser also has some sandbox stuff?
13:52LicenserYap I do :)
13:52Licenserit's even working nicely
13:53StartsWithKhehe, remleduff i found the code, thanks
13:53StartsWithKis there a good tutorial on java security?
13:53LicenserStartsWithK: have a look at http://github.com/Licenser/clj-sandboxm if you like
13:54StartsWithKLicenser, thanks, i will
13:54Licenserit does not go into jvm security but it at least lets you use sandboxes pretty easiely without much work
13:57StartsWithKis there a way to do a security per thread/class loader, or only with codepoint
13:59StartsWithKin java security model.. i tried to find some tutorial/blog on how to setup a security policy for each class loader i create, but as i can see it, only way is by codebase
13:59StartsWithKcodepoint*
14:02dnolenin depth tour of Enlive, http://github.com/swannodette/enlive-tutorial, feedback appreciated. covers scraping Hacker News, New York Times, and functional templating from pure HTML files.
14:02noidiis there something like filter, that would use the value returned by the predicate instead of the original value?
14:03LicenserStartsWithK: sorry, I don't know much about jvm security :( just tried to make the clojure part less of work
14:03noidiI'd like to combine the map and filter operations somehow http://gist.github.com/332107
14:04SynrGdnolen: sure. it's just a matter of not knowing what to wget in advance for offline reference
14:05StartsWithKLicenser, thanks anyway, its weird how how hard it is to find a good tutorial on the subject
14:05SynrGdnolen: i'm afraid the whole doc is just too huge to put on my little model 4G eeepc
14:06LicenserStartsWithK: I know, hiredman is very knoweldable, the library was build with lots of help and hints from him - and some of the code from the clojurebot ;)
14:06noidi,(filter second [[1 2] [3] [4 5]])
14:06clojurebot([1 2] [4 5])
14:07noidiis there a filter-like function that would return (2 5) in that case?
14:09Licenser,(filter identity (map second [[1 2] [3] [4 5]]))
14:09clojurebot(2 5)
14:10noidithat's what I'm doing now
14:11Licenserthat isn't too bad is it?
14:12noidinot too bad, but bit on the verbose side for my tastes
14:12jcromartieIs it just a coincidence that (defroutes foo (GET "/foo" bar)) works, when bar is a defn somewhere?
14:13jcromartiebecause I can't find a trace of that style of route definition in the docs or wikis anywhere
14:13AWizzArdjcromartie: this is how you should do it
14:13noidioh well, I just wrote a helper to do clean that up :) (defn fmap [& args] (filter identity (apply map args)))
14:13jcromartieAWizzArd: oh? well that's good then
14:13jcromartiesomeone needs to illustrate that then
14:14AWizzArdjcromartie: you list your routes, and they should all look like (GET|POST|PUT|DELETE "/some/url" your-handler-fn)
14:14jcromartieAWizzArd: yeah, it's just never shown that way in the docs
14:14AWizzArdand before that you do a (defn- your-handler-fn [request] ...)
14:14jcromartiehere http://github.com/weavejester/compojure/blob/master/README.markdown or here http://compojure.org/ or here http://en.wikibooks.org/wiki/Compojure/Core_Libraries or here http://nakkaya.com/2010/01/22/unit-testing-compojure-routes/
14:14bsteuber,(for [xs [[1 2] [3] [4 5]] :when (second xs)] (second xs))
14:14clojurebot(2 5)
14:14jcromartienot all of that is official of course
14:14bsteubereven more ugly
14:14jcromartiebut the style is nowhere to be found
14:15bsteuberbut in general the for :when might be useful sometimes
14:15AWizzArdjcromartie: I personally do it as you do, and as I just described.
14:15jcromartieyup
14:15noidithe reason I asked was that I've been reading On Lisp lately, which has bent my brain into thinking that there should be a function for everything :)
14:16noidieven (filter identity (apply map args))
14:18AWizzArdbsteuber: an alternative could be destructuring
14:18AWizzArd,(for [[f s] [[1 2] [3] [4 5]] :when s] s)
14:18clojurebot(2 5)
14:18jcromartieAWizzArd: I'm going through the source, trying to figure out how it even works
14:18AWizzArdjcromartie: what specifically do you mean by β€œit”?
14:19jcromartieusing a fn in place of a fn body
14:19jcromartieerr, a keyword
14:19jcromartieI don't even know how to describe it
14:20AWizzArdHmm, you did not use a keyword.
14:21jcromartieI mean (GET "/foo" foo)
14:21jcromartiewhere foo is (defn foo [...] ...)
14:21AWizzArdYes, foo is a symbol here, which evals to a fn object.
14:21bsteuberawizzard: yeah, the destructuring looks nicer - wasn't sure it worked withour error on the missing second element
14:21jcromartieright sorry, that's what I mean
14:21jcromartieso it evals to a fn
14:21jcromartiebut how is that fn called with the request as an argument?
14:21AWizzArdyes, because you bound a fn to it when you said (defn foo ...)
14:21jcromartieit doesn't seem like the macros expand in such a way as to do that
14:23jcromartieor is all of this request-binding stuff throwing me off
14:23AWizzArdjcromartie: compojure sees the url that is called. Then it simply calls the fn that follows the string in which you encoded the url in your route declaration.
14:23jcromartieok but I can say (GET "/foo" (println "bar")) and it prints "bar"
14:23AWizzArd(Method Url Fn)
14:24AWizzArdWhen does it print bar? On visiting /foo in a browser?
14:24jcromartieright
14:25jcromartieand what I'm saying is that none of the examples that I can find do it in the (GET url fn) way
14:26jcromartiethey do it in the (GET url body) way
14:26jcromartieI think I figured it out
14:26AWizzArdProbably your GET is handled differently, because you put a list in there, not a symbol.
14:27jcromartieno
14:27AWizzArdIt will in such a case just eval the list and not try to call it.
14:27jcromartiethat's the way it is supposed to work
14:27AWizzArdYes, I think it is supposed to work this way.
14:28jcromartiethe GET macro expands to a fn that accepts a request, and this fn wraps the body in an if-let that only runs when the request matches the URL passed to GET
14:28AWizzArdAnd the (Method Url Fn) style is imo the appropriate way to have a clean declaration in non-trivial projects. It doesn't matter that it is not typically documented this way.
14:29jcromartiesure
14:30jcromartieit just needs to be documented, and Compojure appears to be doing a lot of extra work that is just thrown away
14:30jcromartiewhen you use that stiy
14:30jcromartiestyle
14:30jcromartienot anything really significant
14:30jcromartiebut the macros involved are big
14:30jcromartieand they do a bunch of bindings that are never used
14:31AWizzArdIn the Compojure group people use this style.
14:31jcromartiemaybe (GET "/foo" (bar request)) would be more idiomatic
14:32AWizzArdin a lisp-1?
14:32AWizzArdI think the current style is very nice.
14:32jcromartieyou say "current style" but that's not what is documented at all
14:32AWizzArdYou just place your callback there that takes a request object.
14:32jcromartieyeah
14:33AWizzArdthe (Method Url (Fn request)) would just be syntactic salt.
14:34jcromartiesalt?
14:34AWizzArdYeah, hehe, the opposit of syntactic suger ^^
14:35jcromartiehuh
14:35jcromartiewell, anyway, it should at least be documented that this style is possible
14:35AWizzArdI mean, it would be repetative to type that out each time.
14:35jcromartieand maybe the macros be made a bit smarter
14:36AWizzArdjcromartie: yes, I would also prefer it if this style were the predominant one in all the examples.
14:37jcromartiethis is what (GET "/foo" bar) expands to: http://gist.github.com/332142
14:37AWizzArdBut then again, many people let their Clojure apps produce HTML as output. This is also done in several examples, while I don't produce HTML.
14:39chouseranyone know how to start java with debugging on such that jswat can attach to the process?
14:39chouser-Xdebug seem to be the common suggestion, but isn't working for me
14:40chouserjswat still says "not a debuggee"
14:41LauJensenchouser: http://clojure.org/getting_started <-- See debugging :)
14:41chouserhehe. thanks!
14:43jcromartieI still don't quite understand how this works, AWizzArd
14:43jcromartieyou can see the expansion here http://gist.github.com/332142
14:44jcromartiebut the fn at line 4 is what's called with the request as an argument, not bar
14:44jcromartieso when does bar get called with the request?
14:48AWizzArdjcromartie: bar is the second argument to create-response
14:48AWizzArdbar is made a closure
14:53jcromartieI still don't see at what point bar is called with the request as an argument
14:55jcromartieoh, update-response is a multimethod
14:55jcromartiedefmethod update-response Fn
14:55jcromartiecalls the fn with the request
14:55jcromartiefinally!
15:04LicenserI have a problem there is something happening I don't understand: http://gist.github.com/332156 this code. Line 4 tells me there are 2 elements in the list called 'units'. woggle woggle tells me that it runs, but the "bla!!!!!!!!!!!!!!" in the filter fn never shows up :(
15:05LicenserI really don't understand why the fn is never called o.o
15:06vyLicenser: Is it because filter works lazily?
15:06Licenservy: thanks!!!!
15:06LauJensenThats it
15:06The-Kennyhaha
15:06The-KennyLazy-Evaluation strikes back
15:07Licenserit strikes again
15:07Licenserthanks people you all rock
15:08Licenser#clojure to the rescue! :D
15:15chouserbleh. I can't figure out what's going on here.
15:15chouserI'm making a call into a java lib and I simply never hear back.
15:15chouserthe following statement is not execute
15:15chouserexecuted
15:15chouserthis statement is wrapped in a try/catch
15:16chouseroh, I should be catching Throwable, shouldn't I.
15:16chousernope, nuthin.
15:17LauJensenHard to say without seeing the code
15:17chouseryeah, I know. but it's so much code
15:17chouservery very similar code elsewhere works fine
15:18chouserI guess I'm not so much looking for help as just whining.
15:18LicenserDon't worry you'll finde the bug :)
15:19LauJensenchouser: You could try removing the try/catch if you haven't already
15:21chouserah, it's waiting on a lock!
15:22Licenserchouser: see told you you'll find it!
15:22LauJensenyea, Licenser was right all along
15:23Licenser;) knows you all are smartish here
15:23LauJensenHow did you track it chouser?
15:29chouser(prn (Thread/currentThread)) before the line in question
15:30chouserthen Ctrl-\ after it gets stuck, looked through the dumped threads for the same-named one, then looked at it's stack trace
15:30LauJensenOk
15:32chouserand there it is: java.lang.Thread.State: WAITING (on object monitor)
15:32LauJensenI'm a little curious why your working with locks...
15:32Licenserbecause he likes the trhill :D
15:33chouserthat's the thing, I'm not -- the java lib I'm using is. I've never seen a deadlocked JVM before.
15:33chouserif that's what this is
15:34chouserpresumably there's a line in its docs somewhere saying I shouldn't do thus-and-such from thread so-and-so.
15:38chouserwow. nothing in the docs, but wrapping (future ...) around the callback function I was passing in (thus calling my code from a Clojure thread instead of one supplied by the lib) fixed everything.
15:41LauJensenSounds dangerous
15:51Licenser:D very nice
15:52LicenserSo soon I'll have a little game online where everyone can write their own AI's in clojure and have then comeet :D
15:52LauJensenI love comeets
15:53underdevi call that bodog poker :)
15:53Licenserbodog poker?
15:54underdevthe little online game where my AI in clojure competes
15:55Licensernono, no poker, it's a space fight simulation :)
15:55Licenserit's going to be quite cool I think
15:55LauJensenSounds great - JME ?
15:56Licenserno everything written from scratch, own engine and everything :)
15:56LauJensenoh
15:56Licensernow I just have to kick the frontend person(s) to make the webside that allows people to interact with the engine
15:57LicenserIt's a bit like RoboCom or, now was it called, AI wars?
15:57LauJensenI think once I can find a spare 6 months or so, I'd like to make something like Eve Online - Thinking of the Universe modeling
15:59Licensernah it's not that complex LauJensen, for now it's just two fleets that can fight eachother based on ship statistics, and AI scripts
16:00LauJensenOk - Let me know once I can get a beta account :)
16:00LicenserLauJensen: you can bet :) I'll post on the mailing list and bother people here :P
16:01LauJensenWould be nice if you named it FlightPaster.com or FlightCaster.org :)
16:01Licenserwhile it is more like a alpha account ;) the game we aim for is supposed to be way more then fleet combat this is just a tech demo for the combat stuff
16:01Licenserheh the engine is called EPIC
16:01LauJensenok
16:02Licenserwe thought a lot over the name
16:02Licenser^^
16:02Licenserbut why should it be called like that?
16:02eevaryou've actually written a poker bot, underdev? nice
16:03Licenserah the webside that was in the news that used clojure
16:03underdevwell, i've got all the clicky done via the Robot class... still learning the AI stuff
16:04LauJensenyea
16:04underdevit reads the cards too
16:04underdevalso via the Robot class
16:05Licenserunderdev: nice!
16:05underdevslogging through "Paradigms of Artificial Intelligence" right now
16:09eevarnot sure real AI is the way to go for poker, though
16:09eevarwell, i guess you could call expert systems "AI" as well
16:10underdevyeah, the nlp stuff isn't relavent. i guess
16:14eevara self-learning poker bot could get expensive, yea :p
16:14underdevlol
16:15Licenserheh
16:15Licenserask IBM to finance it and call it light green or something :P
16:30etatewow that JVM summit talk is truly awesome
16:48LauJensenetate: Yea it gives some great background info
16:48LauJensenbtw etate I'm seriously loving that color-theme, its growing on me!
16:51etateLauJensen: cool :) I'm making a white background version at the moment
16:53LauJensencool, for what? :)
16:53etateLauJensen: day time :> sometimes i like white backgrounds instead of dark ones so i need one dark version and one light :D
16:54LauJensenI think white bg is too hard on the eyes if you're coding for hours, but maybe thats just me
16:54LauJensenAlso - It would never fly in the Matrix
16:55etateLauJensen: yeah I find it hard with extensive periods of coding in it, but i like light backgrounds when reading dense code sometimes
16:55LauJensenLook forward to seeing it
16:56etate:D i'm making use of some unusual colours that i haven't see in other themes, trying to get a good mix of blues and shades of red
16:57etatei'm actually trying to re-create a theme i made a long time ago which had blues and reds, just taking time to get it right
18:09RaynesIs there any way to unload a namespace dynamically?
18:13hiredman,clojure.lang.Namespace/namespaces
18:13clojurebotjava.lang.Exception: Unable to find static field: namespaces in class clojure.lang.Namespace
18:15Raynes(doc remove-ns)
18:15clojurebot"([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."
18:35SynrGwin 23
18:35SynrGargh
18:52defnhello all
19:30kwertiiwith contrib.logging, I see " Mar 14, 2010 4:26:57 PM clojure.contrib.logging$eval__7116$impl_write_BANG___7127 invoke" printed before every log line. what's doing that? how do I turn it off?
20:17psykoticnoidi: way late, but here's another suggestion for your filter/map fusion.
20:25psykotic,(letfn [(filter-map [p f xs] (for [x xs :let [y (f x)] :when (p y)] y))] (filter-map #(< % 10) #(* % %) (range 10)))
20:25clojurebot(0 1 4 9)
20:27psykoticiirc, for actually uses mapcat under the covers. something like (mapcat #(let [x (f %)] (when (p x) x)) xs
20:28psykoticmake that (when (p x) [x])
20:32kwertiiIs there a simple way to adjust the contrib.logging log message level?
20:32psykoticin the jave world, is there a standard technique for making startup fast for quick script-like apps?
20:33psykoticlike, i don't know, jvm memory images dumped immediately after library loads
20:36kwertiipsykotic: I vaguely remember something that would let you bind the "java" runtime to your classes/jar from a long time ago
22:20psykoticcgrand-rec: you around?
23:05aj1979Hi all
23:08aj1979Quick question: do we have a function in clojure which prints a value and returns it? print and println seem to return nil
23:13psykotici have my own (defn trace [x] (println x) x) thing i use, i'm sure there's probably something more elaborate in contrib
23:14psykoticthat's the only use case i have for it--i want to quickly wrap (trace ...) around a subexpression to see its value at run time, without having to rearrange the code structure by introducing new bindings or whatever
23:14drewraj1979: i/o is a side effect; it can't return anything other than nil
23:16aj1979@psykotic - thanks. I may be having some trouble with something like that though. Not working as expected when lazy seqs come into picture
23:16psykoticthat's right
23:17psykoticin most of the clojure use cases of lazy seqs, it isn't that much different from something like an early terminating loop in an imperative language, though
23:17psykoticexcept that things can be deferred much longer :)
23:18aj1979@drewr - Ok, I understand. .... but sometimes is convenient to see the result of an intermediate form that is nested inside something else. I agree it is not functional but very useful.
23:19psykoticeven haskell has a trace form for something liek that
23:19psykoticwhich uses unsafeIO
23:19psykoticit's definitely useful, though the laziness can be an issue, as you say, more so in haskell than clojure fortunately
23:24tomojdrewr: why does it have to return nil?
23:36aj1979@tomoj: a function HAS to return something. I/O is side-effecting. So a function like println does some side-effecting and returns then returns nil because that is the most appropriate thing to return
23:37tomojah, right
23:37tomojdefinitely appropriate