#clojure logs

2010-09-28

00:06amalloytechnomancy: neat. have you thought about allowing more than one mock setting? then the user could, say, mock out either the URL-fetch module or the disk I/O module to test the other one
00:06amalloyobviously i haven't thought that through for more than a minute or so, but it doesn't sound like a totally crazy idea
00:36technomancyamalloy: that could work, but I think it would be easier to do outside the hook
00:37technomancyyou have to bend over backwards to get stuff to work in a hook since everything has to be serializable; you end up wrapping functions that construct forms rather than just wrapping the actual calls
00:39technomancy(I mean when you hook eval-in-project; it's not bending over backwards to hook normal functions)
00:46TheBusbytechnomancy: sorry to change subjects, but is there any interest in replacing ant for process control with a posix JNI library? I'm looking at potentially open sourcing a library and wonder if it would have any value.
00:50technomancyTheBusby: I think I'd be interested, but I would be very interested if you could help with integrating it.
00:51technomancyant is basically a disaster when it comes to unix process management, but I know nothing about JNI and very little about process management APIs (just enough to recognize when things are broken beyond repair)
00:52technomancyTheBusby: my alternative is to create a custom classloader, which hiredman has been bugging me to do for a while now
00:52TheBusbyIn terms of leiningen I'm certain it would be very helpful, but may have issues with portability on non-posix systems (windows, linux, mac are currently supported)
00:53TheBusbyfrom what I've read, Ant just does the best it can and that the JVM is a disaster in regards to process management...
00:53slyrus_a clojure port to a symbolics lisp machine, for instance?
00:53technomancyI have heard of one guy running it on Solaris, but as far as I'm concerned if it makes it work better on the big 3 it's absolutely worth the sacrifice
00:53technomancyTheBusby: right; that's probably more accurate
00:53TheBusbyno promises yet, I need to get a sign off first; but I wanted to see if you'd be interested before pursuing it.
00:54technomancysounds good
00:54amalloynooooo, technomancy, you can't cut off my precious VAX-11!
00:54slyrus_technomancy: the big three are linux, freebsd and macos?
00:54slyrus_:)
00:55technomancyslyrus_: close enough =)
01:23msf_technomancy: is there any way to get lein to install mutliple binaries when using :shell-wrapper ?
01:30technomancymsf_: not yet; if you'd like to suggest some ideas for how that would work could you start a thread on the leiningen mailing list?
01:31technomancyI didn't want to complicate the API up front; I am just glad people are actually using the feature. =)
01:31technomancybut it's definitely on the table for the next release
01:38amalloywhat's this shell-wrapper feature? it builds a .sh (or .bat?) file that invokes java -jar with the right options?
01:39msftechnomancy: well I'm not sure that I am the right person to suggest how it would work :-)
01:39msfbut I definitely have a need right now to have a bunch of different "binaries" in one project
01:42amalloymsf: is there a reason not to make multiple packages which depend on each other and each have a single binary?
01:42msfyes
01:42msfI suppose I could split everything out into multiple projects
01:43amalloyi mean, granted, that's just working around your build tool, if it's all conceptually one project
01:44msfit's all conceptually one project unfortunately
01:45msfI have a bunch of different components that each could use it's own wrapper
01:45msfa worker daemon, a simple command line client, and eventually a web ui
01:45amalloyand i assume it would also look weird to have one binary that takes options?
01:45amalloy./myproj --mode=1
02:06technomancythere's a separate plugin to make init.d scripts that might be more appropriate for the daemon
02:06technomancyhttp://github.com/zkim/leiningen-init-script
02:10scottjthere's also lein-daemon
02:11amalloyguys those sounds awesome
02:13amalloyby the way, technomancy/ninjudd, how compatible are lein/cake? i know cake supports most of the commands that lein does out of the box, but eg do they use the same plugin framework so that plugins are compatible?
02:14amalloy(as they say on radio shows, i'll take my answer off the air - gonna be afk a bit)
02:14technomancyamalloy: no, leiningen plugins are clojure functions, while cake created its own task mechanism
02:16technomancythere are compatibilities between the two project.clj formats, but they are mostly superficial beyond the dependency specifiers IIUC
02:18andyfingerhuttechnomancy: Have you noticed that one of the top Google hits for leiningen is "Leiningen versus the Ants", a 1938 short story? I thought the name was pretty funny. Coincidence?
02:18technomancyandyfingerhut: no coincidence at all
02:18technomancythat story is the inspiration behind the software
02:19andyfingerhutThat seemed more likely than coincidence.
02:19technomancythe story of one man using his quick wit to defeat the chaotic forces of nature
02:42amalloyi notice that emacs's M-x shell allows you to overwrite the shell-written stuff like prompts. i know it has support for read-only portions of buffers; is there an easy way to make that stuff non-editable?
03:18LauJensenGood morning all
03:19amalloymorning lau
03:20amalloy(PS did you get a highlight this time?)
03:23LauJensenhmm, no - I'll go to .emacs
03:24LauJensencan you try again?
03:25LauJensenamalloy ^^
03:25amalloymorning lau
03:25LauJensenAnd it works!, thanks :)
03:25amalloywhat was wrong?
03:25LauJensenI think I had tried to avoid being highlighted on "launch", but went too far
03:25lypanovis there a "lein run" or something?
03:26LauJensenlypanov: "cake run"
03:26amalloyLauJensen: using a regex or something?
03:26LauJensenamalloy: no
03:26LauJensen"lau "
03:26amalloyi see
03:27amalloycake run! that is just the best thing ever. "Hey computer, I'm gonna go on a cake run, do you want anything?"
03:29lypanovLauJensen: stable?
03:29lypanovLauJensen: as in, you using & enjoying?
03:29LauJensenyes, yes and yes!
03:29lypanovcool. switching. thx LauJensen
03:30LauJensennp
03:31amalloyLauJensen: could you use a regex if you wanted to? eg /\b(?iLau(Jensen)?|Jensen)\b/ is kinda hacky but simple and ought to be pretty good
03:32LauJensenI didn't know erc-keywords accepted regexes.. Does that handle case as well ? (upper/lower)
03:32amalloyi don't know if it does accept regexes; i was asking you
03:32LauJensenah right, my mind swapped "could you"
03:33amalloybut if it does, then yes, a PCRE engine will treat that case-insensitively (the (?i) modifier)
03:33LauJensenDocumentation:
03:33LauJensenList of keywords to highlight in all incoming messages.
03:33LauJensenEach entry in the list is either a regexp, or a cons cell with the
03:33LauJensenregexp in the car and the face to use in the cdr. If no face is
03:33LauJensenspecified, `erc-keyword-face' is used.
03:33LauJensen
03:33LauJensenCool :)
03:34LauJensenIts installed now, could you try highlighting me amalloy ?
03:34amalloyLauJensen: fair warning, though, not all regex engines are perl-compatible; the one grep uses by default is awful unless you switch on -e or -P
03:35amalloy(highlighting lau in case the other message was too soon)
03:35LauJensenhmmm
03:35LauJensenplease repeat
03:36amalloyLauJensen: you mean your name, or clarify about PCRE?
03:36LauJensen<amalloy> (highlighting lau in case the other message was too soon)
03:36LauJensenJust write that again please
03:36amalloy(highlighting lau in case the other message was too soon)
03:36LauJensenhmm, its not working, but I know where to go, thanks for the input amalloy
03:37LauJensenGood morning rberger
03:38rbergerGood Morning!
03:38amalloyoh. just tried it out in perl; i was using the wrong syntax for ?i. try thiis instead, LauJensen: /\b((?i)Lau(Jensen)?|Jensen)\b/
03:40AWizzArd~max people
03:40clojurebotmax people is 313
03:41LauJensenamalloy: Could you step into #conjlabs for a second?
03:47yayitsweiare there any Clojure http libraries that use the java.net.URLConnection class? reason I ask is because that's the only accepted way of doing http connections on Google App Engine, according to these docs (http://code.google.com/appengine/docs/java/urlfetch/usingjavanet.html)
03:47LauJensenyayitswei: did you check out clojure.contrib.http.agent?
03:49yayitsweiLauJensen: will try it now, thanks. was previously using com.twinql.clojure.http, which gave me an java.security.AccessControlException running on GAE
03:57amalloyg'night folks
04:12tobiasraederHey :)
04:13tobiasraederIs there any way in clojure to create a clojure object that represents an interface? For example that i can call (.isInterface object) and it returns true? (I need it for java interop and can't touch the java code)
04:24Chousuketobiasraeder: you can use reify
04:24Chousukeor hm
04:25Chousukedo you mean actually creating an interface?
04:25Chousukefor that there's definterface
04:25tobiasraederah okay
04:25tobiasraederyeah i mean actually creating the interface
04:26tobiasraederty seems like it is exactly what i was looking for.
05:04kjeldahlI've managed to connect to postgresql through clojure.contrib.sql, but the clj-record stuff isn't cooperating. Anybody on who've used clj-record?
05:17kjeldahlSometimes when I run "lein deps" I get a NullPointerException. Immediately running it again then works fine. Can anybody explain why?
05:32LauJensenkjeldahl: you mispelled 'cake' and wrote 'lein' instead
05:33kjeldahlIs that a not-so-subtle hint again that I'm using the wrong tool?
05:34kjeldahlAnyway, my clojure.contrib.sql / clj-record trouble was solved by upgrading lein-swank to 1.2.0-SNAPSHOT. Found the thread that discussed the bug (something about printing inside the sql module).
05:35tobiasraederAnybody ever used a macro to generate an interface using definterface and provided typehints for the generated interface functions?
05:35kjeldahlI'll try to install cake. Is this the right repo: http://github.com/ninjudd/cake
05:37bobo_kjeldahl: yes
05:37tobiasraederAnybody can give me a quick downrun on the advantages of cake over leiningen?
05:38kjeldahlbobo_: Thanks.
05:40Chousuketobiasraeder: are you having trouble doing that? :)
05:41Chousuketobiasraeder: when you generate code in a macro, you can't always use the reader metadata syntax. You can however attach metadata to the symbols manually, using with-meta
05:41bobo_tobiasraeder: persistent vm, ruby hoock instead of bash, you wont have LauJensen nagging you to change and so on :-)
05:41tobiasraeder@Chousuke what im trying to generate is (definterface interf# (^String getName[]) (^Void setName[name]))
05:42kjeldahlSince there is no cake-swank to put in project.clj, I'll assume lein-swank is ok? ;-)
05:42kjeldahlEh, if I can get it running that is.
05:42Chousuketobiasraeder: why are you generating an anonymous interface? what use is that? :/
05:42LauJensenkjeldahl: yea, lein-swank is fine, cake is a drop-in replacement
05:42Chousuketobiasraeder: anyway, that should work just fine
05:43zmila,(doc map-indexed)
05:43clojurebot"([f coll]); Returns a lazy sequence consisting of the result of applying f to 0 and the first item of coll, followed by applying f to 1 and the second item in coll, etc, until coll is exhausted. Thus function f should accept 2 arguments, index and item."
05:43tobiasraeder@Chousuke its some really stupid java code which i have to interop with where i have to supply an interface and a class that implements said interface which then generates some objects via reflection
05:43kjeldahlNice, thanks. Works fine.
05:43Chousukemaybe ^void instead of ^Void?
05:43Chousuketobiasraeder: urgh.
05:43tobiasraeder@Chousuke yeah and cant change the java side :/
05:43tobiasraeder@Chousuke and i got no idea where to attach the return value typehints to :s
05:44ChousukeI think you have them in the right place. though I'm not sure
05:45tobiasraeder@Chousuke yeah that definterface works fine but if i try to create that from a macro i cant seem to place the typehints for the return values
05:45Chousukehmh
05:46Chousuketry ~'^String foo
05:46tobiasraederill try, ty
05:46Chousukemaybe the namespace resolution in ` is messing up the metadata somehow
05:47ChousukeI'm not sure if that works either but it's the only thing I can think of :P
05:47Chousukeuntil someone who knows definterface better comes and saves the day
05:47tobiasraederalright, thank you for the input. ill let you know if i get it to work
05:50Chousukeit seems definterface has no documentation. :|
05:51Chousukebut it's probably similar to reify
05:51Chousukeie. return type hint goes on method name
05:52Chousuketobiasraeder: maybe it would be easier to use a protocol or something
05:52Chousuketobiasraeder: since a protocol generates a matching interface
05:53tobiasraeder@Chosuke tried that but i need to pass an object to the java code and that object has to be the class of the interface which is then checked with .isInterface etc to make sure it is an interface and that the supplied object implements the interface
05:53Chousukeso you can create a protocol, then a deftype/reify object/defrecord that implements the protocol, and pass the interface and that object to the java code
05:53tobiasraederhow do i get the interface classname?
05:53Chousukeit's the same as the protocol I think
05:54Chousukeie your.namespace.here.Protocol (instead of your.namespace.here/Protocol which gives you the protocol object.)
05:54tobiasraederah
05:54tobiasraederill try that
05:56Chousukesee the documentation for protocols for more hints. http://clojure.org/protocols
05:56tobiasraederyeah that seems to do the job. thank you very much.
05:57tobiasraederis there a way to get namespace.protocol automaticly if i just have the protocol var at hand?
05:57ChousukeI'm not sure.
05:58tobiasraederalright
05:59esj11
06:04kjeldahlAm I right concluding that clj-record assumes the primary key on all tables is named "id"?
06:05kjeldahlMust be, with code like this: (sql/delete-rows (table-name model-name) ["id = ?" (:id record)])
06:11tobiasraederyeah
06:12kjeldahlDing! Clojure, through clj-record, managed to put in a row in my postgresql database. Baby steps, I know. :-)
06:12tobiasraederStill nice! :)
06:13tobiasraederenjoy.
06:13pomykwhen I run cake I get: Exception in thread "main" java.io.FileNotFoundException: Could not locate clojure/java/io__init.class or clojure/java/io.clj on classpath: (io.clj:1)
06:16kjeldahlIs the book "Programming Clojure" free? While bughunting search for clj-record stuff I found it downloadable as a pdf on the net. If it's not free the author may want to know. Looks like a chinese site.
06:17ChousukeIt's not free.
06:18kjeldahlOk, I'll alert the author directly (assuming I can find his email address).
06:22esjthat didn't take long
06:23kjeldahlAlerted support@pragprog.com (found it in the book... ;-)
06:25LauJensenesj: and its not the first time either
06:26esjsucks
06:26LauJensenEverybody (not me) loves piracy, except when it happens to someone you know
06:33tomojhmm, my macro does (loop [count# ~count] ..), where in this case count contains the symbol 'count, which refers back to a different let binding (let [count ...])
06:33tomojI think this is not going so well
06:37Chousuke:P
06:41esjouch
06:51esjtomoj: how many counts can a count macro count if a count macro could count counts ?
06:59tobiasraederIt's probably i really dumb question but how do i defince a protocol inside a macro and use it properly? i tried
06:59tobiasraeder(defmacro mymacro [] `(defprotocol myprotocol) `(str *ns* "." myprotocol))
07:00tobiasraederwhich tell's me that user/myprotocol isn't defined
07:00tobiasraeder*define
07:00tobiasraederthe error occurs when i (macroexpand (mymacro))
07:04arbschttobiasraeder: (macroexpand (mymacro)) evaluates (mymacro). instead try (macroexpand '(mymacro))
07:05tobiasraeder@arbscht ah, thank you. i somehow always forget the leading '
07:07tomojhmm, is there a simple way to create a tcp proxy in clojure? I just want to forward all the bytes that come in to some remote host, and forward all bytes from the remote host back, but also run processing on them
07:07tomojnow I've got 2 inputstreams and 2 outputstreams and don't know what to do
07:16bmhIs it possible to do upper_bound and lower_bound queries on sorted maps?
07:17bmh(log time queries, that is)
07:20LauJensen,(filter #(< 5 % 10) (apply sorted-set (range 20)))
07:20clojurebot(6 7 8 9)
07:20LauJensenbmh: You mean that kind of thing?
07:22tobiasraederIs there a way to get the Class object based on a string with the class name within clojure? (the same as would be returned by (class object)
07:23bmhLauJensen: more like...
07:23bmhhttp://www.cplusplus.com/reference/stl/map/upper_bound/
07:25LauJensenbmh: exchange filter for drop-while and you'll effectively have a seq starting where you want
07:26bmhLauJensen: Sure. I know how to write the linear time version. Won't calling drop-while on a sorted-map just walk the elements?
07:26LauJensenbmh: yea, but sorted sets dont support access on index
07:27bmh%s/sorted-set/sorte-map/
07:28LauJensensame story
07:29mrBliss,(Class/forName "java.lang.String")
07:29clojurebotjava.lang.String
07:29mrBlisstobiasraeder: ^^
07:29bmhnone of this hinges on index access. The idea is to get the first entry that is strictly greater than the search key, or the last entry that is <= to the search key
07:31tobiasraeder@mrBliss thank you.
07:43bmhhey dnolen
07:43dnolenbmh: hullo
07:47LauJensenbmh: You could try asking your question again for dnolen, he might have a good idea
07:48bmhalright
07:48bmhdnolen: are you familiar with the STL?
07:50dnolenbmh: heh, not particularly no. but reading the back log if you're using a sorted set why not just use first, last ?
07:50dnolen,(first (apply sorted-set [100 1 50]))
07:50clojurebot1
07:50dnolen,(last (apply sorted-set [100 1 50]))
07:50clojurebot100
07:51dnolen,(last (conj (apply sorted-set [100 1 50]) 20))
07:51clojurebot100
07:51bmh[1 2 3 4 6 7 8 9], give me the first element greater than 5 in log time
07:56bmhrhickey: Are there plans to expose PersistentQueue?
07:58@rhickeybmh: perhaps - enough people seem to use it
08:02RaynesWhy aren't there docs for the clojure.java namespaces here? http://clojure.github.com/clojure/
08:02lpetitHello
08:03LauJensenlpetit: Howdy
08:03lpetitrhickey: I managed to make things fit together. We may be close to a happy end to *some* "story" between clojure and OSGi
08:03@rhickeylpetit: great! what worked?
08:03lpetitI had to patch clojure in several areas, though. 3 areas, to be precise
08:04dnolenbmh: yeah, no way to do that I can see. Though the tools are there to build such a data structure I think.
08:04lpetit1. your suggestion was necessary. Placing an additional pushLOADER() right after pushNS() in the bytecode of AOTed classes load()
08:04bmhdnolen: ah-ha. subseq and rsubseq seem to do the right thing
08:05cemericklpetit: Neil Bartlett and aav were in here yesterday afternoon kibitzing on the osgi issues. There's a google doc where they've started lining up requirements; maybe you can throw in with them, as they have a pile of osgi expertise (but probably less Clojure know-how than you?).
08:05LauJensenkibitzing?
08:05cemerickindeed :-)
08:06cemericklpetit: http://bit.ly/clojureosgi
08:06dnolenbmh: nice, did not know that, my Clojure-fu is still at a fledgling level :)
08:07Raynes$dict kibitz
08:07sexpbotRaynes: verb: make unwanted and intrusive comments
08:07RaynesInteresting. Never heard that one before.
08:07cemerickthat's not right
08:07cemerickaccording to google: 2. Speak informally; chat.
08:08RaynesI believe Wordnik and Google use some of the same sources.
08:08RaynesSo, that's odd.
08:08cemerickOh, it had one of the definitions, just not the one I was using.
08:08lpetit2. ninjudd reported, a while back, and among other things, a problem in Compiler$ImportExpr. Initial emit: gen.invokeStatic(CLASS_TYPE, Method.getMethod("Class forName(String)")). Patched emit: gen.invokeStatic(RT_TYPE, Method.getMethod("Class classForName(String)"))
08:09cemerickso s/right/what I meant :-)
08:09lpetitBut then there was still a problem.
08:09lpetitrhickey: and here's where I made the third patch, and were I need your help to see whether it makes sense in all cases (I'm pretty confident with patch 2, but maybe you have also something to say 'bout it ?)
08:10lpetitrhickey: maybe we could verify that patch 2. makes sense before I speak about patch 3, to keep things simple
08:11lpetitcemerick: interesting. I have also created a google doc summarizing what I've found, and what is explained here (though it's more personal notes than meant to be shared with others)
08:11LauJensenlpetit: link? :)
08:12lpetitLauJensen: when it's cleaned up, yes. If everything is accepted by Rich, I do not totally exclude writing a blog post on the subject (would be my first one !)
08:12LauJensenCant I get a preview?
08:13cemericklpetit: Sounds like a good start. I figure the three of you will be able to cover all the necessary ground. FWIW, they didn't actually think that patching clojure was necessary at this point, so I suspect some cross-pollination would be a net gain.
08:13lpetitLauJensen: I prefer focusing on potential issues, one by one, here first, then update my document (if it still makes sense). No need to present everything at once if there's crap inside
08:13LauJensen(-> lpetit kibitzing cross-pollination) = net gain
08:15lpetitHopefully Rich will have some time accepting / rejecting my point 2. Then I'll talk about point 3. If both seem valid, then yes, it will become interesting that more eyes look at what I did. If not, it would just waste the time of others :-)
08:16lpetitcemerick: I'll look at the doc. I must first verify that we're on the same "story".
08:16lpetitcemerick: (not to say that one "story" would be better than the other, though)
08:17lpetitcemerick: the patches for clojure are really this: bug patches. Not additional features. So they are somehow "right". "debugged" clojure should work with OSGi without architectural change.
08:17cemericklpetit: Presumably, the ideal would be for a generalized set of solutions to be explored. I'm sure there are a number of use cases crossed with however many container implementations exist.
08:18lpetitcemerick: in my "story", the only difference between containers is on how they use the context class loader for greater good, and things may change on how bundle creators leverage those OSGi-imple context classloader specificities.
08:19lpetitcemerick: but I also have locally a solution which is fully implementation agnostic.
08:20lpetitcemerick: the solution leverages the existing public OSGi APIs to create a custom ClassLoader injected into Compiler.LOADER's root.
08:21cemericklpetit: sounds like a winner to me, but then I know fairly little about OSGi at this point. :-)
08:22lpetitcemerick: started to read the doc. Seems we are not totally on the same "story".
08:23cemericklpetit: well, you have edit on it now -- by all means, contribute as you see fit :-)
08:23lpetitcemerick: thanks
08:29lpetitcemerick: the "story" in the document is unclear to me. Here is mine: if the clojure bundle is named "clojure", if bundles "b1" and "b2" must use clojure, then they will have bundle "clojure" as their dependency. Sharing the same "clojure" bundle implies sharing the same clojure "world". So b1 and b2 can require/use namespaces from each other. There is a "web" of interconnected bundles : all the bundles that depend on the clojure b
08:30lpetitcemerick: with this vision, if there are several "applications" loaded in the same OSGi environment, if you want to separarate them, then each of them must provide its own clojure bundle.
08:31cemericklpetit: I *think* that that's what they're aiming for as well. Best way to check is to add that scenario/perspective to the doc and see if they agree.
08:31lpetitcemerick: this simplifies things well, while not over-simplifying them, IMHO. As a result, using clojure correctly in e.g. Eclipse/Equinox is just a matter of applying the 3 patches I've gathered to clojure code (because currently in some areas the context classloader is not used), and using one of the "buddy" policies of Eclipse, the simplest being the "dependent" policy.
08:31aavcemerick: it's nothing wrong with this scenario
08:31lpetitaav: hello
08:32aavlpetit, cemerick: hi!
08:32cemerickaav: hi again :-D
08:32lpetitaav: it's this requirement which alerted me : "4. Clojure source SHOULD NOT have visibility of other clojure sources, that are not available to the hosting bundle"
08:33aavlpetit: added by me :)
08:33aavlpetit: the point was to be as close as possible to osgi behaviour with regards to package visibility
08:34lpetitaav: and contradictory with the story I described and you just acknowledged to be yours too. With my "story", clojure source of bundles b1 and b2 share the same clojure env, so they have 'visibility' on each other
08:36aavlpetit: they share, but nothing prevents us from "artificial failing" of attempts to requre/use/etc from packages that are not available
08:37aavotherwise it will get very confusing, i'm afraid
08:37lpetitaav: IMHO, such fine grained separation will not be easy (if feasible at all) with clojure until modularization concerns are taken into account at the core of clojure (ns n1 depends on version 2 of ns n2 ; possibility to have several "sets/worlds" of ns handled by the same clojure environment, etc.). And even when clojure's state of affair reaches this modularity level at clojure code level, things will be complicated with all AOT
08:39aavlpetit: proper separation will not be easy. but i see a possible compromise.
08:40lpetitaav: Above all, I'm questioning not the technical feasibility, but rather the goal one wants to achieve, the use cases one wants to support. I'm unclear about yours. I hope mine (as described above) is clear and without shadow ;-)
08:41aavlpetit: i would like to have consistent (as far as possible) behaviour for clojure and native java part of a system
08:43aavi.e. I have a project, that contains a lot of java code and clojure code at the same time. i want to have more or less same rules when it comes to visibility and loading of anything
08:43lpetitaav: will get confusing if some bundles "hijack" your bundle, indeed. But what we're mainly talking about is bundles sharing code via classloaders, not leveraging OSGi services (that's another story, will be interesting to provide a layer above OSGi API to ease the write of such services, as has been done recently by somebody for google AppEngine with appengine-magic)
08:43lpetitaav: my story may be "too simple" for you (and I can hear that), but it is consistent.
08:44lpetitaav: I understand
08:44@rhickeylpetit: #2 is a definite problem. In fact, ImportExpr specifically exists to better support modularity. One thing all of the module systems leverage are calls to Class.forName. But Class.forName walks the stack (to find the invoker class and it's loader) and thus can't be proxied or nested. For this reason, prior to import being a macro, it could never do the right thing. Now it does and you want to change it back :(
08:45jjidocan you do multiple dispatch on more than just the first arg with a protocol function?
08:45cemerickjjido: nope; such cases call for multimethods
08:46@rhickeylpetit: I predict changing import to use RT.classForName will break many things in OSGi
08:47@rhickeyimport was improved because of complaints about not playing well with modularity systems.
08:48jjidocemerick: so I should define my multimethod outside the protocol? I guess I will just do a instance? check for now
08:48@rhickeyif the modularity system has assigned a classloader for some ns X, then you want its imports to use that classloader
08:48lpetitrhickey: that's sad. What's even more sad is that I don't understand
08:49cemerickjjido: if you have a protocol, but you need some kind of dispatch / switch based on a condition besides the type of the first arg, then you need to fall back to a regular conditional
08:49@rhickeylpetit: what I expected from that exercise yesterday was a request from you for a hook to allow you to root the dynamic classloader you create in static init
08:49cemerickor you might be able to map in a multimethod as the impl of a protocol for a particular type via extend, etc
08:49jjidocemerick : got it
08:51lpetitrhickey: but before I did point 2.'s change, I had this exact problem: no visibility from the clojure bundle to the class, because the clojure bundle does not depend on the using bundle (or there would be a circular dependency between the 2). Letting the context classloader 's OSGi impl do its magic allows the import to just work.
08:51aavrhickey: what i'm doing now is simply setting a context classloader to an appropriate one (related to the bundle, .clj file is loaded from)
08:53lpetitaav: are you able to do that without patching clojure ? (either a patch at the java source code level, or a patch leveraging the possibility of redefining in clojure some vars in clojure.core ?)
08:53aavyes
08:53aavno clojure patches were needed
08:53@rhickeylpetit: but it's not the clojure bundle doing the import. import is a macro that gens Class.forName with the scope and access of the caller
08:54@rhickeythat was the whol;e point of the changes to import and making import a macro + special op
08:54aavthe only dity trick i do - substitute clojure's load function
08:55lpetitrhickey: which caller ? are we able to know who the caller is ? are we able to take control of the context classloader before/after the call ?
08:55@rhickeylpetit: caller is the code that has the word import or :import in it
08:55lpetitaav: and now if that's not patching clojure by leveraging the possibility to redefine some clojure.core vars, please tell me what it is ! :)
08:56aav(defn osgi-require [name]
08:56aav (binding [load osgi-load]
08:56aav (require name)
08:56aav )
08:56aav)
08:56aavi'm not sure if this is very elegant. but it works...
08:56lpetitaav: interesting, though
08:57@rhickeylpetit: but it seems you are trying to work around OSGi wather than with it. If OSGi had a loader it liked for the module, than that loader should work fine for its imports.
08:57lpetitrhickey: quite true.
08:58@rhickeylpetit: I'm a bit confused as to how you are establishing deps between bundles. Are you trying to supplant OSGi in this area?
08:58aavlpetit: take a look at http://github.com/aav/clojure.osgi - it's very minimalistic, but it works
08:58lpetitHmm, but my problems where real .... I did not add this patch upfront ...
08:58lpetitrhickey: no
08:59lpetitrhickey: but as said before, I leverage Equinox's "buddy" policy ("dependent" in my case) so that class/resource resolution is bidirectional when using the context class loader
09:01@rhickeylpetit: to what did you bind Compiler.LOADER in the AOT class static init?
09:03lpetitrhickey: to RT.makeClassLoader()
09:04fliebelDoes self have any special meaning in Clojure I'm unaware of?
09:05lpetitrhickey: but there's a missing implicit part in my story. My story is about getting "as dynamic" as possible when developing in an OSGi environement. That is as few AOT compilation as possible (just for the required parts when legacy java classes need to find the AOTed class, just for when the class will be loading from declarative settings).
09:05jjidofliebel: usually not
09:06lpetitrhickey: so no unnecessary AOT compiled namespaces. When you talked about the "caller", weren't you implying the caller was an AOT compiled namespace ?
09:06@rhickeylpetit: that won't work, you need to root the dynamic classloader to the loader being used by OSGi to load the class being initialized
09:06fliebeljjido: Thanks. I'm having a weird error, and it wouldn't be the first time it was because of a var nam shadowing something else.
09:06@rhickeylpetit: AOT or not, the class gets compiled and call import
09:07@rhickeybut yes, I was talking about AOT with the static stuff, sinc ethat was your problem yesterday
09:08lpetitrhickey: ccw already works with OSGi with fully AOTed code for a while (so maybe I did not get rid of the transitively compiled namespaces from other bundles after the compilation, hmmm)
09:10@rhickeylpetit: I'm confused
09:10@rhickeyyesterday - lpetit: rhickey: how does an AOT compiled gen-class, when loaded from plain old java class (for example), initialize itself ?
09:12AWizzArdI may be the first developer who experienced a real code break through the change of primitives. But: this is most likely due to a bug. I create somewhere (Integer. "123") and this info gets lost, and I end up having a long.
09:13AWizzArdAs my code was working with byte streams I expected Ints and read 4 bytes. But what I wrote were Longs, so I should have read 8 bytes instead, with the new clojure.jar.
09:13AWizzArdI assume that the issue that I filed yesterday will solve this.
09:14AWizzArdIt is probably the same thing as this Integer/valueOf thing.
09:17lpetitrhickey: In my real-world scenario, there will be some gen-classes, and a bunch of regular ns as .clj files.
09:18@rhickeylpetit: I think you should look carefully at what aav posted
09:18lpetitrhickey: I will, though later, must go back to work :-/
09:18@rhickeyme too
09:18lpetitaav: thanks for sharing, hope to be able to look at this tonigh
09:18lpetitrhickey: thanks again for your time, very much appreciated !
09:29fliebelWhat could be a case where I insert a symbol where I meant inserting a seq? I'm not doing (symbol x) and macroes are involved. "Don't know how to create ISeq from: clojure.lang.Symbol"
09:29mrBlissfliebel: can you show the line?
09:30fliebelmrBliss: (chain-template template self)but that calls this line: `(en/snippet* (en/html-resource ~rec) [~'headers ~'body] ~@expr))
09:33mrBlissfliebel: which functions on that line take seqs? expr is certainly a list? I mean code ;-)
09:34fliebel?
09:35jk_does anyone here use eclipse w/counterclockwise plugin?
09:36fliebelmrBliss: chain-template is a macro that takes rec and expr as arguments. But I can't see how self/expr can be a symbol.
09:36mrSpecHello!
09:37mrSpecI'd like to return result of sql query as a list. is it possible to do (with-connection db (with-query-results foo bar (map #(:user %) foo)) ? I can only do (dorun (map ...)) is it normal?
09:37mrBliss,(let [expr 'self] `(list ~@expr))
09:37clojurebotDon't know how to create ISeq from: clojure.lang.Symbol
09:38mrBlissfliebel: are you sure self can be spliced?
09:38mrBliss(I'm just thinking out loud)
09:38fliebelmrBliss: Apparently not…
09:39lpetitjk_: yes
09:40jk_lpetit: i'm scratching my head over somethign that should be simple. i have 2 files in the project w/2 separate namespaces. i want to use the second file (via :use) in the first but the repl doesn't see the second namespace. what's the trick for getting both files loaded into the repl when it starts?
09:42lpetitjk_: I'm confused with your question
09:44jk_lpetit: i have a clojure project in counterclockwise. there are 2 source files, each with their own namespace. when I "run" the first file (that ":use"s the second), I can't use any functions from the second file since they aren't seen on the classpath.
09:44lpetitjk_: crazy :-/
09:45jk_lpetit: crazy??
09:45lpetitjk_: I meant "weird"
09:45jk_lpetit: have you ever developed on a project with more than a single file in it?
09:45jk_lpetit: in ccw i mean
09:46lpetitjk_: more and more parts of ccw are written in ccw. paredit.clj is written in ccw. The basic stuff you're describing should just work. Or it's a *serious* (critical !) regression.
09:46lpetitjk_: what do you mean by "when I 'run'". What is "run" ?
09:47LauJensenjk_: For the serious stuff, lpetit uses Emacs :P
09:47lpetitLauJensen: ah ah
09:47jk_lpetit: like when you "right click/run" on a source file
09:47clojurebotamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
09:47jk_LauJensen: :)
09:49jk_lpetit: that starts a repl and loads your file but i need that repl to see the other functions in the second file too. it would be nice if it just loaded all the files in your project since the idea of a project is to develop them all together
09:49jk_lpetit: the :use clause complains that it doesn't see that namespace on the classpath
09:53lpetitjk_: "lpetit: the :use clause complains that it doesn't see that namespace on the classpath": this is the weird part. This normally just works.
09:54lpetitjk_: not all files are loaded on startup when invoking "run" on a specific ns file. Just the selected file will be loaded (and all its expressions evaluated, so of course some other namespaces may be loaded as a result of (:require) (:use) placed in the (ns) form
09:55jk_lpetit: and the second namespace (in :use) is in the second file in my same project, in the src directory
09:55lpetitjk_: if you specifically want *all* your project namespaces to be automatically loaded, don't invoke "run" from a specific file, but from the project's root node. This has the special behaviour you're after: ccw will then try to load every ns in turn
09:55jk_lpetit: i thought it would just get loaded automatically
09:55jk_lpetit: ahh!
09:56lpetitjk_: it should be loaded transitively if it's in the (ns) of your other file, though.
09:57lpetitjk_: if file f1 contains "(ns f1 (:use f2))", if file f2.clj contains "(ns f2)", then in this particular case, invoking "run" either on file f1.clj or on the project's root should trigger the load of namespace f2.
09:58jk_lpetit: well that's what i thought but figured i must be doing something stupid
09:59lpetitjk_: can you share your project eg on github ?
09:59jk_lpetit: i need to get ready for work. thanks very much for the input. i'll come back to this and have another look later
09:59lpetitjk_: ok, cu
09:59jk_lpetit: sure, i can do that later but i'm already gonna be late for a meeting!
10:00fliebelmrBliss: Some more debugging reveals that I do put a seq into the function, but inside the macro, printing the arguments gives me just their symbols.
10:03fliebelWell, actually it prints 4 lines, 2 of which I can't make sense and 2 that seem in the wrong order.
10:03fliebelhtml (last page)
10:03fliebelhtml (last page)
10:03fliebeltemplate self
10:03fliebelindex.html index.md []
10:04fliebelThat last line is printed in the fn that calls the macro that printed the first 3 lines.
10:04fliebelThough there is only one print statement in the macro and it is called 2 times. Go figure...
10:07jk_lpetit: still there?
10:09jk_lpetit: i tried another couple of things quickly (i really need to go!) but the problem seems tied to the fact that i changed the namespace values and they didn't match the filename. i reverted to just using the filename for the namespace and it's all working normally
10:09jk_lpetit: seems like if i want to have a ns "x.y.z" it's tied to a java package x.y, filename z. i think... gotta look more later
10:10chouserrhickey: ha! what does it mean that "arbitrary functional destructuring" is now marked for Release.Next?
10:11@rhickeychouser: you don't want it now?
10:11scottjYeah for improved debugging!
10:12_fogus_ooooooo! arbitrary functional destructuring is my favorite.
10:12chouserrhickey: I'm not saying that, I just assumed it was dead.
10:15@rhickeya lot of stuff was held until after 1.2, but then we had to first integrate all of the num/equiv. Now we are in a position to apply more patches
10:15@rhickeyscreening help welcome
10:17_fogus_@rhickey: screening?
10:18cemerick_fogus_: panning for gold in those assembla hills
10:18_fogus_cemerick: Gotcha
10:20fliebelOkay, I'm out of ideas. I've been fighting the same bug for days now. The only options I've left is that I'm overlooking something stupid, or a bug in Clojure. Usually it's the first though. I have a macro that should get called with a string and a seq. When I turn it into an fn that prints the args, it prints the expected result. When I have the real thing, it blows up at the splicing part, on a var that was a proper vector in the fn variant. It
10:22cemerickfliebel: paste and you shall receive
10:22_fogus_Anyone interesting in patches pertaining to any of my "Monkeying" posts? http://blog.fogus.me/tag/monkey/
10:23fliebelcemerick: http://github.com/pepijndevos/utterson/blob/develop/src/utterson/compile.clj
10:23fliebelline 101
10:24_fogus_Where anyone == rhickey ;-)
10:24@rhickeyfliebel: write the expansion by hand, make sure it works, then macroexpand-1 the macro call and make sure it turns into that expansion
10:25cemerickfliebel: I was hoping for something sliced out of its context. The process of doing that often reveals bugs/misconceptions. Barring that, see rhickey ^^
10:25cemerickor, rhickey's advice, I mean
10:25fliebelrhickey: I pasted the macor in the repl and called it with the expected arguments, and IIRC it worked.
10:26fliebelcemerick: I'm going to work on that.
10:26@rhickeyfliebel: I am explicitly saying, don't do that
10:26fliebelrhickey: I expanded it as well of course, but I'll do some more of that.
10:27@rhickeycalling a macro is the worst way to test it, as two things are happening and you'll have much more difficulty determining where it is going wrong
10:28tobiasraederone quick question, is it possible to construct an interface (using definterface) or a protocol with typehinted functions from a macro? i seem to fail
10:30fliebelrhickey: Expanded macro looks good and works.
10:30@rhickey_fogus_: deftest and comp yes, anaphora, no
10:33lpetitrhickey: I've looked at what aav did, and it looks good. It just happen that I've worked too late on the subject the previous night, and I don't have all my cognitive abilities today. Will think about it in "off" mode, and come back later when my mind is clear and (hopefully) with the simplest example demonstrating the problem.
10:33_fogus_rhickey: OK great. Is it still anaphora when its explicitly named?
10:33@rhickey_fogus_: nope
10:34@rhickeylpetit: sounds good
10:37cemerickrhickey: if you're spelunking in case, perhaps supporting dispatch on referenced static final fields and enums would be worth folding in (i.e. http://cemerick.com/2010/08/03/enhancing-clojures-case-to-evaluate-dispatch-values/)
10:37cemerickThe above is flawed, but only in some specifics AFAICT.
10:37fliebelWhen I print something in a macro before the body returned, what should that do?
10:40fliebelIn my case, that prints just the exact code inserted.
10:40fliebelOn the repl, that prints the values inserted.
10:40fliebelTrying to reproduce.
10:41fliebelthat's it!
10:43fliebelcemerick, rhickey: http://gist.github.com/601109
10:45@rhickeycemerick: so, where's the patch? :)
10:45fliebelRemoving the splice reveals that indeed just the symbol a is inserted, which can't be spliced.
10:46cemerickrhickey: ha! I'll be happy to produce one, though I figure I should wait until you've finished with #426
10:47cemerickfliebel: yup, only seqable things can be spliced in
10:47fliebelcemerick: But… the value of c is very much a seq.
10:48@rhickeycemerick: hrm, you don't want to do 426 as well?
10:48cemerickfliebel: the macro a is not splicing in the vector c, it's splicing in the symbol provided to it as argument b.
10:49AWizzArdrhickey: would it be possible, if your schedule allows it, to add a (possibly empty) marker Interface for defrecords and deftypes, so that (record? r) and (deftype? d) can be implemented, by simply checking for this Interface?
10:50cemerickrhickey: I could, but it won't be for a while; probably not until after the conj, anyway.
10:50fliebelcemerick: So what do I do? :(
10:51cemerickfliebel: well, that depends on what you *want* to do. Sorry if that sounds pedantic. :-|
10:51cemerickmacros operate on code, not runtime values
10:51cemericke.g. (println (a [1 2 3]))
10:52cemerickyou can *refer* to the existing var c, but that's bad practice
10:52fliebelcemerick: All I want is to call snippet* with a seq instead of with a ton of arguments directly.
10:53fliebelcemerick: But snippet* is a macro, so I can't use apply.
10:53@rhickeycemerick: I understand, just kidding. But could you please put a pointer to your case+ stuff into the comments on #426
10:53cemerickha, sure
10:55raekfliebel: I recently started to read here, so I might be missing the point, but could you let the macro genererate a (apply ...)?
10:55cemerickfliebel: I don't understand where you're going wrong. e.g. http://gist.github.com/601109#comments
10:57fliebelcemerick: In my case the vector is in a let, so I put the symbol in the macro.
10:58fliebelraek: Basically I have a seq of arguments stored somewhere, and a macro to apply them to. So I can't use apply on a macro and I can splice the /symbol/ to the seq.
10:58fliebel*cant
10:59raekdoes it have to be a macro?
10:59raeksorry, but I have to go again...
10:59fliebelraek: It;s in enlive.
11:02fliebelcemerick: I'm not using a vector literal.
11:02quizmewhat's this called "->" ?
11:03fliebelquizme: Threading macro?
11:03quizmethnx
11:04_fogus_quizme: Zeno's arrow. ;-)
11:05tobiasraederis there a way to do something like (defprotocol myprotocol (^String myfn [])) with a macro? (the main part is the ^String)
11:05cemerickfliebel: My point before was, you can't use macros with runtime data; the macro is being expanded by the compiler long before that data is bound in the let form.
11:05cemerickYou can get around this with eval, but that's sorta icky.
11:05cemerick,(eval (list 'and true false))
11:05clojurebotDENIED
11:06cemerickbah. anyway...
11:06cemerickfliebel: all of enlive's macros are backed by functions (as is polite), so there's surely an appropriate fn for you to use instead
11:06fliebelcemerick: Right… So what are my options for applying a seq in a var to a macro?
11:06cemerickfliebel: eval, or find a macro that'll get the job done
11:07fliebelcemerick: It's all macros until deep down where I'd have a 20-line fn I could apply this to.
11:07cemericksorry, or find a *function* that'll get the job done
11:09fliebelcemerick: The main ones all go through snippet* to transformation. making a fn out of that is going to be icky as well. I'll opt for the eval route :(
11:10cemerickfliebel: it happens, sometimes. I'd ping cgrand if you see him, and ask if there's a better way.
11:11fliebelcemerick: I will. Thanks :)
11:11fliebel~seen cgrand
11:11clojurebotcgrand was last seen quiting IRC, 224 minutes ago
11:12cemerickquizme: -> is known as the Thrush Combinator in haskelly, FP circles as well
11:12cemerickThey're *very* good at giving things fancy names, it turns out.
11:12LauJensencemerick: IIRC thrush is a term which comes from math
11:14fliebelLauJensen: It's also a bird :)
11:20esjfliebel: as well as something that makes the young cry....
11:24chouserI believe the "Thrush combinator" is a function, right? -> is a macro, so it can't be the same thing, can it?
11:25LauJensenchouser: it can
11:26chouser,(-> [i [1 2 3]] (for (* i i)))
11:26clojurebot(1 4 9)
11:26chousercan Thrush do that?
11:26_fogus_A very good article on Thrush is http://github.com/raganwald/homoiconic/blob/master/2008-10-30/thrush.markdown#readme, but mine is simpler http://blog.fogus.me/2009/09/04/understanding-the-clojure-macro/ even if the commas thing is controversial. ;-)
11:26LauJensendebashing wrote something on Thrush as well
11:26LauJensen(thrush being ->)
11:27_fogus_I like Braithwaite's better
11:27LauJensenwhy?
11:27clojurebothttp://clojure.org/rationale
11:29_fogus_LauJensen: It makes more sense to me, plus it's very well written
11:29quizmehttp://pastie.org/1186727 <--- why?
11:30chouserquizme: that became (fn (sqr 5) [x] (+ 1 x)) ... which isn't valid clojure code
11:31esji'm weirdly happy to able to give -> a name
11:31esjthanks
11:31chouserIf -> were the Thrush combinator (and clojure had haskell-like auto-currying) that would have worked.
11:31octei want to generate a sequence from 0..inf, increasing by 1 each time
11:31chouserbut since -> is not Thrush and clojure doesn't curry, that's just a syntax error.
11:31octelike this: (iterate (fn [x] (+ x 1)) 0)
11:31octebut that feels awkward
11:32quizmethnx i'll chew on that
11:32chouserocte: (fn [x] (+ x 1)) can be written #(+ x 1) or just inc
11:32octethanks
11:32esjdammit
11:33chouserocte: but actually range with no args does just what you want
11:33chouser,(range)
11:33clojurebotExecution Timed Out
11:33chouser,(take 100 (range))
11:33clojurebot(0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99)
11:33octerange is what i wanted
11:33esjso we've cuckolded Thrush...
11:33octe,(range 4)
11:33clojurebot(0 1 2 3)
11:35chouseresj: -> is just different than Thrush. Similar, but with its own behavior that is sometime nicer and sometimes not.
11:35esjchouser: I should probably have read the article, rather than jump to conclusions. Thanks for the warning.
11:35chouser:-)
11:36chouserthrush should be easy enough to write. I wonder if it would be useful...
11:38chouser(defn thrush [& args] (reduce #(%2 %1) args))
11:38chouser(thrush 5 inc inc inc) ;=> 8
11:38chouser(thrush 5 #(- % 2) #(* 2 %)) ;=> 6
11:40chouser(thrush 5 sqr (fn [x] (+ 1 x)) #(Math/sqrt %) int str) ;=> "5"
11:44_fogus_chouser: Or another way to "visualize" thrush is (defn thrush [a & args] ((apply comp (reverse args)) a))
11:46chouser_fogus_: ah, good.
11:54_fogus_chouser: I like yours better. Very elegant.
11:57chouser_fogus_: I was a bit surprised I didn't end up needing 'reverse'. Your use of comp probably indicates what I was thinking.
11:57edwI apologize for bringing this problem up again, but I'm trying to get rid of the "error in process filter: Wrong number of arguments" error that pops up when '0'ing out of the SLIME debugger. Anyone know the underlying cause?
11:58_fogus_chouser: Mine could be the comment for yours. ;-)
11:59chouseredw: You want a cause a bit less underlying than "because you're using emacs" I suppose? :-)
12:00edwShow me an alternative and I'll use it. :P
12:00chouserpeople make even more fun of my alternative.
12:01edwPico?
12:01edwNotepad?
12:01edwTeachtext?
12:01edwEDLIN?
12:02edwWordstar?
12:02chouserexactly
12:02cemerickYou people are all nuts. ;-)
12:02chouserI had wordstar
12:03chouseron an 8" floppy for my CP/M
12:03chouserbut I didn't write any Clojure with it
12:03sproustedw: I don't have that problem at all.
12:03edwI wrote papers for middle school in Supertext on my Apple ][+. It used inverse text to denote capital letters.
12:03sproustedw: I would recommend using bleeding edge SLIME & swank-clojure, works great right now with GNU Emacs.
12:04sproustedw: and don
12:04edwdon?
12:04sproust't mind the naysayers, they'll be switched to emacs within a few years anyway.
12:04edwAh.
12:04sproustEsp. cemerick.
12:04chouserhehe
12:04sproustHe's just dying to switch.
12:05chouseroh! cemerick ... I wanted to talk to you about nREPL
12:05chouserfinally read the proposal in the readme last night
12:05edwsproust: I'm using SLIME from boinkor. Should I get it from the Savannah CVS repo?
12:05edwOr SVN, or whatever the SLIME folks use?
12:06chousercemerick: is the "nil" in the example telnet sessions "out" key intentional?
12:07cemerickchouser: yes -- that's the repl printing the result of the (println 5) expression
12:07cemerickThe intention is that for interactive use, one only ever needs to care about :out
12:07chousercemerick: so "out" include *out*, *err* and repeats the "value"
12:08cemerickchouser: yes, though I don't view it as repeating the value, insomuch as :value is explicitly providing the printed value for use by tooling
12:09cemerickI suppose I should make it so that :value is provided only if requested
12:09chousercemerick: in my brief excursions into repl-writing I've enjoyed taking advantage of knowledge about whether text comes from *out*, vs *err* vs the return value of the expression
12:09chousercoloring each of them differently, for example
12:09cemericksure
12:10chouserI think this can reduce confusion, and I would be sad if the nREPL spec made this implossible.
12:10cemerickhaving the return value split out is critical, of course
12:10chouseror even impossible
12:10TeXnomancyedw: it's better-supported to install slime via package.el; trunk frequently breaks
12:11edwTeXnomancy: Thanks.
12:11cemerickchouser: I'm not super-happy about the mingling of *out* and *err* myself, but it definitely simplified the spike.
12:12cemerickpulling them apart will likely require emitting N response messages per request.
12:12cemerickThat will also resolve the issue of long-running evaluations.
12:12chousercemerick: to color the return value differently as is, I would have to find and remove the "value" from the "out" ?
12:13cemerickas-is, yes. Never considered that one. Are there any other repls that color the return value specially?
12:14chousercemerick: I have a nasty ANSI-terminal color codes repl that does, and texture does too.
12:14chouserI like it
12:14cemerickhow do you find the scope of the printed value there?
12:15cemerickor are you hooking into c.m/repl?
12:15chouserhooking c.m/repl
12:15cemerickok
12:16cemerickIn that case, perhaps the next rev will split *out* and *err*, not print the final value to *out*, but still always include it in :value
12:16chouserI especially like not printing the value to *out*
12:16chousersplitting *out* from *err* while still mixing their chronology would add a fair amount of complexity to the spec
12:17cemerickThat may become an option. I want to make quickie interactive clients as easy as possible to write.
12:17edwYay! I can recover from (+ 1 'a) in SLIME!
12:17chouserthough the code for creating/comsuming that may still not be too tricky.
12:17cemerickchouser: the chronology will be retained -- messages carrying portions of *out* and *err* will be delivered in order.
12:18cemerickchouser: can I get you to outline your ideal in the design notes?
12:20chousercemerick: for quickie clients, (println (str (:out msg) (:value msg))) doesn't seem too onerous
12:21cemerickchouser: 'twas but a bad rationalization :-)
12:23chousercemerick: for *out* and *err* you're thinking of multiple messages per response, for a sort of "live, streaming" feel?
12:24cemerickyup
12:24cemerickN responses per request is already on the todo list for other reasons
12:24cemerickchouser: can you msg me your gdocs addy?
12:35rickmodeI have a protocol method that takes two args like this (foo? [this x] (some test)) and I want to use it like a partial, except it's the second argument that's known, so I'm using a (let [f? #(foo? % a] ...). Is there some variation of partial I can use instead?
12:36rickmodeSorry, that let should be: (let [f? #(foo? % a)] ...)
12:39amalloyrickmode: if it were an interface instead of a protocol you could use memfn, but i don't think protocols work that way
12:41rickmodeamalloy: you mean a protocol method can't be used as first class function?
12:43amalloyrickmode: well, i confess i don't have a lot of experience with protocols. maybe you can, but i don't know how; i was suggesting you might find info on it somewhere near the documentation for memfn
12:43rickmodeamalloy: oic... thanks
12:45MayDanielrickmode: There's a partial function in c.c.str-utils2 for functions that take their primary argument first.
12:48rickmodeMayDaniel: I see it... I think I'll just keep using #(foo % second) ... seems to be just as terse for my case (2 args)
12:48chousermemfn is not useful now that we have #()
12:48chouserprotocol methods are first-class functions
12:52amalloychouser: really? i mean, sure, you can write memfn with #(), but (a) memfn seems a little more self-documenting, and (b) you can't nest #()
12:52chouseryou can nest memfn?
12:52amalloyno, but you can put a memfn inside a #()
12:52chouserheh. oh.
12:53chouseryou can't type-hint the target of memfn
12:54amalloyi guess conceivably you could nest memfn, but it's hard to imagine. "This java method takes an argument of type IFn. Please create a memfn for it, passing (memfn x 10) as the IFn argument."
12:55rickmodeamalloy / chouser: so a protocol *is* a first class fn, with the same performance? or does the run-time wrap the method when it's passed as an arg?
13:03chousera protocol method really is a function, a clojure.lang.Fn
13:05rickmodechouser: thanks
13:05chouserthe compiler does special things to make protocol fn calls as fast as possible, and I'm not sure if it can do that when they're passed as an arg or not
13:05clojurebotWhy are you asking *him*
13:08shooverchouser: what about ->> as thrush? http://clojure.bighugh.com/thrush.html
13:09shoover_fogus_: if you prefer raganwald's version, then his ultimate conclusion is built into clojure: let
13:12chousershoover: ->> is also a macro. are you asking for the function equivalent like I did with 'thrush'?
13:44shooverchouser: nah, just saying I found ->> to be more useful than -> for emulating the thrush combinator a la raganwald
13:45chouserah
13:45shooverIt's more in the spirit of making something close within a given language than making a pure implementation of the mathematics
13:45chouserstill a macro though, not a combinator.
13:45chouser,(->> (* i 2) (let [i 10]))
13:45clojurebot20
13:46chouserI'm not arguing over what's useful, just about names and their meanings.
13:48solussd,(* 7 7)
13:48clojurebot49
13:49kotarak,(->> 5 (* 2) (+1) (when false))
13:49clojurebotnil
13:53chouserkotarak: scary, isn't it?
13:53chouser,(-> what the heck was I thinking? comment)
13:53clojurebotnil
13:54kotarakchouser: not really. This is basically the same effect as you get in C with #define STUFF(x) bla_blub(x); (<- note: ;)
13:54kotarakchouser: just a different level
13:55chouseryeah, I guess. not recommended either place
13:56kotarakchouser: or the binding/recur thing which was on the group recently: sometimes the sewers under the shiny surface smell pretty bad. ;)
14:07AWizzArd,(doc vlist)
14:07clojurebotExcuse me?
14:46LauJensenGents, when I do a "dock center", the component does what its supposed to, but leaves about 3px on each side unpainted, is this some property of the JFrame or the component?
14:47shooverchouser: I'm letting amazing thrush FUNCTION sink in
14:47shooverchouser: er, your amazing...
14:48chouserheh
14:48shooverI think you should call it ..
14:48amalloyshoover: that's "you're amazing", when you're talking about chouser :)
14:48chouserha ha
14:49LauJensenwow, you're still going on about thrush? :)
14:49amalloyLauJensen: worse than that, i just ordered the book with all the birds from amazon
14:50LauJensenoh man :(
14:50LauJensenIts when ordering stuff that it sucks to be the guy whos always right, on the second try
14:50amalloyLauJensen: er what?
14:50LauJensendidn't you describe yourself as such the other morning?
14:50LauJensen"im the guy whos always right on exactly the second try"
14:50amalloyyesssss, i think i did
14:51amalloynot sure what that has to do with ordering
14:51LauJensenwell, if you order the wrong thing on your first try, it costs you money and you have to do it again
14:51amalloyalthough, amusingly enough, i ordered some new RAM yesterday, and then realized it was the wrong kind. and that kinda sucked. so i guess i see what you mean
14:52alpheusIs there something like memoize that provides access to its cache?
14:58tolsenclojure.string seems to have disappeared from the API Overview at http://clojure.github.com/clojure/ . Anybody else notice?
15:04replaca_tolsen: yeah, a few namespaces seem to be missing. I'll get it fixed up. Thanks for pointing it out.
15:06LauJensenchouser: Aren't you responsible for the API docs? ^^
15:09tolsenreplaca_: Thanks
15:11tolsennow's a good time for me to become more familiar with clojure's documentation tools so I don't have to rely on the website so much :-)
15:12LauJensenoh sorry replaca_, didn't see you there
15:12replaca_LauJensen: yup, I'm the responsible party :)
15:12LauJensengreat :)
15:43anonymouse89easy way to list the classes in a jar from clojure?
15:44_fogus_shoover, chouser: http://blog.fogus.me/2010/09/28/thrush-in-clojure-redux/
15:45KirinDave_fogus_: so...
15:45KirinDave_fogus_: Good idea or terrible idea? http://idisk.me.com/dfayram/Public/Pictures/Skitch/current-status-20100928-124429.png
15:45KirinDaveWebmachine port to clojure.
15:45hiredmananonymouse89: http://gist.github.com/601649
15:46_fogus_KirinDave: I don't know much about Webmachine, but I like REST so yes... good idea indeed
15:47hiredmananonymouse89: uh, that function expects the jar as a byte array which is a little odd
15:47hiredmanbut, uh, thats what I had
15:47KirinDave_fogus_: Well, also the plan to use a protocol. But I guess you don't know how webmachine works, so time will tell.
15:47nickikis there a good enlive sample application
15:48chouser_fogus_: not only easier than writing my own blog post, but the results are better as well. Thanks!
15:48chouser_fogus_: slight correction: I'm only the co-author of JoC
15:48_fogus_chouser: My pleasure.
15:50anonymouse89hiredman: thanks!
15:50_fogus_KirinDave: One thing that I've always found lacking is the ability to take a "description" of a RESTful service that used to generate both server and client.
15:51LauJensen_fogus_: Good write-up! thanks
15:51KirinDaveThe client I wouldn't want to generate.
15:51KirinDaveBut I agree on the server part
15:52bmhCan I map over the values of a sorted-map and get a sorted-map back without having to rebuild the whole structure?
15:52_fogus_KirinDave: Why not client?
15:52lancepantzbmh: I don't think so
15:53lancepantzatleast, if you map over a hash, you have to wrap it back using into
15:53KirinDave_fogus_: I have other things to do. :)
15:53lancepantzso imagine it would be the same
15:53_fogus_LauJensen: Thanks. The -> as Thrush posts never quite sat well with me, but it finally crystalized today why that was. (thanks to #clojure)
15:53KirinDaveBut also because client usage of restful services tends to be really varied.
15:54bmhlancepantz: That's really too bad.
15:55_fogus_KirinDave: Fair enough. :-)
15:55lancepantzbmh: i'd bet there's good reason
15:56KirinDave_fogus_: Look, this is gonna be open source. :)
15:56bmhlancepantz: You're more generous than I. :-)
15:56KirinDave_fogus_: So once I've released, maybe we can move forward from there
15:56KirinDaveI was trying to evaluate how to build a correctly-behaving series of API servers in clojure for BankSimple
15:56KirinDaveAnd getting _correct_ behavior is actually really painful.
15:57_fogus_KirinDave: I don't agree on your Emacs theme however, that might be a show-stopper. ;-)
15:57KirinDave_fogus_: I actually changed it just for today to something bright
15:57KirinDaveLight incidence
15:57_fogus_Whew!!
15:57KirinDaveUsually I use Charcoal
15:59_fogus_KirinDave: If you make it to the Conj, then I'm in!
15:59bmhlancepantz: My best guess for an underlying reason is that map operates on keys and values. If you change the keys, uniqueness isn't guaranteed.
15:59KirinDave_fogus_: I can't.
15:59KirinDaveMy dog has cancer.
15:59bmhAll this suggests is that there should be another map function that can't change keys
16:00_fogus_KirinDave: I'm sorry. That's terrible
16:00KirinDaveAlso banksimple and oreilly deal
16:00KirinDaveIt's just one of those deals.
16:01_fogus_KirinDave: I am excited about the book BTW, it looks to be the first O'Reilly book I've bought in ~3 years
16:01hiredman~def fmap
16:01LauJensenDoes anybody know of a library which would let me do fancy animations on regular swing interfaces?
16:02KirinDave_fogus_: Thank you, but I don't think you will find it very illuminating though.
16:02_fogus_KirinDave: I doubt that very much.
16:02KirinDave_fogus_: We're pretty much deliberately aiming at the ruby/python/perl/deep-java convesaion
16:02KirinDaveWe won't even have a chapter on macros.
16:02LauJensenKirinDave: You need to work on your sales skills, seriously :)
16:02KirinDaveWhat have I given birth to.
16:02LauJensenOhh man you're killing it
16:03KirinDaveWe'll have macros
16:03KirinDavebut they're in case studies.
16:03hiredmanthat makes more sense to me
16:03amalloyLauJensen: maybe he's aiming for the self-loathing market
16:03LauJensenamalloy: more like charity :)
16:04_fogus_KirinDave: That's an interesting approach! I look forward to seeing how it pans out
16:05KirinDaveLauJensen: Actually I just want to be honest. If you are in #clojure it'll be a curiosity for you.
16:05KirinDaveIt's for people in #ruby and #rails and #python. :)
16:05LauJensenKirinDave: Fair enough :)
16:05KirinDave“Look, you can do amazing shit with Clojure, and it has all the power of your favorite language (and them some).”
16:06hiredmanI think macros are better shown as working constructs then a bunch of naval gazing form rewriting
16:07chouserI is inside ur navel, rewriting ur forms.
16:07KirinDaveWell, and for clojure macros are WAY less part of the community culture than, say, common lisp.
16:08LauJensenonly because Rich wont give us readermacros :(
16:08LauJensen(j/k)
16:08Chousukeuser-definable reader macros* :P
16:08KirinDaveSo, advice time.
16:08KirinDavehttp://bitbucket.org/justin/webmachine/wiki/BigHTTPGraph
16:08KirinDaveI need to implement this and I am torn.
16:08KirinDaveI could use a functional approach
16:09KirinDaveOR I could make the states actual objects. Both have merit.
16:09KirinDaveThe nice part about making them actual objects is that then they're introspect-able.
16:09hiredman,(pl (↕map (replicate 3 (↕apply vector $ (↕map range $ 10 inc · inc · inc) call · ⌽* $ 10 · call · (⌽+ -2) map)) shuffle))
16:09clojurebot([50 100 60 80 30 20 10 70 90 40] [20 30 80 70 10 40 50 60 90 100] [60 100 70 90 30 80 10 40 20 50])
16:10chouserKirinDave: ick. Really, nobody has implemented that with code you can just use?
16:11KirinDaveUm
16:11KirinDaveIn scala?
16:11KirinDaveIn erlang?
16:11KirinDaveIt's not so bad once you get the epic responder informal-protocol tamed.
16:12chouserit just looks like the kind of code you want to have written and maintained in as few places as possible.
16:12KirinDaveYes.
16:12KirinDavechouser: So to start: https://gist.github.com/02254fca76c1435ce403
16:13Chousukeoh wtf
16:13philjordanchrist, that looks pretty horrendous
16:14KirinDaveEh
16:14KirinDaveThat's how it's done.
16:14KirinDaveDont worry
16:14KirinDaveOnce I have a map with default impls and some friendly macros
16:14philjordanalso, it seems like some of this stuff is a property of the HTTP request, whereas some of it depends on the resource being requested
16:14KirinDaveIt'll be like (html-responder [request] ...)
16:14KirinDaveYes.
16:15KirinDaveIt uses that protocol to plug into the graph
16:15KirinDavehttp://bitbucket.org/justin/webmachine/wiki/BigHTTPGraph
16:15chouserKirinDave: you're sure that should all be data instead of code?
16:15chousershouldn't
16:15KirinDave?
16:15philjordanyeah, I know the graph, I refer to it frequently :)
16:15KirinDaveI think a protocol is probably the right choice here.
16:15KirinDaveUnlike webmachine, i want dynamic responder updates and changes.
16:16KirinDaveSo it needs to be something tied to an object, not a module name
16:16philjordanto be honest, I'd try implementing that protocol for a specific not-quite-trivial resource
16:17KirinDave?
16:17philjordansome of the code will naturally cluster or be similar in some way
16:17hiredmanby object you mean something that the protocol is extended to?
16:17KirinDaveYes
16:17philjordanthen refactor from there
16:17KirinDaveyeah
16:17KirinDavethat's the plan
16:17KirinDavethis is prototype stage.
16:18philjordanbut I have to say, I've been on Clojure hiatus for a couple months now, so I've missed most of the protocols/types stuff
16:18philjordan(I know how it works in theory but have no practical experience)
16:19KirinDavephiljordan: This is my inaugural big project with them, too.
16:20hiredmanI like to use protocols to provide the minimum contract to be fulfilled to participate in a library, then have functions in the library build on the protocol to provide what is needed
16:20hiredmanbecause the protocol is small then it makes it easy to bring other things into the fold of the library
16:20philjordanI'd probably break that protocol up a bit
16:22philjordannot quite sure how to structure it just yet, but I'd focus on grouping functionality by different types of resources - static/cacheable vs dynamic, add an authentication/authorisation layer, etc
16:24philjordanbut the first pass would definitely be a horrendously messy implementation that responds to exactly one kind of request, then add another and see what's common and what isn't, etc.
16:24philjordanI think having it as one giant chunk of predicates is probably overwhelming, realistically
16:25philjordananyway.
16:26philjordanI actually came here with a HTTP related question too.
16:26AWizzArdI would like to try out the new clojure.jar with the bugfix from rhickey about the Int/Long auto translation. In this jar I don't find clojure.set anymore. Is that correct? Were those set fns moved?
16:27@rhickeyAWizzArd: set is not auto-referred
16:27AWizzArdah oki
16:28DeusExPikachuanyone use incanter here?
16:28philjordanbeen out of the clojure loop for a while (half a year?), and haven't done any webserver shenanigans in Clojure for even longer (2008?), so I was wondering what you guys like to use for webserver, dispatching, templating, persistence, etc.
16:29philjordanI'm aware of Compojure, which looks pretty straightforward
16:29kjeldahlI have a project.clj file that only refers to clojure 1.2, but "cake deps" still seems to pull in 1.3 (the pom file). Is this correct, and if so why?
16:29chouserphiljordan: I tend to prefer the cgrand stack: moustache for routing, enlive for templating
16:29ninjuddkjeldahl: does something you are depending on use 1.3?
16:29philjordanwait, I thought mustache was a templating engine
16:29AWizzArdIt is no problem to (require '[clojure.set :as set]) and have the set/fns *and* the function set, right? This is working for me now, but I don't know if it is supposed to.
16:30kjeldahlninjudd: Not that I am aware of, see http://gist.github.com/601716
16:31amalloyAWizzArd: seems like that should work fine. calling a namespace makes no sense, so it won't do that; and function/member doesn't make sense either, so it will resolve the namespace
16:32philjordanchouser: I've encountered enlive in my searches, it seems kind of trippy - what do you do in practice, give your placeholders ids in the HTML and then replace them with enlive queries?
16:32Rayneskjeldahl: It doesn't pull in the jar file?
16:32Rayneskjeldahl: If not, it doesn't really matter.
16:33kjeldahlRaynes: Nope, no jar file. Thanks.
16:33chouserphiljordan: yup. I think cemerick may have pushed it as far as anyone.
16:33kjeldahlI was just curious.
16:33RaynesSome of my projects do that. Not sure why, but it doesn't appear to have any effect on anything. I guess it's just because one of the projects depend on x version, but you depend on y version and your version trumps it's version.
16:33AWizzArdrhickey: very good, thanks for fixing that bug. Another problem with this automatic translation that I encountered was implicitly fixed by this. My old code that expects Ints now works correctly, when I explicitly specify that I want an Integer *handshaking*
16:33RaynesIt only matters if the jar file that depends on 1.3.0 *actually* requires it to function.
16:34kjeldahlYeah, I checked lib and the jar wasn't there, so it can not be used.
16:35ninjuddkjeldahl: yeah, i tried it and i see something is trying to pull 1.3
16:36kjeldahloh
16:37ninjuddkjeldahl: you can require swank-clojure directly instead of lein-swank
16:37Rayneslein-swank is actually in swank-clojure now.
16:39philjordanchouser: right, I think I've found all the bits I need, thanks - Ring, Moustache, Enlive - anything else?
16:39ninjuddkjeldahl: looks like it is enlive
16:40ninjuddenlive has this: [org.clojure/clojure "[1.1.0,)"]
16:41RaynesEw.
16:41RaynesI hate version ranges.
16:41RaynesThey're so often unnecessary.
16:41kjeldahlThanks for the detective work.
16:41Raynes[1.1.0] would be a 'soft' version dependency, meaning that if you required 1.2.0, your version would > enlive's, killing the purpose for a version range.
16:41kjeldahlGot rid of lein-swank as well; works great.
16:42RaynesEr, without the square brackets, I guess.
16:42ninjuddkjeldahl: no problem
16:44tobiasraeder_Can anyone explain me what (defn [[name [& args]]] ...) exactly does?
16:44tobiasraeder_(defn myfn [[name [& args]]] ...) obviously
16:45philjordanhas anyone got any advice for reconciling state in STM with state in persistence (DB)?
16:46philjordantobiasraeder_: myfn will accept 1 argument, which must be a seq, the first element of which will be bound to name, the rest to args
16:46philjordantobiasraeder_: uh, strike that
16:47RaynesThat's an odd destructuring form.
16:47RaynesIsn't [& args] a bit of redundancy there?
16:47philjordantobiasraeder_: 1 argument, a seq. first element -> name, second element also a seq -> args
16:47philjordanbut yeah, that's equivalent (except for enforcing seq-ness) to [[name args]]
16:48philjordanso (myfn ["blah" [1 2 3]]) binds "blah" to name and (1 2 3) to args
16:49philjordannot quite sure why you'd want that...
16:49tobiasraeder_@philjordan thank you
16:53philjordanso yeah, has anyone stored state in Clojure's STM while also storing some in another transactional system (database)? any hints on not making a total cockup of it?
16:54jcromartiephiljordan: don't do it
16:54jcromartiephiljordan: one or the other
16:54philjordanI couldn't really find anything relevant online on the topic, though I might have been searching badly
16:54jcromartiethe problem is that your ref or whatever just becomes a cache
16:54jcromartieand now you're on the hook to handle cache invalidation
16:55jcromartiebecause at *some* point the other system will be updated without going through your functions that make sure both of them get updated
16:56philjordanjcromartie: I do realise this, just wondering if there are any strategies. I'm not thinking of a cache per se, even storing different state in the 2 systems seems like a hard problem.
16:57jcromartieit's the whole reason why we say that mutable state is bad :)
16:59philjordanyes, it's just that (a) a lot of state is transient and writing it to disk is crazy (b) some state is important and absolutely needs to be dumped to disk
16:59philjordanthe best thing I can come up with is some kind of transaction log
17:00philjordanwhich isn't so great for structured retrieval later
17:01philjordan(basically, serialising persistence access, using an agent from a dosync)
17:03philjordanbut reads will go out of sync pretty much immediately
17:06jcromartiehmm
17:06jcromartiephiljordan: I'd pick one persistent store and stick with it.
17:06jcromartieI assume you're building a web app
17:06philjordanyeah, it looks like it.
17:07jcromartiephiljordan: is it a web app?
17:08philjordanwell, the web app I'm about to start building won't have any dire performance requirements, I was just asking in general, as I've encountered the issue before and never solved it satisfactorily
17:08philjordanthe issue came up in a multiplayer game server I built for a customer last year
17:09jcromartieI see
17:09jcromartieyeah I built one web app with Clojure and started to roll my own persistence (refs persisted to disk by agents)
17:09jcromartiein the end, a DB was better
17:09jcromartieat least for the persisted data
17:09jcromartiethere was some truly transient stuff in refs
17:10philjordanthe games themselves were transient, the scores etc of course weren't. didn't run into any issues in practice, and I think I engineered it well enough that there weren't any edge cases, but it was a bit of a mess
17:10jcromartiehm
17:10jcromartiewell that makes sense at least
17:11philjordanwhat's the easiest way to talk to a db from clojure these days?
17:11philjordan(loaded question, ha!)
17:11jcromartiebut I'll tell you that 90% of the bugs in my full-time employment's ASP.NET web app come out of state being stored in multiple places, denormalized and mutable
17:11jcromartieclj-sql?
17:11jcromartieclojure.contrib.sql
17:12jcromartieeasy enough
17:12jcromartiethere's no mature ORM-type library, although that wouldn't really be a good name for something like that in Clojure
17:12yayitsweiis there a way to make "cake compile" not restart the JVM? as it is, I have to restart swank and reconnect my SLIME every time I compile
17:13ninjuddyayitswei: are you compiling java? or just clojure?
17:13philjordanjcromartie: I have no big issue with writing queries explicitly as long as data type mappings are sane and I never, ever have to worry about escaping
17:13yayitsweijust clojure
17:14philjordanjcromartie: do you know of any schema versioning systems for clojure?
17:14jcromartiephiljordan: how about CouchDB? :)
17:15jcromartieoh here http://osdir.com/ml/clojure/2010-02/msg01189.html
17:15philjordanjcromartie: I think I'll pass on that one, I'll be using enough unfamiliar tech for this project as it is
17:15jcromartieyeah
17:16philjordanjcromartie: my last Clojure web project was in December 2008, there were no serious libraries back then
17:16ninjuddyayitswei: yeah. i'm not sure it is necessary to restart if you recompile clojure files
17:16ninjuddyayitswei: i may have just put that in to be consistent
17:17philjordanthanks for the link btw
17:18ninjuddyayitswei: well, i guess it is necessary for gen-class
17:18ninjuddyayitswei: is there a reason you need to aot compile everythin?
17:20ninjuddyayitswei: if there's a reason you need to have :aot :all, then cake needs to restart your project jvm when you compile
17:22yayitsweininjudd: I see, does C-c C-k update the jar files? it doesn't right?
17:23yayitsweiI need to update the files in the class/ directory
17:23ninjuddit doesn't
17:24yayitsweisorry, does it update the classes/ directory?
17:27ninjuddno. it just loads the file into the jvm
17:30yayitsweininjudd: thanks, just verified that
17:32yayitsweioh well, restarting is just one extra step, I can just chain 'compile' and 'swank' together
17:36ninjuddyayitswei: or you can add autostart to your config
17:37ninjuddyayitswei: add this to .cake/config: swank.autostart = localhost:4005
17:37yayitsweininjudd: thanks, didn't know about that
17:37ninjuddyou need a different port for each project if you plan to run multiple simultaneously
17:38ninjuddyayitswei: http://github.com/ninjudd/cake/wiki/Swank
17:38yayitsweininjudd: got it
17:39lpetitI've enhanced the Clojure/OSGi integration notes with a separate part currently (this may change) "Clojure-OSGi manifesto"
17:40lpetitI guess that while such "big picture" goals are not shared by anybody, we will again and again follow separate roads while having the feeling of being on the same.
17:40lpetithttps://docs.google.com/document/edit?id=11G7v_I1DMWisc5pWKWisW85rUkGk9egi_voT4Mp_vQo
17:44lpetitninjudd: hey !
17:44ninjuddlpetit: hey
17:46lpetithave you read the following link ^^^. We're not alone in our quest to make clojure play with OSGi. aav is also very active on the subject, and has already create a repo on github
17:46ninjuddlpetit: We're sorry, but google@justinbalthrop.com does not have access to this document.
17:47lpetitninjudd: I myself have tried some patch experiments on clojure core, including your (ImportExpr), but while talking about it with Rich, there was a problem. ImportExpr seemed somehow correct w/regard to AOT compiled classes. Still banging my head against the wall, though, to understand if this also applies to import statements emitted from regular clojure files.
17:47lpetitninjudd: will try to correct that
17:48lpetithttps://docs.google.com/document/edit?id=11G7v_I1DMWisc5pWKWisW85rUkGk9egi_voT4Mp_vQo&amp;authkey=CKeqoZQJ
17:48lpetitninjudd: new link ^^
17:49lpetitmy congtribution at the end
17:52lpetitninjudd: does it work for you?
17:53ninjuddlpetit: still reading the conversation with rich earlier today
17:54ninjuddlpetit: did that part of the patch actually help solve your problem?
17:55ninjuddthat was the part of the patch i was actually less sure about, but discussion never got past the changes to *use-context-classloader*
17:55lpetitninjudd: you mean the part concerning ImportExpr ? It seemed so. Though Rich arguments somehow made it into my head, and now I'm confused
18:03ninjuddlpetit: yeah. it has been a while since i was trying to do this, so i'm struggling to get my head back around it
18:10cemerickninjudd: you should be able to see that doc, but I can add you for edit
18:11ninjuddcemerick: i can see it now
18:11cemerickninjudd: well, you have edit anyway :-)
18:11cemericklater
18:17ninjuddlpetit: reading the doc. OSGi isn't directly related to what i am working on, but the issues you're dealing with are similar to what i have to deal with if i want to use a single JVM for both cake and the project it is building
19:01lpetit~seen cemerick
19:01clojurebotcemerick was last seen quiting IRC, 49 minutes ago
19:25nathanmarzhello clojurians, looking for some feedback on some clojure code
19:25nathanmarzhttp://gist.github.com/602003
19:25nathanmarztrying to turn a java class into a clojure function for creating objects of that type
19:25nathanmarzso i can do things like (apply mk-fooclass args)
19:28nathanmarzit works, but wondering if there's a better way
19:30ohpauleezdear vim people or users of paredit.vim:
19:30ohpauleezdoes anyone know how to delete matching paren
19:31dnolennathanmarz: do you need to use eval in this case? couldn't you get the class name as a symbol, convert to string to find the class? factory-fn could become a macro.
19:31dnolen,(.getConstructors (Class/forName (str 'java.lang.String)))
19:31clojurebot#<Constructor[] [Ljava.lang.reflect.Constructor;@1e20bca>
19:31nathanmarzdnolen: well i use reflection on the class to get the number of args to the constructor
19:31nathanmarzoh i see
19:32dnolennathanmarz: yeah, I'm just saying that you can avoid the use of eval here.
19:32ataggart,*clojure-version*
19:32clojurebot{:interim true, :major 1, :minor 2, :incremental 0, :qualifier "master"}
19:32nathanmarzyea
19:33nathanmarzis there a practical difference? will the macro code be faster or anything than the function returned via eval?
19:33dnolennathanmarz: eval trigger compilations. You might not want/need that at runtime.
19:34ataggart,(Integer. (byte 0))
19:34clojurebotjava.lang.IllegalArgumentException: No matching ctor found for class java.lang.Integer
19:35nathanmarzdnolen: makes sense, thanks
19:45ohpauleezfor those curious about my my question. <leader>S. Also W, J, O are helpful
21:09reburgif i have some object and i want to get a version of it that complies with some interface, that's a job for reify, right?
21:13reburgoh and i just discovered extend-type, which does precisely what i want
21:13reburgnever mind
22:07hiredmanI think I am going to take a classloader outback and stab it in the stomache and twist
22:10KirinDaveHaving problems?
22:11hiredmanI am trying to replace lein's launching of a new jvm for eval-in-project with using a new classloader
22:12hiredmanI can do stuff like getting the value of *clojure-version* using the new classloader and it is the project's clojure version not lein's
22:12hiredmanbut loading files via load doesn't work
22:16KirinDaveHow does it break?
22:19hiredmanhttp://gist.github.com/602200
22:28TheBusbyhiredman: I'm not sure if this is related, but I was talking with technomancy yesterday about replacing the ant dependency for process spawning with a JNI library.