#clojure logs

2010-08-22

00:01trptcolinah, throwing an exception in the thread: java.lang.IllegalStateException: Can't change/establish root binding of: *ns* with set
00:14technomancyihodes: do you mean to say the repl task doesn't work at all?
00:14technomancyinside or outside a project?
00:14technomancygit master or lein stable 1.3.0?
00:18technomancytrptcolin: I'm thinking we could get rid of eval-without-project and just call clojure.main/repl directly
00:18technomancythere's also the question of whether lein repl should attempt to mimic the args of clojure.main's repl
00:18technomancyhaven't thought that through very thoroughly yet
00:19trptcolinwouldn't calling clojure.main/repl directly circumvent the new port-listening feature?
00:20technomancyoh, of course
00:20technomancyso it could just eval the server form instead of using eval-in-project
00:21trptcolinright, and that was my first attempt, thwarted so far by the need for doing some binding magic with *ns* so it can be changed... not sure how to get around that
00:30technomancywe could still accept as much as we can of the same args as clojure.main/repl and simply pass them through
00:30ihodestechnomancy: no, REPL works. what i've done is clone the git repo, and i'd like to be able to test my changes made there. should i compile/make a jar file and then call my hacked on version of lein with the shell script, or perhaps another way? i'm trying to figure out how you'd test changes you make to lein, as I can't test the REPL from slime/swank
00:31technomancysince lein repl used to be just a wrapper around clojure.main/repl, it used to do this by accident, and some people asked why it stopped working
00:31trptcolinyeah, that seems like a good idea.
00:31technomancyihodes: you can run lein straight from the checkout; there's no need to "build" it other than just getting lein's lib/ dir populated
00:33trptcolintechnomancy: i need to bail for the night, but yeah, having it mirror/call through to clojure.main/repl seems like the way to go. seems like it takes care of the ns-binding issues internally
00:33technomancywell, I'm headed off; let me know how the hacking goes.
00:33trptcolin:)
00:33technomancythanks for your help
00:34trptcolinthanks for yours :) it's great to hack on a project with a helpful & available leader
01:27BahmanHi all!
01:47@chouserBahman: hi!
01:47BahmanHello chouser!
02:32woobyhttp://gist.github.com/543427 - anybody know why this doesn't work the way a fool like i would suspect?
02:40dsantiagoYou're trying to invoke a symbol like it's a function.
02:40dsantiagoWhat that does is try to look up itself in its argument.
02:41dsantiagoFor example, ('Class {'Class 2}) -> 2.
02:58woobydsantiago: thanks, i see
02:58woobymore generally i'm looking for a way to generate a method call
02:59dulanovtry to use defmacro
02:59dsantiagoYeah, you want a macro.
02:59woobyi am, but i hit a wall... it only works with literal arguments
03:00woobyit works also with def'd arguments because i eval what gets passed in, but that doesn't work with locals
03:02woobyhttp://gist.github.com/543427 updated with a new shenanigan
03:04dsantiago(defmacro abc [x] (let [m (symbol (str ".get" x))] `(~m (Object.))))
03:04clojurebotslime-install is an automated elisp install script at http://github.com/technomancy/emacs-starter-kit/blob/2b7678e9a331d243bf32cd8b591f826739dad2d9/starter-kit-lisp.el#-72
03:05dsantiagoThen you can do (abc Class)
03:06Chousukewooby: macros can't work with nonliteral arguments. You can't store the method name in a runtime variable.
03:09woobythanks Chousuke
03:09woobyand dsantiago
03:10Chousukeyou can generate reflective code from a macro though if you need to be able to figure out the method at runtime
03:10woobyi think that's what i should do
03:11woobyhm
03:11woobywell i know what the method should be, i just need a good way of generating it and calling it
03:13woobyanyways, bedtime for me, thanks for the help folks
03:31LauJensenGood morning all
04:42defnmorning
05:03LauJensenI dont think I quite understand this Last Var Win approach to clashes. I have a situation now where I initialize a namespace and several warnings are given that libs are overlapping. Then if I have changed one of my (:use imports) I re-eval the (ns) declaration, which now instead of warning me, throws an exception which is only resolvable by restarting the repl
05:15noidiI'm getting an exception when realizing a lazy seq. The problem is the stack trace only shows the fn that realizes the seq, and the fn is a common helper so I have no idea where the seq might have been created.
05:16noidiany idea how to find out where the buggy seq was created (other than going through the source checking all calls to the realizing fn)?
05:19hoecknoidi: in slime, one can throw or expand the nested exceptions and so maybe find the fn that caused the real trouble
05:20hoecknoidi: other IDEs should provide that too
05:21noidiI'm getting the error during compilation, and mvn clojure:swank compiles before launching swank so I can't get to slime
05:21noidion the bright side that narrows down the calls to the fn quite a bit
05:21LauJensenpaste the code + backtrace?
05:22noidiit would be nice if Clojure printed something like "Caused by realizing a lazy seq at somefile.clj:123" after the stack trace
05:22LauJensenyea that would be fantastic
05:22LauJensenIts actually a little odd that Rich has given more priority to backtraces yet
05:22LauJensens/has/hasnt/
05:22sexpbotIts actually a little odd that Rich hasnt given more priority to backtraces yet
05:22noidithat should be quite doable with metadata
05:23noidiLauJensen, I can't, this is for work, but thanks
05:23LauJensenk
05:24noidithis is bordering on ironic, the seq is realized in a precondition that I wrote just to avoid digging through pages of stack traces :)
05:24LauJensenhehe
05:24LauJensenthe only sure winner is printlines
05:25hoeckisn't that just as easy as (doseq [x (take-while identity (iterate #(.getCause %) <the-exception>)))] (.printStackTrace))
05:25LauJensenDid you see marcyks (?) 'trace all functions in an ns' trick on StackOverflow?
05:25noidino
05:26hiredman,(use 'clojure.stacktrace)
05:26clojurebotnil
05:26hiredman,(doc root-cause)
05:26clojurebot"([tr]); Returns the last 'cause' Throwable in a chain of Throwables."
05:27noidihiredman, thanks, I'll check that out
05:27hiredman~google clj.stacktrace
05:27clojurebotFirst, out of 208 results is:
05:27clojurebotmmcgrana&#39;s clj-stacktrace at master - GitHub
05:27clojurebothttp://github.com/mmcgrana/clj-stacktrace
05:27noidiI get two "Caused by" stack traces alread, doesn't that suggest that Clojure's doing that already?
05:28LauJensenhttp://stackoverflow.com/questions/3346382/clojure-adding-a-debug-trace-to-every-function-in-a-namespace
05:29noidiLauJensen, thanks
05:29LauJensennp
07:44jcromartieI don't think there's a link to http://clojure.org/datatypes on the left-hand side of clojure.org
07:46RaynesAll hail multimethods.
07:47jcromartieare multimethods still relevant in light of deftype and defrecord?
07:48jcromartieor protocols, I suppose
07:53LauJensenYea
07:53LauJensenThey give you more freedom in terms of dispatching
07:56raekprotocols are grouped and have better performance (since they integrate with the host's dispatch system), but are not as general as multimethods
08:08raekI still think multimethods are a good alternative to long conds (typically value-based)
08:08jcromartienownow, here's a question
08:08jcromartiethe docs say "By default, pr and prn print in a way that objects can be read by the reader"
08:08jcromartiebut that's definitely not true for defrecord
08:09jcromartieso what are the persistence implications for defrecord, if they can't be pr'ed
08:10raekthere is a ticket for it: https://www.assembla.com/spaces/clojure/tickets/374-print-read-syntax-for-defrecords
08:13jcromartiecool
08:38noidiis it ok to use promises as a synchronization mechanism between threads?
08:39noidiI call a function in thread A that starts thread B, and I want the function to wait until B has performed it's initialization before returning from the fn.
08:40raeknoidi: do you know about futures?
08:40noidiwould it be bad style to create a promise b-ready and at the end of the function that starts b do a @b-ready
08:40noidiraek, yes
08:41raek(my opinion is that) it would only be bad style if it could have been done with futures
08:42LauJensennoidi: I think all the use cases of promises are still unchartered, but your suggestion doesn't sound offensive to me, because its a phase in the thread you're waiting for and not the entire thread
08:42noidiyup, in my case B is a long-running thread
08:43noidiand I want to make sure that when I start it in A by calling (start-b), B is really ready when the function exits
08:43LauJensenSo you'd either end up using a promise or a global/shared switch of some kind. I would try with the promise first
08:43noidiok, thanks
08:44noidithe reason I asked if it's bad style was that I don't really care about the value of the promise, just that it's delivered
08:44noidibut I'll go with the promise then
08:44LauJensenWell. Back in the day, thats how agents were abused, simply as a way of threading operations, which eventually made the case for futures :)
08:58no_mindwhat is drupal 7 semantics web ?
09:08LauJensenIts a new thing for Drupal which would enable the system to understand contexts which humans intuitively pick up (http://www.cmswire.com/cms/web-cms/call-for-feedback-on-drupal-7-semantic-web-impementation-006392.php)
09:09LauJensenAnything else you need me to google for you? :)
09:55AWizzArdClojure and JNI? I have a C program which I would like to use in Clojure. This is the spell checker program “Hunspell” (used in OpenOffice, Firefox, Chrome, etc). There already IS a JNI lib for that and I use it for over a year already. But its Hunspell version is old, and also does not run on Windows64.
09:56AWizzArdSo I am thinking about writing some bindings to call into Hunspell. Should this better be done in pure Java?
09:57AWizzArdOr are there benefits of doing JNI in Clojure?
09:57LauJensenAWizzArd: Didn't chouser work on clojure-jni interface? And also there was a debate on the ML regarding the naming of what used to be clj-native I think - I cant tell you if they would be preferable to Java in your situation, but I imagine they would
09:57AWizzArdLauJensen: I discovered that chouser did some JNA work.
09:58LauJensenIm not sure if chouser ever worked on anything which he actually completed, but there should be some code floating around :)
09:58AWizzArdI will ask him later about JNI.
09:59LauJensenAWizzArd: btw, doesnt look like Das Keyboard is purchable in Denmark, so its a good thing Im going to Germany before long
10:00AWizzArdLauJensen: yes, if you visit Germany by car, coming from Denmark/North you could make a stop in Kiel and buy one directly.
10:01LauJensenKiel is very close to me, Frankfurt isnt :( I think I'll fly
10:02AWizzArdLauJensen: then you could ask kotarak to order one for you (from Kiel), and meet him in Frankfurt.
10:02LauJensenYea that would work
10:33raekLauJensen: have you tried Das Keyboard yourself? If so, how was it?
10:38LauJensenraek: No - We had a lengthy (and good) debate about keyboards last night, as Im looking to buy a new one
10:38LauJensenAWizzArd got me hooked on Das Keyboard, technomancy suggested Kinesis Advantage or ibms M.
10:43ChousukeModel M keyboards work great for self-defense too.
10:43LauJensenChousuke: So would Das Keyboard
10:43qbgMy Unicomp works fine
10:43LauJensen(its heavily inspired by Model M)
10:44ChousukeLauJensen: Is it equally indestructible? :P
10:44LauJensenTime will tell
10:44LauJensencheck out their website, they promote it as a better M
11:01AWizzArdWell, I had a Das Keyboard and Model M, and definitly find the Das better.
11:03LauJensenAWizzArd: How long have u had it?
11:04AWizzArdI got my first Das around 2006
11:04LauJensenHow long do they last?
11:04AWizzArdDidn’t find out yet :)
11:05LauJensenGood!
11:06AWizzArdThe scooped keys are very nice. I can blindly put my fingers on the keys and feel how they have to be positioned to type blindly.
11:06LauJensenscooped?
11:08AWizzArdhttp://www.tekgear.com/PDF/scooped-key.jpg
11:08AWizzArdOn qwertz this is F and J, and those keys typically have a marker.
11:13LauJensenk, Dinovo has something like that, only its just a slim line
11:14LauJensenbtw, DiNovo is worn down in max 2 years, then the keys start sounding very aged
11:14clojurebotmaxine is http://research.sun.com/projects/maxine/
11:28LauJensentechnomancy, Chousuke, or anybody else knowledgable with Emacs. I have M-. bound to slime-edit-definition in Clojure-mode, yet it never gives me anything other than an exception. What do you guys use to speed-jump to the definition of an fn ?
11:36pdelgallegois it possible to create custom task to run them with Leiningen? I mean the same way that you can create and execute rake task.
11:42LauJensenpdelgallego: Im not entirely sure, but I think that issue might have been one of the factors which made way for 'cake'
11:43pdelgallegoLauJensen, you are right, I just found cake. and it looks like a rake replacement.
11:44pdelgallegocake documentation explains how to create custom tasks.
11:45pdelgallegoit is nice that it support persistent jvm
11:46LauJensenIm still waiting for 1 - 2 hour of sparetime to play with it, but yea it looks very promising
12:08hvassume I don't care about leiningen plugins defined inside a project. Are there other reasons why I shouldn't keep an instance of clojure running and just send -e "(leiningen.core/-main args)" for each project?
12:16gfrlogwould it be accurate to say that vars allow using dynamic scoping?
12:23ChousukeI suppose.
12:23Chousukethread-isolated though.
12:24Chousukeie. dynamic rebinding of a var does not affect its value in other threads.
12:27gfrlogbut it does in other functions
12:36raekthe variables are always lexically scoped, but the value can be dynamically bound
12:37gfrlogaah
12:40raek(def x 1) (defn f [] x) (let [x 2] (f))
12:40gfrlogthat returns 2 I take it?
12:41raekthis would return 2 if clojure would have dynamically scoped vars
12:41raekexactly
12:41raek(def x 1) (defn f [] x) (binding [x 2] (f))
12:41raekahem... I meant "no"
12:41raekthis however returns 2
12:42raekthe symbol x in f is resolved to user/x (the global variable)
12:42gfrlogoh wait
12:42gfrloghmm
12:42gfrlogokay
12:42raekthe let introduces a local value in in the lexical scope of the let
12:42gfrlogso let always creates a new var
12:43raekwhich does not include the inside of f
12:43gfrlogthat then is the crucial difference between binding and let?
12:43gfrlogother than the order thing
12:43raekactually, not a var, but a local name for a value
12:44raekbinding rebinds the global variable to another value temporarily and thread-locally
12:44raekit's like it saved the old value, sets the var to the new value and after everything in the binding form has been executed, restores the old value of the var
12:46raekscoping answers the question "which var/parameter/let'ed-value?" and binding "what value?"
12:46gfrloghmmm
12:46gfrlogokay
12:46gfrlogI believe good sense has been made here
12:46gfrlogthank you.
12:47raekalso, note that the var has to exist before you can rebind it with binding
12:47raeka (def x) is sufficient
12:47gfrloggotcha
12:51BahmanHi all!
13:04hvhow can I add a symbol to 'clojure.core? (intern 'clojure.core '*foo* nil) and then *foo* gives me Unable to resolve symbol *foo* in this context
13:09raekwhat are you trying to do? :) (if you have to, I guess you could alway do a (in-ns 'clojure.core) and then def enything you like)
13:09raek*anything
13:11hvraek: thanks, I think that would be the same as (intern 'clojure.core '*foo* ...). Maybe I am missing something else.
13:11raekuser=> (intern 'clojure.core 'foo)
13:11raek#'clojure.core/foo
13:11raekworked for me
13:12raekah, now I see
13:12raekyou have to (use 'clojure.core) agter that
13:12raekotherwise, the new var will not be referred
13:12hvwell, maybe it is actually added to clojure.core. it is just that the namespace "user" does not get it.
13:13raekhv, yes... intern and def should be the same in that case
13:13raekexactly
13:13raekdoes clojure.core/*foo* work?
13:13hvyes
13:13dnolenhv: (refer 'clojure.core) if you want to get it into the user namespace
13:14dnolenthough I don't see why you'd want to put something clojure.core
13:14raekbut now, why would you want to do all this? :)
13:14hvdnolen: because it is still missing from there :p
13:14raekthen :use that var from another namespace until it appears in core
13:15hvraek: I am lazy
13:16bartjHi, am trying to build a new interface for IRC logs
13:16dnolenhv: heh, what you're doing sounds like about the same amount of work.
13:16raek...or define it in the namespace that needs it
13:16raekwhat dnolen said...
13:17bartjusers will tag relevant conversations with keywords (eg: clojure 1.2/ concurrency/etc) - so that users can follow relevant topics easily
13:17bartjdo you think this would be useful ?
13:17bartjI find that a lot of information / my learning of Clojure was done on the IRC
13:18bartjwhat do you guys think of this ?
13:18rhudsonWho does the tagging? When?
13:19bartjwiki-style -> users do the tagging
13:19LauJensenbartj: I think its an interesting idea to have a logreader which categories conversations based on tags, like if I said 'tag: New IRC reader' then that would become a category. If people would get behind it and support it, it could make for some sweet documentation
13:20bartjI have learnt so much hanging around here...
13:20rhudsonme too
13:20bartjbut scavenging through a lot of old logs is kinda tough
13:21bartjand maybe have threaded conversations too....
13:23bartjLauJensen, thanks!
13:27bartjmay I ask how I can obtain the IRC logs ?
13:27bartjI contacted the freenode guys...and they said they didn't log anything server side
13:27mrBlissbartj: http://clojure-log.n01se.net/
13:28bartjmrBliss, yes but, how is it logged - by a client ?
13:28mrBlissbartj: you could write a bot
13:29LauJensenbartj: You could write a (pirc)bot, but why not just scrape clojure-log.n01se?
13:31bartjam reading the first clojure log here - http://clojure-log.n01se.net/date/2008-02-01.html
13:31RaynesOr, you could use Irclj. :>
13:32bartjand the first question in there by chouser seems so surreal to me
13:32RaynesLauJensen: I'll let you off with a warning this time, but the next time I see you peddling Pircbots rather than Ircljbots, I'll be forced to write you a citation.
13:32LauJensenSorry, ircljbots is your wrapper on pircbot I suppose+
13:33bartjLauJensen, yes scraping is an option
13:34RaynesLauJensen: Nosir.
13:34RaynesLauJensen: Irclj is what I wrote to avoid having to use Pircbot in sexpbot. raek also uses it.
13:34Raynes:D
13:34LauJensenoh ok - whats wrong with Pircbot?
13:34RaynesNothing really. I just wanted something written in Clojure. Preferably by me.
13:35LauJensenRaynes: Im curious, what do you do besides hacking on interesting projects?
13:35bobo_scary, i was reading the source of irclj, tabbed to irc and here you are talking about it
13:35RaynesWatch television and eat sunflower seeds.
13:35LauJensenbobo_: We are very well prepared
13:35hvis there a "with-ns"?
13:35LauJensenRaynes: oh
13:36bartjRaynes, what's the diff b/w irclj and sexpbot ?
13:36bartjand which would you recommend that I use.
13:36Raynesbartj: sexpbot is a bot that uses Irclj.
13:37RaynesIrclj is the library that forms the basis of sexpbot.
13:38RaynesSo, if you want to write your own bot, you'd want to use Irclj.
13:39Raynesraek: Ping me when you push. I'm going to have to take off for a couple of hours soon, so I'm going to try to get a little work done first.
13:39bartjRaynes, I wouldn't want to write my own bot
13:39bartjRaynes, just log the conversations here
13:40Raynessexpbot doesn't actually have decent logging yet. However, it probably wouldn't be hard to write a quick logbot with Irclj.
13:41bartjRaynes, couldn't you point me to some background info/material I would need to write one ?
13:42bartjRaynes, *please
13:43RaynesIrclj's README and API docs are pretty much *it* as far as documentation goes. I also have a small example bot in the examples/ directory of the repository. I'll put a brief tutorial near the top of my TODO list.
13:44raekRaynes: pong!
13:44RaynesWeeee, codes.
13:44RaynesOh noes, merge conflicts.
13:44RaynesNot quite. Local changes.
13:44raekcould be the tabs->spaces...
13:45raekanyway, here's my bot using irclj: http://raek.se/trattern.clj
13:45raekthe irc stuff is at the bottom
13:46raekI'm only using the :on-message callback, but so far that's the only thing I have needed
13:46Raynesraek: Naw, it was just a little change I made after I pushed earlier.
13:47raekright. don't forget to set emacs to use spaces... ;)
13:47RaynesI already did.
13:47RaynesI believe I had that set a while back.
13:47RaynesI must have accidentally only set it for that session.
13:48bartjRaynes, raek thanks!
13:48raekI should create a ticket to get that cond-re macro into clojure.contrib.cond
14:03raekhehe "Cake or death!"
14:29rhickey'equiv' branch now merged into master, primitive args returns et al
14:33LauJensenSweet!
14:34LauJensenWhats the artifact for that, still 1.2-master-snapshot?
14:45LauJensenrhickey: got artifact?
14:54rhickeyLauJensen: no artifact
14:55AWizzArdrhickey: do you already have an idea what "the" main change will be in 1.3?
14:56AWizzArdPods? More Clojure in Clojure? Unboxed numbers?
14:56LauJensenAWizzArd: primitie args returns et al = unboxed numbers
14:57AWizzArdyes, I thought this could come for 1.3 as rhickey already made very substantial progress with this.
14:58LauJensenIf its already in master I assumed it was surefire for 1.3
14:59AWizzArdBtw, Googles boss (Schmidt) just published some info: every 2 days now we create as much information as we did from the dawn of civilization up until 2003 - about five exabytes of data.
14:59LauJensenouch
15:01AWizzArdHe also said that he thinks that mankind is not ready for the technological revolution that is about to come soon. I guess he talks about the Singularity.
15:02LauJensenReally...
15:02LauJensenAWizzArd: Could also be a reference to Das Keyboard II, you never know :)
15:06ScriptorAWizzArd: does that include information that is copied from another source, or is it all new info?
15:07fro0gAWizzArd: yes, give us entropy information about the data
15:09LauJensenWeird: http://beust.com/weblog/2010/08/19/clojure-concurrency-and-silver-bullets/
15:32amalloysuppose i've defined a record as (defrecord Storage [a b]). is there a way i can construct it without having to pass its fields in order? eg (Storage. :b 1 :a 2)?
15:33raekamalloy: you have to make a functiion for that
15:34raekrecords are rarely exposed to the user (at least in clojure.core)
15:34raeka contructor function is very common to have
15:35AWizzArdamalloy: if you created a (def empty-Storage (Storage. nil nil)) then you could use into
15:35amalloyoh, i see. so it's stylistic/idiomatic to internally create a record, but only publicly expose a (make-myrecord) function?
15:36AWizzArdamalloy: in practise a factory fn is often useful
15:36AWizzArdNot always you will want to really store 1:1 data in your records, but instead have some initialization.
15:37AWizzArdRecords may contain internal fields that the user is not supposed to touch, something like that.
15:38amalloyAWizzArd: it seems like if i want information hiding i ought to use a type instead, oughtn't i? as i understand it records are usually used just as a convenient storage space
15:40tomoj(defrecord Foo [a]) (Foo. 1 nil {:a 2}) ; weird
15:42AWizzArdtomoj: yes, there are still some things that can be optimized.
15:43AWizzArdfor example (eval (Foo. 1)) ==> {:a 1}
15:43AWizzArdRecords evaluate to maps, not to themselves.
15:44akhudek,(case (class 1)
15:44akhudek java.lang.Integer :x
15:44akhudek :y)
15:44clojurebotEOF while reading
15:44akhudek,(case (class 1) java.lang.Integer :x :y)
15:44clojurebot:y
15:44akhudekI would have expected :x there :/
15:46nirlyI'm trying to run an example from "programming clojure" which requires that ant.jar and ant-launcher.jar be in the class-path. I'm using clojure box and added "(setq swank-clojure-classpath (list "c:/clojure")" to my .emacs file as was suggested somewhere. The books says to run this command "(def mkdir-task (org.apache.tools.ant.taskdefs.Mkdir.))" in the REPL in order to check that the files are available. I get " [Thrown class java.l
15:46nirlyang.ClassNotFoundException]" when running it.
15:50tomoj-> (case Integer Integer 1 2)
15:50sexpbotjava.lang.ClassCastException: clojure.lang.PersistentVector cannot be cast to clojure.lang.MapEntry
15:50tomojwat
15:50tomoj,(case Integer Integer 1 2)
15:50clojurebot2
15:55kmcwhat's a good document for getting up to speed on the Clojure-specific aspects of Clojure quickly?
15:56kmcsay i'm already familiar with Scheme, Haskell, FP concepts in general, etc.
15:57dnolenkmc: Joy of Clojure ? also I think the website is pretty good.
15:57xternalalso, it's not really a contrast document, but I think labrepl is pretty good for diving in.
15:57kmcwhat part of the website?
15:57xternalhttp://github.com/relevance/labrepl
15:58dnolenkmc: pretty much the entire left column
15:58kmcok
15:58kmcthanks
15:58kmc:)
16:01akhudekhuh, that case thing is odd
16:01akhudekworks everywhere else
16:01akhudekwith =
16:02akhudekor defmulti type dispatch
16:02dnolennirly: ant might not be on that path. I'm not familiar with Clojure Box, but lein can save you a lot of trouble when it comes managing your classpath
16:02amalloywell case is at compile time, so that's surprising in that it's a bug, but not earth-shattering
16:04akhudekso that *is* a bug then? not intended behaviour somehow?
16:05tomoj,(case 'Integer Integer 1 2)
16:05clojurebot1
16:05amalloy*shrug* i'm not a language designer or anything. but it seems to be surprising behavior, so if it's "intended" there's a bug in the documentation
16:06tomoj"The test-constants are not evaluated"
16:06tomojdoc seems fine to me
16:07amalloy"They...need not be quoted"
16:07nirlydnolen: I tried adding the actual directory that contains the jar to the classpath as well (not sure if that's what's needed), I still get the same error.
16:07tomojthe quoted 'Integer there is not a test constant
16:07akhudekah, I see, hm
16:07amalloyoh right
16:08tomojit's the same as (case 'x x 1 2)
16:08nirlydnolen: do I need to add the jar itself to the classpath?
16:08amalloynirly: that's usually the case with jars
16:08nirlyok i'll try
16:09akhudek,(case (str (class 1)) "class java.lang.Integer" :x :y)
16:09clojurebot:x
16:10tomoj.getName to get rid of the "class "
16:10akhudekmaybe I should just use a multimethod instead, although it's ironic because this is for a dispatch function
16:10akhudekessentially I'm trying to group certain class pairs into catagories
16:10akhudekand dispatch on the catagory
16:15kmcbeginner question: i'm told clojure.contrib.complex_numbers provides complex numbers. how would i import this library in order to use it?
16:15akhudek(ns user (:use clojure.contrib.complex-numbers))
16:15amalloyfrom the repl, or in a package you're editing?
16:16kmci'd like to edit a file, then load a repl in its namespace and poke it
16:16akhudekthe above will import all the symbols into the "user" namespace
16:17amalloy(ns my-pkg (:use clojure.contrib.complex-numbers))
16:17amalloythen from the repl (in-ns 'my-pkg)
16:18raekkmc: you also probably need some kind of project management system (for example Leiningen) to start a repl or swank server with the correct CLASSPATH (so that clojure can find the files for my-pkg)
16:20amalloykmc: raek is right. even if you're only editing a single file and not collaborating, leiningen is very handy to have around
16:21raekthere are some good mini-tutorials here: http://www.assembla.com/wiki/show/clojure/Getting_Started
16:21raekjust pick an IDE + a build tool
16:25bobo_dont even need an IDE, lein repl is enough if you just want a repl
16:26tomojdon't even need lein
16:27bobo_true, but then it gets annoying if you want to add deps
16:27tomojindeed
16:27bobo_and lein is probably easier to start then just a clojure repl
16:27rhudsoncljr is a nice middle ground
16:28amalloybobo_: meh. of course i use lein, but with the clj script from clojure.contrib it's not hard to start a repl
16:30amalloywhat's the recommended way to name packages/namespaces? the java-verbose org.mydomain.myuser.myproject.core, or the conflict-prone myproject.core, or some nice compromise?
16:32raekI once had an idea of starting a project name register service
16:33raekcalled something like "cljlibs"
16:33raekso that one could register the project "foo"
16:33raekand then use cljlibs.foo as the namespace
16:34raekmy compromise so far has been to use my relatively short domain: se.raek.foo
16:34raekbut not everyone have their own domain...
16:34amalloyyeah, and my domain is a bit long: org.malloys.akm (i could probly leave off akm, as nobody else in the family will use clojure ever)
16:36amalloyraek: let me know if you ever start cljlibs, so i can snap up project names like "poker" to sell when clojure goes mainstream
16:36raek:)
16:37raekI don't know how to handle those cases
16:37raekmaybe an URL to existent project page should be required
16:38raeksome middle ground between how things are done in clojars and maven's central repo
16:46amalloyi don't quite get when to use protocols. i just want to define a pluggable "strategy" function that takes certain parameters and can be passed to other functions. on the one hand, i would like to have the code reflect the expected parameters, but on the other it seems silly to declare a protocol and create new classes to do nothing but hold a single method
16:56LauJensenamalloy: Have you see the video Stuart Halloway did on Protocols?
16:56amalloyno, i haven't! where is it?
16:57LauJensensec
16:57LauJensenhttp://vimeo.com/11236603
17:14ssiderishello
17:14ssiderisI have trouble running "lein swank" on windows
17:14ssiderishas anyone encountered such problems?
17:15raekwhat happens?
17:21LauJensenssideris: To answer your question: Yea I think quite a few people have had that
17:27ssiderisraek: it says: That's not a task. Use "lein help" to list all tasks.
17:27ssiderisLauJensen: any way to fix it?
17:29raekdid you run "lein deps"?
17:29technomancypdelgallego: it's very easy to create new lein tasks; see the file plugins.md that comes with leiningen
17:29ssiderisraek: yes
17:30raekand add swank-clojure to project.clj?
17:30raekif so, then I don't know
17:30ssiderisyes, I did all that :-)
17:31pdelgallegotechnomancy, ok, Im going take a look. thx
17:31technomancypdelgallego: basically: create a functino called leiningen.mytask/mytask
17:32technomancypdelgallego: if it has an argument called "project", it will be passed the current project; otherwise it will be runnable outside projects. the rest of the args are just the command-line args that are passed in.
17:33technomancypdelgallego: there's no difference between your custom tasks inside src/leiningen/mytask.clj and the built-in tasks, so you can look at the build-in ones as an example, or the plugins on http://wiki.github.com/technomancy/leiningen/plugins
17:34technomancy(not a metaphor)
17:34pdelgallegotechnomancy, I see.
17:36ssiderisis there any other way to run swank apart from "lein swank"?
17:40amalloyfor what it's worth, on my linux box, lein swank resolves into the following command line. you may be able to get it working by replacing the pathnames as appropriate
17:40amalloyjava-Xbootclasspath/a:/home/akm/.m2/repository/org/clojure/clojure/1.2.0/clojure-1.2.0.jar-client-cp/home/akm/.m2/repository/leiningen/leiningen/1.3.0/leiningen-1.3.0-standalone.jar::lib/dev/swank-clojure-1.2.0.jar::src/:-Dleiningen.version=1.3.0clojure.main-e(use 'leiningen.core)(-main)/dev/nullswank
17:41amalloyhrm, the spaces all seem to have been stripped
17:42raekssideris: lein repl, (use '[swank.swank :only [start-repl]]) (start-repl 4005 "localhost")
17:43sunkencityrylehIs there some variant of foldk
17:43sunkencityrylehwhoops.
17:44sunkencityrylehis there some variant of inject/foldl or what it can be called that can operate on several lists at once?
17:46sunkencityrylehright now I zip them together first with (mapcat #(list [%1 %2] ... and then use apply when i iterate on the list
17:46amalloynot built-in, i think, but should be easy to write. what usage did you have in mind?
17:47sunkencityrylehthis is the scenario
17:47raek,(map vector [1 2 3 4] [5 6 7 8]) ; map can take arguments from multiple sequences
17:47clojurebot([1 5] [2 6] [3 7] [4 8])
17:47sunkencityryleh(map last (drop-while #(apply = %) (mapcat #(list [%1 %2]) "FOOFOO" "FOOBAR")))
17:48sunkencityrylehI want to strip off the things that are similar in the beginning
17:49sunkencityrylehan irritating side effect of using mapcat is that the lists need to be the same length
17:49hiredmanhuh?
17:49hiredmando you mean the same depth?
17:50sunkencityrylehmapcat stops at the shortest list
17:50sunkencityrylehor string in this case
17:50hiredmanah
17:50hiredmanright, just like map
17:50hiredmanI was assuming you meant the sublists
17:50raekwhat do you want to return? a sequence of pairs? two sequences?
17:50sunkencityryleha string ideally
17:51sunkencityrylehthe last string in the argument to mapcat
17:51sunkencityrylehbut without the part that similar to the first :)
17:53sunkencityrylehmap vector is a lot cleaner than my list %... thnx
17:55raekI suspect you have to roll you own looping in this case
17:55raekshouldn't be too hard with loop and recur
17:56raekyou kind of wanna do a [(rest a) (rest b)]
17:56derkaHello Guys
17:56hiredmanor just use reduce
17:56derkaIs anybody using clojure on macosx
17:56derkasnowleopard
17:57rhudsonderka: yes
17:57derkacool rhudson
17:58derkahow did you setup clojure, i am trying to learn clojure, reading programming clojure book from stuart halloway, but cant find a way to properly install stuff. i havent touched java since the 90s so the setup is complicated for me :)
17:58derkaand i am lazy
17:58derka:)
17:59sunkencityrylehraek: thanks
17:59rhudsonI've had Java on my Mac forever so I don't remember if that's part of the standard install or not. It certainly updated Java when I upgraded to Snow
17:59rhudsonDo you have Java on your machine?
17:59derkayes java is installed by default, java 1.6
18:00rhudsonOK. Probably the easiest way to get started is to use cljr.
18:00derkain /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/bin/java
18:00rhudsonYou download a script that downloads everything else you need.
18:00AWizzArdderka: first you should decide with which environment you would like to work. A very simple start would be to download clojure.jar from http://build.clojure.org/ and put it somewhere on your disk, open a shell and cd into the right directory and then do: java -cp clojure.jar clojure.main
18:00derkacljr? is that: http://github.com/carlism/Clojure-MacOSX/
18:00rhudsonNo, let me find the ref
18:01derkaok thanks rhudson
18:01AWizzArdBut you can also work with Emacs, Vim, NetBeans or Eclipse.
18:01derkathanks awizzard, i have used clojure.jar already, but in the programming clojure book there are lot of examples to test, and i need to seutp the environmment
18:01derkaawizzard i am using textmate
18:01rhudsonhttp://github.com/liebke/cljr
18:01derkathx rhudson
18:01rhudsonThere's a Clojure bundle fore TextMate apparently
18:02rhudsonhttp://www.assembla.com/wiki/show/clojure/Getting_Started_with_Textmate
18:04derkathx a lot rhudson
18:04derkaand awizzard
18:08rhudsonAWizzArd, the reason I recommend cljr in cases like this, is that it's about the easiest way I know of to get a repl with clojure-contrib and jline on the classpath.
18:09AWizzArdyes sure, the example I gave is the most basic way to start with Clojure, it is only sufficient for small tests
18:09rhudsonRight. I'd be dead without jline
18:13amalloywait, i was expecting records to behave like maps: (defrecord Foo [a]) ((Foo. 17) :a)
18:16rhudsonamalloy, as you found out they're not
18:16rhudsonThe (:a foo) form is very efficient
18:16amalloyoh, and (foo :a) isn't? i see
18:17amalloyi was thinking it'd make it awkward to get at items of a nested record hierarchy, but (.. foo bar baz) is more readable than the map equivalent
18:18raekshouldn't get-in work for records too?
18:18amalloyprobably. i just don't know get-in exists :)
18:19raekget-in, assoc-in and update-in is a neat family of functions :)
18:19amalloyi knew about assoc and update, but managed to not find get
18:20raekI often use get when both the key and and the map are variables
18:20amalloyddsolve.core> (get-in posn :state :trumps)
18:20amalloy; Evaluation aborted.
18:20amalloyddsolve.core> (.. posn state trumps)
18:20amalloy:nt
18:21raek,(get-in {:a {:b {:c 1}}} [a b c])
18:21clojurebotjava.lang.Exception: Unable to resolve symbol: a in this context
18:21rhudsonyou can also do (-> posn :state :trumps)
18:21raek,(get-in {:a {:b {:c 1}}} [:a :b :c])
18:21clojurebot1
18:21amalloyoh sorry, it works - forgot you need a seq of keys, not variadic args
18:21raekyeah, get-in and -> have some overlap
18:24danlarkinhiredman: pingaling
18:26hiredmandanlarkin: pongalong
18:38rglwhich book do you guys advice me to buy? I was thinking Programming Clojure but I'm affraid it might be outdated that news ones like Practical Clojure?
18:38amalloyi've enjoyed (ha ha) The Joy of Clojure
18:39ssiderisis "the joy" out yet?
18:39arkhamalloy: a good link re: clojure books is here - http://stackoverflow.com/questions/2578837/comparing-clojure-books
18:39rglthat one is not in print yet
18:39amalloyno, i don't think it's out, but the MEAP has almost every chapter
18:39arkhssideris: JoC is not out in print yet but you can get the full unedited version through the MEAP program
18:40amalloyand it discusses 1.2 features, which must be a plus if you don't want to be "outdated"
18:45raekif you are a beginner, I would recommend Programming Clojure
18:45raekI don't think that is outdated
18:45raek*it's
18:46rhudsonThe only parts that's outdated is the "getting started" stuff -- other than that it's a great into
18:46rhudson=> intro
18:46raekimho, the new stuff in 1.2 does not replace older stuff
18:46arkhI still find Programming Clojure really useful and it's only occasional that I need to remind myself what's in the changelogs for 1.1 and 1.2
18:47raekthere are more features to fill the gaps that existed in 1.1
18:47raekat least when considering protocols
18:49arkhyeah, e.g. Prog Clojure doesn't go into deftype and defrecord very deep and says nothing about reify (along with protocols) All that intro information can be found at http://clojure.org/datatypes easily enough.
18:50rglthx guys :-)
18:50arkhthat is to say, introductory information can be found on those topics there - not saying those are all introductory features ;)
18:50Raynesarkh: Programming Clojure doesn't go into deftype and defrecord *at all*.
18:50RaynesIt was Clojure 1.0.
18:50rglI'll get practical clojure for starting with clojure. Later I'll get the joy one :-)
18:50Raynesraek: It's very outdated.
18:51arkhRaynes: defrecord is on page 5. It's not much though, more of a "this exists"
18:51Raynesarkh: Really?
18:51RaynesI never saw it.
18:51rglwhat you guys think about enclojure.org?
18:52rhudsonarkh: that's not the 1.2 defrecord per se -- it's handwaving about how you can add things like that with macros
18:52arkhrhudson: true
18:54arkhrhudson: lol, yeah, that's well put
18:54rhudsonBut we know it's handwaving that's fully backed up!
18:55arkhRaynes: you're pretty much right
18:55RaynesI haven't read that part of the book in a long time.
18:55RaynesOr any of the book for that matter. I usually refer to Joy now.
18:55rhudsonStill, I think you need to know most of 1.0 Clojure before protocols and datatypes makes sense
18:56amalloyagreed. i used JoC as my intro book and pretty much glazed over that chapter
18:56rhudson:)
18:56rhudsonI think JoC is a great second book
18:57amalloy"this sounds pretty cool, i wonder what it all means"
18:57arkhI really look forward to the print version. It's easier on the eyes to read a book that way (no e-reader in my inventory)
18:57amalloyit's coming soonish, isn't it?
18:57rhudsonSept I think
19:01amalloydoes anyone know how a map is stored internally? i don't plan to rely on any implementation details, i just wonder how well clojure can avoid new'ing objects for operations like assoc
19:04arkh, (class {})
19:04clojurebotclojure.lang.PersistentArrayMap
19:04arkhamalloy: check out the source for ^^^
19:04amalloythanks
19:05arkhamalloy: there's a bunch of videos Rich has done, too, like http://blip.tv/file/812787
19:06arkh(sort of OT to your question, but they're good to see)
19:07tomojamalloy: clojure can't avoid new'ing objects for assoc
19:07tomojmaybe I don't understand what you mean..
19:08amalloytomoj: certainly it has to new *some* objects, eg the new map and the new key
19:09amalloybut does it manage to reuse references to the old key/value pairs or does it have to make new Entry's as well, was what i was thinking about
19:10tomojamalloy: http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/ and http://blog.higher-order.net/2010/08/16/assoc-and-clojures-persistenthashmap-part-ii/ might be helpful
19:10amalloytomoj: thanks!
19:12tomojlooks like it only has to create new nodes in the trie for the path from the root to the new entry
19:13tomojPersistentHashMap will probably be more interesting than PersistentArrayMap
19:14tomojand it might be easier to start with vectors http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/
19:14amalloyyeah, i'm reading vectors
19:20arkhRaynes: none of my business, but will you be going to college earlier than the usual 4-years-high-school-then-college? Have you picked a college?
19:21RaynesI'm in 11th grade.
19:21RaynesWhether or not I'll go to college is up in the air. At least immediately.
19:21RaynesIt'll probably be a while, if I do.
19:21arkhthat's totally cool - I went right away and it probably wasn't the right time
19:22tomojRaynes: wow, nice head start
19:22Raynestomoj: ?
19:22arkhI hope you're not too frustrated by the way classes are structured, i.e. I hope you find a program that accommodate where you are with your learning
19:23arkhs/accommodate/accommodates
19:24arkhmaybe Relevance will hire you out of "high school" ;)
19:24Raynes:p
19:24RaynesI'm doubtful.
19:24Raynes;)
19:47amalloysuppose i have (defrecord Foo [a b]) (let [f (Foo. 1 2), accessor :a]). is there a more-clever way to get a result of 1 than (get f accessor)?
19:49AWizzArdamalloy: did you try (accessor f)
19:50amalloy*blink* well, apparently not, lol
19:51amalloythanks
20:24bortrebwould a function still be pure if it opened up a swing gui window but then closed it before it itself terminated?
20:28polypusbortreb: not if the gui can affect your application state in any way. the function might always return the same value, but calling it pure would be a bit of a stretch
20:40bortrebbut let's say it's just an empty window, and then it gets destroyed and garbage collected
20:41tomojno.
20:41tomojif you take the call to this function and replace it with its return value, the program will behave differently
20:42bortrebthat's a very good point, but it depends on what you mean by bahave differently doesn't it?
20:43bortrebbecause, it seems like it's exactly the same as creating a mutable java object, getting something from it, and destroying it -- that is still pure isn't it?
20:43Raynesbortreb: Not open a GUI qualifies as behaving differently.
20:43RaynesGreating GUI window is a big fat side effect.
20:43RaynesCreating a*
20:43bortrebbut if you could see the memory changing (like the led's on a connection machine) it would bahave differently
20:44bortrebso does it really depend on the observer and what he considers "different" ?
20:44amalloybut then no function could be pure, because they all change memory
20:44bortrebwhat if it's on a headless machine and you don't ever see the screen, is it pure then?
20:44tomojjust curious, why do you care?
20:45dreishAnyone recognize this error from "lein native-deps"? Exception in thread "main" java.lang.IllegalAccessError: default-repos does not exist (native_deps.clj:1)
20:45bortrebI wanted to know a more rigorous definition of "pure" -- it seems like the "pure" we throw around everyday is actually relative!
20:46tomojif you want to get rigorous I think you'll have to talk about imaginary computers
20:47tomojbut, of course it's relative. if you consider the noise your computer makes an output of your program...
20:48bortrebI wrote a function using the ImageJ to transform images. that library is so tied to gui that it opens up a blank window for ~1 ms. But if I had to classify it as pure or not, I'd say it's pure...
20:48RaynesI'd disagree, but that's just me.
20:49bortrebbut then you turn your monitor off or disable x, and it's suddenly pure?
20:49bortrebit seems you have to wither accept that or say that literally no function is pure which seems like a paradox
20:50tomojif you disable x, won't the function throw an error?
20:52bortrebYou could always intercept the call and just not display the window, but I think just turning your monitor off or running it on a headless machine is a better example
20:53bortrebmaybe the concept is "pure at this level of detail" ?
20:53tomojif a program prints to a file and no one ever looks at it, did it do any I/O?
20:55tomoj(I mean, it doesn't matter to me whether the monitor is on :))
20:55bortrebdepends whether your monitor's on
20:56tomojif my monitor is off, my program doesn't do file I/O? O_o
20:56bortrebif the hard disk played a song whenever a file was written to it, they maybe yes, but only if you care about sound?
20:57bortrebif you don't care about sound, then it's pure w.r.t anything non-sound related?
20:57@chouserthe real question is -- why do you care?
20:57Raynes<bortreb> I wanted to know a more rigorous definition of "pure" -- it seems like the "pure" we throw around everyday is actually relative!
20:57@chouserif you memoize the function, will your program still work correctly?
20:58@chouserif you call the function in a transaction, and the transaction retries, will you program still work correctly?
20:58@chouserthose are more interesting questions than the definition of "pure"
20:58bortrebthat's the thing ---- it _would_
20:58bortreb.... unless you care about the screen
20:58@chouserthen it's "pure enough" *shrug*
20:59@chouserhm...
20:59bortrebI think there's different levels of pure
20:59bortreband the definition we use is: it doesn't change any state we can _see_
20:59clojurebotyou're doing it wrong!
21:00bortreblol clojurebot
21:01tomojdoes referential transparency require that you can replace a single call with many calls?
21:01RaynesRegardless of whether I can see it or not, if my function does something other than compute a value and return that value, I'm going to say it isn't pure.
21:03tomojI mean, e.g. if your function which opens a window is called a million times in parallel and opens a million windows...
21:03bortrebbut to "compute a value" it still has to do physical things in the reality in which it is embedded --- what's the difference between moving a robotic arm on your hard drive platter to go to the memory location of a function definition and having your "hard drive" be a tape archive that requires a 2-ton robot to do the same?
21:05bortrebactually, that's exactly what it does and it makes me very sad, but in terms of taking in a bitmap and giving me a log-polar transform of that bitmap, it works correctly and is referentially transparent
21:07Raynesbortreb: There is a crucial difference between you and I: I don't care. ._.
21:09bortrebRaynes: fair enough! but it's interesting to think about sometimes nevertheless
21:11dreishLooks like lein 1.3.0 breaks native-deps 1.0.1. :(
21:12dreishAnyone know how to reach dnolen?
21:30defnhmmm, is it possible to define 5 defs with different values attached to them all at once?
21:30defn(def foo "bar"), (def baz "bees"), ...
21:31defni think i want defmulti
21:32tomojreally?
21:32defntomoj: what would you do
21:33tomoj(def foo "bar") (def baz "bees") ... or write a macro
21:33tomojI don't see how defmulti will help you
21:34defn:foo, :baz
21:34polypustechnomancy: you around? if i follow the instructions for lein-clojars and put :repositories [["clojars" "http://...&quot;]] in project.clj, lein spews this out: Exception in thread "main" java.lang.IllegalArgumentException: Vector arg to map conj must be a pair (NO_SOURCE_FILE:0)
21:34defndispatch on those and return their values
21:34tomojbut then you still have to defmethod for each, no?
21:35defnoh...right :)
21:35tomojand if you're doing that, you might as well just (def blah {:foo "bar"..}) and (:foo blah)
21:35defn*nod*
21:35polypusok i see the leiningen sample project has a map there instead. the instructions at lein-clojars are wrong
21:36tomojbut maybe something like (defmacro defbymap [m] (list* 'do (for [[k v] m] `(def ~k ~v)))) ?
21:39defnyou're awesome tomoj
21:41defntomoj: i still do not understand macros
21:41defnteach me your magic
21:45defn(doc list*)
21:45clojurebot"([args] [a args] [a b args] [a b c args] [a b c d & more]); Creates a new list containing the items prepended to the rest, the last of which will be treated as a sequence."
21:53tomojor (defmacro defbymap [m] (list* 'do (map #(list* 'def %) m))) :D
21:54tomojit's just `(do ~@(for [[k v] ...
21:59tomojare there any examples of &env usage out there?
22:00qbgI think it is used in the serializable function library
22:02tomojah, yeah, thanks
22:02tomojso you do have to dig down through some undocumented java methods to use it.. strange
22:02ihodeshttp://github.com/technomancy/serializable-fn
22:03ihodesyeah it's a bit sketch
22:03tomojmaybe the java part of clojure uses it?
22:03ihodesi *think* it's used in conjunction with macros, specifically...? (tell me i'm wrong?)
22:04tomojyeah, it's for macros, but nothing in the clojure part of clojure seems to actually use it
22:04ihodesyeah i think it's what is passed to macros at macro-expansion time
22:05ihodessince it's only, along with &form, in macro definitions
22:06polypusdefn: could also go macroless (defn keydef [& kvs] (doseq [[k v] (partition 2 kvs)] (intern *ns* (symbol (name k)) val)))
22:06polypus
22:06polypusval should be v
22:07defnpolypus: cool
22:13hamzais there a particular reason for leiningen plugins not including lib folder in classpath?
22:14polypushamza: do you mean the classpath of the lein process itself or the project classpath?
22:15hamzaproject classpath
22:15hamzaI can't access any dependencies from my leiningen plugin because lib/ is not on the classpath
22:15polypusin that case i think you'd have to include the lein plugin as a regular dependency of your project and not a dev-dependency
22:16polypusor maybe i'm misunderstanding
22:18hamzaI have a plugin that I am writing which needs to access a jar now the jar is in lib/ but when lein runs lib folder is not on the classpath so plugin crashes with class not found.
22:18hamzaI am not using someone elses plugin
22:18defni need some good excuses to make up some macros now...
22:20polypushamza: are you running lein from within your plugin's directory to test it?
22:21hamzano i am running it from the project directory
22:22tomojyou're running lein in project/ and you want plugin/lib/ on the classpath?
22:22tomojor project/lib/^
22:22tomoj?
22:23hamzarunning from project/ and I want project/lib/ on the classpath
22:23tomojwell, that's odd
22:23polypusok so you have two projects, one for the plugin, and one that you are using to test the plugin right? if in the test project you have your plugin as a :dev-dependency then lein should pull in whatever jars are required by your plugin
22:23tomojoh, maybe I see
22:25hamzapolypus: I have only one project.
22:41polypushamza: try the two project method i mentioned above and see how you go, works for me
22:44polypusi'm pretty sure it is has to do with all of your plugin's dependencies being pulled into /lib/dev when you use the two project method
22:46tomojdoes that mean that swank-clojure has to dev-depend on itself if you want to `lein swank` with it?
22:46defnis there a quick way to get a-z as a list of strings, like ("a" "b" "c"...)
22:47hiredman,(map char (range 97 140))
22:47defnlike a range, but for letters?
22:47clojurebot(\a \b \c \d \e \f \g \h \i \j \k \l \m \n \o \p \q \r \s \t \u \v \w \x \y \z \{ \| \} \~ \ \€ \ \‚ \ƒ \„ \
22:47defnoh right...thanks
23:02slyrus,(map (comp str char) (range 97 100))
23:02clojurebot("a" "b" "c")
23:02slyrusif you want strings
23:03defnslyrus: cool, thanks
23:03defnthat's handy
23:04defncomp is great -- why do i never use this?
23:58amalloyi find myself using update-in in a way that seems silly - what's the right way to do this? (update-in m [keyword-var] inc)
23:59amalloyi could (assoc m keyword-var (inc keyword-var m)) but that looks worse