#clojure log - Dec 23 2009

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

0:00 technomancy: sure

0:00 defn: (anyone is welcome really)

0:00 http://github.com/defn/cljex

0:00 src/cljex/* -- im trying to organize it better

0:00 it seems like a real mess right now

0:02 i *just* added the controller and view directories, i think that will go a long way in cleaning some of it up

0:02 i guess one of my questions is: is a config.clj ill-advised?

0:02 technomancy: gotta get your .gitignore to skip .# autosaves

0:04 defn: project-root seems to assume that you're always running out of a checkout

0:04 defn: haha yes i was just noticing that

0:04 technomancy: IMHO it's a better idea to keep your app code in one place and your data code somewhere else

0:04 s/data code/data/

0:04 anyway, then it won't break if you try to run it out of a jar or a server container or what have you

0:05 defn: so would you recommend putting public and docs and such in the root?

0:05 technomancy: yeah

0:05 defn: i know you have a "resources" thing with leiningen, but im not sure how to go about using such a thing

0:05 technomancy: resources would be for read-only data

0:05 I'd have your config file be a map serialized to disk

0:06 defn: another problem ive been having is that when im in a REPL, the output from System/getProperty "user.dir" is always wrong

0:06 technomancy: yeah, relying on that kind of stuff is troublesome

0:07 defn: mainly im just trying to get paths nailed down, but ive been having some trouble

0:07 technomancy: have a set of default config values, then check (System/getProperty "cljex.config") to see if it points to a map on disk; if it does then merge it with the default config map

0:07 I'd say you should require the data path to be explicitly passed in

0:07 either through an environment variable or a property

0:07 defn: ah, that's interesting

0:08 how do you create such a property: "cljex.config"?

0:08 technomancy: or a command-line arg

0:08 just launch it with java -cp [...] -Dcljex.config=/etc/cljex.clj [...]

0:08 you can have as many -D properties as you like

0:08 defn: ah, cool!

0:09 technomancy: man... there's so many little things like this that are just not documented in the context of clojure

0:09 defn: yeah, why do you think im working on this project?

0:09 ;)

0:09 technomancy: you have to pick it out of java-specific docs

0:09 heh

0:09 defn: i so do miss the ruby documentation

0:09 technomancy: well it looks like most of this is clojure-specific

0:09 I'm talking about JVM-level quirks

0:10 defn: sure sure -- it's not the same thing, but it's along the same lines

0:10 documentation is key

0:10 technomancy: especially I/O related classes; you just have to figure that stuff out for yourself

0:10 yeah, I mean it makes sense to start with clojure functions etc

0:11 defn: i feel like a big part of the whole endeavor is just getting people to document things like this in a coherent way

0:11 technomancy: but yeah, I hope this takes off

0:11 defn: it's slow going, but i hope it does too

0:11 thanks for the support :)

0:12 i just sent in my contributer agreement to rhickey -- i'm hoping to dig in a bit more so I can document things as they develop

0:12 the 1.1.0 stuff is cool, but so sparsely documented

0:13 if you're lucky you can find 1-3 posts on the internet of people showing how they use it

0:13 (chunked-seqs, transients, etc)

0:13 technomancy: I thought the docs for transients were pretty thorough.

0:14 somnium: the chunk family doesnt even have doc strings

0:14 defn: look at this: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/transient

0:15 *puke*

0:15 wtf is that?

0:15 technomancy: oh, I meant http://clojure.org/transients

0:15 defn: oh sure, but why nothing in the API? it's unnerving to me :\

0:15 technomancy: presumably the docstring will get fixed before the release

0:16 defn: the whole reason i started this project is that guessing at the API docs is a recipe for confusion

0:16 so many weird references to single character :args meta

0:17 like:

0:17 ,(doc chunk)

0:17 clojurebot: "([b]); "

0:17 defn: wtf is b?

0:17 _mst: ChunkBuffer!

0:17 don't ask me how to create one though ;)

0:18 defn: ,(doc print-doc)

0:18 clojurebot: "([v]); "

0:18 somnium: defn: at this point the chunk fns dont neem intended for users

0:18 defn: how about that one?

0:18 what is v?

0:18 a var?

0:18 a vector?

0:18 _mst: I guessed var :)

0:18 danlarkin: use the source, young skywalker

0:18 somnium: defn: when you see doc-strings like that its time to read the source

0:19 defn: danlarkin: somnium: i can read source, that's all well and good, but it bothers me that it's not more explicit

0:19 why the information-hidey-ness?

0:19 danlarkin: "patches welcome :)"

0:19 defn: haha :) i just sent in my contributer agreement :)

0:20 somnium: defn: try doing (defn foo [v]) (doc foo)

0:22 defn: somnium: sure, i know how they get there, why they're there and all, i just feel like there needs to be some more elaboration in the API documentation -- the API docs as they stand now are just these automatically generated docstrings pushed to a website

0:23 im sure this is efficient and easy, but people who are new to the language with no lisp background, with no java background, they're juggling enough as it is without adding another level of complexity to the matter

0:23 i shouldn't have to read and understand the whole of clojure.core source in order to write a program

0:25 i mean, im not opposed to it, i think it's a great learning experience, but there are many folks who are going to give up long before they get to reading source, and i think that's a shame

0:25 somnium: I would posit that people with no java or lisp background learning clojure have enough intellectual curiosity to poke around in the source when needed

0:25 defn: somnium: right now yes, but in the future, that's likely going to change

0:26 clojure has been getting a lot of attention, lots of noobs afoot

0:26 myself included

0:27 somnium: I think a very thorough explanation of special forms would be good for newbs

0:27 after that clojure.core isnt hard to read IMO

0:27 defn: not hard to read no, but i am big on examples, i dunno, in general, writing good documentation to me means diversifying the methods of explanation

0:28 somnium: my main issue with core is all the java poking up into it, but maybe Ill get over that

0:28 defn: clojure currently has the core API which is very terse, and it has people who are writing blog posts about how to use it

0:29 i think it could be so much more rich with an API that did some of the blogger's work for them

0:29 (the documentation i mean)

0:29 (extended-print-doc)

0:30 :)

0:31 somnium: the java bothered me without a doubt, but im slowly getting used to it -- remembering that java's garbage collection is the reason i use clojure in the first place gives me a bit of pause

0:31 somnium: defn: well, I hope your effort takes off. rdoc got me up and running with ruby very quickly

0:32 technomancy: yeah, the docstrings that just say "see http://clojure.org/special-forms" are rather ill-advised IMO

0:34 defn: is this application meant to be read/write or just a web frontend to some hard-coded data?

0:34 somnium: its not the java per se that bothers me, all the opaque calls to c.l.RT and etc, and the java tends to have less documentation than the clojure at this point

0:34 defn: technomancy: front-end for the time being, but in the future a wiki-esque sort of thing

0:34 technomancy: cool

0:35 defn: technomancy: which do you prefer?

0:36 technomancy: I think a wiki is the right idea, but leaving it at the web I'm not so fond of. Ideally further down the road you could download a jar that would contain all the docs as well as some reader functions

0:36 then you could do (explain chunk) from the repl to see the detailed examples

0:36 defn: that's awesome i didn't even really consider that

0:36 technomancy: that way slime and the IDEs could provide integrated help

0:36 I'm more likely to use docs that don't involve a context switch

0:37 defn: im so new to the idea of building jars and all that i dont really know what's possible

0:37 technomancy: sure, the jar can contain mostly data

0:37 defn: kind of like javadoc technomancy?

0:37 technomancy: I dunno; I've only used javadoc in the context of a browser

0:37 I think it's HTML-only

0:37 defn: something i would love to see done in clojure (that i just dont know enough about clojure to build yet) is something like _why's what_method?

0:37 technomancy: I'm thinking of repl-level interaction

0:37 defn: (what-makes "abc" "ABC")

0:38 slashus2: Is there already a "clojuredoc" generator sort of thing?

0:38 defn: yes

0:38 technomancy: slashus2: there is, but it's currently designed only to work with contrib and clojure itself

0:38 hasn't really been generalized

0:38 and it relies on good docstrings; I think defn's effort is meant to supplement the docstrings

0:38 defn: *nod*

0:39 slashus2: That sounds like a good idea. I found myself in the beginning reading the core source to learn about the language and how it works.

0:39 defn: maybe i should include the source on every page as well...

0:39 somnium: maybe a metadata database in something like json, then it could be consumed on and offline by whatever app

0:40 defn: (source ...) is awfully handy

0:40 somnium: ! so many good ideas

0:40 slashus2: Aside from the complex macros, it is very readable.

0:41 technomancy: my favourite thing about core.clj is how the readability improves as you get further into it.

0:41 it's like a good wine

0:41 slashus2: very true

0:41 defn: technomancy: definitely

0:42 but i'd be hard pressed to disagree with any sort of reference to good wine

0:42 technomancy: actually I'm not sure that good wine is like that

0:42 defn: tbqh

0:42 technomancy: yeah

0:42 ubii: being a beer drinker myself, I am still learning to develop a taste for wine

0:42 slashus2: It was really the first language that I bothered to look at the core implementation's source.

0:42 q1: (bean ...) is good too

0:42 technomancy: maybe bad beer would be a better analogy

0:43 somnium: :)

0:43 defn: one could also be a jerk and say: "it's like women..the more beer you drink..."

0:43 somnium: clojure.core: like bad beer in a good way

0:44 defn: by line 1000 of core.clj you start to really enjoy the `~name because it's closing time, and well, you haven't written anything in a long time

0:44 somnium: ,(macroexpand '(for [x (range 10)] (* x x)))

0:44 clojurebot: (let* [iter__6014__auto__ (clojure.core/fn iter__4083 [s__4084] (clojure.core/lazy-seq (clojure.core/loop [s__4084 s__4084] (clojure.core/when-let [s__4084 (clojure.core/seq s__4084)] (if (clojure.core/chunked-seq? s__4084) (clojure.core/let [c__6012__auto__ (clojure.core/chunk-first s__4084) size__6013__auto__ (clojure.core/int (clojure.core/count c__6012__auto__)) b__4086 (clojure.core/chunk-buffer size__6013__auto__)]

0:44 slashus2: noes

0:44 defn: oi vey!

0:45 ubii: too many of the languages that I have started to hack around with are like women, in that they look good from afar, but once you get up close, they really are not that great

0:45 defn: the implemented chunks in for now?

0:45 i thought it was only filter and ....

0:45 somnium: let* confused the hell out of me at first

0:45 slashus2: I think Rich did it for all of the higher order functions.

0:45 defn: cool

0:46 ubii: whoops, I should say, like some women

0:46 somnium: (doc let)

0:46 clojurebot: "([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein."

0:46 defn: ubii: hehe, yeah you wouldn't want to be a /gay/ nerd.

0:46 (doc let*)

0:46 clojurebot: Titim gan éirí ort.

0:46 somnium: hmm, I get the special forms message at my repl

0:47 slashus2: Have you all noticed that the transient implementation could probably be moved up a little in the core? Maybe it could be used to implement a few of the other core functions? (I may be wrong about this)

0:47 defn: somnium: same here, why is that?

0:47 weird...

0:47 somnium: let* is a compiler symbol

0:48 ,(let* [x 1] x)

0:48 clojurebot: 1

0:48 somnium: (resolve 'let*)

0:49 ,(resolve 'let*)

0:49 clojurebot: nil

0:49 defn: he's choking

0:49 pdk: nothing motivates you to begrudgingly take another look at emacs as trying out 3 different ides all not wanting to work

0:49 defn: ,(macroexpand-1 (let* [x 1] x))

0:49 clojurebot: 1

0:50 pdk: it's as if they magically become impossible when you add clojure into the mix

0:50 defn: it's as if they were impossible to begin with

0:51 ubii: pdk: which ides did you try?

0:51 pdk: i tried the clojure plugins in eclipse idea and netbeans so far

0:51 with eclipse it flipped out and cried trying to open an individual clj file

0:51 something about one of the base classes not having a filename property

0:51 idea pissed me off with how it refuses to open individual files outside of a project window

0:52 somnium: http://tinypic.com/view.php?pic=2w40c9t&s=6

0:52 pdk: and netbeans just sits and stares if i try to open a file

0:52 somnium: ^^ why would anyone not want to use emacs? :-)

0:52 ubii: didn't try eclipse, but had netbeans 6.8 working, before I re-installed the OS on my laptop

0:53 pdk: some of us would be perfectly happy just to have a notepad++ level editor with proper lisp indenting

0:53 defn: if it doesn't have paredit-mode

0:53 i dont want to talk about it

0:54 pdk: hm true

0:54 somnium: pdk: you say that now, but you havent used paredit

0:54 defn: a lisp editor without paredit-mode is like a human being without genitalia

0:54 ubii: in other words, not that fun

0:54 pdk: ok forget the ides for tonight

0:55 ubii: pdk, I gave up and decided to just man up and use emacs

0:55 somnium: defn: Im not sure thats the metaphor I would have used, but enclojure is painful without paredit

0:56 on the unfortunate occasions when Ive needed to write .java it comes in handy though

0:57 defn: somnium: my metaphor skills are obvious

0:57 somnium: :)

0:57 defn: looking forward to getclojure.org

0:58 defn: one thing i have to say, without gushing too much I hope, is how great this community is

0:58 lots of great personalities amongst us

0:58 among us*

0:59 ^^case in point

0:59 ubii: defn: is getclojure.org going to be the home of your new app?

0:59 defn: ubii: yeah eventually, im a newb

1:00 ubii: cool

1:00 defn: ive just never been so taken by a language before. i thought ruby was cool, but the allure of a lisp, concurrency, functional programming, transients, chunked-seqs, so many fantastic ideas and new directions

1:00 it's very exciting

1:02 ubii: I have always been interested in lisp, but just never got around to trying to learn it, now with clojure I have an excuse

1:02 defn: same here

1:02 watching rich's talks was just mind blowing

1:02 somnium: I tried common-lisp, and I hated it

1:02 defn: his talk "Are we there yet?" and his talk with Brian Beckman

1:02 ubii: I am tired of drinking the ruby kool-aid and am looking for a change

1:02 defn: ive watched them like 100 times

1:03 ubii: hmm, haven't seen that one yet

1:03 defn: the are we there yet?

1:03 ubii: correct

1:03 defn: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

1:03 you saw the beckman video

1:03 ?

1:04 somnium: I expect Rich's ideas will have a lot of influence beyond clojure in the years to come

1:04 defn: somnium: yeah that's why it's exciting

1:04 i totally agree

1:04 ive tried to explain this to friends and they think im evangelizing, but it's a total paradigm shift

1:05 one of the questions at the end of the "Are we there yet?" talk is a guy basically saying rich is repeating the history of philosophy with this sort of new synthesis of ideas

1:05 ubii: what is the link to the beckman video?

1:06 defn: http://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/

1:07 ubii: enjoy. some good stuff there :)

1:07 ubii: no haven't seen that either

1:07 defn: i think you'll appreciate the are we there yet talk after watching the beckman interview

1:10 ubii: the only screencasts that I have watched so far are Rich's 90 minute An Introduction for Lisp Programmers, the peepcode clojure screencast, and a 10 part clojure screencast on youtube

1:10 defn: those are good

1:10 but the beckman interview is a very conversational introduction which i enjoyed

1:11 ubii: going to watch that right now

1:11 defn: and then are we there yet talk is sort of a window into the thought process behind clojure

1:11 which i think is very revealing

1:11 it sort of gives you a framework to understand clojure's trajectory

1:12 ubii: though I really should be working on some ruby projects for my clients

1:12 defn: :)

1:12 i spent 6 hours today at work working on clojure

1:12 i should be fired tbqh

1:12 i feel guilty the whole time, but I can't stop

1:13 ubii: I am a freelancer and work from home, so no big brother to worry about :)

1:13 defn: ubii: nice to meet you :)

1:13 <-devin

1:14 ubii: plus, I set my own hours, so if I spent x amount of hours learning clojure and "not" working, then I can alway make it up later

1:14 though there are these things called deadlines, that I sometimes need to worry about

1:15 defn: you too

1:15 defn: ubii: did you just start clojure today?

1:16 ubii: seems like most of my clients are trying to squeeze as much as they can in before the end of the year, so the last month or so has been crazy busy

1:17 defn: I starting reading up on it and watching some screencast a couple of months ago, but I have been so busy with work lately, that I haven't been able to "officially" sit down and start learning it until this week

1:19 defn: ubii: i failed a class to work on it -- it takes time with no lisp and java experience

1:19 but it's coming along

1:19 ubii: spent most of my time before, playing around with various editors/ides, including emacs, trying to decide what to use, before I got started actually learning the language

1:20 defn: learning emacs is fantastic, paredit-mode is great, slime is great

1:20 and with it being elisp, you get sort of a mini clojure (lisp) education in the process of messing with your config

1:21 ubii: never really touch lisp before, but have worked with Java before, so that aspect is not foreign

1:21 s/touch/touched/

1:21 defn: ive worked with java, but never professionally, only silly academic things that didn't need to *work*

1:22 i never had to package up a jar, or if i did, i did it unknowingly via an IDE

1:22 ubii: most of my professional java experience has been more on the project management side, with a wee bit of pair programming with one of my developer at my last job

1:22 other than that, I have several college classes on Java

1:23 somnium: ubii: you may find inf-ruby (written by Matz) and Rinari (for rails) will help the 12-step-program move along faster

1:23 ubii: though to be honest, it has been years since I have touched Java, so I am beyond rusty

1:24 yeah, I will have to check them out

1:24 somnium: inf-ruby is what originally gon me hooked on emacs

1:28 ubii: wow, Beckman is an Astrophysicst, which is another field that I have interest in

1:28 defn: somnium: i haven't used inf-ruby much

1:28 somnium: what you're favorite thing about it?

1:29 somnium: defn: its like slime-lite

1:29 defn: does it link your .rb file with an irb repl?

1:30 somnium: defn: it runs an inferier irb process and you can send it whatever you want

1:31 defn: from a source file though, yes?

1:31 Like C-x C-e

1:31 to get a method into the inferior ruby?

1:31 somnium: defn: sure, from clipboard, from file, jruby, mri, whatever

1:32 defn: cool

1:32 ill have to check that out more

1:32 somnium: I dont recall the bindings off hand, C-h b is for that

1:32 defn: i tried inf-ruby before i knew antyhing about slime

1:32 M-. is the greatest function ever

1:32 somnium: mozrepl for js is cool too

1:33 nothing matches slime though

1:33 defn: i was amazed when i hit M-. on accident

1:33 i thought i'd have to scroll through core.clj

1:33 somnium: defn: what is it mapped to?

1:34 defn: (slime-edit-definition)

1:34 ubii: find a tag

1:34 defn: Lookup the definition of the name at a point.

1:34 somnium: my keybindings are all over the place now with dvorak + ergoemacs

1:34 defn: why dvorak?

1:35 i read up on it and it doesnt look more efficient

1:35 somnium: defn: 80% of keypresses on the home row

1:36 defn: yeah but it's not really faster

1:36 somnium: my fingers were starting to hurt from emacs so I decided to learn dvorak and switch to ergoemacs

1:36 defn: it's like if i invented a new home row that exists on the left half of the keyboard

1:36 somnium: defn: ?

1:36 defn: and then claimed it was more efficient because i put commonly used chars together

1:37 somnium: defn: a lot of research went into the design

1:37 defn: finger strength, occurence frequency, etc

1:38 anyway, my fingers never hurt now so I quite like it

1:38 but it was an awkward first week

1:38 ubii: not feeling the love on the Beckman video, as it is still caching and has not started to play yet :(

1:38 defn: ubii: download the wmv

1:38 or whatever format

1:38 ubii: yeah, I should

1:38 defn: im watching it again now

1:39 :)

1:39 ubii: bad enough that you sent me out to Microsoft related site :)

1:39 maybe that is why it is not working :)

1:41 somnium: defn: one question, why is semi-colon on the home row? :)

1:41 ubii: hmm 526MB download, let me try a differnt format

1:42 defn: somnium: touché

1:43 somnium: ubii: i have to go -- girlfriend is giving me the eye via text message

1:43 ubii: later

1:43 defn: it was good talking to you both, ill see you around, oh and, contribute to cljex! :)

1:43 lots of low hanging fruit

1:46 somnium: cheers

1:50 ubii: guess I should bail, so I can get some work done, while I am waiting for this video to download

1:51 later

1:52 somnium: ciao

3:56 astertronisticon: \help

3:57 \nickserv

5:06 triyo: I have a map of key/value pairs whos keys match to my function's parameter names. How do I utilize destructuring here without needing to use something like let to bind each param individually?

5:07 I've seens examples but cat for the life of me remember where.

5:07 *seen

5:10 cark: (defn my-func [{:keys [param1 param2]}] ... )

5:10 or

5:11 (defn my-func [{param1 :param1 param2 :param2}] ... )

5:11 i never use the second one so it might be wrong

5:12 anyways the info is available there : http://clojure.org/special_forms

5:13 triyo: thx cark

5:14 cark: i think there should be a separate page on destructuring on the clojure web site

5:15 triyo: I agree

5:17 cark: there is also a defnk macro somewhere that does that plumbing for you

5:18 in contrib

5:20 triyo: def api

5:24 fliebel: ,(doc ->>) ;returns an error on my computer

5:24 clojurebot: "([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."

5:26 fliebel: What can possibly be the problem? I'm just running Clojure 1.0 Is ->> new or deprecated?

5:26 * talios wanders in after releasing 1.2 of the clojure-maven-plugin

5:26 arbscht: fliebel: newer than 1.0

5:27 fliebel: arbscht: so I need to get the 1.1 rc?

5:28 talios: 'lo arbscht

5:28 arbscht: fliebel: that should help

5:28 talios: hey

5:28 talios: how goes?

5:29 arbscht: alright. haven't written much code this month, hoping to dive into 1.1 rc before the year end :p

5:29 fliebel: Where do I get clojure-contrib for 1.1rc?

5:30 talios: they're both on build.clojure.org/snapshots

5:30 (maven repo

5:34 fliebel: talios: hey, that worked!

5:35 Although I'm not sure I got a compatible contib now

5:35 talios: both should be 1.1-master-SNAPSHOT I think

5:36 which is what I'm using currently

5:36 er 1.1.0-master-SNAPSHOT

5:36 fliebel: talios: I just picked clojure from the google code thing where the download link goes on the clojure website

5:36 talios: ah ok - the build.clojure.org is from the hudson continuous build

5:37 fliebel: I'll pick the other clojure...

5:38 talios: mm, I really should finnish up more of this maven DSL

5:38 what are you guys using to build your clojure foo? maven? leiningen?

5:38 ant? or just the REPL

5:39 fliebel: I'd like to know that as well...

5:39 arbscht: lein and ant (separately) for me

5:40 talios: fliebel - seems quite a few are using my maven-clojure-plugin, and quite a few people are looking forward to my maven/clojure polyglot work ( which looks similar to leiningen)

5:41 fliebel: I think most of them use lein… I never looked into building things yet.

5:56 I got something strange: clj does not stop after running a file.

5:57 It just runs this: java -classpath /opt/local/share/java/clojure/lib/*:. clojure.main $1

5:58 It just keeps saying "Java" at the top of my terminal.

5:59 Chousuke: fliebel: maybe you need to call shutdown-agents?

6:00 fliebel: chousuke: The thought didn't even occur to me… Do I need to kill agents? :P

6:02 Chousuke: kill? well, you need to make sure they don't have an action running in an infinite loop :/

6:02 the jvm won't exit as long as there are threads alive.

6:02 fliebel: I never used a def on them, so when I'm done it's out of all scopes and could be garbage collected, can't it?

6:03 Chousuke: shutdow-agents closes the threadpool

6:03 fliebel: ok… I'll try that

6:03 Chousuke: the agent objects themselves don't really matter.

6:03 fliebel: ok

6:04 Worked!

6:04 talios: doh - bug report on the clojure-maven-plugin 1.2 already :( reproducable, but not sure -why- :(

6:05 grr maven

6:09 neotyk: talios: do you need some help with maven?

6:10 talios: just looking through my diffs to see what might have triggered it - for some reason my goal isn't getting test deps, even thou the mojo has "@requiresDependencyResolution test"

6:12 neotyk: talios: have you looked at generated plugin.xml ?

6:14 talios: generated plugin.xml says test.

6:14 mm, actualy - I look in the one in the jar as well

6:15 and that was test as well

6:17 mmmm, I wonder.... I moved a bunch of things to my Abstract parent class, which doesn't has the @requiresDep... annotation. I guess thats it.

6:18 fliebel: Does anyone know a good auto pair plugin for vim? When I type "(" I automatically get ")", but it is a little "arrogant", when I just want a single ( or ) because I added some code in between I have to do some extensive fiddling to get it to do that. I'm now thinking about disabling it, but it's a great thing to have, if it works.

6:39 metoo: ,(-> 2 inc dec)

6:39 clojurebot: 2

6:40 metoo: ,(-> 2 #(+ 3 %))

6:40 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.ISeq

6:40 metoo: ,(-> 2 (#(+ 3 %)))

6:40 clojurebot: 5

6:41 metoo: why here i have to add another '()?

6:41 ,(-> 2 (+ 3))

6:41 clojurebot: 5

6:41 metoo: ,(-> 2 print)

6:41 clojurebot: 2

6:42 metoo: ,print

6:42 clojurebot: #<core$print__5678 clojure.core$print__5678@15e3abb>

6:42 cark: when the -> macro see a list, it applies the result to the first element (a function) of that list

6:42 metoo: ,#(+ 3 %)

6:42 clojurebot: #<sandbox$eval__4183$fn__4185 sandbox$eval__4183$fn__4185@39a07>

6:43 hiredman: ,(macroexpand '#(+ 3))

6:43 clojurebot: (fn* [] (+ 3))

6:43 hiredman: ,(macroexpand '(-> 2 #(+ 3)))

6:43 clojurebot: (fn* 2 [] (+ 3))

6:43 metoo: hmm

6:45 so -> think #(..) as a list?

6:45 hiredman: it is a list

6:45 #() is expanded by the reader to (fn* ..)

6:46 metoo: ic, but this is abit odd

6:46 hiredman: it's not

6:46 metoo: ,(-> 2 (fn [x] (+ x 2)))

6:46 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:46 hiredman: fn*

6:47 cark: ,(-> 2 ((fn [x] (+ x 2))))

6:47 clojurebot: 4

6:47 hiredman: ~macro

6:47 clojurebot: macro are just a game with symbols

6:47 hiredman: gah

6:47 clojurebot: forget macro|are|just a game with symbols

6:47 clojurebot: I forgot macro|are|just a game with symbols

6:48 hiredman: ~macro

6:48 clojurebot: macro are just a game with symbols

6:48 hiredman: liar

6:48 cark: it's true that it would be nicer to have it understand it the way metoo wants

6:48 it wouldn't be that hard

6:48 make ti a special case for (fn* and (fn

6:48 metoo: sure

6:49 cark: just for fn* actually

6:50 hiredman: cark: I prefer consistency

6:50 cark: true, let's just say it's a close call here

6:51 this double parenthesis thing is quite ugly

6:51 metoo: ,(fn [x] (+ x 1) 2)

6:51 clojurebot: #<sandbox$eval__4201$fn__4203 sandbox$eval__4201$fn__4203@1fb4a7b>

6:51 metoo: oops

6:51 fliebel: what is fn*? my doc doesn't find it.

6:51 metoo: ,((fn [x] (+ x 1)) 2)

6:51 clojurebot: 3

6:52 hiredman: fliebel: fn is actually not a special form, it is a macro that emits fn*

6:52 fn* is the special form

6:52 metoo: ,(-> 2 (fn [x] (+ x 1)))

6:52 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:52 metoo: it's not consistency

6:52 hiredman: it is

6:52 metoo: ,(-> 2 (print))

6:53 clojurebot: 2

6:53 hiredman: ,(macroexpand '(-> 1 (fn [] )))

6:53 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

6:53 hiredman: ,(macroexpand '(-> 1 (fn* [] )))

6:53 clojurebot: (fn* 1 [])

6:53 hiredman: ,(macroexpand '(-> 1 (print)))

6:53 clojurebot: (print 1)

6:53 hiredman: completely uniform

6:54 the-kenny: ,(macroexpand '(->> 1 (fn* [] )))

6:54 ,(macroexpand '(->> 1 (fn* [] )))

6:54 clojurebot: (fn* [] 1)

6:54 metoo: ,(macroexpend '(->1 print))

6:54 clojurebot: java.lang.Exception: Unable to resolve symbol: macroexpend in this context

6:54 hiredman: metoo: I just did that

6:54 fliebel: What is a ctor?

6:54 hiredman: constructor

6:56 metoo: print is a function (fn ...) also function, why act not same?

6:57 the-kenny: metoo: Where does it differ?

6:57 hiredman: metoo: print is a symbol

6:57 -> is a macro

6:57 metoo: and (fn ..) is a list?

6:57 hiredman: it operates before any symbol resolution or function creation

6:58 it is a list

6:58 metoo: i think ->/->> macro should know (fn..) as special form just like cark said

6:58 hiredman: (-> 1 print) generates the list (print 1) which when evaluated is a function call

6:59 metoo: nope

6:59 the-kenny: metoo: Then you would have to implement dozens of special cases for every single macro

6:59 hiredman: (-> 1 (fn* [] )) generates the list (fn* 1 []) when evaluated this is not a valid form

7:01 cark: the-kenny : no there would be a single special case

7:01 but yes i'm not sure that's a good idea

7:01 metoo: function in clojure isnot first class member just like haskell?

7:01 the-kenny: cark: and what should the special case do?

7:02 metoo: They are, but they are accessed through symbols

7:02 cark: check if the first element iof the list is fn*

7:02 hiredman: metoo: -> is a macro

7:02 it operates on the datastructures generated by the reader

7:02 metoo: ->/->> thread inside functions

7:03 hiredman: ,(read-string "(fn [] )")

7:03 clojurebot: (fn [])

7:03 hiredman: ,(list? (read-string "(fn [] )"))

7:03 clojurebot: true

7:04 metoo: so, it just a list, not others,right?

7:04 hiredman: "not others"?

7:04 metoo: this list eval to one function

7:04 hiredman: ,(list? (read-string "(+ 1 2)"))

7:04 clojurebot: true

7:04 hiredman: after macro expansion

7:05 fliebel: Why doesn't this work? (-> "/path/to/file"

7:05 (FileWriter.)

7:05 (BufferedWriter.)

7:05 (.write "content"))

7:05 hiredman: (fn [] ) does not become a function until after -> is done

7:05 ,(macroexpand '(Foo.))

7:05 clojurebot: (new Foo)

7:05 metoo: i got the point, but i think it 's not natural :)

7:06 hiredman: Foo. is a reader macro

7:06 metoo: it is

7:06 metoo: you just don't know macros

7:06 fliebel: hiredman: so I need to insert the path somewhere in the middle?

7:06 hiredman: fliebel: loose the parens

7:06 lose

7:06 (-> "foo" Foo. Bar. Baz.)

7:08 fliebel: hiredman: (-> "/path/to/file"

7:08 FileWriter.

7:08 BufferedWriter.

7:08 (.write "content"))

7:09 No matching method found: write for class java.io.BufferedWriter

7:10 hiredman: well check the javadocs for BufferedWriter

7:10 fliebel: the problem is this:

7:10 hiredman: fliebel: no

7:10 fliebel: ,(macroexpand '(.write java.io.writer.))

7:10 clojurebot: java.lang.ClassNotFoundException: java.io.writer.

7:10 hiredman: stop

7:10 Stop!

7:11 do not continue until you have read the java docs for bufferedwriter

7:11 fliebel: I did....

7:11 hiredman: are you sure?

7:12 metoo: Writer?

7:12 hiredman: ok

7:12 fliebel: hiredman: It inherits a write

7:13 the-kenny: fliebel: and write takes a string?

7:13 fliebel: hiredman: the problem is that .write turns into (. (java.io.Writer.) write)

7:13 hiredman: http://java.sun.com/j2se/1.5.0/docs/api/java/io/Writer.html#write(java.lang.String)

7:14 hiredman: that is not a problem

7:14 fliebel: works fine here

7:15 so you must be doing something different

7:15 fliebel: hmh, I think I found it :$ I wasn't supplying a string, but a list containing a string :$

7:16 metoo: shuld work

7:17 fliebel: except that it did not write anything :( But before starting to worry, let's double check my string :D

7:18 the-kenny: fliebel: with-open?

7:19 ,(doc with-open)

7:19 clojurebot: "([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."

7:19 hiredman: fliebel: you have to close your streams

7:19 fliebel: ah...

7:19 hiredman: metoo: go write your own language, please

7:20 or take some time and learn clojure instead of sitting around saying "should work"

7:20 well

7:20 close or flush

7:20 closing flushes

7:21 metoo: hiredman: i mean fliebel's code should work

7:21 fliebel: hiredman: so I can't use -> because write returns nothing.

7:22 hiredman: a. use with-open, b. (-> "foo" Writer. (doto (.write "x") .close))

7:23 (with-open [w (-> "foo" Writer.)] (.write w "x"))

7:24 fliebel: hmhm

7:25 it worked!

7:58 What should I put in a leiningen file for clojure and clojure-contrib?

8:02 somnium: :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]]

8:02 the-kenny: 1.1.0-new-SNAPSHOT is also possible for clojure too

8:02 (new branch)

8:03 fliebel: what is the difference?

8:03 the-kenny: new vs. master branch

8:03 somnium: the-kenny: I had trouble getting new-SNAPSHOT to work with swank last time I tried, have you had trouble?

8:04 fliebel: ah *looks puzzled, assumes git speak*

8:04 the-kenny: fliebel: yes, git branches ;)

8:04 somnium: Yes, I had problems too.. but I had a working setup with new in another project.. strange stuff ;)

8:04 somnium: the-kenny: I suspect it might be lein's fault

8:05 I had it working when I was doing it by hand

8:05 the-kenny: somnium: No, I had aot-problems

8:05 somnium: the-kenny: even with non-AOT swank jar?

8:05 the-kenny: somnium: hm... don't know if my swank.jar is aot'd or not

8:06 it's from clojars

8:06 somnium: the-kenny: theres nwo in the repo, the versioned is aot'ed

8:06 /s/wno/two

8:06 lein installs an AOT'ed one

8:07 guess swapping it with the slim should work

8:12 neotyk: Would like to use ClojureQL via Leiningen, what are it's coordinates ?

8:12 the-kenny: neotyk: http://clojars.org/org.clojars.snuxoll/clojureql

8:13 fliebel: How do I get command line arguments, like with the java main function?

8:13 the-kenny: ,*command-line-args*

8:13 clojurebot: nil

8:14 fliebel: that was to simple… :$

8:14 neotyk: the-kenny: thanks

8:14 the-kenny: You're welcome

8:15 fliebel: Does this sort of stuff work to get the same behavior via java or clj? (defn -main [& args])

8:15 (apply main *command-line-args*)

8:52 Whoa! Calling shutdown-agents gives me a nasty error… Without it nothing happens, but the application continues to run.

8:53 Exception in thread "main" java.util.concurrent.RejectedExecutionException (generator.clj:0)

8:55 hiredman: you shutdown the agents, but are still sending actions

8:55 the actions are rejected

8:55 fliebel: So? await them?

8:56 cemerick: oh, this is pretty: http://lesscss.org/

8:56 hiredman: fliebel: don't touch agents after you shutdown the agent system

8:57 fliebel: hiredman: I can't see how I do something to an agent after I call shutdown… hmmm....

8:58 hiredman: fliebel: you are

8:58 fliebel: yep, misplaced a paren...

8:58 I indented the shutdown, but the function stopped the line before that.

9:04 Can someone help me with a little concurrency? I got an agent vector that is appended to. At the moment I use await to wait for everything to finish. If I remove that the last few items are missing. How can I start processing those items but also make sure to get all of them?

9:05 chouser: fliebel: are you using this agent as a work queue?

9:05 the-kenny: fliebel: From where are you calling await?

9:05 fliebel: uuhm, one moment...

9:06 AWizzArd: fliebel: maybe you want http://java.sun.com/javase/6/docs/api/java/util/concurrent/ArrayBlockingQueue.html

9:06 rhickey: rc2 is up: http://code.google.com/p/clojure/downloads/list

9:07 fliebel: I use send-off to append data from files into the agent vector, then from the main thread I call await and then start using the vector.

9:07 chouser: yay!

9:07 rhickey: includes fixes for sorted collections' empty and arraymap persistent!

9:08 chouser: rhickey: I saw that. What changed your mind?

9:08 fogus: the twitterverse has been notified.

9:09 rhickey: chouser: I looked more closely at the diff, decided it was minor enough to risk the fact tht it hasn't seen any use

9:09 what I'd like to avoid is pre-release breakage

9:10 chouser: rhickey: yes, entirely reasonable.

9:10 hiredman: wow

9:10 since when did that work

9:11 chouser: That bug's been sitting there getting almost no complaints for months

9:11 rhickey: I'm thinking also next time I'd like tests for new features to be pre-reqs for release, e.g. transients should have tests

9:12 fliebel: AWizzArd: How do I use that thing you pointed to?

9:13 AWizzArd: fliebel: okay, maybe you don't know how many elements you want to put on the queue, so a http://java.sun.com/javase/6/docs/api/java/util/concurrent/LinkedBlockingQueue.html may be even better for you.

9:13 rhickey: all branches are now in sync

9:13 AWizzArd: fliebel: just call the constructor, maybe (let [x (java.util.concurrent.LinkedBlockingQueue.)] ...)

9:13 rhickey: oh that's good news, thank you

9:13 rhickey: i.e. new has all master patches

9:14 chouser: not too much painful merging I hope?

9:15 fliebel: AWizzArd: await takes only 20 ms, so unless it is dead simple to rip out my agent and use your list, I'm leaving it this way.

9:17 AWizzArd: The queues to which I pointed you also supports something like await and await-for. But it can also make sure that you get all elements and such.

9:18 hiredman: blockingqueue's are great because you can just start processing, and your processing function with wait until it has something to process

9:18 fliebel: how about send-off? the point of the whole thing was to go read thos files somewhere in teh future and come back to hem when needed.

9:19 rhickey: chouser: totally painless

9:27 AWizzArd: fliebel: where you now have your agent you use the queue. (def my-agent (agent [])) ==> (def my-queue (LinkedBlockingQueue.)) And instead of (send my-agent conj value) you can (.put my-queue value).

9:28 arj_: I'm having trouble with an anonymous function that returns a map. Defined as #({:id %)), if I call that on a string e.g. I get wrong number of arguments for persistentarraymap?

9:28 hiredman: arj_: #() is not (fn ...)

9:28 fliebel: AWizzArd: thanks

9:28 hiredman: ,(macroexpand '#({:a 1})

9:28 clojurebot: EOF while reading

9:28 hiredman: ,(macroexpand '#({:a 1}))

9:28 clojurebot: (fn* [] ({:a 1}))

9:29 hiredman: you are calling the map as a function there

9:29 arj_: aha

9:29 how would I write it then?

9:30 chouser: #(hash-map :id %) or (fn [v] {:id v})

9:30 arj_: thanks :)

9:33 devlinsf: chouser: Hey, 128 got in!

9:33 chouser: Thanks for cleaning it up

9:34 chouser: devlinsf: sure, thanks for the tests

9:34 so will your visitor be easier to write now?

9:35 devlinsf: Hehehehe..

9:35 I'm taking it to a whole new lever

9:35 level

9:35 You're gonna love it

9:36 I've still got to put a little polish on the new fn. I'll send you a link when it's done

9:39 fliebel: Can someone give me a little help with lein? I need to get an external jar included.

9:42 The faq says I have to install it into ~/.m2, but I never used maven, and typing man maven gives no result, so how should I do this?

9:50 neotyk: fliebel: google for mvn artifact install

9:55 fliebel: neotk: thanks

9:55 neotyk: fliebel: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

9:56 in lein what versions of clojure{,-contrib} I should use? 1.1.0-master-SNAPSHOT 1.1.0-rc2?

9:56 fliebel: that is not an easy command, but I'll eventually figure out.

10:01 neotyk: I can figure out file and version, do you have any idea about the others? that would save me a lot of time

10:01 neotyk: fliebel: np

10:03 fliebel: Especially artefactid…. no Idea what that means. For packaging I'd try jar, for group id the classpath, is that anywhere near correct?

10:04 rhickey: devlinsf: ping

10:05 devlinsf: rhickey: he

10:05 rhickey: Hey, thank you too

10:06 rhickey: devlinsf: Hi - saw your videos - nice. 2 nits with the transients one:

10:06 devlinsf: Sure

10:06 (How'd you find them)

10:06 (Don't post a link yet)

10:06 rhickey: transients *do* share structure, in fact, a new transient shares almost all of its structure with the persistent it was created from

10:06 devlinsf: Ooops

10:07 rhickey: what they don't do is offer persistence

10:07 and when done, the persistent adots almost all of the structure of the transient

10:07 chouser: devlinsf: just saw a link to your videos here: http://disclojure.org/

10:07 devlinsf: Ah. I'll ad an adendum to the show nore

10:07 WOw

10:07 rhickey: a transient is more like the birthing mode of a persistent

10:07 devlinsf: Hmmm....

10:08 Okay

10:08 Good to know

10:09 rhickey: a second point, a key protection of transients is that they don't support the 'changing' interface of persistents, i.e. conj etc, so if accidentally leaked (before calling persistent!, they can't be used as a changeable persistent, even in the same thread

10:09 devlinsf: Oh yeah. Duh

10:10 rhickey: I'm working on 2 more now, transients & constraints

10:10 Eh, templates & constraints

10:10 rhickey: templates?

10:10 devlinsf: Yeah. clojure.template

10:11 rhickey: do we want to talk about that?

10:11 devlinsf: I've found a pretty cool use case

10:11 check the github for episdoe 3

10:11 http://github.com/francoisdevlin/Full-Disclojure

10:13 * devlinsf pushes commit

10:14 hiredman: neotyk: where you able to get clojurebot up?

10:20 fliebel: where is my pom.xml file? (need it for lein)

10:27 neotyk: fliebel: in lein dependencies [[groupId/artifactId "version"]]

10:27 hiredman: not yet

10:28 fliebel: neotyk: So how can I add this? http://code.google.com/p/markdownj/wiki/Maven

10:28 hiredman: well I'm around and in a better place then yesterday

10:29 neotyk: hiredman: trying to leiningenize clojurebot

10:29 hiredman: hah!

10:29 excellenet

10:29 I was thinking I should do that some day

10:30 neotyk: hiredman: but we have some issues with netowork at office now (~80% packet lost) so it goes terrible slow

10:30 hiredman: :(

10:30 fliebel: neotyk: I understand that I should add org.markdownj and all that stuff, but how do I add the scala-tools repo?

10:31 hiredman: lein would be good, since clojurebot's list of deps never seems to shrink, and I never upgrade, so getting the right set of jars would be a hassel

10:34 neotyk: I really like that you can upgrade plugins without restarting bot

10:34 if I remember right

10:36 fliebel: I found the repository keyword, but nothing about it's syntax

10:38 neotyk: fliebel: http://github.com/technomancy/leiningen/blob/master/src/leiningen/deps.clj

10:38 fliebel: I think it is [[id url]]

10:38 fliebel: neotyk: I think so to since using the string or just the url fails

10:38 neotyk: fliebel: if I read it right, though I'm new to clojure

10:40 fliebel: neotyk: you're right, but it's not yet working...

10:41 wrong version :S

10:43 It's working now!

10:43 neotyk: fliebel: so how do you use repos?

10:44 fliebel: :repositories [["scala-tools" "http://scala-tools.org/repo-releases"]]

10:44 cool

10:51 djpowell: what sort of applications does promise/deliver have?

10:51 fliebel: promise allows for dataflow programming… I'm trying to understand that :)

10:52 The basic idea is that you deliver a variable, but nothing happen untill the data arrives.

10:52 chouser: I keep using it to turn callback-driven RPC into blocking calls.

10:53 CalJunior: I am trying to implement a java interface using proxy but keep getting java.lang.RuntimeException

10:54 (def foo (proxy [SomeJavaInterface] []))

10:55 java.lang.Exception: Can't resolve: SomeJavaInterface (NO_SOURCE_FILE:18)

10:56 I did import the interface class: (import '(com.mycompany.client.SomeJavaInterface))

10:58 I know this is a boring java interop for noobs question but any suggestions?

10:59 cemerick: CalJunior: (import 'pkg.ClassName), not (import '(pkg.ClassName))

10:59 chouser: ugh. wow. that probably ought to throw something.

11:01 CalJunior: ClassNotFoundException. So it's back to the classpath drawing board again ...

11:01 hiredman: well

11:01 (import '(foo)) is importing no classes from the foo package

11:01 chouser: right

11:02 which is useless, so almost certainly not what you meant.

11:02 hiredman: I suppose it could throw something :/

11:02 fliebel: defn: Are you reading? I succeeded in finishing the very basic functionality and built a jar. I send you an email with more information. Anyone else: check out http://github.com/pepijndevos/utterson <<< my first clojure project! :)

11:02 cemerick: I don't know that that should throw an exception.

11:02 Maybe a warning printed to *err*?

11:03 chouser: if classpaths weren't tricky and a cause of newbie pain, it might be best to *not* warn or error out.

11:08 CalJunior: I'm quite sure I have set the classpath correctly.

11:09 is there a way to check this in clojure repl?

11:09 except for the import call returning a class not found exception.

11:10 chouser: CalJunior: how are you setting the classpath. env variable, command-line arg, or ... ?

11:10 cemerick: (System/getProperty "java.class.path") (if you set up the classpath in a typical way)

11:10 CalJunior: I've set the classpath in a shell script.

11:10 chouser: CalJunior: using CLASSPATH=... ?

11:11 CalJunior: basically I'm using the Progamming Clojure shell script from Stuart Halloway

11:12 (System/getProperty "java.class.path")

11:12 the jar is in the classpath according to (System/getProperty "java.class.path")

11:13 the jar includes com.mycompany.client.SomeJavaInterface.class

11:13 chouser: hm. can you look inside the .jar and see ... hm...

11:13 CalJunior: I did.

11:13 chouser: yeah

11:13 any dashes or underscores involved?

11:15 CalJunior: nope

11:15 neotyk: how do I use http://github.com/joshua-choi/fnparse from leiningen?

11:16 CalJunior: when I do (import '(com.mycompany.client.SomeJavaInterface)) - which would be wrong - clojure return 'nil' rather than ClassNotFoundException

11:16 chouser: CalJunior: yeah, that's essentially a no-op

11:16 CalJunior: right

11:16 chouser: ,(import '(i.made.this.up))

11:16 clojurebot: nil

11:16 CalJunior: clear

11:16 chouser: ,(import 'i.made.this.up)

11:16 clojurebot: java.lang.ClassNotFoundException: i.made.this.up

11:17 chouser: CalJunior: could you lisp.paste your actual results from (System/getProperty "java.class.path") and your actual import line?

11:18 lisppaste8: url?

11:18 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

11:18 CalJunior: yes I can

11:21 lisppaste8: caljunior pasted "classpath" at http://paste.lisp.org/display/92539

11:22 CalJunior: this is the actual import line: http://paste.lisp.org/display/92540

11:27 the first .jar contains com/ib/client/EWrapper.class file which is the interface I want to implement using proxy.

11:28 that would be jtsclient.jar

11:30 AWizzArd: clojurebot: max people

11:30 clojurebot: max people is 240

11:32 AWizzArd: chouser: last year we also peaked in late December/mid January with people here. And I think it was around January of this year when the first Clojure was released. Now we are close to the next one.

11:33 pdk: christmas break from work is the best time of year to futz with new languages apparently :p

11:33 AWizzArd: If my idea is right then in late January there will be fewer commits to the Clojure repository, and fewer people in here, and fewer postings in the group.

11:33 pdk: come to think of it didnt python start as a 2 week christmas break project

11:33 AWizzArd: hmm :-)

11:34 pdk: cal: if it returns nil as far as i know that indicates the import worked

11:35 but yeah the syntax with '() around package names is correct

11:35 CalJunior: chouser disagrees on this:

11:35 ,(import '(i.made.this.up))

11:35 clojurebot: nil

11:36 pdk: hmm

11:36 hiredman: (importing nothing from any package)

11:36 CalJunior: I quote: "yeah, that's essentially a no-op"

11:37 there must be a problem with my shell script.

11:38 hiredman: clojurebot: dirt simple?

11:38 clojurebot: simple setup is http://www.thelastcitadel.com/dirt-simple-clojure

11:38 neotyk: hiredman: you can check my fork, only fnparse to sort out and all dependencies are solved

11:38 hiredman: wow

11:38 CalJunior: hiredman: thanks

11:39 neotyk: hiredman: temporary putting FnParse.jar in lib will show that it is last dep to solve

11:40 hiredman: now I finally see errors like: "Caused by: java.io.IOException: Cannot run program "git" (in directory "/home/hiredman/clojure"): error=2, No such file or directory" which is great progress

11:40 hiredman: :|

11:41 yeah, and horribleness on my part

11:41 that would be clode_lookup.clj

11:41 code

11:41 neotyk: hiredman: I guess it's time for clojurebot.properties from my side :P

11:42 hiredman: I having a sneaking suspision that path is hard coded

11:42 for that particular plugin

11:42 neotyk: I've already filled issue in FNParse to make it leiningen friendly

11:43 hiredman: the fnparse author was in here the other day talking about splitting fnparse into two libraries

11:43 what I get for using something under active developement

11:43 lisppaste8: Chouser annotated #92539 "searching for a class file in a jar" at http://paste.lisp.org/display/92539#1

11:44 chouser: CalJunior: take a look at that paste

11:45 I know you said you already looked inside the .jar, but we must be missing *something*. So this has Java do the checking inside the .jar, from the same repl that's failing to load the class.

11:45 maybe it'll tell us something.

11:48 CalJunior: chouser: thanks, I'm on it.

11:58 aldebrn: Been running Rich's ant colony simulation on my i720 with (def ant-sleep-ms 1) and seeing all 8 lines in System Monitor go to ~50% floods me with hope (as someone who has tried to do parallel scientific computing on generic CPUs)

11:59 They found all the food :-/

12:01 chouser: aldebrn: that must not be the Motorola i720 Cell Phone

12:21 CalJunior: chouser & hiredman: problem resolved. my clojure setup was busted. thanks for the pointers.

12:24 chouser: CalJunior: did the jar-entries fn help diagnose at all?

12:37 CalJunior: chouser: I got the following Exception when running the jar-entries fn: Unable to resolve symbol: ->> in this context (NO_SOURCE_FILE:5)

12:38 is it relevant I was running clojure 1.0.0?

12:38 hiredman: yeah

12:39 ->> is not in 1.0

12:39 chouser: yeah, sorry. didn't think twice about that.

12:39 CalJunior: ok, glad you figured it out anyway.

12:40 CalJunior: in 1.1.0 it returns: ("com/ib/client/EWrapper.class")

12:40 so it found the class file.

12:41 chouser: so what was the actual problem?

12:46 CalJunior: good question. still trying to figure that out. the problem only occurs on my desktop. I installed the latest clojure release on my laptop added the jar file to the classpath (essentially the same shell script) and it worked.

12:52 a telling sign might be that when I run the script it boots clojure 1.0.0 while the clojure.jar file in the classpath is most definitely a more recent version (1.1 rc2 now)

12:53 chouser: CalJunior: maybe paste your script?

12:53 hiredman: clojurebot: -cp and classpath?

12:53 clojurebot: -cp and CLASSPATH are mutually exclusive

12:53 CalJunior: good point

12:53 hiredman: I dunno, just a guess

12:55 CalJunior: paste.lisp.org/display/92545

12:56 hiredman: use clojure.main

12:57 (I doubt that is the problem, but best not use Repl or Script)

12:57 CalJunior: yes, but that doesn't make a difference

12:57 in this case

12:58 hiredman: I don't think that it would

13:01 CalJunior: I deleted all clojure.jar files except for 1.1 rc2 version and it still boots 1.0.0.

13:03 chouser: maybe compojure.jar (or something) includes clojure.main?

13:03 CalJunior: I have to sign off. dinner beckons (CET). it must be my system setup, probably not clojure specific so I will try to resolve it myself. thanks again.

13:03 tolstoy: Trying running from a different user account. ;)

13:03 CalJunior: i tried removing compojure.jar. no change.

13:04 chouser: CalJunior: ok. let us know what you find, though, for when others run into similar problems.

13:04 CalJunior: different user account: good idea.

13:05 p.s. clojure the lang and the community is great. I happily donated to the 2010 funding drive.

13:06 chouser: CalJunior: great, thanks!

13:07 CalJunior: I donated under my real name, which I prefer to keep off the chat log due to my regularly less than intelligent questions :-)

13:08 chouser: understandable, if not very sporting.

13:08 hiredman: haha

13:09 chouser: I occasionally go back to the beginning of the logs which surprisingly coincide with me starting to ask questions here.

13:10 Reading my own questions helps from them helps to keep perspective on everyone else's questions. :-)

13:10 hiredman: nom de cancre

13:14 fogus: CalJunior: An Orioles fan?

13:14 chouser: "ah, for is in the svn" -- 7 Feb 2008

13:15 "I just thought recur would be more correct before I realized that it didn't really make sense for lazy-cons" -- 12 Feb 2008

13:17 cemerick: jeez, I was in here on 2/7/2008

13:18 almost two years, comin' up

13:18 hiredman: 2008:Nov:11:13:30:11 hiredman is this coljure swag, or libertarian swag?

13:18 my first question

13:18 chouser: "Chouser: But I can't say I like lisp's lack of syntax. Clojure's [vectors] help a little ..."

13:18 hiredman: such wide-eyed innocence

13:19 chouser: hehe

13:21 "Chouser: hash- and sorted-maps are immutable?" sheesh!

13:22 cemerick: ...and I was yammering on about an eclipse plugin back then.

13:22 ...using the sbcl eclipse plugin as a base, I think

13:23 tolstoy: When I use languages like Clojure or Groovy (or Erlang), I find I just don't need a big beefy IDE. Textmate works fine.

13:23 Although emacs/slime and swank work for Clojure quite nicely.

13:24 Is there something like (apropos "some key words") in Clojure?

13:24 hiredman: just wait for my gui repl

13:24 the-kenny: tolstoy: doc

13:24 oh, sorry. No

13:24 hiredman: find-doc

13:24 (doc find-doc)

13:24 clojurebot: "([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern"

13:24 tolstoy: Ah, find-doc. Okay.

13:25 hiredman: I'm going to have a write-history function that will write the repl's history to file

13:26 tolstoy: Oh, cool! Just (find-doc'd) my way to update-proxy. Might-could use that.

13:30 kylesmith: Anyone interested in giving me some feedback on my genetic algorithms / genetic programming?

13:31 Fossi: lisp just loves emacs

13:31 especially with paredit

13:32 takes editing to another level

13:42 pdk: kylesmith what sort of things are you using it for

13:56 wavis_: kylesmith: i'm not particularly experienced with those, but i'd love to have a look

14:29 fliebel: Why does prxml print? I'd like to have the output, not printing it.

14:29 the-kenny: fliebel: use with-out-string

14:30 fliebel: the-kenny: thanks… I was already looking at setting *out* myself. I hate functions that print. adding print is a small effort, caching printed stuff is harder.

14:54 LauJensen: I was looking at the Par branch last night - whats going on with that ? Still being worked on? Some of it is destined for merge with master?

15:00 drewr: LauJensen: I think I remember par being deprecated in favor of forkjoin

15:01 rhickey: the par branch is the new forkjoin stuff

15:01 it will eventually be folded in

15:01 drewr: ah

15:01 LauJensen: Any docs on the 'forkJoin' stuff I can go have a lookat ?

15:01 + \space

15:01 rhickey: but we need to have a conversation in the community about java 5, since it won't be supported by forkjoin

15:02 it would be nive to put forkjoin behind agents, future etc

15:02 nice

15:03 drewr: will that be post-cinc?

15:04 rhickey: drewr: it's unrelated, so could go before or after, more a matter of time, and focus

15:05 drewr: that's more what I meant, focus-wise

15:07 rhickey: drewr: TBD, I'm still working on what is the best path. Given deftype/protocols, the possibility exists to bring a lot of the abstractions over. At that point, many interesting things could be on the table. Primitive versions of vectors etc. Integrated par support in some of the algorithms. I also have work going on to enhance the transient support, and a possible new ref type, which interestingly go together very nicely

15:08 cinc can use protocols for its abstractions

15:08 there is simply a ton to do

15:09 chouser: which is amazing considering Clojure is already more than holding its own

15:10 rhickey: yes, its a good feeling that it can be both useful and growing

15:10 without a real tension between the two

15:10 LauJensen: uuuh that sounds interesting - transients connected with refs?

15:11 rhickey: but some of these steps might be (at least temporary) disruptive

15:11 chouser: I'm thinking specifically of our codebase at work, where for any given module we can currently pretty easily choose between C++, Clojure, Java, and JRuby. Clojure doesn't feel fractionally mature compared to C++.

15:12 rhickey: many of these things go into the 'perf-enhancing' category, even par

15:12 but that fits with make-it-right-then-make-it-fast

15:12 chouser: deftype/protocol is not entirely in that category

15:12 rhickey: LauJensen: yeah, a bit too early for me to talk about it

15:13 LauJensen: Ok

15:13 rhickey: chouser: no, definitely not, they are important for abstraction, and that was a deficit area

15:13 chouser: ^^ that's agreeing

15:13 chouser: :-) yes.

15:14 headius: make-it-fast is an endless life-sucker

15:14 rhickey: there are so many interesting areas for Clojure. Using deftype+protocols should be an important next step

15:15 drewr: I'm looking forward to deftype/proto being canonized in clojure's core; I feel like I can't get a good head model going

15:15 rhickey: headius: micro-optimization, yes, much of this is macro

15:16 drewr: protocols are substantially the way I used interfaces in Clojure's core JAva stuff, the mapping will be very transparent

15:16 danlei: quick question: I read that add-classpath will be removed in 1.1, what is the preferred way to change the cp dynamically now?

15:17 (repl use only, I'm aware that add-classpath shouldn't have been used in "real" code)

15:18 chouser: with protocols in place, the two areas I'd still love to see are weaknesses that come with the JVM and lack of compile-time correctness checking.

15:18 hiredman: danlei: try out http://gist.github.com/255766

15:18 rhickey: danlei: I'm hoping for a contribution that provides repl/interactive dynamic classpath using java.system.class.loader

15:18 hiredman: I find that bewildering

15:19 danlei: thanks hiredman & rich

15:19 fogus: chouser: weaknesses? like lack of fixnum?

15:19 hiredman: yeah, I should put a newer version with nicer macros

15:20 it's more or less http://gist.github.com/251980

15:20 generated via asm and stuffed in a jar for your classloading pleasure

15:20 chouser: fogus: I suppose, though what hurts me more often are startup time and deployment complexity (classpaths, lein resorting to python for installation, etc.)

15:21 fogus: chouser: what I mean by that is weaknesses in that category. fixnum, tco, etc...

15:21 chouser: ahhh, nevermnd I see

15:21 fliebel: How do I set *warn-on-reflection* and friends? Just using def returns all sorts of errors.

15:21 chouser: I suppose a different jvm could potentially solve all those problems for a wider variety of languages.

15:21 the-kenny: fliebel: set!

15:22 chouser: ...but I'm more interested in cinc, to solve all those problem and many others, if only for Clojure.

15:23 I would simply love for target platform requirements to (almost) never be a reason to not use Clojure.

15:23 fliebel: the-kenny: thanks

15:23 chouser: need to write a bit of logic in your auto-configuring browser proxy rules? Good thing Clojure compiles to javascript...

15:24 need to customize an app that is scritable only via lua? Clojure seqs and immutable collections are still handy there.

15:25 fogus: Oh I see a lot of value in cinc... and compile-time correctness checking.

15:25 fliebel: chouser: clojure = js? what is cinc?

15:26 fogus: cinc -- allowing people to complain about lack of tco across multiple platforms!

15:27 rhickey: fogus: yes, spread the blame :)

15:27 fogus: ;)

15:28 notostraca: so you can get clojure to compile to JS now? using what, GWT or something?

15:28 fogus: I had an interesting question on my blog that I have not had time to think about... basically, the question was "what does :pre :post buy us above `(assert)`?"

15:28 the-kenny: notostraca: There are some small libraries.

15:29 Macros in clojure make translating clojure to * very easy

15:29 cemerick: fogus: idioms are good :-)

15:29 notostraca: i would like to see clojure-> haXe myself

15:29 fogus: fliebel: http://blog.n01se.net/?p=41 cinc

15:30 cemerick: ?

15:30 rhickey: fogus: also documentation, and perhaps amenable to automatic use (in test generation etc)

15:30 cemerick: fogus: :pre and :post provide standard hooks for 99.5% of all assert usage

15:30 ska2342: I keep asking myself whether Clojure will still be a Java-library, too after CINC is complete.

15:31 rhickey: ska2342: what do you mean by that?

15:31 cemerick: insofar as asserts define the "contract" of a fn, providing them in predefined slots is a good thing

15:32 ska2342: rhickey: people keep talking about how easy it is to call Java from Clojure, but the other way round (without using Compiler and Clojure-source-strings) is very interesting, too.

15:32 chouser: using assert instead of :pre is usually pretty straightforward, if you had to do it. Using assert instead of :post is a pain.

15:32 rhickey: ska2342: that will be just as easy - that's why protocols have a mapping to interfaces

15:33 fliebel: the-kenny: how does that set! thing work? (set! *warn-on-reflection* true) gives me an exception.

15:33 ska2342: rhickey: what about IDE support, will they need to have some Java _sources_ hanging around or are they doing everything via introspection?

15:33 fogus: all of that RE :pre :post sounds like a reasonable response. Is there anything that :pre :post provide (besides test gen, etc...) that assert cannot?

15:33 notostraca: i second fliebel's question

15:34 the-kenny: fogus: It's used exactly like this

15:34 (in the repl)

15:35 rhickey: fogus: potentially pre and post conditions could come from somewhere other than where the body does

15:36 ska2342: as a sidenote: I really like that line "Clojure is a library, too", sounds even better in German :-)

15:36 rhickey: ska2342: the IDEs are working with Clojure source already

15:37 fliebel: the-kenny: (set! *warn-on-reflection* true) is what's on the java-interop page, but that gives me a java.lang.IllegalStateException

15:38 ska2342: rhickey: I have a feeling that it would be good to maintain that feature. But then, what I do know... I do fully trust you on this.

15:39 rhickey: ska2342: there will be no reduction in interop either way

15:39 ska2342: rhickey: cool

15:39 fogus: rhickey: "somewhere other than where the body does" which is exactly what my post is meant to show... even if I couldn't elucidate it that clearly. Thanks

15:40 joshua-choi: I'm trying to figure out the new syntax for implementing protocols directly inside a deftype

15:40 user=> (defprotocol A (a [x y]))

15:40 A

15:40 user=> (deftype B A (a [x y] [x y]))

15:40 java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (NO_SOURCE_FILE:0)

15:40 Am I doing something incorrectly?

15:40 rhickey: joshua-choi: you need a vector for fields

15:41 (deftype B [] A ...

15:41 joshua-choi: I forgot about that

15:41 But it still doesn't work for me

15:41 (deftype B [] A (a [x y] [x y]))

15:41 java.lang.IllegalArgumentException: Can't define method not in interfaces: a (NO_SOURCE_FILE:3)

15:41 rhickey: joshua-choi: now you have one too many args

15:41 joshua-choi: In deftype?

15:41 rhickey: x becomes the target object and is not in the sig

15:41 joshua-choi: Ah

15:41 rhickey: in the deftype, yes

15:42 if you want to refer to it, use :as this

15:42 KirinDave: rhickey: So… have you written up a "When to use deftype and when not to?"

15:42 rhickey: (deftype B [] :as this A (a [y] [this y]))

15:43 joshua-choi: Excellent, thank you

15:43 LauJensen: rhickey: Out of curiosity: How much time do you find to code in Clojure these days, is it mostly Java?

15:44 fanatico: Anyone have any experience access scala code from clojure?

15:44 * rhickey codes in Java so he doesn't have to

15:45 liebke: rhickey: you mean, you code in Java, so we don't have to :)

15:45 rhickey: liebke: both

15:46 but the former is more paradoxical

15:47 liebke: :)

15:48 rhickey: Clojure is now poised to wrest itself from Java

15:51 LauJensen: cinc coming close to completion ?

15:51 rhickey: LauJensen: cinc coming close to beginning

15:51 LauJensen: Well excuse me for waking up :)

15:54 fogus: fanatico; yes

15:54 danlarkin: It's too bad there's no "h" we can add to the end of cinc. I would like it to be a word, that would be fun

15:54 LauJensen: curte :)

15:54 cute :)

15:56 fanatico: fogus: great. I'm trying to use the knockoff markdown library. How would I access a singleton from clojure?

15:57 rhickey: KirinDave: I haven't, I'm not sure there are many prohibitions at this point

15:58 KirinDave: rhickey: I guess I am still struggling to follow what problems you were trying to solve outside of an underlying method to implement some stuff in clojure that was currently in java.

15:59 fogus: fanatico: Do you mean a Scala object?

15:59 fanatico: fogus: yeah.

15:59 rhickey: KirinDave: he problems I solved with Java - how to implement abstraction such as Clojure's ISeq, Associative, Collections, IRef etc

15:59 the problems

16:00 fogus: fanatico: what is happening when you try?

16:01 rhickey: Clojure depends on there being a high performance polymorphism substrate in the host, but didn't integrate it, instead used it directly in host lang

16:01 hiredman: for something on the surface appears be more like Java, Scala code seems to go through much more mangling durring compiling

16:02 fanatico: fogus: it can't find the class.

16:03 a Test object would be compiled into Test$.MODULES$, right?

16:04 hiredman: fanatico: #scala might know

16:06 fanatico: hiredman: I'll ask. The scala->java bridge doesn't seem that well documented.

16:08 cemerick: it's damn scary, at least the last time I had my head in there

16:08 * the-kenny thinks the scala syntax is the most scary thing of scala

16:10 gravity: the-kenny: The syntax moreso than the type system?

16:10 the-kenny: gravity: Not sure.

16:10 * fogus looking for my old scala notes

16:10 fogus: after a year and a half of writing scala i can say that the syntax.... uhhhh, grows on you

16:11 the-kenny: gravity: I'm parentophile

16:11 gravity: heh

16:11 hiredman: like a fungus?

16:11 fogus: :p

16:11 fliebel: Why does the reflection warning stop working when you're running from a jar? When I ran a script with the warnings turned on I was able to fix them, but lein won't let me put anything in a jar with that thing in it.

16:11 fogus: I've found scala's syntax to suffer from C++'s 20% problem

16:11 hiredman: fliebel: the reflection warning happens at compile time

16:12 not runtime

16:12 cemerick: fogus: i.e. you need to make sure you stay away from the 20% that is incomprehensible?

16:12 fogus: fanatico: I can't find my notes! :( Help fail

16:13 technomancy: cemerick: ... and everyone has their own 20% =)

16:13 fliebel: hiredman: but can't compile just ignore it? It not very nice to have to edit code when switching from jar to clj.

16:13 saml: how can I execute external commands?

16:13 hiredman: fliebel: what do you mean?

16:13 cemerick: technomancy: right. I worry about that in clojure when I see discussions pro and con of pointfree vs. ->> and ->

16:13 fogus: cemerick: Given that there are typically 5 ways to do anything in scala, people tend to adopt their favorite way which tends to not be "your" way

16:14 fanatico: The type system is insanely complex, but I haven't seen much production code that using the scarier parts. I wonder if it'll end up like C++, where there are a bunch of style guides that dictate which 60% of the language is usable, and they all disagree.

16:14 fliebel: hiredman: that it does not compile as long as that line is in there...

16:14 hiredman: fliebel: clojure always compiles

16:14 clojure is never interpreted

16:14 fliebel: hiredman: huh?

16:14 gravity: Perl managed to get a set of best practices that are being widely used, and they use code analysis to enforce it. I could see Scala going that way.

16:14 hiredman: ah

16:14 I see

16:15 fogus: fanatico: my point exactly. ;)

16:15 hiredman: I understand

16:15 fliebel: you can only use set! if a binding has been setup for that var

16:16 which the repl code does for *warn-on-reflection*

16:16 fliebel: ah...

16:16 hiredman: so loading it outside of the repl will fail

16:16 (which compiling does)

16:16 aot compiling

16:17 fanatico: fogus: much nicer language than C++, but yeah, "multi-paradigm" is a scary description for a language.

16:17 fliebel: hiredman: ok, now I understand… are all those *something* repl-only?

16:17 hiredman: fliebel: the bindings for them are setup by the repl code

16:17 fogus: I can't complain though... I've enjoyed working with Scala... it makes my work life bearable

16:17 technomancy: I noticed in duck-streams there's a :tag "java.lang.Boolean"

16:18 apart from the java.lang being redundant, is that a mistake?

16:18 I mean, strings don't get eval'd in that context, right?

16:18 hiredman: technomancy: they do, if I recall

16:18 technomancy: interesting. what's the reasoning behind that?

16:19 or is it just a historical quirk?

16:19 hiredman: useful historical quirk I think

16:19 technomancy: useful?

16:20 hiredman: you could do stuff like #^"[Ljava.lang.Object;"

16:20 before there was support for #^objects

16:20 still can do it for arbitrary array types

16:21 hmmm

16:21 java/lang/Object actually

16:22 technomancy: oh, I didn't realize you could use that notation

16:22 hiredman: so maybe that Boolean is a mistake?

16:22 technomancy: it looks so hideous I assumed it was garbage

16:22 or garbled

16:22 hiredman: there are two representations for class names used in the jvm

16:22 cemerick: that string :tag trick is super-useful for type-hinting in macros

16:23 hiredman: java/lang/Object and Ljava/lang/Object;

16:23 a [ preifx means array of that type

16:26 technomancy: is tagging vars like *default-encoding* actually helpful?

16:27 I thought it was mostly recommended for function args/return values

16:34 q1: mmm i have an ArraySeq. tips on pulling out one particular index value, say 5.

16:37 neotyk: hiredman: thanks for pulling my changes

16:37 hiredman: just into a lien branch for now

16:37 q1: this seems to work, not sure it's the gbest way: (get (vec *ArraySequence*) 5)

16:37 arohner: q1: by arrayseq, you mean a java array you've run (seq) on?

16:38 q1: arohner: a return value from (re-split)

16:38 arohner: ,(doc nth)

16:38 clojurebot: "([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."

16:38 q1: thanks

16:38 Heh i'm pretty new. Still learning the core api.

16:38 arohner: np

16:39 neotyk: hiredman: thanks anyway, it is nice

16:40 drewr: joshua-choi: is json.clj based on fnparse 2.2.4 or 3.beta?

16:54 LauJensen: Did a small blogpost showing off a little emacs/compojure/clojureql cocktail http://www.bestinclass.dk/index.php/2009/12/dynamic-interactive-webdevelopment/

17:13 joshua-choi: drewr: FnParse 2.2. 3.beta.2 is completely out of date; it was before I decided to split the library; don't touch it. :)

17:13 I mean, 3.beta.0 and .1.

17:19 drewr: joshua-choi: ok, thanks!

17:21 neotyk: joshua-choi: did you have a chance to look at http://github.com/joshua-choi/fnparse/issues/#issue/1

17:21 joshua-choi: Ah, yes, sorry for not replying yet

17:21 I'm going to do that today

17:22 I'll let you know when I do so

17:22 neotyk: joshua-choi: awesome!

17:42 durka42: LauJensen: awesome video

17:45 LauJensen: durka42: thanks :)

17:54 arohner: whee! I crashed my JVM with an infinite loop:

17:54 Invalid access of stack red zone 0x130648ce0 rip=0x12f185900

17:54 ./start.sh: line 33: 20505 Bus error

18:32 I have an add-watch causing an infinite loop. I assume that would happen if my watch function triggers a modification to the ref it's watching, but I don't think that's the case. Can anything else cause it?

18:33 my watch function doesn't update the ref it's watching, but does update other refs.

18:49 neotyk: hiredman: I get NPE in clojurebot.clj:22 clojurebot.clj:20 can you help?

18:51 jweiss: bah, i can never remember how to convert :blah to "blah"

18:51 ,(str :blah)

18:51 clojurebot: ":blah"

18:51 jweiss: doesn't work...

18:52 tolstoy: ,(name :blah)

18:52 clojurebot: "blah"

18:53 jweiss: tolstoy: great, thanks

18:53 hiredman: neotyk: yes

18:54 neotyk: hiredman: seems like props file is missing

18:54 hiredman: yes

18:54 clojurebot doesn't come with the properties file

18:55 neotyk: ha, now it does with template with dummy values

18:55 but lein is not adding resoures to classpath

18:55 hiredman: right

18:55 neotyk: i mean my fork does

18:55 hiredman: what?

18:55 neotyk: it has dummy prop file

18:56 hiredman: last I heard lein had a bug where it was not adding ./resources to the classpath

18:58 liebke`: AAAAA

18:59 oops :)

18:59 hiredman: ?

19:02 neotyk: hiredman: it has to be something with lein uberjar, as if I start manually with src and resources in classpath i have next error

19:02 hiredman: maybe the uberjar sets the classpath internally

19:04 neotyk: hiredman: I think it is dependent task of uberjar: compile that does it wrong

19:04 hiredman: oh, when building the uberjar you get the exception?

19:05 neotyk: when "lein uberjar"

19:05 but at compilation phase

19:05 hiredman: you are going to have issues with aot'ing clojurebot to begin with

19:05 because clojure's compiler runs every thing as it compiles

19:05 neotyk: what is aot'ing?

19:05 hiredman: ahead of time

19:05 ahead of time compiling

19:06 neotyk: so probably leiningen was not that good idea to start with

19:06 as part of it's build process is compilation

19:07 hiredman: well clojurebot can be alterd

19:07 compilation is overrated to begin with

19:07 lein needs a "just jar up the clojure src" target

19:08 neotyk: agree

19:08 technomancy: that'll be default for the jar task in the next version

19:09 the-kenny: awesome :)

19:10 hiredman: and /bin/sh right?

19:10 :P

19:10 technomancy: sure

19:16 hiredman: neotyk: anyway, you don't actually need a clojurebot.clj to launch clojurebot, it's just how I do it

19:16 you can also leave clojurebot.clj out of the src/

19:17 neotyk: it is very useful for me, I'm also learning clojure at-the-same-time

19:17 kylesmith: pdk: ping

19:18 wavis: ping

19:18 fanatico: Is there a way to get more debugging information from `import`?

19:18 wavis: kylesmith:ack

19:18 hiredman: neotyk: more or less what clojurebot was(is?) for me

19:18 fanatico: not really

19:18 what import does is actually very simple

19:19 kylesmith: wavis: sorry, I had to leave before. http://github.com/fakejennick/gp

19:19 hiredman: usually in a namespace a symbol foo/bar will map to var #'foo/bar

19:20 (import '(foo bar)) maps the symbol bar in the namespace to the class foo.bar

19:20 fanatico: hiredman: http://pastebin.ca/1725466

19:21 wavis: kylesmith:thanks! can't look much at the moment, but I have to do some ga at some point in the near future so I will

19:21 hiredman: fanatico: not going to fly

19:21 neotyk: hiredman: bot got connected :D

19:21 hiredman: you had better put the class in a package

19:21 :D

19:21 kylesmith: wavis: cool. let me know what you think.

19:21 * neotyk is doing a happy dance

19:22 hiredman: (import (HelloWorld)) is also not correct (but using classes that are not in packages is a bad idea)

19:22 kylesmith: wavis: I also have a wrapper for Jgap

19:22 hiredman: should be something like (import HelloWorld)

19:23 wavis: kylesmith: didn't even know about jgap. cool!

19:23 hiredman: (import (HelloWorld)) imports no classes from the non-existant package HelloWorld

19:23 the syntax is (import (PackageName ClassName1 ClassName2))

19:31 fanatico: hiredman: thanks. got it working.

19:39 scala interop works!

19:39 user=> (.toString (DefaultDiscounter/toXML (DefaultDiscounter/knockoff "_hello_ world")))

19:39 "<p><em>hello</em> world</p>"

19:44 jweiss: i could have sworn there is a shorthand for (not (nil? x)) somewhere

19:45 not the easiest thing to find

19:45 or maybe i am imagining it? (not-nil? x)?

19:47 chouser: usually you'd just say x

20:00 q1: any tips on applying a case insensitive regex?

20:02 danlarkin: #"(?i)foo"

20:02 q1: ah ha! thank you.

20:02 jkoppel: What's the best way to write a macro foo such that (foo a) expands to (baz (bar ~a))?

20:03 (defmacro [a] `(baz (bar ~~a))) gives me errors, though I think something similar works in CL

20:05 slashus2: jkantz: Would (defmacro b [a] `(baz (bar ~'~a))) work?

20:06 jkoppel: Yes!

20:06 Thanks!

20:10 neotyk: good night

20:45 jweiss: given a fn, is it possible to get how many args it takes?

20:47 hiredman: ,(->> (fn []) class .getMethods (map #(.getName %)))

20:47 clojurebot: ("invoke" "compare" "applyTo" "withMeta" "withMeta" "call" "applyToHelper" "throwArity" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "run" "meta" "wait" "wait" "wait" "hashCode" "getClass" "equals" "toString" "notify" "notifyAll")

20:47 hiredman: ,(->> (fn []) class .getDeclaredMethods (map #(.getName %)))

20:47 clojurebot: ("invoke")

20:47 hiredman: ,(->> (fn []) class .getDeclaredMethods first class .getMethods)

20:47 clojurebot: #<Method[] [Ljava.lang.reflect.Method;@6b0a6a>

20:47 hiredman: ,(->> (fn []) class .getDeclaredMethods first class .getMethods (map #(.getName %)))

20:47 clojurebot: ("invoke" "hashCode" "getModifiers" "equals" "toString" "getName" "isSynthetic" "getTypeParameters" "getDeclaringClass" "getAnnotation" "getDeclaredAnnotations" "getReturnType" "getParameterTypes" "toGenericString" "getGenericReturnType" "getGenericParameterTypes" "getExceptionTypes" "getGenericExceptionTypes" "isBridge" "isVarArgs" "getDefaultValue" "getParameterAnnotations" "isAnnotationPresent" "getAnnotations" "setAcc

20:48 hiredman: ,(->> (fn []) class .getDeclaredMethods first .getTypeParameters)

20:48 clojurebot: #<TypeVariable[] [Ljava.lang.reflect.TypeVariable;@6a21b2>

20:48 hiredman: ,(->> (fn []) class .getDeclaredMethods first .getTypeParameters count)

20:48 clojurebot: 0

20:48 hiredman: ,(->> (fn [x]) class .getDeclaredMethods first .getTypeParameters count)

20:48 clojurebot: 0

20:48 hiredman: :|

20:48 slashus2: :-(

20:49 hiredman: ,(->> (fn [x]) class .getDeclaredMethods (map #(.getParameterTypes %)))

20:49 clojurebot: (#<Class[] [Ljava.lang.Class;@8bca43>)

20:49 hiredman: ,(->> (fn [x]) class .getDeclaredMethods (map #(count (.getParameterTypes %))))

20:49 clojurebot: (1)

20:49 hiredman: ,(->> (fn [x]) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))

20:49 clojurebot: 1

20:49 hiredman: ,(->> (fn [x y z]) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))

20:49 clojurebot: 3

20:49 slashus2: yea

20:50 hiredman: jweiss: more or less

20:50 slashus2: would first work instead of (apply max)?

20:50 hiredman: ,(->> (fn ([x]) ([x y z])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))

20:50 clojurebot: 3

20:51 hiredman: max arity

20:51 ,(->> (fn ([x]) ([x y z])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply min))

20:51 clojurebot: 1

20:51 hiredman: min arity

20:51 slashus2: I see

20:51 hiredman: ,(->> (fn ([x]) ([x y z]) ([& m])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))

20:51 clojurebot: java.lang.Exception: Can't have fixed arity function with more params than variadic function

20:51 hiredman: ,(->> (fn ([x]) ([x y z]) ([a b c & m])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))

20:51 clojurebot: 4

20:51 hiredman: not quiet right

20:53 arohner: you can also get the arglist from the var's metadata. Of course, that only works if the fn is def'd

21:00 jweiss: hiredman: wow, that was a lot of work : ) thanks!

21:01 hiredman: restfns implement an extra method so you can check for that

21:01 ,(->> (fn [& x]) class .getDeclaredMethods (map #(.getName %)))

21:01 clojurebot: ("getRequiredArity" "doInvoke")

21:01 hiredman: huh

21:01 ,(->> (fn [& x]) class .getRequiredArity))

21:01 clojurebot: java.lang.IllegalArgumentException: No matching field found: getRequiredArity for class java.lang.Class

21:02 hiredman: ,(->> (fn [& x]) .getRequiredArity))

21:02 clojurebot: 0

21:02 hiredman: ,(->> (fn [a b]) .getRequiredArity))

21:02 clojurebot: java.lang.IllegalArgumentException: No matching field found: getRequiredArity for class sandbox$eval__4489$fn__4491

21:02 hiredman: :|

21:18 arohner: gah, I want :pre and :post on anonymous functions

21:20 cool, it works

21:20 ((fn [x] {:pre [(even? x)]} (* x x) ) 3)

21:20 ,((fn [x] {:pre [(even? x)]} (* x x) ) 3)

21:20 clojurebot: java.lang.Exception: Assert failed: (even? x)

22:34 quizme_: hi

22:35 can you have immutable objects in clojure ?

22:35 i mean

22:35 are user defined objects immutable in the same way lists are ?

22:36 and if not, couldn't they be?

22:41 i guess i mean struct maps

22:49 chouser: quizme_: struct maps are persistent (immutable) just like the other Clojure map types.

22:50 quizme_: i guess the reason i'm asking is that i'm just learning closure, and i'm coming from an oop background, so i'm trying to see if you can do everything in clojure that you can in oop in a concurrency-happy way.

22:52 like basically simulate state variables with some kind of clojure map, then make dispatch methods that would operate on those struct maps in an analogous way to changing state.

22:53 i have the feeling i'm saying a naughty word by saying "changing state"

22:53 JonSmith: in what context?

22:54 changing state is ok

22:54 gravity: clojure has tools (refs, atoms, agents) to deal with state, and they can handle a struct map just fine if you want

22:55 JonSmith: thinking about it, changing state is the whole point of a big chunk of the language :-P

22:56 arohner: quizme_: people build all kinds of useful programs in clojure. there are ways to accomplish everything you'd like. There's not always a direct translation from OOP, but the tools are there

22:58 quizme_: sorry. it's just hard to shake off 10 years of OOP dogma after reading half of a book on clojure.

22:58 JonSmith: does anyone have good 'high level' examples of generating (for example) HTML + CSS + Javascript (libraries tutorials etc.)

22:58 arohner: completely understandable

22:58 JonSmith: i know about scriptjure, compojure, clj-html, etc.

22:59 just wondering if anyone has written a wrapper-like framework that abstracts all of that away yet

22:59 or if there is something in another language i could leach ideas from

23:00 arohner: JonSmith: no, not yet

23:00 quizme_: JonSmith: openLaszlo exports to DHTML.

23:01 JonSmith: oh, this is interesting

23:03 chouser: JonSmith: maybe http://www.webtoolkit.eu/jwt ... I know some people have used it from Clojure

23:04 JonSmith: yeah, i will look through JWT and lazlo

23:05 hiredman: swing really is horrid

23:06 devlinsf: hiredman: why?

23:06 I kinda like it

23:07 mitchellh: Can anyone recommend some clojure libs or open source apps to study to get more familiar with the language?

23:08 hiredman: devlinsf: oh and I am just trying to beat it until it repaints right now

23:08 devlinsf: Oh

23:08 mitchellh: What're you trying to do?

23:08 hiredman: Yeah, repaint can be a pain

23:09 mitchellh: devlinsf: Anything, I just want to learn more about the "right way" to do things in clojure.

23:09 devlinsf: I just learned the syntax and read the prag prog book last week

23:09 devlinsf: just trying to get more experience

23:09 devlinsf: mitchellh: Pick a text file & parse it

23:09 JonSmith: I would suggest writing something

23:09 devlinsf: mitchellh: You know excel grunt work

23:09 mitchellh: heh

23:10 JonSmith: nah

23:10 do like

23:10 a blog or a twitter client

23:10 devlinsf: hiredman: It sucks that you have to know AWT & Swing, I agree

23:10 hiredman: I paid that price a long time ago, so I'm used to it

23:11 mitchellh: I'm also trying to figure out the proper way clojure libs/apps are built and deployed as well, I'm new to Java other than in an educational environment

23:11 devlinsf: mitchellh: Oh, okay. What environment are you used to coding in?

23:12 mitchellh: Mac with textmate or emacs

23:12 JonSmith: http://en.wikibooks.org/wiki/Clojure_Programming is an ok place to start

23:12 devlinsf: mitchellh: Okay, do you have slime?

23:12 JonSmith: has a few examples (although some might be a bit old)

23:13 mitchellh: devlinsf: I don't

23:13 JonSmith: thanks

23:13 devlinsf: mitchellh Ah, get that. It'll help you experiment at the REPL

23:13 mitchellh: That's the #1 key to learning

23:13 mitchellh: Thanks, will do!

23:14 defn: can i use destructuring to take two sequences and turn it into a map?

23:15 turn /them/ into a map

23:15 arohner: defn: no

23:15 defn: i seem to remember you could

23:15 devlinsf: defn: Use zipmap

23:16 ,(zipmap [:a :b :c] [1 2 3])

23:16 clojurebot: {:c 3, :b 2, :a 1}

23:16 defn: ah, rad

23:16 thanks man

23:16 devlinsf: n/p

23:17 chouser: mitchellh: I'd recommend reading the sources for clojure-contrib and clojure itself, to see how things are done. And projecteuler problems to build some familiarity with how to use Clojure to solve simple problems.

23:18 mitchellh: chouser: Thanks, that's a great idea

23:19 defn: i have two directories of files. one directory of files will have all possible filenames, and another directory will have only some of those filenames. what's the most efficient way to discover which examples exist in both locations?

23:19 devlinsf: defn: define efficient

23:20 defn: least code or best performance?

23:20 defn: the latter

23:20 devlinsf: Ah.

23:20 JonSmith: couldn't you make two sets

23:20 defn: i was thinking about creating a map

23:20 oh duh, a set makes more sense

23:20 JonSmith: and do an intersection

23:20 :-)

23:20 defn: yes!

23:20 brilliant!

23:20 JonSmith: !

23:20 defn: hehe, thanks

23:25 night all

23:32 arohner: sigh. why do ints and longs have to hash differently?

23:32 especially given Object.hashCode returns an int?

23:35 fanatico: chouser: is 1.1.0 pretty much frozen now?

23:35 arohner: fanatico: yes

23:35 very minor changes between now and 1.1 official

23:41 interferon: if i have a function, can i get its source?

23:41 say, (something (fn [x] (+ x y)), and (defn something [f] (<source> f))

23:42 devlinsf: interferon: Nope

23:42 interferon: You could use a custom defn

23:46 interferon: thanks

23:46 arohner: interferon: you can get it from the var, but that won't work for anonymous functions

23:48 and if you really wanted, you can get the bytecode for the function

23:48 i've considered writing that

23:51 hiredman: (let [y (.getBounds jc)]

23:51 (-> scroll .getViewport

23:51 whoops

23:51 (let [y (.getBounds jc)]

23:51 (-> scroll .getViewport

23:51 sorry

23:52 http://paste.lisp.org/display/91148

23:52 thats the one

23:55 fanatico: I've updated :pre and :post to print which condition failed, and what form caused the exception to be raised.

23:55 previously: "Caused by: java.lang.Exception: Assert failed: (= % x)"

23:56 now: "Caused by: java.lang.AssertionError: Postcondition failed when (bad-fn 2): (= % x)"

23:56 thoughts?

23:56 devlinsf: fanatico: Awesome

23:56 fanatico: I didn't like that I couldn't tell which failed

23:57 fanatico: devlinsf: same here. I remember dismissing :pre and :post when they first were added for that exact reason.

23:58 tomoj: can anyone spot the problem with this ns declaration? https://gist.github.com/3cdad726f965d4793a07

23:59 devlinsf: fanatico: I know it came up on the list

23:59 tomoj: when I try to 'lein jar' I get "java.lang.IllegalStateException: bytes already refers to: #'clojure.contrib.http.agent/bytes in namespace: clojure.contrib.http.agent"

23:59 devlinsf: fanatico: http://groups.google.com/group/clojure/browse_thread/thread/f20a8d42b2ae9093

Logging service provided by n01se.net