0:05 dnolen: interesting (set key) is nearly twice as fast as (contains? set key)
0:06 amalloy: dnolen: contains? has to do several typechecks
0:07 (i suspect)
0:07 $source contains?
0:07 sexpbot: contains? is http://
0:09 amalloy: dnolen: yeah. it checks to see what kind of collection it is in order to decide how to look it up with contains?. for a set, it just calls .invoke
0:36 mec: Joy of Clojure or Portal 2, such a difficult decision :x
0:39 amalloy: mec: wait, is portal 2 out yet? or are you making a financial decision?
0:39 mec: financial, portal is out in a couple weeks but I dont think Joy has been released at a couple places either
0:40 amalloy: mec: my copy went into the mail today
0:40 as did a lot of people's, to judge from the twitterverse
0:41 pdk: p2 is available for preorder
0:41 feels good getting tjoc with the preorder code
0:42 mec: amazon says march 31
1:15 amalloy: anyone know a good way to sneak a for- or doseq-like construct into a ->/doto form? eg, (let [sizes (range 10)] (-> obj .getSizeList (doto (.add 0) (.add 1) ...))), except looping through sizes? i know i could do it by breaking out of the ->doto tree with a let/doseq, but it'd be nice if i could keep everything in this form-rewriting macro i'm already in the heart of
1:19 devn_: mec: Joy of Clojure, no contest
1:20 it's a fantastic book. the chapter on multimethods is worth the price alone
1:23 amalloy: devn_: you sound like someone who didn't play portal 1. it's a tough choice if you can only afford one of them :)
1:25 devn_: i played all of portal 1 twice
1:25 it's not a tough choice at all IMHO
1:25 one of them contains knowledge about something useful
1:25 and the other is a video game
1:26 no offense -- im all for entertainment, but if you have to choose between plato and NBA Jam, there is a clear objective winner
1:26 amalloy: devn_: *shrug*. i liked JoC when i read it, and obviously it's more "useful", but the internet is already full of knowledge
1:27 but mostly i was exaggerating for entertainment value
1:27 devn_: amalloy: fair enough -- IDK, i just think the chapters from like 8-N of JoC were absolutely fantastic
1:28 the whole get/put/beget yegge reference and prototypal inheritance sprinkled over multimethods was a brilliant way to demonstrate the power
1:29 devn: in any event -- im just being opinionated
1:30 amalloy: devn: that's the nice thing about the internet: you're entitled to be opinionated
1:30 devn: i just dont see a video game anywhere on par with a book in terms of value
1:30 amalloy: id say the same if you were sitting in front of me :)
1:31 I just re-read Practical Clojure. Also worth more than a Sega Genesis in the long run. :)
1:31 amalloy: JoC is the only clojure book i've read
1:31 devn: anyway i should get to bed -- i get to hack on some clojure tomorrow at work. woo!
1:31 cheers alan
1:32 amalloy: night
2:08 paul graham is a bad influence on me. i've been reading On Lisp, and now i'm seeing all kinds of places where it would be useful to introduce symbol capture into my macros
2:17 hoeck: amalloy: where else does one need that except in anaphoric macros?
2:17 amalloy: hoeck: well yes, so far that's it :P
2:18 it's just something i remember having been terrified of when i was learning CL, and clojure too. i'm still glad it's hard in clojure, though
2:19 hoeck: oh well, I did it once in some implementation, capturing a context of 3 vars or so because I did interface with some java lib and the macro did set up some boilerplate to create arguments for class ctors
2:20 yeah, cl has a more brutal approach to that
2:21 amalloy: hoeck: tonight specifically i realized i often wrote ((fn foo* [args] (lazy-seq (...something... (foo* new-args)))) starting-args)
2:21 hoeck: but I could live with symbol capture if there would be some metadata on the macros identifying the captured symbols so that my IDE and tools of choice highlight them
2:22 amalloy: good case for a macro, except it needs the symbol foo* for no particular reason; i decided to call my macro lazy-loop and have it anaphorically bind lazy-recur
2:23 speaking of which, since i've got your attention: https://
2:27 hoeck: amalloy: what is unfold for? seems to be like iterate?
2:27 amalloy: hoeck: it's the opposite of reduce. borrowed from haskell
2:27 hoeck: can you give me some example usage?
2:27 amalloy: i implemented unfold on top of iterate a while ago, and it turns out to be a lot cleaner to just use lazy-seq directly
2:27 https://
2:28 basically (defn fibs [] (unfold (fn [[a b]] [a [b (+ a b)]]) (constantly false) [0 1]))
2:28 hoeck: maybe you should call it "unreduce" then or mention that in the docstring :)
2:29 amalloy: hoeck: unfold is the traditional name for it. reduce is a synonym for fold
2:29 but sure, i suppose i could put that in
2:30 hoeck: I know, I just barely use the term fold, only spending little time inside my xmonad.hs config and more time on the clojure repl
2:30 amalloy: *chuckle*
2:30 well, i don't know any haskell at all tbh. got through chapter one or two of LYAH
2:30 just that brehaut is always telling me about haskell, and plenty of resources online about FP are in terms of haskell
2:32 hoeck: Haskell was my first exposure to functional languages in university some years ago,
2:33 I always miss pattern matching and algebraic datatypes in clojure
2:34 amalloy: hoeck: dnolen (i think?) has a pattern-matching library, and someone tweeted about algebraic data types just the other day
2:35 http://
2:35 hoeck: and of course I don't want them to be much slower than using defrecords and plain ifs :)
2:37 amalloy: thanks, looking at it
2:37 Derander: I'm still struggling to wrap my head around haskell
2:37 it's fun though
2:40 hoeck: what I miss in Haskell is reloading code at runtime
2:53 thorwil: hoeck: maybe this could help, re pattern matching: http://
2:59 hoeck: amalloy: I like that lazy-loop macro
2:59 amalloy: hoeck: feel free to steal; that's what amalloy-utils is for
3:00 hoeck: amalloy: thanks, I have yet to built and maintain my own collection of utils
3:01 amalloy: hoeck: you should! the jvm makes it really easy to distribute/share libraries, even with yourself
3:04 hoeck: thorwil: thanks, that looks really promising
3:06 amalloy: I had one some time ago, and lots of things I wrote myself appeared in core, so I stopped using my stuff and instead used the proper function from core
3:07 and then I'm always afraid of maintaining such a collection, other than that you're right, it is very easy to share and distribute stuff :)
3:07 amalloy: what do you mean by maintaining?
3:08 hoeck: keeping that private util collection working across clojure releases and so on
3:09 amalloy: i wouldn't have thought that'd be so hard, but i guess mine is only a month old or so
3:11 hoeck: it's not hard just boring once it reaches a certain size
3:15 amalloy: it's true, ninjudd's clojure-useful doesn't look like it's fun to maintain
3:21 hoeck: when I really need some utilities, I often write them per project, and try to keep them rather small
3:23 kumarshantanu: hi, anybody with Leiningen plugin-development experience here?
3:24 amalloy: hoeck: per-project is seductive but evil, it seems like
3:24 if something language-level is handy once, it'll be handy again, and i don't want to decide between writing it twice and doing without
3:25 raek: (I've a hello world plugin, but I've used robert.hooke in other projects)
3:25 hoeck: amalloy: yeah, there is no clean solution to it, everything has its drawbacks, but so far I only work on one project :)
3:25 raek: kumarshantanu: go ahead and ask your question... :-)
3:26 kumarshantanu: I put up my questions here (sorry, 4 questions): http://
3:32 raek: kumarshantanu: note that I'm not expert on this, but this is what I know so far:
3:33 plugins run in the leiningen clojure instance and have :dev-dependencies on their classpath
3:34 I made a test plugin that printed the entries of the classpath, and only :dev-deps showed up
3:34 kumarshantanu: raek: thanks, yeah I know that...and not :deps ?
3:34 raek: doesn't seem like it
3:35 kumarshantanu: raek: okay, go on
3:35 raek: I added an ordinary :dep, but it didn't show up in the plugin's classpath
3:35 (but src/ was there)
3:36 kumarshantanu: raek: src was in classpath?
3:36 raek: yes
3:37 (note that I put the plugin in src/leiningen/foo.clj)
3:37 kumarshantanu: and how did you retrieve a list of entries/vars from classpath? (that might come in handy for me)
3:37 raek: it seems like you shouldn't try to run project code in the plugin directly
3:37 but I know that leiningen has a eval-in-project thing
3:38 kumarshantanu: raek: okay, let me elaborate a bit
3:38 raek: kumarshantanu: https://
3:39 kumarshantanu: actually I am trying to write a Lein plugin for Clj-Liquibase (RDBMS migrations, change management etc), so I need access to classpath and need to put configuration code apart from "src" (like Rails)
3:39 raek: doesn't look like resources/ is on the classpath (even if I created it)
3:39 but that will be on the classpath if the plugin is in its own project
3:40 kumarshantanu: raek: could it be because you were picking up *only* the system classpath?
3:40 raek: system classpath?
3:40 kumarshantanu: raek: reference - by looking at the gist
3:41 s/by/am/
3:41 sexpbot: <kumarshantanu> raek: reference - am looking at the gist
3:41 raek: anyway, you can use (require '[clojure.java.io :as io]) (io/reader (io/resource "com/example/foo.txt")) to open something on the classpath
3:42 leiningen does not use a "system classpath"
3:42 I don't think the SystemClassloader is just the standard implementation of a classloader or something
3:42 s/don't//
3:42 sexpbot: <raek> I think the SystemClassloader is just the standard implementation of a classloader or something
3:43 amalloy: raek: i think the system classloader gets some special treatment by the security manager in a sandbox context
3:43 raek: hrm. I would kind of expect lein plugins to have resources/ on their classpaths
3:43 bartj: &(clojure.xml/parse "<root/>")
3:43 sexpbot: java.security.AccessControlException: access denied (java.io.FilePermission /<root/> read)
3:44 bartj: how can I specify that "<root/>" is a string to clojure.xml/parse ?
3:44 kumarshantanu: raek: hmm, I think my question is boiling down to "whether I can have access to `phase` in Leiningen" -- I want access to post-compile phase with classpath and the compiled sources (like in maven, which may not be available in Lein)
3:44 amalloy: bart. don't. put it into a reader
3:45 kumarshantanu: any idea if post-compile stuff is accessible to a Lein plugin?
3:45 bartj: amalloy, documentation mentions that parse takes in a string
3:46 amalloy: bartj: if it *only* wants a string you'll have to pass it some kind of file
3:46 &(doc clojure.xml/parse)
3:46 sexpbot: ⟹ "([s] [s startparse]); Parses and loads the source s, which can be a File, InputStream or String naming a URI. Returns a tree of the xml/element struct-map, which has the keys :tag, :attrs, and :content. and accessor fns tag, attrs, and content. Other parsers can be ... http://
3:46 brehaut: bart: i use the follow monstrosity in necessary-evil to achieve this (-> "<root/>" java.io.StringReader. org.xml.sax.InputSource. stream clojure.xml/parse)
3:46 raek: you can of course make a hook that runs after compilation, but I don't know how to eval something in the project with the newly generated classes in place
3:46 maybe eval-in-project could work
3:46 brehaut: oh wait, remove that stream thing
3:46 bartj: that seems arrgh :)
3:47 amalloy: &(with-in-string "<root/>" (clojure.xml/parse *in*))
3:47 sexpbot: java.lang.Exception: Unable to resolve symbol: with-in-string in this context
3:47 raek: kumarshantanu: I'm afraid I'm stepping into unknown territory now... :-)
3:47 amalloy: &(with-in-str "<root/>" (clojure.xml/parse *in*))
3:47 sexpbot: java.lang.IllegalArgumentException: No matching method found: parse for class com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl
3:48 brehaut: bartj: https://
3:48 amalloy: ugh, that makes a stringreader too
3:48 brehaut: bartj: i wouldnt consider that idiomatic code but it does what i need ;)
3:48 kumarshantanu: raek: thanks, `eval-in-project` sounds interesting
3:50 amalloy: i'm a bit surprised that parse won't take a reader. xml is *supposed* to work with character streams, not byte streams
3:50 but i guess it wants to be allowed to parse the character encoding itself?
3:51 brehaut: amalloy: clojure's xml needs a bit of love in all regards
3:51 amalloy: yeah
3:51 or a little bit of hate, to convince people it needs love
3:51 TobiasRaeder: Morning
3:52 brehaut: i dont think you need to convince anyone
3:53 amalloy: http://
3:53 amalloy: brehaut: what i do need is some sleep. ta-ta
3:53 brehaut: amalloy: night
3:54 bartj: amalloy, thanks!
3:55 brehaut: bartj: if you are just getting started with clojure's xml stuff, i recommend checking out clojure.contrib.zip-filter.xml/xml->
3:57 bartj: brehaut, sure thanks!
3:57 brehaut: no problem
4:00 kumarshantanu: ,(clojure.xml/parse (java.io.StringBufferInputStream. "<root/>"))
4:00 clojurebot: {:tag :root, :attrs nil, :content nil}
4:01 brehaut: kumarshantanu: cool, thanks :)
4:01 kumarshantanu: brehaut: but StringBufferInputStream is deprecated
4:01 brehaut: oh
4:02 kumarshantanu: so, you may have to use ByteArrayInputStream and a wrapper over that
4:02 brehaut: i'll stick with my monstrositiy for now then
4:02 kumarshantanu: brehaut: let me look up and tell you
4:05 (clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<root>XML content here<root/>" "UTF-8")))
4:05 ,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<root>XML content here<root/>" "UTF-8")))
4:05 clojurebot: org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
4:05 kumarshantanu: ,(clojure.xml/parse (java.io.ByteArrayInputStream. (.getBytes "<root>XML content here</root>" "UTF-8")))
4:05 clojurebot: {:tag :root, :attrs nil, :content ["XML content here"]}
4:06 kumarshantanu: brehaut: this version is recommended over the StringBufferInputStream one
4:06 brehaut: kumarshantanu: thanks!
4:11 bartj: hurray parse takes in a InputStream
4:12 I was unnecessary converting it into a String and then reconverting everything back (if that makes sense)
4:12 thanks everyone who helped
5:40 kumarshantanu: ,(.getClassLoader String)
5:40 clojurebot: nil
5:40 kumarshantanu: why does .getClassLoader return nil?
5:41 Fossi: i think it only does with the bot
5:42 ah, no
5:43 kumarshantanu: "Returns the class loader for the class. Some implementations may use null to represent the bootstrap class loader. This method will return null in such implementations if this class was loaded by the bootstrap class loader." Maybe this?
5:46 kumarshantanu: ,(.getClassLoader (class (constantly 10)))
5:46 clojurebot: java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader)
5:46 kumarshantanu: Fossi: got it, thanks!
5:52 no_mind: I have an application which has multiple modules. Each module has its own name space. I am looking for a way to 1) automatically create a list of all namespaces. 2) Call a specific function in all name spaces. The function call will build the menu items and menu paths for the application/modules.
5:58 AWizzArd: no_mind: to do 1) you can write a macro that replaces "ns" and maintains that list.
5:59 And 2) can be done by your own fn "ns-call" which accesses that list and calls those fns.
6:17 Dantas: where can i find the bot commands ?
6:20 fmw: I'm building a web crawler and want to work with data in two/three steps (first, collect the raw documents and store them locally, afterwards I want to scrape them with Enlive to extract the data I'm interested in and store that data and the third step is optional data analysis, e.g. using Apache Mahout)
6:22 Hadoop with HBase seems like a good fit for this (maybe also Riak, but Hadoop works well with stuff like Mahout), but there seems to be a lot of fragmentation as to how to interface with it: cascading, raw map/reduce, pig and hive.
6:22 what are you guys using? I seem Cascading has some mindshare in the Clojure community?
6:25 the easy option would be to store everything in CouchDB and not worry about scaling specifics for now, as I'm already using CouchDB pretty heavily for smaller datasets, but Hadoop/HBase just seems like a better fit for longterm scaling and in combination with other Apache projects I'm (planning on) using (i.e. Lucene/Solr, Mahout).
6:27 powr-toc: what unit-test frameworks are people here using? I've been using clojure.test, but suspect there are better options out there now
6:27 e.g. midje or lazy-test
6:27 fmw: powr-toc: clojure.test
6:29 powr-toc: is anyone using anything for mocking? Right now I'm just rebinding and using atoms/futures to assert callbacks are called etc
6:30 it works ok, but it's a little crufty
6:32 fmw: powr-toc: The Joy of Clojure describes a nice with-redefs function for stubbing
6:35 powr-toc: that macro is going to be in Clojure 1.3 (check the release note of alpha 3)
6:37 powr-toc: fmw: cool I'll check it out
6:39 fmw: powr-toc: http://
6:41 anyway, any hadoop people around to have a look at my earlier question? I'm sure there must be someone, as Clojure seems to be the ideal approach to use the fantastic Apache ecosystem from a sane language (i.e. not Java) ;)
6:43 powr-toc: ahh cool... I'd forgotten about clojure.contrib.mock
6:46 thorwil: i once again have the problem that i would like to feed a macro with a symbol that needs to be expanded. is there such a thing as a runtime macro?
6:47 or any other as-general-as-possible solution to that problem?
6:55 Chousuke: "runtime macro" doesn't really make sense
6:55 unless you're using eval, I guess.
6:57 thorwil: anyway, I don't quite understand your problem
6:57 hoeck: thorwil: do you know that symbol at compiletime?
7:00 thorwil: http://
7:01 i can of course write a macro, taking a keys-vector as argument, bu then i need to have that vector right in the call
7:03 Chousuke: That's probably the best approach to be honest. Or at least the least tricky
7:05 thorwil: Chousuke: but it's almost useless, as that list is needed in several places; thus i would like to put it behind a symbol
7:05 Chousuke: http://
7:05 thorwil: i mean, yes that list is short and copy-pasting it not too painful, but that approach doesn't scale
7:06 clgv: Can I find out in which macrocall a nested macrocall is?
7:06 via &env or something?
7:07 Chousuke: thorwil: if you really need to, you can define a macro that defines a macro. :)
7:07 hoeck: thorwil: or write a macro which binds some var at runtime
7:07 thorwil: Chousuke: i tried. i end up shooting own foot ;)
7:08 ok, ty now i got things to try
7:08 Chousuke: then you could do something like (defsnippetmacro foo [keys-here]) (defsnippetfoo ...)
7:09 thorwil: btw, macro expansion happens before compilation and is a plain replacement operation? as i wonder what happens with a macro call inside a macro call
7:10 Chousuke: thorwil: the macro call gets replaced by the code it expands to, and that is then expanded again, until there are no changes
7:10 If you actually call a macro in a macro (instead of its expansion) then that's expanded when the macro you're defining is compiled
7:14 Keep in mind that macros are just functions. They just have a special purpose; that is, to generate code.
7:18 hoeck: thorwil: and that you can create endless recursive expansions which result in a stackoverflow at compiletime
7:24 thorwil: the global variable approach doesn't seem to work
7:25 in other variations, i run into "Can't take value of a macro"
8:44 bartj: hi is there any maintainer of the clojars website here ?
8:48 sandGorgon: i imported a pure Java class file into clojure. This class has a "private static final String". Can I access this String somehow - even maybe through ns-resolve trickery ?
8:50 hoeck: sandGorgon: maybe using wall-hack-field or writing your own for static fields
8:51 raek: sandGorgon: since it is public, you should not rely on that it exists. iirc, it is possible to circumvent the access control using java.lang.reflect or maybe something in contrib
8:51 s/public/private/
8:51 sexpbot: <raek> sandGorgon: since it is private, you should not rely on that it exists. iirc, it is possible to circumvent the access control using java.lang.reflect or maybe something in contrib
8:53 sandGorgon: hoeck, thanks for the wall-hack-field pointer. i can get started from there. thanks raek
8:53 chouser: it has a more innocuous name in more recent versions of clojure
8:54 hoeck: chouser: oh, which name?
8:55 chouser: It's less memorable too
8:55 * chouser is still looking...
8:55 raek: http://
8:57 chouser: raek: thanks. it always eludes me.
8:58 * hoeck will have a hard time remembering call-method too
8:58 sandGorgon: raek, thanks!
8:59 chouser: It's the namespace I can never remember. I always end up digging around in clojure.reflect.java and being disappointed.
8:59 clgv: If I have a symbol at runtime. How can I define a variable for it in the current namespace?
8:59 chouser: (doc intern)
8:59 clojurebot: DENIED
9:00 chouser: &(doc intern)
9:00 sexpbot: java.lang.SecurityException: You tripped the alarm! intern is bad!
9:00 chouser: sheesh. stupid bots.
9:00 clgv: config
9:00 clojure.core/intern
9:00 ([ns name] [ns name val])
9:00 Finds or creates a var named by the symbol name in the namespace
9:00 ns (which can be a symbol or a namespace), setting its root binding
9:00 to val if supplied. The namespace must exist. The var will adopt any
9:00 metadata from the name symbol. Returns the var.
9:00 chouser: clgv: that's the one
9:00 clgv: ok thx :)
9:01 when I want to check for existance "resolve" should work?
9:01 s/existance/existence/
9:01 sexpbot: <clgv> when I want to check for existence "resolve" should work?
9:01 chouser: clgv: yep
9:07 raek: btw, is there a clojure fn for making a namespace qualified symbol from a (potentially) non-qualified one? (like syntax-quote does)
9:09 something like ##(symbol (name (ns-name *ns*)) (name 'foo))
9:09 sexpbot: ⟹ sandbox10597/foo
9:14 clgv: ##(symbol (name (ns-name *ns*)) (name 'foo))
9:14 sexpbot: ⟹ sandbox10597/foo
9:15 * clgv wonders how the sandbox number is derived ;)
9:20 fliebel: thrush in Python: http://
9:24 Kjellski1: fliebel: Saw that from ycombinator this morning, looks pretty clean =)
9:24 fliebel: Now, if someone would be so kind to write some immutable datastructures…
9:39 clgv: fliebel: why? so that you can do immutable single-thread-programming in python? :P
9:46 chouser: persistent collections are a win even in single-threaded code
9:46 powr-toc: clgv: immutable datastructures are still handy in single threaded programs as they make things easier to reason about
9:46 chouser: ha
10:12 ejackson: oh yeah ! Manning has gotten around to shipping JoC to the foreigners too :D
10:22 * fliebel is still waiting
10:39 TobiasRaeder: :D i just got a notificatio ntoday aswell
10:43 ejackson: i hope mine comes with one of chouser's delicious cookies....
10:43 * Raynes is working on his own book again, seeing as how he is about a quarter inch away from signing a publisher's contract.
10:48 powr-toc: Raynes: Nice! ... what's going to make it different from the existing clojure books?
10:48 TobiasRaeder: gogo Raynes! :D
10:48 duncanm: is there a reason why 0xff works as a literal, but not 0b11?
10:49 cemerick: duncanm: 0x indicates hex; you want 2r11
10:50 ,(= 0xff 16rff)
10:50 clojurebot: true
10:50 Raynes: powr-toc: There will be a free copy available online, for one. Furthermore, it should be 1.3 compatible unless No Starch pushes me into publishing it before then, but even then, it'll have notes about 1.2.
10:50 It's also more Learn You a Haskellish. More lighthearted than the books already around.
10:51 duncanm: cemerick: ah.. but the java lang spec says 0b11 is valid also, why isn't that format also supported?
10:52 ooh
10:52 maybe that's a java 7 feature
10:52 cemerick: yeah, those extended literals are java 7-only
10:52 duncanm: "The integral types (byte, short, int, and long) can be expressed using decimal, octal, hexadecimal, or binary number systems. (You can create binary literals in Java SE 7 and later.)"
10:52 ahh
10:53 0b1010 looks a bit nicer than 2r1010 to me
10:53 powr-toc: Raynes: cool... if its light hearted are the projects going to be more fun orientated than industry orientated?
10:53 duncanm: but i'll have to wait till java 7 ships, then
10:53 cemerick: duncanm: the literals supported by clojure have nothing to do with java literals, except perhaps the shared legacy
10:53 Raynes: powr-toc: You'll find no industry oriented material in this book.
10:54 duncanm: cemerick: well, it says "Numbers - as per Java, plus indefinitely long integers are supported, as well as ratios, e.g. 22/7."
10:54 i'd hope that when Java 7 adds binary literals in the form of 0b...., that Clojure adds the same support
10:54 powr-toc: yay!
10:55 cemerick: duncanm: *shrug* The generality of RrXX is an improvement over the legacy notations IMO.
10:55 powr-toc: cemerick, what does the r stand for?
10:55 cemerick: radix
10:55 powr-toc: radix?
10:55 lol
10:55 cemerick: ,4r34
10:55 clojurebot: For input string: "34"
10:55 powr-toc: I should really engage my brain before asking
10:56 cemerick: whoops
10:56 ,4r33
10:56 clojurebot: 15
10:56 cemerick: It's sometimes handy to have literals for odd bases
10:57 I've never liked the zero prefix for octals. It takes me a number of extra cycles to parse "043" as octal-43, and not decimal 43.
10:59 powr-toc: cemerick, yeah, that's cool... I'd not known about the radix syntax...
11:00 duncanm: cemerick: there's something to be said for that too, i suppose
11:03 powr-toc: w00t unit tests passing again!
11:04 Raynes: powr-toc: http://
11:34 naeu: hey there, any cake-heads in here?
11:35 tasty cake
11:36 ninjudd: ping
11:38 jcromartie: I'm still using rake
11:38 not that they have much to do with one another
11:38 naeu: :-)
11:38 jcromartie: except that cake is a rubygem
11:39 I mean, is Ruby the new Perl or what
11:39 naeu: Ruby is the new Cobol :D
11:39 but, for sure, Ruby has a fine sweet spot doing shell-like stuff
11:39 jcromartie: yeah, that's where it's useful for me
11:39 Cake's persistent JVM might convince me though
11:40 naeu: it's the native library handling that convinced me
11:40 but i'm struggling configuring the classpath
11:40 it doesn't seem to recognise my cake config
11:40 I must be doing something silly
11:42 Raynes: naeu: We actually have a channel for cake #cake.clj. However, ninjudd and lancepantz have been very busy with work lately, so it's largely inactive at the moment. If you post your question to the mailing list, you'll probably get an answer within 24 hours or less.
11:42 naeu: Raynes: thanks, although may I quickly run through what I'm trying to do so you can see if it's sane or not?
11:43 Raynes: Sure. Hop over to #cake.clj
11:57 nickik: is there something like pprint for strings?
11:58 i mean if I have a string with html in it "<h1> <a herf="/"> home </a></h1>" and i would like to see that pritty printed
11:59 ephcon: you mean printing with indentation?
12:08 Licenser: good god jain-sip is one horrible librarie :( it is like a prime example of why I hate jave
12:10 fliebel: When exactly is a watcher fn called? Before or after the actual commit? I think I'm having a problem because the watcher fn set some java in motion that runs before the actual thing is committed, and the java code hapily starts using the old value.
12:11 ejackson: fliebel: i don't know, but the watcher returns both old and new values, so you might be able to solve your issue this way.
12:11 faust45: hi guy's
12:12 i try make jar for clojure-contrib-1.1.0 but fail can any one help me? http://
12:14 fliebel: ejackson: Not really, I do not call the code directly. It's the paintComponent of a JPanel, so there is no way I can get my new value in there.
12:16 ejackson: I could try to use another type of shared data that does commit before calling the watcher.
12:16 faust45: can any one help me with clojure-contrib?
12:16 ejackson: that seems wise
12:16 raek: fliebel: it should be called when the value has for sure been committed
12:17 but when the watch fn is called, the atom/ref/agent value might have changed again
12:17 ejackson: faust45: its not finding any source.
12:17 technomancy: faust45: you shouldn't build clojure-contrib; you should get it from build.clojure.org/releases
12:19 faust45: ejackson: "not finding any source" but why? i just download package from http://
12:20 what's i am doing wrong?
12:20 ejackson: faust45: technomancy is correct. You don't want to build this.
12:20 fliebel: raek: That does not correspond to my observations. The agent contains objects to be painted, and when changed, the watcher marks these regions dirty. The problem is that when it redraws, it still shows the image in the old location. This makes me think the repainting is done before the agent has actually updated.
12:21 ejackson: the reason is that maven needs specific instructions to know how to build clojure source, using the maven-clojure plugin (or something like this). Its more complex than I understand, sorry.
12:21 faust45: technomancy: but what i need to download from http://
12:21 raek: hrm. that might be true for agents
12:22 ejackson: faust45: it used to build with ant I think, dunno anymore
12:22 fliebel: raek: So using a ref would solve it?
12:22 raek: since their updates will never be retried...
12:23 https://
12:24 faust45: technomancy: did you know http://
12:24 raek: an atom will only notify its watchers when the value has been swapped sucessfully
12:24 technomancy: faust45: no, that's too old. look in http://
12:24 raek: faust45: most probably not. clojure-contrib contains precompiled code and such code is not binary compatible between versions
12:25 fliebel: raek: Okay, I'll try atom to see if it's really what it is I think it is… is is...
12:25 faust45: raek: but how i can build package for clojure 1.3.0-alpha6?
12:26 raek: fliebel: looks like agents set the state before notifying too: https://
12:26 faust45: what package?
12:26 faust45: raek: .jar
12:26 raek: also, since 1.3, clojure has been split up into modules
12:27 faust45: how you make a jar for you own project? someone else's project?
12:27 *clojure-contrib has been split up into modules
12:28 waxrosecaveman: How do you actually connect clojure-contrib with clojure?
12:28 ejackson: waxrose: you list it as a dependency in the project.clj or pom.xml file.
12:29 technomancy: faust45: in general building your own jars for things like this is unnecessary; you should just pull in packages others have created with build tools
12:29 ejackson: then (use [coljrue.contrib...] ...) it in your source
12:29 waxrose: ejackson, Thanks. What about for the REPL?
12:29 ejackson: waxrose: it still needs to be on the classpath, leiningen puts it there for you.
12:30 waxrose: Okay, cool.
12:30 raek: waxrose: you do that step, and then run "lein repl" or "cake repl" depending on what build tool you use
12:30 ejackson: at the repl you can type (use 'clojure.contrib.repl-utils), and if it works, then you have it on the classpath
12:30 faust45: raek: so i need setup dependency xml file with reference to http://
12:30 waxrose: Thanks guys. Helpful as always. :D
12:31 fliebel: raek: Okay, the problem lies somewhere else, it persist with atoms.
12:31 raek: faust45: what build tool are you using?
12:31 faust45: raek: mvn
12:32 waxrose: technomancy, You mentioned to me a REPL for Android that is far from development. I actually installed a REPL from the market that is using 1.2 yesterday and it seems to work very well on my phone.
12:33 raek: faust45: I haven't used maven for clojure myself, but maybe this is useful: http://
12:33 fliebel: raek: Weird eh? http://
12:33 raek: it has an example pom.xml file
12:34 fliebel: funky.
12:36 technomancy: waxrose: it's "usable" but not usable to build regular applications with.
12:36 fliebel: raek: Those squares are just to signify there has been a redraw, but the black stuff (only Y!) is leftover image.
12:37 waxrose: True, but it's nice to at least mess around with while in class so I don't have to actually pay attention to my professors.
12:37 faust45: raek: but what you using for run clojure?
12:37 raek: leiningen
12:37 faust45: https://
12:38 faust45: raek: thanks for help
12:38 raek: it has a nice tutorial too: https://
12:39 waxrose: Does anybody know what the deal with The Joy of Clojure? They seem to have pushed the date back of it's print release or B&N must have used an incorrect date.
12:39 :/
12:40 Licenser: waxrose: I think it was just shipped
12:40 Raynes: waxrose: AFAIK, a lot of people have confirmed that it has already been shipped to them.
12:40 Over the past few days.
12:40 * Licenser got his shipping confirmation
12:40 waxrose: Is that just from purchases from manning though?
12:41 Raynes: I suppose.
12:41 Licenser: aloa Raynes :) long time no see
12:41 Raynes: Hi there.
12:41 * ohpauleez got a shipping confirmation, should have it in a few days
12:41 waxrose: Because I work at B&N and there seems to be some issue at B&N.
12:41 Raynes: waxrose: You could just wait for another 10 months or so and buy my book! :>
12:41 waxrose: Raynes, Which is? :P
12:42 Raynes: I've only been to a B&N twice in my life. I don't live near one.
12:42 Meet Clojure
12:42 waxrose: Oh, I didn't hear about that one yet. Will it be on manning as well?
12:43 Raynes: Nope. No Starch. I haven't actually signed the contract yet, so the only real announcement was on my blog a while back.
12:43 waxrose: Oh, I like No Starch. I'll most def buy it when it comes out!
12:44 Raynes: <3
12:44 * waxrose puts on to buy list.
12:44 Havvy: My Inferior Lisp program: java -cp C:/clojure/clojure.jar;C:/clojure/clojure-contrib.jar;C:/Havvy/Code/src clojure.main
12:44 I've a file at C:/Havvy/Code/src/com/havvy/converter.clj
12:44 * Raynes checks marketing off his list of things to do today.
12:44 waxrose: Raynes, Best of with it. :D
12:44 Havvy: (load "com.havvy.converter") fails with the error java.io.FileNotFoundException: Could not locate com.havvy.converter__init.class or com.havvy.converter.clj on classpath: (NO_SOURCE_FILE:0)
12:45 * waxrose checks talking with an author of a clojure book for the week.
12:45 Havvy: So how can I load the file C:/Havvy/Code/src/com/havvy/converter.clj ?
12:45 hiredman: ,(doc load-file)
12:45 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."
12:46 waxrose: Raynes, Opps, I meant best of luck with the book.
12:46 nickik: Raynes, do some more. How do you think your book will compair the others. I mean there are a lot of books coming out. Stu just signed for 2. Edition.
12:47 * waxrose will support Raynes regardless! <3
12:47 Raynes: I think the biggest difference will be the tone of my book. If you've read Learn You a Haskell, you can expect a similar tone in my book.
12:48 It's true, I have a lot of competition, but I think variety is good, and No Starch doesn't seem to be worried at this point.
12:48 waxrose: Competition usually brings out the best of people. That or suicide. >.<
12:48 Raynes: Heh
12:49 raek: Havvy: 'load' expects slashes instead of dots and underscores instead of dashes
12:49 (it's a lower-level operation)
12:50 waxrose: Raynes, Maybe similar to also maybe Land of Lisp?
12:50 Havvy: hiredman, raek: Thanks so far.
12:50 Raynes: waxrose: I suppose, but probably not as intense or as wild as Land of Lisp.
12:51 raek: Havvy: also, I'd recommend to use slime, leiningen and swank-clojure
12:51 waxrose: Not sure if anything can be as wild as _why's poignant guide to Ruby, but nice to know.
12:51 nickik: is Meet ... a naming convention to (like joy of ....., ... in action from manning)
12:51 Havvy: raek: Yeah, I see that everywhere. >_>
12:52 raek: (it simplifies interactive development and handles the classpath for you)
12:55 Havvy: I wish to understand how classpath works before I regalate it to another app.
12:57 raek: a very good thing to do... I just wanted to make you aware of the more convenient options :-)
12:59 Raynes: nickik: Meet Clojure was just a random working title when I started the book. I planned on coming up with a more clever name, but that didn't end up happening and everybody seems to like Meet Clojure.
13:00 nickik: Yeah its a nice name, better then programming clojure or clojure programming :)
13:00 ejackson: i find that i'm being programmed by clojure...
13:01 waxrose: ejackson, Clojure Matrix
13:23 fliebel: Huh? Updating :x in a record in a set cause the watcher to be called, updating :x does not!
13:23 mattmitchell: I'm getting a result set back which has this: {:count(*) 5} -- how do i access the value of :count(*) ?
13:24 fliebel: (make that last one :y)
13:28 amalloy: &(keyword "count(*)")
13:28 sexpbot: ⟹ :count(*)
13:29 amalloy: mattmitchell: though a nicer solution is to modify your sql to be like SELECT COUNT(*) AS cnt ...
13:29 mattmitchell: amalloy: ahh good point :)
13:29 fliebel: This seems to be a bug, or a feature in PersistentTreeSet. When I sort on both :x and :y, it does update!
13:38 Bleadof: If I have a _ in defmacros parameter list, what does it mean?
13:39 hiredman: _ is a normal symbol, but by convention it means whatever it is bound to is not used
13:41 Bleadof: So it's there for readability?
13:41 Indeed
13:41 Now it makes sense
13:43 hiredman, thanks :)
13:49 amalloy: &((fn [a a] a) 1 2)
13:49 sexpbot: ⟹ 2
13:52 __name__: o_O
13:52 amalloy: __name__: it makes sense if you remember that arglists are just the first half of a let binding
13:52 &(let [a 1, a 2] a)
13:52 sexpbot: ⟹ 2
13:53 __name__: yeah, but it seems somewhat counterintuitive for function declarations.
13:54 amalloy: __name__: (fn [_ _ data-i-actually-want] ...)
13:54 fliebel: Is this expected behavior? ##(sorted-set-by #(compare (:x %1) (:x %2)) {:x 1 :y 2} {:x 1 :y 3} {:x 2 :y 2})
13:54 sexpbot: ⟹ #{{:x 1, :y 2} {:x 2, :y 2}}
13:54 amalloy: fliebel: yes, sadly
13:55 if your comparator says that two keys are equal, they can't both be in the set
13:55 fliebel: amalloy: Oh, okay. I solved it by sorting on all the keys I need, but it's weird.
13:56 amalloy: fliebel: it actually couldn't work the other way, i think
13:56 Havvy: Uhg, this client is so unreable.
13:56 *unreadable
13:56 amalloy: because if someone asked you to look up {:x 1 :y 3}, and you (the computer) got to the {:x 1 :y 2} node, which direction would you go down the tree to keep looking?
13:57 it can't be left or right of the current node cause the comparator returns 0, and it's not the current node, so...
13:57 __name__: amalloy: Yeah, makes sense :)
13:58 fliebel: amalloy: I see… Well, I guess you could make the leaf nodes seqs of items, and do hashCode stuff there. I expected it to work like ##(sort [3 2 1 2])
13:58 sexpbot: ⟹ (1 2 2 3)
13:59 amalloy: fliebel: hashcode and equals have to correspond: if two items compare as equal, they are required to have the same hashcode
13:59 because, after all, they're equal :P
14:00 fliebel: But on the other hand, I kind of like this. I am having "unstable" Java stuff in the other keys, so this way, I know for sure it only compares on :x and :y
14:00 amalloy: of course that's not true when you pass in a separate comparator, so maybe that could be made to work. but there's no reason that the duplicated keys would be leaves
14:33 Havvy: http://
14:40 amalloy: Havvy: i don't know the clojure test apis very well. where's the doc for the test function you're calling?
14:41 raek: ,(doc clojure.core/test)
14:41 clojurebot: "([v]); test [v] finds fn at key :test in var metadata and calls it, presuming failure will throw exception"
14:41 vita: hi everyone...I have a problem with java interloop... my function is receiving list of arguments to call some java method on java object...basically I want to do something like (. "abc" substring '(1 2))
14:41 raek: it follows the convention of clojure.test
14:41 vita: but apply can't be used
14:42 is there any way to expand list and to call java method?
14:42 raek: vita: yes: (apply #(.substring "abc" %1 %2) [1 2])
14:42 amalloy: $source test
14:42 sexpbot: test is http://
14:42 raek: you have to wrap the method in a function
14:43 amalloy: you probably need to call (test #'arr), not (test arr)
14:43 raek: since jvm methods are not first class (without reflection)
14:43 Havvy: amalloy: That does it. But why?
14:44 vita: thanks!! but is there any way to dynamically do that for function with n args? sometimes it is passed 2 sometimes more...i am passing java method and arg list of variable size
14:44 amalloy: Havvy: ##(map meta [first #'first])
14:44 sexpbot: ⟹ ({:line 53} {:ns #<Namespace clojure.core>, :name first, :file "clojure/core.clj", :line 48, :arglists ([coll]), :doc "Returns the first item in the collection. Calls seq on its\n argument. If coll is nil, returns nil.", :added "1.0"})
14:44 amalloy: the function itself rarely has much useful meta; most of it is on the var object
14:45 raek: vita: java methods that are variadic actually take an array as its last arg on the jvm level
14:45 ,(String/format "%d%d%d" (into-array [1 2 3]))
14:45 clojurebot: "123"
14:46 Havvy: So (test arr) looks at the actual function while (test #'arr) looks at the var holding the function?
14:46 amalloy: Havvy: indeed. ##(macroexpand '#'arr)
14:46 sexpbot: ⟹ (var arr)
14:46 raek: but for only a fre fixed arities, you'd need to do something like (fn ([o] (.foo o)) ([o x] (.foo o x)) ([o x y] (.foo o x y)))
14:47 Havvy: So is it possible to put metadata on the function itself and not the var holding the function?
14:47 amalloy: Havvy: sure, but you probably don't want to for this
14:47 Havvy: Metadata as a language feature is very interesting none-the-less.
14:48 vita: i know that...bu methods that I call are not variadic... i'm constructing clojure api for some java library...and creating some utility methods to do that.. so i receive the java method name as paramether and list of arguments for that method..and I want to call that method. thanks a lot for help...this idea with anonimous fn is great
14:48 amalloy: Havvy: yeah, i've found a couple uses but it seems to require a lot of experience to recognize when it might be useful
14:48 raek: it is possible to make a macro that uses reflection to build that anonymous fn... :-)
14:49 Havvy: Thank you very much for the help with that. Now I can write unit tests easily.
14:49 amalloy: &(meta (with-meta {:type :awesome} (constantly 1)))
14:49 sexpbot: java.lang.ClassCastException: clojure.core$constantly$fn__3551 cannot be cast to clojure.lang.IPersistentMap
14:49 amalloy: dang it, i always get those backwards: ##(meta (with-meta (constantly 1) {:type :awesome}))
14:49 sexpbot: ⟹ {:type :awesome}
14:51 dakrone: b
14:53 Havvy: amalloy: Try thinking "With meta 'meta' apply to 'form'."
14:54 amalloy: Havvy: that's the wrong order :P.
14:54 Havvy: Oh. :P Everything looks the same in this client. X.X
14:56 vita: ok...i have found another way.to solve this......idea with anonimous fns was good:)
14:56 thanks ;)
14:57 mattmitchell: What's the best way to remove specific items from a vector?
14:58 gigamonkey: What's the relationship between defprotocol and defmulti?
14:58 I.e. does defprotocol implicitly do a bunch of defmulti's?
14:59 raek: gigamonkey: no implicit relashionships
14:59 amalloy: mattmitchell: by not using vectors :P
14:59 or, ##(remove #{1 5 7} (vec (range 10)))
14:59 sexpbot: ⟹ (0 2 3 4 6 8 9)
15:00 amalloy: gigamonkey: defprotocol uses java inheritance
15:00 raek: mattmitchell: you can use subvec to pick out the parts to the left and right of the element, and the 'into' the right one into the left one, but that runs in linear time
15:00 amalloy: making it a more limited, faster version of defmulti
15:00 gigamonkey: Ah, I see, so protocols are single-dispatch only.
15:00 raek: protocols have some additional stuff outside the regular java stuff to make them more dynamic, though
15:01 cemerick: gigamonkey: yes, and only on the concrete type of the first arg; no dispatch fn anywhere
15:01 mattmitchell: amalloy: thanks!
15:01 thorwil: hmm, how to escape an (that will be passed as string to a enlive transformation)?
15:01 sritchie: &(reduce + (map (fn [x] (* x x)) (range 10)))
15:01 sexpbot: java.lang.NullPointerException
15:01 sritchie: why does that give a nullpointerexception?
15:02 raek: gigamonkey: stuarthalloway explains this very good in this video: http://
15:02 amalloy: sritchie: does it give an NPE outside of sexpbot?
15:02 oh i bet i know
15:02 sritchie: it gives 285
15:02 in the repl
15:02 amalloy: someone used findfn and accidentally deleted +
15:03 raek: thorwil: enlive should do html escaping automatically
15:03 amalloy: $login
15:03 sexpbot: You've been logged in.
15:03 amalloy: $reload
15:03 sexpbot: Reloaded successfully.
15:03 amalloy: &(reduce + (map (fn [x] (* x x)) (range 10)))
15:03 sexpbot: java.lang.NullPointerException
15:03 amalloy: sigh
15:03 sritchie: &(reduce * (map (fn [x] (* x x)) (range 5)))
15:03 sexpbot: ⟹ 0
15:03 sritchie: haha, oh yeah, whoops
15:03 &(reduce + (map (fn [x] (* x x)) (range 1 10)))
15:03 sexpbot: java.lang.NullPointerException
15:03 sritchie: &(reduce * (map (fn [x] (* x x)) (range 1 5)))
15:03 sexpbot: ⟹ 576
15:03 sritchie: &(reduce + 1 (map (fn [x] (* x x)) (range 1 5)))
15:03 sexpbot: java.lang.NullPointerException
15:04 raek: thorwil: ...by using 'content' instead of 'html-content', which does not do escaping
15:04 amalloy: &(reduce + 1 (map (fn [x] (* x x)) (range 1 5)))
15:04 sexpbot: ⟹ 31
15:05 thorwil: raek: i found that it will write out " ", but using "/240" seems to work to get a space into the html
15:05 mattmitchell: how can i compare two hash-maps, where if all keys are present in both maps, with the same paired values, the result would be true...
15:05 thorwil: raek: oh well, i'm using content already
15:05 raek: thorwil: in addtion, you can type that character in your strings with "\u00a0"
15:05 amalloy: mattmitchell: that sounds like = to me
15:06 mattmitchell: ,(= {:id 1 :name "sam"} {:name "sam" :id 1})
15:06 clojurebot: true
15:06 mattmitchell: ahh :)
15:06 ok
15:06 thorwil: raek: thanks!
15:07 sritchie: $botsnack
15:07 sexpbot: sritchie: Thanks! Om nom nom!!
15:07 sritchie: amalloy: cool, thanks
15:08 cgray: hi, is there any way to have the same name for two different functions in two different namespaces?
15:08 cemerick: cgray: that's what namespaces are all about :-)
15:09 cgray: cemerick: that's what I thought :)
15:09 but I have (ns foo.bar) and (ns foo.baz (:require [foo.bar :as bar]))... both have quux as a function, and I get problems compiling
15:10 cemerick: cgray: you'll have to be more specific
15:10 amalloy: cgray: restart your repl and/or swank?
15:11 it's not unlikely that you had a broken require/use earlier that's still in the way
15:11 Havvy: The REPL is awesome BTW.
15:11 cgray: error: java.lang.IllegalStateException: quux already refers to: #'foo.bar/quux in namespace: foo.baz
15:11 Havvy: How do you end it without closing the buffer?
15:12 cgray: amalloy: i'll try that
15:13 cemerick: cgray: assuming a REPL restart fixes your issue, you could have gotten there without a restart using ns-unmap
15:14 cgray: no, restarting the repl just made the problem different :)
15:14 Havvy: ,doc ns-unmap
15:14 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/doc
15:14 amalloy: (doc ns-unmap)
15:14 clojurebot: "([ns sym]); Removes the mappings for the symbol from the namespace."
15:15 cgray: oh, I see the problem now, I had circular requires
15:15 Havvy: Can that be used to remove a dynamically created var?
15:16 amalloy: Havvy: the answer to your question is yes, but i don't actually understand the question
15:18 Havvy: My "Learn LISP" program is a program that dynamically creates functions that converts data from one type to another so that if you have a converter a=>b and b=>c, it will create a=>c automatically. For testing purposes, I'll need to unbind the created functions.
15:18 raek: ns-unmap and remove-ns can be used to remove (accidentally) introduced vars and namespaces
15:18 Havvy: (doc remove-ns)
15:18 clojurebot: "([sym]); Removes the namespace named by the symbol. Use with caution. Cannot be used to remove the clojure namespace."
15:20 fliebel: I thought sets where seqs to? UnsupportedOperationException nth not supported on this type: PersistentTreeSet
15:21 raek: neither maps, vector not sets are seq
15:21 s
15:22 ,(map seq? (list 1 2 3) [1 2 3] #{1 2 3} {:a 1, :b 2})
15:22 clojurebot: java.lang.IllegalArgumentException: Wrong number of args (4) passed to: core$seq-QMARK-
15:22 raek: ,(map seq? [(list 1 2 3) [1 2 3] #{1 2 3} {:a 1, :b 2}])
15:22 clojurebot: (true false false false)
15:22 Havvy: ,(seq #{1 2 3})
15:23 clojurebot: (1 2 3)
15:23 amalloy: fliebel: they're seqable, but not seqs
15:24 fliebel: well, of course… I should know these things by now… I thought the data structures page said so, but looking at it, it just says "Sets are collections"
15:24 raek: sets are not sequential collections, so therefore they don't support nth
15:24 amalloy: &(let [[a b] (seq #{1 2 3 4})] b)
15:24 sexpbot: ⟹ 2
15:24 raek: ,(map sequential? [(list 1 2 3) [1 2 3] #{1 2 3} {:a 1, :b 2}])
15:24 clojurebot: (true true false false)
15:25 raek: hrm
15:25 amalloy: raek: eh?
15:25 fliebel: raek: What about sorted-set?
15:25 raek: ,(nth {:a 1, :b 2} 0)
15:25 clojurebot: java.lang.UnsupportedOperationException: nth not supported on this type: PersistentArrayMap
15:25 amalloy: fliebel: no
15:25 fliebel: &(sequantial? (sorted-set 1 2 3))
15:25 sexpbot: java.lang.Exception: Unable to resolve symbol: sequantial? in this context
15:25 fliebel: &(sequential? (sorted-set 1 2 3))
15:25 sexpbot: ⟹ false
15:26 amalloy: arguably they *could* be marked as sequential, because there is a clear order, but that would have some bad side effects elsewhere i suspect
15:26 fliebel: amalloy: Like what?
15:27 raek: I think this has been discussed on the clojure-dev list recently
15:27 amalloy: fliebel: code that assumes (conj foo bar) will make foo longer if it's sequential, for example
15:28 fliebel: hm
15:29 Uh, is there any wait to make iterate behave? I mean, make it stop sometime. Or do I really need to wrap it in take?
15:29 amalloy: fliebel: take-while is about it
15:29 raek: reminds me of unfold
15:29 amalloy: i do have an "iterations": https://
15:30 raek: yeah, they're pretty closely related
15:37 fliebel: is the above close to what you wanted?
15:45 cgray: is there a way to have something run at the beginning of the program, but not when being compiled?
15:46 fliebel: amalloy: Exactly what I needed, just get all the restses.
15:46 raek: cgray: it can be a good idea to keep that code in a (defn -main [...] ...)
15:47 cgray: raek: ok, thanks
15:48 raek: then you can use it with "lein run", generate a main class, etc
15:48 cgray: raek: it's a servlet... will it still be run?
15:49 fliebel: Sweet! Detecting collisions for 50 objects in 5ms
15:50 cgray: raek: well, it compiles, so I'll give it a try :)
15:53 raek: cgray: it will not run automatically by compiling it, nor bt loading it
15:54 cgray: ahh, so is there something that will run automatically when it is loaded, but not when it is compiled?
15:55 raek: no, loading and compiling is mostly the same thing
15:55 (unless you do Ahead Of Time compilation)
15:55 cgray: if you have a repl, start the servlet by running the -main function
15:55 cgray: that's what i'm doing
15:56 i'm running on google app engine
15:56 raek: ah, you're generating a jar file?
15:56 cgray: yeah
16:08 fliebel: Weee! http://
16:21 chouser: fliebel: colliding ... satellites?
16:22 fliebel: chouser: Yea, aren't they pretty? haha, I just made collision detection for my Clojure game(engine)
16:23 powr-toc: Does anyone here know how to adjust emacs layout rules for clojure? Indentation seems to indent to the first function arg, which is often too much (especially if the function name is long)
16:23 ?
16:24 hiredman: ((partial some-fn first-arg) arg2 arg3) is a indentation hack I am not above using
16:24 (for which I will burn)
16:24 chouser: ha!
16:25 hiredman: I had to read that at least 3 times to understand what your point, but that is, indeed, worthy of a burning.
16:25 * fliebel wonders if any games have been written in Clojure before.
16:26 chouser: fliebel: snake!
16:26 fliebel: chouser: Where? *googles*
16:27 http://
16:27 dnolen: fliebel: somebody had built a fairly fleshed out strategy game in Clojure, I recall 7K LOC or something.
16:27 fliebel: Penumbra has several games in it Tetris, Asteroids, Pong
16:27 fliebel: dnolen: Name?
16:28 dnolen: all deliciously short
16:28 fliebel: check the ML, don't recall.
16:28 brehaut: fliebel: brian carper was working on a little rpg at one point
16:28 hiredman: speaking of the ml http://
16:28 fliebel: dnolen: I'm using Swing, for which I shall burn together with hiredman
16:29 chouser: fliebel: epic snake thread from yesteryear: http://
16:29 brehaut: fliebel: http://
16:38 fliebel: brehaut: Thanks for that. Very good to know I'm not alone. But in fact, I *am* using agents and all. Hopefully cemerick was right in his comment.
16:45 amalloy: dnolen, fliebel: i think that strategy game had the word iron in the name
16:46 b6n: Hi, is there a way to get a list of functions loaded by a load-file call?
16:46 amalloy: http://
16:46 ironclad
16:47 fliebel: amalloy: thanks :)
16:52 mec_: How do i get java to use the jdk instead of the jre?
16:53 technomancy: b6n: no, but you can list all the top-level vars in a namespace, which is a higher-level version of that
16:57 mec_: Or rather, when I install the jdk, why does it also install and use the JRE instead
17:01 b6n: technomancy: my intention is to load a .clj file from somewhere and call some of its functions which have some special meta data. So I maybe don't know the namespace defined there. Do I have a chance to do that?
17:01 technomancy: b6n: load-file is very low-level; it's much better to work in terms of namespaces with use and require.
17:02 I'm not sure if that's doable with just load-file
17:07 amalloy: technomancy: maybe (let [forms (read the file) vars (doall (filter var? (map eval forms)))] ...now vars is all the vars defined...)
17:08 b6n: I thought about filtering what (all-ns) would provide me
17:15 technomancy, amalloy: thanks guys I think I'll try my luck with a mixture of your answers. :-)
17:15 technomancy: b6n: are you ben black?
17:16 joly: Yay, Manning shipped my JoC copy this morning!
17:17 b6n: technomancy: no I'm not ben black
17:17 technomancy: ah ok, different b6n
17:21 b6n: And I thought it would be innovative… ;-)
17:43 powr-toc: technomancy: I'm using clojure-test-mode and find its recommendations for C-t working a little odd... i.e. to put the files in test/foo/bar/test/baz.clj ... why not put the test first in the package name and be done?
17:44 s/for/to get/
17:44 sexpbot: <powr> technomancy: I'm using clojure-test-mode and find its recommendations to get C-t working a little odd... i.e. to put the files in test/foo/bar/test/baz.clj ... why not put the test first in the package name and be done?
17:44 powr-toc: ha cute! :-_
17:45 s/:-_/:-)/
17:45 sexpbot: <powr> ha cute! :-)
17:52 chouser: is there something like clojure's constantly in ruby?
17:58 technomancy: chouser: I doubt it. try explaining why you would want such a thing to a rubyist and see what kind of reaction you get. =)
17:58 powr-toc: I'm not all that satisfied with the C-t behaviour myself, but you can adjust where it inserts the "test" segment
17:59 clojurebot: why can't you do things like (describe-variable clojure-test-ns-segment-position) ?
17:59 clojurebot: No entiendo
18:00 technomancy: hiredman: when is clojurebot going to learn about elisp?
18:02 hiredman: technomancy: later
18:09 raek: hrm, does the JVM enforce that methods only throw checked exceptions if has declared so, or is this just Java?
18:09 hiredman: just java
18:16 powr-toc: technomancy: cool... how do you do that?
18:16 amalloy: hiredman: really? so you could write some jvm assembly to throw an IOException from a method that doesn't declare it, and it would verify?
18:16 powr-toc: I couldn't see anything in customize
18:17 hiredman: amalloy: yes
18:17 amalloy: rich just yanked all declared exceptions out of clojure for 1.3
18:17 amalloy: hiredman: i think he did that by wrapping them in runtime exceptions though
18:17 hiredman: nope
18:17 he did that to stop someone else from wrapping them in runtime exceptions
18:18 wrapping is bad, no way rich would do that unless force to
18:20 powr-toc: amalloy, I heard about that change, but don't really understand what it means or refers to... Clojure doesn't have checked exceptions anyway... so I'm guessing its something else...
18:23 hiredman: some exceptions are generated in java source code, so they had to be changed to be runtime exceptions, but clojure code can do either
18:24 * raek is reading Semantics of Java Byte Code
18:27 powr-toc: hiredman: so what's the difference for day-to-day use? You can no longer catch a specific exception type?
18:29 technomancy: powr-toc: I don't usually use customize; you can setq it
18:29 hiredman: powr-toc: you can do whatever you want, you just can't depend on not getting checked exceptions
18:31 powr-toc: hiredman: can't depend on getting, or cant depend on not getting?
18:33 sorry ... being dumb
18:44 duncanm: raek: is that a book?
18:45 this must be an FAQ, is there a reason why the clojure compiler requires everything be forward referenced?
18:46 it always bothered me some that i had to order my functions in the order that they're used
18:46 oh, i found it
18:46 the explanation
18:46 brehaut: duncanm: link?
18:47 raek: ftp://ftp.dina.kvl.dk/pub/Staff/Peter.Bertelsen/jvm-semantics.ps.gz
18:48 duncanm: I'm curious, what did you find?
18:49 duncanm: https://
18:50 raek: that guy is worth reading? the info is solid?
18:50 hmm
18:50 i see, it's that sort of 'semantics'
18:50 it's not really my cup of tea ;-P
18:53 brehaut: huh, i dont recall ever seeing an *exports* declaration in a clojure library (mentioned in the post duncanm linked); what happened to that convention?
18:54 duncanm: brehaut: most likely it's put on hold
18:54 i suppose you can use defn- for all the 'private' members, right?
18:54 brehaut: yeah or ^:private
18:54 duncanm: any Scala programmers here?
18:55 i started looking into Scala, particularly for their Scala Swing package
18:55 it'd be fun to see if there's anyone else interested in doing some hacking to get a nicer API for writing Swing in Clojure
18:56 it's a simple one, but having (defaction ...) could be nice
18:56 i dunno if it makes sense to do defjcomponent
18:58 brehaut: duncanm: perhaps have a browse through http://
18:59 duncanm: brehaut: yeah, that's from a while ago
19:00 brehaut: i think it'd be interesting to have a defaction that returns an instance that implements both Swing's Action and Clojure's IFn
19:02 i suggested SAM-conversion on IRC before, and Rich responded and shot it down
19:02 but now that it's planned for Java 7, or 8, maybe clojure should have it also
19:03 brehaut: thats a dubious logic to follow ;)
19:03 amalloy: duncanm: Raynes is just in the middle of starting to do a swing library
19:03 Raynes: amalloy: Oh man, that thing isn't going to see the light of day for months probably.
19:03 duncanm: Raynes: let's do it!
19:03 amalloy: or i guess he's just in the beginning of starting. can't really be in the middle of the beginning
19:04 Raynes: Don't go getting peoples hopes up yet. Now that I have to get my ass in gear on this book, I'm not going to have much time for projects.
19:04 Especially new ones.
19:04 duncanm: Raynes: maybe we should talk sometime, i'd like to get some ideas
19:05 Raynes: Sounds like fun. :>
19:05 duncanm: Raynes: i've been wanting to write something to make swing hacking nicer for a while
19:05 seeing the Scala Swing stuff really got me excited
19:05 i even bought the Scala to learn Scala, mostly just because I want to use Scala Swing
19:05 the Scala Book
19:05 Raynes: Heh.
19:05 duncanm: but man, that's a complicated language
19:06 i'm too lazy to learn where all the implicit blocks are allowed
19:06 and that's only syntax
19:06 i dunno, maybe someone else here could set me on the right path
19:06 Raynes: i like this (def-action ...) idea a lot
19:07 amalloy: Raynes: dude, you were the one who tweeted it, and claimed i was helping you with it, before you had any ideas or code. no complaining that *i'm* promoting it too soon
19:07 duncanm: i realized that defaction looks a lot like defecation
19:07 __name__: defaction could be de-faction, the opposite of faction!
19:09 duncanm: Raynes: oh, this shoes thing could be interesting
19:15 boo
19:16 i had hoped that (inspect clojure.lang.IFn) would give me a nice swing dialog with all the members
19:18 la la la
19:20 sritchie_: there we go
19:20 whoops, sorry, wrong group :)
19:26 hiredman: IFn is a pretty sparse interface
19:27 mostly just invoke in a billion arities
19:31 eugu: chouser: with Enumerators in ruby 1.9 it's possible to emulate lazy sequences in ruby, see my take at constantly http://
19:32 duncanm: hmm, my copy of Joy of Clojure will arrive tomorrow
19:32 i was reading a bit of it on my nook
19:40 whoa
19:40 pdlogan = patrick logan?
20:06 joshua__: &find_fn "123" "1" true
20:06 sexpbot: java.lang.Exception: Unable to resolve symbol: find_fn in this context
20:06 joshua__: find_fn "123" "1" true
20:06 $find_fn "123" "1" true
20:06 brehaut: $findfn "123" 1 true
20:06 sexpbot: [clojure.core/not= clojure.core/distinct? clojure.core/contains?]
20:07 joshua__: brehaut, .. the sad thing is that I'm the one who wrote that plugin...
20:07 brehaut: joshua__: haha :)
20:08 joshua__: (def in? contains?) good idea/bad idea?
20:10 amalloy: joshua__: evil
20:10 joshua__: amalloy, but it is more concise and expresses the same concept =/
20:10 amalloy: (says the guy who has (defalias ! complement))
20:11 i mean, i guess it's fine. as long as you're doing it to save typing, and not because the name contains? is confusing
20:11 pdk: (doc defalias)
20:11 clojurebot: No entiendo
20:12 joshua__: Guys, I'm learning Spanish.
20:12 The bot said he doesn't understand.
20:12 That is all.
20:13 Derander: joegallo: muy bien
20:13 pdk: ohhh que pena es esto
20:13 amalloy: Derander: ¿quieres decir joshua?
20:14 Derander: amalloy: ¿Decirte que?
20:14 oh
20:14 sí
20:14 joshua__: see above for random spanish response
20:14 joegallo: sorry for random spanish
20:30 joegallo: Derander: I was so excited that my name was mentioned in here, but now I'm muy disappointed.
20:30 :)
20:33 Derander: joegallo: lo siento señor
20:34 Raynes: Is there a 1.3 changelog lying around anywhere?
20:39 mec: https://
20:39 joshua__: $findfn "123" "1" true
20:39 sexpbot: [clojure.core/not= clojure.core/distinct?]
20:40 Raynes: mec: Duh. Thanks.
20:44 amalloy: $findfn "123" \1 true
20:44 sexpbot: [clojure.core/not= clojure.core/distinct?]
20:44 amalloy: bmph
21:17 mec: any chance 1.3 will have unsigned bit shift?
21:22 brehaut: mec: the jvm has no unsigned types, so it seems unlikely
21:28 amalloy: it's not hard to write an unsigned shift, but as brehaut says there are no unsigned primitives, so it wouldn't be fast
21:37 joegallo: java has a >>> for unsigned shift right, which doesn't seem to have a clojure equivalent
21:37 that is, it shifts a zero into the leftmost position
21:39 i don't see why it wouldn't be fast to just call through to that
21:49 >>> seems to be supported by the iushr and lushr opcodes at the jvm level
22:00 Raynes: Licenser: You wouldn't happen to be around, would you?
22:10 amalloy: joegallo: i didn't know java had >>>; i suppose i've never needed it
22:11 joegallo: You and most of the rest of the world. ;)
22:11 I've never needed it either.
22:11 Just one of those little trivial edges out there.
22:18 amalloy: i just wish java would go ahead and get unsigned types
22:18 joegallo: that would be awesome
22:38 Quick implementation of unsigned-bit-shift-right, passed the lamest of manual tests https://
22:38 almost certainly wrong in some way
22:40 the interesting thing to this is that BigIntegers don't support unsigned shift right, as there is no fixed register size for their abstraction, my implementation just make unsigned-bit-shift-right behave as bit-shift-right for BigIntegers. alternatively, you could get more clever by doing something else.
22:59 amalloy: joegallo: not clear what would be more clever. 0, followed by infinite ones?