#clojure logs

2009-12-21

00:15Blackfootwhat's the best way to get a library like http-client installed with OSX after `port install clojure +rlwrap`
00:16Blackfooti tried installing the jar from clojars, but get an error: java.lang.NoClassDefFoundError: clojure/lang/RT (NO_SOURCE_FILE:0)
01:15pdk`can doto be applied to a class and have static methods of that classed used therein
01:16pdk`or just use ..
01:31bytecoderif it's just a single call you can use it like ,(Math/sqrt 4)
01:31bytecoder,(Math/sqrt 4)
01:31clojurebot2.0
02:44johnmn3by chance, anyone know how to pull the text to the left or right of a caret in a JTextArea lazily?
03:10johnmn3how do you type hint a char[] and an int?
03:25LauJensenMorning team
03:32johnmn3an Unmatched delimiter: ) is kicking my butt!
03:33johnmn3I honestly don't see it.
03:33vegaia better text editor might help ;)
03:33ska2342johnmn3: that's probably from the smilies in your code ;-)
03:33johnmn3gah
03:33ska2342johnmn3: can we look at the code?
03:34johnmn3sure, one sec
03:35lisppaste8johnmn3 pasted "get-expr unmatched paren?" at http://paste.lisp.org/display/92408
03:35johnmn3forgive the ugliness
03:36johnmn3Exception in thread "main" java.lang.Exception: Unmatched delimiter: ) (ed.clj:69)
03:37ska2342johnmn3: I think the line .addKeyListener input is missing it's closing paren
03:38ska2342johnmn3: according to your indentation it should be closed on the line with .requestFocus input ...
03:39johnmn3ska2342: if you hover over the whole form, don't you see the colored parens matched up?
03:40vegaijohnmn3: do you ever close the [*out* starting on l66
03:40johnmn3ah there it is.
03:41johnmn3must have bumped a key or something.. was working fine before
03:41johnmn3the unmatched ")" had me looking for a close parens
03:42johnmn3ok, it compiles now. thanks
03:56edbondhow to get nth element from lazySeq?
04:03somnium,(nth (range 1000) 42)
04:03clojurebot42
05:33fliebelGood 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.
05:33cark,(doc file-seq)
05:33clojurebot"([dir]); A tree seq on java.io.Files"
05:36fliebelwow, thanks :)
05:36cark=)
05:36carkcarefull printing this sequence ... might take a while !
05:36fliebelI understand :)
05:37fliebelhmm, it seems I have to create a java.io.file?
05:37carkthat's easy : (take 10 (file-seq (java.io.File. "c:\\")))
05:39fliebeluser=> (file-seq (java.io.File. "~/downloads/"))
05:39fliebel(#<File ~/downloads>)
05:39carki don't know if ~works in java land
05:40fliebelno, it does not, it seems :D
05:40carkthere are some java properties that do the same i think
05:41cark,(System/getProperty "user.dir")
05:41clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
05:41somnium'(doc file-str)
05:41somnium,(doc file-str)
05:41clojurebot"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."
05:41carkah there you go !
05:42fliebelcool
05:42fliebelI don't need that, but ~ was the most lazy way to get to a dir with very few files.
05:42carkthough on windows it goves me the windows home directory instead of the one i defined using the HOME variable
05:42carkahwell
05:43somniumhmm, it calls System/getProperty
05:44carkwell it's the right thing to do anyways
05:44somniummaybe we can blame it on java :P
05:44carkbooo java !
05:45fliebelWhy is Clojure built on Java? It gives awesome power, but also awesome ugliness…
05:45somniumit will go other places eventually
05:45carki think clojure wants to be practical, and the jvm is very much so
05:45somniumIve been wondering about PLT Scheme lately, it has immutable lists now and compiles to C
05:46carkyep plt scheme is nice
05:46fliebelI think having Clojure compiled to C and running on Parrot would be 2 cool things to do :)
05:46carki'd love to have serialisable continuations in clojure =P
05:46somniumand its GCed, so the path should be shorter than C#/Objective-C
05:46somniumer
05:47somniumC++ I meant
05:47somniuma msg on the mailing list about clojure in C++
05:48somniumfliebel: is parrot finished?
05:48fliebelsomnium: no idea… they are at verion 1.9 I believe.
05:50fliebelBut I'm not sure if it's taken very seriously by developers, there are a lot of hobby project and dead/unfinished languages...
06:38johnmn3if 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
06:38johnmn3for me, chrome is actually running the .java files
06:38johnmn3and they actually work.
06:43somniumjohnmn3: they come up here, nothing in them
06:44somniumjohnmn3: whats the expected behavior?
06:44johnmn3right, if you write into the input stream, it comes out in the output stream.
06:44johnmn3boxes
06:44johnmn3I'm just surprised chrome compiles them and runs them.
06:44johnmn3could be a security issue.
06:45somniumah, its not an applet
06:45somniumthats a definite bug report
06:46johnmn3InputStreamTest extends applet, but nothing says "do you want to run this applet"
06:46johnmn3you running chromium on linux? might me linux specific
06:47johnmn3/s/me/be
06:49LauJensenHas anyone tried working with cookies+contrib/http-agent ?
06:53somniumyeah linux, still beta I guess
06:54somniumthe js console is awesome though
06:57johnmn3that's what I hear.. better than firebug..
06:57somniumjohnmn3: it even has built in autocompletion
06:58johnmn3I like how when searching a page for a term, the right scrolling slide area shows highlights for hits, like a code editor
07:00somniumIm bet they have some amazing tools in-house
07:02johnmn3yea, have you heard about that emacs in firefox thing?
07:02johnmn3ymacs or yemacs or something..
07:03johnmn3clojure on top of JS, using ymacs :)
07:03somniumyes! that is really impressive
07:03johnmn3(would be cool, I mean)
07:03somniumtotally possible
07:04somniumthe hardest part of clojure -> js is mutability
07:05somniumbut no threads, so maybe a js 'dialect' would be more appropriate
07:05somniumthat or hide all data in a closure
07:05LauJensenYou guys haven't seen ClojureScript ?
07:06somniumLauJensen: of course
07:07somniumits almost a translation from clojure to js
07:07somniumdoes it run aganst master?
07:07somniumIve browsed the source quite a bit, but havent actually fired it up
07:09johnmn3never tried it.
07:10LauJensenI think its bit-rotted
07:10LauJensenChris has talked about picking it back up, after clojure-in-clojure is done
07:12somniumIm doing a special-form only compiler, something like a mini-scheme with clojure semantics
07:13somniumimplementing the entire clojure runtime and its data-structures is a task better left to smart people like Chris :)
07:16somnium\me wonders if mini-scheme might be a redundant statement
07:40LauJensensomnium: Whats the purpose ?
07:45somniumLauJensen: of my yet-another-js-generator?
07:45LauJensenmini-scheme
07:46somniumclojure has lots of xml generators, why not multiple js ones?
07:46carkthe task is harder
07:46somniumits for my own use in web app stuff
07:46LauJensenOk, fair enough
07:47somniumvar(kind of), let*, loop*, recur, do, fn*, if
07:47somniumthats my mini scheme in essence, + an approximation of deftype
07:48carkand it compiles to js ?
07:48somniummy main hope is to bring the macro system to bear on ius
07:48somniumyeah, though its hardly been tested
07:49somniumdefype needs some tricks with closures to simulate immutability
07:49cemerickwriting another lisp is a self-justifying exercise :-)
07:49somniumjs is a poor man's scheme anyway :P
07:49carkit's a superset of scheme, give it some credit !
07:49carkon some respect at least
07:50somnium:)
07:50carkthe object system
07:50carkpretty neat
07:50somniumI quite like js actually, but I like clojure more
07:50carkthe syntax is horrible
07:50carkthere is no way to have a sane indentation
07:51LauJensencemerick: 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.
07:51carkLauJensen : what if you want some features you don't have in clojure
07:52carkLauJensen: looking at your blogpost about arc challenge
07:52LauJensenSee ClojureQL for an example
07:52carkyou don't have continuations in clojure, so your solution is very different
07:52LauJensenThats right
07:52carkalso you might want a restricted scripting language for your app
07:53cemerickLauJensen: 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.
07:53carkthere are plenty good reasons to do that kind of stuff
07:53somniumone nice thing about js is you get interface injection for free
07:54somniumand functions carry their source around with them
07:57somniummy motivation is practical though, macros for dojo/mootools, map-reduce fns for couch or mongo, in clojure
07:58carkwell js has good support for literals, in some respect that's quite the same as macros
07:58cemericksomnium: there is a clojure view server for couchdb out there, FYI
07:59cemericksomnium: http://github.com/tashafa/clutch/
08:17somniumcemerick: im not very familiar with couchdb, are views defined in json or javascript? (ie. can you execute arbitrary js in a view?)
08:17cemericksomnium: views are defined by code stored in JSON
08:17cemerickby default, that code is js
08:18cemerickerlang is now supported, though I'm not familiar with the mechanism there
08:18cemerickclojure views are clojure code, stored in json, and executed by a clojure view server running next to couchdb
08:23somniumcemerick: is the range of fns that the clojure view server can store/execute limited at all?
08:23cemericknope
08:23cemerickthe code for any view is just a string, so it's entirely up to the view server to determine the semantics of that
08:24cemerickobviously a concern if you're running an "open" couch, but hardly anyone does
08:28G0SUBI 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.
08:28G0SUBwhat is the way to deal with this?
08:28somniumcemerick: can the view server translate any clojure fn to js I mean?
08:29cemericksomnium: translate a clojure fn to js?
08:29cemerickno, surely no
08:29cemericknot
08:29cemerickwhat would the point of that be?
08:29G0SUBsomnium: 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.
08:30somniumI mostly use mongodb, you can write store js to map-reduce over a collection, aggregate and gen a new one
08:30somniumlike a stored procedure in sql
08:30somniumwriting those in clojure is one of my motivations
08:32somniumG0SUB: #^DBCollection still gens a warning?
08:32G0SUBsomnium: no, but then, the function returns nil.
08:32G0SUBsomnium: I remove the type hint, and it works.
08:36chouserthat's pretty odd.
08:36somniumG0SUB: in congo it appears #^DBCollection is working
08:36G0SUBsomnium: line number? I will check.
08:37somnium71
08:37somniumer
08:37somniumwait thats in new branch
08:38G0SUBsomnium: I see that. what about findOne ?
08:38somniumG0SUB: in the java driver find-one calls find and returns the first item
08:39somniumso its the same method essentially
08:40G0SUBsomnium: in my case, find works well with the type hint. only find-one is failing.
08:42somniumG0SUB: can you paste the code? the javadocs would seem to indicate #^DBCollection is the right type
08:43G0SUBsomnium: just a sec.
08:56lisppaste8G0SUB pasted "Type hint issue" at http://paste.lisp.org/display/92419
08:56G0SUBsomnium: ^^^
08:57ksmHow 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))
08:57ksmIn python I would do *parameters
08:57chouserksm: apply
08:57ksmthanks
08:58chouser(apply function parameters)
08:58ksmNeat, thanks
08:58chouserG0SUB: are there javadocs for that DBCollection class online?
08:58somniumG0SUB: what do you get if you print the type of the collection in both? #<MyCollection> ?
08:59G0SUBchouser: http://api.mongodb.org/java/1.1/com/mongodb/DBCollection.html
08:59G0SUBsomnium: yeah, DBAPILayer$MyCollection
09:00G0SUBhmm, odd. it's working now.
09:00somniumdoes #^DBAPILayer$MyCollection work on *find-one?
09:00G0SUBdon't know what's wrong
09:00G0SUBsomnium: will check.
09:00chouserthere are two .findOne methods that take a single arg
09:01G0SUBchouser: how do I give it a proper type hint?
09:01chouserWhat happens if you hint the arg as well?
09:02somniumyou can put #^DBObject on query
09:02chouser#^DBObject (ClojureDBObject. query)
09:02chouserDoesn't seem like it should be necessary, but might be interesting to try.
09:02G0SUBhmm
09:04G0SUBchouser, somnium: working now.
09:05chouserhuh.
09:06chouserThe compiler ought to be able to see that (ClojureDBObject. foo) returns a DBObject. I wonder why the hint is necessary.
09:07chouserG0SUB: What version of Clojure?
09:07G0SUB"1.1.0-alpha-SNAPSHOT"
09:08somniumI wonder if it sends as Object rather than interface
09:08somniumthough, that should throw an exception somewhere
09:09G0SUBsomnium: 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?
09:09chouserI think it's calling the other .findOne method.
09:09somniumG0SUB: Im clueless, but might be worth running some unit tests with different hints to see if its repeatable
09:10chouserG0SUB: those reflection warnings aren't dangerous
09:10G0SUBsomnium: OK.
09:10somniumfor .toClojure hint as #^ClojureDBObject
09:11chouserG0SUB: I wouldn't bother adding type hints unless you need them for some specific reason.
09:11G0SUBsomnium: well, I tried that hint, didn't work.
09:11G0SUBchouser: mainly for perf.
09:12G0SUBchouser: that code is very heavily used...
09:12chouserok
09:13rhickeywhere is ClojureDBObject defined?
09:14chouserhttp://tinyurl.com/yd978tf/src/main/java/somnium/congomongo/ClojureDBObject.java
09:14somniumG0SUB: the new branch uses protocols, it should be faster if youre doing a lot of fetch-ones
09:15G0SUBsomnium: cool. I anyway don't use congomongo. I just took the ClojureDBObject idea from it. everything else is custom :)
09:15chouserrhickey: BasicDBObject: http://api.mongodb.org/java/1.1/com/mongodb/BasicDBObject.html
09:15somniumah, no worries then :)
09:16chouserG0SUB: oh! your ClojureDBObject is not the one I just linked to?
09:16somniumhuh, they changed it to a linked hash-map
09:16G0SUBchouser: it is. I just use that file.
09:17G0SUBsomnium: changed what?
09:19somniumG0SUB: BasicDBObject used to subclass HashMap
09:19somniumbit-rot sets in fast
09:20G0SUBsomnium: hmm, so is that a breaking change?
09:20chouserthis is actually the one part of cinc that worries me a little -- getting the (newly modular) host method resolution at compile and runtime right.
09:21somniumG0SUB: it shouldnt break anything, DBObject is the key interface
09:21G0SUBsomnium: do we need to modify ClojureDBObject in any way?
09:23somniumG0SUB: no I guess not, just need to recompile it
09:23G0SUBsomnium: OK
09:23somniumcan drop two deprecated methods too
09:30G0SUBsomnium: which ones?
09:32somniumG0SUB: scratch that, I was thinking of a clojure implementation, the java class doesnt have to do anything
09:32G0SUBsomnium: hmm, a Clojure implementation should be cool.
09:33G0SUBinteresting clojure project -> http://code.google.com/p/clojure-textflow/source/browse/src/textflow.clj
09:56maaclAnyone?
09:57somniummaacl: does elpa indicate slime is installed?
09:57maaclyes
10:00maaclsomnium: yes
10:00callenhow much pain am I in for if I come from lisp but not java to clojure?
10:00somniumI think there was an issue with the download failing and not getting cleaned up
10:00Chousukecallen: well, you'll need to learn how to read the java docs at least.
10:01callenChousuke: reading documentation is fine, I know I'd have to leverage existing java functions.
10:01chousercallen: classpath is likely to generate some angst
10:01rhickeychouser: what did you mean by " getting the (newly modular) host method resolution at compile and runtime right" ?
10:02callenchouser: how so?
10:02chousercallen: but you'll get over both of those, and then you'll be golden.
10:02maaclsomnium: ok, any way I can do it manually?
10:02Chousukecallen: the classpath causes headaches for everyone. :)
10:02somniummaacl: technomancy is the one to ask :)
10:03callenChousuke: could you explain what it is exactly that you're talking aboot though?
10:03maaclsomnium: yeah, he doesn't seem to be around :-)
10:03callenChousuke: the path to the libs?
10:04somniummaacl: 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:04liebkemaacl: can blow away your ~/.emacs.d/elpa/ directory, and start over?
10:04maaclliebke: yeah, about to try that
10:05chouserrhickey: 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:05Chousukecallen: paths, but yeah.
10:05chouserrhickey: amounting to regressions in currently working code.
10:05rhickeychouser: hopefully there will be a cross-language thingy for this coming from the JVM language community
10:05Chousukecallen: the classpath tells the JVM where to find classes
10:05callenChousuke: interesting. also I feel like I've seen you around elsewhere before. Where else on fnode do you chill?
10:06chouserrhickey: hm, that's interesting. I think I read a thread you and headius were talking about related to that.
10:06Chousukecallen: ubuntu channels mostly
10:06rhickeyI don't understand the DBObject problem from before, what do I need to reproduce?
10:07callenChousuke: that'd be it then.
10:07devlinsfrhickey: 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:08callenreally comforting to see the creator in the IRC channel, yeesh.
10:08callencan't count beyond one hand how often I see that.
10:08devlinsfrhickey: doesn't have to be now, but before 1.1
10:08Raynescallen: That shocked me as well the first time I came here.
10:09chousersomnium: did you try to reproduce the DBObject problem?
10:10rhickeydevlinsf: functional patches added now won't have seen any usage prior to release - that's not good
10:10callenRaynes: It resembles how the mumble team works, and is thusly very encouraging for me.
10:10devlinsfrhickey: It's a bug fix
10:10somniumchouser: no, my repl is tied up
10:10somniumG0SUB: ping
10:10rhickeydevlinsf: doesn't matter, it's function, not docs etc
10:12devlinsfrhickey: Hmmm... I'm gonna make one last appeal. Isn't one of the major points of an RC to find& fix bugs?
10:12rhickeypeople 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:12devlinsfrhickey: Okay, so it'll have to wait for 1.2?
10:13rhickeyor 1.1.x patches
10:13devlinsfAlright
10:14devlinsfrhickey: I'll bring this up again after the release. Got to go now
10:14rhickeyWe haven't gotten much feedback on RC1 - I presume that's good ?
10:15devlinsfTransients & Sorted Collections
10:15devlinsfThe don't work
10:15pjb3Anyone doing web dev with clojure? What are you using for HTML templating?
10:15devlinsfThe concensus seems to be wait until 1.2
10:16devlinsfhttp://groups.google.com/group/clojure/browse_thread/thread/1281d1f7bfc6c5fa#
10:16rhickeydevlinsf: 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:17chouserthat sounds remarkably like what the transients doc page says. :-)
10:17chouseroh, but I should add hash-set there.
10:17devlinsfRight
10:17devlinsfCan we add a line explictly stating sorted don't work
10:18devlinsfgtg, really
10:24maacl pjb3 enlive
10:24pjb3maacl: yeah, I was just reading about that
10:24karmazillamaybe 'transient (and 'persistent!) could just return its input collection if it is not IEditableCollection?
10:25chouserkarmazilla: no, their largely incompatible objects.
10:26chouseryou ought to be able to assume you can conj! on whatever transient returns
10:26pjb3maacl: the readme is a little dense, do you know of any simple examples?
10:27somniumpjb3: have you tried clout? (formerly known as compojure.html)
10:28karmazillachouser: ok, maybe I'm not updated. Had just understood that the interface was suppose to be the same.
10:28maaclpjb3: http://wiki.github.com/cgrand/enlive/getting-started
10:28maaclpjb3: Or was that what you were reading?
10:28pjb3maacl: thanks
10:29pjb3somnium: you mean hiccup?
10:29somniumthats it
10:29pjb3I'm not a fan of s-exps for html
10:29pjb3I like the idea of enlive much better
10:29chouserkarmazilla: the interface is meant to allow similarly-structured code, but the actual fns supported are mostly different
10:29karmazillachouser: is there a predicate to check for IEditableCollection?
10:29pjb3I'd rather write the html in html and have some method to transform the dynamic parts of it
10:30somniumpjb3: enlive is a good bet then
10:30pjb3somnium: yeah, I'm gonna read the docs on enlive
10:31chouserkarmazilla: just (instance? IEditableCollection x) I think.
10:31the-kennyIs there something like gwt for clojure? (I know compojure, but I'm tired of writing html and css...)
10:32the-kennyor... something like a wrapper for gwt
10:33chouserthe-kenny: there is a thing that's a bit gwt-like, but it has a somewhat generic name that I can never remember...
10:34the-kennychouser: Yes.. I remember I've seen something which sounded like how I want it on github.. but I can't find it anymore
10:34chouserah, there it is. http://www.webtoolkit.eu/jwt
10:35chouserthe-kenny: http://www.nsa.be/index.php/eng/Blog/From-OO-to-Lisp-style-structuring-my-Clojure-Jwt-app
10:36the-kennychouser: ah, thank you :) I'll have a look at it
10:36karmazillachouser: editable? (or something) might be a nice addition to the set of predicates, looking at what is already there
10:49fliebelwhat is the difference between send and send-off? The documentation says they both return immediately, but one should be used for blocking actions.
10:50danm_send-off sends to a thread pool which can grow I believe
10:51chousersend is only for actions that are CPU-bound, not blocking on disk or network
10:52fliebelhmmm, okay...
10:53danm_if you send a bunch of blocking actions, you can end up needlessly blocking other agents
10:53danm_so you use send-off for those
10:54bOR_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:54chouserbOR_: no, actions always happen in the order they were sent, regardless of send vs. send-off
10:55johnmn3So 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:56the-kennybOR_: send-off uses a different thread-pool in the background.
10:56bOR_ah, getting it.
10:56the-kennysend-off is for functions with io-blocking, send for "normal" functions.
10:56johnmn3I 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:57johnmn3how might one set that up?
10:59johnmn3I'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:00fliebelWhy would you ever use 'do'?
11:00johnmn3fliebel: to do two things where only one thing is expected
11:00fliebelhmmm...
11:00chouserfliebel: for side effects
11:01johnmn3,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated))
11:01clojurebotEOF while reading string
11:01johnmn3er
11:01johnmn3,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated)))
11:01clojurebotEOF while reading string
11:01johnmn3err
11:02johnmn3ah
11:02fliebel,(if true (do (pr "hi") (pr "still here") (pr "not evaluated))
11:02clojurebotEOF while reading string
11:02johnmn3,(if true (do (pr "hi") (pr "still here")) (pr "not evaluated"))
11:02clojurebot"hi""still here"
11:02fliebelfinally :P
11:02johnmn3missing that last quote
11:02fliebelI see
11:02johnmn3where if was expecting one thing to happen
11:03johnmn3but like chouser said, people should mostly use it when they're are intentionally trying to induce side effects.
11:04johnmn3(if true (do (functional thing) (pr "this string is a side effect (for logging perhaps)")) (not evaled))
11:04fliebelso more like… (if (do (prn "hallo") true) (prn "world") (prn "not evaluated"))
11:05ksm,(do true false)
11:05clojurebotfalse
11:05johnmn3right
11:23fliebelIs there a less resource intensive way then a regex to determine if a string contains, starts with or ends with a certain string?
11:23stuartsierra,(.contains "foobar" "ooba")
11:23clojurebottrue
11:23chouser,(.startsWith "foobar" "foo")
11:23clojurebottrue
11:24fliebelah, java things....
11:24chouserembrace java. :-)
11:24fliebelthanks… I was diging in the Clojure api
11:24chouseryou're already suffering under any pain that Java is bringing. Might as well enjoy the benefits as well.
11:24fliebel:)
11:30maaclwhy would i get clojure-slime-config: Required feature `slime-autoloads' was not provided when trying to load swank-clojure?
11:30fliebelBenefit 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:44chouserfliebel: right. most languages reimplement strings from scratch. Clojure hasn't bothered.
11:47johnmn3I forgot. How do you do a counter with a closure?
11:48chouser,(-> 2 inc inc inc)
11:48clojurebot5
11:48johnmn3this doesn't work: (defn ab [] (fn [x] (let [a (atom 0)] (if (= x :inc) (swap! a inc) (swap! a dec)) @a)))
11:48johnmn3I mean where the function holds state for you.
11:49chouser:-(
11:49chouserwhy would you want that?
11:50johnmn3I'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:50lpetitand ?
11:50johnmn3so I have to count parens up and down
11:50lpetitso count them, and pass the value in your loop
11:51reifyjohnmn3: 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:51chouserjohnmn3: I'd recommend building a seq of strings, then passing to (apply str ...) to build your final string.
11:52johnmn3that'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:52johnmn3reify: ah
11:53johnmn3So, should I make a function that takes one char at a time?
11:54lpetitjohnmn3: 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:54johnmn3and feed each string into it with a (doseq [a argstring] (myfn a)) ?
11:55lpetitwhat does it mean to "Mark" a portion of text in emacs ?
11:55lpetitand how to do this ?
11:56fliebelOk, 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:56johnmn3then keep conjing the chars to a new string and, when a closing paren matches the opening one, flush and keep going
11:56KirinDavelpetit: You might wanna read the emacs programmer's guide.
11:56KirinDavelpetit: It's in every copy of emacs.
11:56stuartsierralpetit: "mark" is emacs's version of select-copy-and-paste
11:57lpetitKirinDave: just trying to (very) quickly follow Phil's paredit-outline tutorial without having to dig into the rather comprehensive and *big* emacs doc
11:57lpetithttp://p.hagelb.org/paredit-outline
11:57chouser,(let [a (agent [:foo])] (send a conj :bar) (await a) @a)
11:57clojurebot[:foo :bar]
11:58chouserjohnmn3: like that?
11:58KirinDavelpetit: So, the thing is that emacs has a VERY different way of handling text. You literally keep using editing commands.
11:58lpetitstuartsierra: ok, would you mind give me the magical command combination ? :-)
11:58fliebelchouser: thanks… I was close, but not close enough, I was making conj an anonymous function.
11:59lpetitstuartsierra: and I promise not to RTFM you if you ever have a question on Eclipse :-)
11:59fanaticolpetit: ctrl-space
11:59lpetitfanatico: thx
11:59stuartsierralpetit: Ctrl+Space sets the mark. Ctrl+w cuts between "point" (the cursor) and the mark. Alt+w copies between point and mark.
12:00fanaticoand all region-specific commands work on the mark.
12:00johnmn3chouser: let me take that and explore it for a minute
12:00lpetitstuartsierra: 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:01fanaticobut 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:01stuartsierralpetit: The mark is ONE position, not a selection. The area between the mark and the point defines the selection.
12:01chouserjohnmn3: oh, sorry, I meant to address that to fliebel
12:01johnmn3oh
12:01lpetitstuartsierra: ok, so that's weird:
12:01technomancy"mark" as a verb means "make the region contain"
12:02johnmn3well, it applies anyway ;)
12:02lpetit open rooms.clj
12:02lpetit point at right before mire.rooms
12:02lpetit M-(
12:02lpetit Mark "declare rooms"
12:02lpetit Press (
12:02stuartsierraI dunno what that's about.
12:02lpetitI suppose Mark "declare rooms" means mark "d", go to after s, and then press (
12:02lpetitit's a tutorial showing the benefits of paredit
12:03lpetithttp://p.hagelb.org/paredit-outline , line starting with ## 4. Wrangling (depth-changing)
12:03fanaticothe point over the cursor isn't included.
12:06fanaticounless the mark is to the right of the cursor.
12:08maacltechnomancy: think you could help me with a swank-clojure issue?
12:12leafwclojure new branch fails to compile, but ant repots "build successful". IS this normal? The exception claims that clojure.lang.RestFn is not found
12:12leafwCaused by: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V
12:12probablyCoreyWould a clojure shell, like bash or zsh be a horrible idea?
12:12leafwactually, that is clojure.contrib ... oops, sorry
12:13the-kennyleafw: Do you mean clojure or clojure.contrib?
12:13somnium~RestFn
12:13clojurebotexcusez-moi
12:13chouserleafw: do "ant clean" in contrib before building
12:13KirinDaveWell, besides the inability to change cwd, there is nothing wrong with it, probablyCorey.
12:13the-kenny~clojure.lang.RestFn
12:13clojurebotant clean and rebuild contrib
12:13KirinDavescsh is pretty popular.
12:13leafwI was mixing clj new branch with clj contrib master branch.
12:13chouserleafw: that's ok
12:13probablyCoreyKirinDave: Cool, I'll take a look at scsh
12:18leafwclojure-contrib.jar fails to build ... with new branch on both repos
12:18leafwjava.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.Symbol (jmx.clj:89)
12:19leafwalso 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:24chouserleafw: use master branch of contrib
12:25leafwchouser: new branch of clj and master of contrib
12:25leafwok
12:25chouseryeah. :-/
12:25leafwmakes total sense xD
12:25leafw(i.e. it doesn't)
12:26chouserwell, clojure 'new' is almost entirely backward compatible with clojure 'master', so contrib 'master' works fine with it.
12:26chousercontrib 'new' is where some people have started playing with clojure 'new's new features, but obviously they're not keeping up with it.
12:27chouserhm, I wonder if a merge from contrib 'new' would fix it.
12:27leafwit did build, clj new and contrib master. Thanks.
12:27technomancyprobablyCorey: IMHO eshell is another excellent shell written in lisp; I use it nearly exclusively
12:27leafwby the way what is the timeline for clj new to become master? 1 month? 6 ? a year?
12:29chouserleafw: 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:29chousernot sure how fast rhickey will pull the trigger on that, but my guess would be a few weeks at most.
12:30leafwcool
12:30leafwthat's good news. Thanks.
12:31chouserit's not so much news as a guess, so I hope I'm not off by too much. :-/
12:32leafwwell: you just brougth it to the low end of the spectrum I threw (1 motnh to a year)
12:32lpetitstuartsierra: ok, certainly the text should have read : "select" instead of mark
12:33technomancylpetit: they are synonyms
12:33lpetittechnomancy: gaining knowledge of paredit by reading through your excellent paredit-outline intro text
12:33lpetittechnomancy: well, that's not what I was told by Stu
12:34lpetitMust leave, there's a "toast" here at work :)
12:34technomancylpetit: 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:34lpetittechnomancy: ok, good to know that :)
12:35lpetittechnomancy: how complete on the subject of paredit do you think the tuto is ?
12:35technomancylpetit: it's everything I use, but there's still maybe 15% of paredit that it doesn't cover
12:35lpetittechnomancy: and what would you suggest me as a tutorial for gaining even more knowledge ?
12:36technomancythe obscure bits that I haven't internalized myself
12:36technomancylpetit: unfortunately there's not much apart from reading the source. that's why I started the project.
12:36technomancy(the project to create a screencast on it)
12:36lpetittechnomancy: if there's just ~ 15% left, seems ok to me to hope have this rather sooner than later in ccw, then
12:55jneirahi people
13:09technomancydid a de-chunking mechanism ever get checked in?
13:09technomancyISTR mentions of an experimental way go back to 1-at-a-time seqs
13:16Chousuketechnomancy: not as far as I know :/
13:16technomancyyeah, looking back at it there are only mentions that such a mechanism is being discussed
13:17ChousukeI suppose a simple lazy-seq doing rests on the chunked seq is not enough? :/
13:18technomancyChousuke: nope: (def x (seq (rest println (range 39))))
13:18technomancythat prints 0 - 31
13:18technomancyoops
13:18technomancyI meant (def x (rest (map println (range 39))))
13:22lpetit,(def x (rest (map println (range 39))))
13:22clojurebotDENIED
13:23technomancythe def is just to prevent the repl from printing it; you could wrap it in a do or some such
13:25lpetitmy bad
13:25lpetit,(do x (rest (map println (range 39))))
13:25clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
13:25lpetitI'm really a stupid guy sometimes
13:26lpetit,(do (rest (map println (range 39))) nil)
13:26clojurebot0 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:27fliebelI 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:38pdkwhat would be the equivalent of doto for a class instead of an instance so you could call static methods in the doto block
13:45stuartsierra,(.parseInt Integer "123")
13:45clojurebotjava.lang.IllegalArgumentException: No matching method found: parseInt for class java.lang.Class
13:46Chousukehm
13:46Chousukecan't you do (doto someobj Integer/parseInt)?
13:51hiredman_Chousuke: that would return someobj and be rather pointless
13:51hiredman_~macros
13:51clojurebotBarking spiders!
13:53chouserpdk: I think you'd have to write your own macro
13:53pdkhm
13:55chouser(defmacro dostatic [cls & ms] (cons `do (map #(list* `. cls %) ms)))
13:56fliebelHow can I get a regex to just evalulate to true or false? All of them seem to return lists and java stuff...
13:57chouserfliebel: re-find will return nil when it can't find a match
13:57chouserre-matches too, actually
13:57fliebelchouser: thanks, but that is nox exactly clear form the docs
13:57chouserand also re-seq, apparently. So take your pick! :-)
13:59polypusanybody know if google web toolkit is useable from clojure? i'm not really sure how GWT works internally
13:59fliebelchouser: which is the most efficient?
14:00chouserpolypus: I've not heard of anyone using it successfully.
14:00chouserpolypus: I believe the to-js compiler in GWT reads Java sources
14:01carkhum, wasnt it byte code
14:01cark?
14:01polypushuh, so direct java -> js. too bad it's not bytecode. even better would have been to just have the java generate js
14:01chouserfliebel: probably re-matches, though it requires the regex match at the start of the string.
14:01carkchouser : ah looks like you're right =(
14:01chousercark: you may be thinking of android
14:02fliebelthanks
14:02polypuschouser: anyways, thx
14:02carkchouser : right
14:02chouserfliebel: 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:03fliebelchouser: I'm going to stick with re-find, since I reorganized my code to evaluate it only once.
14:04chouserok
14:06polypusmaybe 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:07stuartsierrait still uses Java source I think
14:08chouserpolypus: I've wondered the same, though I didn't persue it.
14:08polypusstuartsierra: what, performs some extra analysis ontop of the bytecode compile?
14:08chouserpolypus: Also wondered about a clojure-to-java-source compiler.
14:09stuartsierrapolypus: No, I think GWT has its own compiler that reads Java sources.
14:09polypuschouser: yeah the latter crossed my mind too
14:09chouserbut actually, when I played with it, the problem was Clojure's collection types use all kinds of unsupported (by gwt) classes.
14:09chousergwt won't produce js for Clojure's own .java code without quite a bit of hacking at it.
14:11chouserstuartsierra: I learned JavaScript already, I just want macros.
14:11hiredmanpeople want to leverage existing tools
14:11chouserand immutables locals and persistent collections.
14:11hiredmanchouser: really? I just want parens
14:11chouserand the seq abstractions
14:11polypusstuartsierra: i actually don't mind javascript. but just trying to pick a toolkit and gwt has a nice crossbrowser canvas implementation
14:11cemerickI thoroughly dislike the entire web development experience, and js + browser dom is a big part of that distaste
14:11polypuswhich i need
14:12chouserjs rivals ruby for my second-favorite language.
14:12chouserI wonder how hard it would be to compile js-like syntax into clojure.
14:12polypuschouser: ditto
14:13hiredmanchouser: :(
14:13chouserhiredman: teehee!
14:14cemericksyntax is *not* the problem, browser quirks are IMO
14:14chouserbrowser quirks are an issue, though js itself has surprisingly few. The DOM makes up for it.
14:14hiredmanI'm waiting for browsers to be rewritten in js
14:14cemerickright, the dom side of things is what I was referring to
14:15chouserindeed. And I tried js without the DOM once (thanks, Yegge). Turns out that's worse.
14:15hiredmanreally a browser could just be something like a smalltalk image
14:15polypusi'm waiting for browsers to standardize ontop of some VM so we can use whatever language we want.
14:15stuartsierrapolypus: dream on
14:15chouserpolypus: I think that's what hiredman just said.
14:15hiredmanpolypus: they did, it's called js
14:15polypusi expect to be dead before that happens though :)
14:16hiredmanjs is the browser bytecode
14:16hiredmanwhich is why you have things like gwt
14:17polypusanybody ever write a VM in javascript?
14:18hiredmanhttp://ejohn.org/blog/ruby-vm-in-javascript/
14:18hiredmanetc, etc, etc
14:20chouserNintendo emulator in pure javascript: http://benfirshman.com/projects/jsnes/
14:23hiredmanhttp://mxr.mozilla.org/mozilla/source/js/narcissus/
14:23hiredman:D
14:24jneirauser experience emulator in bastard javascript: http://www.microsoft.com/windows/ie/ie6/default.mspx
14:25polypusnarcissus must be a speed demon :)
14:26hiredman:P
14:26hiredmanmodern js engines are fast
14:26chousercompared to? non-modern js engines?
14:26hiredmanyes
14:27hiredmanlike last years :P
14:27chouser:-)
14:28hiredmanso you just need a compiler to lower js to native code, and a nice ffi
14:29fliebellol, jsnes is cool :P
14:30alexykanybody here used clojure-twitter?
14:31hiredmanhuh, apparently yeggie's js in elisp is based in part on narcissus
14:32fliebelalexyk: tell me about it, I love writing little twitter apps :)
14:33alexykfliebel: I'm just looking for tips on making it work
14:34fliebelalexyk: looks quite straightforward, what's wrong?
14:35alexykfliebel: getting oauth going -- but I think I found that I should register a separate "client" for it
14:36fliebelalexyk: yea, you need to register your client at twitter before you can do oauth, they'll give you a token to work with.
14:36alexykfliebel: it has "use Twitter for login," do I need that?
14:37fliebelwait a moment
14:37fliebelhttp://twitter.com/oauth_clients/new
14:38fliebelyes, you want to use twitter for login
14:38fliebeloh, wait
14:38alexykfliebel: right, it has a checkbox saying "use Twtter for login," I wonder what that means
14:39fliebelno, i don;t think so...
14:39alexykif oauth's idea is to be able to login without twitter user/password
14:39fliebelalexyk; do you know disqus?
14:39alexykfliebel: yep
14:39fliebelalexyk: they let you login using twitter, if you are going to do that, check that box, else don't
14:41fliebelalexyk: after you registered you can go to http://twitter.com/oauth_clients/ and click your application to see the secret and key
14:42alexykyeah, 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:42fliebelalexyk; that is the whole point of oauth
14:43alexykok, lemme see
14:43fliebelalexyk: 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:44fliebelalexyk: 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:45alexykfliebel: yeah, well clojure-twitter apparently has only oauth
14:45alexykand twitter threatens to stop basic auth
14:48fliebelalexyk: Got to run, success!
14:48alexykthx!
14:55lisppaste8johnmn3 pasted "poor man's s-expr parser" at http://paste.lisp.org/display/92435
14:55johnmn3behold, it's hunchback glory
14:56johnmn3it needs some ironing, but it's coming along.
14:58PrinceOfAis there a clojure wrapper for com.sun.net.httpserver?
15:00johnmn3not sure.. know there is for jetty
15:00johnmn3I should probably add an :else (stop ignoring) to that cond
15:01hiredmanhttp://github.com/hiredman/clojurebot/blob/master/hiredman/http_server.clj <-- not a wrapper around httpserver
15:05quizmehow do i get clj to run like this: /opt/clojure-contrib/launchers/bash
15:05quizmeoopens
15:05quizmeoops
15:05quizmei mean
15:06quizmejava -cp jline-0.9_0_5.jar:clojure.jar jline.ConsoleRunner clojure.lang.Repl
15:07hiredmandepending on your version of clojure clojure.lang.Repl might still be around, but it has been deprecated for many months (feels like forever)
15:07hiredmanuse clojure.main
15:08hiredmanclojurebot: clojure.lang.Repl is <reply> you mean clojure.main
15:08clojurebotYou don't have to tell me twice.
15:08hiredmanclojurebot: clojure.lang.Script is <reply> you mean clojure.main
15:08clojurebotYou don't have to tell me twice.
15:08johnmn3also, your my jline version is 0.9.94
15:08hiredman"your my"
15:08johnmn3erm
15:09johnmn3/s/your/""
15:10johnmn3hmm. didn't know clojure.main replaced script too.
15:11quizmei guess i can just set up an alias clj='java -cp jline-0_9_5.jar:clojure.jar jline.ConsoleRunner clojure.main'
15:11johnmn3hiredman: so I've been tweaking your editor. Made it into a repl. just trying to fasten on that parser now.
15:11hiredmansure, but what about when you want to add something to your classpath?
15:12quizmei dunno ^^;
15:12quizmei'm new to this whole java thing
15:13hiredmanquizme: what java version do you have?
15:13hiredmanjava -version
15:13quizme1.6.0_15
15:14quizme64 bit
15:14hiredmanok, make a directory called .jars in your $HOME
15:14quizmek
15:15hiredmanput something like CLASSPATH="$HOME/.jars/*" in what ever bash uses (.profile? ,bashrc?)
15:15quizme.bashrc
15:15hiredmaneither copy any jars you plan to use to ~/.jars/ or make a syslink
15:16hiredmanstart clojure: java jline.ConsoleRunner clojure.main
15:17quizmexception in thread "main" java.lang.NoClassDefFoundError: jline/ConsoleRunner
15:17hiredmanquizme: you are missing the jline jar
15:17quizmeit's in ~/.clojure
15:18hiredmanso?
15:18quizmeoh
15:18quizmek lemme try
15:19johnmn3definitely doesn't work yet.
15:20hiredmanjohnmn3: what doesn't?
15:20johnmn3converted your code editor to a repl. now trying to bolt on multi-line support.. still banging on it.
15:21hiredmanmultiline support? it works for the select case
15:22johnmn3naw, 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:22hiredmanthat is going to be painful
15:22johnmn3yea, it is. once I have basic repl support, I'll try adding features on from there.
15:23chouserjohnmn3: you didn't happen to look at texture, did you?
15:23chouserjohnmn3: so far just a swing-based repl. I think the handles multiline input.
15:23johnmn3parens highlighting maybe.. after this though, I'm going to implement line history
15:23chousers/the/it/
15:24quizmehiredman: thanks it works
15:24stuartsierraIs there a good Swing tutorial for use *without* an IDE?
15:25johnmn3chouser: 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:25johnmn3I should look at textjure though, and see how it implements multi-line support.
15:26chouserjohnmn3: yeah, that's my poor, sad, abandoned project. :-P
15:26johnmn3I've played with it.. I thought it was pretty cool.
15:27johnmn3I might pick it back up once I wrap my head further around these "bindings" and plumbing.
15:42hiredmanclojurebot: simple setup is http://www.thelastcitadel.com/dirt-simple-clojure
15:42clojurebotYou don't have to tell me twice.
16:00drewrwhat should the behavior of a failed :pre or :post be if *assert* is false?
16:01drewrboth throw a plain j.l.Exception
16:04stuartsierradrewr: if *assert* is false the pre/postconditions are never evaluated
16:05drewris binding sufficient for turning it off?
16:05drewr(binding [*assert* false] (constrained-sqr -1)) => Exception
16:05drewr(constrained-sqr from the doc example)
16:06stuartsierraI guess not.
16:06stuartsierraBut it can be set!
16:07Chousukedrewr: it's a compile-time decision I think
16:08Chousukesince the value of *assert* is checked by the assert macro
16:09chouserChousuke: that looks right.
16:10chouserI guess it makes sense, if the point of *assert* false is to avoid runtime checks.
16:10drewrdo you supply is as a jvm param?
16:10drewrs/is/it/
16:10Chousukedrewr: no, but it's false by default :/ except in the repl.
16:11drewrinteresting
16:16lisppaste8johnmn3 pasted "simple gui repl" at http://paste.lisp.org/display/92442
16:16johnmn3it works!
16:17johnmn3it 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:19johnmn3ah, already found one bug... but it'll have to wait till tomorrow.
16:22liebkejohnmn3: 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:23chouserI'd love to have a simple multi-platform gui repl + clojure source editor to include with clojure
16:25liebkebetter yet
16:26hiredmanhttp://i.imgur.com/7bAxb.png <-- this is pretty cool
16:26hiredman(for a repl)
16:26johnmn3ditto. 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:27lpetitI'm also interested in adding paredit support, maybe written in clojure
16:27lpetitto ccw.
16:27johnmn3hiredman: yea, that's the good thing about a gui repl... drScheme can do pictures too
16:28hiredmanthat would be really sweat for incanter
16:28lpetitCurrently 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:28johnmn3lpetit: I've been thinking about what rules would be though.. have to look into how paredit works and decides on things.
16:29hiredmanI dislike guis, so having a repl that can do gui stuff is nice
16:29liebkehiredman: yeah, it's a feature of R (at least on Mac and Windows) that I would really like to have
16:31lpetitsomebody 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:32lpetitjohnmn3: paredit command list http://mumble.net/~campbell/emacs/paredit.html
16:32johnmn3that's an interesting problem.
16:32lpetitclojurebot: paredit commands is http://mumble.net/~campbell/emacs/paredit.html
16:32clojurebotOk.
16:33lpetitclojurebot: paredit source is http://mumble.net/~campbell/emacs/paredit.el
16:33clojurebotIk begrijp
16:33hiredmanhttp://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj
16:35lpetithiredman: 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:35hiredmanlpetit: it is port of LispReader
16:36johnmn3from LispReader.java ?
16:36hiredmanyes
16:37stuartsierraparedit was written for Common Lisp / Scheme
16:37lpetithiredman: 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:37hiredmanlpetit: there is no reason it could not
16:37hiredmanand it is written in clojure
16:38hiredmanso you don't need to know java to add those features
16:38lpetithiredman: indeed, you're thinking about a special mode that could preserve this information
16:38lpetit ?
16:38johnmn3hmm. so something a little more sophisticated than my expression bagger function.
16:38hiredmanlpetit: I am not thinking about paredit at all
16:39lpetithiredman: maybe we're not talking about the same thing. What do you have in mind ?
16:39hiredmanI'm just saying, if you are going to write a full reader for clojure, there you go
16:39hiredmanparedit is must be much simpler
16:39hiredmanI have't looked at the code, or really even used it that much
16:40lpetithiredman: 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:40hiredmanbut you just match the types of brackets, and keep brackets balanced for a certain set of operations
16:40hiredmanparedit doesn't even need to know about trees
16:41johnmn3if 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:41lpetithiredman: yes, just a stack of types of brackets + offset
16:41hiredmanjohnmn3: the main thing is balencing
16:41hiredmanthe other stuff is icing
16:41lpetitjohnmn3: better separate core paredit functionality from the keys used to invoke the commands, no ?
16:42johnmn3lpetit: true
16:42johnmn3just saying, I tried paredit once and I had a hard time navigating the source
16:43johnmn3I think it would make a good learning tool
16:43lpetitjohnmn3 : look at this http://p.hagelb.org/paredit-outline
16:43lpetitclojurebot: paredit tutorial is http://p.hagelb.org/paredit-outline
16:43clojurebotc'est bon!
16:43lpetit~paredit
16:43clojurebotPardon?
16:43lpetit~paredit.*
16:43clojurebotGabh mo leithscéal?
16:44hiredmanI wonder if I broke something in clojurebot recently
16:44hiredmanclojurebot: paredit?
16:44clojurebotHuh?
16:44hiredmanclojurebot: paredit foo
16:44clojurebotFoo is not Baz.
16:44hiredmanclojurebot: foo paredit
16:44clojurebotfoo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/
16:44johnmn3aye, this will be good material
16:44lpetithiredman: was just guessing. Would a regexp be accepted by clojurebot (if not broken ?)
16:45lpetitjohnmn3: this tuto is made from note made by technomancy for his own use.
16:45hiredmanlpetit: nope
16:47hiredmanoh
16:47lpetithiredman: did you compare the performance of your reader with the current java one, just for fun ?
16:47hiredmanclojurebot: paredit tutorial
16:47clojurebotparedit tutorial is http://p.hagelb.org/paredit-outline
16:47hiredmanlpetit: I did not
16:47lpetithiredman: not tempted ? :-)
16:47hiredmanI did not do any kind of type hinting or what have you
16:48hiredmanlpetit: nope
16:48hiredmanI wrote it, someone else can measure it
16:49lpetitplease, 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:54johnmn3that technomancy doc was a good read.
16:55johnmn3will keep it bookmarked
16:55lpetitI've also put it in clojure bot:
16:55lpetit~paredit tuto
16:55clojurebotexcusez-moi
16:55lpetit~paredit tutorial
16:55clojurebotparedit tutorial is http://p.hagelb.org/paredit-outline
16:56johnmn3btw, if anyone saw my code for the expression bagger, was using all those atoms bad form?
16:57johnmn3the function closes over 5 or 6 atoms
16:57lpetitjohnmn3: can you remember the link ?
16:57lpetits/remember/remind us/
16:57technomancysomebody talked to me about recording the paredit script as a screencast
16:58technomancysince I realized I don't have the editing skills to pull it off
16:58johnmn3http://paste.lisp.org/display/92442
17:00johnmn3I know it's not pretty
17:01johnmn3I still use a brute-force kind of style
17:01lpetitand I'm tired
17:01johnmn3aye
17:01Anniepoo,(in-ns 'tacos)
17:01clojurebot#<Namespace tacos>
17:02Anniepoo,(defn foo [] (println "for lunch"))
17:02clojurebotDENIED
17:02lpetitI don't understand: why do you do all this in order to create a GUI repl ?
17:02chouserjohnmn3: have you seen any of rhickey's material on values vs. identities?
17:02Anniepoo(+ 1 2)
17:02clojurebot3
17:02johnmn3still 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:03johnmn3lpetit: why not?
17:03lpetitjohnmn3: smells bat
17:03lpetitsmells bad
17:03Anniepooanybody else had trouble with enclojure and in-ns?
17:03johnmn3chouser: yea, I have.. are you getting at something?
17:03lpetitjohnmn3: but does not come from a thourough analysis of your code. Just a smell
17:03johnmn3like i'm using too much state there?
17:03johnmn3aye
17:03chouserjohnmn3: are each of those atoms properly an identity?
17:04chouserjohnmn3: I haven't read everything you're doing there, but find it unlikley. :-)
17:04lpetitnot much about state (state has its virtue, and maybe yours is just essential state, I don't know for sure)
17:04lpetitbut smells like too much mutable storages
17:04lpetitas said chouser
17:05johnmn3aye.. 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:05chouserguis *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:06lpetitchouser: 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:06chouserlpetit: not really. it's something I still struggle with, moreso in code related to guis, sockets, and other "external" things like that.
17:07lpetitchouser: ok, so we're all in a learning curve here :-)
17:07johnmn3and I recured most of the changes back to the top of the loop, not needing any storage.. just used accumulators
17:08johnmn3but 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:08chouserjohnmn3: 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:08lpetitjohnmn3: (fn [_] false) can be written (constantly false), btw
17:08johnmn3ah was wondering.. could do that in a lot of places then.
17:09hiredmanhow does clojureql's LIKE operator work?
17:09chouserjohnmn3: 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:10lpetit{:newstr (constantly []), :started (constantly false), ...} and pass it in the loop, and use assoc/update/update-in
17:10johnmn3maybe I could still use a loop. just have it loop once per run, and just have one slot to hold state between loops.
17:11lpetitthere's nothing wrong with a loop
17:11johnmn3right
17:13lpetitfrom paredit's source code:
17:13lpetit;;; This code is written for clarity, not efficiency. It frequently
17:13lpetit;;; walks over S-expressions redundantly. If you have problems with
17:13lpetit;;; the time it takes to execute some of the commands, let me know, but
17:13lpetit;;; first be sure that what you're doing is reasonable: it is
17:13lpetit;;; preferable to avoid immense S-expressions in code anyway.
17:13hiredmanlpetit: pastebin
17:13lpetitgood, maybe trying to do a raw port of it could be usable.
17:13lpetithiredman: sorry
17:13johnmn3so make a map of my data and store it in a ref.
17:14johnmn3should be a good exercise
17:15lpetitI expect emacs lisp to be readable even if it's the first time I read emacs lisp, or am I fooling myself ?
17:15lpetit(I also have *some* CL knowledge)
17:15technomancylpetit: it's pretty straightforward; yet another imperative lisp dialect
17:16technomancyvery similar to CL, but more limited. (only dynamic scope)
17:16lpetittechnomancy: ok, so maybe trying to port it, then write a comprehensive set of unit tests, and then rewrite it in idiomatic clojure
17:16technomancyI think it's closest to MacLISP, which CL is pretty closely related.
17:16lpetittechnomancy: no lexical scope?
17:16technomancylpetit: =(
17:16technomancyit's available in an experimental branch, but it's opt-in
17:17technomancyamazingly enough you can fake it for most purposes with a macro, but heaven help you if you ever try to read the expansion
17:17lpetittechnomancy: ever thought about writing an emacslisp -> clojure translator (or the other way around) ? :-)
17:18technomancylpetit: 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:18technomancyit will be a pretty natural compilation target once thread support is finished
17:19lpetittechnomancy: 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:20technomancyyeah, 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:20lpetittechnomancy: yes, make it work, write a decent test suite, make it right
17:21lpetittechnomancy: yes.
17:22spuzlpetit: :o
17:22technomancywhere would we be today if people let that stop them?
17:22spuztechnomancy: finished?
17:23lpetittechnomancy: 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:23lpetit;)
17:23lpetitok, time to go to bed, bye guys
17:23doublindirectionis it possible to specify a throw clause to a :gen-class :method? I cannot find anything in the docs
17:24chouserdoublindirection: I don't think so
17:24lpetitdoublindirection: you don't need to do so
17:24hiredmanparedit?
17:24clojurebotparedit source is http://mumble.net/~campbell/emacs/paredit.el
17:24lpetitor do you ?
17:24chouserClojure doesn't have much patience for checked exceptions.
17:25lpetitit works again !
17:25hiredmanlpetit: what you wanted never worked
17:25hiredman(but it does now)
17:25lpetitparedit.*
17:25lpetit~paredit.*
17:25clojurebotparedit commands is http://mumble.net/~campbell/emacs/paredit.html
17:25hiredmanno not that
17:25doublindirectionI'm generating API for java coders, they will want checked exceptions
17:26lpetithiredman: just dreaming :-)
17:26hiredmanasking "paredit?" and expecting the fact for "paredit source"
17:26lpetitok
17:26lpetitwould it be a good idea for it to return everything that starts with paredit ? (multiple lines ?)
17:26lpetit~paredit source
17:26clojurebotparedit source is http://mumble.net/~campbell/emacs/paredit.el
17:26lpetit~paredit commands
17:26clojurebotparedit commands is http://mumble.net/~campbell/emacs/paredit.html
17:27lpetit~paredit tutorial
17:27clojurebotparedit tutorial is http://p.hagelb.org/paredit-outline
17:27lpetitparedit tuto?
17:27lpetit~paredit tuto?
17:27clojurebotparedit commands is http://mumble.net/~campbell/emacs/paredit.html
17:27lpetitI'm confused
17:28lpetitok, must really leave now, cu
17:28hiredmanI am ok with that
17:33Anniepoo,(reduce #(+ %1 %2) '())
17:33clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--4276$fn
17:34Anniepooexpected something other than that
17:35chouseryeah, that's a bit weird.
17:36chouserbut it's documented
17:36AnniepooI guess the converse question is, what should it return?
17:36chouserIf coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments.
17:36chouserfrom the docstring
17:37Anniepoomaybe it's just the choice of exception to throw
17:38hiredmanreduce doesn't throw any exceptions
17:38hiredmanfn's throw exceptions if misapplied
17:38Anniepooah, ok, now makes sense
17:51jweisscan 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:52technomancyjweiss: couch is easy. I've heard mongo is nice too if you need it to handle absurdly large datasets.
17:53jweisstechnomancy: 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:54kwertiijweiss: Berkely DB?
17:54kwertii*Berkeley
17:54Anniepoohttp://w-hat.com/httpdb/
17:54Anniepoodeadly simple
17:56technomancyif you want a web-based system, slapping a JS UI on top of couch is the simplest thing that could work
17:56technomancybut it doesn't involve clojure. =)
17:56chouserAnniepoo: ooo
17:56Anniepoo???
17:56jweisstechnomancy: i want to build an api/cli first and add a web ui later
17:56chouserI've written a few underpowered versions of httpdb for various little ajax projects.
17:57Anniepoohad the impression the request was for simple and flexible
17:57chouserAnniepoo: apparently I should have been using httpdb. :-)
17:57kwertiiIs anyone working on an Elephant-like transparent persistence system for Clojure yet?
17:58jweissflexible, not necessarily simple. would be nice if there's an existing redhat or debian package (which is +1 for couch and berkeley)
17:58Anniepoowell, if you trust your data to w-hat, go for it
17:58jweissi was under the impression that clojure's json-fu is not very strong
17:59hiredmanjweiss: very wrong
17:59jweissoh i stand corrected then
17:59hiredmanthere are two json encoder/decoders for clojure, and another encoder as the demo for fnparse
17:59hiredmanone of the json libs is in contrib
18:00hiredmananyway, derby is nice and easy to use
18:00jweissok so whose couchdb lib should i try first, danlarkin's or thekenny's
18:00jweissthere's also this redis thing: http://github.com/ragnard/redis-clojure
18:03hiredmanhttp://db.apache.org/derby/
18:04drewrcan anyone compare parsec and fnparse? are they similar?
18:04hiredmanhttp://bret.appspot.com/entry/how-friendfeed-uses-mysql
18:15maacljweiss: Clutch has worked out good for me
18:15kwertiiAre there any good examples of non-trivial open source Compojure apps out there?
18:16technomancykwertii: clojars may be a good one
18:17kwertiitechnomancy: thanks, will take a look
18:19jweissmaacl: so it looks like you can query directly in clojure using clutch?
18:20maacljweiss: yep - it has a view server
18:20jweissmaal - interesting, i will look into that, thanks
18:20jweissmaacl: ^
18:26lazy1How can I get the name of a function which is passed as a parameter? (actually a vector of functions)
18:28hiredmanlazy1: functions don't have names
18:29lazy1So I need to explicitly add metadata?
18:29hiredmanfunctions don't take metadata
18:29lazy1The var the points to the function?
18:29lazy1s/the/that/
18:29hiredmanyes
18:30hiredmanvars do have names
18:30hiredman,(prn #'+)
18:30clojurebot#'clojure.core/+
18:30hiredman,(prn-str #'+)
18:30clojurebot"#'clojure.core/+\n"
18:31lazy1But if I get an array of functions, I can't use #' on them (or do I?)
18:32kwertiitechnomancy: is technomancy.us written in Clojure?
18:32Chousukelazy1: you don't need #' to use functions as values
18:33lazy1I know, sorry for not being clear
18:33lazy1I've tried something like http://paste.lisp.org/display/92451, but I get an error on var
18:33Chousukelazy1: #'foo is short for (var foo), so it won't work on values of anything.
18:33technomancykwertii: nope: http://p.hagelb.org/Rakefile.html
18:34Chousukethe argument to var is a symbol (foo)
18:34lazy1Ah
18:34lazy1Is there a way to write nameof?
18:34Chousukefor arbitrary functions? no :/
18:34Chousukesome functions don't even have names.
18:34kwertiitechnomancy: ah, interesting. having grown frustrated with merb and rails, I am now weighing Ramaze versus Compojure.
18:35technomancykwertii: I vote for static files. =)
18:35kwertiitechnomancy: would love to, but it has to front a SQL database :)
18:35lazy1Is that why we have deftest?
18:38hiredmanlazy1: what do you mean?
18:38lazy1So you'll be able to get the name of the failed test
18:40hiredmanlazy1: I haven't really used deftest, but from what I recall it doesn't print out "names" of tests ever
18:41hiredmanthe test runner runs the tests for a namespace and blows up if they fail
18:42lazy1OK, then let me get to a higher level
18:43alexykmattrepl: figured it's easier to chat here than over github mail! :)
18:43lazy1I'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:43lazy1(that = name of the function that failed)
18:44Chousukepass the name of the function to the agents as well :P
18:44alexykhow do we do default arguments in clojure?
18:45lazy1I tried to avoid that, but I like the simplicity of that
18:45Chousukealexyk: overload by argcount usually
18:45lazy1Thanks
18:45alexykah ok
18:45alexykanybody else familar with oauth here?
18:46Chousuke(fn foo ([] (foo 1 2)) ([x y] (+ x y))) is a common pattern
18:46Chousukeexcept with defn, obviously. :)
18:47alexykChousuke: so optional will be nil in one branch; no real way to distinguish optional from default with non-nils, right?
18:47Chousukealexyk: well, it's whatever you pass from the overloaded lesser arity.
18:49ksmwait, so a function can have multiple bodies?
18:49hiredmangah
18:50Chousukeksm: yeah. overloaded on arity
18:50defnhmmm -- where'd clojure.test go?
18:51ksmneat
18:56defnam i crazy? did clojure.test vanish?
18:57lazy1defn: (require 'clojure.test) works for me
18:58lazy1,(require 'clojure.test)
18:58clojurebotnil
18:58defnyeah for some reason that ns doesn't exist for me?
18:58lazy1which version of clojure?
18:58lazy1IIRC it moved to clojure core after 1.0
18:58defnso maybe im running 1.0?
19:00lazy1Maybe, there is a stub left in clojure.contrib.test for backward compatibility
19:02defnyeah im running old clj
19:14headiusrhickey: around?
19:39alexykChousuke: so what's the syntax for optional params like (fun x :and y :maybe z)?
19:41the-kennyalexyk: for defn? [foo bar & [a b c]]
19:42alexykso :only is not a map key?
19:43the-kennyhm.. I don't know what you mean.
19:43the-kennySorry
19:43defnsweeet -- testing is fun
19:43defn:X
19:44kylesmithcan anyone explain why (read-string "abc123") works, and (read-string "123abc") throws a NumberFormatException?
19:45the-kennykylesmith: Because the reader tries to interprete 123abc as a number, but fails to parse the a?
19:46kylesmithyes, but why doesn't read-string return the entire string when happens?
19:46kylesmith,(doc read-string)
19:46clojurebot"([s]); Reads one object from the string s"
19:47the-kennyhm.. it the same when you type "123abc" in the repl.
19:47kylesmith"123abc" is certainly an object, so why not 'read' that and return it?
19:47the-kennykylesmith: but read-string just sees 123abc, not the " around it
19:47the-kenny,(read-string "\"123abc\"")
19:47clojurebot"123abc"
19:50the-kennyIf you type 123abc in the repl, it also doesn't gets interpreted as a string
19:51kylesmithtrue, but the doc doesn't say "Attempts to read the first possible object, or throws an exception"
19:55technoma`kylesmith: you can't start a symbol with a digit
19:59kylesmithwhat I'm really trying to do is read all objects from a string by wrapping the string in parens, and calling read-string.
20:05technoma`well if you want symbols back then you'll need to wrap it in a quote as well
20:05technoma`but do you really want symbols back?
20:06rhickeyheadius: hey
20:07kylesmithtechnoma`: you talkin to me?
20:07technoma`kylesmith: right
20:08kylesmithI want a seq of strings to be read, not symbols
20:08kylesmithit would be nice if read took a 'template' of types
20:09chouserkylesmith: 'read' is for converting text to clojure objects, just the way clojure source is read.
20:10kylesmithi.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:10mattreplalexyk: there's defnk in c.c.def, alternatively see this page: http://stackoverflow.com/questions/717963/clojure-keyword-arguments
20:11mattreplheh
20:11kylesmithchouser: yes, but read can sometimes be abused for parsing files ;)
20:13JonSmithwhy do people go crazy about typing 2 extra parens/curly-brackets/square-braces?
20:14defnbecause they're crazy
20:15defnJonSmith: it really depends on where and why
20:16defni can see why someone would be annoyed by typing them where they're clearly not needed or don't represent anything of importance
20:16defnand yet are required
20:18JonSmithI always have thought the CL &key &rest &optional &aux etc. were confusing
20:25defnwhen i use (deftest mytestname) -- does mytestname need to be unique
20:25defnerr let's say I have (defn mytestname [])
20:25defncan i have (deftest mytestname) as well?
20:25defnor will those overlap?
20:26technoma`defn: they're all vars
20:26defntechnoma`: thanks
20:30developernotesHas anyone ever seen the message "Cannot open load file, swank-clojure-autoload" when attempting to launch slime with clojure?
20:30technoma`developernotes: you're probably using a deprecated configuration
20:31technoma`that file hasn't existed for quite some time now
20:31developernotesI originally installed clojure in emacs through ELPA, is there a good way to upgrade this?
20:33technoma`developernotes: you can remove all your old configuration. if you're using elpa then simply installing the packages will be enough
20:33technoma`in particular calling clojure-slime-config is no longer needed
20:33ohpauleezDoes anyone else compile and run clojure on jvm 1.7?
20:34developernotestechnoma`: 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:35technoma`developernotes: in that case you might have to keep around some of your old config, but not clojure-slime-config
20:35technoma`you should be able to use it in harmony with CL, but I haven't tried that myself
20:35developernotestechnoma`: okay, I'll give it a go.
20:35developernotestechnoma`: thanks.
20:36technoma`np
20:47developernotesI 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:49developernotesI 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:49developernotesAny thoughts on getting clojure to run within emacs through slime, I already have swank-clojure installed, and also clojure itself.
20:51defndevelopernotes: you're using jochu's swank-clojure -- use technomancy's elpa version of clojure-mode, swank-clojure
20:51defnremove any configuration you've done
20:51developernotesdefn: I installed swank-clojure from ELPA.
20:51defnand clojure-mode?
20:51defndid you run M-x clojure-install?
20:52defnyou'll also need slime from elpa
20:53developernotesdefn: 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:53developernotesdefn: thoughts?
20:54defndevelopernotes: not really -- it seems like you have everything working, but that there's another swank-clojure floating about
20:54developernotesdefn: I have slime from ELPA installed, but not slime-repl from ELPA, do I need that?
20:55defnyes
20:55defnget that
20:55defnCan anyone tell me how to get ("abc") out of the list so it's just "abc"?
20:57hiredmanseriously?
20:57hiredman,(first '("abc"))
20:57clojurebot"abc"
20:58defnbahhh sorry hiredman -- i accidentally had (first (str '("abc")))
21:01kwertiianyone know why C-c C-k produces "Wrong number of args passed to: basic$eval--1058$compile-file-for-emacs"?
21:01ssideris,(first (first '("abc")))
21:01clojurebot\a
21:02kwertiiafaik I am using clojure 1.1 nightly from git, as well as the latest swank-clojure and clojure-mode
21:04headiusrhickey: sorry, missed ya, around now?
21:05rhickeyheadius: hi
21:05headiushey there
21:05headiusI think we're talking past each other on jvm-l
21:05rhickeya bit
21:05headiusI 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:05ssideris,(
21:05clojurebotEOF while reading
21:05rhickeymy main concern is not building a mega-compiler out of all our compilers joined by the coordinator
21:06headiusyeah, I don't want that either
21:06rhickeyI think making type info available to tools like IDEs via APIs is fine
21:06headiuswhat 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:06rhickeybut when I try to think through the compilation workflow that way, it seems complex
21:06headiusit may be
21:06headiusand it may be too complex
21:07rhickeywe need C++ header files :)
21:07headiusyeah, that's basically what this ends up as
21:07headiusvirtual header files
21:07rhickeythere are some benefits to that
21:08headiusI 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:08rhickeyinference is very scary - I think we need them to step up rather than speculate about what might work
21:08headiusrefactoring 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:09rhickeyall of these concepts are really pretty foreign for langs that don't use classes in the ordinary way - as John Cowan said
21:09headiuscertainly, but that's a separate discussion
21:10headiusthis is for joint compiling languages that want to present Java types and have cross-language, possibly-circular dependencies
21:10headiusand I'm trying to stop the spread of one-off joint compilers
21:10headiusthere's a groovy/java compiler that's mostly separate from the groovy/scala/java compiler, which is separate from the scala/java compiler
21:10headiusso many wheels being reinvented
21:11rhickeyand those langs are the most similar
21:11headiusit 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:12headiusat 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:12headiusrather than just diving into an approach
21:12rhickeywhat'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:13rhickeybut yes, we need some use cases and scenarios
21:13headiusthe 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:13headiusand that may be fine
21:13rhickeythe pathological cases require topological sorts etc
21:14headiusI 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:14radsusing 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:14headiusmy 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:15rads(I just want to make Pircbot#setName public)
21:15headiusI've started to hack that a bit in Duby, but it's all in Ruby and not useful in general
21:15headiusI 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:17rhickeya prototype never hurts
21:22headiusI'll see if I can mock something up
21:23rhickeycool
21:23defnheadius: Duby?
21:24headiusmy ruby-syntaxed static-typed, local-type-inferred, compiler-pluggable language
21:24headiusa toy, but maybe more someday
21:25defnheadius: cool
21:25headiushttp://kenai.com/projects/duby
21:26headiusgrr....javax.lang type names are *almost* the same as com.sun.mirror
21:27defnhttp://blog.fogus.me/2009/12/21/clojures-pre-and-post/
21:28bettspNewb question, what does a '*' after a function name mean?
21:29bettsphttp://github.com/ragnard/redis-clojure/blob/master/src/redis/internal.clj on line 38 for example
21:29defnbettsp: depends on the function
21:29defnit's not a pointer or anything
21:29dnolenbettsp: has no real meaning, it's a convention really.
21:29bettspdefn: Ok, so there's no idiomatic meaning though
21:29defnnot that im aware of, ive seen it used in many different cases
21:29bettspdefn: accepted throughout Clojure that is
21:30defnusually it's a way of differentiating myfn from a special myfn*
21:30defnerr not usually, in *some* cases that ive seen, that's how it behaves
21:30dnolenbettsp: usually it differentiates between a macro and the function that does the work.
21:31bettspdefn: But that's not the same as *s in (set!), which is a convention throughout the language
21:31bettspLike (set! *some-variable* true)
21:33PrinceOfArhickey: 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:34rhickeyPrinceOfA: um, not even close
21:35PrinceOfArhickey: has it somehow changed your professional life or do you still do the same stuff?
21:35PrinceOfAor same stuff + clojure development
21:35rhickeyPrinceOfA: mostly Clojure now
21:39headiushmm
21:42PrinceOfArhickey: 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:44rhickeyPrinceOfA: I never expected it to hit the way it did
21:47tolstoyAnyone have a recommendation for an xmlrpc client? Has someone wrapped that all up in a clojure lib yet?
21:47PrinceOfArhickey: 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:47tolstoyThere's one for Apache, and there's this Redstone one....
21:48ssiderisrhickey: 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:48ssiderisi'm asking mainly because i would like to do the same
21:48ssideris(give up the dayjob and work on my own projects)
21:53radsanyone know why (.setName x) still doesn't work using this code? http://gist.github.com/261442
21:53tolstoyrads: Yep.
21:54tolstoyrads: That method is protected.
21:54tolstoyYou can use (in contrib java-utils) wall-hack-method to get at it.
21:54rhickeyssideris: http://clojure.org/funding
21:55tolstoyrads: I just worked on that very problem yesterday! Also see hiredman's clojure bot (githup) to see how he worked it.
21:55radstolstoy: cool, thanks
21:56tolstoy(wall-hack-method org.jibble.pircbot.PircBot :setName [String] bot name)
21:58ssiderisrhickey: ok :-)
22:00kwertiiIt 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:04alexykis there a way to list names defined in repl?
22:06mitchellhalexyk: (ns-public *ns*) will list all the public ones
22:06alexykmitchellh: thx
22:06alexykhm... Unable to resolve symbol: ns-public in this context
22:07alexykshould I import it from somewhere?
22:07mitchellhits part of clojure.core so you shouldn't have to
22:07mitchellhbut just to be sure try
22:07mitchellh(clojure.core/ns-publics *ns*)
22:07mitchellhalexyk: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/ns-publics
22:07alexykah, ns-publics
22:07mitchellhoh, did I misspell it previously? My mistake
22:08alexyknp, works now
22:08alexykcuute
22:08alexykrhickey: you got something really special going! :) I like it better every day
22:08mitchellhThere are others, like ns-interns and such but I just started with clojure so I'm not sure which you want :)
22:09polypusi 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:09alexyk_ato: did you really have just two months Clojure experience before doing WF2, per twbray?
22:09alexykit's hard to beieve
22:11ssiderisalexyk: what's the project you're referring to?
22:11alexykssideris: Wide Finder 2
22:12alexykclojurebot: ~Wide Finder
22:12clojurebotHuh?
22:12alexykclojurebot: ~"wide finder dammit"
22:12clojurebotExcuse me?
22:12alexykclojurebot: ~"wake up hiredman"
22:12clojurebotwhen I write functions I go blind and let the lambda do its thing
22:12alexykhttp://www.tbray.org/ongoing/When/200x/2009/09/27/Concur-dot-next
22:13ssiderisoh yes, i read about wide finder 2
22:13alexykfurthermore, that would put making clojars at day 1 or 2 of clojure, which is harder to believe still
22:15hiredmanwhat?
22:16clojurebotWhat is meta
22:16alexykhiredman: what what?
22:16alexykclojurebot's on strike, not googling
22:16hiredman~google stuff
22:16clojurebotFirst, out of 35800000 results is:
22:16clojurebotThe Story of Stuff
22:16clojurebothttp://www.storyofstuff.com/
22:16hiredman?
22:16alexykhow do we google "wide finder"?
22:17hiredmanclojurebot: google wide finder
22:17clojurebotFirst, out of 5240000 results is:
22:17clojurebotWide Finder Home - Wide-Finder - wikis.sun.com
22:17clojurebothttp://wikis.sun.com/display/WideFinder/
22:17alexykah... so ~ is for single word?
22:17hiredman~ is short for clojurebot:
22:17clojurebotfor is not a loop
22:18alexykah! the mysteries unravel
22:18hiredmanyou have to tell clojurebot you want to google
22:18alexykclojurebot: I want to google something
22:18clojurebotrationale is http://clojure.org/rationale
22:22JonSmithclojurebot: google foo
22:22clojurebotFirst, out of 3010000 results is:
22:22clojurebotFoobar - Wikipedia, the free encyclopedia
22:22clojurebothttp://en.wikipedia.org/wiki/Foobar
22:26PrinceOfAdoes 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:27PrinceOfA*handle function which is defined elsewhere
22:28ohpauleezhas anyone been having issues with lein repl?
22:30kwertiiohpauleez: lein repl works fine here, it's lein swank that's causing me problems :)
22:31ohpauleezah, gotcha, thanks for letting me know kwertii
22:40arohner(and foo (every? identity foo))
22:40arohneris there a more concise way to write that? it feels wrong
22:42arohneractually, that doesn't do what I want either, it fails on an empty list
22:43arohnerI want 1) foo is a seq 2) foo is non-empty 3) every value of foo is true
22:47JonSmithyou could use filter i guess
22:47JonSmithmeh, that's kind of silly though
22:49JonSmith,(= () nil)
22:49clojurebotfalse
22:49JonSmith,(= '() nil)
22:49clojurebotfalse
22:49JonSmith,(= nil false)
22:49clojurebotfalse
22:49JonSmith,(= false false)
22:49clojurebottrue
22:50JonSmith,(reduce #(and %1 %2) (list true true true true))
22:50clojurebottrue
22:51JonSmith,(reduce #(and %1 %2) (list true true false false))
22:51clojurebotfalse
22:51JonSmith,(reduce #(and %1 %2) (list))
22:51clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--4356$fn
22:51arohner,(reduce #(and %&) (list))
22:51clojurebotnil
22:52arohner,(reduce #(and %&))
22:52clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$reduce
22:52arohner,(reduce #(and %&) nil)
22:52clojurebotnil
22:53arohnerI think that works. thanks
23:20arohneris there a way to introspect a multimethod to see what values it will work on?
23:21arohnernm
23:21arohner(.getMethodTable multi-method)
23:21arohnerreading the source is good for you!
23:25ohpauleezarohner: (methods) should also work, right? http://github.com/richhickey/clojure/blob/a9cb831fe714966e225a5297ef844513fe4a373a/src/clj/clojure/core.clj#L1066
23:25ohpauleezwhich is just sugar .getMethodTable
23:26arohneroh, nice
23:27arohnerthat's not mentioned on the multimethods page