#clojure log - Jul 08 2009

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

0:27 technomancy: who wants to try out my dependency management project? http://github.com/technomancy/corkscrew/tree/master

2:30 doubleagent: Is this the correct channel for 'support' questions?

2:33 slashus2: What question do you have?

2:35 doubleagent: Fairly simple. How do I force a Ratio or Double to be represented as an Integer/Long/BigNum?

2:36 slashus2: ,(double 5/4)

2:36 (bigint 5/4)

2:37 doubleagent: That what you mean?

2:39 doubleagent: slashus2, thanks - I see those forms in the api now too. :)

2:39 slashus2: doubleagent: This is dex by the way.

2:39 :-P

2:40 doubleagent: :)

2:55 slashus2: doubleagent: Rich Hickey hangs out in here often too.

2:56 doubleagent: cool.

5:49 tsdh: Hi. What do I have to do to get a repl when invoking "java -jar my-stuff.jar"?

5:50 This jar contains all clojure class files and my code. In my ant jar target there's <exclude name="**/Test*.java"/>.

5:50 Ups, sorry. I've meant: <attribute name="Main-Class" value="clojure.lang.Repl"/>

5:52 But executing the jar errors: http://paste.lisp.org/display/83222

5:59 Hm. I replaced the value of Main-Class with "clojure.main", but I get the same exceptions.

5:59 hoeck: tsdh: and you have set a classpath?

6:00 tsdh: as in the clojure build.xml?

6:00 tsdh: It is ".". Yes, exactly the same.

6:00 asbjxrn: Is the line reader part of the jar?

6:00 Uh...

6:02 tsdh: asbjxrn: It's in java, so it should be there anyway, right?

6:03 I annotated my previous paste with the complete build.xml.

6:04 asbjxrn: Yes I got confused there, thought it was that jline.ConsoleRunner lib... Don't know how I managed to misread that badly.

6:06 tsdh: Oh, in the paste of the exception backtrace I omitted the last line. "Could not find the main class: clojure.main. Program will exit."

6:08 But looking at the jar's contents, there is clojure/main.class...

6:09 hoeck: tsdh: so you are compiling clojure into this jar, and additionally your own (compiled) namespace?

6:10 tsdh: Yes.

6:11 hoeck: what about only compiling your namespace and adding a precompiled clojure.jar to your own jarfile?

6:12 tsdh: I tried that first, but it didn't work, too...

6:12 hoeck: too bad, mhh, do you have a build-xml for that latter case?

6:13 tsdh: sure, I'll annotate my paste.

6:15 done

6:16 Ups, there's a small error in it. The jar target depends on unjar, and it should depend on compile.

6:17 I fixed that and annotatet the past with the error I get with this jar.

6:27 Hm, when I omit the (unpacked) jar in my jar and call it with "java -cp ".:clojure.jar:myjar.jar" clojure.main, it works...

6:35 hoeck: packaging a jar inside a jar and then setting the manifests classpath attribute is not allowed - thats new to me

6:35 tsdh: so I'm going tol try the other approach : )

6:55 tsdh: its the version.properties file in the clojure subfolder that is missing from the jar

6:57 tsdh: clojure loads it at class-initialization-time

6:58 ChrisPS: Using emacs slime, can I select a function-name and jump to its definition in clojure-mode?

6:59 hoeck: tsdh: adding <include name="**/*.properties"/> to the unjar pattern and <fileset dir="${build}" includes="**/*.properties"/> to the create-jar pattern works

7:02 ChrisPS: the slime-edit-definition command will do that

7:03 ChrisPS: but it isn't very reliable here (using xemacs, and a not up-to-date clojure-mode/swank/slime)

7:08 ChrisPS: hoeck: oh, this works perfectly here (!)

7:11 hoeck: ChrisPS: well, then maybe I'm going to update my setup, but no its lunchtime : )

7:11 r/no/now

7:48 tsdh: I have annotated your paste with a build.xml that works (at least with my setup)

7:58 bartj: can someone please help me setup REPL using vimclojure

7:58 durka42: bartj: what OS are you on?

7:58 bartj: durka42: Ubuntu

7:59 durka42: ok, do you have vim and clojure and vimclojure installed already

7:59 tsdh: hoeck: Thanks.

7:59 bartj: I have got most of it right, except I am unable to understand how to set up LocalLeader, etc.

8:00 durka42: yes

8:01 durka42: so you should be able to do \sr from within a clojure file to start a repl

8:02 provided you have vimclojure's ng-server running

8:05 bartj: durka42, yes I have the ng-server running

8:07 durka42: but nothing happens when you do \sr?

8:07 bartj: durka42, no

8:07 I don't think I have specified the map properly in my vimrc

8:07 can you tell me how it should look like?

8:08 I have the foll. lines in my vimrc:

8:08 let vimclojure#NailgunClient = "/home/<username>/clojure/vimclojure-2.1.1/ngclient"

8:08 let clj_want_gorilla = 1

8:10 can someone help me setting up the REPL in vim (using vimclojure)

8:11 I have the ng-server running but, when I type "\sr" in vim the REPL does not start :(

8:11 I haven't used maps in vim yet

8:11 durka42: i have let g:clj_want_gorilla = 1, not sure if that makes any difference

8:12 do you have a .clj file open in vim?

8:12 bartj: durka42, yes

8:12 durka42, I'll try that

8:13 durka42, no luck

8:14 also, does vimclojure not have automatic paranthesis closing?

8:15 durka42: no it doesn't

8:15 you might find surround.vim and autoclose.vim helpful

8:15 bartj: both?

8:16 durka42, I think my main problem is that I am not able to set "<LocalLeader>" in my .vimrc file

8:20 durka42: does it work if you do :call vimclojure#Repl.New() directly?

8:23 bartj: durka42, it throws me two warnings but yes! it does work!!!

8:23 * durka42 wonders if the warnings are meaningful

8:24 bartj: durka42, I am not able to "type" anything though

8:24 durka42: in the repl?

8:24 bartj: durka42, the warnings are - Couldn't execute Nail! /bin/bash: /home/kiran/clojure/vimclojure-2.1.1/ngclient: is a directory

8:25 durka42: eh...

8:25 bartj: durka42, I think this is because, I have this in my .vimrc

8:25 durka42: is that a directory?

8:25 bartj: yes

8:25 durka42: you should set that to the executable

8:26 not the directory it is in

8:26 bartj: durka42, I am on Unbuntu

8:26 durka42: if you go into the vimclojure-2.1.1 directory and run ant, you will get an executable called ng in vimclojure-2.1.1

8:26 bartj: and I have a ng.exe so, it wouldn't make sense right?

8:27 durka42: no, not that one

8:27 there should be a file named ng

8:28 bartj: there is something called ng-server

8:28 in vimclojure-2.1.1/bin directory

8:29 my local.properties in the vimclojure directory looks like this:

8:29 clojure.jar = /home/username/clojure/clojure/clojure.jar

8:29 clojure-contrib.jar = /home/username/clojure/clojure-contrib/clojure-contrib.jar

8:29 clojurebot: clojure is a language to use if you want to up your game

8:29 bartj: nailgun-client = ng

8:29 vimdir = /home/username/.vim

8:31 durak42, are you there? please help

8:32 there is a ng.exe

8:38 I am on Ubuntu, unable to setup REPL on vimclojure

8:38 durka42: sorry, i wasn't paying attention

8:38 first, change the directories in local.properties so they point to your actual clojure and contrib jars

8:38 bartj: durka42, you are like my only hope now to clojure (seriously)

8:38 durka42: then run ant in the vimclojure-2.1.1 directory

8:39 bartj: yes, did that

8:39 running ant throws and error - "java.lang.NoSuchMethodError: clojure.lang.Var.deref()Ljava/lang/Object; "

8:39 tsdh: When I start a repl with 'java -cp ".:clojure.jar:other.jar" clojure.main' and then try to `use' a namespace from other.jar, I get a "java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0)".

8:39 What should that tell me?

8:40 durka42: the ant error is interesting...

8:40 is your clojure up to date?

8:41 tsdh: Well, somehow. When I use my slime repl using the same clojure version, it works

8:41 bartj: durka42, how do I see the version number?

8:42 tsdh: Ups, wrong conversation. :-)

8:43 durka42: where did you download it from?

8:43 there is a file in clojure/src/clj/clojure/version.properties

8:43 tsdh: try to get a backtrace?

8:43 * durka42 will be back

8:45 tsdh: durka42: How?

8:49 bartj: where can I get clojure-contrib from?

8:49 I have got the latest clojure from here - http://code.google.com/p/clojure/downloads/list

8:49 Chouser: bartj: clojure and contrib latest are now at github

8:50 bartj: http://github.com/richhickey/

8:50 durka42: tsdh: (.printStackTrace *e)

8:50 bartj: Chouser: you mean the stable versions?

8:51 Chouser: How can I know the version of my clojure?

8:51 Chouser: bartj: all versions are at github. google code is no longer being updated.

8:51 Chousuke: bartj: the stable is still 1.0.0 though.

8:52 Chouser: bartj: if you have at least version 1.0 of clojure, you can type *clojure-version* at the repl

8:54 bartj: It gives me a "Unable to resolve symbol"

8:54 Chousuke: then you have some old version :/

9:00 bartj: Can someone mention on clojure hosted on googlecode project that it is not the latest!

9:01 Chouser: there's a small note on http://code.google.com/p/clojure/

9:01 rhickey: bartj: http://code.google.com/p/clojure/ says "Note - the latest development is on GitHub and Assembla"

9:02 Chouser: the featured download there is 1.0.0 which is the latest stable anyway

9:02 latest release

9:02 Chousuke: is there going to be a bugfix release of 1.0 anytime soon though?

9:03 Chouser: also, have you noticed that you can use assembla to "connect" two tickets together. maybe that would be useful for the 1.0-bugfix tracking tickets.

9:04 Chouser: Chousuke: ooh, no I hadn't.

9:04 bartj: rhickey: thanks! (I missed that, maybe it can be in red or something :)

9:04 Chousuke: there's an "associations" thingy on the ticket page

9:04 Chouser: Chousuke: ok thanks.

9:06 Chousuke: it doesn't seem to like associating things with closed tickets though :/

9:08 but it seems you could just create a ticket, then click "associate with new ticket" to create the bugfix tracking ticket as a child of the main entry.

9:10 AWizzArd: Any windows user here who has installed JDK 6 Update 14?

9:10 Chouser: yeah, that looks good -- one operation makes a two-way link.

9:22 bartj: can anyone please tell me how to start REPL in vim using vimclojure?

9:22 I donot have the mapping set up properly for "\sr"

9:23 durka42: if I type :call vimclojure#Repl.New() in vim I get the following errors

9:23 clojurebot: vimclojure is state-of-the-art

9:23 bartj: Couldn't execute Nail! java.lang.NoClassDefFoundError: Could not initialize class de.kotka.vimclojure.nails.Repl at java.lang.Class.forName0(Native Method) a t java.lang.Class.forName(Class.java:169) at com.martiansoftware.nailgun.NGSession.run(Unknown Source

9:24 someone please help!

9:29 can someone help me setup REPL on vimclojure?

9:29 clojurebot: http://www.khanacademy.org/

9:29 bartj: is anyone here?

9:29 or is everyone ignoring me?

9:29 test

9:30 rhickey: bartj: I'm sure if someone knew the answer they'd chime in - I don't

9:30 Chousuke: bartj: Maybe there are no vimclojure users around :/

9:30 but that looks like your classpath isn't properly configured

9:36 AWizzArd: rhickey: any news about Datalog? And btw, is DL comparable to Jess (rule engine)?

9:38 rhickey: AWizzArd: there is datalog in contrib, I haven't had as much time for it as I'd like, differs from Jess in being "backward chaining" (although can be bottom-up) vs forward-chaining Rete in Jess

9:38 try it out!

9:40 AWizzArd: Ah good, it arrived in contrib by now. While Jess is nice it is *by far* too expensive.

9:41 rhickey: How much is Jess?

9:46 AWizzArd: rhickey: if you want to fully use it 75k

9:46 but an evaluation license for 90 days or so only costs 5k

9:47 this is for companies but also for personal use. Only the US government may use it for free, and universities may apply for a free license.

9:47 asbjxrn: 5k for evaluation!?

9:47 AWizzArd: yup

9:48 rhickey: well, there's Drools then

9:48 AWizzArd: ah no, 2000 for 90 days evaluation (just checked again)

9:50 Lisa is unfortunately very clos'ish which would make a translation harder. Not much reusable code.

9:51 rhickey: http://www.jboss.org/drools/

9:54 the only problem with Drools, IIRC, was that they weren't great at dynamic facts, i.e. you (I) want to be able to use java.util.Maps (and thus Clojure maps) as facts, and they wanted POJOs with bean properties :(

9:55 bartj: durka42 are you there?

9:56 I get the foll. error - Couldn't execute Nail! java.lang.NoClassDefFoundError: Could not initialize class de.kotka.vimclojure.nails.Repl at java.lang.Class.forName0(Native Method) a t java.lang.Class.forName(Class.java:169) at com.martiansoftware.nailgun.NGSession.run(Unknown Source)

9:56 when I do a ":call vimclojure#Repl.New()" in vim

9:56 ie. trying to start a REPL on vim

10:05 AWizzArd: For just general pattern matching that also has pretty declarative rules fnparse is nice.

10:36 sayyestolife: this question might be bizare (and probably wrong) but, how can clojure be "truely" multithreaded when running on jvm? (is the jvm also multithreaded?)

10:36 Chouser: yes

10:37 jvm provides access to real OS threads, and Clojure uses them.

10:40 but a perfectly reasonable question. :-)

10:43 sayyestolife: oh okay, cool :)

10:52 AWizzArd: Is there a way in JSwat (4.4) to watch some specific variables? The default view shows me everything, but my clojure vars are deeply hidden into class members of arreys of hashtables of arrays of values, and so on.

10:55 I can step through my program, which is nice, but don't see why it goes a specific route and how values change. The real values are not practically visible.

12:00 Is there in contrib already a text/repl based stepper?

14:06 dysinger: sup

14:09 Raynes: Hi.

14:13 danlarkin: howdy

14:18 sayyestolife: it seems like the 'cond' in clojure doesn't work quite the same way as the one in c-lisp?

14:20 hiredman: among many things

14:20 sayyestolife: well, is there a way of having a similar cond in clojure?

14:21 the api doc didn't give me much of a clue of how to use clojures cond

14:21 hiredman: ,(doc cond)

14:21 clojurebot: "([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."

14:21 hiredman: ,(cond (= 1 1) :foo :else :bar)

14:21 clojurebot: :foo

14:22 sayyestolife: thanks

14:22 hiredman: I have not really used cl, but I believe the main difference is you don't wrap tests and expressions in their own set of parens

14:22 sayyestolife: oh

14:23 that was it, thanks!

14:23 hiredman: so if (= 1 1) is true then the result of the above cond is :foo

14:23 :else is just a convention, you can use anyhing non-nil as the final clause

14:23 sayyestolife: ok

14:24 hiredman: ,(cond (= 1 3) :foo \F :bar)

14:24 clojurebot: :bar

14:24 hiredman: well, non-nil and non-false

14:24 lenst: ,(or nil false)

14:24 clojurebot: false

14:25 hiredman: ,(or false nil)

14:25 clojurebot: nil

15:06 ChrisPS: hello all

15:09 drewr: hi

15:16 sayyestolife: I just made my first clojure app, may I be so rude that I'd request some comments on it? http://pastebin.com/d5c8bf086

15:17 arohner_: sayyestolife: it looks fine

15:18 Chouser: uses mutual recursion

15:19 it won't load in a fresh repl without (declare guess-the-number) first, but I wonder if mutual recursion is the best way to go.

15:19 sayyestolife: Chouser hmm how would you structure it then?

15:20 drewr: a single loop would suffice

15:20 Chouser: not sure. maybe a single loop/recur?

15:21 or reduce on (repeatedly read-line)

15:21 ok, I don't really recommend the latter in the case. :-)

15:21 drewr: reduce with side-effects?

15:21 :-)

15:22 Chouser: I've actually used (repeatedly #(.read f)) a few times -- it can work quite nicely.

15:22 hiredman: yes it can

15:23 Chouser: sayyestolife: but it works! congrats. :-)

15:23 sayyestolife: thanks! :)

15:25 Chouser: yeah, I think since the heart of your program is the guess loop, I'd try to do that with a single local loop. If you want to factor out some code, use a different tack.

15:25 maybe store the messages in a separate hash so they don't clutter up the logic in the loop. or something.

15:27 sayyestolife: mkay

16:40 technomancy: when you see something like Text.class() in Java, what does it mean?

16:40 isn't Text already a class?

16:40 err; assuming Text is a class. =)

16:40 Chouser: technomancy: it's now they get the instance of Class

16:41 technomancy: Chouser: so (say) when you reference String, that's not an instance of Class?

16:41 or not in Java at least?

16:41 Chouser: I'm not sure, but I guess you can't just say Class foo = Text;

16:42 ozzilee: technomancy: I'm pretty sure it's mostly just a syntactic kludge.

16:42 Chouser: you'd have to say Class foo = Text.class();

16:42 technomancy: ozzilee: so it's probably unnecessary in Clojure then?

16:42 ozzilee: technomancy: Yeah, I think it is (unnecessary).

16:42 Chouser: in clojure you'd just use the word Text as an expression

16:42 Chousuke: ,(.class "foo")

16:42 clojurebot: java.lang.IllegalArgumentException: No matching field found: class for class java.lang.String

16:42 technomancy: what a mess of a language. =)

16:42 Chousuke: hmm.

16:42 hiredman: I know Class has a getClass method

16:42 Chouser: ,Integer

16:42 clojurebot: java.lang.Integer

16:42 hiredman: never heard of the class method

16:42 Chousuke: (class Integer)

16:42 ,(class Integer)

16:42 clojurebot: java.lang.Class

16:43 ataggart: ,(.getClass "foo")

16:43 clojurebot: java.lang.String

16:43 hiredman: ,(class (resolve (symbol "Integer")))

16:43 clojurebot: java.lang.Class

16:43 Chousuke: but String.class is special syntax in Java to get the class object I think

16:43 ataggart: (class String)

16:43 hiredman: yeah

16:43 ataggart: ,(class String)

16:43 clojurebot: java.lang.Class

16:43 hiredman: but you don't call it like a method

16:43 String.class()

16:43 Chouser: it's pretty amazing how little #clojure knows about Java

16:44 Chousuke: :)

16:44 ataggart: String.class() isn't valid java anyway

16:44 technomancy: sorry, no parens on that.

16:44 hiredman: hey, I am in #java too

16:45 ataggart: why?

16:45 Chouser: I guess #clojure probably knows more about java than #java does about clojure.

16:45 technomancy: Chouser: every time I try to read something that explains basic Java concepts it just numbs my brain. I literally can't proceed.

16:45 Chouser: technomancy: heh

16:45 technomancy: it's like my brain is trying to protect itself

16:45 Chousuke: basic java concepts? like whaT?

16:46 technomancy: dependency injection is the classic example.

16:46 Chousuke: hm

16:46 ataggart: DI isn't really java per se

16:46 Chousuke: I don't think that's a basic java concept.

16:46 :P

16:46 technomancy: I can't even comprehend the basic problem it's trying to solve, much less how it works.

16:46 but I'm OK with that.

16:46 ataggart: avoiding tight coupling between implementations

16:47 drewr: technomancy: +1

16:48 Chousuke: sounds like they just need higher-order functions :/

16:48 ataggart: bear in mind this is within the context of java, not a functional language

16:49 also makes it easy to swap out implementations without the caller caring

16:52 hiredman: I am by no means a fan of Java, but I fidn the level of disgust regarding it far out of porportion to how horrible it is

16:52 mblinn: yeah the need for such things seems to pretty much disappear in more expressive languages

16:53 Chousuke: hiredman: I found java rather pleasant, coming from C++ :P

16:55 ataggart: hiredman: I can't tell whether you think the level of disgust is too small or too great ;)

16:56 hiredman: too great

16:56 it's not like java eats babies (very often)

16:57 Chousuke: I guess a lot of the disgust comes from the perception that all java apps are of substandard quality (because many of them are)

16:57 mblinn: yeah, it's the 90% of everything is crap rule

16:57 Chousuke: I think java's UI toolkits make it worse though.

16:58 it's easy to make a java GUI program that doesn't fit well in any system.

16:58 drewr: and because it's so ubiquitous, 90% is a very large sample

16:58 ataggart: I'm not sure what a "java app" is, but I use several dozen open source java tools and libraries. They serve my purposes very well

16:58 Chousuke: so even if the code is good, it'll still look like crap.

16:59 ataggart: 90% of java apps with a UI makes up about 5% of the java stuff out there

16:59 Chousuke: there are pleasant exceptions too though, like Cyberduck on OS X.

16:59 I didn't even know it was java until I took a look at the source :P

16:59 drewr: Chousuke: I suspect the good apps like that hide their Java so well that people don't realize it's Java

16:59 Chousuke: heh, yeah

17:00 Cyberduck isn't portable java though.

17:00 it uses Cocoa bindings for its UI.

17:00 drewr: DBVisualizer is another one (although it requires JDBC knowledge to use)

17:00 ataggart: judging java by the ui apps that are written in it is... less than representative.

17:01 drewr: ataggart: those were examples of *good* apps

17:01 ataggart: my point is that a huge proponderance of java is running without any ui whatsoever, namelyon the server

17:01 and much of it is very well done

17:02 drewr: my problem with Java started when I had to maintain some Struts/JSP coming from a Perl background

17:02 just seemed way too heavy

17:02 ataggart: well, that's a separate issue from the language

17:02 Chousuke: ataggart: I think Java's reputation got another hit here in Finland when one of our banks, as a result of a merger, replaced their fully working and cross-platform compatible web banking solution with a java-based piece of crap that worked well for no-one.

17:03 drewr: ataggart: true, but a language is inseparable from its ecosystem, and the ecosystem at a lot of Java shops sucks

17:03 ataggart: bad shops are bad. can't do much about that

17:03 Chousuke: ataggart: the amount of fail was epic.

17:03 ataggart: if anything I would imaine that the distribution of code quality to volume is a result of java being somewhat more approachable than some functional languages

17:04 slashus2: Chousuke: So the software didn't replace the old software completely? Usability wise..

17:04 ataggart: namely java has a huge amount of code spread around the quality axis (because one can write working, yet crappy code in java)

17:04 Chousuke: slashus2: I don't know, but my impression is that it was a complete overhaul

17:04 ataggart: whereas only the top few academic and hardcore CSers are doing stuff in "better" but more esoteric languages

17:05 so, higher quality, but very little of it to see

17:05 Chousuke: http://kks.cabal.fi/SampoApplet this page collected some of the fail found in the java client applet.

17:05 ataggart: I dont care what other people do

17:05 so long as my java code is done correctly

17:06 Chousuke: I like the public static final int RandomErrorNotEnoughRandom = 1;

17:06 drewr: ataggart: none of us is arguing that Java is bad; we were just reminiscing about our bad tastes :-)

17:07 ataggart: java related stuff I use on a regular basis: eclipse, ant, ivy, tomcat, apache-commons-*, hibernate, log4j, spring, aspectj, various MQs, several X*L related libraries, and so on

17:08 Chousuke: eclipse is pretty good

17:08 it's not even that slow anymore.

17:08 ataggart: yup, and they had the god sense to not deal with Sun's ui library

17:08 *good

17:08 Chousuke: the look'n'feel could still be better though.

17:09 ataggart: intellij felt snappier when I played with it, but I dislike how things are laid out

17:09 plus the ecosystem aroudn eclipse is better

17:10 alas, I don't have anu opportunity to do real work in clojure

18:06 eevar: ,(doc for)

18:06 clojurebot: "([seq-exprs body-expr]); List comprehension. Takes a vector of one or more binding-form/collection-expr pairs, each followed by zero or more modifiers, and yields a lazy sequence of evaluations of expr. Collections are iterated in a nested fashion, rightmost fastest, and nested coll-exprs can refer to bindings created in prior binding-forms. Supported modifiers are: :let [binding-form expr ...], :while test, :when test.

18:08 kotarak: oh. Welcome back, clojurebot. How was your vacation?

18:08 AWizzArd: ~max people

18:08 clojurebot: max people is 164

18:17 hiredman: http://ejohn.org/blog/html-5-parsing/ slightly off-topic, but the page contains the word Java...

18:27 grrrt: Hi! Are there guidelines for documenting clojure code? And is it possible to generate html from code docs?

18:28 doh... I just noticed "gen-html-docs" in clojure contrib. I'll look at that before asking questions :)

18:38 Knekk_: ,(+ 1 2)

18:38 clojurebot: 3

18:38 Knekk_: neat-o

18:55 arohner_: I have a collection of elements that I want to logical and. Is there a better way than (every? identity coll)?

19:00 it would be nice if (doc ns) produced the doc strings for all public functions in the namespace

19:00 lol

19:00 ,(doc docs)

19:00 clojurebot: "clojure.contrib.ns-utils/docs;[[nsname]]; Prints documentation for the public vars in a namespace"

19:01 arohner_: of course...

19:08 technomancy: it must be hard to be a scala newbie. you have to choose between reading "Programming Scala", reading "Programming Scala", and reading "Programming in Scala"

21:22 hiredman: ~exceptions

21:22 clojurebot: http://paste.lisp.org/display/74305

21:53 notostraca_: Hi, room

21:54 danlarkin: Hi, notostraca_

21:54 notostraca_: I am trying to learn clojure

21:54 in particular, I am trying to learn clojure to use on an IRC bot

21:54 danlarkin: how's it going?

21:54 notostraca_: well it is going pretty well

21:55 on a side-note i did a little experimenting with fibonacci sequences

21:55 and i got the 1,000,000th after a while

21:55 but my question is esoteric

21:56 i want to use the PircBot IRC bot

21:56 written in java

21:56 but it uses java threads

21:56 and I don't know if there are bad interactions with the STM?

21:57 danlarkin: there's a mature user of PircBot already, clojurebot

21:57 his code is open source

21:57 clojurebot: where are you?

21:57 clojurebot: http://github.com/hiredman/clojurebot/tree/master

21:57 notostraca_: nice!

21:57 danlarkin: I don't know if that uses the STM at all

21:58 notostraca_: well my irc bot is meant to moderate a "tabletop" game

21:58 but to do more than just roll dice

21:59 so it has to separate game commands from normal chat

22:00 danlarkin: mmmhmm

22:00 notostraca_: because the whole routine of "Bot: it is your turn, Bill. What is your action? a, b, or c", "Bill: b", "Bot: Targeting what character? a, b, or c", "Bill: a"...

22:00 danlarkin: yeah I think that's a good use case for clojure

22:00 notostraca_: gets to take up a lot of chatroom space

22:01 so i am not sure about a lot of things about concurrency

22:01 hiredman: 3d6

22:01 clojurebot: 6

22:01 JAS415: if i'm using :inline and :inline-arities, is there a way to make the function inline for any arity?

22:01 notostraca_: 10d99

22:01 clojurebot: 465

22:01 hiredman: 3d6

22:01 clojurebot: 16

22:02 JAS415: i cast magicmissile

22:02 notostraca_: at the darkness?

22:02 JAS415: yes, at the darkness

22:03 notostraca_: you hit the darkness for NaN damage

22:03 JAS415: nice

22:03 1e7d6

22:03 hm

22:03 notostraca_: 1.5d7

22:03 JAS415: any ideas about inline and inline arities

22:03 ?

22:04 notostraca_: & args...

22:04 hiredman: the bot uses a regex to look for dice rolls

22:04 JAS415: I don't think you can inline arbitrary arities

22:04 JAS415: that's too bad it would be useful for fixing +

22:04 hiredman: 1d6+20

22:04 clojurebot: 22

22:05 JAS415: hmm

22:05 well it takes a set

22:05 maybe i can make it take a really big set?

22:06 hiredman: well

22:07 ,^+

22:07 clojurebot: nil

22:07 hiredman: bah

22:07 ,^#'+

22:07 clojurebot: {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 549, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__3946 clojure.core$fn__3946@90ebfe>, :doc "Returns the sum of nums. (+) returns 0."}

22:08 JAS415: nope it didn't like that

22:08 ah becauserange didn't exist

22:09 hiredman: I am not sure how :inline is suposed to work

22:09 JAS415: it is a function that returns a list of lists that expands out into the body

22:10 example you can do this:

22:11 (defn +

22:11 "Returns the sum of nums. (+) returns 0."

22:11 {:inline (fn ([x y] `(. clojure.lang.Numbers (add ~x ~y)))

22:11 ([x y & more] (reduce (fn [a b] `(. clojure.lang.Numbers (add ~a ~b))) `(. clojure.lang.Numbers (add ~x ~y)) more)))

22:11 :inline-arities #{1 2 3 4 5 6 7 8 9 10 11 12 13}}

22:11 ([] 0)

22:11 ([x] (cast Number x))

22:11 ([x y] (. clojure.lang.Numbers (add x y)))

22:11 ([x y & more]

22:11 (reduce + (+ x y) more)))

22:12 and then your math for (+ 1 (+ 2 (+ 3))) isn't any faster than (+ 1 2 3) because they are the same

22:12 just i'd like it to inline for all arities

22:13 hiredman: you need a set of all natural numbers

22:13 :P

22:13 JAS415: yup!

22:13 :-)

22:13 hiredman: clojurebot: set?

22:13 clojurebot: It's greek to me.

22:13 JAS415: except i guess i need to build it from java primitives?

22:16 notostraca_: can you use lazy sets of all natural numbers?

22:16 are there any lazy sets???

22:17 hiredman: no

22:17 I was sort of working on rule based sets

22:17 JAS415: you can coerce a lazy list to a set i think though

22:18 hiredman: I kind of doubt that

22:18 JAS415: hmm

22:18 well i guess 1-20 should be enough for now?

22:18 2-20

22:19 hiredman: http://paste.lisp.org/display/80355

22:20 a big annoyance is many clojure.set operations work on the result of calling seq on the set

22:20 JAS415: ooo

22:20 hmm

22:21 well i guess i could do a proxy class on that which returns true as long as it is a number?

22:21 i guess it would have to be a number within a range

22:31 notostraca_: hm

22:31 this looks bad for my usage of clojurebot

22:31 it still won't respond to my DCC request

22:31 so i don't know if it... can.

22:32 i bet it isn't able

22:32 hiredman: it won't

22:32 clojurebot is uses pircbot

22:32 and I never connected up the dcc bits

22:32 notostraca_: pircbot uses threads for dcc

22:32 hiredman: and?

22:32 notostraca_: are they compatible with clojure concurrency stuff?

22:33 hiredman: of course

22:33 notostraca_: oh good

22:33 i am just working my way through Programming Clojure, so I don't know most of this

22:34 hiredman: unless you need annotations, you can use anything java from clojure

22:34 notostraca_: nice

22:35 are there any good parsing libraries for clojure?

22:35 hiredman: fnparse is pretty nice

22:35 clojurebot: parse?

22:35 clojurebot: parser is http://github.com/joshua-choi/fnparse/tree/master

22:35 hiredman: there is clj-peg too

22:35 I have not used clj-peg

Logging service provided by n01se.net