#clojure log - Dec 21 2009

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

0:15 Blackfoot: what's the best way to get a library like http-client installed with OSX after `port install clojure +rlwrap`

0:16 i tried installing the jar from clojars, but get an error: java.lang.NoClassDefFoundError: clojure/lang/RT (NO_SOURCE_FILE:0)

1:15 pdk`: can doto be applied to a class and have static methods of that classed used therein

1:16 or just use ..

1:31 bytecoder: if it's just a single call you can use it like ,(Math/sqrt 4)

1:31 ,(Math/sqrt 4)

1:31 clojurebot: 2.0

2:44 johnmn3: by chance, anyone know how to pull the text to the left or right of a caret in a JTextArea lazily?

3:10 how do you type hint a char[] and an int?

3:25 LauJensen: Morning team

3:32 johnmn3: an Unmatched delimiter: ) is kicking my butt!

3:33 I honestly don't see it.

3:33 vegai: a better text editor might help ;)

3:33 ska2342: johnmn3: that's probably from the smilies in your code ;-)

3:33 johnmn3: gah

3:33 ska2342: johnmn3: can we look at the code?

3:34 johnmn3: sure, one sec

3:35 lisppaste8: johnmn3 pasted "get-expr unmatched paren?" at http://paste.lisp.org/display/92408

3:35 johnmn3: forgive the ugliness

3:36 Exception in thread "main" java.lang.Exception: Unmatched delimiter: ) (ed.clj:69)

3:37 ska2342: johnmn3: I think the line .addKeyListener input is missing it's closing paren

3:38 johnmn3: according to your indentation it should be closed on the line with .requestFocus input ...

3:39 johnmn3: ska2342: if you hover over the whole form, don't you see the colored parens matched up?

3:40 vegai: johnmn3: do you ever close the [*out* starting on l66

3:40 johnmn3: ah there it is.

3:41 must have bumped a key or something.. was working fine before

3:41 the unmatched ")" had me looking for a close parens

3:42 ok, it compiles now. thanks

3:56 edbond: how to get nth element from lazySeq?

4:03 somnium: ,(nth (range 1000) 42)

4:03 clojurebot: 42

5:33 fliebel: Good morning! At least for me it is… Is there a simple way to walk a directory tree in Clojure? I know there is duck-streams, but as far as I can tell that does not include walking. Even looking around in java.io does not give me a clear way to do it.

5:33 cark: ,(doc file-seq)

5:33 clojurebot: "([dir]); A tree seq on java.io.Files"

5:36 fliebel: wow, thanks :)

5:36 cark: =)

5:36 carefull printing this sequence ... might take a while !

5:36 fliebel: I understand :)

5:37 hmm, it seems I have to create a java.io.file?

5:37 cark: that's easy : (take 10 (file-seq (java.io.File. "c:\\")))

5:39 fliebel: user=> (file-seq (java.io.File. "~/downloads/"))

5:39 (#<File ~/downloads>)

5:39 cark: i don't know if ~works in java land

5:40 fliebel: no, it does not, it seems :D

5:40 cark: there are some java properties that do the same i think

5:41 ,(System/getProperty "user.dir")

5:41 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)

5:41 somnium: '(doc file-str)

5:41 ,(doc file-str)

5:41 clojurebot: "clojure.contrib.duck-streams/file-str;[[& args]]; Concatenates args as strings and returns a java.io.File. Replaces all / and \\ with File/separatorChar. Replaces ~ at the start of the path with the user.home system property."

5:41 cark: ah there you go !

5:42 fliebel: cool

5:42 I don't need that, but ~ was the most lazy way to get to a dir with very few files.

5:42 cark: though on windows it goves me the windows home directory instead of the one i defined using the HOME variable

5:42 ahwell

5:43 somnium: hmm, it calls System/getProperty

5:44 cark: well it's the right thing to do anyways

5:44 somnium: maybe we can blame it on java :P

5:44 cark: booo java !

5:45 fliebel: Why is Clojure built on Java? It gives awesome power, but also awesome ugliness…

5:45 somnium: it will go other places eventually

5:45 cark: i think clojure wants to be practical, and the jvm is very much so

5:45 somnium: Ive been wondering about PLT Scheme lately, it has immutable lists now and compiles to C

5:46 cark: yep plt scheme is nice

5:46 fliebel: I think having Clojure compiled to C and running on Parrot would be 2 cool things to do :)

5:46 cark: i'd love to have serialisable continuations in clojure =P

5:46 somnium: and its GCed, so the path should be shorter than C#/Objective-C

5:46 er

5:47 C++ I meant

5:47 a msg on the mailing list about clojure in C++

5:48 fliebel: is parrot finished?

5:48 fliebel: somnium: no idea… they are at verion 1.9 I believe.

5:50 But I'm not sure if it's taken very seriously by developers, there are a lot of hobby project and dead/unfinished languages...

6:38 johnmn3: if anyone is using chrome, trying going here and tell me if you get popups: http://gauss.ececs.uc.edu/Users/Franco/Week6/H7/InputStreamTest.java.html

6:38 for me, chrome is actually running the .java files

6:38 and they actually work.

6:43 somnium: johnmn3: they come up here, nothing in them

6:44 johnmn3: whats the expected behavior?

6:44 johnmn3: right, if you write into the input stream, it comes out in the output stream.

6:44 boxes

6:44 I'm just surprised chrome compiles them and runs them.

6:44 could be a security issue.

6:45 somnium: ah, its not an applet

6:45 thats a definite bug report

6:46 johnmn3: InputStreamTest extends applet, but nothing says "do you want to run this applet"

6:46 you running chromium on linux? might me linux specific

6:47 /s/me/be

6:49 LauJensen: Has anyone tried working with cookies+contrib/http-agent ?

6:53 somnium: yeah linux, still beta I guess

6:54 the js console is awesome though

6:57 johnmn3: that's what I hear.. better than firebug..

6:57 * johnmn3 doesn't know much js yet though

6:57 somnium: johnmn3: it even has built in autocompletion

6:58 johnmn3: I like how when searching a page for a term, the right scrolling slide area shows highlights for hits, like a code editor

7:00 somnium: Im bet they have some amazing tools in-house

7:02 johnmn3: yea, have you heard about that emacs in firefox thing?

7:02 ymacs or yemacs or something..

7:03 clojure on top of JS, using ymacs :)

7:03 somnium: yes! that is really impressive

7:03 johnmn3: (would be cool, I mean)

7:03 somnium: totally possible

7:04 the hardest part of clojure -> js is mutability

7:05 but no threads, so maybe a js 'dialect' would be more appropriate

7:05 that or hide all data in a closure

7:05 LauJensen: You guys haven't seen ClojureScript ?

7:06 somnium: LauJensen: of course

7:07 its almost a translation from clojure to js

7:07 does it run aganst master?

7:07 Ive browsed the source quite a bit, but havent actually fired it up

7:09 johnmn3: never tried it.

7:10 LauJensen: I think its bit-rotted

7:10 Chris has talked about picking it back up, after clojure-in-clojure is done

7:12 somnium: Im doing a special-form only compiler, something like a mini-scheme with clojure semantics

7:13 implementing the entire clojure runtime and its data-structures is a task better left to smart people like Chris :)

7:16 \me wonders if mini-scheme might be a redundant statement

7:40 LauJensen: somnium: Whats the purpose ?

7:45 somnium: LauJensen: of my yet-another-js-generator?

7:45 LauJensen: mini-scheme

7:46 somnium: clojure has lots of xml generators, why not multiple js ones?

7:46 cark: the task is harder

7:46 somnium: its for my own use in web app stuff

7:46 LauJensen: Ok, fair enough

7:47 somnium: var(kind of), let*, loop*, recur, do, fn*, if

7:47 thats my mini scheme in essence, + an approximation of deftype

7:48 cark: and it compiles to js ?

7:48 somnium: my main hope is to bring the macro system to bear on ius

7:48 yeah, though its hardly been tested

7:49 defype needs some tricks with closures to simulate immutability

7:49 cemerick: writing another lisp is a self-justifying exercise :-)

7:49 somnium: js is a poor man's scheme anyway :P

7:49 cark: it's a superset of scheme, give it some credit !

7:49 on some respect at least

7:50 somnium: :)

7:50 cark: the object system

7:50 pretty neat

7:50 somnium: I quite like js actually, but I like clojure more

7:50 cark: the syntax is horrible

7:50 there is no way to have a sane indentation

7:51 LauJensen: cemerick: really? :) I've always found it pointless when people implemented other lisps in Clojure - Like Qi for instance. Nobody asks Mercedes to implement a Fiat on their technology.

7:51 cark: LauJensen : what if you want some features you don't have in clojure

7:52 LauJensen: looking at your blogpost about arc challenge

7:52 LauJensen: See ClojureQL for an example

7:52 cark: you don't have continuations in clojure, so your solution is very different

7:52 LauJensen: Thats right

7:52 cark: also you might want a restricted scripting language for your app

7:53 cemerick: LauJensen: programming languages are modes of expression, as well as tools, and the search space in both cases is infinite. Once you stop looking for better options in either category, you're doing yourself a huge disservice.

7:53 cark: there are plenty good reasons to do that kind of stuff

7:53 somnium: one nice thing about js is you get interface injection for free

7:54 and functions carry their source around with them

7:57 my motivation is practical though, macros for dojo/mootools, map-reduce fns for couch or mongo, in clojure

7:58 cark: well js has good support for literals, in some respect that's quite the same as macros

7:58 cemerick: somnium: there is a clojure view server for couchdb out there, FYI

7:59 somnium: http://github.com/tashafa/clutch/

8:17 somnium: cemerick: im not very familiar with couchdb, are views defined in json or javascript? (ie. can you execute arbitrary js in a view?)

8:17 cemerick: somnium: views are defined by code stored in JSON

8:17 by default, that code is js

8:18 erlang is now supported, though I'm not familiar with the mechanism there

8:18 clojure views are clojure code, stored in json, and executed by a clojure view server running next to couchdb

8:23 somnium: cemerick: is the range of fns that the clojure view server can store/execute limited at all?

8:23 cemerick: nope

8:23 the code for any view is just a string, so it's entirely up to the view server to determine the semantics of that

8:24 obviously a concern if you're running an "open" couch, but hardly anyone does

8:28 G0SUB: I have an abstract class which is later implemented in some other place. I am facing some problem with type hints. If I put the type of the abs. class, it does not work.

8:28 what is the way to deal with this?

8:28 somnium: cemerick: can the view server translate any clojure fn to js I mean?

8:29 cemerick: somnium: translate a clojure fn to js?

8:29 no, surely no

8:29 not

8:29 what would the point of that be?

8:29 G0SUB: somnium: this is wrt MongoDB. I need to put a type hint while using the .findOne method which is specified in DBCollection, but is implemented in DBAPILayer.

8:30 somnium: I mostly use mongodb, you can write store js to map-reduce over a collection, aggregate and gen a new one

8:30 like a stored procedure in sql

8:30 writing those in clojure is one of my motivations

8:32 G0SUB: #^DBCollection still gens a warning?

8:32 G0SUB: somnium: no, but then, the function returns nil.

8:32 somnium: I remove the type hint, and it works.

8:36 chouser: that's pretty odd.

8:36 somnium: G0SUB: in congo it appears #^DBCollection is working

8:36 G0SUB: somnium: line number? I will check.

8:37 somnium: 71

8:37 er

8:37 wait thats in new branch

8:38 G0SUB: somnium: I see that. what about findOne ?

8:38 somnium: G0SUB: in the java driver find-one calls find and returns the first item

8:39 so its the same method essentially

8:40 G0SUB: somnium: in my case, find works well with the type hint. only find-one is failing.

8:42 somnium: G0SUB: can you paste the code? the javadocs would seem to indicate #^DBCollection is the right type

8:43 G0SUB: somnium: just a sec.

8:56 lisppaste8: G0SUB pasted "Type hint issue" at http://paste.lisp.org/display/92419

8:56 G0SUB: somnium: ^^^

8:57 ksm: How can I do some sort of list unpacking so I can send it as parameters to a function? such as: (def parameters ["value1" "value"]) (defn function [var1 var2] ...) (function (unpack parameters))

8:57 In python I would do *parameters

8:57 chouser: ksm: apply

8:57 ksm: thanks

8:58 chouser: (apply function parameters)

8:58 ksm: Neat, thanks

8:58 chouser: G0SUB: are there javadocs for that DBCollection class online?

8:58 somnium: G0SUB: what do you get if you print the type of the collection in both? #<MyCollection> ?

8:59 G0SUB: chouser: http://api.mongodb.org/java/1.1/com/mongodb/DBCollection.html

8:59 somnium: yeah, DBAPILayer$MyCollection

9:00 hmm, odd. it's working now.

9:00 somnium: does #^DBAPILayer$MyCollection work on *find-one?

9:00 G0SUB: don't know what's wrong

9:00 * somnium scratches head

9:00 G0SUB: somnium: will check.

9:00 chouser: there are two .findOne methods that take a single arg

9:01 G0SUB: chouser: how do I give it a proper type hint?

9:01 chouser: What happens if you hint the arg as well?

9:02 somnium: you can put #^DBObject on query

9:02 chouser: #^DBObject (ClojureDBObject. query)

9:02 Doesn't seem like it should be necessary, but might be interesting to try.

9:02 G0SUB: hmm

9:04 chouser, somnium: working now.

9:05 chouser: huh.

9:06 The compiler ought to be able to see that (ClojureDBObject. foo) returns a DBObject. I wonder why the hint is necessary.

9:07 G0SUB: What version of Clojure?

9:07 G0SUB: "1.1.0-alpha-SNAPSHOT"

9:08 somnium: I wonder if it sends as Object rather than interface

9:08 though, that should throw an exception somewhere

9:09 G0SUB: somnium: another help, I call .toClojure on the return value of an update operation. that generates a reflection warning. what type hint should I give it?

9:09 chouser: I think it's calling the other .findOne method.

9:09 somnium: G0SUB: Im clueless, but might be worth running some unit tests with different hints to see if its repeatable

9:10 chouser: G0SUB: those reflection warnings aren't dangerous

9:10 G0SUB: somnium: OK.

9:10 somnium: for .toClojure hint as #^ClojureDBObject

9:11 chouser: G0SUB: I wouldn't bother adding type hints unless you need them for some specific reason.

9:11 G0SUB: somnium: well, I tried that hint, didn't work.

9:11 chouser: mainly for perf.

9:12 chouser: that code is very heavily used...

9:12 chouser: ok

9:13 rhickey: where is ClojureDBObject defined?

9:14 chouser: http://tinyurl.com/yd978tf/src/main/java/somnium/congomongo/ClojureDBObject.java

9:14 somnium: G0SUB: the new branch uses protocols, it should be faster if youre doing a lot of fetch-ones

9:15 G0SUB: somnium: cool. I anyway don't use congomongo. I just took the ClojureDBObject idea from it. everything else is custom :)

9:15 chouser: rhickey: BasicDBObject: http://api.mongodb.org/java/1.1/com/mongodb/BasicDBObject.html

9:15 somnium: ah, no worries then :)

9:16 chouser: G0SUB: oh! your ClojureDBObject is not the one I just linked to?

9:16 somnium: huh, they changed it to a linked hash-map

9:16 G0SUB: chouser: it is. I just use that file.

9:17 somnium: changed what?

9:19 somnium: G0SUB: BasicDBObject used to subclass HashMap

9:19 bit-rot sets in fast

9:20 G0SUB: somnium: hmm, so is that a breaking change?

9:20 chouser: this is actually the one part of cinc that worries me a little -- getting the (newly modular) host method resolution at compile and runtime right.

9:21 somnium: G0SUB: it shouldnt break anything, DBObject is the key interface

9:21 G0SUB: somnium: do we need to modify ClojureDBObject in any way?

9:23 somnium: G0SUB: no I guess not, just need to recompile it

9:23 G0SUB: somnium: OK

9:23 somnium: can drop two deprecated methods too

9:30 G0SUB: somnium: which ones?

9:32 somnium: G0SUB: scratch that, I was thinking of a clojure implementation, the java class doesnt have to do anything

9:32 G0SUB: somnium: hmm, a Clojure implementation should be cool.

9:33 interesting clojure project -> http://code.google.com/p/clojure-textflow/source/browse/src/textflow.clj

9:56 maacl: Anyone?

9:57 somnium: maacl: does elpa indicate slime is installed?

9:57 maacl: yes

10:00 somnium: yes

10:00 callen: how much pain am I in for if I come from lisp but not java to clojure?

10:00 somnium: I think there was an issue with the download failing and not getting cleaned up

10:00 Chousuke: callen: well, you'll need to learn how to read the java docs at least.

10:01 callen: Chousuke: reading documentation is fine, I know I'd have to leverage existing java functions.

10:01 chouser: callen: classpath is likely to generate some angst

10:01 rhickey: chouser: what did you mean by " getting the (newly modular) host method resolution at compile and runtime right" ?

10:02 callen: chouser: how so?

10:02 chouser: callen: but you'll get over both of those, and then you'll be golden.

10:02 maacl: somnium: ok, any way I can do it manually?

10:02 Chousuke: callen: the classpath causes headaches for everyone. :)

10:02 somnium: maacl: technomancy is the one to ask :)

10:03 callen: Chousuke: could you explain what it is exactly that you're talking aboot though?

10:03 maacl: somnium: yeah, he doesn't seem to be around :-)

10:03 callen: Chousuke: the path to the libs?

10:04 somnium: maacl: I got it to work by putting in a blank .emacs and making sure it asked me if I want to install clojure, but that was just shotgun debugging (I had a previous version installed)

10:04 liebke: maacl: can blow away your ~/.emacs.d/elpa/ directory, and start over?

10:04 maacl: liebke: yeah, about to try that

10:05 * rhickey doesn't understand the classpath problem

10:05 chouser: rhickey: It seems to me that the method resolution algorithm in Compiler.java embodies a complex set of rules that will be rewritten for cinc. That seems more likely than any other area I can think of to appear to be correct and working only to fail later in odd corner cases.

10:05 Chousuke: callen: paths, but yeah.

10:05 chouser: rhickey: amounting to regressions in currently working code.

10:05 rhickey: chouser: hopefully there will be a cross-language thingy for this coming from the JVM language community

10:05 Chousuke: callen: the classpath tells the JVM where to find classes

10:05 callen: Chousuke: interesting. also I feel like I've seen you around elsewhere before. Where else on fnode do you chill?

10:06 chouser: rhickey: hm, that's interesting. I think I read a thread you and headius were talking about related to that.

10:06 Chousuke: callen: ubuntu channels mostly

10:06 rhickey: I don't understand the DBObject problem from before, what do I need to reproduce?

10:07 callen: Chousuke: that'd be it then.

10:07 devlinsf: rhickey: Good Morning. I was working on assembla ticket 128 w/ chouser . Could you take a look at the patch? I was hoping to make 1.1

10:08 callen: really comforting to see the creator in the IRC channel, yeesh.

10:08 can't count beyond one hand how often I see that.

10:08 devlinsf: rhickey: doesn't have to be now, but before 1.1

10:08 Raynes: callen: That shocked me as well the first time I came here.

10:09 chouser: somnium: did you try to reproduce the DBObject problem?

10:10 rhickey: devlinsf: functional patches added now won't have seen any usage prior to release - that's not good

10:10 callen: Raynes: It resembles how the mumble team works, and is thusly very encouraging for me.

10:10 devlinsf: rhickey: It's a bug fix

10:10 somnium: chouser: no, my repl is tied up

10:10 G0SUB: ping

10:10 rhickey: devlinsf: doesn't matter, it's function, not docs etc

10:12 devlinsf: rhickey: Hmmm... I'm gonna make one last appeal. Isn't one of the major points of an RC to find& fix bugs?

10:12 rhickey: people could work on any number of bugs and want to squeeze them in, at some point there needs to be a cutoff. Producing the RC was that point. I wouldn't hold up for other than a broadly impactful bug

10:12 devlinsf: rhickey: Okay, so it'll have to wait for 1.2?

10:13 rhickey: or 1.1.x patches

10:13 devlinsf: Alright

10:14 rhickey: I'll bring this up again after the release. Got to go now

10:14 rhickey: We haven't gotten much feedback on RC1 - I presume that's good ?

10:15 devlinsf: Transients & Sorted Collections

10:15 The don't work

10:15 pjb3: Anyone doing web dev with clojure? What are you using for HTML templating?

10:15 devlinsf: The concensus seems to be wait until 1.2

10:16 http://groups.google.com/group/clojure/browse_thread/thread/1281d1f7bfc6c5fa#

10:16 rhickey: devlinsf: not all collections do or will support transients, linked lists and binary trees (the sorteds) won't see much benefit vs the high-branching-factor collections

10:17 chouser: that sounds remarkably like what the transients doc page says. :-)

10:17 oh, but I should add hash-set there.

10:17 devlinsf: Right

10:17 Can we add a line explictly stating sorted don't work

10:18 gtg, really

10:24 maacl:  pjb3 enlive

10:24 pjb3: maacl: yeah, I was just reading about that

10:24 karmazilla: maybe 'transient (and 'persistent!) could just return its input collection if it is not IEditableCollection?

10:25 chouser: karmazilla: no, their largely incompatible objects.

10:26 you ought to be able to assume you can conj! on whatever transient returns

10:26 pjb3: maacl: the readme is a little dense, do you know of any simple examples?

10:27 somnium: pjb3: have you tried clout? (formerly known as compojure.html)

10:28 karmazilla: chouser: ok, maybe I'm not updated. Had just understood that the interface was suppose to be the same.

10:28 maacl: pjb3: http://wiki.github.com/cgrand/enlive/getting-started

10:28 pjb3: Or was that what you were reading?

10:28 pjb3: maacl: thanks

10:29 somnium: you mean hiccup?

10:29 somnium: thats it

10:29 pjb3: I'm not a fan of s-exps for html

10:29 I like the idea of enlive much better

10:29 chouser: karmazilla: the interface is meant to allow similarly-structured code, but the actual fns supported are mostly different

10:29 karmazilla: chouser: is there a predicate to check for IEditableCollection?

10:29 pjb3: I'd rather write the html in html and have some method to transform the dynamic parts of it

10:30 somnium: pjb3: enlive is a good bet then

10:30 pjb3: somnium: yeah, I'm gonna read the docs on enlive

10:31 chouser: karmazilla: just (instance? IEditableCollection x) I think.

10:31 the-kenny: Is there something like gwt for clojure? (I know compojure, but I'm tired of writing html and css...)

10:32 or... something like a wrapper for gwt

10:33 chouser: the-kenny: there is a thing that's a bit gwt-like, but it has a somewhat generic name that I can never remember...

10:34 the-kenny: chouser: Yes.. I remember I've seen something which sounded like how I want it on github.. but I can't find it anymore

10:34 chouser: ah, there it is. http://www.webtoolkit.eu/jwt

10:35 the-kenny: http://www.nsa.be/index.php/eng/Blog/From-OO-to-Lisp-style-structuring-my-Clojure-Jwt-app

10:36 the-kenny: chouser: ah, thank you :) I'll have a look at it

10:36 karmazilla: chouser: editable? (or something) might be a nice addition to the set of predicates, looking at what is already there

10:49 fliebel: what is the difference between send and send-off? The documentation says they both return immediately, but one should be used for blocking actions.

10:50 danm_: send-off sends to a thread pool which can grow I believe

10:51 chouser: send is only for actions that are CPU-bound, not blocking on disk or network

10:52 fliebel: hmmm, okay...

10:53 danm_: if you send a bunch of blocking actions, you can end up needlessly blocking other agents

10:53 so you use send-off for those

10:54 bOR_: so with send-off, the functions send to the agent do not neccesarily happen in the same order that they are send to the agent?

10:54 chouser: bOR_: no, actions always happen in the order they were sent, regardless of send vs. send-off

10:55 johnmn3: So I'm working on hiredman's simple code editor.. making it a repl. There's one function which is a keyListener for the enter key, which gets the text from the text field and puts in an ArrayBlockingQueue. the other repl function, start-repl-thread runs clojure.main/repl with configuration options, specifically: :read (... ((binding [*in* (.take transfer-q)]... so, my problem is...

10:56 the-kenny: bOR_: send-off uses a different thread-pool in the background.

10:56 bOR_: ah, getting it.

10:56 the-kenny: send-off is for functions with io-blocking, send for "normal" functions.

10:56 johnmn3: I want to be able to write: (defn hi [name] <enter> and not have it evaluated yet.. I already have a good function to count parens.. I just need to use some intermediate structure to hold on to the string until we have a balanced form, and then send it to read

10:57 how might one set that up?

10:59 I'm guessing some kind of function that holds a queue or buffer and keeps on filling up until it reads a matching closing parens, then it flushes the queue to the repl's read.

11:00 fliebel: Why would you ever use 'do'?

11:00 johnmn3: fliebel: to do two things where only one thing is expected

11:00 fliebel: hmmm...

11:00 chouser: fliebel: for side effects

11:01 johnmn3: ,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated))

11:01 clojurebot: EOF while reading string

11:01 johnmn3: er

11:01 ,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated)))

11:01 clojurebot: EOF while reading string

11:01 johnmn3: err

11:02 ah

11:02 fliebel: ,(if true (do (pr "hi") (pr "still here") (pr "not evaluated))

11:02 clojurebot: EOF while reading string

11:02 johnmn3: ,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated"))

11:02 clojurebot: "hi""still here"

11:02 fliebel: finally :P

11:02 johnmn3: missing that last quote

11:02 fliebel: I see

11:02 johnmn3: where if was expecting one thing to happen

11:03 but like chouser said, people should mostly use it when they're are intentionally trying to induce side effects.

11:04 (if true (do (functional thing) (pr "this string is a side effect (for logging perhaps)")) (not evaled))

11:04 fliebel: so more like… (if (do (prn "hallo") true) (prn "world") (prn "not evaluated"))

11:05 ksm: ,(do true false)

11:05 clojurebot: false

11:05 johnmn3: right

11:23 fliebel: Is there a less resource intensive way then a regex to determine if a string contains, starts with or ends with a certain string?

11:23 stuartsierra: ,(.contains "foobar" "ooba")

11:23 clojurebot: true

11:23 chouser: ,(.startsWith "foobar" "foo")

11:23 clojurebot: true

11:24 fliebel: ah, java things....

11:24 chouser: embrace java. :-)

11:24 fliebel: thanks… I was diging in the Clojure api

11:24 chouser: you're already suffering under any pain that Java is bringing. Might as well enjoy the benefits as well.

11:24 fliebel: :)

11:30 maacl: why would i get clojure-slime-config: Required feature `slime-autoloads' was not provided when trying to load swank-clojure?

11:30 fliebel: Benefit is relative in this case… Most languages offer their own solution that is documented in one place. But I must agree that Java also brings some power into Clojure.

11:44 chouser: fliebel: right. most languages reimplement strings from scratch. Clojure hasn't bothered.

11:47 johnmn3: I forgot. How do you do a counter with a closure?

11:48 chouser: ,(-> 2 inc inc inc)

11:48 clojurebot: 5

11:48 johnmn3: this doesn't work: (defn ab [] (fn [x] (let [a (atom 0)] (if (= x :inc) (swap! a inc) (swap! a dec)) @a)))

11:48 I mean where the function holds state for you.

11:49 chouser: :-(

11:49 why would you want that?

11:50 johnmn3: I'm trying to build a buffer that I can keep adding strings too.. "(asdf (asdf" until it gets a closing paren that matches the first open peren. then it returns the whole string.

11:50 lpetit: and ?

11:50 johnmn3: so I have to count parens up and down

11:50 lpetit: so count them, and pass the value in your loop

11:51 reify: johnmn3: move the let outside fn, like: (defn ab [] (let [a (atom 0)] (fn [x] (if (= x :inc) (swap! a inc) (swap! a dec)) @a)))

11:51 chouser: johnmn3: I'd recommend building a seq of strings, then passing to (apply str ...) to build your final string.

11:52 johnmn3: that's what I did. but I want to be able to make multiple calls to the function, because the user will be passing a whole function in, lines at a time, and I need a place to store those lines until the whole form is written

11:52 reify: ah

11:53 So, should I make a function that takes one char at a time?

11:54 lpetit: johnmn3: why not make this counter part of the intermediate state, having the function return {:buffer the-buffer, :open-parens the-count-of-open-parens]. And either publish the keys as part of your API, or provide helper functions to relieve the user from knowing the exact datastructure you use for holding the state ?

11:54 johnmn3: and feed each string into it with a (doseq [a argstring] (myfn a)) ?

11:55 lpetit: what does it mean to "Mark" a portion of text in emacs ?

11:55 and how to do this ?

11:56 fliebel: Ok, I got another should-be-simple-but-can't-figure-it-out issue. I got an agent to which I want to "append" items, or set to a new list with more items, if that sounds better to you. I can't figure out how to do that… send seems to be a threaded apply or something like that.

11:56 * lpetit guesses the poor eclipse guys exposes himself to a lot of RTFMs answers ...

11:56 johnmn3: then keep conjing the chars to a new string and, when a closing paren matches the opening one, flush and keep going

11:56 KirinDave: lpetit: You might wanna read the emacs programmer's guide.

11:56 lpetit: It's in every copy of emacs.

11:56 stuartsierra: lpetit: "mark" is emacs's version of select-copy-and-paste

11:57 lpetit: KirinDave: just trying to (very) quickly follow Phil's paredit-outline tutorial without having to dig into the rather comprehensive and *big* emacs doc

11:57 http://p.hagelb.org/paredit-outline

11:57 chouser: ,(let [a (agent [:foo])] (send a conj :bar) (await a) @a)

11:57 clojurebot: [:foo :bar]

11:58 chouser: johnmn3: like that?

11:58 KirinDave: lpetit: So, the thing is that emacs has a VERY different way of handling text. You literally keep using editing commands.

11:58 lpetit: stuartsierra: ok, would you mind give me the magical command combination ? :-)

11:58 fliebel: chouser: thanks… I was close, but not close enough, I was making conj an anonymous function.

11:59 lpetit: stuartsierra: and I promise not to RTFM you if you ever have a question on Eclipse :-)

11:59 fanatico: lpetit: ctrl-space

11:59 lpetit: fanatico: thx

11:59 stuartsierra: lpetit: Ctrl+Space sets the mark. Ctrl+w cuts between "point" (the cursor) and the mark. Alt+w copies between point and mark.

12:00 fanatico: and all region-specific commands work on the mark.

12:00 johnmn3: chouser: let me take that and explore it for a minute

12:00 lpetit: stuartsierra: but Phil states in his doc "Mark "declare rooms"" , so I guess mark can be placed on text selections as well as text offsets

12:01 fanatico: but I agree with stuartsierra, most people don't have the intuition for how emacs handles text (especially the kill ring), so it's best to read that section of the manual.

12:01 stuartsierra: lpetit: The mark is ONE position, not a selection. The area between the mark and the point defines the selection.

12:01 chouser: johnmn3: oh, sorry, I meant to address that to fliebel

12:01 johnmn3: oh

12:01 lpetit: stuartsierra: ok, so that's weird:

12:01 technomancy: "mark" as a verb means "make the region contain"

12:02 johnmn3: well, it applies anyway ;)

12:02 lpetit: open rooms.clj

12:02 point at right before mire.rooms

12:02 M-(

12:02 Mark "declare rooms"

12:02 Press (

12:02 stuartsierra: I dunno what that's about.

12:02 lpetit: I suppose Mark "declare rooms" means mark "d", go to after s, and then press (

12:02 it's a tutorial showing the benefits of paredit

12:03 http://p.hagelb.org/paredit-outline , line starting with ## 4. Wrangling (depth-changing)

12:03 fanatico: the point over the cursor isn't included.

12:06 unless the mark is to the right of the cursor.

12:08 maacl: technomancy: think you could help me with a swank-clojure issue?

12:12 leafw: clojure new branch fails to compile, but ant repots "build successful". IS this normal? The exception claims that clojure.lang.RestFn is not found

12:12 Caused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

12:12 probablyCorey: Would a clojure shell, like bash or zsh be a horrible idea?

12:12 leafw: actually, that is clojure.contrib ... oops, sorry

12:13 the-kenny: leafw: Do you mean clojure or clojure.contrib?

12:13 somnium: ~RestFn

12:13 clojurebot: excusez-moi

12:13 chouser: leafw: do "ant clean" in contrib before building

12:13 KirinDave: Well, besides the inability to change cwd, there is nothing wrong with it, probablyCorey.

12:13 the-kenny: ~clojure.lang.RestFn

12:13 clojurebot: ant clean and rebuild contrib

12:13 KirinDave: scsh is pretty popular.

12:13 leafw: I was mixing clj new branch with clj contrib master branch.

12:13 chouser: leafw: that's ok

12:13 probablyCorey: KirinDave: Cool, I'll take a look at scsh

12:18 leafw: clojure-contrib.jar fails to build ... with new branch on both repos

12:18 java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol (jmx.clj:89)

12:19 also lots of name conflicts: java.lang.Exception: Name conflict, can't def bytes because namespace: clojure.contrib.http.agent refers to:#'clojure.core/bytes (agent.clj:252)

12:24 chouser: leafw: use master branch of contrib

12:25 leafw: chouser: new branch of clj and master of contrib

12:25 ok

12:25 chouser: yeah. :-/

12:25 leafw: makes total sense xD

12:25 (i.e. it doesn't)

12:26 chouser: well, clojure 'new' is almost entirely backward compatible with clojure 'master', so contrib 'master' works fine with it.

12:26 contrib 'new' is where some people have started playing with clojure 'new's new features, but obviously they're not keeping up with it.

12:27 hm, I wonder if a merge from contrib 'new' would fix it.

12:27 leafw: it did build, clj new and contrib master. Thanks.

12:27 technomancy: probablyCorey: IMHO eshell is another excellent shell written in lisp; I use it nearly exclusively

12:27 leafw: by the way what is the timeline for clj new to become master? 1 month? 6 ? a year?

12:29 chouser: leafw: I think we're still hoping for 1.1.0 final to be out by christmas. that would free up master to take on the 'new' patches.

12:29 not sure how fast rhickey will pull the trigger on that, but my guess would be a few weeks at most.

12:30 leafw: cool

12:30 that's good news. Thanks.

12:31 chouser: it's not so much news as a guess, so I hope I'm not off by too much. :-/

12:32 leafw: well: you just brougth it to the low end of the spectrum I threw (1 motnh to a year)

12:32 lpetit: stuartsierra: ok, certainly the text should have read : "select" instead of mark

12:33 technomancy: lpetit: they are synonyms

12:33 lpetit: technomancy: gaining knowledge of paredit by reading through your excellent paredit-outline intro text

12:33 technomancy: well, that's not what I was told by Stu

12:34 Must leave, there's a "toast" here at work :)

12:34 technomancy: lpetit: great! but I wrote that actually for notes to myself about how I should record a screencast. so it uses terminology that may not be appropriate for people getting started with Emacs. =)

12:34 lpetit: technomancy: ok, good to know that :)

12:35 technomancy: how complete on the subject of paredit do you think the tuto is ?

12:35 technomancy: lpetit: it's everything I use, but there's still maybe 15% of paredit that it doesn't cover

12:35 lpetit: technomancy: and what would you suggest me as a tutorial for gaining even more knowledge ?

12:36 technomancy: the obscure bits that I haven't internalized myself

12:36 lpetit: unfortunately there's not much apart from reading the source. that's why I started the project.

12:36 (the project to create a screencast on it)

12:36 lpetit: technomancy: if there's just ~ 15% left, seems ok to me to hope have this rather sooner than later in ccw, then

12:55 jneira: hi people

13:09 technomancy: did a de-chunking mechanism ever get checked in?

13:09 ISTR mentions of an experimental way go back to 1-at-a-time seqs

13:16 Chousuke: technomancy: not as far as I know :/

13:16 technomancy: yeah, looking back at it there are only mentions that such a mechanism is being discussed

13:17 Chousuke: I suppose a simple lazy-seq doing rests on the chunked seq is not enough? :/

13:18 technomancy: Chousuke: nope: (def x (seq (rest println (range 39))))

13:18 that prints 0 - 31

13:18 oops

13:18 I meant (def x (rest (map println (range 39))))

13:22 lpetit: ,(def x (rest (map println (range 39))))

13:22 clojurebot: DENIED

13:23 technomancy: the def is just to prevent the repl from printing it; you could wrap it in a do or some such

13:25 lpetit: my bad

13:25 ,(do x (rest (map println (range 39))))

13:25 clojurebot: java.lang.Exception: Unable to resolve symbol: x in this context

13:25 lpetit: I'm really a stupid guy sometimes

13:26 ,(do (rest (map println (range 39))) nil)

13:26 clojurebot: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

13:27 fliebel: I just wrote some Clojure code… with a purpose and some threading for the first time :D ( defn ) http://github.com/pepijndevos/utterson/blob/master/src/utterson/core.clj

13:38 pdk: what would be the equivalent of doto for a class instead of an instance so you could call static methods in the doto block

13:45 stuartsierra: ,(.parseInt Integer "123")

13:45 clojurebot: java.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.Class

13:46 Chousuke: hm

13:46 can't you do (doto someobj Integer/parseInt)?

13:51 hiredman_: Chousuke: that would return someobj and be rather pointless

13:51 ~macros

13:51 clojurebot: Barking spiders!

13:53 chouser: pdk: I think you'd have to write your own macro

13:53 pdk: hm

13:55 chouser: (defmacro dostatic [cls & ms] (cons `do (map #(list* `. cls %) ms)))

13:56 fliebel: How can I get a regex to just evalulate to true or false? All of them seem to return lists and java stuff...

13:57 chouser: fliebel: re-find will return nil when it can't find a match

13:57 re-matches too, actually

13:57 fliebel: chouser: thanks, but that is nox exactly clear form the docs

13:57 chouser: and also re-seq, apparently. So take your pick! :-)

13:59 polypus: anybody know if google web toolkit is useable from clojure? i'm not really sure how GWT works internally

13:59 fliebel: chouser: which is the most efficient?

14:00 chouser: polypus: I've not heard of anyone using it successfully.

14:00 polypus: I believe the to-js compiler in GWT reads Java sources

14:01 cark: hum, wasnt it byte code

14:01 ?

14:01 polypus: huh, so direct java -> js. too bad it's not bytecode. even better would have been to just have the java generate js

14:01 chouser: fliebel: probably re-matches, though it requires the regex match at the start of the string.

14:01 cark: chouser : ah looks like you're right =(

14:01 chouser: cark: you may be thinking of android

14:02 fliebel: thanks

14:02 polypus: chouser: anyways, thx

14:02 cark: chouser : right

14:02 chouser: fliebel: doubt it'll make much difference for performance. re-find or re-matches seem clearest in their meaning if you're just treating it as true/false.

14:03 fliebel: chouser: I'm going to stick with re-find, since I reorganized my code to evaluate it only once.

14:04 chouser: ok

14:06 polypus: maybe it's possible to use GWT if only ever in development mode: "When an application is running in development mode, the Java Virtual Machine (JVM) is actually executing the application code as compiled Java bytecode, using GWT plumbing to connect to a browser window"

14:07 stuartsierra: it still uses Java source I think

14:08 chouser: polypus: I've wondered the same, though I didn't persue it.

14:08 polypus: stuartsierra: what, performs some extra analysis ontop of the bytecode compile?

14:08 chouser: polypus: Also wondered about a clojure-to-java-source compiler.

14:09 stuartsierra: polypus: No, I think GWT has its own compiler that reads Java sources.

14:09 polypus: chouser: yeah the latter crossed my mind too

14:09 chouser: but actually, when I played with it, the problem was Clojure's collection types use all kinds of unsupported (by gwt) classes.

14:09 gwt won't produce js for Clojure's own .java code without quite a bit of hacking at it.

14:10 * stuartsierra wonders why everyone is so afraid of learning JavaScript

14:11 chouser: stuartsierra: I learned JavaScript already, I just want macros.

14:11 hiredman: people want to leverage existing tools

14:11 chouser: and immutables locals and persistent collections.

14:11 hiredman: chouser: really? I just want parens

14:11 chouser: and the seq abstractions

14:11 polypus: stuartsierra: i actually don't mind javascript. but just trying to pick a toolkit and gwt has a nice crossbrowser canvas implementation

14:11 cemerick: I thoroughly dislike the entire web development experience, and js + browser dom is a big part of that distaste

14:11 polypus: which i need

14:12 chouser: js rivals ruby for my second-favorite language.

14:12 I wonder how hard it would be to compile js-like syntax into clojure.

14:12 polypus: chouser: ditto

14:13 hiredman: chouser: :(

14:13 chouser: hiredman: teehee!

14:14 cemerick: syntax is *not* the problem, browser quirks are IMO

14:14 chouser: browser quirks are an issue, though js itself has surprisingly few. The DOM makes up for it.

14:14 hiredman: I'm waiting for browsers to be rewritten in js

14:14 cemerick: right, the dom side of things is what I was referring to

14:15 chouser: indeed. And I tried js without the DOM once (thanks, Yegge). Turns out that's worse.

14:15 hiredman: really a browser could just be something like a smalltalk image

14:15 polypus: i'm waiting for browsers to standardize ontop of some VM so we can use whatever language we want.

14:15 stuartsierra: polypus: dream on

14:15 chouser: polypus: I think that's what hiredman just said.

14:15 hiredman: polypus: they did, it's called js

14:15 polypus: i expect to be dead before that happens though :)

14:16 hiredman: js is the browser bytecode

14:16 which is why you have things like gwt

14:17 polypus: anybody ever write a VM in javascript?

14:18 hiredman: http://ejohn.org/blog/ruby-vm-in-javascript/

14:18 etc, etc, etc

14:20 chouser: Nintendo emulator in pure javascript: http://benfirshman.com/projects/jsnes/

14:23 hiredman: http://mxr.mozilla.org/mozilla/source/js/narcissus/

14:23 :D

14:24 jneira: user experience emulator in bastard javascript: http://www.microsoft.com/windows/ie/ie6/default.mspx

14:25 polypus: narcissus must be a speed demon :)

14:26 hiredman: :P

14:26 modern js engines are fast

14:26 chouser: compared to? non-modern js engines?

14:26 hiredman: yes

14:27 like last years :P

14:27 chouser: :-)

14:28 hiredman: so you just need a compiler to lower js to native code, and a nice ffi

14:29 fliebel: lol, jsnes is cool :P

14:30 alexyk: anybody here used clojure-twitter?

14:31 hiredman: huh, apparently yeggie's js in elisp is based in part on narcissus

14:32 fliebel: alexyk: tell me about it, I love writing little twitter apps :)

14:33 alexyk: fliebel: I'm just looking for tips on making it work

14:34 fliebel: alexyk: looks quite straightforward, what's wrong?

14:35 alexyk: fliebel: getting oauth going -- but I think I found that I should register a separate "client" for it

14:36 fliebel: alexyk: yea, you need to register your client at twitter before you can do oauth, they'll give you a token to work with.

14:36 alexyk: fliebel: it has "use Twitter for login," do I need that?

14:37 fliebel: wait a moment

14:37 http://twitter.com/oauth_clients/new

14:38 yes, you want to use twitter for login

14:38 oh, wait

14:38 alexyk: fliebel: right, it has a checkbox saying "use Twtter for login," I wonder what that means

14:39 fliebel: no, i don;t think so...

14:39 alexyk: if oauth's idea is to be able to login without twitter user/password

14:39 fliebel: alexyk; do you know disqus?

14:39 alexyk: fliebel: yep

14:39 fliebel: alexyk: they let you login using twitter, if you are going to do that, check that box, else don't

14:41 alexyk: after you registered you can go to http://twitter.com/oauth_clients/ and click your application to see the secret and key

14:42 alexyk: yeah, I see that... what I'm not clear about is how can I post to my account if I don't provide user/pwd

14:42 fliebel: alexyk; that is the whole point of oauth

14:43 alexyk: ok, lemme see

14:43 fliebel: alexyk: your application is going to ask twitter for access using a token, of you accept that, it gets another token, now every request with that token is known to be from a trusted source and is allowed access to your account.

14:44 alexyk: I know it's a lot of black magic when you first look at it. I managed to get it working once, but for my own little apps it's more convenient to use basic auth…

14:45 alexyk: fliebel: yeah, well clojure-twitter apparently has only oauth

14:45 and twitter threatens to stop basic auth

14:48 fliebel: alexyk: Got to run, success!

14:48 alexyk: thx!

14:55 lisppaste8: johnmn3 pasted "poor man's s-expr parser" at http://paste.lisp.org/display/92435

14:55 johnmn3: behold, it's hunchback glory

14:56 it needs some ironing, but it's coming along.

14:58 PrinceOfA: is there a clojure wrapper for com.sun.net.httpserver?

15:00 johnmn3: not sure.. know there is for jetty

15:00 I should probably add an :else (stop ignoring) to that cond

15:01 hiredman: http://github.com/hiredman/clojurebot/blob/master/hiredman/http_server.clj <-- not a wrapper around httpserver

15:05 quizme: how do i get clj to run like this: /opt/clojure-contrib/launchers/bash

15:05 oopens

15:05 oops

15:05 i mean

15:06 java -cp jline-0.9_0_5.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl

15:07 hiredman: depending on your version of clojure clojure.lang.Repl might still be around, but it has been deprecated for many months (feels like forever)

15:07 use clojure.main

15:08 clojurebot: clojure.lang.Repl is <reply> you mean clojure.main

15:08 clojurebot: You don't have to tell me twice.

15:08 hiredman: clojurebot: clojure.lang.Script is <reply> you mean clojure.main

15:08 clojurebot: You don't have to tell me twice.

15:08 johnmn3: also, your my jline version is 0.9.94

15:08 hiredman: "your my"

15:08 johnmn3: erm

15:09 /s/your/""

15:10 hmm. didn't know clojure.main replaced script too.

15:11 quizme: i guess i can just set up an alias clj='java -cp jline-0_9_5.jar:clojure.jar jline.ConsoleRunner clojure.main'

15:11 johnmn3: hiredman: so I've been tweaking your editor. Made it into a repl. just trying to fasten on that parser now.

15:11 hiredman: sure, but what about when you want to add something to your classpath?

15:12 quizme: i dunno ^^;

15:12 i'm new to this whole java thing

15:13 hiredman: quizme: what java version do you have?

15:13 java -version

15:13 quizme: 1.6.0_15

15:14 64 bit

15:14 hiredman: ok, make a directory called .jars in your $HOME

15:14 quizme: k

15:15 hiredman: put something like CLASSPATH="$HOME/.jars/*" in what ever bash uses (.profile? ,bashrc?)

15:15 quizme: .bashrc

15:15 hiredman: either copy any jars you plan to use to ~/.jars/ or make a syslink

15:16 start clojure: java jline.ConsoleRunner clojure.main

15:17 quizme: xception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner

15:17 hiredman: quizme: you are missing the jline jar

15:17 quizme: it's in ~/.clojure

15:18 hiredman: so?

15:18 quizme: oh

15:18 k lemme try

15:19 johnmn3: definitely doesn't work yet.

15:20 hiredman: johnmn3: what doesn't?

15:20 johnmn3: converted your code editor to a repl. now trying to bolt on multi-line support.. still banging on it.

15:21 hiredman: multiline support? it works for the select case

15:22 johnmn3: naw, I changed it up.. the input is just a JTextField now. I'm basically trying to get what a repl from the command like provides, but in a gui.

15:22 hiredman: that is going to be painful

15:22 johnmn3: yea, it is. once I have basic repl support, I'll try adding features on from there.

15:23 chouser: johnmn3: you didn't happen to look at texture, did you?

15:23 johnmn3: so far just a swing-based repl. I think the handles multiline input.

15:23 johnmn3: parens highlighting maybe.. after this though, I'm going to implement line history

15:23 chouser: s/the/it/

15:24 quizme: hiredman: thanks it works

15:24 stuartsierra: Is there a good Swing tutorial for use *without* an IDE?

15:25 johnmn3: chouser: yours, right? yes, I looked at it. unfortunately, it's just a little bit advanced for me. This is more of a learning thing right now.

15:25 I should look at textjure though, and see how it implements multi-line support.

15:26 chouser: johnmn3: yeah, that's my poor, sad, abandoned project. :-P

15:26 johnmn3: I've played with it.. I thought it was pretty cool.

15:27 I might pick it back up once I wrap my head further around these "bindings" and plumbing.

15:42 hiredman: clojurebot: simple setup is http://www.thelastcitadel.com/dirt-simple-clojure

15:42 clojurebot: You don't have to tell me twice.

16:00 drewr: what should the behavior of a failed :pre or :post be if *assert* is false?

16:01 both throw a plain j.l.Exception

16:04 stuartsierra: drewr: if *assert* is false the pre/postconditions are never evaluated

16:05 drewr: is binding sufficient for turning it off?

16:05 (binding [*assert* false] (constrained-sqr -1)) => Exception

16:05 (constrained-sqr from the doc example)

16:06 stuartsierra: I guess not.

16:06 But it can be set!

16:07 Chousuke: drewr: it's a compile-time decision I think

16:08 since the value of *assert* is checked by the assert macro

16:09 chouser: Chousuke: that looks right.

16:10 I guess it makes sense, if the point of *assert* false is to avoid runtime checks.

16:10 drewr: do you supply is as a jvm param?

16:10 s/is/it/

16:10 Chousuke: drewr: no, but it's false by default :/ except in the repl.

16:11 drewr: interesting

16:16 lisppaste8: johnmn3 pasted "simple gui repl" at http://paste.lisp.org/display/92442

16:16 johnmn3: it works!

16:17 it needs a lot of cleaning up, but it actually works. (the multi-line support).. I'm sure it breaks under some conditions, but it's a start.

16:19 ah, already found one bug... but it'll have to wait till tomorrow.

16:22 liebke: johnmn3: nice, I'm looking forward to watching your progress. I'd love to have a simple multi-platform gui repl to include with Incanter

16:23 chouser: I'd love to have a simple multi-platform gui repl + clojure source editor to include with clojure

16:25 liebke: better yet

16:26 hiredman: http://i.imgur.com/7bAxb.png <-- this is pretty cool

16:26 (for a repl)

16:26 johnmn3: ditto. I think basic repl support as a start is important.. then pump some steroids into the (completion, history, paredit?) and then extend it to do regular code editor like chores.. but keeping the focus on the repl

16:27 lpetit: I'm also interested in adding paredit support, maybe written in clojure

16:27 to ccw.

16:27 johnmn3: hiredman: yea, that's the good thing about a gui repl... drScheme can do pictures too

16:28 hiredman: that would be really sweat for incanter

16:28 lpetit: Currently alternatives would be to reuse existing code in existing eclipse plugins for Scheme. Still not sure whether I want to adapt their code, or rewrite the whole stuff in clojure

16:28 johnmn3: lpetit: I've been thinking about what rules would be though.. have to look into how paredit works and decides on things.

16:29 hiredman: I dislike guis, so having a repl that can do gui stuff is nice

16:29 liebke: hiredman: yeah, it's a feature of R (at least on Mac and Windows) that I would really like to have

16:31 lpetit: somebody knows the principles behind paredit. Does it rescan the whole buffer content each time an opening symbol (paren, square bracket) is involved in the typing, or is it more sophisticated ? Does it work well with big files such as core.clj (presumably when editing stuff near the end of the file) ?

16:32 johnmn3: paredit command list http://mumble.net/~campbell/emacs/paredit.html

16:32 johnmn3: that's an interesting problem.

16:32 lpetit: clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

16:32 clojurebot: Ok.

16:33 lpetit: clojurebot: paredit source is http://mumble.net/~campbell/emacs/paredit.el

16:33 clojurebot: Ik begrijp

16:33 hiredman: http://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj

16:35 lpetit: hiredman: is it just a reader for creating clojure datastructures, or does it preserve (maybe optionnally) all the properties of the initial source code (different possibilities for representing metadatas, preserving comments, etc.) ?

16:35 hiredman: lpetit: it is port of LispReader

16:36 johnmn3: from LispReader.java ?

16:36 hiredman: yes

16:37 stuartsierra: paredit was written for Common Lisp / Scheme

16:37 lpetit: hiredman: yes, so it's not tailored for textual editors problems, in that it does not preserve what the user is typing. And I guess that in the case of paredit's problem, it's also somewhat "overkill" since it recognizes structures paredit won't care about (meta, derefs, etc.)

16:37 hiredman: lpetit: there is no reason it could not

16:37 and it is written in clojure

16:38 so you don't need to know java to add those features

16:38 lpetit: hiredman: indeed, you're thinking about a special mode that could preserve this information

16:38 ?

16:38 johnmn3: hmm. so something a little more sophisticated than my expression bagger function.

16:38 hiredman: lpetit: I am not thinking about paredit at all

16:39 lpetit: hiredman: maybe we're not talking about the same thing. What do you have in mind ?

16:39 hiredman: I'm just saying, if you are going to write a full reader for clojure, there you go

16:39 paredit is must be much simpler

16:39 I have't looked at the code, or really even used it that much

16:40 lpetit: hiredman: we agree, paredit must be much simpler since it only has to deal with trees and leaves without knowing too much about the different kinds of leaves

16:40 hiredman: but you just match the types of brackets, and keep brackets balanced for a certain set of operations

16:40 paredit doesn't even need to know about trees

16:41 johnmn3: if I were to try to implement some rudimentary paredit features.. would it be heresy to opt for more regular key combinations, rather than emacs like key combos?

16:41 lpetit: hiredman: yes, just a stack of types of brackets + offset

16:41 hiredman: johnmn3: the main thing is balencing

16:41 the other stuff is icing

16:41 lpetit: johnmn3: better separate core paredit functionality from the keys used to invoke the commands, no ?

16:42 johnmn3: lpetit: true

16:42 just saying, I tried paredit once and I had a hard time navigating the source

16:43 I think it would make a good learning tool

16:43 lpetit: johnmn3 : look at this http://p.hagelb.org/paredit-outline

16:43 clojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline

16:43 clojurebot: c'est bon!

16:43 lpetit: ~paredit

16:43 clojurebot: Pardon?

16:43 lpetit: ~paredit.*

16:43 clojurebot: Gabh mo leithscéal?

16:44 hiredman: I wonder if I broke something in clojurebot recently

16:44 clojurebot: paredit?

16:44 clojurebot: Huh?

16:44 hiredman: clojurebot: paredit foo

16:44 clojurebot: Foo is not Baz.

16:44 hiredman: clojurebot: foo paredit

16:44 clojurebot: foo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/

16:44 johnmn3: aye, this will be good material

16:44 lpetit: hiredman: was just guessing. Would a regexp be accepted by clojurebot (if not broken ?)

16:45 johnmn3: this tuto is made from note made by technomancy for his own use.

16:45 hiredman: lpetit: nope

16:47 oh

16:47 lpetit: hiredman: did you compare the performance of your reader with the current java one, just for fun ?

16:47 hiredman: clojurebot: paredit tutorial

16:47 clojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline

16:47 hiredman: lpetit: I did not

16:47 lpetit: hiredman: not tempted ? :-)

16:47 hiredman: I did not do any kind of type hinting or what have you

16:48 lpetit: nope

16:48 I wrote it, someone else can measure it

16:49 lpetit: please, could a paredit expert tell if, approximately, the following link seems to be a whole reference of paredit commands, or just a summary of the more useful ? http://mumble.net/~campbell/emacs/paredit.html

16:54 johnmn3: that technomancy doc was a good read.

16:55 will keep it bookmarked

16:55 lpetit: I've also put it in clojure bot:

16:55 ~paredit tuto

16:55 clojurebot: excusez-moi

16:55 lpetit: ~paredit tutorial

16:55 clojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline

16:56 johnmn3: btw, if anyone saw my code for the expression bagger, was using all those atoms bad form?

16:57 the function closes over 5 or 6 atoms

16:57 lpetit: johnmn3: can you remember the link ?

16:57 s/remember/remind us/

16:57 technomancy: somebody talked to me about recording the paredit script as a screencast

16:58 since I realized I don't have the editing skills to pull it off

16:58 johnmn3: http://paste.lisp.org/display/92442

17:00 I know it's not pretty

17:01 I still use a brute-force kind of style

17:01 lpetit: and I'm tired

17:01 johnmn3: aye

17:01 Anniepoo: ,(in-ns 'tacos)

17:01 clojurebot: #<Namespace tacos>

17:02 Anniepoo: ,(defn foo [] (println "for lunch"))

17:02 clojurebot: DENIED

17:02 lpetit: I don't understand: why do you do all this in order to create a GUI repl ?

17:02 chouser: johnmn3: have you seen any of rhickey's material on values vs. identities?

17:02 Anniepoo: (+ 1 2)

17:02 clojurebot: 3

17:02 johnmn3: still learning. you don't have to actually try to understand it.. it's a bit messy.. Just wondering if that's bad form, or acceptable in this situation.

17:03 lpetit: why not?

17:03 lpetit: johnmn3: smells bat

17:03 smells bad

17:03 Anniepoo: anybody else had trouble with enclojure and in-ns?

17:03 johnmn3: chouser: yea, I have.. are you getting at something?

17:03 lpetit: johnmn3: but does not come from a thourough analysis of your code. Just a smell

17:03 johnmn3: like i'm using too much state there?

17:03 aye

17:03 chouser: johnmn3: are each of those atoms properly an identity?

17:04 johnmn3: I haven't read everything you're doing there, but find it unlikley. :-)

17:04 lpetit: not much about state (state has its virtue, and maybe yours is just essential state, I don't know for sure)

17:04 but smells like too much mutable storages

17:04 as said chouser

17:05 johnmn3: aye.. my original function used a loop, but then I needed a function that was fed it's input one character at a time, which made a loop pointless.

17:05 chouser: guis *are* mutable state, and it can be hard to prevent that from causing the rest of your code to become infected with mutable state and imperative style. But it's worth the effort.

17:06 lpetit: chouser: beyond Rich's videos (which I've watched "eyes wide open" :-) ), do you know of any online tutorial to help continue "think" about it ?

17:06 chouser: lpetit: not really. it's something I still struggle with, moreso in code related to guis, sockets, and other "external" things like that.

17:07 lpetit: chouser: ok, so we're all in a learning curve here :-)

17:07 johnmn3: and I recured most of the changes back to the top of the loop, not needing any storage.. just used accumulators

17:08 but when being fed only one char at a time, with nothing to loop over on each run, I couldn't figure out an alternative

17:08 chouser: johnmn3: bagger is creating a bunch of state and then mutating it. try imagining all that state as a single value instead. then make a pure function that takes that value (along with any other needed data) and returns a *new* value.

17:08 lpetit: johnmn3: (fn [_] false) can be written (constantly false), btw

17:08 johnmn3: ah was wondering.. could do that in a lot of places then.

17:09 hiredman: how does clojureql's LIKE operator work?

17:09 chouser: johnmn3: then if you need to, you can store that value in a single reference type. This will keep more of your code "pure functional" and you'll get the best benefits from Clojure's features.

17:10 lpetit: {:newstr (constantly []), :started (constantly false), ...} and pass it in the loop, and use assoc/update/update-in

17:10 johnmn3: maybe I could still use a loop. just have it loop once per run, and just have one slot to hold state between loops.

17:11 lpetit: there's nothing wrong with a loop

17:11 johnmn3: right

17:13 lpetit: from paredit's source code:

17:13 ;;; This code is written for clarity, not efficiency. It frequently

17:13 ;;; walks over S-expressions redundantly. If you have problems with

17:13 ;;; the time it takes to execute some of the commands, let me know, but

17:13 ;;; first be sure that what you're doing is reasonable: it is

17:13 ;;; preferable to avoid immense S-expressions in code anyway.

17:13 hiredman: lpetit: pastebin

17:13 lpetit: good, maybe trying to do a raw port of it could be usable.

17:13 hiredman: sorry

17:13 johnmn3: so make a map of my data and store it in a ref.

17:14 should be a good exercise

17:15 lpetit: I expect emacs lisp to be readable even if it's the first time I read emacs lisp, or am I fooling myself ?

17:15 (I also have *some* CL knowledge)

17:15 technomancy: lpetit: it's pretty straightforward; yet another imperative lisp dialect

17:16 very similar to CL, but more limited. (only dynamic scope)

17:16 lpetit: technomancy: ok, so maybe trying to port it, then write a comprehensive set of unit tests, and then rewrite it in idiomatic clojure

17:16 technomancy: I think it's closest to MacLISP, which CL is pretty closely related.

17:16 lpetit: technomancy: no lexical scope?

17:16 technomancy: lpetit: =(

17:16 it's available in an experimental branch, but it's opt-in

17:17 amazingly enough you can fake it for most purposes with a macro, but heaven help you if you ever try to read the expansion

17:17 lpetit: technomancy: ever thought about writing an emacslisp -> clojure translator (or the other way around) ? :-)

17:18 technomancy: lpetit: once cinc is done and the lexical scope/threading branches get merged to mainline Emacs I'll probably play around with it a bit

17:18 it will be a pretty natural compilation target once thread support is finished

17:19 lpetit: technomancy: seems like copying paredit.el code in a .clj file and doing the translation may be a rather systematic (and boring, btw :-) ) task. Lots of symbols replacements, replacing setq with some set!, etc.

17:20 technomancy: yeah, you'd probably want a pretty literal translation at first, then try to clean it up with a bit more FP once it was working

17:20 * technomancy hates writing tests for UI-ish code, but I guess those commands would be more or less functional

17:20 lpetit: technomancy: yes, make it work, write a decent test suite, make it right

17:21 technomancy: yes.

17:21 * lpetit guesses he's slowly committing to yet another project he may not finish ... ;-)

17:22 spuz: lpetit: :o

17:22 technomancy: where would we be today if people let that stop them?

17:22 spuz: technomancy: finished?

17:23 lpetit: technomancy: yes, "They didn't know it was impossible, that's why they succeeded in it" (or something like that, in french "Ils ne savaient pas que c'était impossible, c'est pour cela qu'ils l'ont réussi")

17:23 ;)

17:23 ok, time to go to bed, bye guys

17:23 doublindirection: is it possible to specify a throw clause to a :gen-class :method? I cannot find anything in the docs

17:24 chouser: doublindirection: I don't think so

17:24 lpetit: doublindirection: you don't need to do so

17:24 hiredman: paredit?

17:24 clojurebot: paredit source is http://mumble.net/~campbell/emacs/paredit.el

17:24 lpetit: or do you ?

17:24 chouser: Clojure doesn't have much patience for checked exceptions.

17:25 lpetit: it works again !

17:25 hiredman: lpetit: what you wanted never worked

17:25 (but it does now)

17:25 lpetit: paredit.*

17:25 ~paredit.*

17:25 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

17:25 hiredman: no not that

17:25 doublindirection: I'm generating API for java coders, they will want checked exceptions

17:26 lpetit: hiredman: just dreaming :-)

17:26 hiredman: asking "paredit?" and expecting the fact for "paredit source"

17:26 lpetit: ok

17:26 would it be a good idea for it to return everything that starts with paredit ? (multiple lines ?)

17:26 ~paredit source

17:26 clojurebot: paredit source is http://mumble.net/~campbell/emacs/paredit.el

17:26 lpetit: ~paredit commands

17:26 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

17:27 lpetit: ~paredit tutorial

17:27 clojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline

17:27 lpetit: paredit tuto?

17:27 ~paredit tuto?

17:27 clojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html

17:27 lpetit: I'm confused

17:28 ok, must really leave now, cu

17:28 hiredman: I am ok with that

17:33 Anniepoo: ,(reduce #(+ %1 %2) '())

17:33 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--4276$fn

17:34 Anniepoo: expected something other than that

17:35 chouser: yeah, that's a bit weird.

17:36 but it's documented

17:36 Anniepoo: I guess the converse question is, what should it return?

17:36 chouser: If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments.

17:36 from the docstring

17:37 Anniepoo: maybe it's just the choice of exception to throw

17:38 hiredman: reduce doesn't throw any exceptions

17:38 fn's throw exceptions if misapplied

17:38 Anniepoo: ah, ok, now makes sense

17:51 jweiss: can someone recommend a key-value db to use with clojure? i would like to implement a bug tracking system and i don't want to be stuck dealing with rdbms schemas, i want it to be flexible

17:52 technomancy: jweiss: couch is easy. I've heard mongo is nice too if you need it to handle absurdly large datasets.

17:53 jweiss: technomancy: i doubt i need to handle absurdly large dbs. redhat's very old and very large bug tracking system is only up to 500k records

17:54 kwertii: jweiss: Berkely DB?

17:54 *Berkeley

17:54 Anniepoo: http://w-hat.com/httpdb/

17:54 deadly simple

17:56 technomancy: if you want a web-based system, slapping a JS UI on top of couch is the simplest thing that could work

17:56 but it doesn't involve clojure. =)

17:56 chouser: Anniepoo: ooo

17:56 Anniepoo: ???

17:56 jweiss: technomancy: i want to build an api/cli first and add a web ui later

17:56 chouser: I've written a few underpowered versions of httpdb for various little ajax projects.

17:57 * jweiss doesn't do ui design very well

17:57 Anniepoo: had the impression the request was for simple and flexible

17:57 chouser: Anniepoo: apparently I should have been using httpdb. :-)

17:57 kwertii: Is anyone working on an Elephant-like transparent persistence system for Clojure yet?

17:58 jweiss: flexible, not necessarily simple. would be nice if there's an existing redhat or debian package (which is +1 for couch and berkeley)

17:58 Anniepoo: well, if you trust your data to w-hat, go for it

17:58 jweiss: i was under the impression that clojure's json-fu is not very strong

17:59 hiredman: jweiss: very wrong

17:59 jweiss: oh i stand corrected then

17:59 hiredman: there are two json encoder/decoders for clojure, and another encoder as the demo for fnparse

17:59 one of the json libs is in contrib

18:00 anyway, derby is nice and easy to use

18:00 jweiss: ok so whose couchdb lib should i try first, danlarkin's or thekenny's

18:00 there's also this redis thing: http://github.com/ragnard/redis-clojure

18:03 hiredman: http://db.apache.org/derby/

18:04 drewr: can anyone compare parsec and fnparse? are they similar?

18:04 hiredman: http://bret.appspot.com/entry/how-friendfeed-uses-mysql

18:15 maacl: jweiss: Clutch has worked out good for me

18:15 kwertii: Are there any good examples of non-trivial open source Compojure apps out there?

18:16 technomancy: kwertii: clojars may be a good one

18:17 kwertii: technomancy: thanks, will take a look

18:19 jweiss: maacl: so it looks like you can query directly in clojure using clutch?

18:20 maacl: jweiss: yep - it has a view server

18:20 jweiss: maal - interesting, i will look into that, thanks

18:20 maacl: ^

18:26 lazy1: How can I get the name of a function which is passed as a parameter? (actually a vector of functions)

18:28 hiredman: lazy1: functions don't have names

18:29 lazy1: So I need to explicitly add metadata?

18:29 hiredman: functions don't take metadata

18:29 lazy1: The var the points to the function?

18:29 s/the/that/

18:29 hiredman: yes

18:30 vars do have names

18:30 ,(prn #'+)

18:30 clojurebot: #'clojure.core/+

18:30 hiredman: ,(prn-str #'+)

18:30 clojurebot: "#'clojure.core/+\n"

18:31 lazy1: But if I get an array of functions, I can't use #' on them (or do I?)

18:32 kwertii: technomancy: is technomancy.us written in Clojure?

18:32 Chousuke: lazy1: you don't need #' to use functions as values

18:33 lazy1: I know, sorry for not being clear

18:33 I've tried something like http://paste.lisp.org/display/92451, but I get an error on var

18:33 Chousuke: lazy1: #'foo is short for (var foo), so it won't work on values of anything.

18:33 technomancy: kwertii: nope: http://p.hagelb.org/Rakefile.html

18:34 Chousuke: the argument to var is a symbol (foo)

18:34 lazy1: Ah

18:34 Is there a way to write nameof?

18:34 Chousuke: for arbitrary functions? no :/

18:34 some functions don't even have names.

18:34 kwertii: technomancy: ah, interesting. having grown frustrated with merb and rails, I am now weighing Ramaze versus Compojure.

18:35 technomancy: kwertii: I vote for static files. =)

18:35 kwertii: technomancy: would love to, but it has to front a SQL database :)

18:35 lazy1: Is that why we have deftest?

18:38 hiredman: lazy1: what do you mean?

18:38 lazy1: So you'll be able to get the name of the failed test

18:40 hiredman: lazy1: I haven't really used deftest, but from what I recall it doesn't print out "names" of tests ever

18:41 the test runner runs the tests for a namespace and blows up if they fail

18:42 lazy1: OK, then let me get to a higher level

18:43 alexyk: mattrepl: figured it's easier to chat here than over github mail! :)

18:43 lazy1: I'm trying to distribute functions (tests) between several agents, and I'd like to print an error if one of them fails. How can I do that?

18:43 (that = name of the function that failed)

18:44 Chousuke: pass the name of the function to the agents as well :P

18:44 alexyk: how do we do default arguments in clojure?

18:45 lazy1: I tried to avoid that, but I like the simplicity of that

18:45 Chousuke: alexyk: overload by argcount usually

18:45 lazy1: Thanks

18:45 alexyk: ah ok

18:45 anybody else familar with oauth here?

18:46 Chousuke: (fn foo ([] (foo 1 2)) ([x y] (+ x y))) is a common pattern

18:46 except with defn, obviously. :)

18:47 alexyk: Chousuke: so optional will be nil in one branch; no real way to distinguish optional from default with non-nils, right?

18:47 Chousuke: alexyk: well, it's whatever you pass from the overloaded lesser arity.

18:49 ksm: wait, so a function can have multiple bodies?

18:49 hiredman: gah

18:50 Chousuke: ksm: yeah. overloaded on arity

18:50 defn: hmmm -- where'd clojure.test go?

18:51 ksm: neat

18:56 defn: am i crazy? did clojure.test vanish?

18:57 lazy1: defn: (require 'clojure.test) works for me

18:58 ,(require 'clojure.test)

18:58 clojurebot: nil

18:58 defn: yeah for some reason that ns doesn't exist for me?

18:58 lazy1: which version of clojure?

18:58 IIRC it moved to clojure core after 1.0

18:58 defn: so maybe im running 1.0?

19:00 lazy1: Maybe, there is a stub left in clojure.contrib.test for backward compatibility

19:02 defn: yeah im running old clj

19:14 headius: rhickey: around?

19:39 alexyk: Chousuke: so what's the syntax for optional params like (fun x :and y :maybe z)?

19:41 the-kenny: alexyk: for defn? [foo bar & [a b c]]

19:42 alexyk: so :only is not a map key?

19:43 the-kenny: hm.. I don't know what you mean.

19:43 Sorry

19:43 defn: sweeet -- testing is fun

19:43 :X

19:44 kylesmith: can anyone explain why (read-string "abc123") works, and (read-string "123abc") throws a NumberFormatException?

19:45 the-kenny: kylesmith: Because the reader tries to interprete 123abc as a number, but fails to parse the a?

19:46 kylesmith: yes, but why doesn't read-string return the entire string when happens?

19:46 ,(doc read-string)

19:46 clojurebot: "([s]); Reads one object from the string s"

19:47 the-kenny: hm.. it the same when you type "123abc" in the repl.

19:47 kylesmith: "123abc" is certainly an object, so why not 'read' that and return it?

19:47 the-kenny: kylesmith: but read-string just sees 123abc, not the " around it

19:47 ,(read-string "\"123abc\"")

19:47 clojurebot: "123abc"

19:50 the-kenny: If you type 123abc in the repl, it also doesn't gets interpreted as a string

19:51 kylesmith: true, but the doc doesn't say "Attempts to read the first possible object, or throws an exception"

19:55 technoma`: kylesmith: you can't start a symbol with a digit

19:59 kylesmith: what I'm really trying to do is read all objects from a string by wrapping the string in parens, and calling read-string.

20:05 technoma`: well if you want symbols back then you'll need to wrap it in a quote as well

20:05 but do you really want symbols back?

20:06 rhickey: headius: hey

20:07 kylesmith: technoma`: you talkin to me?

20:07 technoma`: kylesmith: right

20:08 kylesmith: I want a seq of strings to be read, not symbols

20:08 it would be nice if read took a 'template' of types

20:09 chouser: kylesmith: 'read' is for converting text to clojure objects, just the way clojure source is read.

20:10 kylesmith: i.e, tell the parser to interpret the first object as an x, the second as a y, the third as a vector of [foo bar baz] etc

20:10 mattrepl: alexyk: there's defnk in c.c.def, alternatively see this page: http://stackoverflow.com/questions/717963/clojure-keyword-arguments

20:11 heh

20:11 kylesmith: chouser: yes, but read can sometimes be abused for parsing files ;)

20:13 JonSmith: why do people go crazy about typing 2 extra parens/curly-brackets/square-braces?

20:14 defn: because they're crazy

20:15 JonSmith: it really depends on where and why

20:16 i can see why someone would be annoyed by typing them where they're clearly not needed or don't represent anything of importance

20:16 and yet are required

20:18 JonSmith: I always have thought the CL &key &rest &optional &aux etc. were confusing

20:25 defn: when i use (deftest mytestname) -- does mytestname need to be unique

20:25 err let's say I have (defn mytestname [])

20:25 can i have (deftest mytestname) as well?

20:25 or will those overlap?

20:26 technoma`: defn: they're all vars

20:26 defn: technoma`: thanks

20:30 developernotes: Has anyone ever seen the message "Cannot open load file, swank-clojure-autoload" when attempting to launch slime with clojure?

20:30 technoma`: developernotes: you're probably using a deprecated configuration

20:31 that file hasn't existed for quite some time now

20:31 developernotes: I originally installed clojure in emacs through ELPA, is there a good way to upgrade this?

20:33 technoma`: developernotes: you can remove all your old configuration. if you're using elpa then simply installing the packages will be enough

20:33 in particular calling clojure-slime-config is no longer needed

20:33 ohpauleez: Does anyone else compile and run clojure on jvm 1.7?

20:34 developernotes: technoma`: okay, I'll try that, will that still allow me to run SBCL, I assume so, they shouldn't be tied to that right?

20:35 technoma`: developernotes: in that case you might have to keep around some of your old config, but not clojure-slime-config

20:35 you should be able to use it in harmony with CL, but I haven't tried that myself

20:35 developernotes: technoma`: okay, I'll give it a go.

20:35 technoma`: thanks.

20:36 technoma`: np

20:47 developernotes: I just installed swank-clojure for emacs, but everytime I attempt to run M-x slime, it just loads SBCL instead of clojure, any thoughts as to what might cause this?

20:49 I was under the impression that M-x slime would launch clojure with swank-clojure installed and that I would need to use C-u M-x slime to provide an alternate process to run (i.e., sbcl).

20:49 Any thoughts on getting clojure to run within emacs through slime, I already have swank-clojure installed, and also clojure itself.

20:51 defn: developernotes: you're using jochu's swank-clojure -- use technomancy's elpa version of clojure-mode, swank-clojure

20:51 remove any configuration you've done

20:51 developernotes: defn: I installed swank-clojure from ELPA.

20:51 defn: and clojure-mode?

20:51 did you run M-x clojure-install?

20:52 you'll also need slime from elpa

20:53 developernotes: defn: when I run M-x clojure-install, it prompts for the directory I previously installed it to, but when I say 'y', it says that this function is deprecated in favor of swank-clojure.

20:53 defn: thoughts?

20:54 defn: developernotes: not really -- it seems like you have everything working, but that there's another swank-clojure floating about

20:54 developernotes: defn: I have slime from ELPA installed, but not slime-repl from ELPA, do I need that?

20:55 defn: yes

20:55 get that

20:55 Can anyone tell me how to get ("abc") out of the list so it's just "abc"?

20:57 hiredman: seriously?

20:57 ,(first '("abc"))

20:57 clojurebot: "abc"

20:58 defn: bahhh sorry hiredman -- i accidentally had (first (str '("abc")))

21:01 kwertii: anyone know why C-c C-k produces "Wrong number of args passed to: basic$eval--1058$compile-file-for-emacs"?

21:01 ssideris: ,(first (first '("abc")))

21:01 clojurebot: \a

21:02 kwertii: afaik I am using clojure 1.1 nightly from git, as well as the latest swank-clojure and clojure-mode

21:04 headius: rhickey: sorry, missed ya, around now?

21:05 rhickey: headius: hi

21:05 headius: hey there

21:05 I think we're talking past each other on jvm-l

21:05 rhickey: a bit

21:05 headius: I think everyone considers it a given that stub generation is one way to make this work, since that's what groovy's joint compiler does, for example

21:05 ssideris: ,(

21:05 clojurebot: EOF while reading

21:05 rhickey: my main concern is not building a mega-compiler out of all our compilers joined by the coordinator

21:06 headius: yeah, I don't want that either

21:06 rhickey: I think making type info available to tools like IDEs via APIs is fine

21:06 headius: what I want is really just a compiler into which I can make an upcall and say "I need this type and I don't know how to find it", and it will either look at existing classes or query other languages being compiled at the same time

21:06 rhickey: but when I try to think through the compilation workflow that way, it seems complex

21:06 headius: it may be

21:06 and it may be too complex

21:07 rhickey: we need C++ header files :)

21:07 headius: yeah, that's basically what this ends up as

21:07 virtual header files

21:07 rhickey: there are some benefits to that

21:08 headius: I know the inference case is a little obscure too, but I know the scala guys have endless battles getting IDEs to support cross-language type management, refactoring, etc

21:08 rhickey: inference is very scary - I think we need them to step up rather than speculate about what might work

21:08 headius: refactoring and friends are certainly out of scope for this, but being able to just get a "map" of what types a set of files provides and consumes would provide the underpinnings for all that as well as a joint compiler

21:09 rhickey: all of these concepts are really pretty foreign for langs that don't use classes in the ordinary way - as John Cowan said

21:09 headius: certainly, but that's a separate discussion

21:10 this is for joint compiling languages that want to present Java types and have cross-language, possibly-circular dependencies

21:10 and I'm trying to stop the spread of one-off joint compilers

21:10 there's a groovy/java compiler that's mostly separate from the groovy/scala/java compiler, which is separate from the scala/java compiler

21:10 so many wheels being reinvented

21:11 rhickey: and those langs are the most similar

21:11 headius: it won't be long before jruby can enlist in those compilers almost as easily, and I don't want it to need another one-off

21:12 at any rate, I wanted you to understand I'm trying to gather all potential requirements, then figure out what's reasonable and in scope, and then decide on which approach to take

21:12 rather than just diving into an approach

21:12 rhickey: what's most appealing about Per's suggestion is that each compiler can work as-is (i.e. non-joint), given some separate way to enumerate types, and another to generate stubs

21:13 but yes, we need some use cases and scenarios

21:13 headius: the stub-based thing is certainly the easiest, but it's also the "dumbest" in that it doesn't provide a lot of useful tooling beyond belching out classes

21:13 and that may be fine

21:13 rhickey: the pathological cases require topological sorts etc

21:14 headius: I also have a side motive, which is to try to get scala guys to figure out the hard parts of cross-language inference in a common compiler so I don't have to write any of that for duby

21:14 rads: using the following code, when I try to call (.setName (new cljbot.pircbot) "test"), I get no method found: http://gist.github.com/261442 anyone know why it doesn't work?

21:14 headius: my ideal setup would be a service which knows how Java types are structured and how method lookup works that I can just toss mirrors into and get mirrors out

21:15 rads: (I just want to make Pircbot#setName public)

21:15 headius: I've started to hack that a bit in Duby, but it's all in Ruby and not useful in general

21:15 I suppose one way to explore this would be to write it in Java and base it on the mirror types, which has been planned for Duby for a whil

21:17 rhickey: a prototype never hurts

21:22 headius: I'll see if I can mock something up

21:23 rhickey: cool

21:23 defn: headius: Duby?

21:24 headius: my ruby-syntaxed static-typed, local-type-inferred, compiler-pluggable language

21:24 a toy, but maybe more someday

21:25 defn: headius: cool

21:25 headius: http://kenai.com/projects/duby

21:26 grr....javax.lang type names are *almost* the same as com.sun.mirror

21:27 defn: http://blog.fogus.me/2009/12/21/clojures-pre-and-post/

21:28 bettsp: Newb question, what does a '*' after a function name mean?

21:29 http://github.com/ragnard/redis-clojure/blob/master/src/redis/internal.clj on line 38 for example

21:29 defn: bettsp: depends on the function

21:29 it's not a pointer or anything

21:29 dnolen: bettsp: has no real meaning, it's a convention really.

21:29 bettsp: defn: Ok, so there's no idiomatic meaning though

21:29 defn: not that im aware of, ive seen it used in many different cases

21:29 bettsp: defn: accepted throughout Clojure that is

21:30 defn: usually it's a way of differentiating myfn from a special myfn*

21:30 err not usually, in *some* cases that ive seen, that's how it behaves

21:30 dnolen: bettsp: usually it differentiates between a macro and the function that does the work.

21:31 bettsp: defn: But that's not the same as *s in (set!), which is a convention throughout the language

21:31 Like (set! *some-variable* true)

21:33 PrinceOfA: rhickey: According to wikipedia, you funded the development of Clojure out of your own pocket for 2,5 years. Has Clojure turned out to be a financial success for you?

21:34 rhickey: PrinceOfA: um, not even close

21:35 PrinceOfA: rhickey: has it somehow changed your professional life or do you still do the same stuff?

21:35 or same stuff + clojure development

21:35 rhickey: PrinceOfA: mostly Clojure now

21:39 headius: hmm

21:42 PrinceOfA: rhickey: has clojure turned out to be what you expected it to be when you started the effort? or did it turn out to be something else, i mean both technologically and as a community

21:44 rhickey: PrinceOfA: I never expected it to hit the way it did

21:47 tolstoy: Anyone have a recommendation for an xmlrpc client? Has someone wrapped that all up in a clojure lib yet?

21:47 PrinceOfA: rhickey: ok, thanks. i'm asking because clojure as a codebase and a tool, the github thing and the community all have a very positive feel to it. i'm wondering how much of it is planned and how much "just happened" :)

21:47 tolstoy: There's one for Apache, and there's this Redstone one....

21:48 ssideris: rhickey: if it's not a financial success for you personally, how do you manage to mostly do clojure these days? i mean financially if you don't mind me asking

21:48 i'm asking mainly because i would like to do the same

21:48 (give up the dayjob and work on my own projects)

21:53 rads: anyone know why (.setName x) still doesn't work using this code? http://gist.github.com/261442

21:53 tolstoy: rads: Yep.

21:54 rads: That method is protected.

21:54 You can use (in contrib java-utils) wall-hack-method to get at it.

21:54 rhickey: ssideris: http://clojure.org/funding

21:55 tolstoy: rads: I just worked on that very problem yesterday! Also see hiredman's clojure bot (githup) to see how he worked it.

21:55 rads: tolstoy: cool, thanks

21:56 tolstoy: (wall-hack-method org.jibble.pircbot.PircBot :setName [String] bot name)

21:58 ssideris: rhickey: ok :-)

22:00 kwertii: It seems that "lein swank" does not include the src/ directory in the classpath, but "lein repl" does. Am I doing something wrong, or is this a bug?

22:04 alexyk: is there a way to list names defined in repl?

22:06 mitchellh: alexyk: (ns-public *ns*) will list all the public ones

22:06 alexyk: mitchellh: thx

22:06 hm... Unable to resolve symbol: ns-public in this context

22:07 should I import it from somewhere?

22:07 mitchellh: its part of clojure.core so you shouldn't have to

22:07 but just to be sure try

22:07 (clojure.core/ns-publics *ns*)

22:07 alexyk: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns-publics

22:07 alexyk: ah, ns-publics

22:07 mitchellh: oh, did I misspell it previously? My mistake

22:08 alexyk: np, works now

22:08 cuute

22:08 rhickey: you got something really special going! :) I like it better every day

22:08 mitchellh: There are others, like ns-interns and such but I just started with clojure so I'm not sure which you want :)

22:09 polypus: i just noticed something. M-x swank-clojure-project ignores the :library-path in project.clj. to get it to work i had to symbolic link in the project root to my lib folder

22:09 alexyk: _ato: did you really have just two months Clojure experience before doing WF2, per twbray?

22:09 it's hard to beieve

22:11 ssideris: alexyk: what's the project you're referring to?

22:11 alexyk: ssideris: Wide Finder 2

22:12 clojurebot: ~Wide Finder

22:12 clojurebot: Huh?

22:12 alexyk: clojurebot: ~"wide finder dammit"

22:12 clojurebot: Excuse me?

22:12 alexyk: clojurebot: ~"wake up hiredman"

22:12 clojurebot: when I write functions I go blind and let the lambda do its thing

22:12 alexyk: http://www.tbray.org/ongoing/When/200x/2009/09/27/Concur-dot-next

22:13 * alexyk gonna bill clojurebot again

22:13 ssideris: oh yes, i read about wide finder 2

22:13 alexyk: furthermore, that would put making clojars at day 1 or 2 of clojure, which is harder to believe still

22:15 hiredman: what?

22:16 clojurebot: What is meta

22:16 alexyk: hiredman: what what?

22:16 clojurebot's on strike, not googling

22:16 hiredman: ~google stuff

22:16 clojurebot: First, out of 35800000 results is:

22:16 The Story of Stuff

22:16 http://www.storyofstuff.com/

22:16 hiredman: ?

22:16 alexyk: how do we google "wide finder"?

22:17 hiredman: clojurebot: google wide finder

22:17 clojurebot: First, out of 5240000 results is:

22:17 Wide Finder Home - Wide-Finder - wikis.sun.com

22:17 http://wikis.sun.com/display/WideFinder/

22:17 alexyk: ah... so ~ is for single word?

22:17 hiredman: ~ is short for clojurebot:

22:17 clojurebot: for is not a loop

22:18 alexyk: ah! the mysteries unravel

22:18 hiredman: you have to tell clojurebot you want to google

22:18 alexyk: clojurebot: I want to google something

22:18 clojurebot: rationale is http://clojure.org/rationale

22:22 JonSmith: clojurebot: google foo

22:22 clojurebot: First, out of 3010000 results is:

22:22 Foobar - Wikipedia, the free encyclopedia

22:22 http://en.wikipedia.org/wiki/Foobar

22:26 PrinceOfA: does the proxy macro require the functions required by the interface to be declared where the proxy macro is used? for example, com.sun.net.httpserver.HttpHandler has "void handle(HttpExchange exchange)". when creating a proxy, am i forced to do (proxy [HttpHandler] [] (handle [HttpExchange] ...))) or can i somehow refer to a handle function elsewhere?

22:27 *handle function which is defined elsewhere

22:28 ohpauleez: has anyone been having issues with lein repl?

22:30 kwertii: ohpauleez: lein repl works fine here, it's lein swank that's causing me problems :)

22:31 ohpauleez: ah, gotcha, thanks for letting me know kwertii

22:40 arohner: (and foo (every? identity foo))

22:40 is there a more concise way to write that? it feels wrong

22:42 actually, that doesn't do what I want either, it fails on an empty list

22:43 I want 1) foo is a seq 2) foo is non-empty 3) every value of foo is true

22:47 JonSmith: you could use filter i guess

22:47 meh, that's kind of silly though

22:49 ,(= () nil)

22:49 clojurebot: false

22:49 JonSmith: ,(= '() nil)

22:49 clojurebot: false

22:49 JonSmith: ,(= nil false)

22:49 clojurebot: false

22:49 JonSmith: ,(= false false)

22:49 clojurebot: true

22:50 JonSmith: ,(reduce #(and %1 %2) (list true true true true))

22:50 clojurebot: true

22:51 JonSmith: ,(reduce #(and %1 %2) (list true true false false))

22:51 clojurebot: false

22:51 JonSmith: ,(reduce #(and %1 %2) (list))

22:51 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--4356$fn

22:51 arohner: ,(reduce #(and %&) (list))

22:51 clojurebot: nil

22:52 arohner: ,(reduce #(and %&))

22:52 clojurebot: java.lang.IllegalArgumentException: Wrong number of args passed to: core$reduce

22:52 arohner: ,(reduce #(and %&) nil)

22:52 clojurebot: nil

22:53 arohner: I think that works. thanks

23:20 is there a way to introspect a multimethod to see what values it will work on?

23:21 nm

23:21 (.getMethodTable multi-method)

23:21 reading the source is good for you!

23:25 ohpauleez: arohner: (methods) should also work, right? http://github.com/richhickey/clojure/blob/a9cb831fe714966e225a5297ef844513fe4a373a/src/clj/clojure/core.clj#L1066

23:25 which is just sugar .getMethodTable

23:26 arohner: oh, nice

23:27 that's not mentioned on the multimethods page

Logging service provided by n01se.net