#clojure log - Mar 14 2010

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

0:00 psykotic: in that example you posted, i don't see how readability is improved

0:04 somnium: hmm, not much I agree, but it saves 5 parens or so :)

0:04 anyway, just a random thought. not something I plan on using atm

0:07 psykotic: i think the unrolled plist-style that clojure uses for conds, lets, etc, but not a big fan of 'unstructured' separators like that

0:07 s/i think/i really like/

0:12 somnium: I 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

4:03 vy: How can we submit issues to http://github.com/technomancy/slime project? It's the SLIME distributed with ELPA, ain't?

4:03 bitbckt:

4:33 kwertii: vy: there's an issue tracker at that page

4:36 vy: kwertii: Would you mind telling me where it is, please?

4:37 kwertii: vy: ahh, that's a fork. you have to go to the original

4:37 it says "forked from nablaone/slime" .. go there... and then there's a button that says "issues"

4:37 but that fork doesn't seem to belong to the original author

4:38 "unofficial repository, updated daily (import from CVS) "

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

4:44 vy: Hrm... No, I want to submit issues for technomancy's fork.

5:22 psykotic: mmm, (run-seq (mfilter (const [false true]) [1 2 3 4]))

7:33 TDT: hey 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

7:33 and trying again.

7:38 LauJensen: TDT: http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/

7:39 ttmrichter: What is swank/slime?

7:39 Quick glanceover with Google makes it look like an emacs thing. Is that right?

7:40 arbscht: ttmrichter: yes

7:40 ttmrichter: Ah. Thanks.

7:40 TDT: LauJensen: 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.

7:40 LauJensen: TDT 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

7:51 TDT: LauJensen: 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.

7:52 LauJensen: 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.

7:53 LauJensen: TDT: http://nakkaya.com/2010/02/07/using-multiple-lisps-with-inferior-lisp/

7:53 That might help you with the CL issue - Glad the video helped

7:54 psykotic: re: 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

7:54 i 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.

7:55 TDT: LauJensen: 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.

7:56 LauJensen: psykotic: Emacs will automatically detect any evil intentions and erase the harddrive of the guilty party

7:57 psykotic: LauJensen: yeah, i saw that in the latest cvs head :)

7:59 LauJensen: 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!

8:00 LauJensen: What kind of slideshow?

8:00 psykotic: i mean like powerpoint, keynote

8:00 actually, it's written as an org-mode exporter.

8:00 so i piggyback on their mark up and structure

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

8:02 i'm entirely too infatuated with org-mode

8:02 Chousuke: I should use org-mode more, but...

8:06 LauJensen: hehe

8:07 Chousuke: Put it in your TODO list

8:07 psykotic: doh! :)

8:08 Chousuke: :P

8:13 LauJensen: psykotic: Although the idea sounds nice, how about just doing a 1:1 port of Keynote and Open Sourcing it ?

8:13 Chousuke: LauJensen: Delivered with a complimentary pony, obviously

8:13 psykotic: someone actually did a web app that's almost like that (the cappucino guys), but not open source

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

8:15 TDT: LauJensen: Do you use lein for your project management within clojure?

8:15 psykotic: or maybe it's that i wouldn't recognize keynote slides that don't use the default template :)

8:15 LauJensen: You're the odd-ball - Slides need to be pretty and catchy

8:15 TDT: Clojuresque and Lein

8:16 psykotic: pretty and catchy usually means simple

8:16 little clutter, lots of whitespace. i don't think the tech part of it factors heavily into it.

8:17 i used to work at a big company where everyone did slide-based presos all the time, it was hell

8:17 99% 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

8:17 the mere absence of that feature in keynote is a large part of why keynote slides are better

8:51 callen: should I just use ClojureX?

8:51 contrib is being cantankerous for both emacs and on my side.

8:52 "build.xml does not exist" yeah thanks. the maven build worked fine though, but emacs isn't smart enough to try that.

8:57 TDT: LauJensen: 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

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

9:00 LauJensen: TDT I've never experienced that

9:02 TDT: Ah 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.

9:03 LauJensen: TDT - Make sure that your lein project has swank as a dev-dependency and that you're run 'lein deps'

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

9:03 (as well as a cloneable git repo)

9:05 TDT: good 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?

9:05 LauJensen: Still using the same setup

9:06 rhickey: this looks like it could use some help, type hints, modern interop style etc - http://www.paullegato.com/blog/yahoo-finance-clojure/

9:06 TDT: LauJensen: k, I'll stick with it then as well. Thanks

9:07 LauJensen: np

9:46 callen: coming to clojure from python, when I'm dealing with a java date object, how can I see the methods that the object has?

9:46 previously, ipython provided tab completion to see all the available methods, metadata, class variables, etc.

9:50 rhickey: callen: if you use enclojure it will do completion for both Clojure and Java stuff

9:51 La Clojure w/IntelliJ probably will as well

9:51 callen: rhickey: 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.

9:53 etate: callen: 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 :)

9:53 callen: rhickey: is there a way to have method completion, without departing slime or the repl?

9:53 rhickey: is there just some object metadata that I can invoke?

9:53 rhickey: python equivalent being _meta

9:53 rhickey: callen: also, repl-utils from contrib will give you the show and javadoc functions - http://richhickey.github.com/clojure-contrib/repl-utils-api.html

9:54 callen: because ipython introspects using standard metadata attached to the objects at runtime, tool agnostic that way.

9:54 oh bugger, contrib. I don't think that's in my class-path yet.

9:58 aha, contrib is on my cp now.

9:58 Raynes: What is the best way to check if a element is in a sequence? For example (any? \x coll).

10:01 callen: are there any paste services that accommodate clojure?

10:01 n/m, got one.

10:02 psykotic: Raynes: (some #(= x) coll)

10:02 callen: http://www.dpaste.org/E7I6/ <- http://richhickey.github.com/clojure-contrib/repl-utils-api.html

10:02 psykotic: err, make that (some #(= x %) coll)

10:02 Raynes: callen: gist.github.com, hpaste.org (I think), programble.co.uk/paste, paste.pocoo.org, snipt.org, etc.

10:02 callen: Raynes: already got one. see above for paste.

10:03 Raynes: dpaste supports it.

10:03 psykotic: gist has stolen my heart.

10:03 i doubt i'll ever use another patebin

10:03 Chousuke: gist is fun in that you can actually clone the gists :P

10:03 and push to them

10:03 Raynes: http://www.acidrayne.net/wiki/doku.php?id=pastebins I keep a list here.

10:03 Not that all of them support Clojure, but most of them do.

10:03 callen: that's pretty cool @ gist. I might switch to it.

10:04 anyone have any idea Re: my error?

10:04 psykotic: it's especially nice if you already have a gist account

10:04 err, github account

10:04 callen: clojure-contrib is on the classpath.

10:04 Raynes: psykotic: Thanks.

10:04 Chousuke: Clojurebot started as a gist, but then I cloned it and pushed it into a proper github repo

10:04 psykotic: Raynes: fwiw, there should still be a builtin for that idiom

10:04 Chousuke: that's why the first commit messages aren't very informative :P

10:04 psykotic: i'm sure there is in contrib but imo it should be in core

10:04 Raynes: psykotic: Agreed.

10:05 psykotic: Raynes: 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:05 Chousuke: I also like M-x gist-buffer

10:05 Raynes: Eh.

10:05 callen: cannot create ISeq from clojure.lang.Symbol after attempting to create a namespace with require repl-utils.

10:05 Wat.

10:05 oh hoh.

10:05 it works in a repl

10:06 but not in slime.

10:06 #!@$

10:06 psykotic: ,(some :b [{:a 1} {:b 2} {:c 3}])

10:06 clojurebot: 2

10:06 callen: psykotic: is cljbot isolated safely?

10:06 psykotic: rhickey: since you seem to be here, is there any reason you didn't make every? symmetric with some?

10:07 admittedly the use case for every is less useful, but it's an odd asymmetry

10:08 Chousuke: auto-install.el even has support for installing from gist!

10:12 Raynes: http://gist.github.com/331995

10:12 Eh, wrong channel.

10:12 callen: ugh.

10:13 rhickey: psykotic: it's some, not some? and that is the difference. some returns the return value of the test fn, not necessarily true/false

10:14 psykotic: rhickey: i said some. the ? was a question indicator. :)

10:14 rhickey: ok, well, same answer

10:14 :)

10:14 psykotic: well, my point is that and : or :: some : every?, or well, that's the natural symmetry

10:14 Raynes: callen: clojurebot is sandboxed.

10:15 rhickey: but some does more than t/f

10:15 psykotic: just 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:15 callen: the 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:16 how do I make a comment?

10:16 rhickey: ;comment

10:16 Raynes: callen: ;

10:16 callen: And (comment ..)

10:16 callen: I saved a class path printer. And thank you.

10:16 Raynes: (doc comment)

10:16 clojurebot: "([& body]); Ignores body, yields nil"

10:18 rhickey: psykotic: ah. so you want every like some, could do, not sure about the utility of that value though

10:18 callen: rhickey: 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:18 it seemed to think STM was the future.

10:19 rhickey: callen: where was that?

10:19 callen: (without explicitly mentioning clojure, I don't think clojure existed when the paper was written)

10:19 psykotic: rhickey: i agree it's less useful but it just seems like an unexpected asymmetry. principle of least astonishment and all that.

10:19 callen: rhickey: it was a "least you should know about programming paradigms" or some-such, I'll look it up.

10:19 rhickey: it did a good job of explaining why I don't like haskell, indirectly. (again without naming names, really.)

10:20 psykotic: haskell is pretty pluralistic about concurrency.

10:20 callen: aha, 2009.

10:20 psykotic: I'm referring less to concurrency when I speak of haskell

10:20 psykotic: and more to it being the BDSM of programming languages.

10:20 http://lambda-the-ultimate.org/node/3465

10:20 psykotic: hardly

10:20 callen: 2009, I was wrong, clojure was extant.

10:21 psykotic: tch. I'm here for a reason. anyway, linkage above.

10:21 psykotic: pascal is more bdsm than haskell. in pascal the types are just sitting there as pences.

10:21 callen: rhickey: ^^

10:21 psykotic: *fences

10:21 callen: psykotic: 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:21 psykotic: in 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:21 rhickey: psykotic: least astonishment depends on where you come from - http://www.lispworks.com/documentation/HyperSpec/Body/f_everyc.htm#every

10:22 callen: rhickey: have you seen the paper I linked to above before?

10:22 rhickey: callen: yes, thanks

10:22 callen: np.

10:22 psykotic: rhickey: cl's standard library is pretty horrible, i'm not sure it's much of a yardstick :)

10:22 callen: it more or less summarized the 'ick' I was experiencing.

10:22 Raynes: #letsargueabouthaskell

10:23 callen: Raynes: yeah I'd rather not.

10:23 anyway.

10:23 psykotic: i often wonder how cl would have changed if they had adopted richard waters's streams proposal

10:23 it lets you program in a style very similar to lazy sequences in clojure

10:23 rhickey: psykotic: I disagree

10:23 callen: http://gist.github.com/332001 <--- clojure-contrib is in the class path, what gives?

10:23 psykotic: s/streams/series/

10:23 rhickey: It may be limited, but not horrible

10:23 some of it very well considered

10:24 psykotic: rhickey: fair enough, yeah

10:24 callen: I think having good judgment with respect to libraries is more important than making it expansive.

10:24 .NET and python are good examples of what can go wrong there.

10:24 psykotic: its 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:24 rhickey: psykotic: an interesting exercise would be - define every (no ?) as you describe. Would anyone prefer it to every? ?

10:25 callen: did guido *ever* sit in #python and respond to people?

10:25 psykotic: callen: probably in 93 :)

10:25 rhickey: psykotic: agreed, but there I would say the main liability of CL lib is age, not design. For its age, a great design

10:25 callen: psykotic: I'd be surprised if he did. He doesn't seem the type to actually care to talk to anyone.

10:26 psykotic: rhickey: well, i have some bones to pick with it. a lot of it is very "first-order". things like loop and format.

10:27 it's interesting to read steele's comments on that aspect.

10:27 he attributes it to a lack of practical experience with that programming style among lispers--which is probably true.

10:27 rhickey: psykotic: but being a Lisp-2, that is the style. There was Scheme for the other style, after all. What matters is consistency

10:27 psykotic: rhickey: you know the standard appendix with the SERIES proposal, right?

10:27 vy: rhickey: 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:27 psykotic: it's much higher-order.

10:28 rhickey: Given all that CL had on its plate, I think they did a great job

10:28 psykotic: oh sure

10:28 it's amazingly good

10:28 i'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:29 rhickey: SERIES 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:29 callen: psykotic: given that I know more scheme than CLOS, this doesn't hurt me.

10:29 psykotic: right, i should say it gives a similar STYLE to higher-order programming but it's first-order by design.

10:30 the whole compiling thing is pretty crazy but an obvious artifact of the performance obsessiveness of the lisp heads at the time.

10:30 rhickey: psykotic: 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:30 they would

10:30 psykotic: i don't disagree. actually, i think what bothers me most is the visual asymmetry :)

10:31 the semantics are a corollary, or vice versa, heh

10:31 i also think any/all are prettier, shorter and more symmetric, but again that's a haskell vs cl heritage thing

10:38 callen: okay, I've tried loading the class path from the manual install, and from clojurex.

10:39 it cannot find clojure.contrib nor clojure.contrib.repl-utils

10:39 clojure appears to otherwise function.

10:40 http://gist.github.com/332001

10:40 is there some procedure for testing/dealing with class loading issues?

10:41 psykotic: rhickey: srfi-1's every seems to have the semantics i mentioned. http://srfi.schemers.org/srfi-1/srfi-1.html#Searching

10:47 * callen bashes head against desk

10:48 callen: cannot validate pom.xml in mvn package attempt for latest git clone of clojure-contrib.

10:49 even using the distro default install of clojure does not seem to be able to load my clojure contrib.

10:52 psykotic: i had problems building clojure-contrib a few days ago from the github head. try switching to the 1.1.0 branch or something.

10:52 callen: psykotic: I've got 4 installs of clojure running around, all in an attempt to get clojure.contrib to work.

10:52 psykotic: your name is illustrative of my state of mind in trying to get this to work.

10:53 psykotic: i'll take your slight of haskell as the ravings of a madman, then :)

10:53 callen: I'd be delighted if we didn't bring that discussion up again.

10:53 I'm here for clojure, not Simon.

10:54 psykotic: so you're sure you have clojure-contrib.jar in your -cp?

10:54 callen: psykotic: as I said before, it was in the list, right before the clojure.jar

10:55 psykotic: dude, you're typing (:require ...)

10:55 callen: cargo cult. got it from the repl-utils page.

10:55 psykotic: ,(doc require)

10:55 clojurebot: "([& 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:55 callen: I'm in the shotgun blast and pick apart the remnants stage of learning the language.

10:55 psykotic: you're typing it as a keyword.

10:56 ,(:require {:require 42})

10:56 clojurebot: 42

10:56 callen: psykotic: okay, how do I invoke the stuff in repl-utils?

10:56 because it says none of the stuff in there exists.

10:56 psykotic: for a start, use require rather than :require

10:56 chouser: repl-utils is one of the rare cases that I recommend a naked 'use'

10:56 callen: ClassNotFoundException for (require clojure.contrib.repl-utils)

10:56 rhickey: callen: (require 'clojure.contrib.repl-utils)

10:57 callen: symbol.

10:57 bugger.

10:57 psykotic: if you looked at (doc require) it has a straight-up example

10:57 callen: throws a verify error, no idea if that indicates anything meaningful.

10:58 psykotic: what does that colon do?

10:58 it makes doc fail, for one.

10:58 so obviously it's syntactically significant.

10:59 psykotic: ,(class :x)

10:59 clojurebot: clojure.lang.Keyword

10:59 psykotic: ,(class 'x)

10:59 clojurebot: clojure.lang.Symbol

10:59 psykotic: it's the difference between specifying a keyword and a symbol

10:59 callen: okay but with respect to require?

10:59 psykotic: keywords in operator position act as lookup operations

11:00 the standalone require doesn't use it. you're probably thinking of (ns foo (:require ...))

11:00 callen: right.

11:00 why is it needed as part of a namespace (lookup operation?)

11:00 psykotic: there it's acting as a 'key'. it's not a function in itself, it's interpreted by the ns macro

11:00 callen: ah.

11:00 so it's a way of passing it unevaluated to the macro?

11:00 much like symbol, but for...other things.

11:00 *twitches* I think?

11:01 rhickey: keywords evaluate to themselves

11:02 callen: so what is its purpose as before a require in the operator area for a namespace?

11:02 psykotic: in the case of macros, i think it's mostly just a convention. it's possible to use symbols there.

11:02 callen: is it just a way of creating a reference that the macro can use without executing the require statement?

11:02 rhickey: callen: 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:03 callen: well 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:03 ugly word, summary.

11:05 rhickey: no, 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:06 ns need not evaluate any of the data forms it is passed

11:06 callen: well, you pass a require into a namespace in order to make use of what the library provides in a sanitary area, right?

11:06 I guess what I'm wondering is why you're keywording the require.

11:07 rhickey: so 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:07 psykotic: i.e. it's convention

11:08 callen: ah, okay. thank you.

11:08 sorry to be such a pain, but I very much want to understand what's going on.

11:08 rhickey: else they would be tempted to put other function calls in there, which won't make sense to ns

11:08 callen: I don't like riding on cargo.

11:10 okay, I can get repl-uitls to require.

11:10 none of the relevant public stuff seems to work though.

11:10 nothing in this context.

11:10 unable to resolve symbol.

11:11 rhickey: callen: are you just winging it without a book or tutorial?

11:11 or reading the online docs?

11:11 callen: online docs.

11:11 and tutorials.

11:11 went through one tutorial, it covered the basics of the data types, operations, etc. I'd done scheme before, nothing unfamiliar there so far.

11:12 rhickey: require will load the library but not pull all of its names into your ns

11:12 callen: that's the kind of thing the tutorials I've read have not covered.

11:12 psykotic: rhickey: i'm looking at the yahoo finance guy's clojure code and there are some funny java slips

11:12 rhickey: you could do that, at some cost of pollution, by using 'use' instead

11:12 psykotic: rhickey: like in his big (str ...) call to construct an url by concatenation, there's a + between two elements :)

11:12 callen: rhickey: 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:13 I swear to god, I read another tutorial that can be boiled down to, "LOL PREFIX NOTATION" I'm going to get stabby.

11:14 rhickey: a cleaner way is to use an alias for the namespace with require :as - (require '[clojure.contrib.repl-utils :as repl])

11:14 then (repl/javadoc String)

11:14 callen: aha, just like python. excellent.

11:14 seriously though, is there a book/tutorial that'll go more in-depth than what I've found so far?

11:14 I don't really want to keep pinging the channel like this.

11:15 rhickey: http://pragprog.com/titles/shcloj/programming-clojure

11:15 callen: is the pragprog book on.....I was just about to ask.

11:15 did Halloway do a good job?

11:16 rhickey: yes

11:17 callen: excellent. thank you.

11:17 rhickey: people have liked this also: http://java.ociweb.com/mark/clojure/article.html

11:17 http://stackoverflow.com/questions/599519/which-tutorial-on-clojure-is-best

11:19 callen: I'd found that before.

11:19 I don't do video, it's too slow.

11:19 rhickey: faster than IRC sometimes :)

11:20 callen: I'd already said I didn't like pinging you guys. :(

11:20 rhickey: callen: we don't mind really

11:21 callen: rhickey: fsm bless you.

11:21 rhickey: and the ns stuff is the trickiest bit, that and classpaths

11:21 callen: rhickey: somehow I managed to trip over both right off the git.

11:22 wait a tic. has anyone used clojure on android yet?

11:22 oh hoh, there's a framework.

11:22 cool. #_#

11:36 remleduff: I've heard that the dalvik vm is bad at both jit and gc, which are two things that closure uses heavily

11:36 callen: rhickey: what guided many of your decisions wrt language design? I'd like to read the same material, perhaps understand your mindset better.

11:38 remleduff: dalvik sucks period.

11:39 AWizzArd: callen: 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:40 callen: AWizzArd: I can't download experience. I took that part for granted. All I can do is look to his personal library.

11:40 rhickey: callen: http://www.amazon.com/Clojure-Bookshelf/lm/R3LG3ZBZS4GCTH

11:40 Raynes: I 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:40 callen: AWizzArd: 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:40 Raynes: callen: I don't think he was trying to be a smartass.

11:41 callen: Then why say it?

11:41 Raynes: Because he's right.

11:41 callen: I know he's got lots of experience. I read several interviews.

11:41 Raynes: it was an unconstructive statement for reasons I laid out above.

11:41 AWizzArd: callen: we are working on the part of downloading knowledge, but I think we are still 2-4 decades away from that.

11:41 Raynes: Eh, I'm not so sure about that.

11:41 callen: deconstructing an attempt at learning without providing an alternative is pointless and nihilistic.

11:41 Raynes: Maybe he'll write a book about it all one day.

11:42 callen: wonderful. Until then, the bookshelf he linked to will be very helpful.

11:42 Raynes: And then you can go into your magical corner where everything is in books. :D

11:42 callen: Raynes: provide an alternative.

11:42 Raynes: I function on what I can do *right now* and what I can do *right now* is read.

11:42 and code.

11:42 that's about it.

11:43 Raynes: I can't even compare my lisp experiences to his because I come from scheme, rather than LW // CLOS

11:43 Raynes: Well, you could ask questions about what you're wondering about, to fill in the blanks.

11:43 rhickey: ok, let's not argue

11:44 callen: agreed.

11:44 Raynes: I'm not arguing. I just don't appreciate the attitude. I'll slip on out the back now. ;)

11:44 callen: Raynes: there's no specificity in my curiosity.

11:44 Raynes: 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:44 I know the rationale for STM, so need to ask about that specifically.

11:44 I know the rationale for Lisp, so no need to ask there either.

11:45 There's nothing at all to scope any particular query with. So I might as well just ask for general purpose reading. *shrugs*

11:47 Raynes: does that explain where I'm coming from?

11:47 if I sounded hostile previously, I'm sorry, I didn't mean to.

11:47 rhickey: callen: 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:48 Raynes: It's all good. I don't hold grudges.

11:48 etate: callen: have you watched the clojure vids on blip?

11:48 callen: I wouldn't ever presume a language to be guided entirely by book learning, one that I would learn anyway.

11:48 etate: Don't do video.

11:48 etate: callen: the two vids specifically targetted at Common Lispers are really informative and explain a lot of the design decisions

11:49 callen: etate: schemer. I don't like listening to people talk, it's distracting. I multi-task quite a bit.

11:49 etate: speech is slow.

11:49 remleduff: I know the list says "In no particular order" but SICP at the very bottom of the list? ;)

11:49 AWizzArd: callen: You are denying yourself input channels that may transport useful information.

11:50 callen: AWizzArd: 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:50 I *hate* it when my friends send me pointless videos. *hate*

11:50 rhickey: callen: 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:50 in talks etc

11:51 callen: it 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:51 rhickey: is there a transcript? :(

11:51 remleduff: callen: I actually watched the videos while doing other work, for some reason that was pretty much enough attention to get started

11:51 Raynes: I don't think I can read and watch television at the same time.

11:51 rhickey: http://clojure.googlegroups.com/web/clojure-for-lispers-transcript.txt

11:51 callen: remleduff: once the linguistic portion of my mind is forced to focus on words, I'm unable to multitask.

11:52 rhickey: :D thank you.

11:52 remleduff: I'm almost physically incapable of working/coding without music.

11:52 rhickey: one of the few for which there is

11:52 etate: callen: they are really worth watching, even if they take you out of your busy schedule for an hour

11:52 callen: remleduff: the only thing I can do without music is tests.

11:52 etate: have transcript, unnecessary.

11:52 Hickey's voice is delightful but unrelated to the material.

11:52 etate: callen: and rhickeys voice is soothing

11:53 callen: etate: ^^

11:53 etate: :D

11:53 Raynes: I put on a Rich Hickey talk when I have trouble sleeping at night.

11:53 It helps me sleep, and I dream of parentheses.

11:53 etate: haha

11:55 rhickey: callen: http://clojure.googlegroups.com/web/Clojure-Boston-Lisp-Part-1-Audience-Questions.txt goes with that

11:56 and the slides: http://clojure.googlegroups.com/web/clojureforlispers.pdf

11:59 callen: all very helpful, thank you.

12:00 Raynes: rhickey: Where are the slides for the first transcript?

12:01 rhickey: Raynes: are they not ^^

12:01 ?

12:01 Raynes: Oh. I thought those were for a different talk.

12:02 callen: nope. they're for the talk.

12:14 remleduff: If 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:14 There should be a question mark there

12:14 Argh, meant that for #emacs

12:15 Raynes: remleduff: A quick glance at my cheetsheet just shows C-M-f

12:24 LauJensen: rhickey: 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:25 TDT: Hmm...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:38 remleduff: When 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:40 Chousuke: remleduff: are you sure you have the correct namespace in the repl?

12:40 remleduff: Argh, I must have been doing something wrong

12:40 Chousuke: if you have a (ns ...) form in the top of the file you're evaluating, all evals are done in it

12:40 and the slime repl defaults to the user namespace

12:41 you can do (in-ns 'foo.bar) to switch the namespace in the repl

12:41 remleduff: I had (client ["ping"]) and ended up evaluation ["ping"] instead of the whole thing accidentally

12:41 Chousuke: heh

12:44 remleduff: How would I, using paredit, change "id" to :id?

12:46 dnolen: remleduff: hmm, probably simpler to just replace-string right?

12:47 remleduff: It's weird, it won't let me delete the quotes, but it won't let me "barf" the thing inside the quotes

12:47 psykotic: LauJensen: i remember trying to decipher that quote too.

12:47 LauJensen: Yea - I'm just wondering if there's more to it

12:48 psykotic: LauJensen: 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:48 LauJensen: Could be

12:48 remleduff: "If a tree falls in a forest, who's behaving?" ;)

12:48 LauJensen: "State - Who's behaving?" :)

12:49 psykotic: regarding the whole 'sequence of states' thing, it reminded me of david hume's investigation of causality.

12:49 LauJensen: I'm unfamiliar with his study

12:50 remleduff: I highly recommend the "Giants of Philosophy" audiobooks for listening while jogging :)

12:50 psykotic: well, 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:51 fortunately, in functional programming, we have data flow :)

12:51 life is simple

12:51 LauJensen: simple(r)

12:53 psykotic: i really enjoyed that talk of rich's, it's rare to see talks that go into that level of things.

12:53 LauJensen: I 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:54 psykotic: i'm not sure the causality is that strict, but they certainly seem to have informed his views

12:55 LauJensen: True - 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:55 remleduff: Anyone using FleetDB at the moment?

12:55 LauJensen: remleduff: Meikel has implemented a backend for ClojureQL for FleetDB now and he seems pretty psyched about it

12:56 psykotic: my 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:56 Raynes: Is there a function to get a random element of a list?

12:56 Or to randomize a list, or something similar?

12:56 psykotic: *reservation

12:56 LauJensen: psykotic: Can you elaborate on your concern ?

12:56 Raynes: I know it's easy to just generate a random number the size of the sequence and then nth it, but still.

12:56 psykotic: for example, he says that the world 'really doesn't work like message passing'.

12:56 remleduff: It 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:56 Raynes: A random number between 0 and the size of the seq*

12:56 psykotic: i 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:56 remleduff: Well, it will get an exception if it inserts a duplicate, but how is it supposed to know what the next free id is

12:57 etate: LauJensen: which talk is the one with that quote?

12:57 psykotic: so, i don't think imperative programming is bad (when it is) because the world 'doesn't work like that'.

12:57 LauJensen: "Are we there yet?" JVM Keynote

12:57 @etate

12:58 psykotic: 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:58 I'm not sure this isn't just the natural evolution of paradigmes

12:58 psykotic: and 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:59 i.e. everything is mediated by particles.

12:59 the notion of a consistent snapshot doesn't really make sense from a pure physical point of view

12:59 LauJensen: You mean as the medium of observance?

12:59 psykotic: Sure it does, in the sense that your mind makes this snapshots, he's referring to the sensory/mental process

12:59 psykotic: right

13:00 etate: LauJensen: thanks checking it out now :D

13:00 psykotic: well, first, i think that gets into issues we don't really know very much about

13:00 LauJensen: psykotic: Even message passing in its current form does not match particle passing, as there's the 2-way quality check

13:00 psykotic: LauJensen: the actor model was directly modeled on physics, btw.

13:00 if you go read carl hewitt's original paper

13:01 2-way quality check?

13:01 LauJensen: psykotic: 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:01 psykotic: the actor model doesn't either

13:01 you can do that - but it's pure protocol, like any kind of handshaking, not intrinsic to the model

13:01 LauJensen: I remember looking at one implementation which does, Erlangs perhaps

13:02 sproust: Clj newbie has a question; listening to RHickey's interview on Channel9 (very interesting).

13:02 LauJensen: I dont see how you could do with out. In distributed computing there's no assurance of sound transmission without such a check?

13:02 sproust: Because the data structures are immutable, copies are beign made of "values" eveywehre.

13:02 LauJensen: sproust: link?

13:02 psykotic: LauJensen: right, you usually end up doing something like that at some point.

13:02 sproust: These 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:03 LauJensen: psykotic: Sure, so its not a model which translate well from physics to computing

13:03 sproust: 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:03 psykotic: LauJensen: 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:03 sproust: http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/

13:04 LauJensen: thanks

13:04 psykotic: or perhaps chemistry vs physics, or something, e.g. molecules are a good example of 'handskaking'

13:04 LauJensen: psykotic: But weren't we talking about the physics level, and how you didn't think it was viable to think like Rich did? :)

13:04 psykotic: LauJensen: no, i'm saying he's switching levels, and now you are too.

13:05 your argument about consistent snapshots concerned the brain, a biological, very complex system

13:06 LauJensen: sure, but the connection to the sensory system is still valid. Where your models doesn't seem to be, in that its inherently insecure

13:06 psykotic: i think trying to model common sense ideas about perception make for good design, but unsound philosophy :)

13:07 and in his discussion he's jumping between the two as if they were the same

13:07 LauJensen: I'll give you that

13:08 And an interesting observation

13:08 remleduff: sproust: 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:09 psykotic: LauJensen: 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:10 so, 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:10 sproust: remleduff: 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:11 LauJensen: sproust: Check out the link I sent you, there's STM, CAS, Agents explained there

13:11 sproust: remleduff; or perhaps there AREN'T any locks nor CAS used at all in constructing new data structures! That would be a wonderful thing.

13:11 psykotic: i 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:11 sproust: LauJensen: I will, thanks :-)

13:11 LauJensen: psykotic: the instrumentalism?

13:12 psykotic: instrumentalism is the guy that the validity of ideas should be judged by how useful tools/instruments they are

13:12 err, /is the guy/is the idea/

13:13 LauJensen: So its pragmatism ?

13:13 psykotic: well, pragmatism is a kind of extreme instrumentalism :)

13:13 LauJensen: No wait, I see the distinction

13:13 psykotic: where they apply it to everything

13:13 remleduff: sproust: 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:13 sproust: You do need some kind of concurrency construct when you alter what an identity is looking at

13:14 psykotic: LauJensen: 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:15 remleduff: sproust: so (assoc {} :a 1) shouldn't require locking, but (def a {}) (dosync (alter a assoc {:a 1}) obviously involves locking

13:15 LauJensen: psykotic: Indeed, since fundamental truth then is determined by the user/perceiver

13:16 sproust: remleduff: so you're saying that ALL of the synchronization is always explicit, in the form of (swap) (alter) etc. ?

13:17 psykotic: LauJensen: 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:17 Chousuke: sproust: I think seqs have some synchronised methods

13:17 remleduff: sproust: That's my understanding, I hope I'm not leading you astray

13:18 Darn it, I knew if I hit enter someone would contradict me

13:18 Chousuke: sproust: but you shouldn't care about the underlying implementation.

13:18 LauJensen: psykotic: 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:18 Chousuke: sproust: it might change at any time and you wouldn't (shouldn't) notice :)

13:18 LauJensen: s/I'm/I

13:18 sproust: Right; Chousuke: I'm curious about those special cases.

13:19 Chousuke: sproust: I suppose you need to go read the java code then

13:19 psykotic: LauJensen: you are being disingenuous and condescending. the people who object to that kind of tactic aren't "teens".

13:19 LauJensen: psykotic: Agreed - Those that get upset probably are

13:19 psykotic: getting upset at what seems like self-serving dishonesty is childish?

13:20 sproust: Chousuke: 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:20 psykotic: you're obviously a damn good programmer and a good writer, so i feel it detracts from your points.

13:20 you don't really need to do that.

13:21 LauJensen: psykotic: 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:21 clojurebot: /summon rhickey

13:22 psykotic: sorry, off topic

13:22 LauJensen: np

13:22 Chousuke: I think most of the so called "dishonesty" is just LauJensen not paying enough attention to the implications of his statements.

13:24 Licenser: wow bindings are a evil thing, they really can bite you in the behind o.O

13:25 psykotic: chousuke: i give lau's intelligence more credit than that, but i've gone too far off topic already, and apologize

13:26 LauJensen: I 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:26 Chousuke: psykotic: I think it has more to do with experience than with intelligence.

13:26 but yeah, I'll go do something else now.

13:27 * Licenser reads scrollback and decides to hand out cookies to all :)

13:29 SynrG: what reference doc exists for clojure for offline reading?

13:29 a recursive wget of clojure.org/Reference fails. not sure why. the robots.txt file didn't look like it would exclude it ...

13:29 LauJensen: SynrG: (doc ...) from the REPL works great

13:30 SynrG: fair enough. and i have been using that ...

13:30 it's just a little awkward to browse.

13:30 StartsWithK: SynrG, wget -krmnp -E -X/page,/message --no-check-certificate -P <target> https://clojure.org

13:30 SynrG: StartsWithK: thanks

13:30 remleduff: sproust: 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:30 Licenser: Is there a way to indentify a anonymous FN?

13:31 Like can I attatck a meta something to it do that the trace says 'this is function X/Y/Z?

13:31 Chousuke: fns support metadata in master

13:31 but not in earlier versions of clojure

13:34 Licenser: darn too sad but thanks Chousuke

13:34 SynrG: being fairly java-illiterate, i wanted some java reference doc too, but the openjdk-6-doc package is ~260M unpacked! a bit much

13:35 chouser: anonymous functions can have names that show up in their classname

13:35 bends the term "anonymous" a bit, doesn't it.

13:35 remleduff: Why doesn't the following cause some kind of error? (dosync alter a assoc :a 1)

13:35 I'm missing the parens around the alter form

13:35 chouser: each of those is a valid expression

13:35 ,alter

13:35 clojurebot: #<core$alter__4925 clojure.core$alter__4925@189471a>

13:35 chouser: ,assoc

13:35 Licenser: chouser: I don't know it's very handy to know where it was created :P

13:35 clojurebot: #<core$assoc__4268 clojure.core$assoc__4268@11d8ca6>

13:35 chouser: ,:a

13:35 clojurebot: :a

13:36 SynrG: i stumble on things like "clojure strings are java strings" because i don't know the latter

13:36 Licenser: ,(fn [a] (+ a a))

13:36 clojurebot: #<sandbox$eval__5928$fn__5930 sandbox$eval__5928$fn__5930@93b096>

13:36 chouser: ,(fn adder-thing [a] (+ a a))

13:36 clojurebot: #<sandbox$eval__5934$adder_thing__5936 sandbox$eval__5934$adder_thing__5936@1c342bd>

13:36 Licenser: ,#{:name "my-fn"}(fn [a] (+ a a))

13:36 clojurebot: #{"my-fn" :name}

13:36 Licenser: wait chouser this is great!

13:36 #

13:36 I love you! Well platonaically spoken

13:36 chouser: ;-)

13:37 Licenser: it his horribly usefull since I juggle with fn's in fn's in fn's that come out of fn chains themselfs

13:38 remleduff: What's the advantage of using the metadata reader magic to set the name over the (fn name ...) style ?

13:38 chouser: yep, and the classname generally has the full lexical context of the fn

13:39 dnolen: SynrG: 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:39 chouser: ,(class (((fn foo [] (fn bar [] (fn baz []))))))

13:39 clojurebot: sandbox$eval__5942$foo__5944$bar__5945$baz__5946

13:40 noidi: is 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:40 The-Kenny: noidi: just use %

13:40 StartsWithK: noidi, (complement nil?)

13:40 chouser: noidi: nil? itself is pretty rarely used

13:41 noidi: The-Kenny, ah, of course :)

13:41 chouser: noidi: usually, nil and false are lumped together as The-Kenny suggests

13:41 noidi: I just need to filter out nils from a seq, so (filter identity ...) is probably the way to go

13:41 ...or is it? :)

13:41 StartsWithK: ,(filter identity [1 2 nil 3])

13:41 clojurebot: (1 2 3)

13:42 chouser: yes, that's a common idiom

13:42 bsteuber: noidi: also for and :when can often be used

13:42 Chousuke: you might also like (remove nil? ...)

13:43 StartsWithK: is clojurebot configured to deny access to certan things only by using java security, or is there some kind of whitelist of names too?

13:43 Chousuke: StartsWithK: there's actually a blacklist ;/

13:43 StartsWithK: which of course means it has holes

13:43 StartsWithK: what about memory consumation?

13:43 i will not try, just asking

13:44 what if you create realy large array

13:44 Chousuke: the JVM it runs on is limited to a 64MB heap I think

13:46 StartsWithK: i see, but in general its safe? you can't access nothing from filesystem, open a socket or exit the jvm

13:46 Chousuke: yeah

13:47 Licenser: I really really love clojure :=

13:49 remleduff: StartsWithK: You might be interested in http://github.com/hiredman/clojurebot/blob/master/hiredman/sandbox.clj

13:49 Bad link, sorry

13:50 StartsWithK: remleduff, thanks

13:51 remleduff: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot.clj

13:51 I mean: http://github.com/hiredman/clojurebot/blob/master/src/hiredman/sandbox.clj

13:52 Never C&P when you're in a hurry to leave

13:52 AWizzArd: I think Licenser also has some sandbox stuff?

13:52 Licenser: Yap I do :)

13:52 it's even working nicely

13:53 StartsWithK: hehe, remleduff i found the code, thanks

13:53 is there a good tutorial on java security?

13:53 Licenser: StartsWithK: have a look at http://github.com/Licenser/clj-sandboxm if you like

13:54 StartsWithK: Licenser, thanks, i will

13:54 Licenser: it does not go into jvm security but it at least lets you use sandboxes pretty easiely without much work

13:57 StartsWithK: is there a way to do a security per thread/class loader, or only with codepoint

13:59 in 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:59 codepoint*

14:02 dnolen: in 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:02 noidi: is there something like filter, that would use the value returned by the predicate instead of the original value?

14:03 Licenser: StartsWithK: sorry, I don't know much about jvm security :( just tried to make the clojure part less of work

14:03 noidi: I'd like to combine the map and filter operations somehow http://gist.github.com/332107

14:04 SynrG: dnolen: sure. it's just a matter of not knowing what to wget in advance for offline reference

14:05 StartsWithK: Licenser, thanks anyway, its weird how how hard it is to find a good tutorial on the subject

14:05 SynrG: dnolen: i'm afraid the whole doc is just too huge to put on my little model 4G eeepc

14:06 Licenser: StartsWithK: 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:06 noidi: ,(filter second [[1 2] [3] [4 5]])

14:06 clojurebot: ([1 2] [4 5])

14:07 noidi: is there a filter-like function that would return (2 5) in that case?

14:09 Licenser: ,(filter identity (map second [[1 2] [3] [4 5]]))

14:09 clojurebot: (2 5)

14:10 noidi: that's what I'm doing now

14:11 Licenser: that isn't too bad is it?

14:12 noidi: not too bad, but bit on the verbose side for my tastes

14:12 jcromartie: Is it just a coincidence that (defroutes foo (GET "/foo" bar)) works, when bar is a defn somewhere?

14:13 because I can't find a trace of that style of route definition in the docs or wikis anywhere

14:13 AWizzArd: jcromartie: this is how you should do it

14:13 noidi: oh well, I just wrote a helper to do clean that up :) (defn fmap [& args] (filter identity (apply map args)))

14:13 jcromartie: AWizzArd: oh? well that's good then

14:13 someone needs to illustrate that then

14:14 AWizzArd: jcromartie: you list your routes, and they should all look like (GET|POST|PUT|DELETE "/some/url" your-handler-fn)

14:14 jcromartie: AWizzArd: yeah, it's just never shown that way in the docs

14:14 AWizzArd: and before that you do a (defn- your-handler-fn [request] ...)

14:14 jcromartie: here 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:14 bsteuber: ,(for [xs [[1 2] [3] [4 5]] :when (second xs)] (second xs))

14:14 clojurebot: (2 5)

14:14 jcromartie: not all of that is official of course

14:14 bsteuber: even more ugly

14:14 jcromartie: but the style is nowhere to be found

14:15 bsteuber: but in general the for :when might be useful sometimes

14:15 AWizzArd: jcromartie: I personally do it as you do, and as I just described.

14:15 jcromartie: yup

14:15 noidi: the 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:16 even (filter identity (apply map args))

14:18 AWizzArd: bsteuber: an alternative could be destructuring

14:18 ,(for [[f s] [[1 2] [3] [4 5]] :when s] s)

14:18 clojurebot: (2 5)

14:18 jcromartie: AWizzArd: I'm going through the source, trying to figure out how it even works

14:18 AWizzArd: jcromartie: what specifically do you mean by “it”?

14:19 jcromartie: using a fn in place of a fn body

14:19 err, a keyword

14:19 I don't even know how to describe it

14:20 AWizzArd: Hmm, you did not use a keyword.

14:21 jcromartie: I mean (GET "/foo" foo)

14:21 where foo is (defn foo [...] ...)

14:21 AWizzArd: Yes, foo is a symbol here, which evals to a fn object.

14:21 bsteuber: awizzard: yeah, the destructuring looks nicer - wasn't sure it worked withour error on the missing second element

14:21 jcromartie: right sorry, that's what I mean

14:21 so it evals to a fn

14:21 but how is that fn called with the request as an argument?

14:21 AWizzArd: yes, because you bound a fn to it when you said (defn foo ...)

14:21 jcromartie: it doesn't seem like the macros expand in such a way as to do that

14:23 or is all of this request-binding stuff throwing me off

14:23 AWizzArd: jcromartie: 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:23 jcromartie: ok but I can say (GET "/foo" (println "bar")) and it prints "bar"

14:23 AWizzArd: (Method Url Fn)

14:24 When does it print bar? On visiting /foo in a browser?

14:24 jcromartie: right

14:25 and what I'm saying is that none of the examples that I can find do it in the (GET url fn) way

14:26 they do it in the (GET url body) way

14:26 I think I figured it out

14:26 AWizzArd: Probably your GET is handled differently, because you put a list in there, not a symbol.

14:27 jcromartie: no

14:27 AWizzArd: It will in such a case just eval the list and not try to call it.

14:27 jcromartie: that's the way it is supposed to work

14:27 AWizzArd: Yes, I think it is supposed to work this way.

14:28 jcromartie: the 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:28 AWizzArd: And 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:29 jcromartie: sure

14:30 it just needs to be documented, and Compojure appears to be doing a lot of extra work that is just thrown away

14:30 when you use that stiy

14:30 style

14:30 not anything really significant

14:30 but the macros involved are big

14:30 and they do a bunch of bindings that are never used

14:31 AWizzArd: In the Compojure group people use this style.

14:31 jcromartie: maybe (GET "/foo" (bar request)) would be more idiomatic

14:32 AWizzArd: in a lisp-1?

14:32 I think the current style is very nice.

14:32 jcromartie: you say "current style" but that's not what is documented at all

14:32 AWizzArd: You just place your callback there that takes a request object.

14:32 jcromartie: yeah

14:33 AWizzArd: the (Method Url (Fn request)) would just be syntactic salt.

14:34 jcromartie: salt?

14:34 AWizzArd: Yeah, hehe, the opposit of syntactic suger ^^

14:35 jcromartie: huh

14:35 well, anyway, it should at least be documented that this style is possible

14:35 AWizzArd: I mean, it would be repetative to type that out each time.

14:35 jcromartie: and maybe the macros be made a bit smarter

14:36 AWizzArd: jcromartie: yes, I would also prefer it if this style were the predominant one in all the examples.

14:37 jcromartie: this is what (GET "/foo" bar) expands to: http://gist.github.com/332142

14:37 AWizzArd: But 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:39 chouser: anyone know how to start java with debugging on such that jswat can attach to the process?

14:39 -Xdebug seem to be the common suggestion, but isn't working for me

14:40 jswat still says "not a debuggee"

14:41 LauJensen: chouser: http://clojure.org/getting_started <-- See debugging :)

14:41 chouser: hehe. thanks!

14:43 jcromartie: I still don't quite understand how this works, AWizzArd

14:43 you can see the expansion here http://gist.github.com/332142

14:44 but the fn at line 4 is what's called with the request as an argument, not bar

14:44 so when does bar get called with the request?

14:48 AWizzArd: jcromartie: bar is the second argument to create-response

14:48 bar is made a closure

14:53 jcromartie: I still don't see at what point bar is called with the request as an argument

14:55 oh, update-response is a multimethod

14:55 defmethod update-response Fn

14:55 calls the fn with the request

14:55 finally!

15:04 Licenser: I 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:05 I really don't understand why the fn is never called o.o

15:06 vy: Licenser: Is it because filter works lazily?

15:06 Licenser: vy: thanks!!!!

15:06 LauJensen: Thats it

15:06 The-Kenny: haha

15:06 Lazy-Evaluation strikes back

15:07 Licenser: it strikes again

15:07 thanks people you all rock

15:08 #clojure to the rescue! :D

15:15 chouser: bleh. I can't figure out what's going on here.

15:15 I'm making a call into a java lib and I simply never hear back.

15:15 the following statement is not execute

15:15 executed

15:15 this statement is wrapped in a try/catch

15:16 oh, I should be catching Throwable, shouldn't I.

15:16 * chouser tries that

15:16 chouser: nope, nuthin.

15:17 LauJensen: Hard to say without seeing the code

15:17 chouser: yeah, I know. but it's so much code

15:17 very very similar code elsewhere works fine

15:18 I guess I'm not so much looking for help as just whining.

15:18 * Licenser gives chouser a cookie

15:18 Licenser: Don't worry you'll finde the bug :)

15:19 LauJensen: chouser: You could try removing the try/catch if you haven't already

15:21 chouser: ah, it's waiting on a lock!

15:22 Licenser: chouser: see told you you'll find it!

15:22 LauJensen: yea, Licenser was right all along

15:23 Licenser: ;) knows you all are smartish here

15:23 LauJensen: How did you track it chouser?

15:29 chouser: (prn (Thread/currentThread)) before the line in question

15:30 then Ctrl-\ after it gets stuck, looked through the dumped threads for the same-named one, then looked at it's stack trace

15:30 LauJensen: Ok

15:32 chouser: and there it is: java.lang.Thread.State: WAITING (on object monitor)

15:32 LauJensen: I'm a little curious why your working with locks...

15:32 Licenser: because he likes the trhill :D

15:33 chouser: that's the thing, I'm not -- the java lib I'm using is. I've never seen a deadlocked JVM before.

15:33 if that's what this is

15:34 presumably there's a line in its docs somewhere saying I shouldn't do thus-and-such from thread so-and-so.

15:34 * chouser looks for it.

15:38 chouser: wow. 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:41 LauJensen: Sounds dangerous

15:51 Licenser: :D very nice

15:52 So soon I'll have a little game online where everyone can write their own AI's in clojure and have then comeet :D

15:52 LauJensen: I love comeets

15:53 underdev: i call that bodog poker :)

15:53 Licenser: bodog poker?

15:54 underdev: the little online game where my AI in clojure competes

15:55 Licenser: nono, no poker, it's a space fight simulation :)

15:55 it's going to be quite cool I think

15:55 LauJensen: Sounds great - JME ?

15:56 Licenser: no everything written from scratch, own engine and everything :)

15:56 LauJensen: oh

15:56 Licenser: now I just have to kick the frontend person(s) to make the webside that allows people to interact with the engine

15:57 It's a bit like RoboCom or, now was it called, AI wars?

15:57 LauJensen: I 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:59 Licenser: nah 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:00 LauJensen: Ok - Let me know once I can get a beta account :)

16:00 Licenser: LauJensen: you can bet :) I'll post on the mailing list and bother people here :P

16:01 LauJensen: Would be nice if you named it FlightPaster.com or FlightCaster.org :)

16:01 Licenser: while 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:01 heh the engine is called EPIC

16:01 LauJensen: ok

16:02 Licenser: we thought a lot over the name

16:02 ^^

16:02 but why should it be called like that?

16:02 eevar: you've actually written a poker bot, underdev? nice

16:03 Licenser: ah the webside that was in the news that used clojure

16:03 underdev: well, i've got all the clicky done via the Robot class... still learning the AI stuff

16:04 LauJensen: yea

16:04 underdev: it reads the cards too

16:04 also via the Robot class

16:05 Licenser: underdev: nice!

16:05 underdev: slogging through "Paradigms of Artificial Intelligence" right now

16:09 eevar: not sure real AI is the way to go for poker, though

16:09 well, i guess you could call expert systems "AI" as well

16:10 underdev: yeah, the nlp stuff isn't relavent. i guess

16:14 eevar: a self-learning poker bot could get expensive, yea :p

16:14 underdev: lol

16:15 Licenser: heh

16:15 ask IBM to finance it and call it light green or something :P

16:30 etate: wow that JVM summit talk is truly awesome

16:48 LauJensen: etate: Yea it gives some great background info

16:48 btw etate I'm seriously loving that color-theme, its growing on me!

16:51 etate: LauJensen: cool :) I'm making a white background version at the moment

16:53 LauJensen: cool, for what? :)

16:53 etate: LauJensen: day time :> sometimes i like white backgrounds instead of dark ones so i need one dark version and one light :D

16:54 LauJensen: I think white bg is too hard on the eyes if you're coding for hours, but maybe thats just me

16:54 Also - It would never fly in the Matrix

16:55 etate: LauJensen: yeah I find it hard with extensive periods of coding in it, but i like light backgrounds when reading dense code sometimes

16:55 LauJensen: Look forward to seeing it

16:56 etate: :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:57 i'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:09 Raynes: Is there any way to unload a namespace dynamically?

18:13 hiredman: ,clojure.lang.Namespace/namespaces

18:13 clojurebot: java.lang.Exception: Unable to find static field: namespaces in class clojure.lang.Namespace

18:15 Raynes: (doc remove-ns)

18:15 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."

18:35 SynrG: win 23

18:35 argh

18:52 defn: hello all

19:30 kwertii: with 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:17 psykotic: noidi: way late, but here's another suggestion for your filter/map fusion.

20:25 ,(letfn [(filter-map [p f xs] (for [x xs :let [y (f x)] :when (p y)] y))] (filter-map #(< % 10) #(* % %) (range 10)))

20:25 clojurebot: (0 1 4 9)

20:27 psykotic: iirc, for actually uses mapcat under the covers. something like (mapcat #(let [x (f %)] (when (p x) x)) xs

20:28 make that (when (p x) [x])

20:32 kwertii: Is there a simple way to adjust the contrib.logging log message level?

20:32 psykotic: in the jave world, is there a standard technique for making startup fast for quick script-like apps?

20:33 like, i don't know, jvm memory images dumped immediately after library loads

20:36 kwertii: psykotic: I vaguely remember something that would let you bind the "java" runtime to your classes/jar from a long time ago

22:20 psykotic: cgrand-rec: you around?

23:05 aj1979: Hi all

23:08 Quick question: do we have a function in clojure which prints a value and returns it? print and println seem to return nil

23:13 psykotic: i have my own (defn trace [x] (println x) x) thing i use, i'm sure there's probably something more elaborate in contrib

23:14 that'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:14 drewr: aj1979: i/o is a side effect; it can't return anything other than nil

23:16 aj1979: @psykotic - thanks. I may be having some trouble with something like that though. Not working as expected when lazy seqs come into picture

23:16 psykotic: that's right

23:17 in 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:17 except that things can be deferred much longer :)

23:18 aj1979: @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:19 psykotic: even haskell has a trace form for something liek that

23:19 which uses unsafeIO

23:19 it's definitely useful, though the laziness can be an issue, as you say, more so in haskell than clojure fortunately

23:24 tomoj: drewr: why does it have to return nil?

23:36 aj1979: @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:37 tomoj: ah, right

23:37 definitely appropriate

23:55 * rfg_ thinks partial with one argument, the function, should return that function.

Logging service provided by n01se.net