#clojure logs

2010-03-01

00:08brian_hi , i have a noobie question about libraries, this might not be specific toclojure,but I am encounteringit for the first time with a clojure library, that is a clojure api for an external database library. What I don't get is that it isn't apparent how the api "knows" where the database library is, as there isn't anyplace for meto configure the api to know where it is.Is there some other way that this information gets shared by progr
00:08brian_ams these days?
00:26brian_this is specifically tokyocabinet
00:27TheBusbybrian: I can't help you with your question specifically, but I suspect you'll have the best luck looking at the source code/documentation
00:28TheBusbyif that doesn't help, it might be valuable to contact the author of the library and ask
01:17nunbis this the right place to ask about leiningen?
01:19nunbFor leinengen, which is the checkout director? I am trying to do the step >>Then run "lein-stable deps" in your checkout.<< from the github instructions README
01:19nunb*directory,
01:20Chousukenunb: the dir containing the project.clj file, usually
01:26nunbI can only see ~/.m2 and that doesn't have a project.clj
01:27Chousukenunb: you didn't download the sources? :(
01:27Chousuke:/* even
01:28nunbI did `lein-stable self-install` after downloading the shell-script
01:28nunbDo you mean the clojure sources?
01:28Chousukehm
01:28nunbI guess I just don't know what dir. they are in.
01:28Chousukeno, I mean whatever project you're trying to install I guess :P
01:30nunbChousuke: Ok, I've made a project.clj using the text on github: `~/programming/clojure-stuff/leiningen] tallinn: cat > project.clj`
01:31nunbAnd now lein-stable deps works!
01:32Chousukewhat are you donloading the deps for, though?
01:33ChousukeI mean, creating an empty project.clj downloads the dependencies for an empty project, and I don't see why you'd do that. :/
01:34Chousukeif you're following the "hacking" section on leiningen, that's only needed if you want to do something with the git version of leiningen
01:35Chousukein which case you'd have a leiningen git checkout :)
02:14nunbChousuke: yes, that was what I was trying to do. I see now, the original was just a small shell-script, I should have git-cloned the full thing.
02:16nunbAlso, I am not sure if leiningen or clojureX is the way to go (I am on OSX)
03:24taliosanyone awake?
03:25TheBusbyonly the few who are up during the witching hours
03:26talios:) When did symbolmacro's first appear in clojure? Are they a 1.2 thing? Never seen them before
03:32replaca_talios: symbolmacros, really? where do you see them?
03:33sparievafaik it from contribs master branch - http://richhickey.github.com/clojure-contrib/macro-utils-api.html
03:33taliosin clojure-contrib - http://gist.github.com/318201
03:33taliosthat test fails under clojure-maven-compiler:1.3.2-SNAPSHOT - and it's holding me back making a release :( Only, I don't know why it failing under one version of my plugin and not the prior
03:34taliosI know I've changed the way the clojure:test goal runs slightly, but this failure isn't quite the failure I expected to see :(
03:35replaca_Ah, yes. I think that's an experiment from Konrad Hinsen is doing, not an official language direction
03:52esjHello all
04:02AWizzArdMoin esj
04:12LeafwI'd appreciate help building clojure contrib
04:13Leafwnever mind
04:15talios'lo
04:17Leafwso duck streams has disappeared from clojure contrib?
04:17Leafwis there anywhere where it's documented hwhat's happening with clojure contrib?
04:17taliosThere was talk the other day of somethings from contrib moving to core
04:18LeafwI have the impression that clojure dev suddenly closed up. I can't find relevant info anymore.
04:18taliosclojure-contrib was going through some reorg, moving to maven etc. some things moving to core.
04:18Leafwfind -iname "*duck*" lists nothing on either c or c.c repos.
04:19Leafwso it got moved to some IO package
04:19Leafw(I hope)
04:19taliosahh clojure.io went ahead did it?
04:19Leafwno idea
04:20LeafwI lost track. I guess all of this is happening in emails
04:20Leafwlooks like there is a c.c.io, it's new to me
04:20Leafwcommit c8be49609099ffca541f95b827a41179cbe83080
04:20LeafwAuthor: Stuart Sierra
04:20AWizzArdContrib still contains the old duck-streams
04:20LeafwAWizzArd: in c.c.io I guess
04:20AWizzArdbut now io is the new version, and the one which will imporve
04:21LeafwAWizzArd: latest pull on c.c. master does not show any *duck* file
04:21AWizzArdIn the clojure-contrib.jar file that you can download from build.clojure.org
04:21AWizzArdThere still is a duck-streams.clj
04:21Leafwnot in master.
04:21AWizzArdSo that old code won't break
04:21AWizzArdRight, in the repo itself there is no such file anymore.
04:22AWizzArdI guess by using this Maven thing one can build a clojure-contrib.jar which will include the old duck-streams.clj.
04:23Leafwit's a bit appaling that there isn't a simple way to build c.c.jar without going and learning an entirely new build system, aka mvn
04:23taliosas opposed to using the the old build system you had to learn?
04:23taliosor using leiningen, if they went that way
04:23taliosor make.
04:24Leafwant may be horrible, but at least just about all devs and their tools can use it
04:24Leafwsame for make
04:24Leafwnever mind. AS usual, we'll find a way around.
04:24taliosinstall maven. "mvn install". thats all you need.
04:25Leafwit would have been the 'obvious' thing to just use clojure itself to build c.c.
04:25Leafw"all you need", you are kidding right.
04:25Leafwthis is idle talk anyway.
04:26Leafwhow funny that io.clj reads, in its first line: ";;; duck_streams.clj -- duck-typed I/O streams for Clojure"
04:26taliosit would have been cool to see it use leiningen, but I'm glad Stuart decided to use my plugin. maven gives a lot of other benefits as well
04:28Leafwtalios: to use mvn, I had to download it manually from apache website, and create a bash alias, and setup a JAVA_HOME to my JVM install. All of this because, otherwise, apt-get install mvn would result in about 400 Mb install of gcj and other stuff I really don't need in this tiny machine.
04:29taliosuse a real os :) anything that installs gcj these days isn't worth running
04:29taliosmust be a skank redhat based thing?
04:29talios:)
04:29Leafwubuntu 9.10, but I do lots of java dev, and we have our own battery of JVM to test against.
04:29taliosI bet if you installed ant via apt-get you'd have the same issue
04:30Leafwredhat users RPM, not APT.
04:30Leafwyes, ant had the same issue. But ant is part of a standard build chain of many apps.
04:30Leafwmvn is just new. I am sure it's better than ant. That is not hard.
04:30taliosand so is maven. more and more these days
04:31taliosmvn does have many an issue tho, a lot of them are fixed in the upcoming 3 release tho
04:31Leafwnever mind, talios.
04:31LeafwI have heard that song before.
04:31talioshey - it's irc. we're meant to bitch :)
04:31Leafwindeed XD
04:31eevar2Leafw: learn to use aptitude ;) -- gcj might be a recommended dependency, but if you have openjdk you probably shouldn't have to install it
04:31Leafwbut this channel has always very constructive conversations. Let's keep it like that.
04:31taliosseriously tho, maven 3 doesn't actually solve a lot of the pain points of m2
04:32talioser, does
04:32Leafwnice slip.
04:32talioshur
04:34Leafweevar2: I am sure it can be solved. The point here is that I'd rather not learn yet another piece of trivia.
04:34Leafwtotally orthogonal to my task.
04:43AWizzArdLeafw: this maven approach is also complicated for people behind a firewall, because maven tries to download a few exabytes of data each time you use it. So I just switched to download from http://build.clojure.org/
04:44LeafwAWizzArd: I noticed.
04:47eevar2Leafw: if you'd rather build & maintain packages on your own, that a valid option too
04:48Leafweevar2: it's all about a coherent build system for fiji, which needs both clojure and c.c jars (http://pacific.mpi-cbg.de)
04:48eevar2but personally, I'd take 15 minutes to get to know aptitude better
04:49eevar2debian repos aren't neccessarily cutting edge either, so you might not always have a choice. -- but installing gcj really _is_ optional
04:58tomojgcj?
04:59tomojoh, I thought it was a clojure tool
04:59Leafwno need for "gnu clojure", it's already under an open license :)
05:06ordnungswidrigLeafw: you know: (not (= 'open 'open)) :-)
05:13talioswas interesting - I had to go through last week and add EPL headers to all the code for the clojure-maven-plugin cause the Debian guys wanted to include the plugin in the distro
05:13taliosso there's some sign of cutting edgeness there
05:14ordnungswidrigtalios: cool
05:14ordnungswidrigtalios: it was a long way for maven to enter debian. (Maven is very hard to bootstrap cleanly)
05:14taliosyeh, which is why I really want to get a new release out, only it breaks clojure-contrib now :(
05:15taliosordnungswidrig: yeh, I saw that with JPackage back in the day, trying to package all plugins and dependencies just seems like a fools gain of duplicated effort
05:16talioswill be interesting to see how Jigsaw will help or hurt there
05:16ordnungswidrigDebian is very strict about building from source only.
05:16ordnungswidrigJigsaw?
05:16taliosJigsaw's the module system coming in Java 7
05:16taliossource level modularity
05:17talioskinda like a poor mans OSGi, but with the advantage of being compile time
05:17taliosand without OSGi lifecycle/services
05:38vychouser: AFAIR, you have a clj library for JNA bindings. Do you know how can I make com.sun.jna.Function/getFunction to load a static library? (It always looks for a .so file, but I have an .a, and I don't want to convert it to a shared library.)
05:42vychouser: People say I can't: http://stackoverflow.com/questions/1277034/jna-load-a-lib-library But I can easily bind static libraries using Native.register() method in Java.
06:00tomojis there any support yet in leiningen for pushing a project to a maven repo?
06:01tomojoh, I see, we can just scp the pom
06:01tomojand jar
06:02taliosI thought it had a deploy option?
06:02taliosI thought I saw something about automatically deploying to clojars
06:11tomojhmm
06:11tomojmaybe in the clojars plugin
06:12tomojI don't want to deploy to clojars though :(
06:13taliosthat may be why people still like to use my maven plugin, having the rest of maven's infrastructure and project support is handy
06:14taliosI really need to do some more work on Polyglot Maven as well: http://polyglot.sonatype.org/clojure.html
06:14taliosmaven pom files written in clojure
06:14talios(and scala, groovy, yaml, ruby)
06:15taliosthe problem with that however is things like the maven release plugin want to rewrite an XML file with version number changes, not some weird scripty thing
06:17talios'lo rich
06:17rhickeyhi
06:21taliosoh well - night all.
06:28raekis the convention to name namespaces in singular or plural? i.e. x.y.bar or x.y.bars for a library that works with "bars"?
06:29esji'm guessing singular
06:32bsteuberseems to be about 50:50 in clojure-contrib
06:45dsoprhickey: may I use the clojure logo from your brother in an CC non-commercial licensed work?
06:46rhickeydsop: the Clojure logo should only be used to refer to Clojure itself
06:47dsoprhickey: well I wanted to create a wallpaper for clojure
06:47rhickeynot for distribution
06:47dsopokay
06:47dsopthanks
06:47rhickeythabks for asking
06:47rhickeythanks
06:56zmilahello, rhickey! just my appreciations of your great work. i'm studying the language while solving ProjectEuler problems.
06:56rhickeyzmila: Hi, have fun!
06:56vyDoes "seq" command _clone_ the original object?
06:57rhickeyvy: no
06:58vyI want to create a copy of an int[] returned from a C function (of Pointer return type) call via JNA. Is Arrays.copyOf my only way?
07:00bsteubervy: why not just put it in a clojure vector?
07:02vybsteuber: Right! That's what I was looking for!
07:06bsteuberrhickey: I was very amazed when learning you're a Go player! Though I guess you don't have much time left to play...
07:09bsteuberI'm a german 6d and usung Clojure to manage my Go problem collection, so I find this very cool
07:09bsteuber*using
07:09rhickeybsteuber: yeah, I've been slacking off with my Go, but Go is a lifelong process...
07:10rhickeyso hopefully I'll get back to it
07:11rhickeybsteuber: I never quite made it to US 1D, was playing at 2k at my last peak, so a long way to go
07:11AWizzArdAren't computers around that lvl? 2k / 1k?
07:12vyHow can I make "ints" work? (ints [0 1 3 4 6 8 10]) complains that "clojure.lang.PersistentVector cannot be cast to [I".
07:12rhickeyAWizzArd: what are you implying? :)
07:12bsteuberrhickey: If you need any lessons, just tell me :)
07:12rhickeybsteuber: thanks!
07:12AWizzArdvy: can you somehow use into-array?
07:13AWizzArd,(into-array Integer/TYPE [10 20 30])
07:13clojurebot#<int[] [I@14d8dd6>
07:13AWizzArd,(vec (into-array Integer/TYPE [10 20 30]))
07:13clojurebot[10 20 30]
07:13vyMy bad! Thanks.
07:14bsteuberawizzard: I believe the best bots are already past 1st dan
07:14AWizzArdbsteuber: do you think this is mostly because of improvements in software or thanks to hardware which gets exponentially faster?
07:16bsteuberawizzard: I guess both - those Monte Carlo algorithms sort of kick ass, even if they're brute force like anything else
07:17AWizzArdIn chess they left the brute force approach behind. Those programs are so very good now, they only need ordinary desktop hardware, (notebooks, single core, etc). That is enough to beat Grand Masters.
07:19AWizzArdRybka for example does not even have an opening book anymore, and instead calculates its moves itself. Simply because this is better than everything humans produced within the past hundred years. Crazy stuff.
07:19bsteuberdefinitely
07:20vyIn SLIME, C-c C-c'ing an expression -- when *warn-on-reflection* is enabled -- doesn't output anything neither in repl buffer, nor in inferior lisp buffer. Everytime I have to paste the code into repl manually. Any solutions for this?
07:20AWizzArdvy: can you try C-c C-k and see if that changes anything?
07:21vyAWizzArd: No changes.
07:32bsteuberdas programm ist ziemlicher mist :)
07:32bsteuberhab nach einer woche auch schon wieder die lust verloren
07:32AWizzArdbsteuber: wrong window :)
07:32dsophrhr
07:32bsteuberich hab halt versucht die gängigen algorithmen nachzubauen und war schnell frustriert wie viel langsamer mein zeug war als der C-kram
07:32bsteuberoh, sorry :)
07:32dsopbut I wonder what he's talking about
07:33AWizzArdseems to be german I guess :)
07:33dsopI know that it's german
07:33dsopbut I wonder the context
07:33bsteuberI was talking about my lousy efforts to start a Go programming framework in Common Lisp
07:33dsopokay
07:33bsteuberhttp://sourceforge.net/projects/cl-go/
07:33bsteuberit really sucks, so don't read it :)
07:34bsteuberbut I might try again with clojure
07:34vyCan anybody help with this reflection/coersion related problem, please: http://privatepaste.com/d95ec79026
07:35bsteuberI'm glad I wasn't talking 'bout porn links :)
07:42dsopbsteuber: :)
08:07AWizzArdvy: you are calling the .invoke function and from your paste it is not obvious that you have type hinted all arguments in those calls.
08:25danleiwhat's the preferred way to remove a first occurence from a sequence? (in cl, remove(-if) takes a count parameter ...) no big deal to write a remove-first, but maybe I've missed something obvious ...
08:27danleii.e. something better than: (defn remove-first [pred [head & tail]] (lazy-seq (if (pred head) tail (cons head (remove-first pred tail)))))
08:34bsteubersth. must be wrong with my (ELPA) swank-clojure setup
08:34bsteuberI only have M-x clojure-mode available after starting swank
08:35bsteuberwhich means I don't have syntax highlighting before starting a REPL
08:35bsteuberthat's not how it should be, is it?
08:35rhickeydoes "mvn -Denv=local package" still work for contrib? Not in readme anymore
08:36licoresseis this necessary? (map #(int (* 10 %)) (take 4 (repeatedly rand)))
08:36licoresse,(map #(int (* 10 %)) (take 4 (repeatedly rand)))
08:36clojurebot(7 1 2 2)
08:37licoressewhat is a terser form to represent 4 random numbers in a list
08:38rhickey,(doc rand-int)
08:38clojurebot"([n]); Returns a random integer between 0 (inclusive) and n (exclusive)."
08:39bsteuberso (take 4 (repeatedly #(rand-int 10))) is best?
08:39AWizzArdyes
08:40licoresseah, the #
08:40licoresse(doc repeatedly)
08:40clojurebot"([f]); Takes a function of no args, presumably with side effects, and returns an infinite lazy sequence of calls to it"
08:40licoresseI forgot the #
08:41licoressethanks
08:41danleidid someone answer my remove question? (was disconnected for about 2 minutes)
08:42AWizzArddanlei: nein
08:42AWizzArdso, what you suggested seems plausible
08:42danlei AWizzArd: danke
08:43danlei> ok, maybe an optional parameter like :count would be nice to have?
08:44ordnungswidrigdanlei: no need because repeatedly is lazy.
08:45danlei ordnungswidrig: hm?
08:45bsteuberanderes thema :)
08:46danleiwir könnten ja schon fast nen deutschen clojure-kanal aufmachen ;)
08:46AWizzArdthere already is one..
08:46ordnungswidrigdanlei: #clojure.de
08:46danleioh
08:46danleithanks
08:48LeafwI am just starting to explore defprotocol/reify and I wonder: is it necessary for a protocol to be defined with always at least one argument (which is the 'this' or 'self', IIUC). It makes sense later on when calling (method instance), but why should defprotocol be contaminated with that idea?
08:48Leafwit's not like that argument won't ever be the first one. Python shows it, java hides it.
08:49AWizzArdI think that when you want to use “this” you add a “:as this” to your declaration.
08:49AWizzArdThis is how I did it so far.
08:49AWizzArdBut the fns themselves don’t need to explicitly list this arg.
08:50Leafw,(defprotocol A (do-a [] ""))
08:50clojurebotjava.lang.Exception: Unable to resolve symbol: defprotocol in this context
08:50Leafwhum the bot doesn't know. that fails, though. It needs an arg.
08:50AWizzArdThe bot does not run the freshest clojure.jar
08:51Leafwso, AWizzArd: do your defprotocol declarations not have an arg at least in each method listed?
08:51AWizzArdCorrect.
08:51Leafwhow? Doesn't run.
08:51AWizzArdLeafw: look at line 32: http://gist.github.com/306174
08:51Leafwpaste the above in your repl. To work, it needs (defprotocol A (do-a [a] ""))
08:52Leafwdeftype, not defprotocol
08:52AWizzArdah okay
08:52clojurebotLeafw: aye aye skipper
08:52Leafwdeftype is like defprotocol but more like a java class declaration
08:55rhickeydanlei, bsteuber: repeatedly now takes n arg, so (repeatedly 4 #(rand-int 10)) works
08:56danleirhickey: nice, but I was talking about remove
08:58rhickeydanlei: where (remove n pred coll) would remove some but not the rest of them?
08:58danleitm rhickey yes
08:58danleis/tm//
09:00danleirhickey: if I wanted to remove only the first occurence, the best I came up with was: (defn remove-first [pred [head & tail]] (lazy-seq (if (pred head) tail (cons head (remove-first pred tail))))). A "count" argument to remove would be nice, imho
09:06rhickeyis there paredit magic for turning (a (b ...)) into (b (a ...)) ?
09:07danleirhickey: just transpose-words if you're between a and (
09:09danlei(anywhere between a and b actually)
09:10rhickeyactually it's often (a b (c d (...)) ==> (c d (a b (...)) that I want
09:11danleihm ...
09:15chouserdanlei: (defn remove-n [n p s] (apply concat (map #(if (< %2 n) (when-not (p %1) [%1]) [%1]) s (seq/reductions #(if (zero? %2) (inc %1) %1) 0 s))))
09:16chouserdanlei: I'd bet there's an even better solution.
09:17danleichouser: thanks
09:17danlei(gotta read up on seq/reductions)
09:18bsteuberchouser: (apply concat (map ... => (mapcat ...
09:18bsteuberor am I wronng?
09:18bsteuber-n
09:18chouserbsteuber: heh. nope, not wrong.
09:20chouserI don't really like wrapping every element in a one-item vector, but it's the simplest way to support nil and false values in the input seq
09:21chouser(seq/reductions #(if (zero? %2) (inc %1) %1) 0 s) might warrant its own name. "counting" or something.
09:21chouserer
09:21chouserwhoops
09:21chouser(defn remove-n [n p s] (mapcat #(if (< %2 n) (when-not (p %1) [%1]) [%1]) s (seq/reductions #(if (p %2) (inc %1) %1) 0 s)))
09:22chouserhad a stray 'zero?' in the original
09:26rhickeyit's interesting, would you want the same n arg for filter, and how would you describe what it does?
09:26rhickeysince remove is just sugar for filter
09:28danleirhickey: (remove-if-not #'evenp '(1 2 3 4 5 6 7) :count 2) => (2 4 5 6 7)
09:28danleirhickey: in other words just the same as remove but for (complement pred)
09:28rhickeydanlei: n arg to remove is written, just wondering about the filter question
09:29chouserremove-if-not == filter :-P
09:29danleirhickey: yes, I mean: filter could do the same as remove, but with (complement pred)
09:30rhickeyyes, remove is filter (complement pred), the question is, while n seems to make complete sense for remove, does it for filter?
09:30chouserI appreciate the relative scarceness of numeric indexes and counters in the clojure core fns.
09:30danleichouser: learned about reductions from your solution, seems to be handy
09:30chouserI'm not sure n makes sense for core filter or remove
09:31rhickeychouser: but remove-n is clearly not easy with core fns
09:31danleiI second that (not easy enough)
09:32rhickeyand the n arg doesn't really fit with filter, IMO
09:32chouserI'd rather seen filter/remove support extra seqs like map does
09:33chouserif "counting" were defined, and remove took extra seqs, remove-n would be just:
09:33chouser(defn remove-n [n p s] (remove #(< %2 n) s (counting p s)))
09:34rhickey?
09:34chouseroh. maybe not.
09:34chouserer. nevermind.
09:35danleirhickey: I agree that n doesn't make as much sense for filter as for remove (at least intuitively), but do you think it would hurt?
09:35chouserI should never ever post code without testing.
09:37danlei(where "hurt" = have negative consequences)
09:43chouser(defn remove-n [n p s] (remove #(and (< %2 n) (p %1)) s (counting p s)))
09:43chouserthere
09:43chouserthat's what I meant.
09:46chouserthat looks easy enough to me, and I've wanted multi-seq filter and remove before.
09:46danleihm
09:47Leafwhow is case different than condp ?
09:47LeafwI guess case is a new fn, that compiles to a switch statement?
09:47chousercase requires all your test values to be constant at compile time
09:47Leafwchouser: ok, so a switch. Thanks.
09:48danleichouser: the thing is, I sometimes need (remove n ... but I havent had the need for a multi-seq remove/filter up to now
09:48LeafwI'm reading http://gist.github.com/306174 that AWizzard posted. It's the first coherent non-trivial code that uses defprotocol, deftype and so on that I have seen.
09:48danleichouser: on the other hand, you're right in that it's not too complicated like that
09:49chouserhm. I've never needed remove n. :-)
09:49danleichouser: how would you implement (shuffle ...)? ;)
09:49chouserdanlei: shuffle as in randomize the order of a seq?
09:50Leafwby the way, can deftype extend a type that has already been defined, to avoid writing in all its functions/methods?
09:50danleichouser: yes, my first approach would be:
09:50danleichouser: (defn shuffle [s] (loop [s s acc nil] (if (seq s) (let [e (seq/rand-elt s)] (recur (remove 1 #{e} s) (conj acc e))) acc)))
09:50danleichouser: (given a working (remove n ...)
09:50chouserdanlei: I wouldn't implement it at all. I would use seq/shuffle. :-)
09:50danleichouser: yes ;)
09:50danleichouser: you know what I mean ;)
09:51chouserand, note how it's defined
09:51danleiuses java interop, i guess
09:52chouserright, because Java's array shuffle is so much faster than anything that would likely be built on seq.
09:53danleiit was just an example of a situation, where you'd need something like (remove n, when you're trying to solve with them means of clojure.core
09:54Leafwand would anyone elaborate on how is definterface different than defprotocol?
09:54Leafw(definterface doesn't have any doc string)
09:56chousersure. I can certainly see that remove-n could be useful in some apps, but in my mind there's always a tension between getting everything that might be useful into core (or even contrib) and keeping those as small and general as possible.
09:56danleichouser: in general, I'm not against your proposal (remove/filter taking multiple seqs)
09:57chouserdanlei: well, that's good. But I think rhickey is. :-)
09:57chouserI believe I've mentioned it before and was rejected.
09:57Leafwhe, I second that chouser. An extremely horizontal API makes it hard to internalize, more even for a beginner.
09:57danleichouser: I guess that most of the time it would be used for doing (remove n ...) ;)
09:57chouserdanlei: :-P
10:00danleichouser: btw, do you have admin rights in clojure-dev? I applied for it, but haven't been accepted till now (has been a while)
10:00chouserdanlei: nope, sorry.
10:00danleichouser: ok
10:02AWizzArdNice, finally the #() in ` is fixed.
10:14danleiIs there going to be a #: reader macro for types?
10:15AWizzArddanlei: to read deftypes back in?
10:16danleiAWizzArd: yes
10:16AWizzArdThe question is how we would read them back in with the corresponding deftype declaration missing.
10:16danleimissing -> errror
10:17danlei(my first intuition, not properly reflected)
10:21danleisorry, got disconnected again
10:23rhickeychouser: sorry, got called away. What does it mean for a filter to take multiple seqs? What's getting fitlered?
10:23rhickeyfiltered
10:23chouserrhickey: would just items from the first seq. the others would be passed to the predicate though, as in map
10:23rhickeymeh
10:23chousers/just/just return/
10:24chouserI think your response was stronger in the negative last time, so perhaps I'm making progress. :-)
10:24chouserbut it would avoid this kinds of wrap-in-a-vector/mapcat dance
10:24AWizzArdFunnily I missed such a filter fn some days ago.
10:25rhickeyso, given a fast zip, don't you really want filter-key?
10:25AWizzArdwell, zip would also be good
10:25rhickeyor something that split out predicate and return
10:25AWizzArdWith zip in place such a multi filter wouldn't be required
10:27AWizzArdin c.l.l some days ago someone wanted to keep those elements from the first coll where at the same position in the second coll it says true: (filter (fn [a b] b) [10 20 30 40] [true false true true])
10:28AWizzArdor even better: (filter #(second %) (zip [10 20 30 40] [true true false true]))
10:28AWizzArd(filter second (zip coll1 coll2))
10:28rhickey#(second %) == second
10:28AWizzArdyes :)
10:30chouser(for [[x i] (zip s (counting p s)) :when (and (< i n) (p i))] x)
10:30chouserthis is what you mean by a "fast zip"?
10:30danleiAWizzArd: using series: (choose #z(t nil t) #z(1 2 3)) => #z(1 3)
10:30AWizzArdin Haskell probably a fold on a zip
10:32rhickeychouser: one absolutely minimizing the expense of the tuple and any other overheads
10:32AWizzArdI don't find choose orthogonal enough to filter+zip, but that's just my opinion.
10:33rhickey'counting' seems weird also
10:33chouser:-(
10:34rhickeythe recursive direct lazy-seq definition is pretty clean
10:34AWizzArdWould this zip take exactly two colls or optionally more?
10:40AWizzArdbtw, my filter above should have been a reduce of course
10:43LauJensenHey guys
10:44rhickeychouser: is that right? (for [[x i] (zip s (counting p s)) :when (and (< i n) (p i))] x)
10:49bsteuberwhat's the most idiomatic way to represent a 2d array?
10:50bsteuberAn array of arrays? A flat array? A specific construct?
10:50AWizzArd(make-array String 10 5)
10:51AWizzArd2d arrays can idiomatically represent 2d arrays.
10:51rhickeychouser: (take 10 (counting even? (range 10))) == (0 1 1 2 2 3 3 4 4 5) ?
10:51chouserrhickey: *sigh* no, because :when is not remove
10:51chouseryeah
10:51Chousukeignoring the fact taht arrays are not really idiomatic in clojure :P
10:51Chousukesometimes you do need them, though.
10:52Leafwbsteuber: if you need very large arrays, be careful: each subarray is an Object, and can quickly blow up memory usage. For a 2D array to represent an image or a matrix, use the old trick of a one dimensional array with a 'width' to operate on its 'lines'.
10:52bsteuberwell, I just want to represent a Go board
10:53Leafwthat is small. Anything goes then.
10:53AWizzArdMaybe a simple vector is okay then?
10:53chouser(defn remove-n [n p s] (for [[x i] (map vector s (counting p s)) :when (or (>= i n) (not (p x)))] x))
10:53chouser(defn counting [p s] (seq/reductions #(if (p %2) (inc %1) %1) 0 s))
10:53Chousukebsteuber: use vectors, then. arrays will just bring trouble for you :)
10:54rhickeychouser: I don't think it is supported by your argument for more generality
10:54bsteuberyeah, I guess I meant vectors, not array - have to be more precise with my language
10:55rhickeychouser: i.e. the role of the two seqs is hardwired
10:58chouseryeah, I can see that zip in for feels better than multi-seq filter/remove.
10:59AWizzArdyes
11:00chouserif when-not is an acceptible function, is :when-not an acceptible option for for/doseq?
11:00rhickeynot today
11:00rhickey:)
11:01chouser(defn remove-n [n p s] (for [[x i] (zip s (counting p s)) :when (not (and (< i n) (p x)))] x))
11:01rhickeychouser: but this remove-n still is. So this counting thingy generator keeps running long after its utility is over
11:01rhickeyas does zip
11:02rhickeywhereas the recursive definition of remove-n drops the recursion as soon as possible and returns the tail
11:02chouserah
11:03rhickey(if (pos? n)
11:03rhickey (if (pred (first s))
11:03rhickey (removex (dec n) pred (rest s))
11:03rhickey (cons f (removex n pred (rest s))))
11:03rhickey s)
11:03rhickeythat's what I don't like about counting and its ilk
11:04AWizzArdrhickey sees such things on the first glimpse, fascinating :)
11:07powr-tocDoes anyone know how to read a clob out of a database using c.c.sql, and with-query-results? I get a SQLException even when forcing the seq inside with-query-results: "You cannot invoke other java.sql.Clob/java.sql.Blob methods after calling the free() method or after the Blob/Clob's transaction has been committed or rolled back."
11:11duncanmmorning rhickey
11:11rhickeyduncanm: hi
11:13rhickeyalso recursive version calls pred only once per item
11:15AWizzArdpowr-toc: you can do a doall inside the with-query-results on the results
11:15rhickeybut does hardwire counting those dropped, vs say, those kept
11:15powr-tocAWizzArd: it doesn't work, as I get the exception above
11:16powr-tocI have this inside with-query-results: (doall (map (fn [r] (slurp* (. (:clobdata r) getAsciiStream))) rs))
11:18bsteuberIs it actually possible to directly download something from clojars over http or do people need to use leiningen etc.?
11:20bsteuberI'd like to give users a download-url for my jar
11:21pjstadigAFAIK, lein uses maven which uses http, so should be possible
11:21pjstadighttp://clojars.org/repo/
11:21pjstadigas a starting point
11:22bsteubernice, thank you
11:23bsteuberactually this is a nice way of browsing clojars projects
11:24rhickeyit would be nice if the clojars site had a directory page with at least one-line descriptions of the jars there, vs this file listing
11:32cemerickrhickey: it's just a maven repo -- that kind of directory info is sorta orthogonal to that.
11:33cemerickNexus or nexus pro might allow one to search across project descriptions....
11:34cemerickoutside of that, it wouldn't be particularly difficult to use the maven APIs to pull together a page/site like you're describing.
11:35danlarkinI think _ato's got something in the works
11:35danlarkindon't know what's become of it though
11:47brandonwspeaking of ato, has anyone used ato's nailgun .jar on clojars? i think it is version 0.7.1
11:47brandonwit doesn't work for me-- gives me an error about the POM not being 4.0.0 compliant
11:48Raynesbrandonw: It still grabs it.
11:48RaynesAFAIK
11:57brandonwRaynes: it is only a warning, and i googled it and people said nothing went wrong even though they got the error
11:57brandonwhowever, when i do `lein nailgun` it shows an error, and `lein help` doesn't display nailgun as a task
11:58bsteuberis there any difference between [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] and [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"] ? the former seems newer
11:59danlarkinstuart removed the "-master" part from the pom in early February
12:00danlarkinnot sure why
12:00bsteuberall this master/new/nothing inconsistency is a bit annoying
12:00RaynesLate January, actually.
12:00Raynesbsteuber: I agree.
12:01RaynesThe build breakage which means no new contrib snapshots in the last month is annoying as well. Especially after the name changes.
12:02bsteuberI wasn't aware of that - so you currently can't compile contrib?
12:27cemerickbsteuber, Raynes: you should fundamentally not be depending upon any SNAPSHOT version, unless you're accepting of breakage. That's essentially definitional.
12:29stuartsierraClojure-contrib builds fine.
12:29stuartsierraThere are some errors reported by test, something JMX related.
12:37bsteubercemerick: I know, but for a toy project, I'm willing to deal with breakage for new features :)
12:47AWizzArdcemerick: at least cells show up now, and rhickey depends on defprotocol and deftype. So it is a sign that those things get more stable :)
12:50cemerickAWizzArd: yeah, my only point is that things can change at any time. Protocols et al. could get pushed out to 1.3 on a whim. If one needs to depend on things in a non-release version, it's best to clone the git repo, and use a built artifact pulled from your own maven repo -- or, at the very least, fix your snapshot versions to a specific snapshot timestamp so you're not following HEAD on every zig and zag.
12:51AWizzArdyes, a little bit care on the end-user site makes sense for non-toy projects
12:52bsteuberhuh, I just tried to install clojure-test-mode via ELPA, but I get an error about swank-clojure.el already existing
12:53bsteuberof course it exists :)
12:53bsteuberso do I really need to delete it first?
12:57bsteuberhm, this worked, but in general ELPA seems quite unreliable to me
13:30derefedI'm following this tutorial to set up clojure with emacs: http://riddell.us/tutorial/slime_swank/slime_swank.html and I'm running into a problem in the Configure Emacs section
13:31derefedemacs can't find swank-clojure-autoload
13:31derefedI can't find it in any of the subdirectories of what I installed either
13:32derefedalso, on the add-to-list line just after ;; swank-clojure, that path doesn't exist
13:33derefedhave these been changed to something else?
13:34dnolenderefed: save yourself some time, setup Clojure via ELPA
13:34derefedwhat's ELPA?
13:34dnolenif you go the ELPA route it's easy to use your own builds of Clojure via symlinks.
13:35dnolenEmacs Lisp Package Archive
13:36dnolenderefed: if you already have Emacs installed this will walk you through the steps, http://www.formconstant.net/diagrams/?p=54
13:36dnolenjust ignore the part about Aquamacs
13:36derefedexcellent... thanks, dnolen!
13:37dnolenderefed: no problem. Clojure will be installed in a folder in your home directory called .swank-clojure, you can symlink your own jars there.
13:38dnolenderefed: oh yeah, where it says Option key, I of course mean Meta key.
13:43eyerisI am reading the implementation of clojure.core.pmap. Could someone tell me why the initial call to step drops the first n rets? http://github.com/richhickey/clojure/blob/49a7d6b8e14050a45df5332e768ba6647752215d/src/clj/clojure/core.clj#L4714
13:54rhickeyeyeris: that second copy of the sequence is used to bound the walk
13:57eyerisOh, I see now.
13:57eyerisWhat it's returning is still based on rets, from the first argument.
13:57eyerisThanks.
14:07stuartsierraI've been thinking about primitive types.
14:08rhickeystuartsierra: and?
14:08stuartsierraAnd why they conflict with the Object arg interfaces in IFn.
14:09stuartsierraWhat if functions that take primitive args were compiled with two different "invoke" methods?
14:09stuartsierraOne that matches the IFn interface declarations, i.e. all args are Objects.
14:09stuartsierraOne with the primitive argument types, called "invokePrimitive" or something.
14:10stuartsierraWhen the compiler knows it's dealing with primitives, it can call the primitive version; otherwise, it falls back on the boxed Object version.
14:10rhickeystuartsierra: I have worked on this a good deal. As you think it through you'll find the real problems are with return types
14:10stuartsierraOh I'm sure there are legions of problems I haven't thought of. :)
14:11ankouhi, I have a data structure for which another print-method is defined. Is there a function to print the structure itself?
14:12hiredmanankou: change the type of the structure
14:12stuartsierrarhickey: Is calling Java methods that take primitives OK (unboxed) when using loop primitives?
14:13rhickeystuartsierra: sure, that's how fast native math works. it is just calling static methods taking primitives
14:13stuartsierraok
14:14hiredmanI've been thinking about something like #^{:signature [[int int] double]} (some-fn x y)
14:14rhickeyproviding exact match
14:15stuartsierraright
14:16stuartsierrarhickey: And that works because the Java methods have declared return types?
14:18rhickeystuartsierra: yes. The tricky bit for a generic invoke[Primitive] interface is that while it can be overloaded on argtypes, can't be on return types (at least not without breaking Java compatibility)
14:19timcharperis there any chance an "unless" macro will make it into clojure core ?
14:19rhickey,(doc when-not)
14:19clojurebot"([test & body]); Evaluates test. If logical false, evaluates body in an implicit do."
14:19stuartsierrarhickey: Yes. I was thinking invokePrimitive would not be declared in any interface, just a public method of an individual Fn class.
14:20timcharperawesome! thanks, rhickey
14:20timcharper(for clojure too)
14:20fogustimcharper: (defmacro unless [& args] `(when-not ~@args)) ;-)
14:20timcharperthanks fogus - since when-not is already there, I'll just use that
14:21timcharpercoming from ruby-land, was expecting unless, but willing to adopt when-not instead
14:21fogusThe term unless always confused me.
14:22fogusI guess when-not is more clear to my mind
14:22rhickeystuartsierra: hrm, you need to set your sights higher, else higher-order use of such fns won't be primitive-enabled
14:22stuartsierraoh, forgot about that
14:23Raynescemerick: If I want to use deftype and defprotocol, I don't really have a choice. I'm perfectly fine with dealing with breakage.
14:24RaynesI don't do nothing in which breakage would really cause much of a problem.
14:28stuartsierraWhat if the invoke method called the invokePrimitive method, with appropriate coercions? Could the JVM inline that?
14:29rhickeystuartsierra: in my design whichever version you supplied would get called by the ones you didn't, but no, the JVM wouldn't necessarily get rid of the Objects passed via ordinary invoke, at this time.
14:30stuartsierraAh. Oh well, it was a nice idea while it lasted ... :)
14:31rhickeystuartsierra: I think I'm close on this, but not working on it right now
14:31stuartsierraok, that's fine, just got curious
14:35hiredmanooo
14:57duncanmstuartsierra: what's so cool about the scala command line executables?
15:01hiredmanduncanm: I guess they have them, and they are standard?
15:02stuartsierradunconm, hiredman: yes
15:02stuartsierraThey've just put some more effort into the installation/packaging/setup process.
15:04duncanmoh right - the only standard thing in Clojure is java -cp clojure.jar clojure.main
15:04stuartsierraWe'll get there.
15:04duncanmi wanted to write a REPL with Swing
15:05duncanmi looked into using the Netbeans stuff, and got sucked into all the NB infrastructure
15:05stuartsierraduncanm: it's been done a few times
15:05duncanmstuartsierra: right - i wanted to make a stand-alone REPL thing using the netbeans/clojure work
15:05chouserI think part of our "problem" is we may have more fractured startup states than some others: plain terminal (windows/linux/mac), slime/swank, various IDEs, nailgun, etc...
15:05duncanmthat's probably the nicest setup, since the netbeans deps are part of the JDK now
15:06stuartsierrachouser: Yes. But Scala has some of the same issues. They're just more organized: http://www.scala-lang.org/downloads
15:06chouserhiredman: do you use it regularly?
15:06hiredmanhttp://github.com/hiredman/Repl
15:06hiredmanno
15:07hiredmanI haven't touched it in months
15:07stuartsierra~stuartsierra
15:07clojurebotstuartsierra is volunteering
15:07duncanmhttp://www.scala-lang.org/node/36 -- this is a better listing
15:07chouserstuartsierra: hm, yes, that's all very tidy-looking.
15:08stuartsierraBut hey, we're only on 1.1
15:09duncanmis there a timeline for 1.2?
15:09stuartsierra"when it's ready"
15:11kotarakHopefully it's not "when it's done"...
15:34brandonwanyone up for helping me figure out what is wrong here? -- http://paste.pocoo.org/show/184431/ is my project.clj and http://paste.pocoo.org/show/184430/ is output of lein help
15:35brandonwnailgun doesn't show up as a task for some reason
15:35brandonwi've been told, and found on google, that the warning of the POM not being a valid 4.0 POM shouldn't prevent the nailgun task from working. it doesn't show up for me, though, and i'm not sure why
15:42Raynesbrandonw: You might have to catch technomancy|away when he isn't |away.
15:42brandonwokay. on another note, as a java build-chain newbie, i am actually having trouble with the basic workflow, too.
15:42hiredmanbrandonw: http://clojars.org/org.clojars.ato/nailgun <-- not a nailgun plugin
15:43hiredmanhttp://clojars.org/lein-nailgun <-- a nailgun plugin
15:43brandonwaahhh that would explain it
15:43brandonwyeah that is what i use, but i saw the nailgain from ato and thought it was updated somehow (even though the nailgun client source is a single file that hasn't been modified).
16:03bsteuberis there a function returning both rem and quot like CL had?
16:04dnolenbsteuber: Clojure doesn't have multiple value returns.
16:04bsteuberright - but it could return a vector
16:05bsteuberjust wanted to make sure I didn't overlook anything
16:05hiredmanyou could use binding to simulate it
16:09brandonwif i use `lein new foo` to create a new project, specify the nailgun dep, modify foo/src/foo/core.clj to have a single function with a single println call, call `lein nailgun` to start the ng server, and then start up vim-- i get a FileNotFoundException about locating foo/core.clj on classpath. What could I be doing wrong?
16:10brandonwi haven't changed any of the defaults except to create a function to make sure the repl is working, and to add the nailgun dep in project.clj
16:11bsteuberhiredman: simulate multiple return values? how so?
16:11hiredmanlisppaste8: url?
16:11hiredmandag nabbit
16:11duncanmif i have a map {:a 1 :b 2} and i want to transform it to {:a (f 1) :b (f 2)} - what do i write?
16:12duncanm,(map #(inc (second %)) {:a 1 :b 2})
16:12clojurebot(2 3)
16:13hiredmanhttp://paste.lisp.org/display/95795
16:13hiredmanbsteuber: thats for you
16:14bsteuberhiredman: nice, although using state feels a bit creepy
16:14bsteuberdoes that compose?
16:15duncanm,(map (fn [x] { (first x) (inc (second x)) }) {:a 1 :b 2})
16:15clojurebot({:a 2} {:b 3})
16:15duncanmeek
16:15hiredmanbsteuber: the state is threadlocal
16:16hiredmanbsteuber: is composable
16:16hiredmanyou just have to remember to wrap binding around all the calls
16:18bsteuberic
16:18bsteubergood to have that technique as an option
16:18duncanmbooo
16:19hiredmanthe docs for binding actually explicitly mention that case and don't mention the other cases where binding is used at all
16:19hiredman"Bindings created with binding can be assigned to, which provides a means for a nested context to communicate with code before it on the call stack."
16:19hiredmandoesn't say anything about implicit argument passing
16:20duncanm,(let [m {:a 1 :b 2}] (zipmap (keys m) (map inc (vals m))))
16:20clojurebot{:b 3, :a 2}
16:20duncanmi guess that's one way
16:20hiredman,(doc fmap)
16:20clojurebot"([f s]); Applies function f to each item in the data structure s and returns a structure of the same kind."
16:20hiredman,`fmap
16:20clojurebotclojure.contrib.generic.functor/fmap
16:21hiredman,(fmap inc {:x 1 :y 2})
16:21clojurebot{:x 2, :y 3}
16:21duncanmahh, it's not part of the standard API
16:21duncanmhiredman: thanks!
16:22duncanmhiredman: "each item in the data structure" - how come it doesn't try to (inc :x) ?
16:22hiredmanno idea
16:23ysphmaybe it knows to get values instead of keys? how would you print the source of fmap?
16:24hiredman~def fmap
16:24brandonwinteresting. if i comment out (ns foo.core) in foo/src/foo/core.clj then it works fine
16:25duncanmheh
16:25duncanm(into (empty m) (for [[k v] m] [k (f v)]))
16:25duncanmysph: it specializes for IPersistentMap
16:25brandonwif i leave it in, though, then the nailgun server complains about not being able to find foo/core__init.class or foo/core.clj on classpath
16:25brandonwlein test does work, however...
16:26ysphcool, all the way around
16:26duncanmhiredman: generic.functor - i would never think of looking in there
16:26hiredman*shrug*
16:26duncanmhiredman: i thought functors have to do with modules and what not (like in ML)
16:27hiredmanhttp://en.wikipedia.org/wiki/Functor
16:28duncanmbasically the default map ought to be like fmap
16:28hiredmanthen map could not be lazy
16:28hiredmanor as lazy as it is
16:28hiredman:/
16:28duncanmhmm
16:29stuartsierraYou can also write (zipmap (keys m) (map f (vals m)))
16:29duncanmstuartsierra: that's what i did
16:29duncanm16:20 <duncanm> ,(let [m {:a 1 :b 2}] (zipmap (keys m) (map inc (vals m))))
16:30stuartsierraOr, my favorite, (reduce (fn [m [k v]] (assoc m k (f v))) {} the-map)
16:30hiredman(comp (partial apply zipmap) (juxt keys (comp (partial map f) vals))
16:30duncanmshow-offs
16:30stuartsierra:)
16:30hiredmanI wonder if that works
16:31hiredmanit doesn't
16:31hiredmanbecause of the f
16:31kotarakAnd then hiredman pulls off his mask and Sean jumps out.
16:31duncanmhiredman can type out point-free style code directly
16:31duncanmi just haven't learned how to do that
16:31opqdonutwhat's juxt?
16:32hiredmanjuxt is awesome
16:32duncanm,(doc juxt)
16:32clojurebot"([f] [f g] [f g h] [f g h & fs]); Alpha - name subject to change. Takes a set of functions and returns a fn that is the juxtaposition of those fns. The returned fn takes a variable number of args, and returns a vector containing the result of applying each fn to the args (left-to-right). ((juxt a b c) x) => [(a x) (b x) (c x)]"
16:32kotarak,((juxt :a :b) {:a 1 :b 2})
16:32clojurebot[1 2]
16:32duncanmcrazy stuff
16:32opqdonutah
16:32kotarak,((juxt inc dec) 1)
16:32clojurebot[2 0]
16:33opqdonutso kinda like ()comp map (flip apply x)
16:33opqdonutgah!
16:33opqdonutso kinda like (comp (partial map (flip apply x)) vector)
16:33opqdonutif flip exists :)
16:33stuartsierra,(let [m {:a 1 :b 2 :c 3}] ((apply juxt (keys m)) m))
16:33clojurebot[1 2 3]
16:33stuartsierraThat's a really awkward way to write 'vals'.
16:34kotarakstuartsierra: well, you can choose order, though
16:34stuartsierraTrue.
16:34bsteuber,(map #(% {:a 1 :b 2}) [:a :b])
16:34clojurebot(1 2)
16:35bsteuberthat's what I used to do
16:35opqdonutyeah I tried to write #(% x) more neatly as (flip apply x)
16:35bsteuberbut juxt might be more clear as an idiom
16:36stuartsierrabsteuber: That's essentially what juxt does.
16:36opqdonutbsteuber: indeed
16:36bsteuber,(doc flip)
16:36clojurebot"([x]); takes a function and returns a function that takes arguments in the opposite order"
16:36kotarakopqdonut: where the definition of "neat" is open to discussion
16:36hiredmanflip is a lie
16:36hiredman,`flip
16:36clojurebotsandbox/flip
16:36opqdonutprobably needs a partial in there somewhere
16:36opqdonutone of these days I'll write a macro that partials everything
16:36opqdonutI'm spoiled by haskell
16:37hiredmanorly
16:37duncanmhaha
16:37duncanmO RLY!
16:37brandonwhum. has anyone else had issues with the lein-nailgun plugin not setting the classpath correctly?
16:37chouserif a reify doesn't close over anything, only one instance of it would ever have to be made, right?
16:38brandonwif i manually start it with the correct classpath, it works fine. `lein nailgun` doesn't set the classpath correctly, though...
16:38chouserI guess this is pretty rare
16:38rhickeychouser: theoretically, yes, actually, not yet
16:38chouserooh, I like "yet" :-)
16:39rhickeyyet == after ccinc
16:39chouserhuh. ok.
16:39hiredman,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle))))
16:39clojurebot((10 100 90 40 80 20 70 60 30 50) (100 40 70 10 60 90 20 80 30 50) (30 90 10 20 40 100 50 60 80 70))
16:39rhickeyI can't bear too many more enhancements in Javaland
16:39opqdonutccinc?
16:40kotarakclojure compiler in clojure
16:40opqdonuthiredman: yeah, I'm aware of pl
16:40opqdonutah, yes
16:40duncanmccinc?
16:40chouseryou keep saying that and then keep doing things like fn metadata
16:40duncanmoh oh
16:40duncanmi'm slow
16:41duncanmwhat's PL?
16:41duncanm,(doc pl)
16:41clojurebot"([& forms]); replaces a $ b with (a b) walking right to left replaces a · b with (comp a b) left to right ⌽a with (uncurry a) left to right ↕a with (flip a) left to right"
16:41rhickeychouser: true, must stop that
16:41bsteuber,`pl
16:41clojurebotsandbox/pl
16:42bsteubercrazy
16:42duncanmit's like writing Haskell in Clojure
16:42opqdonutno it's not :)
16:42chouserdynamic haskell
16:42opqdonutdynamic strict haskell without types
16:42hiredmannah, haskell is much more concise about it
16:42opqdonutindeed
16:42opqdonutso, more like eager lambda calculus
16:43hiredman,(pl (λx (inc x) 1))
16:43bsteuberby the way, was there any sort of conclusion about this "-> ->> enhancement" debate?
16:43clojurebot2
16:44duncanmi like -> so much, i stopped using ..
16:44hiredmansure, who uses ..?
16:44bsteuberI'd love to do something like (-> x (/ 3) (- 2 _))
16:45duncanmit took me a while to discover ->
16:45hiredman,(-> 1 (/ 3) (->> (- 2)))
16:45clojurebot5/3
16:46bsteuberhiredman: nice, but it won't work the other way round, would it?
16:46bsteuberbut I have to remember at least using ->> inside ->
16:46stuartsierra-> is slightly evil
16:46bsteuberstuartsierra: I agree
16:47duncanmwhy is that?
16:47duncanmi haven't been following the debate
16:47kotarakbsteuber: It's even more crazy: (doto (JFrame.) (-> .getContentPane do-stuff))
16:47chousercgrand has a patch to allow arbitrary switching back and forth between -> and ->>
16:47stuartsierraThat's definitely evil.
16:48rhickeychouser: not sure I like that at all
16:48chouseryeah
16:48hiredmanI've done that
16:48duncanmkotarak: why write that and not (-> (JFrame.) .getContentPane do-stuff) ?
16:48duncanmoh wait
16:48duncanmoh, i get it
16:48rhickeybut I quite like -> and ->>
16:49duncanmkotarak: hmm.... i see now, tricky
16:49bsteuberafter seeing the proposal using _ I tried to implement some deep replacement of _ while macroexpanding inner stuff first
16:49bsteuberthat was evil :)
16:49kotarakduncanm: imagine some more (.setTitle ) and such things
16:50stuartsierraI like -> and ->> too, I just think they tempt people to try to avoid 'let' altogether.
16:50hiredmanI still haven't gotten into the habit of using ->>
16:50stuartsierraLeading to monstrosities like -..$?>>
16:51chouser,(->> 3 (- a) (/ 4) (let [a 7]))
16:51clojurebot1
16:51duncanmi haven't learned how ->> macroexpands
16:51hiredmanchouser: cute
16:51chouserthat is absolutely abusive.
16:52rhickeystuartsierra: yeah, well, that's a problem, knowing when to stop
16:52stuartsierraProgrammers never know when to stop.
16:52chouserI get such abuse out of my system here so I'm less tempted to do it in real code.
16:53bsteuberso the general opinion is sth like "anything beyond -> and ->> is way too evil"?
16:53duncanmdid the other lisps come up with syntactic florishes like this? i don't think i ever saw them working with Scheme, and I don't know about CL
16:53chouser,(-> [x (range 5)] (for (+ x 3)))
16:53clojurebot(3 4 5 6 7)
16:53rhickeybsteuber: I haven't been persuaded by any further 'enhancements' so far
16:54stuartsierraduncanm: Arc has syntactic sugar for composition, but the point-free style seems to be unique to Clojure.
16:54kotarakchouser: This smells terrible about "#define FOO 5;"...
16:54chouserkotarak: yes, roughly the same level of abuse I think.
16:55stuartsierraI'll admit I was briefly tempted by -> with a placeholder, but at that point you might as well write 'let'.
16:55chouser#define begin { // look, it's pascal!
16:55tomswI'm trying to create an Eclipse plugin that will add Clojure as a scripting shell, but I can't get past a classpath error: "java.io.FileNotFoundException: Could not locate clojure/core__init.class or clojure/core.clj on classpath"
16:56hiredmanhttp://github.com/hiredman/clojurebot/blob/master/src/hiredman/clojurebot/factoids.clj#L166 horrid
16:57tomswif it can load the RT class why can't it load core__init, which is in the same jar?
16:59bsteuberstuartsierra: but by let you cross the bridge away from point-free-land :)
17:00bsteuberok you can do (let [_ ..
17:02stuartsierraThat's the point. point-free only takes you so far, at some point it impedes readability.
17:02kotarak... where it turns into point-less.
17:02chouserbsteuber: more like you come back home after brief sojourn into the land of point-free
17:03hiredmantomsw: most likely a classloader issue, RT is loaded by a classloader that can find the jar, but then RT maybe tries to load clojure.core and whatever classloader it uses doesn't see the jar
17:03tomswhiredman: that makes sense - but then how do I get RT to use a different classloader?
17:04bsteuber,(-> 1 (/ 3) #(- 5 %))
17:04clojurebotjava.lang.ClassCastException: clojure.lang.Symbol cannot be cast to clojure.lang.IPersistentVector
17:04chouserso it's ok to AOT compile code that includes raw fns as long as thost fns aren't closures?
17:04bsteuberoh, I expected that to work
17:04bsteubertoo bad
17:05hiredmantomsw: very painfully
17:05hiredmanbsteuber: you need double parens
17:05kotarakbsteuber: (-> 1 (/ 3) (#(- 5 %)))
17:06bsteuberoh, because #( is a reader macro, true
17:06hiredmanchouser: why wouldn't it be fine if they are closures?
17:07bsteuberok so I'll use that if feel like staying in point-free-land for a little longer :)
17:07chouserI think I'm explaining what I mean poorly.
17:08tomswhiredman: painfully as in hacking RT.java, or not quite so bad?
17:08rhickeychouser: I think definline does
17:08kotarakbsteuber: #(+ 5 %) is not really point-free, no?
17:09bsteuberkotarak: you got me :)
17:09chouserah, good -- the error shows up with eval too.
17:09chouser,(let [a 1] (eval `(~(fn [b] (+ a b)) 2)))
17:09clojurebotDENIED
17:09chouserbleh.
17:09chouseranyway, that fails. but this works:
17:09chouser,(let [a 1] (eval `(~(fn [b] (+ 1 b)) 2)))
17:09clojurebotDENIED
17:09hiredmantomsw: I think hacking RT.java
17:09kotarakbsteuber: I wouldn't worry to much about point-free. Just wastes time.
17:10chouserrhickey: ok, I see that. thanks.
17:12bsteuberok, so I think I learnt from that discussion that I should invest more time in really mastering what clojure currently gives me instead of thinking too hard about improving it
17:13bsteuberwell, maybe that's a bad way to say it
17:13bsteuberanyways, thanks :)
17:23tomswhiredman: think I might have figured it out, I need to change the current thread's classloader when I try and startup clojure
17:24hiredmanthat makes sense, baseloader does fall back to that
17:27tomswhiredman: wayhey! It's working. I'm off to bed. Thanks
17:52defnwow. twitter at 50mil tweets a day. that's 2x as many as there were 4mos ago.
18:28timcharperwhy does range use chunk-buffer? Is it an optimization?
18:28timcharperI'm implementing a function that returns an infinite sequence for use in a for loop.
18:28hiredmanclojurebot: seq-1
18:28clojurebotmake a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive
18:29kotarakfor is not a loop
18:29hiredmanclojurebot: worthless git
18:29clojurebotgitorious mirror is http://gitorious.org/clojure/clojure
18:29kotarakclojurebot: for
18:29clojurebotfor is not used often enough.
18:29timcharperkotarak: what do you mean? how is it not a for ?
18:30timcharperhow is for not a loop ?
18:30kotaraktimcharper: for is a list comprehension and not a loop. doseq is a loop.
18:30danleiit's a list comprehension
18:30kotaraktimcharper: for returns a lazy sequence
18:31timcharperok, fair enough (was aware of both aspects, but as far as I'm concerned it's implementing a loop-like pattern)
18:32AWizzArdtimcharper: under the hood for is a loop. Conceptually it is something higher level.
18:32hiredmanAWizzArd: not really
18:32danleibut if you think "for=loop" you'll get surprised if you use side-effects inside it
18:33hiredmanit's not a loop at any level
18:33danlei(but there's dorun to the rescue)
18:33AWizzArdhiredman: so no jmp command in assembler?
18:33hiredmanAWizzArd: I doubt it
18:33hiredmanit expands to a call to lazy-seq
18:33hiredman:P
18:34AWizzArdDoes not work, Wizards always come back.
18:34hiredmanyes, but do WizzArds?
18:35mabesquick poll.. who here is using 1.2 on a production app? I'd like to start using 1.2 (for deftype) so I've trying to weigh the risks of being on the edge so much..
18:35AWizzArdmabes: I do
18:36mabesAWizzArd: are you using Leinigen and just grab the most recent snapshot whenever that might be pushed out?
18:36AWizzArdI don't use Leiningen yet, but it is likely that I will look at it in the coming weeks/months.
18:37AWizzArdmabes: I update from http://build.clojure.org/
18:43timcharperkotarak: FYI: http://clojure.org/macros - "for" is listed under "Looping". Is there a commonly accepted standard of what constitutes a "loop" in computer science?
18:45timcharper(trying to understand your position on how for is NOT performing a what fundamentally appears to be a loop operation)
18:45chouserit's not an imperative loop like 'for' in C or Java
18:46chouserit's a factory for lazy seqs
18:46timcharperchouser: how would you define a loop ?
18:48AWizzArda block of code that contains a jump back to its starting point
18:52bsteuberwhat's the difference between = and == ?
18:53AWizzArdthere is a ==?
18:53AWizzArd,(doc ==)
18:53clojurebot"([x] [x y] [x y & more]); Returns non-nil if nums all have the same value, otherwise false"
18:56AWizzArd,(== "a" "a")
18:56clojurebotfalse
18:56AWizzArdfalse is non-nil, so the both nums have the same value :)
18:57timcharperAWizzArd: ok, that sounds reasonable. So would you say loop / recur in clojure implement a loop?
18:58AWizzArdyes
18:58danlei`if you consider that tail-recursion IS iteration in e.g. scheme: yes
18:58bsteuberso == is like = for numbers and like identical? otherwise?
18:58AWizzArdrhickey mentioned some months ago that recur basically is "goto"
18:59timcharperso, if the for macro, under the hood, uses loop and recur, would you classify it as performing a loop like operation ?
18:59bsteuberbut it's a very harmless goto :)
18:59timcharper(in spite of it occurring within the context of a lazy-seq) ?
19:00AWizzArdAs for potentially executes the same block of code multiple times I could imagine that it at some low level point is solved by a looping construct. But this is not so important. I also don't try to imagine about the molecular activities inside the cpu while it runs my programs :)
19:00danleiI think that's the point: one doesn't THINK about for as a loop.
19:01AWizzArdWhen I think about for, I think about list comprehension
19:01AWizzArddanlei: exactly
19:01timcharperbut can you say it isn't a loop?
19:01AWizzArdYes
19:01timcharperwhy ?
19:01AWizzArdWould you say that filter is a loop?
19:01timcharperI agree it exhibits more properties than a simple loop
19:01AWizzArdor map?
19:02timcharperyes, I would say both filter, map, and reduce implement a loop
19:02danleiimplement a != is
19:02AWizzArdOkay, then you should see "for" also as a looping construct.
19:02danleiyou wouldn't say a house is a stone, would you?
19:02timcharperno, but I would say a mansion is a house
19:02AWizzArdBut then you could as well go some levels deeper and not see it as loops, but some patterns of electrons :)
19:03timcharperhahah, there is only 1's and 0's, in the end.
19:03AWizzArdI think even that is already a simplification
19:03AWizzArdProbably there are no 1's and 0's, but instead some electrical charges
19:03danlei but do you think in 1s and 0s?
19:04timcharperhahah
19:04timcharperdanlei: there are 10 types of people that think in 1s and 0s
19:04danlei;)
19:04timcharperthose that do, and those that don't
19:04danleiold one ;)
19:04bsteuberoh yeah - and 3 types of mathematicians
19:04bsteuberhave we reached that level yet?
19:05AWizzArdtimcharper: (for ..) is a construct that can do map / filter
19:06timcharperAWizzArd: yes, it's very awesome
19:06timcharperI'm a big fan of clojure's for
19:06AWizzArdit lacks the powers of (reduce ...), which is the most general one (map and filter are special cases of reduce).
19:06danleitimcharper: you could approach it philosophically: the whole is more than the sum of its parts. for might be done using loops or whatever, but it's something different.
19:08timcharperI see your point of view. Thanks for taking time to explain it to me
19:08danlei(or maybe linguistically and say that loops are a meronyme of for, but thats problematic)
19:42timcharperis there a simple debugger tool that fires up a repl in the middle of a running clojure program ?
19:43danleiif I have (defprotocol P (a [x]) (b [x])), and (extend-class Object P (a [x] :foo) (b [x] :bar)), is it possible, given (extend-class Number P (a [x] :bar)), to have (b 1) return :bar?
19:43danleitimcharper: I'd use swank, but you can also use a repl-on-a-socket using server-socket in contrib
19:44danlei(which may not be what you asked for)
19:44timcharperNice! I didn't know you could fire one up like that.
19:45timcharperalready using emacs, so this looks like a slam dunk
19:45timcharper(swank/start-repl)
19:47timcharperhmm, it appears that swank fires it up in a different thread, instead of halting the current thread so I can inspect it. is that how it works for you ?
19:47timcharper(danlei)
19:47danleiyes
19:48danleiit depends on what you want to do exactly, for my needs, swank is ok
19:48arohnertimcharper: http://georgejahad.com/clojure/debug-repl.html
19:48timcharpertrying to debug some code
19:48timcharperbeen using (prn)... but that gets tedious
19:50timcharperarohner: thanks, I'll give that a try.
19:58danleilooks interesting, a small step towards some things CL debuggers provide. bummer it doesn't work in slime
19:59danlei(but mostly, I'm get along well with (print ...))
19:59danlei*getting
20:01danleito put my former defprotocol question differently: is it possible to make Type2 use Type1's implementation of a protocol funcion, if C2 isa? C1, and C2 implemented another function of that protocol (but not the whole protocol)
20:02danleiC1/2 -> Type1/2
20:03hiredmandanlei: no, protocols don't inherit
20:03hiredmanyou can mix and match maps of cuntions
20:03hiredmanfunctions
20:04danleiok
20:04hugodis there a better way than this of capturing the source line number? http://gist.github.com/319010
20:05danleibut I'll have to do it by hand? I'm asking, since if Type2 doesn't implement some protocol functions, it's enough to implement them in Type1, but that won't work anymore if I implement a part of P
20:05hiredmandanlei: what you are asking for is some form of inheritence, which protocols don't provide
20:05tomojshould I use fnparse for high-permormance parsing of a simple language?
20:05tomojor just do it raw
20:05danleihiredman: ok, thanks!
20:06hiredmanis fnparse high performance?
20:10tomojhiredman: I dunno :(
20:11arohnertomoj: IIRC, parsec (parser combinator lib for haskell) is slower than doing it by hand
20:11arohnerof course, fnparse / parsec is probably faster to code
20:12tomojthanks
20:12arohnerhow fast do you need this to be?
20:13tomojthat is unclear
20:13tomojbut, learning fnparse would have significant overhead, I think
20:13tomojlast time I looked at it I couldn't make any sense of it
20:17hiredmanhuh
20:17hiredmanclojurebot: logs?
20:17clojurebotlogs is http://clojure-log.n01se.net/
20:20hiredman,((fp/semantics (fp/rep+ (fp/lit \x)) (comp symbol (partial apply str))){:remainder (seq "xxxyxxx")})
20:20clojurebot[xxx {:remainder (\y \x \x \x)}]
20:34tomojI find myself wanting haskell.. I'm considering making a protocol for this language, and then using extend to give clojure and java types implementations
20:35tomojbut I would want to be able to give implementations of a read-bson method which has a polymorphic return value and dispatches on the return type
20:35tomojand I can't imagine any way to do that in clojure
20:36tomojI had a similar problem earlier and the solution I opted for was a protocol with the methods that are called on instances of implementing types, and a separate multimethod which accepts a symbol arg for the return type
20:37tomojimplementers then have to provide an implementation of the protocol and a corresponding method
20:37tomojfor the multimethod, I mean
20:37tomojdoes this sound sane?
20:38chousernot bad. specifying the desired return type is common in clojure
20:38chousermaking that an open set by using a multimethod seems natural
20:40hiredmanreally, dispatching on return type seems weird
20:40tomojhmm, maybe I want multiprotocols?
20:40hiredmanstuartsierra had a macro for double dispatch protocols
20:41hiredmanwhat would multiprotocols be?
20:42tomojbottom of http://www.assembla.com/wiki/show/clojure/Protocols
20:43tomojI dunno
20:43tomojI guess I still couldn't really dispatch on the return value type
20:44tomojwithout creating a dummy object just to call the function
20:45tomojhmm
20:46hiredmanso you mean dispatching on the return value of another function?
20:46tomojI mean, say I have a JSON protocol
20:46tomojI'd want it to have read and write functions
20:47tomojthe problem is how to allow implementers of the protocol to make their type readable
20:48tomojwhere read is a function that takes a string or some bytes and returns a clojure/java type
20:48hiredmanhmm
20:48tomojer, a value of a clojure/java type
20:48hiredmanright
20:49tomojin haskell you could dispatch on the return type, and instances can define the read method even though it doesn't take a value of their type as the first argument
20:49hiredmandispatching on return type just seems so odd
20:49tomojyeah, but it's awesome in haskell
20:50tomojprobably not so awesome in clojure's dynamic world
20:50tomojbut how else to do it?
20:57hiredmandispatching on the return value works by propagating type information backwards then? it sees what type you are using the return value as?
20:57tomojyeah
20:57hiredmanwild
20:59tomojso e.g. minBound is a 0-ary function which is polymorphic in return type. minBound :: Int is -2147483648, minBound :: Bool is False
20:59tomojif you try to use minBound as a boolean it dispatches on that type and gives you False
20:59tomojin clojure, I was planning to just pass the return type as an argument to the function
21:01tomojif I implement the protocol on Class and have a function that takes a class as the first arg and a string/bytes as the second...
21:01tomoj:)
21:01tomojthat sounds evil
21:02hiredmanhmmm
21:02tomojhmm, that won't even help
21:02hiredmanit sure won't
21:03tomojguess i want to be able to implement a protocol on a singleton object
21:03tomojmonkey-patch it in
21:07atrerusdoes anyone have an example of referencing a maven repository from lein's project.clj?
21:08tomojatrerus: :repositories {"apache-snapshots" "http://people.apache.org/maven-snapshot-repository/&quot;}
21:10atrerusand when you reference the dependency would you use org.apache.people/class-youre-referencing ?
21:11tomojno, I'd use the group and artifact id for whatever I wanted
21:11atrerusok... I'm totally unfamiliar with Maven repos
21:12tomoje.g. [org.apache.solr/solr-core "1.5-SNAPSHOT"]
21:12tomojthe repo stores artifacts, each artifact has a groupid and an artifactid
21:12tomojin leiningen you put [groupid/artifactid "version"]
21:13atrerusok
21:13tomojif you're browsing a maven repo with your browser, the directory path is the groupid, with the last directory before the version numbers being the artifactid
21:14atrerusAH!
21:14atrerusthat's what I was looking for
21:14tomoje.g. [org.apache.solr/solr-core "1.5-SNAPSHOT"] is at /org/apache/solr/solr-core/1.5-SNAPSHOT/ in the repo above
21:14atrerusso this guy for instance: http://mvnrepository.com/artifact/hsqldb/hsqldb
21:14tomojyeah, [hsqldb/hsqldb "1.7.2"] or something
21:15atrerusright, makes sense
21:15tomojI think that's in the central maven repo
21:15tomojso you won't need to add a :repositories, probably
21:15atrerusok
21:15atrerusif I did need to would it just be http://mvnrepository.com ?
21:16tomojdoubtful
21:16tomojI think that's just a search engine
21:16atrerusis there a trusty way for finding the actual URL I'd need to refer leiningen to?
21:17tomojpretty sure you don't need to refer leiningen to a URL
21:17tomojotherwise you just have to find out for each project where they're pushing the artifacts to
21:17atrerusyeah, I'm just wondering for down the road if I need to refer to a non-standard repo
21:20cljneoHi, newbie question. In ClojureBox 1.1 REPL, the form (use 'clojure.contrib.io) throws FileNotFoundException
21:22brandonwdo you have clojure.contrib set in the classpath when running clojure.main ?
21:22cljneohow can I check?
21:22brandonwhow are you starting the repl?
21:23cljneousing swank. It starts automatically when I start ClojureBosx
21:23brandonwokay i'm not familiar with swank
21:24atrerusI haven't used ClojureBox, but I do use swank
21:25atrerusI found it to be a big pain to manage classpaths myself
21:25atrerusleiningen makes it quite a bit easier
21:26atrerusit will download dependencies for you and add them to your classpath
21:27cljneoI checked the swank-clojure-classpath and the clojure.contrib.jar is in it
21:28RaynesIf new people didn't have problems with swank-clojure and Emacs, this channel probably wouldn't get any attention at all.
21:29Raynes:p
21:29atrerushaha!
21:29atrerusso that's why you guys leave some loose ends hanging ;)
21:31brandonwatrerus: try (use 'clojure.contrib.duck-streams)
21:31cljneoactually the problem is CLASSPATH
21:31brandonwerr cljneo, sorry
21:32cljneoduck-streams worked but I deleted some path from the env varialbe on my machine
21:32cljneobut io still throws exception
21:33dnolengetting a working Clojure setup is something like a right of passage... fortunately it's a lot more rewarding after the initial hurdle. it's still easier than getting a working Common Lisp environment in my experience.
21:33dnolencljneo: duck-streams became io
21:33brandonwif you don't have a duck-streams was renamed to io recently, but if you don't have a .jar from later than feb 1st, you won't get the change
21:33cljneohmmm, so it's picking another jar?
21:33brandonws/if you don't have a/
21:33cljneoI have 1.1
21:33brandonwit will be duck-streams then
21:34dnolen1.1 has duck-streams. I believe io is 1.2 right?
21:34cljneoI see
21:36brandonwmy turn for a question :) -- when defining a macro, what is the difference between `(require '~'com.martiansoftware.nailgun.NGServer) and `(require 'com.martiansoftware.nailgun.NGServer) ?
21:37brandonwto my un-trained eyes, '~' appears to quote an expression, then immediately unquote it
21:38hiredman`~'a
21:38hiredman,`~'a
21:38clojurebota
21:38hiredman,`'~'a
21:38clojurebot(quote a)
21:39brandonw,`(require '~'foo)
21:39clojurebot(clojure.core/require (quote foo))
21:39brandonw,`(require 'foo)
21:39clojurebot(clojure.core/require (quote sandbox/foo))
21:39brandonwahhh
21:39brandonwis that relevant?
21:40brandonwone seems to be in the sandbox namespace, but the other isn't? or is that inconsequential in clojurebot's repl
21:41brandonw`(foo '~'bar) looks the same as `(foo 'bar) except for the sandbox/
21:41brandonw,(macroexpand-1 `(require '~'foo))
21:41clojurebot(clojure.core/require (quote foo))
21:42brandonw,(macroexpand-1 `(require 'foo))
21:42clojurebot(clojure.core/require (quote sandbox/foo))
21:42hiredmanhttp://clojure.org/reader#The%20Reader--Macro%20characters
21:42hiredmansee syntax-quote (`)
21:43brandonwis that referred to as symbol capture?
21:43brandonwresolving the symbol in the current context?
21:44cljneobrandonw: duck-streams works for now. How can I find what functions are available in this ns?
21:44cljneotried ns-aliases but it throws errors
21:44brandonwi still look at the clojure contrib api web page
21:44brandonwprobably a better way, though
21:45cljneothe web page refers to io but I have duck-streams :)
21:45brandonwi don't think the content of the namespace was changed
21:46brandonwthe docs on the contrib.api will still be applicable
21:46cljneosorry. There is a 1.1 branch at the top of the docs page
21:46hiredmanbrandonw: it is not symbol capture
21:54brandonwhiredman: i'm sorry: i can see the difference between `(foo bar) and `(foo ~bar) but i still don't understand the difference of `(foo '~'bar) vs `(foo 'bar)
21:54brandonwwhat is the usage of ' in the scope of `
21:55hiredman,`'bar
21:55clojurebot(quote sandbox/bar)
21:55brandonwand if ~ un-quote's something in a syntax quoted list, wouldn't a
21:55hiredman,`'~'bar
21:55clojurebot(quote bar)
21:55brandonw' directly after it cancel that?
21:56hiredmando you see the difference between (quote sandbox/bar) and (quote bar) ?
21:58brandonw`'bar expands to bar in the current namespace, while `'~' expands to bar in whatever namespace executes the macro?
21:58hiredmansandbox/bar is a namespace qualified symbol, bar is just a symbol
21:59brandonwokay
22:00brandonwwould the application of the latter be in evaluating bar in the scope of whatever namespaces are currently being used when the macro is called?
22:02hiredman,`'~'bar
22:02clojurebot(quote bar)
22:02hiredmanthat will not evaluate to anything besides the symbol bar
22:02hiredmanit's quoted
22:02brandonwwell, i mean when the macro is called
22:02brandonwit would have to evaluate what bar is
22:02hiredmanwhy would it?
22:03brandonwoh wait, right
22:03brandonwwell, if it eventually gets called
22:03brandonwand bar needed to be evaluated
22:04hiredmanbut it doesn't
22:04hiredmanbecause it is quoted
22:04hiredman(well it does, it just self evalutes, because that is what quoting is)
22:04hiredman,(macroexpand-1 '`'~'bar)
22:04clojurebot(clojure.core/seq (clojure.core/concat (clojure.core/list (quote quote)) (clojure.core/list (quote bar))))
22:05brandonwi mean, when the macro is called, it expands into the symbol of foo, which is used in the scope of another function
22:05brandonwwhich tries to evaluate foo
22:05hiredmanbrandonw: but it doesn't expand into a symbol, it expands to a quoted symbol
22:06brandonwohhhkay, something kind of clicked in my head
22:07brandonwokay that makes sense now, because the context of what i am looking at is ns-resolve and it is passing a quoted symbol
22:07brandonwwhich it would never need to evaluate, like you are saying
22:09brandonwokay, i think the rest just clicked, too
22:09brandonwam i right in saying `bar is quoting the symbol bar, which has a namespace, which is why it is returning sandbox/bar
22:10hiredmannope
22:10brandonwnevermind, i don't know what i was thinking. i understand how the end results are different, but i don't quite understand why `'~' and `' do different things
22:10hiredmandid you read the link I posted?
22:10brandonwyes
22:10hiredmanbar does not have a namespace
22:11hiredman"For Symbols, syntax-quote resolves the symbol in the current context, yielding a fully-qualified symbol (i.e. namespace/name or fully.qualified.Classname)."
22:11brandonwit said for symbols, syntax quote resolves the symbol in the current context
22:11brandonwso `foo would definitely be wrong
22:11hiredmanno
22:12hiredmanit is fine
22:12hiredman`foo is just like 'foo, but syntax quote namespace qualifies the symbols
22:12brandonwbut if you use (use 'foo), wouldn't that be different than (use `foo) ?
22:13brandonwsorry, i'm thinking in the scope of ns-resolve still
22:14hiredmanbrandonw: yes
22:15brandonwso if you want to explicitly use the namespace "foo" with any namespace macros, it has to be quoted, not syntax quoted
22:16brandonwis '~' the way of quoting what would become the namespace qualified symbol *before* it gets qualified?
22:17brandonwi'm trying to wrap my head around the order of quoting something, then unquoting, then quoting again, then syntax quoting, and how the result is foo being quoted but nto namespace qualified
22:18hiredmanok
22:18hiredmanhere
22:18hiredman`(foo ~x)
22:18hiredman,`(foo ~x)
22:18clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
22:18brandonwright
22:19brandonwtries to eval x because of unquote
22:19hiredmanlet me start over
22:19hiredman,`(foo x)
22:19clojurebot(sandbox/foo sandbox/x)
22:19hiredmanso that namespace qualifies x, but what if we don't want that
22:20hiredman,`(foo ~x)
22:20clojurebotjava.lang.Exception: Unable to resolve symbol: x in this context
22:20brandonwoh okay, x doesn't exist in the current namespace
22:20hiredmanthat stops it from being namespace qualified, but it makes it resolve, which we don't want, we want it quoted
22:20brandonwright
22:20hiredman,`(foo ~'x)
22:20clojurebot(sandbox/foo x)
22:22hiredmanand what if we want to pass the symbol x to foo?
22:22brandonwohhhh okay. so ~' is the way to get something to not resolve, but the extra quote was purely because it needed to retain the quote because it was being used by a namespace macro which requires a quoted symbol
22:23brandonws/needed to retain the quote because it/
22:23brandonwso the thing that was throwing me for a loop was looking a a namespace sitation at the same time as learning about having something not be namespace qualified
22:28brandonwthanks for all the help hiredman
23:50brandonwwhat is the best way to debug macros involving other macros? can i exclude some macros from expanding? i write out the code i am aiming for, but it has macros already in it (import, for example). i don't want import to expand, i just want the other pieces of the macro to expand
23:52woobybradbeveridge, macroexpand-1 perhaps?
23:53woobywoops, meant brandonw
23:53brandonw(macroexpand-1 `(NGServer/main (into-array String addr-port)))
23:54brandonw,(macroexpand-1 `(NGServer/main (into-array String addr-port)))
23:54clojurebot(NGServer/main (clojure.core/into-array java.lang.String sandbox/addr-port))
23:54hiredmanbrandonw: don't use syntax quote there
23:54brandonwthere already is a syntax quote in an upper level expression
23:55brandonwthere is a `(do expr above this, and everything is inside of it
23:55hiredmanso?
23:55clojurebotparedit source is http://mumble.net/~campbell/emacs/paredit.el
23:55brandonwbasically, what i am trying to do is port http://github.com/technomancy/leiningen/blob/master/lein-swank/src/leiningen/swank.clj over to a lein-nailgun plugin that sets the classpath
23:56brandonwi've got the import working, but the actual call to NGServer/main is giving me trouble
23:57brandonwso unquote the whole (NGServer/main expression?
23:58brandonwor don't use syntax quote, use the regular quote