#clojure logs

2010-03-11

00:07tomojis <> used?
00:10psykotic<> gives me pascal flashbacks
00:11psykoticlots of other possibilities though. =>, =>>, etc
00:12psykoticactually i'm already using => for logical implication in my logic-based testing library
00:12tomojhaha
00:12tomojmaybe a strangely-named namespace?
00:12tomojthis would guarantee that there will be no conflicts
00:13tomojso you could do c/> or something
00:17gkoHow do you deal with: ({(BigInteger. "1") "one"} 1) => nil (as 1 is Integer) ?
00:18psykotic,(= (BigInteger. 1) 1)
00:18clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger
00:18psykotic,(= (BigInteger. "1") 1)
00:18clojurebottrue
00:18psykoticit must be a hashing thing?
00:19psykotic,(= (hash (BigInteger. "1")) (hash 1))
00:19clojurebottrue
00:19psykoticnope
00:20psykotic,({(BigInteger. "1") "one"} 1)
00:20clojurebotnil
00:20psykotic,({(BigInteger. "1") "one"} (BigInteger. "1"))
00:20clojurebot"one"
00:20psykoticyeah, that's weird.
00:21gkoActually, it's the same if it's Long, etc...
00:21psykotici'd consider that a bug
00:21psykotichave you searched the list archives?
00:21gkopsykotic: nope. I'll look at them.
00:22psykotic,(class {(BigInteger. "1") "foo"})
00:22clojurebotclojure.lang.PersistentArrayMap
00:22gkopsykotic: but I thought: this should have been spotted a long time ago, so there must be something I missed... :)
00:23psykotic,((hash-map (BigInteger. "1") "one") 1)
00:23clojurebotnil
00:23psykotic,((sorted-map (BigInteger. "1") "one") 1)
00:23clojurebot"one"
00:23psykoticinteresting
00:23psykoticso it works with sorted maps, but not array or hash maps
00:24psykotici wonder if array/hash maps use something other than =
00:25psykotici.e. straight Object.equals()
00:25noidi,(.equals (BigInteger. 1) 1)
00:25clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger
00:25psykotic,(.equals (BigInteger. "1") 1)
00:25clojurebotfalse
00:25psykotic(as expected)
00:26psykotic,(.equals 1 (BigInteger. "1"))
00:26clojurebotfalse
00:26psykoticat least it's symmetric, that's not always the case with equals, heh
00:28psykoticanyway, yeah, that's the problem, it seems
00:28psykoticif you look at equalKey() in PersistentArrayMap.java, it equals equals() directly
00:28psykotici'd definitely consider this a bug, you should post it, gko
00:29psykotics/equals equals()/calls equals()/
00:30psykoticit should call Util.equiv() instead
00:30gkoOK.
00:30psykoticalthough this will slow down things
00:31psykoticit's possible it was done for that reason, though it's a pretty heinous trade-off for performance, if so
00:31tomojhah http://sardakcode.blogspot.com/2009/02/litterate-programming-in-clojure.html
00:31tomojthat code uses itself to display what you see on the page
00:31gkopsykotic: maybe, but it's annoying as one would have to be aware of this..
00:31psykoticgko: i agree, it's completely broken, no excuses.
00:31psykoticyou can't have this kind of behavior in something as core as maps
00:32psykotictomoj: it's amusing that 'literate' is misspelled in the original title, which was evidently later corrected, though it persists in the url :)
00:33tomojyep
00:33tomojI pardoned that because the self-reference was awesome
00:33psykoticbtw, you can easily do literate programming in any language with org-babel
00:33tomojyes, actually
00:33tomojI am watching the presentation that was just posted to planet emacsen
00:34tomojwhich made me think about literate programming in clojure
00:34tomojbut I also want to be able to run the literate code in production :)
00:34psykoticthe only thing i don't like about org-babel is that the code block syntax is a little heavy weight
00:34psykoticbut i can believe you can define macros for that
00:34tomojI haven't looked into it yet
00:35psykoticmy favorite is haskell's LHS since it's so lightweight. it's not fancy like cweb but i consider that an advantage--cweb has so much ceremony that i never use it
00:35psykoticwhereas with haskell i always use LHS even when i don't plan on writing much prose
00:35tomojyes, I want lclj
00:36tomojyou'd have to hack the reader, I guess
00:36tomojor maybe a custom reader macro?
00:36tomojwonder what's available
00:37psykoticbtw ghc actually supports arbitrary filters for lhs mode
00:37psykoticthe > ... is just the default
00:37psykoticit would be nice if you could register simple string-based input-output filters with clojure like that for things like literate
00:38psykoticbut you're right, it would be more lispy to use reader macros. unfortunately, clojure doesn't have a programmable reader.
00:40psykotici don't understand why that is, anyway. it would be super simple for clojure to provide a default dumb reader (no map literals, no #(...), etc) for boot strapping, and simply have a *reader* that takes a lazy stream of characters and produces a lazy stream of data structures.
00:40cad_austinHi, quick question - I've got a directory structure like src/com/projectname/blah.clj . When I open a REPL in emacs ( classpath configured in the .emacs ), the REPL does not recognize (use 'com.projectname.blah). Any suggestions?
00:40psykoticyou don't need the built in reader to support read tables
00:40psykoticso, you would bootstrap with the dumb reader, implement your own fancier reader, and def it to *reader*
00:41tomojpsykotic: did you see the "The sheer elaborated insanity..." tweet? :D
00:41psykoticno?
00:42cad_austinAlso, if blurting out a question is some sort of faux-pas, please let me know. New to IRC.
00:42tomojpsykotic: http://twitter.com/zenoli/status/7889972817
00:42tomojcad_austin: blurting out a question is not a faux-pas, it's expected, actively encouraged behavior
00:42tomoj:)
00:43cad_austintomoj: thanks, worried about it
00:43tomojmany channels have "don't ask to ask, just ask" rules, informal or formal
00:43tomojalso, welcome
00:43psykotictomoj: heh
00:43psykoticin a way i disagree, org-mode does a lot of unemacsy things
00:44psykoticbut usually in a way that improves on emacs
00:44tomojmy emacs fu isn't great enough to appreciate the subtleties of whether org-mode is "emacsy"
00:44psykotican example is the way it implements table 'dragging'
00:44psykoticthe emacs way would be like transpose-word, etc, which is retarded
00:44tomojcad_austin: have you considered clojure-mode?
00:44tomojor, I guess you're using it?
00:44psykotici wrote my own drag.el that provides org-table-like dragging for chars, words, paragraphs, sexprs, etc, it's a million times nicer to use than transposition
00:45psykoticit preserves intraunit point positioning, etc, which transposition doesn't
00:45klafkais anyone familiar with incanter?
00:45tomojpsykotic: wow, is it available?
00:45tomojdo you use it along with paredit?
00:45psykotici can gist it, but it's not really nice
00:45psykotichehe
00:46tomojI feel like there should be a #cult-of-emacs
00:46tomojperhaps #emacs really is enough
00:46psykotictomoj: http://gist.github.com/328872
00:46klafkai don't know why http://codepad.org/zHRy7VSj this is returning a 2x2 matrix instead of a 2x1 matrix ( A is a 2x2 matrix)
00:46tomojthanks!
00:46psykoticfeel free to use it but please don't distribute it. it's still not in shipping shape.
00:47tomojokey
00:47cad_austintomoj: Yes, I'm using it. I actually make more progress with (use 'src.projname.blah) but then the "use" in THAT source file cannot find other libraries. Also, I believe that there is a church of emacs.
00:48psykoticheh, gist's syntax highlighting for .el is broken as heck
00:48psykoticit doesn't know about defun at all, so it thinks the argument list is a function application and highlights the first subexpression accordingly
00:51dmiles_afki am about to attempt to merge the clojure underlying data objects with ABCL.. is there a series tests complete enough to make sur ei didnt totally hoze clojure?
00:52dmiles_afkfor ABCL i run the ANSI-TESTs for common lisp
00:52hiredmanthe only tests I know of are what is in the source tree
00:53mabesIs there already a function that partitions a vector into a number of different sets *of different sizes*? i.e. partition v into seqs of size 1,2,3,4,6,20
00:53dmiles_afkmy goal is just to avoid represetnation convertsion between the two
00:54psykoticmabes: not built in
00:54psykoticmabes: that's one of apl's nice functions.
00:56cad_austinIs there a common convention for laying out the file structure of a clojure program?
00:56mabespsykotic: ok, thanks for the info!
00:57_atocad_austin: yeah, not everyone uses it but the normal way is: source directly under src/, libraries under lib/, tests under test/, compiled classes under classs/
00:57_atoerr I mean "classes/"
00:58mabescad_austin: lein is probably the most popular convention.. and it uses what _ato explained (video on leiningen and project management: http://vimeo.com/8934942)
00:59cad_austin_ato: Definitely watched that one. I've been using it, but as I mentioned before, my namespaces seem to dislike one another.
00:59cad_austin"it" = leiningen
00:59_atocad_austin: are you using M-x swank-clojure-project in emacs?
01:02cad_austin_ato: No, I don't believe so. I've actually hackishly added (setq swank-clojure-extra-classpaths (list my/project/dir)) to my .emacs.
01:03tomojuse swank-clojure-project instead if you don't want to use lein-swank
01:04_atocad_austin: Here's what I do. No path configuration whatsoever in my .emacs. Create a directory for my project, with "src" and "lib" subdirectories. Chuck my source under src with the package directory structure you mentioned. Chuck all my libs (including clojure and swank-clojure.jar) under "lib". Hit M-x swank-clojure-project and point emacs at my project directory and the REPL comes up
01:05cad_austintomoj + _ato: I didn't realize these were existing modes. Thanks. Giving it a shot now.
01:06tomojif you get a recent leiningen working, should be pretty easy to lein-swank and then M-x slime-connect to it
01:07psykoticmabes: http://gist.github.com/328891
01:08psykoticor if you want something more like the apl version, you'd first prefix sum the is
01:09cad_austin_ato: Don't have swank-clojure-project. Should I be using this "ELPA" thing?
01:09mabespsykotic: very nice! I was going down the path of using subvec... I had forgotten about split-at. Very nice solution- thanks!
01:09psykoticincidentally, with the apl semantics, the usual (partition n xs) could then be written (cut (repeat n) xs)
01:10tomojthat is brilliant
01:10tomojcad_austin: yes, use elpa
01:11tomojcad_austin: if you get stuck, let us know
01:11psykoticmabes: sorry, there's actually a bug. in the else branch of the if, it should be [xs] rather than xs
01:12cad_austintomoj: Ok. How did I not know this existed...
01:12mabeshow does one decide to put the collection in the front (as in subvec) or at the end (as in split-at)?
01:14tomojcad_austin: you'll want to install at least clojure-mode and swank-clojure, I believe
01:15cad_austintomoj: Will the installer delete my existing modifications?
01:15tomojno, it won't touch anything you've done already
01:15cad_austintomoj: Ok, thanks.
01:15tomojit will stick a bit of code at the bottom of your .emacs
01:15tomojbut you'll probably want to wipe out your .emacs modifications anyway
01:16tomojunless you're using another lisp as well
01:16_atomabes: the convention is usually, if you're treating it as a collection (get, assoc, conj) it's the first argument, if you're treating it as a sequence (map, reduce, split-at) it's the last argument
01:16tomojyou shouldn't need any .emacs customization besides the installer bit
01:17tomoj(unless you want to use paredit)
01:17cad_austintomoj: Keybindings?
01:17tomojyour keybindings should be fine
01:17tomojunless they're bound to things that don't exist anymore in the elpa version or something
01:17tomojwhich would be odd
01:18tomojbut anyway you will want to not load the slime/swank-clojure/clojure-mode/whatever you were loading before
01:18_atomabes: see also this thread: http://groups.google.com/group/clojure/browse_thread/thread/8b2c8dc96b39ddd7/a8866d34b601ff43
01:18tomojmaybe backup your .emacs just in case :)
01:18mabesahh, ok. thanks for the clarification and pointer _ato
01:24psykotichere's a version of cut that works when the cut-index sequence extends beyond the sequence to be cut, in particular it works with infinite cut-index sequences so that my (cut (repeat n) xs) thing works
01:24psykotichttp://gist.github.com/328891
01:25psykoticthat's pretty neat
01:30cad_austintomoj/_ato: 1) ELPA is AMAZING, 2) installed required without a hitch, thanks to a technomancy article, 3) namespace issues completely resolved
01:30cad_austinThanks very very much.
01:31tomojgreat
01:31_atocad_austin: cool :-)
01:31tomojnow leiningen will help you if you best it
01:39cad_austinIs clojureql the way to go for db stuff?
01:40dnolencad_austin: if you like CouchDB, clutch is pretty cool.
01:43cad_austinI've heard good things. Is either clutch or clojureql stable enough to use on a production environment?
01:43tomojclojureql isn't built with lein, but we can still get it from clojars, right?
01:44tomojI think clojureql is nearing some changes
01:44tomojnot sure how much progress they've made
01:44tomojif you are awake late enough, maybe the owner will come by
01:46cad_austintomoj: I had to install gradle and manual drop the build and a driver into my lib directory.
01:46tomojouch
01:47tomojI see org.clojars.snuxoll/clojureql in clojars
01:47_atohttp://clojars.org/clojureql
01:47tomojguess someone pushed that to clojars, dunno how recent it is
01:47tomojoh, hmm
01:47tomojis it just me or is search broken
01:47_atosearch is broken
01:47_atostuff that doesn't have a description doesn't show up
01:47tomojis that open source?
01:48tomojah yes, I see it
01:50cad_austinForgive the ignorance, but a colleague told me that couchdb obviates lucene. Didn't believe him. Is it true?
01:50cad_austinI should say hibernate search.
01:50cad_austin( We're from Java land )
01:52_atocad_austin: couchdb can optionally integrate with lucene
01:52tomojI don't think it makes lucene obsolete
01:52_atoI don't know anything about hibernate search
01:52tomojme neither
01:53tomojbut I still use solr even though I love the couch
01:53_atocouchdb doesn't itself do full-text search (there's a lucene plugin for couch that adds it)
01:54tomojbut, can that couch plugin be modified like lucene can?
01:54_atobtw I just put in a quick hack to fix the clojars search
01:54tomojawesome :)
01:54tomojwith lucene, I can write clojure to do different kinds of searching/indexing
01:55_atoyeah it's not as flexible
01:55tomojif the couch integration way could work with clojure like that (and with solr..), it'd be cool
01:55cad_austinI'm reading that couch is wicked-slow.
01:56_atodepends on your data set size
01:56_atoit's useless for millions/billions of documents
01:57cad_austin_ato: Ok.
02:00zmila,(doc flatten)
02:00clojurebotTitim gan éirí ort.
02:00cad_austin,(+ 1 1)
02:00clojurebot2
02:00cad_austinOh... cool.
02:00tomojI've heard that it's slow too :(
02:00tomojbut never confirmed it
02:00tomojbut, still cool for small apps to sync up
02:01tomojchef uses it internally for example
02:01tomojalong with solr for searching
02:01cad_austintomoj: this is what I'm referencing, I do not have personal experience, http://www.codeweblog.com/couchdb-vs-mysql-insert-performance-test-data-of-the-speed-test/
02:01hiredmanhuh
02:01hiredmanI wonder why no docs for flatten
02:02hiredmanouch
02:02hiredmanthe json clojurebot grabs for contrib docstrings seems to be empty or have gone missing
02:03hiredmanyeah, it's gone or moved
02:13lancepantzi don't think flatten is in the api
02:13lancepantzi'd like it though
02:14lancepantzoh, nm its in contrib
02:28tomojget cut into core
02:28tomojat least contrib, it's awesome
04:37seangroveHey all, I'm having a terrible time removing nils from this list: http://pastie.org/864693
04:37seangroveHow can I get a flat list of non-nil atoms?
04:38seangroveThe closest I can get is to replace the nils with (())
04:38seangroveThough this might be a side-effect of using the repl, I'm not sure
04:41_atoyikes
04:41_atodo you just want a single list of strings? (no nesting)
04:42_atoI'd just (remove nil? (flatten ...)) the sucker
04:43_ato(flatten is in clojure.contrib.seq-utils)
04:45seangroveAh
04:45seangroveI couldn't find flatten, heh
04:50Licenser_greetings everyone
05:02seangrove_ato: That worked, thank you
05:02seangroveAnd, it's 2:00am, I think I need to sleep
05:02seangroveG'night
05:09zmilaflatten is mentioned twice today :)
06:07psykotic,(future (println "asdf"))
06:07clojurebot#<Object$IDeref$Future$2b9be1f9@16e8a49: :pending>
06:08psykotici notice that when i do something like that from the slime repl, the output never makes it to the buffer.
06:10psykoticworks from clojure's own repl though
06:16psykotichas anyone already done a library for working with 'promise sequences'? i wrote my own stuff already but...
06:24psykoticthe idea is to use bidirectional promises to connect producer and consumer.
06:24psykoticthe producer yields an initial promise which is wrapped in a lazy-seq. the lazy-seq, when forced, delivers a promise back to the producer signaling 'i have just been consumed', and then yields the first cons cell worth of production. etc.
06:25psykoticin the simplest case the producer and consumer will therefore work in lock step, but it's easy to let the producer get ahead of the consumer by some amount, etc.
06:25psykoticit's dataflow programming 101, but it's painful to do with raw promises.
06:48neotykpsykotic: it is in *inferior-lisp*
06:48psykoticneotyk: ah, that makes sense
06:54rhickeyaargh - could someone please fix test so that it doesn't always say the problem is at test_clojure.clj:77 ?
09:16klafkawhat is the exponent symbol in clojure? like 2^4 say
09:17chouserthere's a static method in Math, and instance methods in some of the number types
09:17chouser,(Math/pow 2 4)
09:17clojurebot16.0
09:17AWizzArdklafka: you can use the .pow function in Math or on BigInteger for example
09:17klafkaaah
09:17klafkai see
09:18AWizzArd,(.pow 2M 16)
09:18clojurebot65536M
09:18chouserI wish we had a version of that function that has side effects so we could call it "pow!"
09:19AWizzArdWhat would the side effect do?
09:23chouserbeats me
09:23zmilaside effect - memoize the calculation
09:26AWizzArdchouser: aah, I think now I understand.
09:42paodoes there exist a news feed for clojure development?
09:42mefestoHey everyone. Just wondering if there was some other function that would do the same thing as this: (map vector seq1 seq2)
09:43mefestofor some reason i thought there was some group function that would do the same
09:44klafkais there a clojure mode for aquamacs ?
09:44klafkaor a way to install a module for it
09:45neotykklafka: same as for normal emacs 22
09:45klafkawhen i go to file - new buffer in mode - there is no clojure option, is there a keyboard shortcut for this (almost invariably I'm sure)
09:46chouserpao: there's a google group for general discussion, and another for development of clojure itself.
09:46paochouser: thanks, I remember something along the lines of "clojure weekly news" but probably I'm mistaken
09:47neotykklafka: can you do M-x clojure-mode?
09:48chouserpao: there's a clojure "pipe" of several blogs and also http://disclojure.org/
09:48paochouser: thanks a lot
09:49neotykklafka: you will have less problems not using aquamacs, but emacs
09:50klafkareally?
09:50klafkaok
09:51neotykaqamacs is based of emacs 22
09:51neotykwhile emacs is long on 23
09:51klafkaah i see
09:52neotykand package manager fails silently on 22
09:52Chousukeaquamacs 2.0 is based on 23 though
09:52Chousukebut it's still in beta
09:52neotykexactly
09:53neotykI've switched to emacs by advice here and am very happy user
10:03mattreplthoughts on adding a `file-extension` multimethod in c.c.io?
10:13defnmorning all
10:13defnpao: http://planet.clojure.in
10:14defnwish someone would just put disclojure and planet.clojure.in into one legible news page
10:14paodefn: thanks
10:14defnpao: np
10:18Drakesonis it just me, or is leiningen (git) somehow broken?
10:20S11001001Drakeson: is your problem one of these?: http://github.com/technomancy/leiningen/issues
10:23cemericktotally offtopic, but: what do people use for building slideshows? There's only about 5000 tools out there.
10:26Drakesoncemerick: apple keynote, beamer-latex, also sometimes ad hoc clj->html stuff
10:27Drakesonoops! what do you mean by slideshow?
10:27DrakesonS11001001: apparently not
10:27cemerickwhoa, I'd have to *pay* for *software*?!!1! phffft. :-)
10:27cemerickDrakeson: yeah, that's what I meant, thanks. :-)
10:28chouserI bought apple keynote for a particular project, but it couldn't do what I needed it to. Haven't used it since.
10:29cemerickchouser: then your weapon of choice is...?
10:30chousersorry, I've got nothing. I think I used oopresent last time I had to do slides. I suppose it worked.
10:30foguscemerick: I'm on a markdown kick recently, so I'm using that with js and html
10:30cemerickI fiddled with keynote, and felt like I had all thumbs with it. :-/
10:31cemerickI'm toying with the idea of putting everything into one omnigraffle or omnioutliner doc, and generating a PDF from that.
10:32cemerickfogus: markdown is a little evil. I simply can *never* remember how to make links (e.g. do parens or brackets go first, etc)
10:32chousercemerick: but -- how will you do animated transitions with that!?
10:32DrakesonI strongly prefer beamer over keynote, etc., unless I need to do something that is really easy in keynote. still, having the sources under version control gives me a hot fuzzy feeling :p
10:32cemerickchouser: *click forward*, then *jump around doing jazz hands*
10:32cemericksee? animated transitions.
10:32chousercemerick: that does sound interesting. I'd like to see that some time.
10:33foguscemerick: is it markdown that is evil, or is it your memory? ;)
10:34cemerickfogus: things that require me to remember too much chaff are evil ;-)
10:34fogushmmm, good point
10:35cemerickthat's one of my favorite things about confluence markup...links are just [label|url], which I can remember easily.
10:35triyoto associate a new key and val to a hash-map in an atom I have (swap! db #(assoc % key val)) .. how do I remove a key/val in an hash-map atom?
10:35cemerickDrakeson: presentations using latex? ouch.
10:36chousertriyo: actually, you should instead do (swap! db assoc key val), and then (swap! db dissoc key)
10:36S11001001Drakeson: in that case it works fine for me so...what's the issue?
10:42DrakesonS11001001: I get this error:
10:42DrakesonException in thread "main" java.lang.VerifyError: class clojure.contrib.with_ns$loading__4759__auto____4765 overrides final method meta.()Lclojure/lang/IPersistentMap;
10:42stuartsierraDrakeson: you've got a version mismatch
10:43stuartsierraAlways use matched versions of Clojure and contrib.
10:43Drakesonstuartsierra: it is not me!
10:44Drakesonwhat I did: cd .../leiningen ; git pull ; lein install ; cd some-where-else ; lein new foo ; cd foo ; lein deps ; now lein is broken
10:44stuartsierraSorry, just tuned in on "Exception in thread main"
10:45Drakesonnow I have to rm -Rf ~/.m2 and start over :(
10:50Drakesonit turns out that the example (that "lein new" will create), uses clojure "1.1.0", and clojure-contrib "1.1.0", whereas leiningen (git) uses clojure "1.2.0-master-SNAPSHOT", and clojure-contrib "1.2.0-SNAPSHOT". Now, why should getting deps of both projects (the example project, and leiningen itself) put ~/.m2 in a broken state?
10:51S11001001how do you know that the maven repo is broken?
10:52Drakesonwell, I am not sure, but lein never works after I do that
10:52Drakesoncould you try that?
10:52Drakeson(and possibly risk breaking your ~/.m2)
10:53cemerickDrakeson: your .m2 isn't broken, lein is just specifying incompatible deps
10:54cemerickif you change the versions in your project.clj, that should resolve it (not that I know jack about lein)
10:55Drakesoncemerick: but lein was not working anywhere else (not just in the directory where that faulty project.clj was)
10:57cemerickDrakeson: I guess I don't have a solution for you, then. The .m2 repo is almost certainly not broken, though -- don't conflate the maven bits that lein uses with lein itself.
10:58jcromartieclojurebot: for
10:58clojurebotfor is a loop...in Java
10:59Drakesoncemerick: thanks, that's relieving to know. I'll try to reproduce a couple of times and file a bug report ...
11:02S11001001Drakeson: doing lein install in leiningen shouldn't change the installed version of leiningen unless you're doing something else with the `lein' shell script
11:10DrakesonS11001001: do you have leiningen from git?
11:10DrakesonI just tried again, and it breaks everytime.
11:15arohnerI did not think it was possible. I just wrote clojure code that is *faster* than java
11:16arohnerhttp://www.assembla.com/spaces/clojure/tickets/231 part 2
11:23S11001001Drakeson: my configuration currently being rather delicate, what with including a patched Maven and Leiningen, I would rather not :)
11:24S11001001well I guess I could cp -al it
11:24Drakesonreproducing the bug:
11:24Drakesonhttp://clojure.pastebin.com/TZ5A1QdV
11:35Drakesonhttp://github.com/technomancy/leiningen/issues/issue/25
11:49S11001001Drakeson: I figured it out
11:50S11001001Drakeson: can you try something for me?
11:55DrakesonS11001001: yeah, sure
11:56S11001001Drakeson: delete this file ~/.m2/repository/org/clojure/clojure/1.1.0/clojure-1.1.0.jar and try running a currently failing lein operation
11:57S11001001I love cp -al :)
11:57technomancyDrakeson: what's the problem?
11:57Drakesonthere is a bug report :p
11:57Drakesonhttp://github.com/technomancy/leiningen/issues/issue/25
11:58S11001001technomancy: and I think I've figured out the problem
11:58S11001001Drakeson: btw I've done what I'm asking you to do and it confirmed my suspicions
11:59technomancyDrakeson: someone else reported problems with the upgrade to clojure 1.2.0-SNAPSHOT. maybe try rolling back in leiningen's project.clj file
11:59Drakesontechnomancy: apparently, when both 1.2.0-SNAPSHOT and 1.1.0 get installed, lein stops working
12:00technomancyDrakeson: hmm... can't reproduce here according to that gist
12:00S11001001explanation is on the bug report
12:00DrakesonS11001001: yes, your suggestion works around the issue
12:00S11001001that is, the explanation I just added
12:02S11001001reproducing the bug depends on calling the lein script that exists in the git repo
12:02S11001001you can also get it to happen with an uberjar, it's just harder to break that
12:15hugodDrakeson: did you do a lein deps in the leiningen checkout after git pull
12:16Drakesonline 19 in http://gist.github.com/329308
12:16Drakesonhugod: ;)
12:16hugodah - it wasn't in the line you pasted here
12:20stuartsierraIs print-method considered part of the public API?
12:22stuartsierra~seen cgrand
12:22clojurebotcgrand was last seen quiting IRC, 237 minutes ago
12:23chouserstuartsierra: I don't think it's documented anywhere, but I suspect it's widely leveraged.
12:24stuartsierraHmm. Always looked to me like a terrible hack.
12:25chouseroh?
12:26chouserisn't it a straight-ahead multimethod?
12:26stuartsierraWell, it seems to break a lot: structmaps, datatypes (?)
12:26stuartsierraHonestly, I never figured out the relationship among pr, print-dup, and print-method.
12:27chouserhey, I fixed it for datatypes!
12:27chouser;-)
12:27stuartsierraoh, good
12:27chouserbe seriously, those are just missing implementations, or implementations that intentionally produce output that can't then be read.
12:28stuartsierraSo what's the difference between print-dup and print-method?
12:29chouserhm... I guess print-method is less verbose for casual repl use.
12:29stuartsierrahuh?
12:30chouser,(binding [*print-dup* true] (prn (array-map 1 2 3 4)))
12:31clojurebot#=(clojure.lang.PersistentArrayMap/create {1 2, 3 4})
12:31chouserit's usually nice to not see that kind of detail.
12:31stuartsierraok, but print-method and print-dup do different things, for example with classes.
12:32stuartsierraSometimes print-dup calls print-method
12:32arohnerare there tests for deftypes yet? I should add some for my bug, but I don't see a file
12:34stuartsierraSometimes print-method checks the value of *print-dup*
12:35chouserhm. Well, perhaps the implementation of the two could stand some clean-up.
12:35stuartsierraok
12:36stuartsierraI guess what I'm not clear on is the roles that print-dup and print-method are meant to fill, and how they relate to pr and print.
12:38stuartsierraAnd if *print-dup* is meant to make everything read-able, it should probably throw an Exception on things that can't be read.
12:38stuartsierraBut then what is print-method for?
12:38stuartsierraI'm going in circles here.
12:40chouserI think *print-dup* is meant, for objects that are supported, to print sufficient readable details that a duplicate object can be created when read.
12:40chouserI believe it is used to compile constants.
12:41chouser*print-method* is meant to produce output at the repl for humans to read.
12:42stuartsierraOk, that's not clear at all from the implementations.
12:42etatehey guys, how do i access a method from within a java .jar from clojure?
12:43etatei keep getting NoClassDefFound errors
12:43stuartsierraetate: You need to add the .jar to your java classpath
12:43chouserI don't think any of that precludes *print-dup* throwing an exception if it can't produce readable output. I'd be curious what rhickey would think of that.
12:44etatestuartsierra: i've added it to the swank-clojure class path (i put the jar in lib in clojurebox)
12:44stuartsierraIt was a FAQ with defstruct: http://stackoverflow.com/questions/1291765
12:45stuartsierraetate: and restarted Clojure?
12:45etatestuartsierra: yep
12:45stuartsierradunno then
12:45etatenow i'm getting two different types of exceptions depending on which namespace i use
12:45etateone is ClassNotFoundException
12:45stuartsierraYou can check with (System/getProperty "java.class.path")
12:46etateaha
12:46duncanmwhat's the process for adding something to clojure.contrib?
12:46duncanmit'd be nice to have a FILTER-BY-NAME function that creates a FilenameFilter
12:47stuartsierraclojure.contrib is stagnant
12:47chouseris it?
12:47stuartsierraI say that as an active committer.
12:47duncanmclojure.contrib.io, i mean
12:47stuartsierraStill stagnant.
12:47duncanmthen what's the up and coming?
12:48etatestuartsierra: looks like the classpath is correct :/
12:48stuartsierraduncanm: oblivion
12:48duncanmthat's some codename?
12:48stuartsierraNo, just a state description.
12:48stuartsierraSorry, I'm a bit maudlin today.
12:48stuartsierraJust ignore me.
12:48duncanmheh, okay
12:49stuartsierraYou can suggest stuff on the -dev list, if people like it, make a ticket, then beg somebody to commit it.
12:49duncanmstuartsierra: well, your name is on clojure.contrib.io
12:49stuartsierraYeah.
12:49stuartsierraThat's another problem.
12:49duncanmit's a problem?
12:50stuartsierraMy name's on a lot of stuff that I've disowned: seq-utils, map-utils, clojure.walk, http.agent, ...
12:51stuartsierraMost of them are code I wrote in a hurry a couple of years ago and now shudder to look at.
12:51dakroneso, refactor time?
12:51stuartsierraRewriting time.
12:51stuartsierraI've been working on rewriting the test framework, but no one's going to use it because it's not source-compatible with clojure.test.
12:52duncanmclojure.contrib.io is pretty new, i thought
12:52stuartsierraNo, just a rename of duck-streams.
12:52dakronesounds like a good learning experience for people, if you were to document how you changed your old code to make it better in small portions
12:52stuartsierraBut I didn't. I started from scratch.
12:52duncanmah right, io is a much better name
12:52stuartsierralazytest, for example, is a complete rethinking of how a Clojure test library should work.
12:53dakroneso explain why the new code is better than the old?
12:53stuartsierraIt shares almost nothing with clojure.test.
12:53chousercontrib is definitely a mixed bag. It contains really useful, commonly-used code, but it suffers from the lack of shepherding.
12:53stuartsierraI will, if I ever finish it.
12:53chouserstuartsierra has done the most and the best at that, but I don't think he likes it. :-/
12:53stuartsierraIt's certainly not interesting work. Especially since I'd rather scrap it all and do it better.
12:54stuartsierraThat and nobody listens to me. ;)
12:54chouserstuartsierra: would it be possible programmatically convert existing test-is tests to your new framework? or (bleh) write a compatibility layer?
12:54stuartsierraI tried a compatibility layer, sort of works until you start using things like fixtures. programamtic conversion is impossible
12:55stuartsierraI designed lazytest to enforce separation between setup and assertion code; clojure.test conflates the two.
12:55stuartsierraErgo, converting from one to the other requires manual refactoring.
12:55chouserI don't think fixtures are used much in test.clojure
12:56stuartsierraThey're not, but some contrib tests use them.
12:56stuartsierraI tried converting all the contrib tests to use it, couldn't make it work.
12:56chouserand if it generates failure reports that are more useful to rhickey, I bet he'd be happy to switch over.
12:57stuartsierraFailure reports might be slightly better, that was another goal.
12:57chouserhe was just complainint about them this morning
12:57stuartsierraAh.
12:58stuartsierraoh yeah, that bug
12:58fogusI know what [B [C [F etc... is, but what about long and boolean?
12:58stuartsierraThat happened when I added fixtures.
12:58chouser,(into-array Boolean/TYPE [])
12:58clojurebot#<boolean[] [Z@1db6b07>
12:58hiredman[Z
12:58fogusgot it
12:59chouserand [J for long
12:59fogusthanks!
12:59chouserobvious. *rolls eyes*
12:59fogusYeah really
12:59hiredmanwell, they can't use L
12:59chouserright, because "L" stands for "Lobject"
12:59fogusand B is already taken
12:59etatenow i'm really confused, getting "unsupported escape sequence" when the class path is correct
13:00etatewhen swank loads
13:00stuartsierrachouser: Honestly, the head-long rush to Leiningen and Clojars discouraged me the most.
13:00hiredmanmavem maven?
13:00hiredmanmaven
13:00stuartsierraYes.
13:00stuartsierraThinly wrapped, if need be, but Maven all the way.
13:01chouserI thought leiningen was a thin wrap of maven.
13:01hiredmanno
13:01stuartsierraIt uses the dependency parts, but no.
13:02stuartsierraRather than participating in the humongous Java build/dev environment, we've split off our own incompatible sub-culture.
13:02etatewould dollar signs in java classes cause problems when put in classpath?
13:02chouserfor the most part, the people using Clojure are still (and will for a while) be very open to change, or we wouldn't be using Clojure yet.
13:02hiredmanat the first seajure meet up at least one person said they had switched to lein for their java builds
13:02stuartsierraack!
13:03stuartsierraDo you want to be responsible for maintaining that?!
13:03stuartsierraYet-another-Java-build-tool?
13:03chouserSomething that can demonstrate its value vs. lein will have a good chance of adoption for a while yet I suspect.
13:04arohnerI personally would rather write a sane java build tool, than continue to use ant/maven
13:04stuartsierraMaven. Just need to get a working archetype into central.
13:04chousersurely clojars is at least compatible with maven?
13:04stuartsierraThen a new project is one copy-and-paste line (admittedly a long line, but one line).
13:04arohnerand actually, I would have gone farther. maven versioning is fundamentally broken
13:04stuartsierrachouser: Roughly, until you get into the AOT compilation problems.
13:04technomancyspeaking of maven, we're still using clojure-maven-plugin at work... is there any way to get -D properties to propagate into your clojure code?
13:05technomancyseems like they just get dropped
13:05stuartsierraYeah, that's probably a side effect of starting a new process.
13:05stuartsierratechnomancy: post on the plugin list, talios will probably fix it eventually
13:05technomancya'ight
13:06stuartsierraBasically, all dependency/build management systems are fundamentally broken in some important way, they just vary on which way.
13:07technomancyyeah, I've come to grips with the fact that by writing a build tool I've set myself up to be hated by future generations of programmers.
13:07technomancycomes with the territory
13:07stuartsierra:)
13:08stuartsierraIs it an impossible problem? Or just a very difficult one?
13:08stuartsierraI'm inclined to the former.
13:08arohnerstuartsierra: I'm pretty sure it's not impossible
13:08technomancyreally obvious after working on RubyGems. people love to complain, but it's basically a one-man show; nobody helps out with it.
13:09stuartsierraThis is the fundamental problem with open-source software: lots of bug reports, very few patches.
13:09technomancyleiningen gets a lot of contributions, but obviously a huge part of that is that there's a lot of low-hanging fruit
13:10technomancyand it's got a very small LOC-count, which won't be true forever.
13:10etatehas anyone got a class_browse.clj exception before when using swank-clojure to load a classpath?
13:10stuartsierraReally? interesting.
13:10technomancyhttp://github.com/technomancy/leiningen/graphs/impact <= makes me happy
13:11stuartsierratechnomancy: never looked at one of those graphs before, but I see your point
13:11stuartsierraOk, I guess I'll just drift quietly into obscurity.
13:12dakronestuartsierra: I can see your point though, it would be really nice to have a unified packaging/building system that will work for Java/C#/clj stuff generically
13:12technomancyyour test work and duck-streams work is awesome... I'm going to be interested in how clojure.lib changes the landscape with regard to that.
13:12dakronefor when clojure-clr is up and running
13:13technomancystuartsierra: has it been frustrating not to have commit access to clojure.test?
13:13stuartsierraa bit
13:13stuartsierraLess so since I started lazytest.
13:13technomancysure, naturally
13:13technomancyI hope the same thing doesn't happen with clojure.lib I mean.
13:14stuartsierraThe popularity of duck-streams continues to astonish me. I never used it much after I wrote it.
13:14technomancystuartsierra: everybody's gotta do I/O.
13:14technomancyhttp://github.com/richhickey/clojure/graphs/impact <= this graph is pretty cool too; see if you can figure out when the switch to git happened =)
13:15stuartsierrahih
13:15stuartsierraheh
13:15chousertechnomancy: there were patches from others before the switch to github, but those are attributed to rhickey because of svn
13:16stuartsierraIf clojure is to have a standard library, it will require a full-time BDFL just like the core.
13:16technomancychouser: right; it's a bit misleading if you don't take that into account.
13:16technomancys/a bit/quite/
13:16sattvikMaven's dependency code has the problem of being very hard to integrate into a larger system, such as a linux distro.
13:16technomancystuartsierra: you don't think a team could do it?
13:16stuartsierranever
13:16stuartsierraToo many arguments about style, argument order, naming, ...
13:17stuartsierrabuild tools ... :)
13:17arohnerI don't remember seeing many of those arguments today
13:17chouserstuartsierra: I thought you'd already been appointed. ;-)
13:17arohnerok, build tools
13:17chouserclojurebot: what do you know about stuartsierra?
13:17clojurebotstuartsierra is volunteering
13:18technomancyI raised that thread a while ago about "hey, we've got a lot of tickets that aren't getting attention, what about getting the community to help out and sanity-check incoming patches"
13:18stuartsierraheh
13:18technomancykind of surprised at the stony silence that was met with
13:18stuartsierraclojurebot: def?
13:18clojurebotdeftype is see datatype
13:18stuartsierraHow do I redefine myself?
13:19technomancyarohner: see, that's what I'm talking about. =)
13:19chouserclojurebot: stuartsierra is awesome
13:19clojurebot'Sea, mhuise.
13:19stuartsierraclojurebot: stuartsierra is retiring
13:19clojurebot'Sea, mhuise.
13:19chouserclojurebot: now what do you know about stuartsierra?
13:19clojurebotstuartsierra is volunteering
13:19chouserhehe.
13:19stuartsierraha!
13:19stuartsierraI can't escape!
13:19technomancyarohner: probably better if you found someone who'd actually used deftype to review it though, sorry.
13:20technomancyI think clojurebot has a list of facts for each term and chooses randomly
13:20technomancyyou have to tell him to forget things if you want to change it
13:20technomancy(iirc)
13:20stuartsierraclojurebot: forget stuartsierra
13:20clojurebotI forgot stuartsierra
13:20dakronewhat do you mean by "sanity check", just reproduce the problem?
13:20chouser:-(
13:20stuartsierraclojurebot: stuartsierra?
13:20clojurebotstuartsierra is retiring
13:20stuartsierra:P
13:21arohnerdakrone: reproduce the problem, review the code and see that it's good. in my case, rhickey also complained that my first patch was slow, so see that this one is fast
13:21dakronearohner: well, I can reproduce it, if that help at all
13:22arohnerwhile we're (sort of) on the subject of tests: where should unit tests in clojure.core for deftypes go?
13:22stuartsierraprobably in a new file
13:22arohnerwhat about the default ipersistent map deftype?
13:23stuartsierrawhat about it?
13:24arohnermy patch was about a bug in the default IPersistentMap implemention of deftype
13:24arohnerIMO, it should be next to the other tests on maps
13:24stuartsierraI doubt it, it's still a bug specific to deftype
13:25arohner*shrug* either way is fine with me.
13:25stuartsierraHonestly, just writing tests puts you in a rarefied class.
13:25arohnerthey're not written yet :-)
13:26stuartsierraAh, well then.
13:26stuartsierraI think I'm becoming the grumpy old-timer of the Clojure community.
13:26stuartsierraTime to move on, bother some other channel.
13:34jeldhello
13:34Licensergreetings my lispy friends!
13:34jeldclojure-contrib build fails unit tests under cygwin, could someone remind me the flag I need to give maven to skip the tests?
13:35dakronejeld: -Dmaven.test.skip
13:35jelddakrone: !!!
13:53S11001001stuartsierra: what kinds of AOT compilation problems do you mean with clojars, I mean other than clojure version-matching?
13:54crowbar7my clojure book came today. yippie
14:01cemerickhrm, glad I missed the build tool discussion
14:01chouserperhaps stuartsierra could have used your support
14:01Licensercongrats crowbar7
14:01cemerickI've gone hoarse from it before :-/
14:02cemerickI think it's all up to technomancy now. I'll get the pillow.
14:02crowbar7time to read it
14:02cemerickI bumped into someone who switched their java project from ant to lein + the javac plugin
14:16dnolenanybody messed with Google AppEngine and Enlive?
15:09etatewoah finally, ogre4j loaded woo
15:12rem7hi, im working with incanter and I have an incanter.Matrix and I want to convert it to a PresistantArrayMap so that I can plot it with xy-plot (or atlease thats what I think I have to do) anyone know how?
15:14hiredmanwell, what is a incanter.Matrix
15:14hiredmanis it a java.util.Collection? is it Iterable?
15:14fogusit follows the seq protocol
15:15rem7hiredman: humm.. how do I figure that out
15:15hiredmanrem7: well fogus says it is sequable
15:16hiredmanso you can use any of the sequence functions on it to do whatever
15:17fogusrem7: Doesn't xy-plot take a dataset?
15:18stuartsierraIs it possible to recover the line on which a form was read from within a macro?
15:18rem7fogus: yeah, isn't a data set a PresistantArrayMap?
15:19rem7fogus: there is a to-dataset function, im gonna try that
15:19fogusrem7: it is, but I think that's just an implementation detail
15:20hiredmanstuartsierra: like (line-of ()) ?
15:20hiredmanwhere line-of would just look at the metadata?
15:21stuartsierrahiredman: like I have a macro with a & body argument, and I want to recover the line numbers of each form in the body and use them in the macro.
15:21fogusrem7: seems to work: (to-dataset (matrix [[1 0] [0 1]]))
15:22hiredmanI don't think the reader attaches that metadata to all forms
15:22stuartsierraYeah, that's what I thought.
15:23hiredmanbut (defmacro m [x] (:line (meta x))) works from simple cases
15:23hiredmanfor
15:23stuartsierraok, that might be sufficient
15:23rem7fogus: yeah I think I got it converted to a data set...
15:24rem7fogus: trying to figure out how to plot it
15:24chousersince the reader and read things that don't support metadata, line number metadata is not added to all thing.
15:25chouserbut I think all collections get a line number
15:25hiredmanI think it may just be lists
15:26fogusrem7: http://wiki.github.com/liebke/incanter/sample-plots-in-incanter
15:26hiredmanyeah, I think the listreader is the only collection reader that attaches metadata
15:26chouserhiredman: ah, I do think you're right.
15:26hiredman(think in this case means "I'm pretty sure" because I'm looking at the java)
15:27stuartsierraok, time for some experiments
15:27liebkerem7: to plot the first two columns from a matrix do: (view (xy-plot 0 1 :data (to-dataset my-matrix)))
15:27chouser,(meta (first '(())))
15:27clojurebotnil
15:27chouser,(meta (first '((foo))))
15:27clojurebotnil
15:27liebkerem7: or (with-data my-mat (view (xy-plot ($ 0) ($ 1)))
15:27hiredman() doesn't get metadata for some reason
15:27liebke:)
15:28stuartsierramaybe it's a singleton
15:28hiredmanpossibly
15:28hiredmanit is
15:28fogusliebke: welcome back
15:29liebkefogus: thanks
15:29chouserof course you can still apply metadata to the empty list even though it starts as a singleton.
15:29stuartsierraYeah, only lists get line number metadata. Still, that's useful.
15:29liebkerem7: or just do (view (xy-plot 0 1 :data my-mat))
15:30chouserbut I'd guess the point is that things that could be function calls get line numbers
15:30hiredmanthere may be a *line* var in the compiler somewhere
15:30hiredmanbut accessing that would prove tricky
15:30stuartsierrahiredman: There's @Compiler/LINE, but I don't know by what rules it's updated.
15:30stuartsierraAnd you can't grab it in the middle of a macro as far as I know.
15:30stuartsierraJust at the start.
15:30hiredmanright
15:31chouserclojure.lang.Compiler/LINE at macroexpand time gives you the line number where the macro is being expanded.
15:31chouserso ... probably the same as (:line &form) now?
15:31seangroveHey all, I can't seem to get lein working correcntly
15:31stuartsierraright, not much help in a 20-line macro.
15:31chouserstuartsierra: right.
15:32stuartsierrahmm
15:32seangroveI installed clojure via ClojureX, and clj work from the command line, but I get this whenever trying to do anything lein related: http://gist.github.com/329616
15:32rem7liebke, fogus, thanks that worked :)
15:33seangroveI'm more of a scheme guy myself, not very familiar with Java-land, but it seems like my clojure jar is not correct, perhaps?
15:33liebkecool :)
15:34technomancyseangrove: your project is using dependencies that have been AOT-compiled with the wrong version of clojure
15:34seangrovetechnomancy: Should I compile clojure from source, perhaps?
15:34seangroveOr is that a day-long project?
15:34technomancyseangrove: shouldn't be necessary; just make sure you're using the right version of your dependencies. (contrib version must match clojure version, etc.) what's project.clj look like?
15:35technomancyI recommend against building your own clojure unless you are working on a patch to clojure itself. generally use build.clojure.org
15:36hiredmanerrors mentioning RestFn almost always mean you have compiled code that is not binary compatible with your version of clojure
15:36seangroveIs that perhaps the version of lein I've installed isn't compatible with the version of clojure I have?
15:37seangroveI'm using Clojure 1.2.0-master-SNAPSHOT
15:38hiredmanpossibly one of you dependencies (including clojure-contrib)
15:39chouseroh no -- proxy doesn't work with protocols, does it.
15:40chouserand reify doesn't work with concrete classes
15:40_atolein bundles its own version of clojure, but unless you have an old versions it runs compiles in a seperate classloader with the clojure version you specify in the project file
15:41hiredmanISmuggle
15:41chouserexactly
15:41chouserI suppose I could use definterface
15:41chouserthat's reloadable, right?
15:42hiredmanuh, I dunno
15:44LicenserI feel stupid I fail to run a jar -cp seems to be entirely ignored o.O I tried java -cp ./lib -jar ... java -cp ./lib/clojure-1.1.0.jar -jar ... nothing seems to work
15:45arohnerare there snapshot builds of compojure? I need a jar I can pull from lein, that contains a bugfix that isn't in the most recent official release
15:45hiredman-cp is ignored when you use -jar
15:45Licenser:( gar
15:45Licenseris $CLASSPATH too?
15:45hiredmanI forget
15:45nteonhiredman: really?!? thats just mean of java
15:46hiredmanI know with -cp, $CLASSPATH is ignored
15:46chouserI think with -jar, everything else is ignored
15:46Licenserso how can I run a jar that requires other jars?
15:47hiredmanjava -cp ajar:bjar some.class
15:47chouserLicenser: put them all in the classpath, then name on the command-line the class with the main method you want to run
15:47Licenserahhh
15:47_atoarohner: http://clojars.org/org.buntin/compojure <-- this one seems to be from feb 24
15:48Licenserah sneaky!
15:48arohner_ato: I need one from mar 3 or later
15:48Licenserthanks hiredman, chouser
15:48clojurebothiredman <3 XeLaTeX
15:48_atoarohner: you'll probably need to make your own then
15:49arohner_ato: and then I can just push it to clojars?
15:50_atoarohner: yeah, just remember change the group and version number in project.clj before you upload, so something like: (defproject org.clojars.arohner/compjure "0.4.0-SNAPSHOT" ...
15:51arohner_ato: thanks!
15:54crowbar7am I missing something or can I not just browse all the clojure libs at clojars?
15:54hiredmanhttp://clojars.org/repo
15:55crowbar7ok, nothing on the site itself for that
15:56crowbar7thanks
15:57crowbar7i mean link on the site page
15:58seangroveSo I've downloaded both the clojure.jar and clojure-contrib jars from build.clojure.org, and put them in /System/Library/Java/Extensions (in os x, obviously), should java be able to fine them in there?
15:59seangroveSeems that lein works at least now
16:04tomojif you're using lein, you shouldn't have to put those there
16:04tomoj"lein self-install" should put the jars somewhere so that lein can find them
16:04tomojthen, in your project.clj you will refer to the clojure version you want, 'lein deps' downloads it into lib/
16:05arohner_ato: I broke the clojars UI, though on the other hand, I'm very happy with the result
16:05arohnerhttp://clojars.org/org.clojars.arohner/compojure
16:05arohnerthat's the github SHA1 this was built from
16:05_atohehe
16:05arohnerwhich completely resolves my issues with semantic versioning being completely broken
16:05_atomy poor constrained layout
16:05hiredmannice
16:10seangrovetomoj: So lein can download clojure jars?
16:12tomojseangrove: yep
16:14triyoIs there a way to refer to function who's name will not be realized until runtime? So basically is there a way, from a string I guess, to construct a function ref + call?
16:15dakronetriyo: like (declare foo) ?
16:15hiredmanwhat do you mean "name will not be realized"
16:16hiredmanfunctions can be bound to names, but the names are not an intrinsic property of the functions
16:17triyoI have a macro that introduces a new function when called. This function will be called make-(name-passed-in-as-param)
16:17dakroneyou shouldn't need a forward declaration for that
16:17triyoI have a function that will need to apply that function at runtime
16:18dakroneahh
16:19duncanmwhy is it that calls to System.out.println don't print out to the console when running under SLIME?
16:19triyoI could use a macro to do something like `(apply ~(symbol (str "make-" entype)) ... but macro wont do in my case....
16:20ska2342duncanm: you're printing from other threads? take a look in the *inferior-lisp* buffer. Do you find your output there?
16:24duncanmska2342: hmm, i don't have an *inferior-lisp* buffer
16:24duncanmi'm using M-x slime-connect to start the session
16:26ska2342duncanm: ooh, last time I did that I was on CL and over there I always had my output in the REPL buffer. Great help, I know. Hm, what was the swank call to start the server again?
16:29LicenserI have a odd error: clojure.lang.PersistentStructMap cannot be cast to clojure.lang.IDeref and am not sure what exactly caused it
16:30dakronetriyo: can I see the code and how you're doing it?
16:30dakronetriyo: I do the same thing with a macro and have no problems with using it as a function
16:31dakroneor are you trying to to AOT compile it?
16:31LicenserI have no exact idea how that happens :( is the sad thing
16:31hiredmanLicenser: means you are trying to deref a map
16:31hiredman,@{}
16:31clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IDeref
16:31Licensercool :)
16:31hiredman,(deref {})
16:31clojurebotjava.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IDeref
16:31Licenserhiredman: can you tell me why you know everything?
16:32Licenserand tanks a lot
16:32hiredmanvery boring job, so I do a lot of reading
16:33Licenserheh
16:34triyodakrone: http://gist.github.com/329685
16:34hiredmanhorrible
16:35Licenseranyway you're my hero again hiredman :)
16:35ska2342triyo: you may need to (resolve) the symbol, no?
16:36ska2342,((resolve (symbol "println")) "Hello World")
16:36clojurebotHello World
16:38triyoska2342: exactly. Let me have a quick look to confirm
16:39triyothis will allow me to make map->entity into a function instead of macro.
16:40arohnertechnomancy: are you aware of any .debs for leiningen yet?
16:42LicenserIt is so frustrating if you debug an houre to find a problem and then realize the problem is that you changed something an houre ago to fix another problem o.O
16:44seangroveHrm, confused about this - Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn
16:45hiredmanseangrove: the clojure jar is not on your classpath
16:45seangroveIs that something I've done wrong, an incompatible clojure version...?
16:45technomancyarohner: not sure if that last bit came through; just said someone talked about creating a deb on the mailing list, but I don't know if anything came of it
16:45seangroveah
16:45hiredmanno, that means no clojure at all
16:46arohnertechnomancy: no problems. I was just wondering if there was an easier way before I add 'lein self-install' to my own project's .deb
16:46technomancyarohner: what's your project?
16:47seangrovehiredman: http://pastie.org/865656
16:47seangroveAm I perhaps using the -cp option wrong?
16:47triyoska2342: that worked perfectly. I could now change map->entity to a function and the multimethod would call map->entity at the correct time and work 100% with desired results.
16:47arohnertechnomancy: a webapp that uses machine learning to automate troubleshooting / tech support
16:48hiredmanseangrove: you cannot use -jar and -cp together
16:48hiredman 12:46 hiredman : -cp is ignored when you use -jar
16:48seangroveAh...
16:48hiredmanwow, four minutes ago
16:48arohnertechnomancy: to deploy, we start a pristine EC2 ubuntu, and apt-get install our own .deb
16:49hiredmanI thought it might have been at least ten
16:49seangroveHaha
16:49seangroveSorry for that
16:49technomancyarohner: yeah... I've been musing about deployments with lein and haven't really thought it all the way through yet
16:49seangroveAnd thank you for your patience ;)
16:49ska2342triyo: fine :-) Cool as macros are, avoiding them is usually the best way. And as a rule of thumb: if you are new to lisp, you won't need a macro in your first year (or month, or week, depending on your genius ;-)
16:51technomancybeyond just uberjar of course
16:52technomancyactually I would look into hashdot for deployments since it lets you set JVM options in your clojure code itself and use a proper shebang
16:52arohnertechnomancy: we use a .deb because we need ubuntu dependencies as well. As for starting up, we just use a bash script
16:54arohnerthough hashdot looks pretty cool
16:54technomancyit's cool but unpolished. you have to edit the makefile to install it. =\
16:55technomancyneeds someone who really knows the C build tools to go in and give it some love. I tried, but make is pretty insane.
16:55technomancyall the docs for it assume you know C
16:55arohnerI have a history of fixing insane makefiles. I'm not doing it again
16:55arohner:-)
16:56arohnermy last day job had a 10k LoC in makefiles, for a single project
16:59triyoska2342: well that one example ran me nicely into a wall but I could see the exact reason and new that I needed to push that code to runtime and hence wouldn't work in the macro expansion time. I do stay away from them in general so far, but sometimes macros just do seem the best fit for the job at hand (famous last words. Trying to count num of times I turned a macro into a function.. hmm).
16:59crowbar7hiredman: I see you use a macbook. p
17:04hiredmancrowbar7: huh?
17:05crowbar7hiredman: from the pastebin you posted
17:05crowbar7ohh wait nvm
17:05crowbar7sorry
17:05crowbar7I read that wrong
17:29dakroneout of personal curiosity, any of you live around the Denver/Boulder, CO, USA area?
17:33cljneohi, question about swank on windows. Where should I put leiningen-1.1.0-standalone. When I type M-x slime, I get the error Could not locate swank/swank_init.class on classpath
17:37tomojcljneo: use lein-swank ?
17:37tomojdunno windows-land, though
17:37tomojbut I never use M-x slime for clojure
17:37cljneoI do but it is not working
17:37cljneoit says that swank is not a recognized plugin
17:38cljneotomoj: what do you use if not M-x slime?
17:39mattikuscljneo: do you have a .emacs config that you're particularly fond of? If not, you could try clojure-box or emacs-start-kit
17:39tomojeither 'M-x swank-clojure-project', or, more often, 'M-x slime-connect' with lein-swank
17:39tomojmake sure you have the latest stable lein
17:39tomojand test on a project.clj created with 'lein new'
17:40tomojyou should have at least clojure-mode and swank-clojure installed from elpa
17:40cljneoI had Clojure Box but then I installed Emacs and at first it was working anad then I forgot what I did and then it stopped
17:40tomoj(unless you want to do it manually, in which case, good luck, but I don't have any clue how to help :/)
17:40clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
17:40cljneosome things work in lein (like new) but other do not, like compile.
17:41cljneoI have elpa and I have all the required packages installed and I have leiningen also
17:42cljneotomoj: do you recommend a specific small Linux package that I could use in VirtualBox and is suitable for Clojure with emacs ?
17:42cljneoI meant Linux distro
17:45Drakesonhow can I define a new variable in clojure.core?
17:45RaynesUse some sort of mind control device on rhickey.
17:46hiredman,(ns-map (create-ns 'clojure.core))
17:46clojurebot{sorted-map #'clojure.core/sorted-map, read-line #'clojure.core/read-line, re-pattern #'clojure.core/re-pattern, keyword? #'clojure.core/keyword?, ClassVisitor clojure.asm.ClassVisitor, asm-type #'clojure.core/asm-type, val #'clojure.core/val, ProcessBuilder java.lang.ProcessBuilder, chunked-seq? #'clojure.core/chunked-seq?, Enum java.lang.Enum, SuppressWarnings java.lang.SuppressWarnings, *compile-path* #'clojure.core/*co
17:50dakroneis there a way in clojure to mark a method as deprecated?
17:52hiredmanput "Depricated" in the docstring
17:52hiredman(when *assert* (println "DEPRICATED"))
18:03Licensergood greif this isn't easy o.O
18:03Licenserjust a question about posibility, is it posible to do bindings dynamically during runtime or am I trying something ... imposible?
18:04hiredmanwhat do you mean?
18:06LicenserAh found my mistake :) I want to allow the sandbox to hold bound variables depending on the call as you dynamically rebinding *out* or other special or non speclai variables
18:13etateis there blogging software that supports clojure code?
18:13Licenserhrm or not
18:13dakronehiredman: there's no way to mark deprecated in metadata and have compiler/runtime warnings about it then?
18:16tomojetate: one option is to embed gists
18:16sattviketate: In what sense? I suppose any Java-based software can run Clojure. There is one Clojure-based blog I know of: http://github.com/briancarper/cow-blog I am considering doing Clojure port of blosxom.
18:17tomojI know someone has also hacked up wordpress
18:17tomoj(I assumed you meant highlighting)
18:18hiredmandakrone: nope
18:19dakronehiredman: okay, thanks for the verification
18:34Licenserweeehee, the sandbox now even allows dynamically binding things :D
18:35Licenserso now nothing will stand in the way of making my game scriptable!
18:37dakroneLicenser: what kind of game are you working on?
18:38G0SUBHello. Given a symbol, how can I find out the var that points to that symbol? (var sym) works on the repl, but not inside a function.
18:39hiredmanvars don't point to symbols
18:39G0SUByeah, I didn't mean that.
18:39hiredmanvars can have a name, and those names are symbols
18:39hiredman,(resolve '+)
18:39clojurebot#'clojure.core/+
18:39G0SUBbasically I want to figure out the var which is pointed to by the symbol.
18:40hiredman,(doc find-var)
18:40clojurebot"([sym]); Returns the global var named by the namespace-qualified symbol, or nil if no var with that name."
18:41G0SUBhiredman, cool
18:43etateLicenser: in case you're interested i've just started working on ogre4j bindings
18:44Licenseretate: cool thanks for the info so I am writing my own engine :) that is the whole fun in it.
18:45etateLicenser: good luck with that :)
18:45Licenseretate: thanks :) and it's working great if you want to have a look: http://playground.licenser.net:3000/fight-designer.html
18:46Licenserif you want to add a fight enter #clojure.de as token so it isn't blocked
18:46Licenserand now that I got the sandbox mostly working next step will be to allow people own AI scripts for the units
18:50etateLicenser: i get a timeout when visiting that page
18:50Licenserhmm it's working for me I just tested it
18:50etatebtw how do you make sure defed vars start in the same thread?
18:51Licenserhmm what exactly do you mean?
18:52etatewhen I call new from two separate functions on two different java classes, it starts them in the 'wrong thread'
18:52etatei assume this means they are started in separate threads
18:53Licenserwow okay that sounds strange, so I didn't really touch java classes they are ... javaish
18:53etateindeed
18:53hiredmanetate: if you could pastebin a small test case and the exception
18:53etatehiredman: sure one sec i'll pastebin it
18:54Licenseretate: now you're in good hands, hiredman knows everything :p
18:55Licenserwell anyway bed time for germans here :) have a good night and happy coding!
18:55etatehmm no syntax highlighting for clojure in pastebin
18:56hiredmangist has it
18:56dakronepastie.org does too
18:56hiredmanpaste.lisp.org has basic lisp hilighting
18:57technomancyscpaste!
18:57technomancyhttp://p.hagelb.org
18:57etatehttp://gist.github.com/329869
18:58hiredmanare you familiar with the edt?
18:58etatehiredman: right at the bottom of the paste theres the error
18:58dakronepost via scp? don't you guys have gist web-app posting scripts? :P
18:59etatehiredman: the first two functions are what create the shell and the canvas
19:00technomancydakrone: yeah, but gist can go down
19:00technomancyscp+static HTML never breaks.
19:00dakronetechnomancy: true, unless you're behind a firewall that only allows port 80
19:01hiredmanetate: my guess is the opengl stuff needs to be manipulated on the EDT or in its own thread
19:01technomancydakrone: if you can't use SSH, you've already lost
19:01dakroneas (sadly), I am
19:02etatehiredman: i'm just confused why those are separate threads at all
19:02etatehiredman: since its one function calling another
19:03technomancydakrone: good grief man; where do you work? =\
19:03dakroneEMC
19:03hiredmanetate: I think wrong thread means they are both running on the same wrong thread, not that they are running on different threads
19:04etatehiredman: oh i see, hmm, i thought there was only one thread in this code though
19:04dakronetechnomancy: it's not all bad, I get port 443 too! :P
19:04hiredmanetate: the jvm is never only one thread
19:05hiredmanwell
19:05technomancymy condolances
19:05hiredmannever when you running a gui
19:06etatehiredman: is there a simple way of ensuring that the code stays in the same thread?
19:07arohneretate: why would you want to? we're using clojure for a reason :-)
19:07arohnernm, I think I get it
19:08etatearohner: i'm trying to bind to ogre4j, and i'm getting "wrong thread" errors
19:08arohneretate: are you using slime?
19:09etatearohner: yes
19:09hiredmanetate: the code does stay on the same thread
19:09hiredmanhow are you starting this?
19:09etatehiredman: ctrl-c ctrl-c :)
19:10arohneretate: when using any of the "load code via slime" fns, it happens in a different thread from your slime repl
19:10arohnerrestart the process and do everything from the console, and see what happens
19:10etatearohner: okay i'll try that
19:13hiredmanyeah
19:13hiredmanswt has some stuff like for running code from worker threads on the ui thread which you could use
19:14hiredmanDisplay.syncExec/asyncExec
19:14etatehiredman: useful, i'm getting an error when running from console "ClassCastException NO_SOURCE_FILE"
19:15etatehiredman: I'll try the def approach to see whether shell binds to the wrong thread
19:15hiredmanetate: that is not the whole exception
19:15hiredman"the def approach" ?
19:16etatehiredman: as in the bottom of the pasted source file, instead of calling setup(), to call each function by using (def x (fn ...))
19:16hiredmanuh, why would that make a difference?
19:17hiredmanthat is still going to be run on a slime thread somewhere
19:17etatehiredman: even from the console?
19:17etatehiredman: it would be to test the difference from the console than from slime
19:17hiredmanbut why change your code?
19:19etatehiredman: {:shell #<Shell Shell {}>, :canvas #<GLCanvas GLCanvas {}>}
19:20etatehiredman: thats what it gives me when i do it from the console
19:20hiredmanso its good then?
19:21hiredmanif so the problem is slime running it on the wrong thread
19:22etatehiredman: nope, still get: java.lang.ClassCastException (NO_SOURCE_FILE:21)
19:22rickmodehey how can I give the app I launched with lein swank more heap?
19:22etatehiredman: but its a different error than "wrong thread" at least :)
19:22rickmodelike lein swank -Xmx1g
19:22hiredmanetate: (.printStacktrace *e)
19:22hiredmanthe repl doesn't print the whole stracktrace, but the last exception is bound to *e
19:23hiredman.printStackTrace
19:23etatehiredman: yeah i just did that and it says it comes from clojure.lang.Compiler$InvokeExpr.eval
19:23etate+ alot of other stuff
19:24hiredmanare you sure that is the right exception
19:24hiredmanif it is, pastebin it
19:25etatehiredman: http://gist.github.com/329896
19:27etatehiredman: seems to be coming from the createRenderWindow if i read the stacktrace correctly
19:28hiredmanetate: yeah
19:29hiredmanyou are using some archaic style there
19:29hiredmanthese days almost no one uses . directly
19:29etatehiredman: haha, its my first day with clojure :)
19:29hiredmanand noone uses ..
19:29etatehiredman: what do you use instead of .. ?
19:29hiredman(.method object arg1 arg2)
19:30hiredman-> instead of ..
19:30hiredman,(-> "foo" .getBytes String.)
19:30clojurebot"foo"
19:30hiredman,(-> "foo" .getBytes first int)
19:30clojurebot102
19:30hiredman,(-> "foo" .getBytes first int inc)
19:30clojurebot103
19:31hiredmanstatic methods are (ClassName/methodName arg1 arg2)
19:32etatewhat does (-> "foo" .getBytes String.) translate to in java?
19:32hiredmannew String("foo".getBytes())
19:33hiredman(macroexpand-1 '(String. (.getBytes "foo")))
19:33hiredman,(macroexpand-1 '(String. (.getBytes "foo")))
19:33clojurebot(new String (.getBytes "foo"))
19:33hiredman,(macroexpand '(String. (.getBytes "foo")))
19:33clojurebot(new String (.getBytes "foo"))
19:33hiredmanbleh
19:34hiredman,(macroexpand-1 '(.getBytes "foo"))
19:34clojurebot(. "foo" getBytes)
19:36etatehmm so (-> canvas .getBounds .width) == canvas.getBounds().width ?
19:36hiredman()
19:37hiredmanyes
19:37hiredmanand you can also mix in normal functions
19:37hiredman,(-> 1/2 .denominator inc)
19:37clojurebot3
19:38etatehiredman still gives me the same exn
19:39hiredmanoh, I didn't mean to imply changing it would fix it :/
19:39hiredmanwhat arguments does that method take?
19:39hiredman(where are the javadocs)
19:40etatehiredman: thats a very good question
19:41etatehiredman: i'm using this: http://ogre4j.svn.sourceforge.net/viewvc/ogre4j/trunk/org.ogre4j.examples.swt/src/org/ogre4j/examples/swt/HelloWorld.java?view=markup
19:42hiredmanoh
19:42hiredmanI assumed you accidently left the () off of canvas.getBounds().width
19:43hiredmanyou'll want (-> canvas .getBounds .getWidth)
19:43etatehiredman: how did you find that out?
19:44hiredmanit's a guess
19:45etatehiredman: no matching field found getWidth for class :)
19:46hiredmanwell, .width will work too
19:47rickmodeis this thing on? I can't tell if my questions are lame or if my IRC client is wonky.....
19:47etatehiredman: so to do canvas.getBound().width its (-> canvas .getBounds .width) or (-> canvas .getBounds width)
19:48etatecanvas.getBounds().width even
19:48hiredmanrickmode: this is the first I've heard from you
19:48etaterickmode: its still on but i didn't see any questions
19:49hiredmanetate: (->> Root .getMethods (filter #(= (.getName %) "createRenderWindow")))
19:50etatehiredman: wt.. :)
19:50hiredman->> is like ->, but slightly different
19:50etatehiredman: aah wow
19:51etatehiredman: its supposed to take two longs instead of ints
19:51rickmodelol... ok thanks guys - I guess interjecting a question in the middle of another thread is less than ideal
19:51hiredman,(doc long)
19:51clojurebot"([x]); Coerce to long"
19:51etate([x]) coerces to long?
19:51hiredmanno
19:51hiredman,(doc long)
19:51clojurebot"([x]); Coerce to long"
19:52hiredmanhave you seen doc yet?
19:52hiredman(doc +) in the repl
19:52clojurebot"([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."
19:52etateaaah (long x) coerces to long
19:52hiredmanyes
19:52etatehiredman: no i come from CL, i've never been in JVM land or clojure land before today
19:53hiredmanso clojure attaches docstrings as metadata to vars holding functions
19:53hiredman,(meta (var clojure.core/+))
19:53clojurebot{:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 676, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$_PLUS___4516 clojure.core$_PLUS___4516@7acb6f>, :doc "Returns the sum of nums. (+) returns 0."}
19:54etateawesome
19:54hiredmandoc lets you read docs
19:54radsis there a way to set a binding in a fixture in clojure.test? I tried (use-fixtures :once #(binding [*env* :test] (%))), but *env* remains unbound
19:55etatehiredman: damn still the same ClassCastException :(
19:55hiredmanso whatelse? are you sure the signature actually matches?
19:56hiredmanif you print out the class of each argument before you call the method, does it match?
19:56hiredman,(doto :x prn)
19:56clojurebot:x
19:56clojurebot:x
19:57etatehiredman: just checking
19:57hiredman,(doto :x (-> class prn))
19:57clojurebot:x
19:57clojurebotclojure.lang.Keyword
20:01etatehiredman: nice it got past that error, i was passing a hash where i should pass another value
20:01etatehiredman: however now the JVM crashes :)
20:04hiredmanfun
20:04etatehiredman: hmm this one is difficult to debug
20:05etatehiredman: in the native stack frames it shows me the interpreted call to the createRenderWindow method
20:05etatehiredman: then the RenderSystem_GL dll, and then at the top KERNELBASE.dll
20:06hiredman:(
20:06etatehiredman: i wild guess would lead me to conclude the error is still coming from this method
20:06hiredmanwell, from inside the method now
20:07hiredmandoes the java version work?
20:07etatehiredman: i haven't tried the java version :/
20:07etatehiredman: java scares me
20:07hiredman*shrug*
20:07hiredmanI'm leaving
20:07etatehiredman: thanks for your help
20:08etatehiredman: was very informative :)
20:54radsis there a way to apply a fixture to multiple test files using clojure.test?
20:59technomancyrads: it's done on a per-namespace basis
20:59technomancybut you can share your fixture var and call use-fixtures in each namespace
21:09hiredmandoes it ever bother anyone that we are "quoting" with an apostrophe?
21:10somniumhiredman: I"ve never lost any sleep over it.
21:18seangroveHey all, can I not use (ns jelly.graphics
21:18seangrove (:import 'net.philh.cloggle)) ?
21:18seangroveThat works if I use :require rathat than :import
21:18seangroverather*
21:18seangroveThat's a clj file located at /net/philh/cloggle.clj
21:18hiredmanhave you read the docstring for import?
21:19hiredman,(doc import)
21:19clojurebot"([& import-symbols-or-lists]); import-list => (package-symbol class-name-symbols*) For each name in class-name-symbols, adds a mapping from name to the class named by package.name to the current namespace. Use :import in the ns macro in preference to calling this directly."
21:19Mecin emacs, how do i pull in the namespace from a buffer into the repl?
21:20hiredmanimport is for java classes
21:20hiredmanrequire/use are for clojure namespaces
21:20seangroveAh, that was the bit I was missing
21:21seangroveOk, yes, that looks like it's working
21:21seangrove:use is working, that is
21:21seangroveI guess I had been doing it wrong with putting it in a vector, or something along those lines
21:22mudphoneMec: I think you have to "use" the ns (assuming it's on your classpath)
21:22MecI don't know if it's on the classpath, but i can access form the repl some.namespace/func so shouldnt i be able to intern it?
21:24seangrovePhew, time to take a break for 30 min or so
21:24seangroveThanks for your help hiredman, beginning to get a grip on clojure
21:24joshua-choiI'm trying the REPL out in earnest now, and I have an essential question
21:24joshua-choiIs there a function so that you can quickly reload a namespace?
21:25mudphoneMec: if you "use" the ns, you the "func" will be available in the current ns
21:25Mecuse just gives me an error
21:25hiredmanjoshua-choi: there is a :reload flag for use and require
21:25Meccant locate namespace__init
21:25joshua-choiHmm...what does it do?
21:26hiredmanread the api docs? I think it's under "require" but if you just search the api page for :reload you will find it
21:27joshua-choiYeah, sorry; just being lazy :P
21:27joshua-choiI've just read the docs; I mean more of a function that loads the current namespace or something
21:27mudphonejoshua-choi: I have C-z bound to eval the current buffer in slime
21:28mudphonejoshua-choi: but i have to :reload if I add new vars
21:28mudphoneMec: seems like a classpath problem?
21:28joshua-choiIs there a function to do it in the REPL without an IDE? I'm working in a terminal REPL while editing in a bare-bones editor with no frills. If I edit and save the library I'm working on, can I reload the namespace quickly?
21:28joshua-choiAll signs point to me having to adopt an IDE :(
21:29chousernooo
21:29joshua-choiBut I'd be delighted if there was a built-in function that does that
21:29chouserjust load-file or load, or :reload with use or require
21:29joshua-choiOh, duh; of course I could just press the up arrow until I read the reload again
21:30joshua-choiHa ha, I don't need an extra function; my bad.
21:30mudphonejoshua-choi: oh sorry, for some reason I read "repl" as Emacs
21:30joshua-choiNo problem
21:31Mecmudphone: how come I can use some.namespace/func fine at the repl if its not on the classpath?
21:33Mecah hah, have to refer it
21:34mudphoneMec: is this a namespace you created at the repl? or via load-file?
21:35Mecneither, its just in one of the buffers
21:35mudphoneMec: ah, ok
21:36mudphoneMec: was assuming it was a buffer editing a clojure file on the classpath
21:40TalkingHeadI'm trying to figure out the Clojure equivalent of this Java: File f = new File("data/weekly_apr09.xls");
21:40TalkingHead Workbook wb = Workbook.getWorkbook(f);
21:40TalkingHeadHere's what I came up with:
21:40TalkingHead(defn wb [file] (Workbook. (.getWorkbook (File. file))))
21:41mudphoneTalkingHead: I think you're going to want Workbook/getWorkbook
21:43TalkingHeadthanks mudphone, that seems to have fixed it
21:43mudphoneTalkingHead: wow, i helped
21:43TalkingHead:)
22:57RaynesLooks like I need to try Slate. :.
22:57Raynes:>*
23:00gkoQuestion: If I have a (try ... (let [response (my-function ...] ...), is the only way to retrieve response in a catch is to use an atom ?
23:00gkoan atom defined before (try ...)
23:01arohnergko: you could also use a local var, but those are sort of esoteric
23:03gkolocal var?
23:05arohner,(doc with-local-vars)
23:05clojurebot"([name-vals-vec & body]); varbinding=> symbol init-expr Executes the exprs in a context in which the symbols are bound to vars with per-thread bindings to the init-exprs. The symbols refer to the var objects themselves, and must be accessed with var-get and var-set"
23:07gkoOK, will check. Thanks.
23:07technomancygko: it's much better to put the try inside the let if you can
23:08technomancythere are ways to do it otherwise, but they're not pretty
23:14gkotechnomancy: yeah, but that also means putting the catches inside the let... and as you said: not pretty :(
23:28joshua-choiHey, I've got a conceptual puzzle that I need to solve. Consider the sequence of numbers [3 5 2 1]. Is there a function f so that (= (reduce f [3 5 2 1]) 0.3521)? The function f must return a number.
23:31technomancygko: what I mean is putting the catches inside the let is a lot prettier than letting the value of one of the let-bound variables escape the let scope.
23:31somnium,(Float. (reduce (fn [x y] (str x y)) "0." [3 5 2 1]))
23:31clojurebot0.3521
23:32somniumer
23:32joshua-choiYeah, that should have been another condition. I have to use only arithmetic operations.
23:32technomancyyou'd probably want to run indexed on the seq of numbers and then divide the seq number by * 10 i
23:33somniumapply str would have been better anyway :/
23:33technomancy,(reduce (fn [acc [i x]] (+ acc (/ (float x) (* 10 i)))) [3 5 2 1])
23:33clojurebotjava.lang.UnsupportedOperationException: nth not supported on this type: Integer
23:33joshua-choiUnfortunately, that's another thing I can't do. I must not count the sequence. :(
23:33joshua-choiThe context is a Clojure-in-Clojure LL(2) parser that needs to be able to parse using as little input at a time as possible.
23:34technomancymaybe if there were a lazy version of indexed
23:34technomancycan't think of any other way myself
23:34technomancybut I'm no parser wizard
23:34joshua-choiWell, it *is* a math problem. But I'm not a math wiz myself.
23:34joshua-choiI'm hoping that it's somehow mathematically possible using just numbers.
23:35joshua-choiAs a last resort, I guess I can pass a map...but I feel in my bones that there should be a function that can do this.
23:36joshua-choiWait, that's it
23:36somniumjoshua-choi: could you return a fn that implicitly counts the sequence?
23:36joshua-choitechnomancy: I didn't read your answer properly: indexed should work
23:37joshua-choiI'll try that now
23:38technomancy,(use 'clojure.contrib.seq-utils)
23:38clojurebotnil
23:38technomancy,(reduce (fn [acc [i x]] (println i x acc) (+ acc (/ (float x) (Math/pow 10 (inc i))))) 0 (indexed [3 5 2 1]))
23:38clojurebot0.35209999999999997
23:38clojurebot0 3 0 1 5 0.3 2 2 0.35 3 1 0.352
23:38hiredman,(take 10 (iterate #(/ % 10) 0.1))
23:38clojurebot(0.1 0.01 0.0010 1.0E-4 1.0E-5 1.0000000000000002E-6 1.0000000000000002E-7 1.0000000000000002E-8 1.0000000000000003E-9 1.0000000000000003E-10)
23:38hiredman,(map * [3 52 1] (iterate #(/ % 10) 0.1))
23:38clojurebot(0.30000000000000004 0.52 0.0010)
23:38technomancyyay floats. =\
23:38hiredmangah
23:39hiredman,(map * [3 52 1] (iterate #(/ % 10) 0.1M))
23:39clojurebot(0.3M 0.52M 0.001M)
23:39hiredman,(reduce + (map * [3 5 2 1] (iterate #(/ % 10) 0.1M)))
23:39clojurebot0.3521M
23:40joshua-choi(doc iterate)
23:40clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
23:40technomancyhiredman: nice
23:41hiredman,(partial (comp (partial reduce +) (partial apply map *) reverse list) (iterate #(/ % 10) 0.1M))
23:41clojurebot#<core$partial__5034$fn__5036 clojure.core$partial__5034$fn__5036@16419dc>
23:41hiredman,((partial (comp (partial reduce +) (partial apply map *) reverse list) (iterate #(/ % 10) 0.1M)) [3 5 2 1])
23:41clojurebot0.3521M
23:41hiredmantechnomancy: thanks
23:42hiredmanoh
23:42hiredmanhell, I don't need that reverse
23:43hiredmanor the whole outer partial
23:58tomojweird to google something and find a conversation I took part in earlier today
23:59tomojwonder how often google crawls our logs