#clojure logs

2009-07-08

00:27technomancywho wants to try out my dependency management project? http://github.com/technomancy/corkscrew/tree/master
02:30doubleagentIs this the correct channel for 'support' questions?
02:33slashus2What question do you have?
02:35doubleagentFairly simple. How do I force a Ratio or Double to be represented as an Integer/Long/BigNum?
02:36slashus2,(double 5/4)
02:36slashus2(bigint 5/4)
02:37slashus2doubleagent: That what you mean?
02:39doubleagentslashus2, thanks - I see those forms in the api now too. :)
02:39slashus2doubleagent: This is dex by the way.
02:39slashus2:-P
02:40doubleagent:)
02:55slashus2doubleagent: Rich Hickey hangs out in here often too.
02:56doubleagentcool.
05:49tsdhHi. What do I have to do to get a repl when invoking "java -jar my-stuff.jar"?
05:50tsdhThis jar contains all clojure class files and my code. In my ant jar target there's <exclude name="**/Test*.java"/>.
05:50tsdhUps, sorry. I've meant: <attribute name="Main-Class" value="clojure.lang.Repl"/>
05:52tsdhBut executing the jar errors: http://paste.lisp.org/display/83222
05:59tsdhHm. I replaced the value of Main-Class with "clojure.main", but I get the same exceptions.
05:59hoecktsdh: and you have set a classpath?
06:00hoecktsdh: as in the clojure build.xml?
06:00tsdhIt is ".". Yes, exactly the same.
06:00asbjxrnIs the line reader part of the jar?
06:00asbjxrnUh...
06:02tsdhasbjxrn: It's in java, so it should be there anyway, right?
06:03tsdhI annotated my previous paste with the complete build.xml.
06:04asbjxrnYes I got confused there, thought it was that jline.ConsoleRunner lib... Don't know how I managed to misread that badly.
06:06tsdhOh, in the paste of the exception backtrace I omitted the last line. "Could not find the main class: clojure.main. Program will exit."
06:08tsdhBut looking at the jar's contents, there is clojure/main.class...
06:09hoecktsdh: so you are compiling clojure into this jar, and additionally your own (compiled) namespace?
06:10tsdhYes.
06:11hoeckwhat about only compiling your namespace and adding a precompiled clojure.jar to your own jarfile?
06:12tsdhI tried that first, but it didn't work, too...
06:12hoecktoo bad, mhh, do you have a build-xml for that latter case?
06:13tsdhsure, I'll annotate my paste.
06:15tsdhdone
06:16tsdhUps, there's a small error in it. The jar target depends on unjar, and it should depend on compile.
06:17tsdhI fixed that and annotatet the past with the error I get with this jar.
06:27tsdhHm, when I omit the (unpacked) jar in my jar and call it with "java -cp ".:clojure.jar:myjar.jar" clojure.main, it works...
06:35hoeckpackaging a jar inside a jar and then setting the manifests classpath attribute is not allowed - thats new to me
06:35hoecktsdh: so I'm going tol try the other approach : )
06:55hoecktsdh: its the version.properties file in the clojure subfolder that is missing from the jar
06:57hoecktsdh: clojure loads it at class-initialization-time
06:58ChrisPSUsing emacs slime, can I select a function-name and jump to its definition in clojure-mode?
06:59hoecktsdh: adding <include name="**/*.properties"/> to the unjar pattern and <fileset dir="${build}" includes="**/*.properties"/> to the create-jar pattern works
07:02hoeckChrisPS: the slime-edit-definition command will do that
07:03hoeckChrisPS: but it isn't very reliable here (using xemacs, and a not up-to-date clojure-mode/swank/slime)
07:08ChrisPShoeck: oh, this works perfectly here (!)
07:11hoeckChrisPS: well, then maybe I'm going to update my setup, but no its lunchtime : )
07:11hoeckr/no/now
07:48hoecktsdh: I have annotated your paste with a build.xml that works (at least with my setup)
07:58bartjcan someone please help me setup REPL using vimclojure
07:58durka42bartj: what OS are you on?
07:58bartjdurka42: Ubuntu
07:59durka42ok, do you have vim and clojure and vimclojure installed already
07:59tsdhhoeck: Thanks.
07:59bartjI have got most of it right, except I am unable to understand how to set up LocalLeader, etc.
08:00bartjdurka42: yes
08:01durka42so you should be able to do \sr from within a clojure file to start a repl
08:02durka42provided you have vimclojure's ng-server running
08:05bartjdurka42, yes I have the ng-server running
08:07durka42but nothing happens when you do \sr?
08:07bartjdurka42, no
08:07bartjI don't think I have specified the map properly in my vimrc
08:07bartjcan you tell me how it should look like?
08:08bartjI have the foll. lines in my vimrc:
08:08bartjlet vimclojure#NailgunClient = "/home/<username>/clojure/vimclojure-2.1.1/ngclient"
08:08bartjlet clj_want_gorilla = 1
08:10bartjcan someone help me setting up the REPL in vim (using vimclojure)
08:11bartjI have the ng-server running but, when I type "\sr" in vim the REPL does not start :(
08:11bartjI haven't used maps in vim yet
08:11durka42i have let g:clj_want_gorilla = 1, not sure if that makes any difference
08:12durka42do you have a .clj file open in vim?
08:12bartjdurka42, yes
08:12bartjdurka42, I'll try that
08:13bartjdurka42, no luck
08:14bartjalso, does vimclojure not have automatic paranthesis closing?
08:15durka42no it doesn't
08:15durka42you might find surround.vim and autoclose.vim helpful
08:15bartjboth?
08:16bartjdurka42, I think my main problem is that I am not able to set "<LocalLeader>" in my .vimrc file
08:20durka42does it work if you do :call vimclojure#Repl.New() directly?
08:23bartjdurka42, it throws me two warnings but yes! it does work!!!
08:24bartjdurka42, I am not able to "type" anything though
08:24durka42in the repl?
08:24bartjdurka42, the warnings are - Couldn't execute Nail! /bin/bash: /home/kiran/clojure/vimclojure-2.1.1/ngclient: is a directory
08:25durka42eh...
08:25bartjdurka42, I think this is because, I have this in my .vimrc
08:25durka42is that a directory?
08:25bartjyes
08:25durka42you should set that to the executable
08:26durka42not the directory it is in
08:26bartjdurka42, I am on Unbuntu
08:26durka42if you go into the vimclojure-2.1.1 directory and run ant, you will get an executable called ng in vimclojure-2.1.1
08:26bartjand I have a ng.exe so, it wouldn't make sense right?
08:27durka42no, not that one
08:27durka42there should be a file named ng
08:28bartjthere is something called ng-server
08:28bartjin vimclojure-2.1.1/bin directory
08:29bartjmy local.properties in the vimclojure directory looks like this:
08:29bartjclojure.jar = /home/username/clojure/clojure/clojure.jar
08:29bartjclojure-contrib.jar = /home/username/clojure/clojure-contrib/clojure-contrib.jar
08:29clojurebotclojure is a language to use if you want to up your game
08:29bartjnailgun-client = ng
08:29bartjvimdir = /home/username/.vim
08:31bartjdurak42, are you there? please help
08:32bartjthere is a ng.exe
08:38bartjI am on Ubuntu, unable to setup REPL on vimclojure
08:38durka42sorry, i wasn't paying attention
08:38durka42first, change the directories in local.properties so they point to your actual clojure and contrib jars
08:38bartjdurka42, you are like my only hope now to clojure (seriously)
08:38durka42then run ant in the vimclojure-2.1.1 directory
08:39bartjyes, did that
08:39bartjrunning ant throws and error - "java.lang.NoSuchMethodError: clojure.lang.Var.deref()Ljava/lang/Object; "
08:39tsdhWhen 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)".
08:39tsdhWhat should that tell me?
08:40durka42the ant error is interesting...
08:40durka42is your clojure up to date?
08:41tsdhWell, somehow. When I use my slime repl using the same clojure version, it works
08:41bartjdurka42, how do I see the version number?
08:42tsdhUps, wrong conversation. :-)
08:43durka42where did you download it from?
08:43durka42there is a file in clojure/src/clj/clojure/version.properties
08:43durka42tsdh: try to get a backtrace?
08:45tsdhdurka42: How?
08:49bartjwhere can I get clojure-contrib from?
08:49bartjI have got the latest clojure from here - http://code.google.com/p/clojure/downloads/list
08:49Chouserbartj: clojure and contrib latest are now at github
08:50Chouserbartj: http://github.com/richhickey/
08:50durka42tsdh: (.printStackTrace *e)
08:50bartjChouser: you mean the stable versions?
08:51bartjChouser: How can I know the version of my clojure?
08:51Chouserbartj: all versions are at github. google code is no longer being updated.
08:51Chousukebartj: the stable is still 1.0.0 though.
08:52Chouserbartj: if you have at least version 1.0 of clojure, you can type *clojure-version* at the repl
08:54bartjIt gives me a "Unable to resolve symbol"
08:54Chousukethen you have some old version :/
09:00bartjCan someone mention on clojure hosted on googlecode project that it is not the latest!
09:01Chouserthere's a small note on http://code.google.com/p/clojure/
09:01rhickeybartj: http://code.google.com/p/clojure/ says "Note - the latest development is on GitHub and Assembla"
09:02Chouserthe featured download there is 1.0.0 which is the latest stable anyway
09:02Chouserlatest release
09:02Chousukeis there going to be a bugfix release of 1.0 anytime soon though?
09:03ChousukeChouser: 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.
09:04ChouserChousuke: ooh, no I hadn't.
09:04bartjrhickey: thanks! (I missed that, maybe it can be in red or something :)
09:04Chousukethere's an "associations" thingy on the ticket page
09:04ChouserChousuke: ok thanks.
09:06Chousukeit doesn't seem to like associating things with closed tickets though :/
09:08Chousukebut 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.
09:10AWizzArdAny windows user here who has installed JDK 6 Update 14?
09:10Chouseryeah, that looks good -- one operation makes a two-way link.
09:22bartjcan anyone please tell me how to start REPL in vim using vimclojure?
09:22bartjI donot have the mapping set up properly for "\sr"
09:23bartjdurka42: if I type :call vimclojure#Repl.New() in vim I get the following errors
09:23clojurebotvimclojure is state-of-the-art
09:23bartjCouldn'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
09:24bartjsomeone please help!
09:29bartjcan someone help me setup REPL on vimclojure?
09:29clojurebothttp://www.khanacademy.org/
09:29bartjis anyone here?
09:29bartjor is everyone ignoring me?
09:29bartjtest
09:30rhickeybartj: I'm sure if someone knew the answer they'd chime in - I don't
09:30Chousukebartj: Maybe there are no vimclojure users around :/
09:30Chousukebut that looks like your classpath isn't properly configured
09:36AWizzArdrhickey: any news about Datalog? And btw, is DL comparable to Jess (rule engine)?
09:38rhickeyAWizzArd: 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
09:38rhickeytry it out!
09:40AWizzArdAh good, it arrived in contrib by now. While Jess is nice it is *by far* too expensive.
09:41rhickeyHow much is Jess?
09:46AWizzArdrhickey: if you want to fully use it 75k
09:46AWizzArdbut an evaluation license for 90 days or so only costs 5k
09:47AWizzArdthis 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.
09:47asbjxrn5k for evaluation!?
09:47AWizzArdyup
09:48rhickeywell, there's Drools then
09:48AWizzArdah no, 2000 for 90 days evaluation (just checked again)
09:50AWizzArdLisa is unfortunately very clos'ish which would make a translation harder. Not much reusable code.
09:51rhickeyhttp://www.jboss.org/drools/
09:54rhickeythe 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 :(
09:55bartjdurka42 are you there?
09:56bartjI 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)
09:56bartjwhen I do a ":call vimclojure#Repl.New()" in vim
09:56bartjie. trying to start a REPL on vim
10:05AWizzArdFor just general pattern matching that also has pretty declarative rules fnparse is nice.
10:36sayyestolifethis question might be bizare (and probably wrong) but, how can clojure be "truely" multithreaded when running on jvm? (is the jvm also multithreaded?)
10:36Chouseryes
10:37Chouserjvm provides access to real OS threads, and Clojure uses them.
10:40Chouserbut a perfectly reasonable question. :-)
10:43sayyestolifeoh okay, cool :)
10:52AWizzArdIs 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:55AWizzArdI 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:00AWizzArdIs there in contrib already a text/repl based stepper?
14:06dysingersup
14:09RaynesHi.
14:13danlarkinhowdy
14:18sayyestolifeit seems like the 'cond' in clojure doesn't work quite the same way as the one in c-lisp?
14:20hiredmanamong many things
14:20sayyestolifewell, is there a way of having a similar cond in clojure?
14:21sayyestolifethe api doc didn't give me much of a clue of how to use clojures cond
14:21hiredman,(doc cond)
14:21clojurebot"([& 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:21hiredman,(cond (= 1 1) :foo :else :bar)
14:21clojurebot:foo
14:22sayyestolifethanks
14:22hiredmanI 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:22sayyestolifeoh
14:23sayyestolifethat was it, thanks!
14:23hiredmanso if (= 1 1) is true then the result of the above cond is :foo
14:23hiredman:else is just a convention, you can use anyhing non-nil as the final clause
14:23sayyestolifeok
14:24hiredman,(cond (= 1 3) :foo \F :bar)
14:24clojurebot:bar
14:24hiredmanwell, non-nil and non-false
14:24lenst,(or nil false)
14:24clojurebotfalse
14:25hiredman,(or false nil)
14:25clojurebotnil
15:06ChrisPShello all
15:09drewrhi
15:16sayyestolifeI just made my first clojure app, may I be so rude that I'd request some comments on it? http://pastebin.com/d5c8bf086
15:17arohner_sayyestolife: it looks fine
15:18Chouseruses mutual recursion
15:19Chouserit 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:19sayyestolifeChouser hmm how would you structure it then?
15:20drewra single loop would suffice
15:20Chousernot sure. maybe a single loop/recur?
15:21Chouseror reduce on (repeatedly read-line)
15:21Chouserok, I don't really recommend the latter in the case. :-)
15:21drewrreduce with side-effects?
15:21drewr:-)
15:22ChouserI've actually used (repeatedly #(.read f)) a few times -- it can work quite nicely.
15:22hiredmanyes it can
15:23Chousersayyestolife: but it works! congrats. :-)
15:23sayyestolifethanks! :)
15:25Chouseryeah, 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:25Chousermaybe store the messages in a separate hash so they don't clutter up the logic in the loop. or something.
15:27sayyestolifemkay
16:40technomancywhen you see something like Text.class() in Java, what does it mean?
16:40technomancyisn't Text already a class?
16:40technomancyerr; assuming Text is a class. =)
16:40Chousertechnomancy: it's now they get the instance of Class
16:41technomancyChouser: so (say) when you reference String, that's not an instance of Class?
16:41technomancyor not in Java at least?
16:41ChouserI'm not sure, but I guess you can't just say Class foo = Text;
16:42ozzileetechnomancy: I'm pretty sure it's mostly just a syntactic kludge.
16:42Chouseryou'd have to say Class foo = Text.class();
16:42technomancyozzilee: so it's probably unnecessary in Clojure then?
16:42ozzileetechnomancy: Yeah, I think it is (unnecessary).
16:42Chouserin clojure you'd just use the word Text as an expression
16:42Chousuke,(.class "foo")
16:42clojurebotjava.lang.IllegalArgumentException: No matching field found: class for class java.lang.String
16:42technomancywhat a mess of a language. =)
16:42Chousukehmm.
16:42hiredmanI know Class has a getClass method
16:42Chouser,Integer
16:42clojurebotjava.lang.Integer
16:42hiredmannever heard of the class method
16:42Chousuke(class Integer)
16:42Chousuke,(class Integer)
16:42clojurebotjava.lang.Class
16:43ataggart,(.getClass "foo")
16:43clojurebotjava.lang.String
16:43hiredman,(class (resolve (symbol "Integer")))
16:43clojurebotjava.lang.Class
16:43Chousukebut String.class is special syntax in Java to get the class object I think
16:43ataggart(class String)
16:43hiredmanyeah
16:43ataggart,(class String)
16:43clojurebotjava.lang.Class
16:43hiredmanbut you don't call it like a method
16:43hiredmanString.class()
16:43Chouserit's pretty amazing how little #clojure knows about Java
16:44Chousuke:)
16:44ataggartString.class() isn't valid java anyway
16:44technomancysorry, no parens on that.
16:44hiredmanhey, I am in #java too
16:45ataggartwhy?
16:45ChouserI guess #clojure probably knows more about java than #java does about clojure.
16:45technomancyChouser: every time I try to read something that explains basic Java concepts it just numbs my brain. I literally can't proceed.
16:45Chousertechnomancy: heh
16:45technomancyit's like my brain is trying to protect itself
16:45Chousukebasic java concepts? like whaT?
16:46technomancydependency injection is the classic example.
16:46Chousukehm
16:46ataggartDI isn't really java per se
16:46ChousukeI don't think that's a basic java concept.
16:46Chousuke:P
16:46technomancyI can't even comprehend the basic problem it's trying to solve, much less how it works.
16:46technomancybut I'm OK with that.
16:46ataggartavoiding tight coupling between implementations
16:47drewrtechnomancy: +1
16:48Chousukesounds like they just need higher-order functions :/
16:48ataggartbear in mind this is within the context of java, not a functional language
16:49ataggartalso makes it easy to swap out implementations without the caller caring
16:52hiredmanI 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:52mblinnyeah the need for such things seems to pretty much disappear in more expressive languages
16:53Chousukehiredman: I found java rather pleasant, coming from C++ :P
16:55ataggarthiredman: I can't tell whether you think the level of disgust is too small or too great ;)
16:56hiredmantoo great
16:56hiredmanit's not like java eats babies (very often)
16:57ChousukeI guess a lot of the disgust comes from the perception that all java apps are of substandard quality (because many of them are)
16:57mblinnyeah, it's the 90% of everything is crap rule
16:57ChousukeI think java's UI toolkits make it worse though.
16:58Chousukeit's easy to make a java GUI program that doesn't fit well in any system.
16:58drewrand because it's so ubiquitous, 90% is a very large sample
16:58ataggartI'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:58Chousukeso even if the code is good, it'll still look like crap.
16:59ataggart90% of java apps with a UI makes up about 5% of the java stuff out there
16:59Chousukethere are pleasant exceptions too though, like Cyberduck on OS X.
16:59ChousukeI didn't even know it was java until I took a look at the source :P
16:59drewrChousuke: I suspect the good apps like that hide their Java so well that people don't realize it's Java
16:59Chousukeheh, yeah
17:00ChousukeCyberduck isn't portable java though.
17:00Chousukeit uses Cocoa bindings for its UI.
17:00drewrDBVisualizer is another one (although it requires JDBC knowledge to use)
17:00ataggartjudging java by the ui apps that are written in it is... less than representative.
17:01drewrataggart: those were examples of *good* apps
17:01ataggartmy point is that a huge proponderance of java is running without any ui whatsoever, namelyon the server
17:01ataggartand much of it is very well done
17:02drewrmy problem with Java started when I had to maintain some Struts/JSP coming from a Perl background
17:02drewrjust seemed way too heavy
17:02ataggartwell, that's a separate issue from the language
17:02Chousukeataggart: 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:03drewrataggart: true, but a language is inseparable from its ecosystem, and the ecosystem at a lot of Java shops sucks
17:03ataggartbad shops are bad. can't do much about that
17:03Chousukeataggart: the amount of fail was epic.
17:03ataggartif 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:04slashus2Chousuke: So the software didn't replace the old software completely? Usability wise..
17:04ataggartnamely java has a huge amount of code spread around the quality axis (because one can write working, yet crappy code in java)
17:04Chousukeslashus2: I don't know, but my impression is that it was a complete overhaul
17:04ataggartwhereas only the top few academic and hardcore CSers are doing stuff in "better" but more esoteric languages
17:05ataggartso, higher quality, but very little of it to see
17:05Chousukehttp://kks.cabal.fi/SampoApplet this page collected some of the fail found in the java client applet.
17:05ataggartI dont care what other people do
17:05ataggartso long as my java code is done correctly
17:06ChousukeI like the public static final int RandomErrorNotEnoughRandom = 1;
17:06drewrataggart: none of us is arguing that Java is bad; we were just reminiscing about our bad tastes :-)
17:07ataggartjava 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:08Chousukeeclipse is pretty good
17:08Chousukeit's not even that slow anymore.
17:08ataggartyup, and they had the god sense to not deal with Sun's ui library
17:08ataggart*good
17:08Chousukethe look'n'feel could still be better though.
17:09ataggartintellij felt snappier when I played with it, but I dislike how things are laid out
17:09ataggartplus the ecosystem aroudn eclipse is better
17:10ataggartalas, I don't have anu opportunity to do real work in clojure
18:06eevar,(doc for)
18:06clojurebot"([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:08kotarakoh. Welcome back, clojurebot. How was your vacation?
18:08AWizzArd~max people
18:08clojurebotmax people is 164
18:17hiredmanhttp://ejohn.org/blog/html-5-parsing/ slightly off-topic, but the page contains the word Java...
18:27grrrtHi! Are there guidelines for documenting clojure code? And is it possible to generate html from code docs?
18:28grrrtdoh... I just noticed "gen-html-docs" in clojure contrib. I'll look at that before asking questions :)
18:38Knekk_,(+ 1 2)
18:38clojurebot3
18:38Knekk_neat-o
18:55arohner_I have a collection of elements that I want to logical and. Is there a better way than (every? identity coll)?
19:00arohner_it would be nice if (doc ns) produced the doc strings for all public functions in the namespace
19:00arohner_lol
19:00arohner_,(doc docs)
19:00clojurebot"clojure.contrib.ns-utils/docs;[[nsname]]; Prints documentation for the public vars in a namespace"
19:01arohner_of course...
19:08technomancyit 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:22hiredman~exceptions
21:22clojurebothttp://paste.lisp.org/display/74305
21:53notostraca_Hi, room
21:54danlarkinHi, notostraca_
21:54notostraca_I am trying to learn clojure
21:54notostraca_in particular, I am trying to learn clojure to use on an IRC bot
21:54danlarkinhow's it going?
21:54notostraca_well it is going pretty well
21:55notostraca_on a side-note i did a little experimenting with fibonacci sequences
21:55notostraca_and i got the 1,000,000th after a while
21:55notostraca_but my question is esoteric
21:56notostraca_i want to use the PircBot IRC bot
21:56notostraca_written in java
21:56notostraca_but it uses java threads
21:56notostraca_and I don't know if there are bad interactions with the STM?
21:57danlarkinthere's a mature user of PircBot already, clojurebot
21:57danlarkinhis code is open source
21:57danlarkinclojurebot: where are you?
21:57clojurebothttp://github.com/hiredman/clojurebot/tree/master
21:57notostraca_nice!
21:57danlarkinI don't know if that uses the STM at all
21:58notostraca_well my irc bot is meant to moderate a "tabletop" game
21:58notostraca_but to do more than just roll dice
21:59notostraca_so it has to separate game commands from normal chat
22:00danlarkinmmmhmm
22:00notostraca_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:00danlarkinyeah I think that's a good use case for clojure
22:00notostraca_gets to take up a lot of chatroom space
22:01notostraca_so i am not sure about a lot of things about concurrency
22:01hiredman3d6
22:01clojurebot6
22:01JAS415if i'm using :inline and :inline-arities, is there a way to make the function inline for any arity?
22:01notostraca_10d99
22:01clojurebot465
22:01hiredman3d6
22:01clojurebot16
22:02JAS415i cast magicmissile
22:02notostraca_at the darkness?
22:02JAS415yes, at the darkness
22:03notostraca_you hit the darkness for NaN damage
22:03JAS415nice
22:03JAS4151e7d6
22:03JAS415hm
22:03notostraca_1.5d7
22:03JAS415any ideas about inline and inline arities
22:03JAS415?
22:04notostraca_& args...
22:04hiredmanthe bot uses a regex to look for dice rolls
22:04hiredmanJAS415: I don't think you can inline arbitrary arities
22:04JAS415that's too bad it would be useful for fixing +
22:04hiredman1d6+20
22:04clojurebot22
22:05JAS415hmm
22:05JAS415well it takes a set
22:05JAS415maybe i can make it take a really big set?
22:06hiredmanwell
22:07hiredman,^+
22:07clojurebotnil
22:07hiredmanbah
22:07hiredman,^#'+
22:07clojurebot{: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:08JAS415nope it didn't like that
22:08JAS415ah becauserange didn't exist
22:09hiredmanI am not sure how :inline is suposed to work
22:09JAS415it is a function that returns a list of lists that expands out into the body
22:10JAS415example you can do this:
22:11JAS415(defn +
22:11JAS415 "Returns the sum of nums. (+) returns 0."
22:11JAS415 {:inline (fn ([x y] `(. clojure.lang.Numbers (add ~x ~y)))
22:11JAS415 ([x y & more] (reduce (fn [a b] `(. clojure.lang.Numbers (add ~a ~b))) `(. clojure.lang.Numbers (add ~x ~y)) more)))
22:11JAS415 :inline-arities #{1 2 3 4 5 6 7 8 9 10 11 12 13}}
22:11JAS415 ([] 0)
22:11JAS415 ([x] (cast Number x))
22:11JAS415 ([x y] (. clojure.lang.Numbers (add x y)))
22:11JAS415 ([x y & more]
22:11JAS415 (reduce + (+ x y) more)))
22:12JAS415and then your math for (+ 1 (+ 2 (+ 3))) isn't any faster than (+ 1 2 3) because they are the same
22:12JAS415just i'd like it to inline for all arities
22:13hiredmanyou need a set of all natural numbers
22:13hiredman:P
22:13JAS415yup!
22:13JAS415:-)
22:13hiredmanclojurebot: set?
22:13clojurebotIt's greek to me.
22:13JAS415except i guess i need to build it from java primitives?
22:16notostraca_can you use lazy sets of all natural numbers?
22:16notostraca_are there any lazy sets???
22:17hiredmanno
22:17hiredmanI was sort of working on rule based sets
22:17JAS415you can coerce a lazy list to a set i think though
22:18hiredmanI kind of doubt that
22:18JAS415hmm
22:18JAS415well i guess 1-20 should be enough for now?
22:18JAS4152-20
22:19hiredmanhttp://paste.lisp.org/display/80355
22:20hiredmana big annoyance is many clojure.set operations work on the result of calling seq on the set
22:20JAS415ooo
22:20JAS415hmm
22:21JAS415well i guess i could do a proxy class on that which returns true as long as it is a number?
22:21JAS415i guess it would have to be a number within a range
22:31notostraca_hm
22:31notostraca_this looks bad for my usage of clojurebot
22:31notostraca_it still won't respond to my DCC request
22:31notostraca_so i don't know if it... can.
22:32notostraca_i bet it isn't able
22:32hiredmanit won't
22:32hiredmanclojurebot is uses pircbot
22:32hiredmanand I never connected up the dcc bits
22:32notostraca_pircbot uses threads for dcc
22:32hiredmanand?
22:32notostraca_are they compatible with clojure concurrency stuff?
22:33hiredmanof course
22:33notostraca_oh good
22:33notostraca_i am just working my way through Programming Clojure, so I don't know most of this
22:34hiredmanunless you need annotations, you can use anything java from clojure
22:34notostraca_nice
22:35notostraca_are there any good parsing libraries for clojure?
22:35hiredmanfnparse is pretty nice
22:35hiredmanclojurebot: parse?
22:35clojurebotparser is http://github.com/joshua-choi/fnparse/tree/master
22:35hiredmanthere is clj-peg too
22:35hiredmanI have not used clj-peg