#clojure logs

2010-04-02

00:00_atobecause foo is *ns*/foo
00:00_atoif that makes any sense
00:02_ato,(require '[clojure.contrib.seq-utils :as foo])
00:02clojurebotnil
00:02_ato,foo
00:02clojurebotjava.lang.Exception: Unable to resolve symbol: foo in this context
00:02_ato,foo/partition-by
00:02clojurebot#<seq_utils$partition_by__707 clojure.contrib.seq_utils$partition_by__707@112de47>
00:02_ato,`foo
00:02clojurebotsandbox/foo
00:02_ato,`foo/partition-by
00:02clojurebotclojure.contrib.seq-utils/partition-by
00:03psykotic,`foo/flatten
00:03clojurebotclojure.contrib.seq-utils/flatten
00:05_ato,(ns-unmap *ns* 'foo)
00:05clojurebotnil
00:05_ato,`foo/partition-by
00:05clojurebotclojure.contrib.seq-utils/partition-by
00:05_ato,(ns-unalias *ns* 'foo)
00:05clojurebotnil
00:05_ato,`foo/partition-by
00:05clojurebotfoo/partition-by
00:05_atoeh...
00:05_atooh right, yep
00:06_ato,foo/partition-by
00:06clojurebotjava.lang.Exception: No such namespace: foo
00:12riddochcOkay, looks like the change in clojure that breaks clj-peg is 332a5a. (I know, clj-peg needs fixing, not clojure.)
00:13riddochcSo, I could use a little help in narrowing down where to look...
00:13riddochcThe code is: (ns bughunt (:use (com.lithinos.clj-peg core string-wrapper)))
00:13riddochcThat works in versions of clojure before 332a5a.
00:14cemerickwhew, that's a doozy
00:15riddochcSpecifcally, this is the kind of error I'm seeing:
00:15_atoI wonder if that's just the usual restfn error due to incompatible AOT-compile?
00:15riddochc java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V (NO_SOURCE_FILE:1)
00:15_atoyeah
00:15cemerickyup
00:15riddochcOkay, what should I be looking for?
00:15cemerickriddochc: probably just need to re-AOT-compile
00:16cemericktry running against sources
00:16cemerickif only we had hiredman's fantasy ABI
00:17riddochcWell, there's an issue... clj-peg doesn't come with any build.xml or whatever the maven equivalent is, or *any* sort of build system, as far as I can tell. o.O
00:18_atoit's just pure clojure isn't it? you don't actually need to build it
00:18cemerickriddochc: unless you need AOT compilation, you don't need it ;-)
00:18_atotry just sticking the clj-peg.zip (the source zip) on your classpath
00:18_ato 20623 2010-02-15 22:44 com/lithinos/clj_peg/core.clj
00:18_atoyou probably don't even have to unpack it, as the paths are right ;-)
00:18riddochcThat should work? Weird. New to java, as you can tell.
00:19cemerickriddochc: yes, unless gen-class, etc. is used
00:19cemerickAOT compilation is a tradeoff that a lot of use cases don't require
00:20_atoah damn
00:20_atoit does use gen-class
00:20_atocustom exceptions :(
00:20technomancyboo
00:21technomancy_ato: how goes?
00:21technomancyschool keeping you busy?
00:21riddochcWell, I should be able to narrow this down better, since I can just use the zip... (which I'm trying now)
00:24riddochcHmmm. java.lang.ClassNotFoundException: com.lithinos.clj_peg.PegError (core.clj:9)
00:24_atoyeah.. that's it wanting gen-class
00:25_atotechnomancy: finished school, now work's keeping busy, heh. Don't get to use Clojure enough at work, but _mst's managed to sneak in a couple of minor bits and pieces in it. ;-)
00:25technomancynice =)
00:26technomancysecret lisp!
00:27_atoriddochc: unpack it somewhere and do this: java -cp clojure.jar:clojure-contrib.jar:. -Dclojure.compile.path=. clojure.main -e "(compile 'com.lithinos.clj-peg.PegError)(compile 'com.lithinos.clj-peg.CyclicalError)"
00:27_ato(need to change the paths to your clojure and contrib jars)
00:28riddochc_ato: Thanks, I'll try that.
00:28technomancyalso: submit a bug to the author
00:28cemerickriddochc: alternatively, you *could* try putting the source jar first in the classpath, with the binary jar second (hoping everything except for the gen-class classes get picked up from the second).
00:28technomancybecause honestly. =)
00:33_atough.. looks like core needs compiling as well
00:33_atoit uses get-interface
00:33_atoerr gen-interface
00:33riddochc_ato: Okay, that output two lines: com.lithinos.clj-peg.PegError and com.lithinos.clj-peg.CyclicalError. Looks like I have some .class files in the same place as the .clj files, then.
00:34riddochcOkay, I'll add something to build core, too.
00:35riddochcSpewed lots of lines starting with "No defn for processing "... when I added (compile 'com.lithinos.clj-peg.core)
00:36riddochcBut there's more .class files. Doesn't *look* quite like an error?
00:36_atohmm.. don't think I've seen that before
00:36_atoguess you could give it a go
00:36_atojust add the directory you unpacked it to to your classpath (or create a jar: jar -cvf ../peg-clj-fixed.jar *)
00:37riddochcOkay, how do I get from here to either a .zip or .jar I can put on the classpath? Or is there another way to use...
00:37riddochcAh, thanks.
00:41riddochcAwesome. (ns bughunt (:use (com.lithinos.clj-peg core string-wrapper))) works now.
00:41riddochcOr, at least, it returns 'nil' instead of erroring out.
00:41riddochcSo, when I use a newer version of clojure, I should be rebuilding clj-peg's jar?
00:43riddochc(Assuming I've accounted for other things changing in clojure that would cause source-level incompatibilities?)
00:44dualpi'm getting a problem on the line (require 'swank-clojure-autoload) while following the guide at http://riddell.us/ClojureWithEmacsSlimeSwankOnUbuntu.html
00:45cemerickriddochc: that'd be safest, yeah
00:45dualpFile error: Cannot open load file, swank-clojure-autoload
00:46cemerickriddochc: I'd recommend setting up either maven (google clojure-maven-plugin) or lein so rebuilding clj-peg is less painful next time.
00:47riddochccemerick: I was experimenting with lein the other day. Haven't touched maven, I've been trying to avoid the Java side of things.
00:48riddochccemerick: Which would you recommend?
00:48cemerickriddochc: maven isn't Java, anymore than lein is, anyway
00:48cemerickriddochc: I'm on record. :-) http://muckandbrass.com/web/pages/viewpage.action?pageId=5570562
00:49_atodualp: I think that guide is out of date
00:49_atodualp: try http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs
00:49cemerickriddochc: whoa, odd raw URL; I meant http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer
00:49cemericktho it doesn't matter
00:51cemerickriddochc: I should mention that there's hardly unanimity around build tools in clojure-land at the moment. I suspect clojure-flavored polyglot maven will settle the issue in due course, tho.
00:54riddochccemerick: I'd kinda gathered that from various blogs I've been following. I'lll add this to my list...
00:55absalomI'm trying to figure something out here.. and I think maybe I am just being stupid, but...
00:56absalomI see examples using lazy-seq that would blow the stack if you wrtoe them without the macro...
00:57absalomI'm trying to figure out how that works.
01:09AntonyBlakeyAnyone know how to add compiler metadata in a macro - when I macroexpand the #^{...} is gone
01:10cemerickAntonyBlakey: The reader is gone by the time macroexpansion happens. You need to use with-meta on the symbols you emit from your macro.
01:11AntonyBlakeyThat's what I thought, but Stuart's book says that with-meta isn't for compiler metadata e.g. type annotation.
01:12AntonyBlakeyThe with-meta appears in the macroexpansion. Or should I be manafacturing my own symbols and annotating that?
01:13cemerickAntonyBlakey: That's what I've always done. e.g. (with-meta some-symbol {:tag symbol-of-classname}), etc
01:13AntonyBlakeye.g. ~(with-meta "v" {:tag klass})
01:14cemerickno, you can't add metadata to a string
01:15AntonyBlakeysorry (symbol "v")
01:16cemerickAntonyBlakey: that should work. Note that the value of :tag must be a symbol of the classname, *not* a class object.
01:16cemerickThat's tripped me up a number of times.
01:16AntonyBlakeyOK, done that. Do you have any suggestion for how to verify that the metadata is there. It doesn't appear in macroexpand-1 output (as I thought it wouldn't)
01:16AntonyBlakeygood tip
01:17cemerickwell, you can macroexpand it, and then get the meta of the symbol you expect to be hinted or whatever
01:17cemerickthe meta you add in your macro is not going to turn into reader syntax for meta tho
01:17_atohmm
01:18_ato,(binding [*print-meta* true] (println (with-meta 'v {:hello :world})))
01:18clojurebotv
01:18_atoguess it doesn't work
01:19cemerickyou want
01:19cemerick,(binding [*print-meta* true] (prn (with-meta 'v {:hello :world})))
01:19clojurebot#^{:hello :world} v
01:19cemerickbut that's not the point -- macroexpand doesn't print, it returns symbols
01:19cemerickI guess it doesn't matter if you're just tinkering :-)
01:20_atoright, but you can print the result of macroexpand
01:20AntonyBlakeyThat did it, although it would be nice to get pretty-print + *print-meta* = true
01:20AntonyBlakeyStill, good enough for verifying that it works, thanks.
01:21cemericka good repl will pretty print for you
01:21cemerickand there's pprint otherwise
01:21AntonyBlakeyYeah, but the pretty printer doesn't honour *print-meta*
01:23cemerickhrm, I wonder what enclojure is doing, then
01:25AntonyBlakeyWell, contrib pprint prints meta, but the standard enclojure pprinter doesn't
01:26AntonyBlakeyAh, yes it does, if I (set! *print-meta* true) rather than binding. Still I thought the binding was dynamic scoping
01:27cemerickenclojure's printing happens after your binding form pops off
01:27brian__i'm trying to use "append-spit" to write data returned as a lazyseq to a file, I know its there because I can println it out, I've tried (doll line), but doesnt work
01:27cemerickor, I'd presume
01:27cemerickg'night all :-)
01:28brian__doalli mean
01:31dualpspeaking of enclojure, i'm trying it out and running into a problem. I create a new Clojure project, type a name and namespace and hit Finish, but no project files appear after that. If i try loading the same project again it can't be loaded either. Using the latest march release.
01:33dualphm scratch that, somehow i've created one this time around.
02:00nteonso i have a function that returns a seq. how can I force it to be evaluated at macro-expansion time when its passed as an arg to a macro of mine?
02:00hiredmanyou can't
02:01hiredmanfunctions don't run until runtime
02:02nteonhiredman: makes sense :) thanks
02:18nteonis the binding macro thread-local?
02:18hiredmanhave you read the docs?
02:19hiredmanhttp://clojure.org/vars
02:20nteonhiredman: I'd read (doc binding), I hadn't read that. that answers iot
02:34nteonokay. so if I have a macro '(defmacro mac-test [] (let [s (gensym "s")] `(let [~s *x*] ~s))))' in the nteon.a namespace, and I use that namespace from nteon.b (where *x* is valid) and call the macro, I get 'no such var: nteon.a/*x*'
02:34nteonI would have thought that the code would be executing in the nteon.b namespace?
02:36hiredmannteon: have you read the docs?
02:37nteonhiredman: http://clojure.org/Namespaces didn't really help. I've read programming clojure. anything in particular you can point me to?
02:38hiredmanhttp://clojure.org/reader#The%20Reader--Macro%20characters
02:43nteonhiredman: "syntax-quote resolves the symbol in the current context". So it seems that when I call (foo/bar) from namespace baz, for the duration of the call to bar, *ns* is rebound to foo?
02:43hiredmanno
02:47nteonhiredman: then I don't understand why (defmacro mac-test-2 [] `*x*) in ns nteon.a, would return nteon.a/*x* when called from namespace nteon.b
02:49Chousukenteon: ` is expanded before the macro is even called
02:49nteonChousuke: oh! that makes much more sense.
02:51nteonI would suggest changing the reader docs from "For Symbols, syntax-quote resolves the symbol in the current context" to "For Symbols, syntax-quote resolves the symbol in the namespace in which it was defined"
02:52nteonbut my brain has started turning to mush, so maybe it doesn'
02:52nteont need clarification
02:53Chousukewhat do you mean by "in which it was defined"? :/
02:54Chousukesyntax-quote fully qualifies even symbols that don't refer to anything
02:54Chousuke,`foo
02:54clojurebotsandbox/foo
02:55hiredmanthe qualification happens at read time
02:55hiredmanit has nothing to do with def
02:55hiredman`(foo 1) is read in as (sandbox/foo 1)
02:55nteonChousuke: my edit wasn't much better, you're right. I didn't understand when I read the docs that 'in the current context' meant
02:55nteon'in the current context at read time'
02:55hiredmanit just happens `(foo 1) may be the body of a macro
02:56Chousukethe "read time" might be just and implementation detail though
02:56hiredmansure...
02:57Chousuke` can be implemented as a macro (ostensibly, anyway)
02:58hiredmando you have such an implementation?
02:59Chousukehiredman: I tried to write one, but I ran into trouble with nesting and genyms
03:00hiredman:P
03:00Raynes,(System/getProperty "user.dir")
03:00clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)
03:01LauJensenDisregarding Pulpcore and Processing, are there any interesting 2D libs for Java which are worth looking into?
03:05nteonLauJensen: cairo is interesting, and apparently has java bindings: http://www.cairographics.org/cairo-java/
03:07LauJensenGives me some bad CL associations
03:08LauJensenI have a simple Java 2D thing which emits a ton of polygons, with Swing it takes between 30 and 100 ms, with Slick2D it took 200 ms - Can Cairo beat Java u think ?
03:12nteonLauJensen: no idea :) Its suppose to be moderately fast, especially if you're rendering to an image surface
03:28defnauto-complete + clojure = very nice
03:33RaynesI've never used auto-complete for anything.
03:34LauJensenI have it, but I must admit I rarely use it
03:35RaynesI find it unnecessary.
03:49LauJensenIs it really expected, that to draw 75000 (300x250) rects on a BufferImage (600x500) and then flip that unto a canvas will take between 60 and 100 ms in Java?
05:36lpetitnosé
05:37lpetitdunno
05:39zmiladead calm after april the fool
05:58bsteuberzmila: everyone is catching up on learning scala, I suppose ;-)
05:59zmilaho! does redirect planet-clj to planet-scala still work? :)
06:01LauJensenScala is where the money is though
06:04Borkdudemoney?
06:05LauJensenYea. If I was pitching a project to a customer who wanted an extended on-demand warranty after the 6 months period had passed, we would agree on something like 200$ per bug fixed after warrenty expiration. If such a deal was in play, I'd prefer to code in Scala instead of Clojure
06:07RaynesHehe, get paid to fix bugs you yourself introduced.
06:07Borkdudedo you have a lot of experience with scala in production environments?
06:07RaynesBorkdude: I'm pretty sure he was making a joke.
06:08LauJensenBorkdude: No - I'm building a company based on the dismissmal of imperative langauges like Scala, for the reason of quality and _not_ bug fixing
06:08Borkdudehehe...
06:08RaynesHe is implying that there would be more bugs in Scala code.
06:08defnLauJensen: I just turned it on -- I think it's sort of novel and interesting to code with it, but it kind of kills my train of thought every little fn i add...
06:08Borkdudeyes I get it was a joke, but I was seriously wondering ;-)
06:08defn(auto-complete, that is)
06:09LauJensenRaynes: We're beyond implying. The argument for functional code, is the reduction in bugs
06:09Borkdudeso immutability is not something Scala embraces?
06:09LauJensenBorkdude: Yes but mixed with mutability, which roams freely
06:09RaynesIt has immutable data structures. That's about it, afaik.
06:10LauJensenIn fact the major argument for Scala is that you can take a Java dev, and he'll be productive immediately
06:10defnLauJensen: for sake of argument, it feels even worse when you find a big disgusting bug and have to live with the fact that it's the "purest" bug possible
06:10BorkdudeSound like F#
06:10ChousukeI don't think it's fair to say scala is imperative :P
06:10LauJensenI dont think so
06:10defnLauJensen: i mean that tongue-in-cheek
06:11LauJensenChousuke: It is though, I dont think they deny it themselves?
06:11ChousukeLauJensen: I admit I don't know much about it but to me it seems like it mixes both imperative and functional approaches
06:11LauJensen"Scala is a general purpose programming language designed to express common programming patterns in a concise, elegant, and type-safe way. It smoothly integrates features of object-oriented and functional languages. It is also fully interoperable with Java."
06:12LauJensenIf Scala was functional, they would have said so. Scalas objective was to bring some functional goodness and updated type system into the OO world, ie an incremental improvement over Java in some ways
06:12LauJensenAnd thats fair, and I think they are doing at good job of that, but its not functional
06:13Raynes"Not this shit again."
06:14nteon_hah
06:14LauJensenhttp://gist.github.com/352998
06:14LauJensenThats a quicksort from "Scala by Example" - Looks functional? :)
06:15RaynesLet's call up Robert Fischer and have a "SCALA ISN'T FUNCTIONAL" party.
06:15Chousukewell, obviously not because it's the imperative algorithm :P
06:15Chousukeyou can do that in clojure too
06:16Chousukealbeit it'll be nasty ;(
06:16LauJensenChousuke: No you cant since Clojures data structures are immutable, so theres not i += 1
06:16LauJensenThe whole point is, you have to mangle the system to get near that kind of mutability
06:16ChousukeI suppose you're right.
06:17Chousukearray indexing as a function call somehow looks really weird to me
06:17bsteuberI think Scala does a good job in the same way Java did - driving the C crowd in the Lisp direction (though not nearly halfway as they stated)
06:18Chousukeeven though it's the most natural thing to do in clojure... Just doesn't look right in an algol-style language :P
06:19LauJensenI think Odersky said that Clojure was between Scheme and Java, where Scala was between Haskell and Java and I think thats wrong. Scala is something between C++ and Java, while Clojure its more like Haskell, imo
06:19_atodepends what you're looking at
06:19ChousukeScala is something between CL and java
06:19_atoI think his comment was more referring to the type-system there
06:19Chousukewith heavy leanings to the java side
06:19LauJensenoh - It was a tweet so I figured that he was talking about the entire languages
06:20bsteuberbut why should Clojure be between Scheme and Java? It has Java interop, yes - but it is much more pure than Scheme
06:20LauJensenalthough my impression is that Scala is really just Java on Steroids, ie an incremental upgrade, albeit a big one
06:21Chousukebsteuber: I dunno, Scheme has immutable stuff as well.
06:21bsteuberyeah, but not as heavy as clojure
06:21ChousukeI should really learn Racket or something someday
06:22LauJensenI gotta admit I dont seem more Scheme/Clojure resemblance than with any other dialect
06:22Chousukejust to experience all the cool stuff they have.
06:22dsopwhy not just use whatever does the job best...
06:23ChousukeI think Scheme is more like Clojure than CL is.
06:23LauJensenChousuke: In what way ?
06:23ChousukeCL supports the functional style well because it's a lisp, but imperative code in CL is just as idiomatic
06:23Chousukewhile with Scheme the focus is more on functional style
06:24RaynesI think J resembles the result of giving a small child hundreds of tiny stickers with symbols and letters and numbers on it and letting him arrange them all over the wall in any way he likes.
06:24RaynesUnrelated, but true story.
06:25BorkdudeClojure is Lisp-1, like Scheme
06:25Borkdudebut I don't really know Scheme that well
06:25bsteuberBorkdude: good point
06:25LauJensenTrue
06:26LauJensenRaynes: J is beautiful and organized
06:26RaynesLauJensen: If you know the language.
06:26LauJensenRaynes: And if you restrict yourself to one-liners
06:26bsteuberbut therefore it has dirty CL Makros (despite its auto-gensym-syntax)
06:26LauJensen(which then, add up to about 20 - 25 lines of Clojure)
06:26bsteuberso for me, Clojure just has about the best features of all languages mixed :)
06:26Chousukebsteuber: accidental name capture is almost never a problem though :/
06:27bsteubertrue
06:27BorkdudeChousuke: why write a program with almost no errors, if you can write a program with NO errors
06:27bsteuber"the most hygienic unhygienic macros ever seen" xD
06:28Chousukeheh. indeed
06:30BorkdudeChousuke, "Why write programs with small bugs when you could write programs with no bugs?" -> http://letoverlambda.com/index.cl/guest/chap3.html#sec_5
06:32webwandererhi, how do I send EOF to the REPL. I can't get out of (read)
06:33_atowebwanderer: Ctrl+D usually
06:33mikemwebwanderer: does CTRL+D not work?
06:33webwanderermikem: nope.. i'm on swank-clojure
06:34mikemwebwanderer: in the REPL launched from the console, a newline gets out of (read)
06:35webwandererDoesn't work for me.
06:35webwandererNot for slime-repl that is
06:35Rayneswebwanderer: Input is taken from the inferior lisp buffer.
06:35RaynesGo there and enter your input.
06:36RaynesHow can one copy a file to a new location?
06:36webwandererYep.. worked.
06:36webwandererThanks..
06:37Rayneswebwanderer: Yeah, it's a bug. It's well-known, not sure why it hasn't been fixed yet.
06:37mikemis there something like (read) in clojure, but which exits on the first keypress? currently, I need to press enter to dispatch my character to read
06:37BorkdudeWhere can I find more about the x# notation in macro's ?
06:38_atomikem: try (.read *in*)
06:39_atorepl input might be buffered anyway though
06:39mikemyeah, the REPL requires the enter key
06:39ChousukeBorkdude: clojure.org/reader I think
06:39mikembut I think that's exactly what I'm looking for.
06:39mikem_ato: thanks :)
06:41webwandererRaynes: CTRL+D on the inferior lisp buffer killed my session
06:41webwandereraargh
06:42RaynesThe inferior lisp buffer is kind of important. ;)
06:42_atoRaynes: one of the things Java lacks in its standard library is methods for moving/copying files. If I'm doing lots of file manipulation I usually pull in commons-io: http://commons.apache.org/io/api-release/index.html
06:43_atocheck out the FileUtils class
06:43_atobut if you just want a simple copy you could just implement it yourself (open the source and destination files, read in chucks of 64k or so from one, writing them to the other)
06:43RaynesWell, I already have 38 jars worth of deps, what's a few more. ;)
06:45nteon_heh
06:46BorkdudeThen what does x# in a macro mean
06:48_atoBorkdude: are you familiar with gensym?
06:48Raynes(doc gensym)
06:48clojurebot"([] [prefix-string]); Returns a new symbol with a unique name. If a prefix string is supplied, the name is prefix# where # is some unique number. If prefix is not supplied, the prefix is 'G__'."
06:48Raynes,`x#
06:48clojurebotx__6957__auto__
06:49Borkdudeok great
06:49_atoso when using x# you won't accidentally override a symbol called x in the code that calls the macro
06:50_atoand you can safely nest macros etc
06:51_ato,`(let [x# 5] (do-something-with x#))
06:51clojurebot(clojure.core/let [x__6961__auto__ 5] (sandbox/do-something-with x__6961__auto__))
06:51_ato,`(let [x# 5] (do-something-with x#))
06:51clojurebot(clojure.core/let [x__6965__auto__ 5] (sandbox/do-something-with x__6965__auto__))
06:51_atoeach time you get a new one
06:52_atobut within the syntax-quote (`) it refers to the same symbol
06:52Borkdudeok, I'm trying to grasp if this is the same kind of thing that this guy from Let over Lambda is trying to solve with his defmacro/g! macro
06:53nteon_is there a way to get the seq from ether a var or a symbol? I have a function that works perfectly when called on its own, but falls on its face when called from a macro
06:54_atoBorkdude: yeah, I think it's basically the same idea
06:54Borkdudeso then what is his point with Lisp-1 being a danger to macro's, if you have this?
06:55_atoah
06:55_atothat's fixed by clojure's syntax-quote resolving symbols
06:56_atohis point is that you could do:
06:56_ato(let [inc #(+ % 10)] (some-macro))
06:56_atoand then if some-macro depended on inc, it'd get messed up
06:57_atobut that doesn't happen due to this:
06:57_ato,`(inc 2)
06:57clojurebot(clojure.core/inc 2)
06:57_atosyntax-quote namespace qualifies the inc symbol
06:57_atoso it always refers to the one you mean (unless you explicitly monkey-patch it with binding)
06:58Borkdudeok
06:59Borkdude,(let [inc #(+ %10)] `(inc 2))
06:59clojurebot(clojure.core/inc 2)
06:59Borkdude,(let [inc #(+ %10)] (inc 2))
06:59clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--6998$inc
06:59_ato,(let [inc #(+ %10)] (eval `(inc 2)))
06:59clojurebotDENIED
06:59_atoor right
06:59_atoheh
07:00_atonteon_: could you rephrase that, not sure what you mean by getting a seq from a var or symbol?
07:01_ato,(let [inc #(+ % 10)] (inc 2))
07:01clojurebot12
07:01_ato,(let [inc #(+ % 10)] (clojure.core/inc 2))
07:01clojurebot3
07:07_atoso in that way Clojure does a reasonable job of getting the best of everything: the elegance and simplicity of lisp-1, with the power of unhygienic macros and yet is still reasonably safe due to auto-gensym and the symbol resolution. It's not fool-proof and you still need to know what you're doing when writing macros, but it's at least pretty easy to do things the right way
07:08Borkdudeso if you have a macro that generates code with inc in it
07:08Borkdudeand you surround the macro call with a let and bind inc to some other function, what happens?
07:09_atoif you used syntax-quote (`), which is what you almost always want to do when writing a macro, then the macro uses the original inc function from clojure.core
07:10_atoit'll be this case: (let [inc #(+ % 10)] (clojure.core/inc 2))
07:10Borkdudeok... and when you do want to call the let-bound inc in the macro?
07:10_atothen you do this:
07:11_ato,`(~'inc 2)
07:11clojurebot(inc 2)
07:11_atounquote (~) and then normal quote (') to get the raw, unresolved symbol
07:11Borkdudeok
07:13Borkdude,(defmacro foo [] `(inc 2))
07:13clojurebotDENIED
07:13Borkdudeah can't def macro's here... ok
07:14Raynes,`(inc 2)
07:14clojurebot(clojure.core/inc 2)
07:15Borkdude(defmacro foo1 [] `(inc 2)) (defmacro foo2 [] `(~'inc 2)) (let [inc #(+ % 10)] (println (foo1) (foo2)))
07:15Borkdude=> 3 12
07:18Borkdudethanks for explaining, _ato
07:18_ato:)
07:20Borkdudegtg now, later
07:26imran_srHello everyone. Just starting on clojure. Ok to ask some really dumb newbie questions here?
07:27imran_srI'm running into namespace issues (my own lack of understanding here)
07:27imran_srI want to use str-join. Everything fine when I do: (use '[clojure.contrib.str-utils :only (str-join)])
07:28imran_srbut how do I refer to that function if I don't map str-join into my current namespace
07:28imran_sr(clojure.contrib.str-utils/str-join ....) doesn't work
07:28imran_sr?
07:29_ato,(require 'clojure.contrib.str-utils)
07:29clojurebotnil
07:30_ato,(clojure.contrib.str-utils/str-join "." ["b" "c" "d"])
07:30clojurebot"b.c.d"
07:30imran_sr_ato: ah, thanks
07:30_atoalso:
07:30_ato,(require '[clojure.contrib.str-utils :as str])
07:30clojurebotnil
07:30_ato,(str/str-join "." ["b" "c" "d"])
07:30clojurebot"b.c.d"
07:31imran_sr_ato: got it. I didn't realise that I needed a (require) before using the fully qualified name
07:40defnooo, this clj-refactoring tool looks neat
07:40defnhttp://github.com/tcrayford/clojure-refactoring
07:40imran_sr_ato: I've got a little file with some testing code. The code works (without changing namespaces). Once I added namespaces, I'm getting some issues. Would value your (or anyone elses) opinion
07:41imran_srhttp://clojure.pastebin.com/err0xjpZ
07:42imran_sron line 15, I switch namespace to imran.learning-2
07:42imran_sron line 61, I switch back to the user namespace
07:43imran_srbut I can't refer to a function from imran.learning-2 (line 68)
07:43imran_srwait .... is that (require ...) needed every time I switch out of, and then back into a namespace?
07:44imran_srhmm, nope, that isnt it :(
07:46imran_srbasically, the functions are all for use inside the repl. But there is one multimethod, which I want to segregate into its own namespace (lines 14 - 59)
07:48imran_srwhen I (load-file ...) that script, I get java.lang.Exception: Unable to resolve symbol: str-join in this context (learning-2.clj:69)
07:49imran_srany ideas?
07:49imran_sr:)
07:49Chousukeyou shouldn't switch around namespaces like that:P
07:50Chousukeif you have repl-only functions in the file, put them inside a comment form
07:50imran_srChousuke: agreed. Im just filling out some test funcs as I go along, and thought about adding in namespaces afterwards.
07:51imran_srcomment form?
07:51Chousuke(comment ....)
07:52Chousukeit evaluates to nil, but if you use slime or something that can evaluate interactively, you can easily manually evaluate the forms inside it
07:52imran_srwithout namespaces, everything in that file works from the repl. But why is it breaking if, in the middle, I segregate a multimethod (and its child functions) into its own namespace?
07:53imran_sron line 68, the call to (imran.learning-2/show ...) seems ok, but its choking on (str-join) again ??
07:54imran_srChousuke: (not arguing with your advice btw. I'm just trying to figure out why this isn't working. ie: what dumb syntax mistake I'm making)
07:55hamzagents, since compojure is divided in multiple projects, i am thinking about not using hiccup to generate html but rely on prxml. are there any down sides for this approach?
07:55Chousukeimran_sr: ns changes require you to import the needed stuff
07:55Chousukeimran_sr: btw, you should prefer dashes to underscores
07:56licoresseonly problems with them damn underscores
07:56Chousukeimran_sr: (use 'clojure.contrib.str-utils) after (ns user) should work
07:57imran_sraha!
07:57imran_srthanks
07:57imran_srChousuke: mind if I walk through this, so I figure out whats going on (the whole point of it all, anyway) ?
07:58imran_srChousuke: line 2 has (require 'clojure.contrib.str-utils)
07:58imran_sroh silly me. I just answered my own question
07:59imran_srin (inspect-object ) I used the fully qualified path to str-join, but on line 68, I wasn't. So the original (require) on line 2 didn't help
07:59imran_srthats it?
08:01licoresse,(doc ::)
08:01clojurebotInvalid token: ::
08:01licoresse?
08:01licoresse,(doc @::)
08:01clojurebotInvalid token: ::
08:01licoresse,(doc '::)
08:01clojurebotInvalid token: ::
08:01licoresseok
08:02imran_srchouser: & _ato : thanks for your patient help gents :)
08:04nteon_related to a question I had above, is there a way to have a macro defined in one ns to reference an unqualified var that will be valid in the namespace of the caller?
08:04licoresseis only possible through a funcall?
08:05Chousukenteon_: macros don't care about vars. they work with symbols
08:05Chousukenteon_: do you mean you want to force a capturing expansion? :/
08:06Chousukeif so, you can use ~'foo within `
08:06nteon_Chousuke: what is a capturing expansion?
08:06licoressechouser: is this a bad idea?
08:06Chousukethat will produce the symbol foo instead of somens/foo
08:06Chousukeand it will refer to whatever foo refers to in the expansion environment; could be a local, or a global var
08:06licoresseChousuke: ^
08:06Chousukelicoresse: often it is
08:07Chousukenot always, though. sometimes it's useful
08:07licoresseand what is a capturing expansion?
08:07Chousukebut you need to document any captured names carefully so that people's code won't break
08:07licoresseYeah, I see that
08:08licoresse,(doc require)
08:08clojurebot"([& args]); Loads libs, skipping any that are already loaded. Each argument is either a libspec that identifies a lib, a prefix list that identifies multiple libs whose names share a common prefix, or a flag that modifies how all the identified libs are loaded. Use :require in the ns macro in preference to calling this directly. Libs A 'lib' is a named set of resources in classpath whose contents define a library of Cloju
08:09Chousuke(defmacro foo [& body] `(let [~'x 3] ~@body)) -> (let [x 6] (foo (+ x 1))) -> 4
08:09licoressethe comments are very terse
08:10Chousukebut now I must hurry away... later.
08:10licoresseChousuke: thanks
08:11nteon_Chousuke: thanks! that is what I've been looking for for longer than I'd like to admit
08:12licoressecapturing expansion: when a let definition shadows a var with the same name
08:12licoresse(inside a macro)
08:13nteon_I'm working on a runtime for a DSL, and all the DSL files are output from a compiler of sorts that I also have control over. So im not too worried about some of the dangers of capturing expansion
08:14nteon_all you folks rock, thanks for the help
08:15raekgensym'ed symbols (foo#) are always safe, though
08:20nteon_raek: yea, but they don't do what I want. I have DSL files which specify a simulation, and each file has the same structure (they all have a number of vars that are the same) but is loaded into a unique namespace (based on the file's sha1-hash)
08:21nteon_so when I call load-string on that file, I can guarantee that symbol will be defined & won't be clobbered by anything else in the meantime
08:22nteon_its a little weird, but it seems to be working well
08:27licoressenteon: sounds cool
08:30webwandererAnybody know where I can find Clojure's grammar? I know it's pretty simple but is there a BNF somewhere?
08:33defnIs there a way to magically set the slime-set-default-directory when you start a swank-clojure-project
08:33defnIt is always very unnerving to me that I need to manually do this every time I run swank-clojure-project
08:33defnam i missing something obvious?
08:33licoressedefn: same here
08:34bsteuberdefn: I have emacs lisp functions starting a specific project for me
08:34licoressebut I am lazy
08:34defnbsteuber: care to share?
08:35licoressebstephenson: please share
08:35defnim sure it's not too difficult, but i dont know if im motivated enough to actually do anything about it :)
08:37bsteuberhttp://pastie.org/900217
08:37bsteuberthat's all :)
08:38defnhahaha, that's it!?
08:38defnoh man i feel silly now
08:38bsteuberwenn, not sure if emacs desktops are the best
08:38bsteuberwell
08:38bsteuberbut at least they do the job for me
08:38licoresse:)
08:38defnive never used desktops
08:39bsteuberwell, you don't really need to combine both
08:39bsteuberI'd like a command that opens all _relevant_ files for a project on its own
08:39bsteuberbut I'm also too lazy :)
09:02raekwebwanderer: the readed documentation (http://clojure.org/reader) is probably the closest you get to a grammar
09:03raek*reader
09:03webwandererSaw that. Thanks..
09:03raekthe clojure language is defined in terms of the data structures, not character sequences
09:04raekso there is no special syntax for things like ifs and declarations
09:14avarraek: Those data structures have a plain-text representation. Which is what a BNF covers.
09:18dnolenI think I'm having a deftype inference issue: http://gist.github.com/353121
09:19dnolenhow do I return a boxed number from a deftype method?
09:20LauJensendnolen: I dont think you can return any number except a boxed one
09:20dnolenLauJensen: I need to type hint it, I think it assumes I'm going to return a vec2 instance
09:21dnolenI know what I wrote is wrong, but w/o the type hints I get: vector-math.core.vec2__3954.length_squared()Ljava/lang/Object;
09:21dnolen [Thrown class java.lang.AbstractMethodError]
09:21chouserdnolen: since those particular methods are defined a protocol, it's the protocol that controls what type it will return
09:21defn,{+ 1 2}
09:21clojurebotjava.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 3
09:21dnolenchouser: so just hint the protocol?
09:22chouserdnolen: but default protocol methods take and return Object
09:22chousers/but/by/
09:22defn{reduce + {map inc {list 1 2}}} <<--interesting
09:22dnolenchouser: I know if I have no type hints and try (length-squared v), I get the ^ exception
09:23defnAny suggestions for profiling tools with clojure? I've tried yourkit and jvisualvm, but they are not very helpful...
09:23defnIs there anything being worked on?
09:26dnolendefn: never used any real profiling tools but I'm surprised that YourKit isn't helpful since Rich Hickey uses it himself, and Zachary Tellman has used it to fine tune Penumbra.
09:27defndnolen: it is probably very useful to someone who knows the language much better than me (aka they wrote it) ;)
09:28dnolendefn: heh, true enough. I used "time" _a lot_. Tho that doesn't help much for whole program profiling.
09:30defnyeah id just like to get to know some profiling tools better -- ive run into some performance problems with some stuff ive been working on and i can watch the profiler make a big red graph for IPersistentFn (is that right?)
09:30defnbut when it comes to looking at my code and saying "oh! there it is!"
09:31defnim pretty much clueless
09:33defnfogus: that is very cool
09:33defnfogus: btw, did you see xkcd now has a CLI? I thought about your CLI on your blog when I saw it. They seem awfully similar
09:34dnolenchousre: so no thoughts about that exception?
09:34dnolenchouser: ^
09:34fogusdefn: It's actually a direct fork of my CLI code... but sadly no attribution. :p
09:34defnfogus: you know, i thought so
09:34defnthat's not cool
09:35defnwell i mean, it's very cool, and also not cool
09:35fogusit's not worth fussing about. I actually talked to the guy who did it and he said he would merge back the changes. so that's cool
09:35mikemhow can I get at an array's length? (. my-arr length) doesn't work. my-arr is an instance of [B
09:37fogus,(count (into-array [1 2]))
09:37clojurebot2
09:37defnyeah -- if i were you i'd say something along those lines also, but if i was in that guy's position I would have given credit where it was due because that's just fairness and recognition, the community aspect
09:37fogusWell he did give credit to the original author, so maybe he wasn't aware that I took that over years ago. It's no biggy
09:37defnbut *shrug*
09:37mikemfogus: ok, so (. my-arr length) doesn't work because my-arr is Java Array, not an instance of a Java class?
09:38defnfogus: im on a crusade to fight the evils of covert forking
09:38defnfogus: btw, any word from manning on when the new content is gonna pop up?
09:39defni just got a snazzy ebook reader and am excited for some more JoC
09:39fogusdefn: it wasn't covert, the history of the source is in tact. I think it was just a matter of
09:39fogusmisunderstanding
09:39fogusdefn: I'm hoping today... but I'm an eternal optimist
09:40defnsame here, same here
09:40defnfogus: those code blocks are very cool
09:40defn"blocks"/"boxes"
09:44defnfogus: have you looked into overtone at all?
09:45fogusdefn: this? http://github.com/rosejn/overtone
09:45defn*nod* -- they have a pretty active list going -- i havent had a chance to play much with it, but it looks pretty cool
09:48defnif you can do math you can make music :)
09:49esji used to think that about pool, but it aint so, for the same reason
09:50webwandererwhy can't I attach metadata to lists?
09:50webwanderer,'foo
09:50clojurebotfoo
09:51webwanderer,#^{:a 1} (1 2)
09:51clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
09:51defnesj: i really hope that's not true -- i studied music in college and loved CS in the background (when i wasnt practicing i was tinkering)
09:51webwanderer,#{:a 1} [1 2]
09:51clojurebot#{1 :a}
09:51defnesj: i often hear people who are gifted in math or CS say they're "not musical" and it reminds me of the same thing people who are good at music say about math "im not a math person"
09:52defnit's learned helplessness
09:53esjin my case, I can do maths, and understand music, but the dexterity required to actually produce it, and the the decoupling between theory and practice required to produce 'soulful' music still evade me.
09:53defni heard rich used to be a musician -- stuart h said that in one of his talks
09:53chouser,'#^{:a 1} (1 2)
09:53clojurebot(1 2)
09:53fogusWell, it's not like I never tried music... I tried for a long time. In my case, it's a recognition of my limitations. ;-)
09:53lpetit> ,(meta (with-meta (list 'hello) {:foo :bar} ))
09:53lpetit,(meta (with-meta (list 'hello) {:foo :bar} ))
09:53clojurebot{:foo :bar}
09:53chouser,(meta '#^{:a 1} (1 2))
09:53clojurebot{:a 1}
09:54esjas a kid I drove out 4 music teachers, one from the city, one from the country, one to the priesthood and the final one comitted suicide - no exageratiton.
09:54defnesj: i can produce some soul i think - im a much better musician than i am a programmer I think, but I refuse to allow that to preclude me from tackling something "soulful" in CS or math
09:54lpetitwebwanderer: you create lists with (list ...)
09:54defnesj: whoa. maybe you've got some serious skills!
09:54webwandererah
09:54lpetit(type (list 1 2))
09:55lpetit,(type (list 1 2))
09:55clojurebotclojure.lang.PersistentList
09:55lpetit,(type '(1 2))
09:55clojurebotclojure.lang.PersistentList
09:55lpetitwoops
09:55esjI practice blues/funk guitar almost daily, and am gaining in ability, but its not easy !
09:55defnesj: nor is programming :)
09:55esjtruedat !
09:55lpetit,(meta (with-meta '('hello) {:foo :bar} ))
09:55clojurebot{:foo :bar}
09:55lpetitit works too
09:56defnesj: i learn a lot by osmosis i think -- the more you listen (really listen), the more you internalize the "feelings" and "textures" (to use a couple of cliches) of the subject
09:57defnof course it's not really a subject at a certain point -- it is just your life
09:58esjdefn: oh yeah, I was in New Orleans at the end of last year and the inspiration from those guys alone has kept me going since
09:58defni try to live and breathe jazz, hacking, and inventing -- i try to live my life with attention to those things first, and everything else second
09:58defnif you do that long enough i think you eventually end up somewhere you aren't right now :)
09:59esjstill struggle to make my riffs sound like anything other than catfood though :(
10:00esjluckily my coding is improving rapidly, so thats all good.
10:01defnesj: i think what really opened up my mind was the feeling that i didn't need to play "thoughts", i needed to play inside of the thought -- that is probably sounding really pretentious on your end, but truly, there was a moment where i realized that i needed to allow my hearing guide my thinking, sort of like i wasn't thinking at all
10:02esji get what you're driving at, its an enlightenment.
10:03defn*nod* -- but i think that moment took me a solid 11 years, some of those years were 2-6 hours a day playing my instrument
10:03defna lot of time, but in the end i think we are all capable of being mathematician musicians with soul :)
10:05esjperhaps that's the commonality - both endeavours require a serious investment of time and detemination.
10:08defnyeah i tend to have a mindset (which has put me in some awfully terrible positions) where i feel a need to prove something, i suppose
10:08defni will disregard other things in my life and be practically manic about a subject
10:08esjhahaha, ditto that.
10:09esjit's almost as powerful and it is dangerous :)
10:09defnhave you ever read the bipolar lisp programmer?
10:09defnhttp://www.lambdassociates.org/blog/bipolar.htm
10:10esjno, and I fear you've just disrupted my R programming !
10:11defni sometimes wonder if it's just chance that i somehow ran into that article on the internet, or if there is actually a majority of people interested in lisp who are like that, because the person he describes in that article is me, to a T
10:11defni want to hand it out as my business card: "this story will tell you exactly who i am."
10:12esjhere's something more silly: http://i.imgur.com/1gF1j.jpg
10:12defnagh -- sorry for all the o/t everyone watching or reading this portion of the log
10:13defnsorry to my bot, for making you parse this useless line
10:13defnesj: heh yes that's pretty good
10:13esjit has a friend: http://kvardek-du.kerno.org/2010/01/how-common-lisp-programmer-views-users.html
10:14esjthey came up in a recent clojure meetup
10:14defnesj: have you heard: http://www.catonmat.net/download/the_eternal_flame-god_wrote_in_lisp.mp3
10:18defnesj: heh, it's surprisingly good for a parody
10:19esjagreed
10:19esj"He had 6 days to work so he wrote it all in LISP"
10:20defn"Yes, God had a deadline. So he wrote it all in Lisp."
10:20defnhaha
10:21defnanyway -- im gonna try to write some cheat codes for clojure, nice talking to you esj
10:21esjlikewise, defn, catch you later.
10:21defnciao
10:48underdevhow do i build a map out of a sequence returned by a function?
10:49underdev,(map (range 4))
10:49clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$map
10:49cemerick,(apply hash-map (range 4))
10:49clojurebot{0 1, 2 3}
10:50cemerickthere's also...
10:50cemerick,(into {} [[1 2] [3 4]])
10:50clojurebot{1 2, 3 4}
10:50cemerickdepends on what your data's like
10:51defnunderdev: what do you get back from the function?
10:51underdevcemerick: okay, my first attempt was apply map, which doesn't work, but apply hash-map does
10:51underdevcemerick: ty
10:51defn[1 2 3 4], {:foo 1 :bar 2}
10:51defnetc
10:52cemerickunderdev: map has little to do with hash-maps
10:52cemerickthough the latter are often referred to as maps
10:52underdevand knowing is half the battle :)
10:52defnunderdev: you might also just be able to return the return of function inside {}
10:52cemerickyeah. This is chouser's nightmare.
10:53cemerickand mine, too, really, but it's damn hard to un-overload a name
10:54esjand then there ns-unmap.....
10:54defnI think there should be "adumbrate" in clojure
10:54hiredmanwhen push comes to shove you can always check the docstring and notice map's says nothing about maps
10:55defnto produce a faint image or resemblance of; to outline or sketch., to foreshadow; prefigure., to darken or conceal partially; overshadow.
10:55LauJensendefn: RE profiling, did you see my Fluid Dynamics post ?
10:55cemerickhiredman: people don't read documentation until they're absolutely forced to, regardless of domain
10:55defnLauJensen: i havent read it yet -- you did some profiling in there i take it?
10:55LauJensenIts mostly about profiling, the fluid sim is just a bonus :)
10:55defnah :)
10:56hiredmancemerick: "push comes to shove"
10:56cemerickyeah
10:56defnthat doesn't guarantee the documentation is any good
10:56defnof course
10:56hiredman,(doc map)
10:56clojurebot"([f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls]); Returns a lazy sequence consisting of the result of applying f to the set of first items of each coll, followed by applying f to the set of second items in each coll, until any one of the colls is exhausted. Any remaining items in other colls are ignored. Function f should accept number-of-colls arguments."
10:57cemerickTrouble starts when there's a forest of names that makes it feel like one needs to swallow the world to know how to do things.
10:57cemerickforest of similar* names, I should say
10:57defnto you that is brilliant, inspired documentation which captures the essence of the form's being -- but to someone else it's a bunch of gibberish that should be extracted by someone who speaks esperanza
10:58hiredmanall you need to be able to do is to recognize noun context and verb context
10:58cemerickrigor is demanded, but scarce
10:58defnthat division of language is a very explicit way in which you're reading
10:58hiredmando something to a map, do a map
10:59underdevmap is both, actually
10:59defnor rather, a very implicit way
10:59hiredmanunderdev: that is why I said context
10:59cemerickI'm getting happier and happier with the deftype/defrecord (near?) decision, in part because of stuff like this.
11:00underdevhiredman: your point stands though, this is an exception
11:00underdevgood hueristic
11:00cemerickespecially when I came across a macro I wrote a long time ago called defrecord that defines...domain-specific models! :-P
11:00hiredman,(let [map 1] map)
11:00clojurebot1
11:00hiredmanthere map is neither
11:01defncemerick: is it deft/deftype?
11:01defni thought that was what rich had decided on
11:02cemerickno, deftype/defrecord last I saw
11:02stuartsierraSo defrecord will be like deftype, with auto-generated impls for keyword lookup, metadata, map-like functions? deftype will then have no auto-generated impls?
11:02hiredmanbecause I threatened to sue over the use of deft
11:02cemerickstuartsierra: that's my understanding
11:02defnhiredman: was your band's name in high school "deft leopard"?
11:03hiredmannope
11:03defn...
11:03underdevpour some symantic sugar on me...
11:03stuartsierraYou can't own a real word.
11:04defntouché
11:04defnthat being said, i own defn, and you all owe me *a lot* of money
11:04stuartsierraheh
11:05hiredmanstuartsierra: I have prior art
11:05ericthorsenI see there have been some archetypes created for clojure projects on github. How do/can/are these archetypes get into the main maven repo?
11:06ericthorsenI'd love to see them show up in the Java IDEs when people look for project archetypes
11:06stuartsierraericthorsen: time, commitment, ...
11:06stuartsierraI made an archetype ages ago, wanted to get it into Maven central, but wanted swank-clojure in there too. Still waiting on that one...
11:06defnhiredman: mid 15th century prior art?
11:07ericthorsenstuartsierra: how does one get an archetype into Maven central?
11:07hiredmandefn: I'll have to check the date on my gist
11:07defnhiredman: haha
11:07stuartsierraericthorsen: Same as any other Maven project, as far as I know. Put it in a public repository somewhere, request sync to central.
11:08stuartsierraAs for adding to the default list, not sure.
11:09ericthorsenstuartsierra: So none of these Clojure archetypes have been put into a public repl I take it?
11:09defnLauJensen: this post is fantastic. thank you
11:09stuartsierraericthorsen: not that I am aware
11:09stuartsierraI never finished mine.
11:09ericthorsenstuartsierra: ...default list...perhaps that is on the IDE side .
11:09LauJensendefn: Thanks! :)
11:09stuartsierraericthorsen: There's a list that Maven shows at the command line, that was what I Was thinking.
11:10stuartsierraarchetype:generate or something like that
11:11ericthorsenstuartsierra: ok. I did look at yours. I wanted to have a few archetype available for people who are not familiar with maven. one for 1.0, 1.1, snapshot, etc. If putting them into a public repo eventually gets them synced to maven central, that may be all I need.
11:12stuartsierraYes, that should be all that's needed. We'd need contrib in central too, I think.
11:12stuartsierraOne archetype with a config parameter for different Clojure versions would probably work.
11:12ericthorsenstuartsierra: Is Clojure in central
11:12ericthorsen?
11:12stuartsierrayes
11:13stuartsierrabut not officially synched from build.clojure.org yet
11:14ericthorsenstuartsierra: The user experience I was looking for was create project with "Clojure 1.0", "Clojure 1.1", "Clojure 1.1 w/Compujure"...just a few to get started. The user can use the IDE to add dependancies and never have to learn anything about Maven.
11:15ericthorsenstuartsierra: I might be able to do some of that with parameters in the IDE. I will look into that
11:15stuartsierraYeah, that sounds more like an IDE wizard than purely Maven territory.
11:15ericthorsenstuartsierra: forgive my ignorance here but what does "officially synched" mean?
11:16stuartsierraThe Maven central repository (repo.maven.org) has a list of "official" public repositories that they mirror (via rsync). To get your public repository added to the list, you have to send a request to the Maven central administrators.
11:17stuartsierraOnce you're on the list, anything you deploy to your repo gets copied to central in 1-2 days.
11:17cemerickI hear things go much faster if your repo exposes indexes, etc. via http (as artifactory, nexus, etc) do.
11:17ericthorsenstuartsierra: Why not publish to an existing public repo? Is that a simple thing to do?
11:17cemerickThat avoids key exchange and such.
11:18stuartsierraericthorsen: yes, sonian.net maintains free repos for open-source projects; that's where the Clojure Maven plugin resides.
11:18ericthorsenstuartsierra: great
11:18stuartsierratechnomancy: ping
11:21ericthorsencemerick: Have you tried to add the clojars.org to Netbeans? I was not able to do it (as a maven repo anyway) but did not spend much time there
11:22cemerickericthorsen: No, but I know that the repository root is not obvious, or linked to anywhere. I think you'd have to go looking in lein's source to see where it is.
11:22cemerickor, ask technomancy or _ato :-)
11:22stuartsierraIt's documented now on clojars.org
11:22cemerickah, good
11:23stuartsierrahttp://clojars.org/repo
11:23cemerickthere it is -- never thought to try repo.
11:24stuartsierraericthorsen: By the way, just making a public Maven repo is easy: all you need is a web server. I wrote about it here http://stuartsierra.com/2009/09/08/run-your-own-maven-repository
11:24ericthorsencemerick: Netbeans was looking for the index which is not there (I don;t think)
11:24cemerickericthorsen: yeah, if there's no index, then you won't get any of the IDE goodness
11:24cemerickotherwise, it'd have to crawl the thing
11:24ericthorsencemerick: that is a huge bummer!
11:25cemerickericthorsen: Not sure there's any alternative. You can't have thousands and thousands of IDE users DOS'ing basic mvn repos :-)
11:26ericthorsencemerick: hmm...so how difficult is it to add an index to clojars?
11:26stuartsierraProbably would require running a real Maven repo server rather than whatever technomancy & co. have hacked up with scp
11:26cemerickericthorsen: it's a lucene index AFAIK, so it'd be a pain to duplicate what nexus etc do
11:26stuartsierracemerick: Really? I assumed it was just another XML file.
11:28cemerickstuartsierra: I don't think so. Unless I've gone nutty, it's a lucene index that contains all of the info about the poms as well as all files in all jar/zip/war/ear artifacts, etc.
11:28cemerickthat's what makes it possible to search for artifacts in NetBeans et al. by classname
11:28stuartsierrawow, ok
11:28stuartsierraah
11:28stuartsierraI assume it's tied to a specific Lucene version, then?
11:29cemerickthe index files are of a particular version, but likely an older one to maximize compatibility
11:29cemericklucene has excellent support for reading older index files
11:29ericthorsencemerick: Agreed. I'm trying to avoid the maven vs. lein conversation but what clojars stuff to be easily accessible to maven tools...I guess I've entered that conversation :) I'll post a note on the group about this.
11:29ericthorsenwant
11:29stuartsierraIDE support is a strong argument in favor, I think.
11:30cemerickstuartsierra: yup, just confirmed that the indexes are lucene
11:30ericthorsenstuartsierra: Especially if your argument is that maven is too complicated. I was happy to see the ployglot project move Clojure up on the supported list
11:30stuartsierrayes
11:31stuartsierracemerick: ok
11:31cemerickericthorsen: If I can climb out of the hole I am in now, I may have a screencast/post demoing clj polyglot maven next week.
11:32ericthorsencemerick: Great! That is where I want to be...clojure scripts with all the power of maven behind it.
11:33ericthorsencemerick: That is something I would want to add support in for Enclojure for sure
11:33cemerickericthorsen: % the tooling issues, which we've already discussed. I'm sticking with my pom.xml's :-)
11:33ericthorsencemerick: lol, yes, I won't move until I have tool support either
11:34ericthorsenstuartsierra: cemerick: thanks guys!
11:34stuartsierranp, anything to help Maven take over the world :)
11:35cemerickericthorsen: is that even possible, though? Close-enough is good enough for things like symbol completion while programming, but close-enough gets mighty frustrating while trying to complete artifact version numbers.
11:36ericthorsencemerick: The symbol completion has been helpful enough for me on the pom side of things. That is all I was thinking of replicating
12:11tufflaxI'm on windows, and in emacs that I got from clojure box, I don't have a meta key, how can I set the windows key to be the meta key?
12:12lithper2_try ESC at the meta key
12:12stuartsierratufflax: not sure, that might be a question for #emacs
12:12lithper2_as*
12:12tufflax#emacs
12:12tufflaxops
12:30rhickeyso, I'm thinking about going back to explicit 'this' first arg to reify/deftype/defrecord methods
12:31rhickeysetting recur issues aside I've found 2 things:
12:31rhickeypeople are confused by the difference between the protocol def, and extends, and the internal defs
12:32rhickeysecond, without that there is an issue for mixins needed to know the :as binding in order to do self-reference, making them less modular
12:32rhickeyneeding
12:35rhickey:)
12:36programbleor otherwise dont know enough about clojure to understand a word you just said :P
12:36drewrrhickey: I like the explicit `self` in python, so I'm fine with that decision :-)
12:38pjstadigrhickey: i was confused at first by the difference in arguments, and i think having an explicit argument for this or self makes sense
12:38pjstadigpeople could still name it what they want
12:38rhickeyright, they can
12:38rhickeyor _ when not used
12:39dakroneseems very reasonable
12:39programblelol i wanna do that in my python code
12:40programbleclass foobar: def __init__(frank, x): frank.x = x
12:41cemerickrhickey: I'm fine with that. I've come to find :as to be a little odd. Almost a wart, actually.
12:42npoektophi! i have an existing project in eclipse. Is there any manual how to make it work with repl in slime?
12:42cemerickthat is, I'd rather have implicit or explicit this, and the former now seems impolite given the rest of the language.
12:42Chousukenpoektop: can eclipse run a swank server?
12:43cemericknpoektop: you can use clojure-maven-plugin, which provides a direct REPL as well as swank and nailgun support.
12:44npoektopcemerick, thank you, i will try it
12:44rhickeyneglecting the this arg is a frequent mistake with gen-class though
12:45rhickeyhas everyone reconciled themselves to defrecord?
12:47rhickeyoh, and one more name game - there may be another factory fn that takes keyvals, a la struct-map, but can't have same name as record type
12:47rhickeye.g. (defrecord Foo [a b c]) (Foo 1 2 3) (??? :a 1 :c 2 :d 42)
12:48Chousukerhickey: I don't think it *generally* matters much whether this is implicit or explicit, as long as the approach chosen is consistent with the "feel" of the rest of the language
12:48Chousukerhickey: people will just have to learn to remember the this argument
12:48rhickeyFoo-rec, Foo-record, record-Foo
12:48drewrprogramble: `self` is only a convention
12:50cemerickrhickey: it's just a matter of acclimation. Python folk get along just fine with self. Most fns will just have a first _ arg.
12:51cemerickrhickey: how about a generic fn instead of another specific def, e.g. (record Foo :a 1 :b 2)
12:52cemerickor, if all defrecords supported a no-arg ctor, then we could just use existing map fns
12:53rhickeycemerick: you mean by successive conjing? that would create a full new Foo for each arg
12:53rhickey(record Foo ...) might be possible
12:54cemerickrhickey: yeah, just like into, etc. If you're purposely not aligning your args, you're probably not too worried about perf anyway. *shrug*
12:55cemerickrhickey: derived top-level names are always kludgey. If (record Foo ...) is doable, that's overwhelmingly preferable to an oddly-named, magically-defined thing.
12:55chouserthe recur issue seems like a big ont ot just set aside (re: explicit this)
12:56rhickeychouser: ?
12:56rhickeyah, one to
12:56chouserheh. yeah, sorry.
12:56rhickeywell, it moves the wart
12:57rhickeyso now recurring to the method head will take one fewer args than the method sig
12:57rhickey(foo [this x y] ... (recur newx newy))
12:58bittihm
12:59rhickeycemerick: would you prefer (record Foo ...) for positional as well? Structs had (struct Foo ...) and (struct-map Foo ...)
12:59bittirhickey: why (defn bound ...) in your ants.clj? you didn't had mod back than?
13:00rhickeybitti: probably not
13:01bittirhickey: ic, thx :)
13:01Chousukerhickey: can you cheat a bit and make recur take the explicit this argument in that case and just ignore it? :P
13:01rhickeyChousuke: I doubt it
13:02chousersee, I thought we might want 'record' to mean something besides 'defrecord'. :-)
13:02chouserI like (record Foo :a 1 :b 2), depending I suppose on the amount of magic required.
13:03chouserthe amount of magic required to implement it, I mean.
13:03Chousukeif it's usable with apply I'm all for it
13:03rhickeychouser: there's plenty of overhead to the named args, but the positional case is an interesting one for cemerick's thesis about toplevel names
13:04rhickeyit might be (record ::Foo ...)
13:09bittiif opinions are aksed for: I like if things are implicit, even tough I don't understand the mentioned function yet...
13:09cemerickrhickey: being able to use Foo in function position is important, I think
13:10cemerickChousuke: yeah, that's the sort of thing I want to be able to do to. Throw args around, type ctor fns, mix as required.
13:10chouserbeing able to use 'record' as a real function is also important, as Chousuke mentioned. (apply record Foo myseq)
13:10cemerickobviously not in perf-critical sections
13:10cemerickI think (Foo ...) and (record ::Foo ...) are a very reasonable pair, if the latter is what's required.
13:11cemerickThe keyword, that is.
13:12rhickeythe keyword will be required if (Foo ...) is to work
13:12rhickeyand record is a fn
13:13cemerickare there any other circumstances where one would have to use ::Foo?
13:14rhickeyextend, extend-type
13:14cemerickoh, right, nm
13:14rhickeyextend-protocol
13:15cemerickright, in that case, (record ::Foo ...) is pretty natural
13:15rhickeyprotocols rock
13:16cemerickor at least congruent with other usage
13:16defnrhickey: can i quote you on that?
13:16chouserI hope my section on protocols will make that point sufficiently, though I don't actually use the work "rock"
13:17cemerickI plan on giving them a hard look when I get back to data model stuffs. Still finishing up webby things now.
13:17chouser...and I have this minor problem of the dang things changing their syntax while I'm trying to write about them.
13:17rhickeychouser: I'm seriously working on this stuff now in order to stabilize it for 1.2 and all the books
13:17cemerickchouser: maybe halloway can recommend whatever brand of scotch got him through.
13:18defnchouser: i saw go whole hog; use the word "rock" and "awesome" exclusively
13:18defns/saw/say
13:18rhickeycemerick: stuart got similar support, a flurry of changes to get things in order pre-book
13:18cemerickdefn: they'll have to get the heads first publisher to pick the book up ;-)
13:18rhickeydefn: rock is a technical term
13:18cemerickrhickey: I know, I'm just screwing with chouser :-)
13:19defnrhickey: haha, cemerick: well played :)
13:19rhickeyI do want all the books to be great, and correct
13:20rhickeybut big features like this need time to percolate. No one saw the churn that preceded Clojure's release
13:20cemerickuh-huh
13:20cemerick;-)
13:20chouserrhickey: I'm not really complaining. I have actually spent zero time so far fixing datatype or protocol example syntax.
13:20woobyi ran into jfli the other day and pondered that
13:21chouserrhickey: I'm hoping one or two simple passes later will be sufficient
13:23fogushmmm, maybe stable was not the correct term. :(
13:23quidnuncWhy does "lein-stable deps" give me "Your Leiningen development checkout is missing its dependencies", even after doing "lein-stable self-install"?
13:24defnquidnunc: are you building from source?
13:25quidnuncdefn: The first part is to bootstrap in any case isn't it?
13:25defn(leiningen, i mean)
13:25defnquidnunc: just curious what you're running lein-stable deps and then lein-stable self-install on
13:25quidnuncdefn: I had checked out the source and was intending to but I'm fine with the sable
13:25quidnuncstable*
13:26quidnuncdefn: I downloaded the "stable" script. No previous install
13:26defnquidnunc: ah
13:26quidnunc?
13:26defnquidnunc: just saying "ah" -- acknowledging you
13:27defnquidnunc: you could try blowing away ~/.m2 and then running lein-stable self-install again
13:27quidnuncdefn: Does .m2 contain anything non leiningen related?
13:27defnif you don't know, it won't hurt you :)
13:28defnquidnunc: seriously, likely the answer for you is no
13:29quidnuncdefn: No dice
13:30defnstill complaining, eh?
13:31defnquidnunc: http://groups.google.com/group/leiningen/browse_thread/thread/3f2fce02bbdc325e/3b7b4d7354fae72c?show_docid=3b7b4d7354fae72c
13:31defn^^ are you running leiningen from your checkout?
13:31defn(where is lein on your $PATH)
13:32quidnuncdefn: I put the checkout in my path but I am running the lein-stable from temp.
13:32quidnuncI guess I should remove it from my path
13:33defnquidnunc: per the above URL don't put the checkout on your path, take the script you wget'd and put it in ~/bin/lein
13:34defnthen run lein self-install, cd ~/myprojectdir/ && lein deps
13:35defner, or in your case, you want to put the lein script somewhere outside of the checkout
13:36quidnuncdefn: Thanks, that works
13:36defnnp, thanks technomancy -- he's the guy who wrote it :)
13:36defnthank*
14:00ipostelnikis there a way to view the dependency tree in lein?
14:01ipostelnikI would like to know why certain transitive dependencies are included
14:01SynrGwin 2
14:01SynrGups
14:03cemerickipostelnik: I don't think lein provides that. If you dump the project file to a pom file, you can use any of the dependency graph tools available for maven. *shrug*
14:06cemerickipostelnik: oh, actually, there's the dependency:tree maven goal, which will dump the dep tree as text
14:07cemerickipostelnik: otherwise, both eclipse and netbeans have nice graph visualizations, e.g. http://wiki.netbeans.org/wiki/images/3/3c/Exclude_dep_NewAndNoteworthyNB68.jpg
14:30erikcw1I'm using a package that has a dep on commons-codec-1.3. I've added commons-codec-1.4 to my project.clj file. When I (import) from the REPL, it seems like 1.3 is being loaded. How can I specify which version of the jar I want to use?
14:33defnshouldn't the package you're using have the commons-codec-1.3 in its' project.clj or dependencies?
14:33defns/its\'/its
14:34erikcw1defn: I need 1.4 for my code, but one of my deps uses 1.3...
14:35defnerikcw1: ah i see -- sorry i don't know the answer :\
14:36liebkeerikcw1: there is an exclusion option in lein for the dependencies of your dependencies. Use that to exclude the 1.3 version
14:37defnliebke: thanks again for your help with incanter last week -- it is working very nicely
14:37liebkedefn: glad to hear it :)
14:46stuartsierraHi all, updated documentation for lazytest, now with 15% more BDD! http://github.com/stuartsierra/lazytest
14:52chouserstill working toward full feature merge with circumspec?
14:54fogusstuartsierra: It looks really nice.
14:55stuartsierrachouser: yes
14:56stuartsierraI've got ANSI colored reports, only things missing from circumspec are 1) namespace discovery and 2) continuous testing
14:56stuartsierrafogus: thanks
14:56fogusAny chance we'll see a discussion of this in the book?
14:56defnstuartsierra: very cool
14:57stuartsierrafogus: no, book has no library chapters
14:57stuartsierradefn: thansk
14:57chouserstuartsierra: will one or the other go away then?
14:57bmasonwith inspect-table on a set of maps, I'm getting column headers but no data
14:57bmasonany idea why?
14:57stuartsierrachouser: circumspec might go away, but that's up to the other Stu
14:58chouser:-) ok
14:58bmasonI created this as a test: #{{:foo "stuff" :bar "stuff"}{:foo "more stuff" :bar "more stuff"}}
14:58bmasonall I see in the inspector is columns 'foo' and 'bar'
14:59nteonwhy would (print "hi!") produce no output, but (println "hi!") output what I want?
15:00stuartsierranteon: output buffering?
15:02bittiso the idea of '->' is to support chaining in a readable way?
15:02bittior there is more to it?
15:02chouserbitti: that's pretty much it.
15:03bittiic :)
15:03bmasonare the inspect functions commonly used?
15:03chouserbmason: intersting -- I just get an exception and a blank window
15:04chouserUnsupportedOperationException: nth not supported on this type: PersistentHashSet
15:04bmasondifferent version maybe?
15:05chouser(inspect-table (vec #{...})) seems to work
15:05nteonstuartsierra: holy crap thats annoying
15:05stuartsierrabmason, chouser: inspect-table requires a sequential thing, sets don't count
15:05chousernteon: just use (flush) if you want to flush output
15:05nteonstuartsierra: so apparently if I don't (.flush *out*), stdout never gets written
15:05bmasonaaah
15:06stuartsierranteon: That's typical of of I/O, regardless of language.
15:06nteon(apparently (println ...) calls flush)
15:06bmasonnow, in Stuart Holloway's book I thought we had an example of a set of maps being used to represent a table
15:06stuartsierranteon: actually the output stream flushes automatically on a newline
15:06clojurebotthanks; that was delicious. (nom nom nom)
15:06chousernteon: when *flush-on-newline* is true
15:06chouser,*flush-on-newline*
15:06nteonstuartsierra: eh, I guess I've gotten use to python and bash
15:06clojurebottrue
15:07bmasonthat seemed like a logical way to represent it, as you have things like (select pred set) working on sets
15:07nteonstuartsierra: thanks
15:07stuartsierranteon: actually, chouser's right, I'm not
15:07chouserbmason: I don't know how often clojure.inspect is used, but it's pretty rarely updated. Might predate clojure.set
15:08erikcw1Is there a clojure idiom for converting a byte array into a string, or is (String. byte-aray) the way it is done?
15:08stuartsierraaww, inspect-tree doesn't work on datatypes
15:08bmasonk
15:08bmasonwhat do you guys use to find out what's in stuff?
15:08stuartsierrabmason: prn
15:08bmasone.g. if you're exploring some libraries
15:09bmasonstuartsierra: prn? assuming that's not pr0n, do you have a link?
15:09nteonbmason: I've found the API docs to be quite nice
15:09stuartsierrabmason: prn is just println but formatted like normal code, e.g. strings are quoted
15:10bmasonstuartsierra: k
15:10chouserbmason: I use 'show' to look at methods of a class
15:10chouserbmason: is that what you're asking?
15:11bmasonchouser: that's half of it... that works for java stuff
15:11chouserhm, maybe show on a namespace should list public vars
15:11bmasonhah
15:11bmasonyeah that's what I just tried
15:12bmason,(show (first (all-ns)))
15:12clojurebot=== public clojure.lang.Namespace === [ 0] static all : ISeq () [ 1] static find : Namespace (Symbol) [ 2] static findOrCreate : Namespace (Symbol) [ 3] static remove : Namespace (Symbol) [ 4] name : Symbol [ 5] addAlias : void (Symbol,Namespace) [ 6] alterMeta : IPersistentMap (IFn,ISeq) [ 7] equals : boolean (Object) [ 8] findInternedVar : Var (Symbol) [ 9] getAliases : IPersistentMap () [10] getClass : Class () [11] get
15:12bmasonI got an error on mine though
15:12chouser,(keys (ns-publics 'clojure.inspector))
15:12clojurebotjava.lang.Exception: No namespace: clojure.inspector found
15:12chouserwell, that one worked for me :-)
15:12hiredman,(require 'clojure.inspector)
15:12clojurebotnil
15:12chouser,(keys (ns-publics 'clojure.inspector))
15:12clojurebot(is-leaf get-child-count list-provider inspect old-table-model inspect-tree atom? get-child collection-tag table-model inspect-table tree-model list-model)
15:12bmasonoh yeah
15:12bmasonneeded require
15:13chouserbut without arg or return types, I'm not sure what else 'show' would show
15:13chouserarglists I guess. *shrug*
15:13stuartsierrafirst line of the doc?
15:13chouseryeah, maybe
15:14hiredmanwhat if you actually want to inspect a namespace object?
15:14bmasonyeah, good info
15:14chouserhiredman: there's already a similar problem when trying to inspect Class instead of a class.
15:15hiredmannot that I actually use show
15:15bmasonwhat lib is show in?
15:15chousermaybe an optional (show :class *ns*) vs. (show :ns *ns*)
15:15chouserhiredman: what do you use? javadocs?
15:15hiredmanyes
15:15chouserbmason: clojure.contrib.repl-utils.
15:16hiredmanand (->> foo class .getMethods (map #(.getName %)))
15:16bmasonsounds like a good ns for me to read up on :)
15:16chouseroh, I see -- wrote your own. :-)
15:17hiredmanbut yeah, I javadoc all the time
15:17bmasonjavadocs is a website?
15:18bmasonnvm, found the wiki article
15:18chouseryeah, though you can get there through repl-utils too. (javadoc obj) or (javadoc Integer)
15:18hiredmanthere are a few websites
15:18clojurebotsee Subject Computing, Inc
15:18hiredmanclojurebot: bzzt!
15:18clojurebotIt's greek to me.
15:18bmasonah nice
15:18hiredman~jdoc String
15:19licoresseis elisp a lisp1 or 2?
15:20stuartsierralisp1
15:21bmasonthanks for all the info guys
15:21bmasonyou've been quite helpful
15:22nteonif I've got a keyword, :abc, whats the easiest way to derive the string "abc" from it?
15:22nteon,(.substring (str :abc) 1)
15:22clojurebot"abc"
15:22nteonanything more clojure-y?
15:22hiredman,(doc name)
15:22clojurebot"([x]); Returns the name String of a symbol or keyword."
15:22nteon,(name :abc)
15:22clojurebot"abc"
15:22nteonfantastic
15:23bmasondoesn't substring take a start position and a length?
15:23chouseroptional length
15:23chouseroptional end index, actually
15:24hiredman,(doc subs)
15:24clojurebot"([s start] [s start end]); Returns the substring of s beginning at start inclusive, and ending at end (defaults to length of string), exclusive."
15:33bittirhickey: your 'Western Mass.' talk is very nice. One has the feeling your're sitting next to me going over your ants program
15:34bittibetter than any book :)
15:34lancepantzbitti: link?
15:34bittihttp://blip.tv/file/812787
15:35bittithe ants part is in the 2nd half tough
15:35lancepantzoh yeah, that one
15:35lancepantzit is great
15:36bittibut one has the advantage over the life participants to be able to pause when it's going too fast...
15:36nteonwhat would people think of changing (time ...) to print its output to *err* instead of *out*?
15:42drewrrhickey: any interest in a select-keys modification that takes nested associations?
15:43nteoni've had to just copy the time macro in my program, since I'm writing clojure scripts that read *in* and write to *out*, but I would like to see interesting stats like the time several method calls took
15:44drewri.e., (select-keys {:foo 1 :bar 2 :baz {:quux 27 :quizzle 34}} [:bar [:baz :quux]]) => {:bar 2 :baz {:quux 27}}
15:45hiredman(defmacro time´ [& body] `(binding [*out* *err*] (time (binding [*out* ~*out*] ~@body))))
15:45hiredmanbleh
15:45hiredmanyou need to do all the '~' stuff
15:46nteonhiredman: eesh :)
15:47hiredman*shrug*
15:48hiredmanbinding is horrible and I hates it
15:48vagifHello, anyone familiar with clojure swank-slime knows a way to jump to a function definition by typing (part) of its name ? I'm tired searching everytime
15:49hiredmanchanged fn A's arity, and fixed all the calls to A, and then everything blew up because someone was binding A to a fn with the old arity somewhere
16:02stuartsierrahiredman: avoiding binding was one motivation for lazytest
16:02bittirhickey: all these talks are great, but to really hook up people you probably should make a "Creating a concurrent App in 15 minutes" talk ;)
16:09ipostelnikvagif, slime-apropos does something like what you want
16:09ipostelnikvagif, but no auto-completion
16:12ipostelnikin lein, is there a way to separate production dependencies and dev-dependencies? it appears to throw everything into lib/
16:13div_vagif, what about C-c C-d d ?
16:14div_or M-/ for autocompletion ?
16:20ska2342div_: sorry, missed the beginning. M-/ sounds like dabbrev in Emacs, not autocompletion
16:22div_ska2342, yes you are right, i was answering vagif's question: "Hello, anyone familiar with clojure swank-slime knows a way to jump to a function definition by typing (part) of its name ? I'm tired searching everytime"
16:23div_M-/ might not be optimal :)
16:27ska2342div_: you seem to be mixing completion of known symbols at point with jumping to the defintion of the function. Alternatively I seem to be missing the beginning of the discussion ;-)
16:31div_ska2342, i'm not mixing them, i was just confused by the original question (which i pasted) so i gave options for both completion and jumping to definition
16:32div_but since vagif appears to have gone afk, i suppose the point is moot :)
16:33carkhhum btw what's the emacs extension that allwos to auto-complete "w-o-s" to "with-out-str" ?
16:34carkhi think it's slime related, but never managed to make it work
16:34ska2342carkh: fuzzy-complete in SLIME. IIRC that's not delivered with standard clojure-mode installation via ELPA
16:35carkhah, and it works on pressin M-enter ?
16:36ska2342cark: it works with just TAB in the REPL and M-TAB in source code; the usual completion bindings. I don't know what M-Enter is bound to
16:37carkhah indeed i have it working already in repl =/
16:38ska2342so it *does* ship with clojure mode these days?
16:38carkhoh i don't know, my install is a custom home made mess =P
16:39ska2342carkh: OK, story of my life :)
16:40carkhhum ok it's working with tab in repl, but not in code window ... M-tab on windows is kind of already taken
16:40ska2342carkh: hit and release ESC, then TAB...
16:40carkhyes !!
16:41carkhthanks a lot, this is a great improvement to my everyday life =)
16:41ska2342standard fallback for all the poor users using crappy window-managers
16:42carkhnow there should be a way to bind this to some sensible key
16:42pdis there already a more idiomatic form of (= (string/take 2 s) "AB"), something like (string/starts-with? "AB") ?
16:43ska2342carkh: there is another alternative: C-c TAB
16:45carkhska2342:thanks
16:47lancepantzpd: (.startsWith "ab" "abba")
16:48kotarakI don't get string/take.
16:48kotarak,(subs "abba" 0 2)
16:48clojurebot"ab"
16:51pdkotarak / lancepantz : ty
17:29kotarak,(.index "ABCD" "C")
17:29clojurebotjava.lang.IllegalArgumentException: No matching method found: index for class java.lang.String
17:29kotarak,(.indexOf "ABCD" "C")
17:29clojurebot2
18:05vagifsorry, stepped out. Yes i know about autocompletion and fuzzy completion and appropos
18:05MrEvilwhat's the equivlient in clojure of the compound or boolean statement?
18:05vagifappropos does not jump to function, only shows its doc string
18:06ChousukeMrEvil: compound or... what? :/
18:06vagifi remember there was a function that would return list of declarations in particular namespace
18:06MrEvilthe equivlent of if( a || b)
18:06vagifi wonder if that can be used for findind a function
18:06kotarakvagif: ns-interns
18:06ChousukeMrEvil: (or a b) of course
18:06MrEviloh
18:07Chousukeor actually, for that example (if (or a b) ...)
18:23pdi've a map {:a 1 :b 2} with all the keys for use in a struct-map (but unordered), but how can i call struct-map to use it? i thought maybe (apply ...) but haven't been able to get that to work
18:25kotarakpd: (apply struct-map your-struct (mapcat identity prototype-map))
18:25hiredmanapply concat
18:25hiredmanactually
18:26kotarak,(let [my-struct (create-struct :a :b)] (apply struct-map my-struct (mapcat identity {:b 1 :a 2})))
18:26clojurebot{:a 2, :b 1}
18:26hiredmanyou can use into
18:26pdkotarak: thanks again
18:26kotarak,(let [my-struct (create-struct :a :b)] (apply struct-map my-struct (apply concat {:b 1 :a 2}))
18:26clojurebotEOF while reading
18:26hiredman,(struct :a :b)
18:26clojurebotjava.lang.ClassCastException: clojure.lang.Keyword cannot be cast to clojure.lang.PersistentStructMap$Def
18:27hiredman,(create-struct :a :b)
18:27clojurebot#<Def clojure.lang.PersistentStructMap$Def@dceebf>
18:27hiredman,(into (create-struct :a :b) {:a 1 :b 2})
18:27kotarak,(let [my-struct (create-struct :a :b)] (apply struct-map my-struct (apply concat {:b 1 :a 2})))
18:27clojurebotjava.lang.ClassCastException: clojure.lang.PersistentStructMap$Def cannot be cast to clojure.lang.IPersistentCollection
18:27clojurebot{:a 2, :b 1}
18:27kotarak,(into (struct (create-struct :a :b) nil nil) {:b 2 :a 1})
18:27clojurebot{:a 1, :b 2}
18:28rhickeyI can make array-maps throw an error when duplicate key is supplied. Seems people want that check, but means the behavior will differ from hash-map, which just takes last value of key
18:29rhickeyuser=> (array-map :a 1 :b 2 :a 42)
18:29rhickeyjava.lang.IllegalArgumentException: Duplicate key: :a (NO_SOURCE_FILE:0)
18:29rhickeyuser=> (hash-map :a 1 :b 2 :a 42)
18:29rhickey{:a 42, :b 2}
18:30rhickeyalso, literal maps of different sizes will have different behavior when given dupe keys
18:30rhickey:(
18:30hiredman:(
18:30kotarak,(get (array-map :a 1 :b 2 :a 42) :a)
18:30clojurebot1
18:31rhickeywhat I pasted was possible new behavior
18:31rhickeyuser=> {:a 1 :b 2 :a 42}
18:31rhickeyjava.lang.IllegalArgumentException: Duplicate key: :a
18:31kotarak,(get {:a 1 :b 2 :c 3 :d 4 :e 5 :f 6 :g 7 :h 8 :i 9 :a 42} :a)
18:31clojurebot42
18:31qbgWhy not have array-map mirror hash-map?
18:31kotarakThey seem to have already different behaviour.
18:32arohnerhas anyone here used parenscript in CL?
18:32rhickeykotarak: yes, but in your first case the resulting map isn't a proper map, undetected
18:32rhickey,(array-map :a 1 :b 2 :a 42)
18:32clojurebot{:a 1, :b 2, :a 42}
18:33kotarakrhickey: yes, I know. But here we get 1 with more than 9 literals we get 42.
18:33rhickeykotarak: that is after the fact of creating a non-map
18:33rhickeyso, a secondary effect
18:35rhickeyI'm not disagreeing they are different now, but since you have created a broken map, what behavior can you expect? In the new behavior, one will throw an error and the other not, but no bad maps
18:36rhickeyI wonder if people are relying on the last-wins behavior of hash-map
18:37arohnerrhickey: I do, when using merge
18:37kotarak*shrug* I'm not aware that I do. But I also have no problem with duplicate keys in array-maps....
18:37qbgarohner: merge works on array-maps just fine
18:37rhickeyarohner: merge is a different thing than attempting to create a map with dupe keys in source pairs
18:41rhickeykotarak: no problem with them conceptually, or no problem accidentally creating them?
18:41kotarakrhickey: creating them. Not intentionally and not by accident in two years Clojure
18:42kotarakConceptually it should probably be an error, I guess.
18:43rhickeycertain book authors want to highlight that behavior
18:44qbgTo me it seems like (array-map & args) should be like (assoc (array-map) & args), but then again I haven't used array-maps explicitly much
18:44rhickeywhich looks bad, even though I am in complete agreement it is a non-problem in practice
18:44rhickeyqbg: that would be needlessly slow
18:44kotarakqbg: you do with every {} with less than 9 k-v pairs
18:45qbgkotarak: I know
18:46qbgIf you can detect a duplicate key, couldn't you provide last-wins behaviour at about the same expense?
19:04rhickeyqbg: no
19:07kotarak(doc get-in)
19:07clojurebot"([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys"
19:08dnolenrhickey: btw, defprotocl and deftype rock. it's amazing the perf you get and you don't need to bother with type-hinting in code that uses them.
19:08rhickeydnolen: great!
19:09kotarakah, btw. I had a problem with interface having something like "Object method(X, Comparable); Object method(X, int);" It would always call the Comparable method.
19:09kotarakAlso type-hinted as int.
19:10Licenserhmm can I make a seq from an java.util.Enumeration?
19:10Licenserevening by the way :)
19:10qbgSpeaking of deftype, why is it that in (methodName [args*] body)* you can't use the destructuring syntax for args?
19:10rhickeykotarak: what do you mean by always call?
19:10kotarak(doc enumaration-seq)
19:10clojurebotExcuse me?
19:11kotarakrhickey: I have a deftype implementing this interface. (.method some-x 5) will always call the comparable version. Even with (.method some-x (int 5)).
19:12kotarakrhickey: I can't remember the details right now. Can check on Tuesday.
19:12Licenserah no doc but it exists :) thanks kotarak
19:12kotarakLicenser: wenn man's richtig schreibt, findet man's auch. ;)
19:12rhickey(doc enumeration-seq)
19:12clojurebot"([e]); Returns a seq on a java.util.Enumeration"
19:12Licenserkotarak: details details :P
19:40devinuswhere is all the recent clojure development taking place ?
19:40underdevcleveland?
19:43underdevgithub is the prefered hosted MVCC for clojure it seems, if that's what you were asking.
19:43underdevbut spacially, its a world-wide thing
19:44flavorjonesit's a web. that's world-wide.
19:51riddochcHm. The version of clojure that leiningen wants to use is a version that another library triggers a known bug that's since been fixed. Leiningen is seeming to cause me more problems than it solves. :(
19:53riddochcAnybody have comments on whether polyglot maven is worth trying yet?
19:56riddochcOr suggestions for an appropriate clojure build system for someone with xml allergies, that runs on clojure's current master and doesn't impose any particular version of clojure on the application?
20:00underdevjust an impression i'm getting from the channel- the upper echelons are moving to pure maven
20:02riddochcunderdev: How very javaesque.
20:02danlarkinthat's some nice FUD you've got there
20:04quidnuncWhen I try to start slime I keep getting "NoClassDefFoundError: clojure/main". Google says that others have experienced the problem. One solution was to add swank-clojure.jar to ~/.swank-clojure. I have tried that with no success. What could be wrong?
20:06Licenserhmm is there a simple method to copy a file in clojure?
20:0715SAAM03Btest
20:08quidnunctest successful
20:08underdevriddochc: yeah. i don't bring recent java experience to the table, so i've been learning maven a little at a time
20:08riddochcdanlarkin: I simply don't *know* java anywhere near as well as I know lisp. I'm trying to stay to the lisp side of clojure when I can.
20:09underdevriddochc: someone tweeted this: "everyone is looking for the perfect clojure build system. It must be no less than maven 2, no greater than maven 2, and not maven 2"
20:10brian__quidnunc , I'm a beginner to clojure and emacs, if thats you, I have used "Clojurebox" (only) windows though
20:11quidnuncbrian__: Thanks, but I don't use windows. And I think this automagic stuff is the source of most of my problems.
20:11riddochcunderdev: Found any decent introductions to maven from the point of view of clojure?
20:11danlarkinriddochc: I was responding to underdev, not you :)
20:11underdevriddochc: no. not really.
20:12underdevthere are a couple maven books available online from the maven website
20:12qbgquidnunc: Did you get SLIME & swank-clojure from ELPA?
20:12dullardquidnunc: I got up and running using elpa
20:12underdevsomeone earlier said they were going to blog about polyglot maven and clojure
20:12underdevearlier today, that is
20:12riddochcLicenser: I'd look in the java api, I don't think there's anything clojure-specific last I looked.
20:13Licenser*nods* thanks riddochc
20:13LicenserI feared it was that :P
20:13quidnuncqbg: Yes, elpa
20:13qbgLicenser: You could use slurp and spit, but that could be too inefficient
20:13underdevquidnunc: i can't recommend emacs starter kit enough
20:13LicenserI wonder if (spit file (spulr file)) is working
20:13Licenser:) qbg
20:14underdevquidnunc: if you install all the clojure stuff from elpa included with the emacs starter kit, it "just works"
20:14riddochcI haven't been able to make sense of the documentation for polyglot maven. Probably because I don't really know anything about maven.
20:14underdevpeople trying to pull slime from HEAD and whatnot report a lot of problems, it seems
20:14quidnuncI have been using emacs for many years. emacs-starter-kit seems way too intrusive.
20:15quidnunc"The Starter Kit should provide a saner set of defaults than you get normally with Emacs." == Heresy to a long-time emacs user.
20:15underdevokay, cool
20:15quidnuncthanks anyway
20:29riddochcSo, leningen commit 41fd74 from ~2 weeks ago dropped clojure back to 1.1.0 because of problems in 1.2.0, but doesn't say what those problems are. Whatever they are, it doesn't look like clojure has bugfix commits since then. Does anyone know what the issue is?
20:31qbgHas anyone had success running the penumbra examples?
20:32underdevriddochc: no idea, but i see plenty of alerts about problems in lein from planet clojure. you might want to look there.
20:34riddochcunderdev: Planet clojure? What a good idea. URL?
20:34devinusunderdev: i meant on the web. the github repo only sees updates sporadically and they're usually small. i was wondering if i was missing something?
20:34underdevplanetclojure.in, i think
20:35underdevi just get the feed, so i'm not sure :)
20:35qbgplanet.clojure.in
20:35underdevyeah, sorry. i just get the feed on my igoogle page. subscribed a long time ago :)
20:36underdevdevinus: http://www.assembla.com/spaces/dashboard/index/clojure
20:36underdevyou might take a look there
20:39underdevbut seriously, i'm just trying to help because there doesn't seem to be anyone else here. don't take me seriously, i'm just here for teh lulz
20:39riddochcunderdev: thanks anyway.
20:40qbgriddochc: What library is causing your problem with leiningen?
20:45riddochcqbg: I've been trying to use clj-peg... last night, I fixed it so it'll work on both clojure 1.0 and current master, but somehow the 1.1 version of clojure lein wants to use causes an error when :use-ing clj-peg that more recent versions of clojure seems to have no problem with.
20:46riddochcSo, I have no combination of lein and clj-peg that will work on the same version of clojure.
20:46riddochcFun, huh?
20:46qbgAre you trying to run your program from lein repl or lein swank?
20:47riddochcrepl.
20:47qbgUse lein swank
20:47arohnerriddochc: or just replace clojure 1.1 with clojure 1.2 in lib/, and start clojure from the command line:
20:47riddochcIt would make a difference? The error, by the way, is: java.lang.VerifyError: class com.lithinos.clj_peg.core$loading__4946__auto____15 overrides final method meta.()Lclojure/lang/IPersistentMap; (NO_SOURCE_FILE:1)
20:48arohnerjava -cp lib/*.jar clojure.main
20:48arohnerriddochc: you're using a jdk6, right?
20:48riddochcarohner: Yup.
20:49qbgAnd works okay in Clojure 1.2?
20:49riddochcqbg: It does, in fact.
20:49qbgThen have your project that uses it depend on clojure 1.2 and use lein swank for the repl
20:50riddochcqbg: I haven't really used swank before. Isn't it for emacs?
20:51qbgYeah, this advice is only helpful if you are using slime
20:52riddochcqbg: Hm. I haven't been able to get emacs to play nice with clojure yet. That's another issue altogether...
20:53qbgI find it is easier with lein swank than a normal slime setup actually...
20:53qbgAll you need is slime, and not swank-clojure
20:56underdev*cough* <elpa> *cough* esk
20:57qbgThat part that almost always screws up when setting slime in emacs is the launching and connecting to clojure. lein swank makes that part just work (tm) in my experience.
20:57underdevalso, the project.clj that is used in the labrepl has some of teh hotness in it
20:58riddochcI've been trying to avoid emacs, honestly... I've had RSI. Long story.
20:59riddochcI'd really rather prefer just a repl. It would work a lot better with some of the accessibility tools I use.
21:00underdevlike what, may i ask?
21:00underdevi type about 30% of my clojure code. seriously.
21:00qbgThe java -cp lib/*.jar clojure.main mentioned above should also work then
21:01underdevthe tab key reads my mind and does what i mean
21:01qbg(actually, you probably want src on the classpath also)
21:02riddochcqbg: I suppose, then, that I might as well replace lein with a 3-line shell script, for all it's doing for me. ;)
21:02qbgDon't underestimate the power of shell scripts
21:03riddochcunderdev: It's a strange setup, involving dragon naturallyspeaking in a VM, dasher, cellwriter, easystroke, and a wacom tablet.
21:03underdevso cool.
21:03underdevim unfamilar with some of those
21:04riddochcunderdev: It's often a little slower than typing would be, but sometimes quite a lot faster, depending on what I'm doing.
21:05underdevrt, i use dns, x6 macro keyboard, autohotkey, and a emacs setup that's easy on the hands, with lots and lots of tab completion
21:06underdevw/ ubuntu hosted on windows
21:06underdevgoogling your aps
21:06underdevapps
21:06riddochcunderdev: Dasher is a predictive text entry thing, cellwriter is handwriting recognition, and easystroke is gesture recognition. All free software, dasher's been widely ported.
21:07underdevriddochc: ty
21:07qbgRandom thought: Using emacs with a QWERTY layout feels so weird
21:08riddochcI avoid using a keyboard at pretty much all costs, anymore. I'm a hobbyist now, planning on taking my linguistics background to do speech pathology instead of software dev work.
21:09tomojI loved dasher, but it was too slow :(
21:10tomojmaybe if I lose my hands
21:11riddochcShort version: RSI + burnout = time for a career change. Dasher's not bad, when you've trained it with everything you've ever written. ;)
21:12tomojI wonder how well it can write code
21:12riddochcThough it's a really hideous codebase. Spaghetti code in C++. What method's being called here?
21:12riddochcIt honestly sucks for code.
21:12tomojI believe my friend's sister's fiancee worked on dasher
21:14riddochcMy version of dasher is several years old. More recent versions broke some really important features, notably auto-copy-to-clipboard.
21:18riddochcWarning: I am empirical evidence that too much emacs and not enough typing breaks causes RSI.
21:21riddochcBut that was 5+ years ago. It's better, so long as I don't do anything stupid, like program full-time. Regression is way too easy. Take breaks, use workrave to remind you, and you'll probably avoid this fate.
21:23underdevi don't suffer from rsi, but i suffer from finger memory calcified to commodare 64 keyboard. i've tried dvorak and everything. i programmed in tcl for a long time because its alphanumeric + 3 sets of syntax delimiters
21:24underdev#(foo'()) is murder on me
21:24underdevbut i've macro keyed all the sytactic sugar]
21:24underdevand paredit does the rest :)
21:26underdev+hippie-expand +yasnippets
21:27riddochc"I have gestures for a lot of syntactic sugar. Some scripts so my gestures take parameters from extra input before spitting it into the kernel's uinput module so it looks like it came from a keyboard.
21:28riddochcI really ought to get around to releasing some of this code. I'm a perfectionist. *sigh*
21:28underdevim hoping that bottom-up programming will get me to the point that dragon will helpful
21:30underdevokay, enough spamming, back to list comprehensions :)
21:30riddochcYup.
21:42qbgFool Disclojure is awesome
21:43tomojhmm
21:43tomoj'5 days ago' doesn't sound right
21:44riddochcYeah, I think the server's clock must be 4 days slow.
21:44qbgOr it is an excellent prank
21:44riddochcSo much for NTP.
21:45riddochcIt's definitely clever...
21:50Licensergood greif :(
21:55Licenserfor the reocrd slurp spit doesnot work with non text files
22:36underdevim having trouble groking the difference between apply and map...
22:39tomoj,(map + [1 2 3] [4 5 6])
22:39tomoj> [5 7 9]
22:39tomoj,(apply + [1 2 3])
22:39clojurebot(5 7 9)
22:39tomoj> 6
22:39clojurebot6
22:41tomojer, a seq, yeah :)
22:41tomojmap is for transforming the elements of a list
22:41tomojor applying a transformation to elements of more than one list in parallel
22:42tomojso the transformation you give is called n times where n is the length of the shortest list you pass
22:43tomoj(map f [1 2 3] [4 5 6]) == [(f 1 4) (f 2 5) (f 3 6)]
22:43tomoj(apply f [1 2 3]) == (f 1 2 3)
22:43underdevokay, i get it
22:44tomojI am glad to see another person who groks "grok"
22:44tomojI get many weird looks
22:44underdevstranger...
22:45tomojI think equivalencies like that would be useful in defn's doc project
22:45underdevthat last bit was very helpful, yeah
22:45tomojit can be easier to understand an example when you don't see the result, but some intermediate form
22:46tomoj,is
22:46clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.contrib.test-is/is
22:46underdevrt, that completely models the results i was getting from the repl, but i couldn't see it like that
22:47tomoj,(is (= (map f [1 2 3] [4 5 6]) [(f 1 4) (f 2 5) (f 3 6)]))
22:47clojurebotDENIED
22:47tomojdarn
22:47tomojI love that github easily allows me to look up a project by a person instead of by name
22:47tomojI suck at remembering names
22:48tomojI guess walton looks for clojurebot examples?
22:54underdevlike Pres. Clinton before me, i don't know what "is" is, but given a def for f, that evaluates to true
22:54underdevsuper, ty tomoj
22:55tomojah, hmm
22:55tomojof course
22:55tomojthe problem is that we don't want to bother coming up with such definitions