#clojure log - Mar 11 2010

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

0:07 tomoj: is <> used?

0:10 psykotic: <> gives me pascal flashbacks

0:11 lots of other possibilities though. =>, =>>, etc

0:12 actually i'm already using => for logical implication in my logic-based testing library

0:12 tomoj: haha

0:12 maybe a strangely-named namespace?

0:12 this would guarantee that there will be no conflicts

0:13 so you could do c/> or something

0:17 gko: How do you deal with: ({(BigInteger. "1") "one"} 1) => nil (as 1 is Integer) ?

0:18 psykotic: ,(= (BigInteger. 1) 1)

0:18 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger

0:18 psykotic: ,(= (BigInteger. "1") 1)

0:18 clojurebot: true

0:18 psykotic: it must be a hashing thing?

0:19 ,(= (hash (BigInteger. "1")) (hash 1))

0:19 clojurebot: true

0:19 psykotic: nope

0:20 ,({(BigInteger. "1") "one"} 1)

0:20 clojurebot: nil

0:20 psykotic: ,({(BigInteger. "1") "one"} (BigInteger. "1"))

0:20 clojurebot: "one"

0:20 psykotic: yeah, that's weird.

0:21 gko: Actually, it's the same if it's Long, etc...

0:21 psykotic: i'd consider that a bug

0:21 have you searched the list archives?

0:21 gko: psykotic: nope. I'll look at them.

0:22 psykotic: ,(class {(BigInteger. "1") "foo"})

0:22 clojurebot: clojure.lang.PersistentArrayMap

0:22 gko: psykotic: but I thought: this should have been spotted a long time ago, so there must be something I missed... :)

0:23 psykotic: ,((hash-map (BigInteger. "1") "one") 1)

0:23 clojurebot: nil

0:23 psykotic: ,((sorted-map (BigInteger. "1") "one") 1)

0:23 clojurebot: "one"

0:23 psykotic: interesting

0:23 so it works with sorted maps, but not array or hash maps

0:24 i wonder if array/hash maps use something other than =

0:25 i.e. straight Object.equals()

0:25 noidi: ,(.equals (BigInteger. 1) 1)

0:25 clojurebot: java.lang.IllegalArgumentException: No matching ctor found for class java.math.BigInteger

0:25 psykotic: ,(.equals (BigInteger. "1") 1)

0:25 clojurebot: false

0:25 psykotic: (as expected)

0:26 ,(.equals 1 (BigInteger. "1"))

0:26 clojurebot: false

0:26 psykotic: at least it's symmetric, that's not always the case with equals, heh

0:28 anyway, yeah, that's the problem, it seems

0:28 if you look at equalKey() in PersistentArrayMap.java, it equals equals() directly

0:28 i'd definitely consider this a bug, you should post it, gko

0:29 s/equals equals()/calls equals()/

0:30 it should call Util.equiv() instead

0:30 gko: OK.

0:30 psykotic: although this will slow down things

0:31 it's possible it was done for that reason, though it's a pretty heinous trade-off for performance, if so

0:31 tomoj: hah http://sardakcode.blogspot.com/2009/02/litterate-programming-in-clojure.html

0:31 that code uses itself to display what you see on the page

0:31 gko: psykotic: maybe, but it's annoying as one would have to be aware of this..

0:31 psykotic: gko: i agree, it's completely broken, no excuses.

0:31 you can't have this kind of behavior in something as core as maps

0:32 tomoj: it's amusing that 'literate' is misspelled in the original title, which was evidently later corrected, though it persists in the url :)

0:33 tomoj: yep

0:33 I pardoned that because the self-reference was awesome

0:33 psykotic: btw, you can easily do literate programming in any language with org-babel

0:33 tomoj: yes, actually

0:33 I am watching the presentation that was just posted to planet emacsen

0:34 which made me think about literate programming in clojure

0:34 but I also want to be able to run the literate code in production :)

0:34 psykotic: the only thing i don't like about org-babel is that the code block syntax is a little heavy weight

0:34 but i can believe you can define macros for that

0:34 tomoj: I haven't looked into it yet

0:35 psykotic: my 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

0:35 whereas with haskell i always use LHS even when i don't plan on writing much prose

0:35 tomoj: yes, I want lclj

0:36 you'd have to hack the reader, I guess

0:36 or maybe a custom reader macro?

0:36 wonder what's available

0:37 psykotic: btw ghc actually supports arbitrary filters for lhs mode

0:37 the > ... is just the default

0:37 it would be nice if you could register simple string-based input-output filters with clojure like that for things like literate

0:38 but you're right, it would be more lispy to use reader macros. unfortunately, clojure doesn't have a programmable reader.

0:40 i 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.

0:40 cad_austin: Hi, 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?

0:40 psykotic: you don't need the built in reader to support read tables

0:40 so, you would bootstrap with the dumb reader, implement your own fancier reader, and def it to *reader*

0:41 tomoj: psykotic: did you see the "The sheer elaborated insanity..." tweet? :D

0:41 psykotic: no?

0:42 cad_austin: Also, if blurting out a question is some sort of faux-pas, please let me know. New to IRC.

0:42 tomoj: psykotic: http://twitter.com/zenoli/status/7889972817

0:42 cad_austin: blurting out a question is not a faux-pas, it's expected, actively encouraged behavior

0:42 :)

0:43 cad_austin: tomoj: thanks, worried about it

0:43 tomoj: many channels have "don't ask to ask, just ask" rules, informal or formal

0:43 also, welcome

0:43 psykotic: tomoj: heh

0:43 in a way i disagree, org-mode does a lot of unemacsy things

0:44 but usually in a way that improves on emacs

0:44 tomoj: my emacs fu isn't great enough to appreciate the subtleties of whether org-mode is "emacsy"

0:44 psykotic: an example is the way it implements table 'dragging'

0:44 the emacs way would be like transpose-word, etc, which is retarded

0:44 tomoj: cad_austin: have you considered clojure-mode?

0:44 or, I guess you're using it?

0:44 psykotic: i 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

0:45 it preserves intraunit point positioning, etc, which transposition doesn't

0:45 klafka: is anyone familiar with incanter?

0:45 tomoj: psykotic: wow, is it available?

0:45 do you use it along with paredit?

0:45 psykotic: i can gist it, but it's not really nice

0:45 hehe

0:46 tomoj: I feel like there should be a #cult-of-emacs

0:46 perhaps #emacs really is enough

0:46 psykotic: tomoj: http://gist.github.com/328872

0:46 klafka: i don't know why http://codepad.org/zHRy7VSj this is returning a 2x2 matrix instead of a 2x1 matrix ( A is a 2x2 matrix)

0:46 tomoj: thanks!

0:46 psykotic: feel free to use it but please don't distribute it. it's still not in shipping shape.

0:47 tomoj: okey

0:47 cad_austin: tomoj: 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.

0:48 psykotic: heh, gist's syntax highlighting for .el is broken as heck

0:48 it doesn't know about defun at all, so it thinks the argument list is a function application and highlights the first subexpression accordingly

0:51 dmiles_afk: i 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?

0:52 for ABCL i run the ANSI-TESTs for common lisp

0:52 hiredman: the only tests I know of are what is in the source tree

0:53 mabes: Is 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

0:53 dmiles_afk: my goal is just to avoid represetnation convertsion between the two

0:54 psykotic: mabes: not built in

0:54 mabes: that's one of apl's nice functions.

0:56 cad_austin: Is there a common convention for laying out the file structure of a clojure program?

0:56 mabes: psykotic: ok, thanks for the info!

0:57 _ato: cad_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/

0:57 err I mean "classes/"

0:58 mabes: cad_austin: lein is probably the most popular convention.. and it uses what _ato explained (video on leiningen and project management: http://vimeo.com/8934942)

0:59 cad_austin: _ato: Definitely watched that one. I've been using it, but as I mentioned before, my namespaces seem to dislike one another.

0:59 "it" = leiningen

0:59 _ato: cad_austin: are you using M-x swank-clojure-project in emacs?

1:02 cad_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.

1:03 tomoj: use swank-clojure-project instead if you don't want to use lein-swank

1:04 _ato: cad_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

1:05 cad_austin: tomoj + _ato: I didn't realize these were existing modes. Thanks. Giving it a shot now.

1:06 tomoj: if you get a recent leiningen working, should be pretty easy to lein-swank and then M-x slime-connect to it

1:07 psykotic: mabes: http://gist.github.com/328891

1:08 or if you want something more like the apl version, you'd first prefix sum the is

1:09 cad_austin: _ato: Don't have swank-clojure-project. Should I be using this "ELPA" thing?

1:09 mabes: psykotic: very nice! I was going down the path of using subvec... I had forgotten about split-at. Very nice solution- thanks!

1:09 psykotic: incidentally, with the apl semantics, the usual (partition n xs) could then be written (cut (repeat n) xs)

1:10 tomoj: that is brilliant

1:10 cad_austin: yes, use elpa

1:11 cad_austin: if you get stuck, let us know

1:11 psykotic: mabes: sorry, there's actually a bug. in the else branch of the if, it should be [xs] rather than xs

1:12 cad_austin: tomoj: Ok. How did I not know this existed...

1:12 mabes: how does one decide to put the collection in the front (as in subvec) or at the end (as in split-at)?

1:14 tomoj: cad_austin: you'll want to install at least clojure-mode and swank-clojure, I believe

1:15 cad_austin: tomoj: Will the installer delete my existing modifications?

1:15 tomoj: no, it won't touch anything you've done already

1:15 cad_austin: tomoj: Ok, thanks.

1:15 tomoj: it will stick a bit of code at the bottom of your .emacs

1:15 but you'll probably want to wipe out your .emacs modifications anyway

1:16 unless you're using another lisp as well

1:16 _ato: mabes: 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

1:16 tomoj: you shouldn't need any .emacs customization besides the installer bit

1:17 (unless you want to use paredit)

1:17 cad_austin: tomoj: Keybindings?

1:17 tomoj: your keybindings should be fine

1:17 unless they're bound to things that don't exist anymore in the elpa version or something

1:17 which would be odd

1:18 but anyway you will want to not load the slime/swank-clojure/clojure-mode/whatever you were loading before

1:18 _ato: mabes: see also this thread: http://groups.google.com/group/clojure/browse_thread/thread/8b2c8dc96b39ddd7/a8866d34b601ff43

1:18 tomoj: maybe backup your .emacs just in case :)

1:18 mabes: ahh, ok. thanks for the clarification and pointer _ato

1:24 psykotic: here'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

1:24 http://gist.github.com/328891

1:25 that's pretty neat

1:30 cad_austin: tomoj/_ato: 1) ELPA is AMAZING, 2) installed required without a hitch, thanks to a technomancy article, 3) namespace issues completely resolved

1:30 Thanks very very much.

1:31 tomoj: great

1:31 _ato: cad_austin: cool :-)

1:31 tomoj: now leiningen will help you if you best it

1:39 cad_austin: Is clojureql the way to go for db stuff?

1:40 dnolen: cad_austin: if you like CouchDB, clutch is pretty cool.

1:43 cad_austin: I've heard good things. Is either clutch or clojureql stable enough to use on a production environment?

1:43 tomoj: clojureql isn't built with lein, but we can still get it from clojars, right?

1:44 I think clojureql is nearing some changes

1:44 not sure how much progress they've made

1:44 if you are awake late enough, maybe the owner will come by

1:46 cad_austin: tomoj: I had to install gradle and manual drop the build and a driver into my lib directory.

1:46 tomoj: ouch

1:47 I see org.clojars.snuxoll/clojureql in clojars

1:47 _ato: http://clojars.org/clojureql

1:47 tomoj: guess someone pushed that to clojars, dunno how recent it is

1:47 oh, hmm

1:47 is it just me or is search broken

1:47 _ato: search is broken

1:47 stuff that doesn't have a description doesn't show up

1:47 tomoj: is that open source?

1:48 ah yes, I see it

1:50 cad_austin: Forgive the ignorance, but a colleague told me that couchdb obviates lucene. Didn't believe him. Is it true?

1:50 I should say hibernate search.

1:50 ( We're from Java land )

1:52 _ato: cad_austin: couchdb can optionally integrate with lucene

1:52 tomoj: I don't think it makes lucene obsolete

1:52 _ato: I don't know anything about hibernate search

1:52 tomoj: me neither

1:53 but I still use solr even though I love the couch

1:53 _ato: couchdb doesn't itself do full-text search (there's a lucene plugin for couch that adds it)

1:54 tomoj: but, can that couch plugin be modified like lucene can?

1:54 _ato: btw I just put in a quick hack to fix the clojars search

1:54 tomoj: awesome :)

1:54 with lucene, I can write clojure to do different kinds of searching/indexing

1:55 _ato: yeah it's not as flexible

1:55 tomoj: if the couch integration way could work with clojure like that (and with solr..), it'd be cool

1:55 cad_austin: I'm reading that couch is wicked-slow.

1:56 _ato: depends on your data set size

1:56 it's useless for millions/billions of documents

1:57 cad_austin: _ato: Ok.

2:00 zmila: ,(doc flatten)

2:00 clojurebot: Titim gan éirí ort.

2:00 cad_austin: ,(+ 1 1)

2:00 clojurebot: 2

2:00 cad_austin: Oh... cool.

2:00 tomoj: I've heard that it's slow too :(

2:00 but never confirmed it

2:00 but, still cool for small apps to sync up

2:01 chef uses it internally for example

2:01 along with solr for searching

2:01 cad_austin: tomoj: 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/

2:01 hiredman: huh

2:01 I wonder why no docs for flatten

2:02 ouch

2:02 the json clojurebot grabs for contrib docstrings seems to be empty or have gone missing

2:03 yeah, it's gone or moved

2:13 lancepantz: i don't think flatten is in the api

2:13 i'd like it though

2:14 oh, nm its in contrib

2:28 tomoj: get cut into core

2:28 at least contrib, it's awesome

4:37 seangrove: Hey all, I'm having a terrible time removing nils from this list: http://pastie.org/864693

4:37 How can I get a flat list of non-nil atoms?

4:38 The closest I can get is to replace the nils with (())

4:38 Though this might be a side-effect of using the repl, I'm not sure

4:41 _ato: yikes

4:41 do you just want a single list of strings? (no nesting)

4:42 I'd just (remove nil? (flatten ...)) the sucker

4:43 (flatten is in clojure.contrib.seq-utils)

4:45 seangrove: Ah

4:45 I couldn't find flatten, heh

4:50 Licenser_: greetings everyone

5:02 seangrove: _ato: That worked, thank you

5:02 And, it's 2:00am, I think I need to sleep

5:02 G'night

5:09 zmila: flatten is mentioned twice today :)

6:07 psykotic: ,(future (println "asdf"))

6:07 clojurebot: #<Object$IDeref$Future$2b9be1f9@16e8a49: :pending>

6:08 psykotic: i notice that when i do something like that from the slime repl, the output never makes it to the buffer.

6:10 works from clojure's own repl though

6:16 has anyone already done a library for working with 'promise sequences'? i wrote my own stuff already but...

6:24 the idea is to use bidirectional promises to connect producer and consumer.

6:24 the 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.

6:25 in 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.

6:25 it's dataflow programming 101, but it's painful to do with raw promises.

6:48 neotyk: psykotic: it is in *inferior-lisp*

6:48 psykotic: neotyk: ah, that makes sense

6:54 rhickey: aargh - could someone please fix test so that it doesn't always say the problem is at test_clojure.clj:77 ?

9:16 klafka: what is the exponent symbol in clojure? like 2^4 say

9:17 chouser: there's a static method in Math, and instance methods in some of the number types

9:17 ,(Math/pow 2 4)

9:17 clojurebot: 16.0

9:17 AWizzArd: klafka: you can use the .pow function in Math or on BigInteger for example

9:17 klafka: aah

9:17 i see

9:18 AWizzArd: ,(.pow 2M 16)

9:18 clojurebot: 65536M

9:18 chouser: I wish we had a version of that function that has side effects so we could call it "pow!"

9:19 AWizzArd: What would the side effect do?

9:23 chouser: beats me

9:23 zmila: side effect - memoize the calculation

9:26 AWizzArd: chouser: aah, I think now I understand.

9:42 pao: does there exist a news feed for clojure development?

9:42 mefesto: Hey everyone. Just wondering if there was some other function that would do the same thing as this: (map vector seq1 seq2)

9:43 for some reason i thought there was some group function that would do the same

9:44 klafka: is there a clojure mode for aquamacs ?

9:44 or a way to install a module for it

9:45 neotyk: klafka: same as for normal emacs 22

9:45 klafka: when 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)

9:46 chouser: pao: there's a google group for general discussion, and another for development of clojure itself.

9:46 pao: chouser: thanks, I remember something along the lines of "clojure weekly news" but probably I'm mistaken

9:47 neotyk: klafka: can you do M-x clojure-mode?

9:48 chouser: pao: there's a clojure "pipe" of several blogs and also http://disclojure.org/

9:48 pao: chouser: thanks a lot

9:49 neotyk: klafka: you will have less problems not using aquamacs, but emacs

9:50 klafka: really?

9:50 ok

9:51 neotyk: aqamacs is based of emacs 22

9:51 while emacs is long on 23

9:51 klafka: ah i see

9:52 neotyk: and package manager fails silently on 22

9:52 Chousuke: aquamacs 2.0 is based on 23 though

9:52 but it's still in beta

9:52 neotyk: exactly

9:53 I've switched to emacs by advice here and am very happy user

10:03 mattrepl: thoughts on adding a `file-extension` multimethod in c.c.io?

10:13 defn: morning all

10:13 pao: http://planet.clojure.in

10:14 wish someone would just put disclojure and planet.clojure.in into one legible news page

10:14 pao: defn: thanks

10:14 defn: pao: np

10:18 Drakeson: is it just me, or is leiningen (git) somehow broken?

10:20 S11001001: Drakeson: is your problem one of these?: http://github.com/technomancy/leiningen/issues

10:23 cemerick: totally offtopic, but: what do people use for building slideshows? There's only about 5000 tools out there.

10:26 Drakeson: cemerick: apple keynote, beamer-latex, also sometimes ad hoc clj->html stuff

10:27 oops! what do you mean by slideshow?

10:27 S11001001: apparently not

10:27 cemerick: whoa, I'd have to *pay* for *software*?!!1! phffft. :-)

10:27 Drakeson: yeah, that's what I meant, thanks. :-)

10:28 chouser: I bought apple keynote for a particular project, but it couldn't do what I needed it to. Haven't used it since.

10:29 cemerick: chouser: then your weapon of choice is...?

10:30 chouser: sorry, I've got nothing. I think I used oopresent last time I had to do slides. I suppose it worked.

10:30 fogus: cemerick: I'm on a markdown kick recently, so I'm using that with js and html

10:30 cemerick: I fiddled with keynote, and felt like I had all thumbs with it. :-/

10:31 I'm toying with the idea of putting everything into one omnigraffle or omnioutliner doc, and generating a PDF from that.

10:32 fogus: markdown is a little evil. I simply can *never* remember how to make links (e.g. do parens or brackets go first, etc)

10:32 chouser: cemerick: but -- how will you do animated transitions with that!?

10:32 Drakeson: I 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:32 cemerick: chouser: *click forward*, then *jump around doing jazz hands*

10:32 see? animated transitions.

10:32 chouser: cemerick: that does sound interesting. I'd like to see that some time.

10:33 fogus: cemerick: is it markdown that is evil, or is it your memory? ;)

10:34 cemerick: fogus: things that require me to remember too much chaff are evil ;-)

10:34 fogus: hmmm, good point

10:35 cemerick: that's one of my favorite things about confluence markup...links are just [label|url], which I can remember easily.

10:35 triyo: to 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:35 cemerick: Drakeson: presentations using latex? ouch.

10:35 * cemerick is hard to please

10:36 chouser: triyo: actually, you should instead do (swap! db assoc key val), and then (swap! db dissoc key)

10:36 S11001001: Drakeson: in that case it works fine for me so...what's the issue?

10:42 Drakeson: S11001001: I get this error:

10:42 Exception in thread "main" java.lang.VerifyError: class clojure.contrib.with_ns$loading__4759__auto____4765 overrides final method meta.()Lclojure/lang/IPersistentMap;

10:42 stuartsierra: Drakeson: you've got a version mismatch

10:43 Always use matched versions of Clojure and contrib.

10:43 Drakeson: stuartsierra: it is not me!

10:44 what I did: cd .../leiningen ; git pull ; lein install ; cd some-where-else ; lein new foo ; cd foo ; lein deps ; now lein is broken

10:44 stuartsierra: Sorry, just tuned in on "Exception in thread main"

10:45 Drakeson: now I have to rm -Rf ~/.m2 and start over :(

10:50 it 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:51 S11001001: how do you know that the maven repo is broken?

10:52 Drakeson: well, I am not sure, but lein never works after I do that

10:52 could you try that?

10:52 (and possibly risk breaking your ~/.m2)

10:53 cemerick: Drakeson: your .m2 isn't broken, lein is just specifying incompatible deps

10:54 if you change the versions in your project.clj, that should resolve it (not that I know jack about lein)

10:55 Drakeson: cemerick: but lein was not working anywhere else (not just in the directory where that faulty project.clj was)

10:57 cemerick: Drakeson: 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:58 jcromartie: clojurebot: for

10:58 clojurebot: for is a loop...in Java

10:59 Drakeson: cemerick: thanks, that's relieving to know. I'll try to reproduce a couple of times and file a bug report ...

11:02 S11001001: Drakeson: 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:10 Drakeson: S11001001: do you have leiningen from git?

11:10 I just tried again, and it breaks everytime.

11:15 arohner: I did not think it was possible. I just wrote clojure code that is *faster* than java

11:16 http://www.assembla.com/spaces/clojure/tickets/231 part 2

11:23 S11001001: Drakeson: my configuration currently being rather delicate, what with including a patched Maven and Leiningen, I would rather not :)

11:24 well I guess I could cp -al it

11:24 Drakeson: reproducing the bug:

11:24 http://clojure.pastebin.com/TZ5A1QdV

11:35 http://github.com/technomancy/leiningen/issues/issue/25

11:49 S11001001: Drakeson: I figured it out

11:50 Drakeson: can you try something for me?

11:55 Drakeson: S11001001: yeah, sure

11:56 S11001001: Drakeson: 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:57 * Drakeson duplicates his ~/.m2 ...

11:57 S11001001: I love cp -al :)

11:57 technomancy: Drakeson: what's the problem?

11:57 Drakeson: there is a bug report :p

11:57 http://github.com/technomancy/leiningen/issues/issue/25

11:58 S11001001: technomancy: and I think I've figured out the problem

11:58 Drakeson: btw I've done what I'm asking you to do and it confirmed my suspicions

11:59 technomancy: Drakeson: someone else reported problems with the upgrade to clojure 1.2.0-SNAPSHOT. maybe try rolling back in leiningen's project.clj file

11:59 Drakeson: technomancy: apparently, when both 1.2.0-SNAPSHOT and 1.1.0 get installed, lein stops working

12:00 technomancy: Drakeson: hmm... can't reproduce here according to that gist

12:00 S11001001: explanation is on the bug report

12:00 Drakeson: S11001001: yes, your suggestion works around the issue

12:00 S11001001: that is, the explanation I just added

12:02 reproducing the bug depends on calling the lein script that exists in the git repo

12:02 you can also get it to happen with an uberjar, it's just harder to break that

12:15 hugod: Drakeson: did you do a lein deps in the leiningen checkout after git pull

12:16 Drakeson: line 19 in http://gist.github.com/329308

12:16 hugod: ;)

12:16 hugod: ah - it wasn't in the line you pasted here

12:20 stuartsierra: Is print-method considered part of the public API?

12:22 ~seen cgrand

12:22 clojurebot: cgrand was last seen quiting IRC, 237 minutes ago

12:23 chouser: stuartsierra: I don't think it's documented anywhere, but I suspect it's widely leveraged.

12:24 stuartsierra: Hmm. Always looked to me like a terrible hack.

12:25 chouser: oh?

12:26 isn't it a straight-ahead multimethod?

12:26 stuartsierra: Well, it seems to break a lot: structmaps, datatypes (?)

12:26 Honestly, I never figured out the relationship among pr, print-dup, and print-method.

12:27 chouser: hey, I fixed it for datatypes!

12:27 ;-)

12:27 stuartsierra: oh, good

12:27 chouser: be seriously, those are just missing implementations, or implementations that intentionally produce output that can't then be read.

12:28 stuartsierra: So what's the difference between print-dup and print-method?

12:29 chouser: hm... I guess print-method is less verbose for casual repl use.

12:29 stuartsierra: huh?

12:30 chouser: ,(binding [*print-dup* true] (prn (array-map 1 2 3 4)))

12:31 clojurebot: #=(clojure.lang.PersistentArrayMap/create {1 2, 3 4})

12:31 chouser: it's usually nice to not see that kind of detail.

12:31 stuartsierra: ok, but print-method and print-dup do different things, for example with classes.

12:32 Sometimes print-dup calls print-method

12:32 arohner: are there tests for deftypes yet? I should add some for my bug, but I don't see a file

12:34 stuartsierra: Sometimes print-method checks the value of *print-dup*

12:35 chouser: hm. Well, perhaps the implementation of the two could stand some clean-up.

12:35 stuartsierra: ok

12:36 I 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:38 And if *print-dup* is meant to make everything read-able, it should probably throw an Exception on things that can't be read.

12:38 But then what is print-method for?

12:38 I'm going in circles here.

12:40 chouser: I 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:40 I believe it is used to compile constants.

12:41 *print-method* is meant to produce output at the repl for humans to read.

12:42 stuartsierra: Ok, that's not clear at all from the implementations.

12:42 etate: hey guys, how do i access a method from within a java .jar from clojure?

12:43 i keep getting NoClassDefFound errors

12:43 stuartsierra: etate: You need to add the .jar to your java classpath

12:43 chouser: I 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:44 etate: stuartsierra: i've added it to the swank-clojure class path (i put the jar in lib in clojurebox)

12:44 stuartsierra: It was a FAQ with defstruct: http://stackoverflow.com/questions/1291765

12:45 etate: and restarted Clojure?

12:45 etate: stuartsierra: yep

12:45 stuartsierra: dunno then

12:45 etate: now i'm getting two different types of exceptions depending on which namespace i use

12:45 one is ClassNotFoundException

12:45 stuartsierra: You can check with (System/getProperty "java.class.path")

12:46 etate: aha

12:46 duncanm: what's the process for adding something to clojure.contrib?

12:46 it'd be nice to have a FILTER-BY-NAME function that creates a FilenameFilter

12:47 stuartsierra: clojure.contrib is stagnant

12:47 chouser: is it?

12:47 stuartsierra: I say that as an active committer.

12:47 duncanm: clojure.contrib.io, i mean

12:47 stuartsierra: Still stagnant.

12:47 duncanm: then what's the up and coming?

12:48 etate: stuartsierra: looks like the classpath is correct :/

12:48 stuartsierra: duncanm: oblivion

12:48 duncanm: that's some codename?

12:48 stuartsierra: No, just a state description.

12:48 Sorry, I'm a bit maudlin today.

12:48 Just ignore me.

12:48 duncanm: heh, okay

12:49 stuartsierra: You can suggest stuff on the -dev list, if people like it, make a ticket, then beg somebody to commit it.

12:49 duncanm: stuartsierra: well, your name is on clojure.contrib.io

12:49 stuartsierra: Yeah.

12:49 That's another problem.

12:49 duncanm: it's a problem?

12:50 stuartsierra: My name's on a lot of stuff that I've disowned: seq-utils, map-utils, clojure.walk, http.agent, ...

12:51 Most of them are code I wrote in a hurry a couple of years ago and now shudder to look at.

12:51 dakrone: so, refactor time?

12:51 stuartsierra: Rewriting time.

12:51 I'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:52 duncanm: clojure.contrib.io is pretty new, i thought

12:52 stuartsierra: No, just a rename of duck-streams.

12:52 dakrone: sounds 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:52 stuartsierra: But I didn't. I started from scratch.

12:52 duncanm: ah right, io is a much better name

12:52 stuartsierra: lazytest, for example, is a complete rethinking of how a Clojure test library should work.

12:53 dakrone: so explain why the new code is better than the old?

12:53 stuartsierra: It shares almost nothing with clojure.test.

12:53 chouser: contrib is definitely a mixed bag. It contains really useful, commonly-used code, but it suffers from the lack of shepherding.

12:53 stuartsierra: I will, if I ever finish it.

12:53 chouser: stuartsierra has done the most and the best at that, but I don't think he likes it. :-/

12:53 stuartsierra: It's certainly not interesting work. Especially since I'd rather scrap it all and do it better.

12:54 That and nobody listens to me. ;)

12:54 chouser: stuartsierra: would it be possible programmatically convert existing test-is tests to your new framework? or (bleh) write a compatibility layer?

12:54 stuartsierra: I tried a compatibility layer, sort of works until you start using things like fixtures. programamtic conversion is impossible

12:55 I designed lazytest to enforce separation between setup and assertion code; clojure.test conflates the two.

12:55 Ergo, converting from one to the other requires manual refactoring.

12:55 chouser: I don't think fixtures are used much in test.clojure

12:56 stuartsierra: They're not, but some contrib tests use them.

12:56 I tried converting all the contrib tests to use it, couldn't make it work.

12:56 chouser: and if it generates failure reports that are more useful to rhickey, I bet he'd be happy to switch over.

12:57 stuartsierra: Failure reports might be slightly better, that was another goal.

12:57 chouser: he was just complainint about them this morning

12:57 stuartsierra: Ah.

12:58 oh yeah, that bug

12:58 fogus: I know what [B [C [F etc... is, but what about long and boolean?

12:58 stuartsierra: That happened when I added fixtures.

12:58 chouser: ,(into-array Boolean/TYPE [])

12:58 clojurebot: #<boolean[] [Z@1db6b07>

12:58 hiredman: [Z

12:58 fogus: got it

12:59 chouser: and [J for long

12:59 fogus: thanks!

12:59 chouser: obvious. *rolls eyes*

12:59 fogus: Yeah really

12:59 hiredman: well, they can't use L

12:59 chouser: right, because "L" stands for "Lobject"

12:59 fogus: and B is already taken

12:59 etate: now i'm really confused, getting "unsupported escape sequence" when the class path is correct

13:00 when swank loads

13:00 stuartsierra: chouser: Honestly, the head-long rush to Leiningen and Clojars discouraged me the most.

13:00 hiredman: mavem maven?

13:00 maven

13:00 stuartsierra: Yes.

13:00 Thinly wrapped, if need be, but Maven all the way.

13:01 chouser: I thought leiningen was a thin wrap of maven.

13:01 hiredman: no

13:01 stuartsierra: It uses the dependency parts, but no.

13:02 Rather than participating in the humongous Java build/dev environment, we've split off our own incompatible sub-culture.

13:02 etate: would dollar signs in java classes cause problems when put in classpath?

13:02 chouser: for 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:02 hiredman: at the first seajure meet up at least one person said they had switched to lein for their java builds

13:02 stuartsierra: ack!

13:03 Do you want to be responsible for maintaining that?!

13:03 Yet-another-Java-build-tool?

13:03 chouser: Something that can demonstrate its value vs. lein will have a good chance of adoption for a while yet I suspect.

13:04 arohner: I personally would rather write a sane java build tool, than continue to use ant/maven

13:04 stuartsierra: Maven. Just need to get a working archetype into central.

13:04 chouser: surely clojars is at least compatible with maven?

13:04 stuartsierra: Then a new project is one copy-and-paste line (admittedly a long line, but one line).

13:04 arohner: and actually, I would have gone farther. maven versioning is fundamentally broken

13:04 stuartsierra: chouser: Roughly, until you get into the AOT compilation problems.

13:04 technomancy: speaking 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:05 seems like they just get dropped

13:05 stuartsierra: Yeah, that's probably a side effect of starting a new process.

13:05 technomancy: post on the plugin list, talios will probably fix it eventually

13:05 technomancy: a'ight

13:06 stuartsierra: Basically, all dependency/build management systems are fundamentally broken in some important way, they just vary on which way.

13:07 technomancy: yeah, 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:07 comes with the territory

13:07 stuartsierra: :)

13:08 Is it an impossible problem? Or just a very difficult one?

13:08 I'm inclined to the former.

13:08 arohner: stuartsierra: I'm pretty sure it's not impossible

13:08 technomancy: really obvious after working on RubyGems. people love to complain, but it's basically a one-man show; nobody helps out with it.

13:09 stuartsierra: This is the fundamental problem with open-source software: lots of bug reports, very few patches.

13:09 technomancy: leiningen gets a lot of contributions, but obviously a huge part of that is that there's a lot of low-hanging fruit

13:10 and it's got a very small LOC-count, which won't be true forever.

13:10 etate: has anyone got a class_browse.clj exception before when using swank-clojure to load a classpath?

13:10 stuartsierra: Really? interesting.

13:10 technomancy: http://github.com/technomancy/leiningen/graphs/impact <= makes me happy

13:11 stuartsierra: technomancy: never looked at one of those graphs before, but I see your point

13:11 Ok, I guess I'll just drift quietly into obscurity.

13:12 dakrone: stuartsierra: 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:12 technomancy: your 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:12 dakrone: for when clojure-clr is up and running

13:13 technomancy: stuartsierra: has it been frustrating not to have commit access to clojure.test?

13:13 stuartsierra: a bit

13:13 Less so since I started lazytest.

13:13 technomancy: sure, naturally

13:13 I hope the same thing doesn't happen with clojure.lib I mean.

13:14 stuartsierra: The popularity of duck-streams continues to astonish me. I never used it much after I wrote it.

13:14 technomancy: stuartsierra: everybody's gotta do I/O.

13:14 http://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:15 stuartsierra: hih

13:15 heh

13:15 chouser: technomancy: there were patches from others before the switch to github, but those are attributed to rhickey because of svn

13:16 stuartsierra: If clojure is to have a standard library, it will require a full-time BDFL just like the core.

13:16 technomancy: chouser: right; it's a bit misleading if you don't take that into account.

13:16 s/a bit/quite/

13:16 sattvik: Maven's dependency code has the problem of being very hard to integrate into a larger system, such as a linux distro.

13:16 technomancy: stuartsierra: you don't think a team could do it?

13:16 stuartsierra: never

13:16 Too many arguments about style, argument order, naming, ...

13:17 build tools ... :)

13:17 arohner: I don't remember seeing many of those arguments today

13:17 chouser: stuartsierra: I thought you'd already been appointed. ;-)

13:17 arohner: ok, build tools

13:17 chouser: clojurebot: what do you know about stuartsierra?

13:17 clojurebot: stuartsierra is volunteering

13:18 technomancy: I 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:18 stuartsierra: heh

13:18 technomancy: kind of surprised at the stony silence that was met with

13:18 stuartsierra: clojurebot: def?

13:18 clojurebot: deftype is see datatype

13:18 stuartsierra: How do I redefine myself?

13:18 * arohner could use sanity checking on http://www.assembla.com/spaces/clojure/tickets/231

13:19 technomancy: arohner: see, that's what I'm talking about. =)

13:19 chouser: clojurebot: stuartsierra is awesome

13:19 clojurebot: 'Sea, mhuise.

13:19 stuartsierra: clojurebot: stuartsierra is retiring

13:19 clojurebot: 'Sea, mhuise.

13:19 chouser: clojurebot: now what do you know about stuartsierra?

13:19 clojurebot: stuartsierra is volunteering

13:19 chouser: hehe.

13:19 stuartsierra: ha!

13:19 I can't escape!

13:19 technomancy: arohner: probably better if you found someone who'd actually used deftype to review it though, sorry.

13:20 I think clojurebot has a list of facts for each term and chooses randomly

13:20 you have to tell him to forget things if you want to change it

13:20 (iirc)

13:20 stuartsierra: clojurebot: forget stuartsierra

13:20 clojurebot: I forgot stuartsierra

13:20 dakrone: what do you mean by "sanity check", just reproduce the problem?

13:20 chouser: :-(

13:20 stuartsierra: clojurebot: stuartsierra?

13:20 clojurebot: stuartsierra is retiring

13:20 stuartsierra: :P

13:21 arohner: dakrone: 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:21 dakrone: arohner: well, I can reproduce it, if that help at all

13:22 arohner: while we're (sort of) on the subject of tests: where should unit tests in clojure.core for deftypes go?

13:22 stuartsierra: probably in a new file

13:22 arohner: what about the default ipersistent map deftype?

13:23 stuartsierra: what about it?

13:24 arohner: my patch was about a bug in the default IPersistentMap implemention of deftype

13:24 IMO, it should be next to the other tests on maps

13:24 stuartsierra: I doubt it, it's still a bug specific to deftype

13:25 arohner: *shrug* either way is fine with me.

13:25 stuartsierra: Honestly, just writing tests puts you in a rarefied class.

13:25 arohner: they're not written yet :-)

13:26 stuartsierra: Ah, well then.

13:26 I think I'm becoming the grumpy old-timer of the Clojure community.

13:26 Time to move on, bother some other channel.

13:34 jeld: hello

13:34 Licenser: greetings my lispy friends!

13:34 jeld: clojure-contrib build fails unit tests under cygwin, could someone remind me the flag I need to give maven to skip the tests?

13:35 dakrone: jeld: -Dmaven.test.skip

13:35 jeld: dakrone: !!!

13:53 S11001001: stuartsierra: what kinds of AOT compilation problems do you mean with clojars, I mean other than clojure version-matching?

13:54 crowbar7: my clojure book came today. yippie

14:01 cemerick: hrm, glad I missed the build tool discussion

14:01 chouser: perhaps stuartsierra could have used your support

14:01 Licenser: congrats crowbar7

14:01 cemerick: I've gone hoarse from it before :-/

14:02 I think it's all up to technomancy now. I'll get the pillow.

14:02 crowbar7: time to read it

14:02 cemerick: I bumped into someone who switched their java project from ant to lein + the javac plugin

14:03 * cemerick cries just a little bit

14:16 dnolen: anybody messed with Google AppEngine and Enlive?

14:22 * fogus deja vu

15:09 etate: woah finally, ogre4j loaded woo

15:12 rem7: hi, 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:14 hiredman: well, what is a incanter.Matrix

15:14 is it a java.util.Collection? is it Iterable?

15:14 fogus: it follows the seq protocol

15:15 rem7: hiredman: humm.. how do I figure that out

15:15 hiredman: rem7: well fogus says it is sequable

15:16 so you can use any of the sequence functions on it to do whatever

15:17 fogus: rem7: Doesn't xy-plot take a dataset?

15:18 stuartsierra: Is it possible to recover the line on which a form was read from within a macro?

15:18 rem7: fogus: yeah, isn't a data set a PresistantArrayMap?

15:19 fogus: there is a to-dataset function, im gonna try that

15:19 fogus: rem7: it is, but I think that's just an implementation detail

15:20 hiredman: stuartsierra: like (line-of ()) ?

15:20 where line-of would just look at the metadata?

15:21 stuartsierra: hiredman: 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:21 fogus: rem7: seems to work: (to-dataset (matrix [[1 0] [0 1]]))

15:22 hiredman: I don't think the reader attaches that metadata to all forms

15:22 stuartsierra: Yeah, that's what I thought.

15:23 hiredman: but (defmacro m [x] (:line (meta x))) works from simple cases

15:23 for

15:23 stuartsierra: ok, that might be sufficient

15:23 rem7: fogus: yeah I think I got it converted to a data set...

15:24 fogus: trying to figure out how to plot it

15:24 chouser: since the reader and read things that don't support metadata, line number metadata is not added to all thing.

15:25 but I think all collections get a line number

15:25 hiredman: I think it may just be lists

15:26 fogus: rem7: http://wiki.github.com/liebke/incanter/sample-plots-in-incanter

15:26 hiredman: yeah, I think the listreader is the only collection reader that attaches metadata

15:26 chouser: hiredman: ah, I do think you're right.

15:26 hiredman: (think in this case means "I'm pretty sure" because I'm looking at the java)

15:27 stuartsierra: ok, time for some experiments

15:27 liebke: rem7: to plot the first two columns from a matrix do: (view (xy-plot 0 1 :data (to-dataset my-matrix)))

15:27 chouser: ,(meta (first '(())))

15:27 clojurebot: nil

15:27 chouser: ,(meta (first '((foo))))

15:27 clojurebot: nil

15:27 * fogus breathes a sigh now that liebke is here

15:27 liebke: rem7: or (with-data my-mat (view (xy-plot ($ 0) ($ 1)))

15:27 hiredman: () doesn't get metadata for some reason

15:27 liebke: :)

15:28 stuartsierra: maybe it's a singleton

15:28 hiredman: possibly

15:28 it is

15:28 fogus: liebke: welcome back

15:29 liebke: fogus: thanks

15:29 chouser: of course you can still apply metadata to the empty list even though it starts as a singleton.

15:29 stuartsierra: Yeah, only lists get line number metadata. Still, that's useful.

15:29 liebke: rem7: or just do (view (xy-plot 0 1 :data my-mat))

15:30 chouser: but I'd guess the point is that things that could be function calls get line numbers

15:30 hiredman: there may be a *line* var in the compiler somewhere

15:30 but accessing that would prove tricky

15:30 stuartsierra: hiredman: There's @Compiler/LINE, but I don't know by what rules it's updated.

15:30 And you can't grab it in the middle of a macro as far as I know.

15:30 Just at the start.

15:30 hiredman: right

15:31 chouser: clojure.lang.Compiler/LINE at macroexpand time gives you the line number where the macro is being expanded.

15:31 so ... probably the same as (:line &form) now?

15:31 seangrove: Hey all, I can't seem to get lein working correcntly

15:31 stuartsierra: right, not much help in a 20-line macro.

15:31 chouser: stuartsierra: right.

15:32 stuartsierra: hmm

15:32 seangrove: I 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:32 rem7: liebke, fogus, thanks that worked :)

15:33 seangrove: I'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:33 liebke: cool :)

15:34 technomancy: seangrove: your project is using dependencies that have been AOT-compiled with the wrong version of clojure

15:34 seangrove: technomancy: Should I compile clojure from source, perhaps?

15:34 Or is that a day-long project?

15:34 technomancy: seangrove: 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:35 I recommend against building your own clojure unless you are working on a patch to clojure itself. generally use build.clojure.org

15:36 hiredman: errors mentioning RestFn almost always mean you have compiled code that is not binary compatible with your version of clojure

15:36 seangrove: Is that perhaps the version of lein I've installed isn't compatible with the version of clojure I have?

15:37 I'm using Clojure 1.2.0-master-SNAPSHOT

15:38 hiredman: possibly one of you dependencies (including clojure-contrib)

15:39 chouser: oh no -- proxy doesn't work with protocols, does it.

15:40 and reify doesn't work with concrete classes

15:40 _ato: lein 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:40 * chouser abuses IDeref yet again...

15:41 hiredman: ISmuggle

15:41 chouser: exactly

15:41 I suppose I could use definterface

15:41 that's reloadable, right?

15:42 hiredman: uh, I dunno

15:44 Licenser: I 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:45 arohner: are 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:45 hiredman: -cp is ignored when you use -jar

15:45 Licenser: :( gar

15:45 is $CLASSPATH too?

15:45 hiredman: I forget

15:45 nteon: hiredman: really?!? thats just mean of java

15:46 hiredman: I know with -cp, $CLASSPATH is ignored

15:46 chouser: I think with -jar, everything else is ignored

15:46 Licenser: so how can I run a jar that requires other jars?

15:47 hiredman: java -cp ajar:bjar some.class

15:47 chouser: Licenser: put them all in the classpath, then name on the command-line the class with the main method you want to run

15:47 Licenser: ahhh

15:47 _ato: arohner: http://clojars.org/org.buntin/compojure <-- this one seems to be from feb 24

15:48 Licenser: ah sneaky!

15:48 arohner: _ato: I need one from mar 3 or later

15:48 Licenser: thanks hiredman, chouser

15:48 clojurebot: hiredman <3 XeLaTeX

15:48 _ato: arohner: you'll probably need to make your own then

15:49 arohner: _ato: and then I can just push it to clojars?

15:50 _ato: arohner: 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:51 arohner: _ato: thanks!

15:54 crowbar7: am I missing something or can I not just browse all the clojure libs at clojars?

15:54 hiredman: http://clojars.org/repo

15:55 crowbar7: ok, nothing on the site itself for that

15:56 thanks

15:57 i mean link on the site page

15:58 seangrove: So 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:59 Seems that lein works at least now

16:04 tomoj: if you're using lein, you shouldn't have to put those there

16:04 "lein self-install" should put the jars somewhere so that lein can find them

16:04 then, in your project.clj you will refer to the clojure version you want, 'lein deps' downloads it into lib/

16:05 arohner: _ato: I broke the clojars UI, though on the other hand, I'm very happy with the result

16:05 http://clojars.org/org.clojars.arohner/compojure

16:05 that's the github SHA1 this was built from

16:05 _ato: hehe

16:05 arohner: which completely resolves my issues with semantic versioning being completely broken

16:05 _ato: my poor constrained layout

16:05 hiredman: nice

16:10 seangrove: tomoj: So lein can download clojure jars?

16:12 tomoj: seangrove: yep

16:14 triyo: Is 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:15 dakrone: triyo: like (declare foo) ?

16:15 hiredman: what do you mean "name will not be realized"

16:16 functions can be bound to names, but the names are not an intrinsic property of the functions

16:17 triyo: I have a macro that introduces a new function when called. This function will be called make-(name-passed-in-as-param)

16:17 dakrone: you shouldn't need a forward declaration for that

16:17 triyo: I have a function that will need to apply that function at runtime

16:18 dakrone: ahh

16:19 duncanm: why is it that calls to System.out.println don't print out to the console when running under SLIME?

16:19 triyo: I could use a macro to do something like `(apply ~(symbol (str "make-" entype)) ... but macro wont do in my case....

16:20 ska2342: duncanm: you're printing from other threads? take a look in the *inferior-lisp* buffer. Do you find your output there?

16:24 duncanm: ska2342: hmm, i don't have an *inferior-lisp* buffer

16:24 i'm using M-x slime-connect to start the session

16:26 ska2342: duncanm: 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:29 Licenser: I have a odd error: clojure.lang.PersistentStructMap cannot be cast to clojure.lang.IDeref and am not sure what exactly caused it

16:30 dakrone: triyo: can I see the code and how you're doing it?

16:30 triyo: I do the same thing with a macro and have no problems with using it as a function

16:31 or are you trying to to AOT compile it?

16:31 Licenser: I have no exact idea how that happens :( is the sad thing

16:31 hiredman: Licenser: means you are trying to deref a map

16:31 ,@{}

16:31 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IDeref

16:31 Licenser: cool :)

16:31 hiredman: ,(deref {})

16:31 clojurebot: java.lang.ClassCastException: clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.IDeref

16:31 Licenser: hiredman: can you tell me why you know everything?

16:32 and tanks a lot

16:32 hiredman: very boring job, so I do a lot of reading

16:33 Licenser: heh

16:34 triyo: dakrone: http://gist.github.com/329685

16:34 hiredman: horrible

16:35 Licenser: anyway you're my hero again hiredman :)

16:35 ska2342: triyo: you may need to (resolve) the symbol, no?

16:36 ,((resolve (symbol "println")) "Hello World")

16:36 clojurebot: Hello World

16:38 triyo: ska2342: exactly. Let me have a quick look to confirm

16:39 this will allow me to make map->entity into a function instead of macro.

16:40 arohner: technomancy: are you aware of any .debs for leiningen yet?

16:42 Licenser: It 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:44 seangrove: Hrm, confused about this - Exception in thread "main" java.lang.NoClassDefFoundError: clojure/lang/IFn

16:45 hiredman: seangrove: the clojure jar is not on your classpath

16:45 seangrove: Is that something I've done wrong, an incompatible clojure version...?

16:45 technomancy: arohner: 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:45 seangrove: ah

16:45 hiredman: no, that means no clojure at all

16:46 arohner: technomancy: 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:46 technomancy: arohner: what's your project?

16:47 seangrove: hiredman: http://pastie.org/865656

16:47 Am I perhaps using the -cp option wrong?

16:47 triyo: ska2342: 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:47 arohner: technomancy: a webapp that uses machine learning to automate troubleshooting / tech support

16:48 hiredman: seangrove: you cannot use -jar and -cp together

16:48 12:46 hiredman : -cp is ignored when you use -jar

16:48 seangrove: Ah...

16:48 hiredman: wow, four minutes ago

16:48 arohner: technomancy: to deploy, we start a pristine EC2 ubuntu, and apt-get install our own .deb

16:49 hiredman: I thought it might have been at least ten

16:49 seangrove: Haha

16:49 Sorry for that

16:49 technomancy: arohner: yeah... I've been musing about deployments with lein and haven't really thought it all the way through yet

16:49 seangrove: And thank you for your patience ;)

16:49 ska2342: triyo: 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:51 technomancy: beyond just uberjar of course

16:52 actually 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:52 arohner: technomancy: we use a .deb because we need ubuntu dependencies as well. As for starting up, we just use a bash script

16:54 though hashdot looks pretty cool

16:54 technomancy: it's cool but unpolished. you have to edit the makefile to install it. =\

16:55 needs someone who really knows the C build tools to go in and give it some love. I tried, but make is pretty insane.

16:55 all the docs for it assume you know C

16:55 arohner: I have a history of fixing insane makefiles. I'm not doing it again

16:55 :-)

16:56 my last day job had a 10k LoC in makefiles, for a single project

16:59 triyo: ska2342: 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:59 crowbar7: hiredman: I see you use a macbook. p

17:04 hiredman: crowbar7: huh?

17:05 crowbar7: hiredman: from the pastebin you posted

17:05 ohh wait nvm

17:05 sorry

17:05 I read that wrong

17:05 * crowbar7 is a moron

17:29 dakrone: out of personal curiosity, any of you live around the Denver/Boulder, CO, USA area?

17:33 cljneo: hi, 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:37 tomoj: cljneo: use lein-swank ?

17:37 dunno windows-land, though

17:37 but I never use M-x slime for clojure

17:37 cljneo: I do but it is not working

17:37 it says that swank is not a recognized plugin

17:38 tomoj: what do you use if not M-x slime?

17:39 mattikus: cljneo: do you have a .emacs config that you're particularly fond of? If not, you could try clojure-box or emacs-start-kit

17:39 tomoj: either 'M-x swank-clojure-project', or, more often, 'M-x slime-connect' with lein-swank

17:39 make sure you have the latest stable lein

17:39 and test on a project.clj created with 'lein new'

17:40 you should have at least clojure-mode and swank-clojure installed from elpa

17:40 cljneo: I 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:40 tomoj: (unless you want to do it manually, in which case, good luck, but I don't have any clue how to help :/)

17:40 clojurebot: make 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:40 cljneo: some things work in lein (like new) but other do not, like compile.

17:41 I have elpa and I have all the required packages installed and I have leiningen also

17:42 tomoj: do you recommend a specific small Linux package that I could use in VirtualBox and is suitable for Clojure with emacs ?

17:42 I meant Linux distro

17:45 Drakeson: how can I define a new variable in clojure.core?

17:45 Raynes: Use some sort of mind control device on rhickey.

17:46 hiredman: ,(ns-map (create-ns 'clojure.core))

17:46 clojurebot: {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:50 dakrone: is there a way in clojure to mark a method as deprecated?

17:52 hiredman: put "Depricated" in the docstring

17:52 (when *assert* (println "DEPRICATED"))

18:03 Licenser: good greif this isn't easy o.O

18:03 just a question about posibility, is it posible to do bindings dynamically during runtime or am I trying something ... imposible?

18:04 hiredman: what do you mean?

18:06 Licenser: Ah 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:13 etate: is there blogging software that supports clojure code?

18:13 Licenser: hrm or not

18:13 dakrone: hiredman: there's no way to mark deprecated in metadata and have compiler/runtime warnings about it then?

18:16 tomoj: etate: one option is to embed gists

18:16 sattvik: etate: 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:17 tomoj: I know someone has also hacked up wordpress

18:17 (I assumed you meant highlighting)

18:18 hiredman: dakrone: nope

18:19 dakrone: hiredman: okay, thanks for the verification

18:34 Licenser: weeehee, the sandbox now even allows dynamically binding things :D

18:35 so now nothing will stand in the way of making my game scriptable!

18:37 dakrone: Licenser: what kind of game are you working on?

18:38 G0SUB: Hello. 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:39 hiredman: vars don't point to symbols

18:39 G0SUB: yeah, I didn't mean that.

18:39 hiredman: vars can have a name, and those names are symbols

18:39 ,(resolve '+)

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

18:39 G0SUB: basically I want to figure out the var which is pointed to by the symbol.

18:40 hiredman: ,(doc find-var)

18:40 clojurebot: "([sym]); Returns the global var named by the namespace-qualified symbol, or nil if no var with that name."

18:41 G0SUB: hiredman, cool

18:43 etate: Licenser: in case you're interested i've just started working on ogre4j bindings

18:44 Licenser: etate: cool thanks for the info so I am writing my own engine :) that is the whole fun in it.

18:45 etate: Licenser: good luck with that :)

18:45 Licenser: etate: thanks :) and it's working great if you want to have a look: http://playground.licenser.net:3000/fight-designer.html

18:46 if you want to add a fight enter #clojure.de as token so it isn't blocked

18:46 and now that I got the sandbox mostly working next step will be to allow people own AI scripts for the units

18:50 etate: Licenser: i get a timeout when visiting that page

18:50 Licenser: hmm it's working for me I just tested it

18:50 etate: btw how do you make sure defed vars start in the same thread?

18:51 Licenser: hmm what exactly do you mean?

18:52 etate: when I call new from two separate functions on two different java classes, it starts them in the 'wrong thread'

18:52 i assume this means they are started in separate threads

18:53 Licenser: wow okay that sounds strange, so I didn't really touch java classes they are ... javaish

18:53 etate: indeed

18:53 hiredman: etate: if you could pastebin a small test case and the exception

18:53 etate: hiredman: sure one sec i'll pastebin it

18:54 Licenser: etate: now you're in good hands, hiredman knows everything :p

18:55 well anyway bed time for germans here :) have a good night and happy coding!

18:55 etate: hmm no syntax highlighting for clojure in pastebin

18:56 hiredman: gist has it

18:56 dakrone: pastie.org does too

18:56 hiredman: paste.lisp.org has basic lisp hilighting

18:57 technomancy: scpaste!

18:57 http://p.hagelb.org

18:57 etate: http://gist.github.com/329869

18:58 hiredman: are you familiar with the edt?

18:58 etate: hiredman: right at the bottom of the paste theres the error

18:58 dakrone: post via scp? don't you guys have gist web-app posting scripts? :P

18:59 etate: hiredman: the first two functions are what create the shell and the canvas

19:00 technomancy: dakrone: yeah, but gist can go down

19:00 scp+static HTML never breaks.

19:00 dakrone: technomancy: true, unless you're behind a firewall that only allows port 80

19:01 hiredman: etate: my guess is the opengl stuff needs to be manipulated on the EDT or in its own thread

19:01 technomancy: dakrone: if you can't use SSH, you've already lost

19:01 dakrone: as (sadly), I am

19:02 etate: hiredman: i'm just confused why those are separate threads at all

19:02 hiredman: since its one function calling another

19:03 * dakrone laments not being able to use anything that doesn't use port 80

19:03 technomancy: dakrone: good grief man; where do you work? =\

19:03 dakrone: EMC

19:03 hiredman: etate: I think wrong thread means they are both running on the same wrong thread, not that they are running on different threads

19:04 etate: hiredman: oh i see, hmm, i thought there was only one thread in this code though

19:04 dakrone: technomancy: it's not all bad, I get port 443 too! :P

19:04 hiredman: etate: the jvm is never only one thread

19:05 well

19:05 technomancy: my condolances

19:05 hiredman: never when you running a gui

19:06 etate: hiredman: is there a simple way of ensuring that the code stays in the same thread?

19:07 arohner: etate: why would you want to? we're using clojure for a reason :-)

19:07 nm, I think I get it

19:08 etate: arohner: i'm trying to bind to ogre4j, and i'm getting "wrong thread" errors

19:08 arohner: etate: are you using slime?

19:09 etate: arohner: yes

19:09 hiredman: etate: the code does stay on the same thread

19:09 how are you starting this?

19:09 etate: hiredman: ctrl-c ctrl-c :)

19:10 arohner: etate: when using any of the "load code via slime" fns, it happens in a different thread from your slime repl

19:10 restart the process and do everything from the console, and see what happens

19:10 etate: arohner: okay i'll try that

19:13 hiredman: yeah

19:13 swt has some stuff like for running code from worker threads on the ui thread which you could use

19:14 Display.syncExec/asyncExec

19:14 etate: hiredman: useful, i'm getting an error when running from console "ClassCastException NO_SOURCE_FILE"

19:15 hiredman: I'll try the def approach to see whether shell binds to the wrong thread

19:15 hiredman: etate: that is not the whole exception

19:15 "the def approach" ?

19:16 etate: hiredman: as in the bottom of the pasted source file, instead of calling setup(), to call each function by using (def x (fn ...))

19:16 hiredman: uh, why would that make a difference?

19:17 that is still going to be run on a slime thread somewhere

19:17 etate: hiredman: even from the console?

19:17 hiredman: it would be to test the difference from the console than from slime

19:17 hiredman: but why change your code?

19:19 etate: hiredman: {:shell #<Shell Shell {}>, :canvas #<GLCanvas GLCanvas {}>}

19:20 hiredman: thats what it gives me when i do it from the console

19:20 hiredman: so its good then?

19:21 if so the problem is slime running it on the wrong thread

19:22 etate: hiredman: nope, still get: java.lang.ClassCastException (NO_SOURCE_FILE:21)

19:22 rickmode: hey how can I give the app I launched with lein swank more heap?

19:22 etate: hiredman: but its a different error than "wrong thread" at least :)

19:22 rickmode: like lein swank -Xmx1g

19:22 hiredman: etate: (.printStacktrace *e)

19:22 the repl doesn't print the whole stracktrace, but the last exception is bound to *e

19:23 .printStackTrace

19:23 etate: hiredman: yeah i just did that and it says it comes from clojure.lang.Compiler$InvokeExpr.eval

19:23 + alot of other stuff

19:24 hiredman: are you sure that is the right exception

19:24 if it is, pastebin it

19:25 etate: hiredman: http://gist.github.com/329896

19:27 hiredman: seems to be coming from the createRenderWindow if i read the stacktrace correctly

19:28 hiredman: etate: yeah

19:29 you are using some archaic style there

19:29 these days almost no one uses . directly

19:29 etate: hiredman: haha, its my first day with clojure :)

19:29 hiredman: and noone uses ..

19:29 etate: hiredman: what do you use instead of .. ?

19:29 hiredman: (.method object arg1 arg2)

19:30 -> instead of ..

19:30 ,(-> "foo" .getBytes String.)

19:30 clojurebot: "foo"

19:30 hiredman: ,(-> "foo" .getBytes first int)

19:30 clojurebot: 102

19:30 hiredman: ,(-> "foo" .getBytes first int inc)

19:30 clojurebot: 103

19:31 hiredman: static methods are (ClassName/methodName arg1 arg2)

19:32 etate: what does (-> "foo" .getBytes String.) translate to in java?

19:32 hiredman: new String("foo".getBytes())

19:33 (macroexpand-1 '(String. (.getBytes "foo")))

19:33 ,(macroexpand-1 '(String. (.getBytes "foo")))

19:33 clojurebot: (new String (.getBytes "foo"))

19:33 hiredman: ,(macroexpand '(String. (.getBytes "foo")))

19:33 clojurebot: (new String (.getBytes "foo"))

19:33 hiredman: bleh

19:34 ,(macroexpand-1 '(.getBytes "foo"))

19:34 clojurebot: (. "foo" getBytes)

19:36 etate: hmm so (-> canvas .getBounds .width) == canvas.getBounds().width ?

19:36 hiredman: ()

19:37 yes

19:37 and you can also mix in normal functions

19:37 ,(-> 1/2 .denominator inc)

19:37 clojurebot: 3

19:38 etate: hiredman still gives me the same exn

19:39 hiredman: oh, I didn't mean to imply changing it would fix it :/

19:39 what arguments does that method take?

19:39 (where are the javadocs)

19:40 etate: hiredman: thats a very good question

19:41 hiredman: 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:42 hiredman: oh

19:42 I assumed you accidently left the () off of canvas.getBounds().width

19:43 you'll want (-> canvas .getBounds .getWidth)

19:43 etate: hiredman: how did you find that out?

19:44 hiredman: it's a guess

19:45 etate: hiredman: no matching field found getWidth for class :)

19:46 hiredman: well, .width will work too

19:47 rickmode: is this thing on? I can't tell if my questions are lame or if my IRC client is wonky.....

19:47 etate: hiredman: so to do canvas.getBound().width its (-> canvas .getBounds .width) or (-> canvas .getBounds width)

19:48 canvas.getBounds().width even

19:48 hiredman: rickmode: this is the first I've heard from you

19:48 etate: rickmode: its still on but i didn't see any questions

19:49 hiredman: etate: (->> Root .getMethods (filter #(= (.getName %) "createRenderWindow")))

19:50 etate: hiredman: wt.. :)

19:50 hiredman: ->> is like ->, but slightly different

19:50 etate: hiredman: aah wow

19:51 hiredman: its supposed to take two longs instead of ints

19:51 rickmode: lol... ok thanks guys - I guess interjecting a question in the middle of another thread is less than ideal

19:51 hiredman: ,(doc long)

19:51 clojurebot: "([x]); Coerce to long"

19:51 etate: ([x]) coerces to long?

19:51 hiredman: no

19:51 ,(doc long)

19:51 clojurebot: "([x]); Coerce to long"

19:52 hiredman: have you seen doc yet?

19:52 (doc +) in the repl

19:52 clojurebot: "([] [x] [x y] [x y & more]); Returns the sum of nums. (+) returns 0."

19:52 etate: aaah (long x) coerces to long

19:52 hiredman: yes

19:52 etate: hiredman: no i come from CL, i've never been in JVM land or clojure land before today

19:53 hiredman: so clojure attaches docstrings as metadata to vars holding functions

19:53 ,(meta (var clojure.core/+))

19:53 clojurebot: {: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:54 etate: awesome

19:54 hiredman: doc lets you read docs

19:54 rads: is 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:55 etate: hiredman: damn still the same ClassCastException :(

19:55 hiredman: so whatelse? are you sure the signature actually matches?

19:56 if you print out the class of each argument before you call the method, does it match?

19:56 ,(doto :x prn)

19:56 clojurebot: :x

19:56 :x

19:57 etate: hiredman: just checking

19:57 hiredman: ,(doto :x (-> class prn))

19:57 clojurebot: :x

19:57 clojure.lang.Keyword

20:01 etate: hiredman: nice it got past that error, i was passing a hash where i should pass another value

20:01 hiredman: however now the JVM crashes :)

20:04 hiredman: fun

20:04 etate: hiredman: hmm this one is difficult to debug

20:05 hiredman: in the native stack frames it shows me the interpreted call to the createRenderWindow method

20:05 hiredman: then the RenderSystem_GL dll, and then at the top KERNELBASE.dll

20:06 hiredman: :(

20:06 etate: hiredman: i wild guess would lead me to conclude the error is still coming from this method

20:06 hiredman: well, from inside the method now

20:07 does the java version work?

20:07 etate: hiredman: i haven't tried the java version :/

20:07 hiredman: java scares me

20:07 hiredman: *shrug*

20:07 I'm leaving

20:07 etate: hiredman: thanks for your help

20:08 hiredman: was very informative :)

20:54 rads: is there a way to apply a fixture to multiple test files using clojure.test?

20:59 technomancy: rads: it's done on a per-namespace basis

20:59 but you can share your fixture var and call use-fixtures in each namespace

21:09 hiredman: does it ever bother anyone that we are "quoting" with an apostrophe?

21:10 somnium: hiredman: I"ve never lost any sleep over it.

21:18 seangrove: Hey all, can I not use (ns jelly.graphics

21:18 (:import 'net.philh.cloggle)) ?

21:18 That works if I use :require rathat than :import

21:18 rather*

21:18 That's a clj file located at /net/philh/cloggle.clj

21:18 hiredman: have you read the docstring for import?

21:19 ,(doc import)

21:19 clojurebot: "([& 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:19 Mec: in emacs, how do i pull in the namespace from a buffer into the repl?

21:20 hiredman: import is for java classes

21:20 require/use are for clojure namespaces

21:20 seangrove: Ah, that was the bit I was missing

21:21 Ok, yes, that looks like it's working

21:21 :use is working, that is

21:21 I guess I had been doing it wrong with putting it in a vector, or something along those lines

21:22 mudphone: Mec: I think you have to "use" the ns (assuming it's on your classpath)

21:22 Mec: I 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:24 seangrove: Phew, time to take a break for 30 min or so

21:24 Thanks for your help hiredman, beginning to get a grip on clojure

21:24 joshua-choi: I'm trying the REPL out in earnest now, and I have an essential question

21:24 Is there a function so that you can quickly reload a namespace?

21:25 mudphone: Mec: if you "use" the ns, you the "func" will be available in the current ns

21:25 Mec: use just gives me an error

21:25 hiredman: joshua-choi: there is a :reload flag for use and require

21:25 Mec: cant locate namespace__init

21:25 joshua-choi: Hmm...what does it do?

21:26 hiredman: read the api docs? I think it's under "require" but if you just search the api page for :reload you will find it

21:27 joshua-choi: Yeah, sorry; just being lazy :P

21:27 I've just read the docs; I mean more of a function that loads the current namespace or something

21:27 mudphone: joshua-choi: I have C-z bound to eval the current buffer in slime

21:28 joshua-choi: but i have to :reload if I add new vars

21:28 Mec: seems like a classpath problem?

21:28 joshua-choi: Is 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:28 All signs point to me having to adopt an IDE :(

21:29 chouser: nooo

21:29 joshua-choi: But I'd be delighted if there was a built-in function that does that

21:29 chouser: just load-file or load, or :reload with use or require

21:29 joshua-choi: Oh, duh; of course I could just press the up arrow until I read the reload again

21:30 Ha ha, I don't need an extra function; my bad.

21:30 mudphone: joshua-choi: oh sorry, for some reason I read "repl" as Emacs

21:30 joshua-choi: No problem

21:31 Mec: mudphone: how come I can use some.namespace/func fine at the repl if its not on the classpath?

21:33 ah hah, have to refer it

21:34 mudphone: Mec: is this a namespace you created at the repl? or via load-file?

21:35 Mec: neither, its just in one of the buffers

21:35 mudphone: Mec: ah, ok

21:36 Mec: was assuming it was a buffer editing a clojure file on the classpath

21:40 TalkingHead: I'm trying to figure out the Clojure equivalent of this Java: File f = new File("data/weekly_apr09.xls");

21:40 Workbook wb = Workbook.getWorkbook(f);

21:40 Here's what I came up with:

21:40 (defn wb [file] (Workbook. (.getWorkbook (File. file))))

21:41 mudphone: TalkingHead: I think you're going to want Workbook/getWorkbook

21:43 TalkingHead: thanks mudphone, that seems to have fixed it

21:43 mudphone: TalkingHead: wow, i helped

21:43 TalkingHead: :)

22:57 Raynes: Looks like I need to try Slate. :.

22:57 :>*

23:00 gko: Question: 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:00 an atom defined before (try ...)

23:01 arohner: gko: you could also use a local var, but those are sort of esoteric

23:03 gko: local var?

23:05 arohner: ,(doc with-local-vars)

23:05 clojurebot: "([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:07 gko: OK, will check. Thanks.

23:07 technomancy: gko: it's much better to put the try inside the let if you can

23:08 there are ways to do it otherwise, but they're not pretty

23:14 gko: technomancy: yeah, but that also means putting the catches inside the let... and as you said: not pretty :(

23:28 joshua-choi: Hey, 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:31 technomancy: gko: 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:31 somnium: ,(Float. (reduce (fn [x y] (str x y)) "0." [3 5 2 1]))

23:31 clojurebot: 0.3521

23:32 somnium: er

23:32 joshua-choi: Yeah, that should have been another condition. I have to use only arithmetic operations.

23:32 technomancy: you'd probably want to run indexed on the seq of numbers and then divide the seq number by * 10 i

23:33 somnium: apply str would have been better anyway :/

23:33 technomancy: ,(reduce (fn [acc [i x]] (+ acc (/ (float x) (* 10 i)))) [3 5 2 1])

23:33 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: Integer

23:33 joshua-choi: Unfortunately, that's another thing I can't do. I must not count the sequence. :(

23:33 The 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:34 technomancy: maybe if there were a lazy version of indexed

23:34 can't think of any other way myself

23:34 but I'm no parser wizard

23:34 joshua-choi: Well, it *is* a math problem. But I'm not a math wiz myself.

23:34 I'm hoping that it's somehow mathematically possible using just numbers.

23:35 As 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:36 Wait, that's it

23:36 somnium: joshua-choi: could you return a fn that implicitly counts the sequence?

23:36 joshua-choi: technomancy: I didn't read your answer properly: indexed should work

23:37 I'll try that now

23:38 technomancy: ,(use 'clojure.contrib.seq-utils)

23:38 clojurebot: nil

23:38 technomancy: ,(reduce (fn [acc [i x]] (println i x acc) (+ acc (/ (float x) (Math/pow 10 (inc i))))) 0 (indexed [3 5 2 1]))

23:38 clojurebot: 0.35209999999999997

23:38 0 3 0 1 5 0.3 2 2 0.35 3 1 0.352

23:38 hiredman: ,(take 10 (iterate #(/ % 10) 0.1))

23:38 clojurebot: (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:38 hiredman: ,(map * [3 52 1] (iterate #(/ % 10) 0.1))

23:38 clojurebot: (0.30000000000000004 0.52 0.0010)

23:38 technomancy: yay floats. =\

23:38 hiredman: gah

23:39 ,(map * [3 52 1] (iterate #(/ % 10) 0.1M))

23:39 clojurebot: (0.3M 0.52M 0.001M)

23:39 hiredman: ,(reduce + (map * [3 5 2 1] (iterate #(/ % 10) 0.1M)))

23:39 clojurebot: 0.3521M

23:40 joshua-choi: (doc iterate)

23:40 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

23:40 technomancy: hiredman: nice

23:41 hiredman: ,(partial (comp (partial reduce +) (partial apply map *) reverse list) (iterate #(/ % 10) 0.1M))

23:41 clojurebot: #<core$partial__5034$fn__5036 clojure.core$partial__5034$fn__5036@16419dc>

23:41 hiredman: ,((partial (comp (partial reduce +) (partial apply map *) reverse list) (iterate #(/ % 10) 0.1M)) [3 5 2 1])

23:41 clojurebot: 0.3521M

23:41 hiredman: technomancy: thanks

23:42 oh

23:42 hell, I don't need that reverse

23:43 or the whole outer partial

23:58 tomoj: weird to google something and find a conversation I took part in earlier today

23:59 wonder how often google crawls our logs

Logging service provided by n01se.net