#clojure logs

2011-02-28

02:38Null-AWhen the repl evals a record, how control its printed value?
02:39Null-Aits not calling toString, I tried overriding that
02:44tomojit's the print-method multimethod
02:44tomoje.g.: (defrecord Foo []) (defmethod print-method Foo [f w] (.write w "foo!"))
02:56Null-Atomoj: thanks
03:00tomojdo question marks in protocol fn names cause trouble?
03:08amalloyi don't think so
03:11tomojhuh, this is odd
03:11tomojhttps://github.com/ztellman/lamina/blob/master/src/lamina/core/observable.clj#L23-37
03:11tomojeven if I change it to is-consumer, I get "Can't define method not in interfaces: is_consumer"
03:12tomojwonder if it could be a checkout dep problem..
03:14tomojwtf
03:15tomojlein installing and removing the checkout dep, I can now use the namespace. C-c C-k'ing the file still gives the same error. if I call consumer? on that reify'd I get "No single method: consumer_QMARK_ of interface: lamina.core.observable.ObserverProtocol found for function: consumer? of protocol: ObserverProtocol"
03:16tomojoh, somehow the lein-install'd version doesn't have that protocol fn
03:18tomojbecause it's not the code that was sitting there when I `lein install`d...
03:18tomoj..because I didn't run `lein deps`. d'oh
03:23tomojand shucks, with the jar actually in place I get the same old "can't define method not in interfaces"
03:26amalloytomoj: i have this issue anytime i try to deal with protocols, because i do it rarely enough that i can't get the syntax right :P
03:26tomojI figured it was an arity problem, but I've triple checked
03:27amalloyi can verify that question marks aren't an issue, though - found a project of mine with an after? protocol method
03:28tomojswitched to is-consumer and leininstall'd just to be sure, same problem
03:28tomojinexplicably
03:29tomojI'll just hope ztellman runs into this problem too
03:29tomojseems like he probably wouldn't have committed it if so, though, it actually breaks the entire library
03:31tomojwait, but the tests run fine
03:31tomojshoot
03:31tomojAOT'd crap from older versions in my project
03:33tomojand I guess the reify gets checked at compile-time before the C-c C-k would have eval'd the new protocol in
03:33tomojor something crazy like that
05:09n1kayaWhen can I expect to see Clojure on GHC ?
05:12ChousukeIs someone working on that?
05:13n1kayano thats why I'm in here trying to spur one of you to do so :D
05:14n1kayaright now people complain they can't use clojure for system programming because of it's slow startup time.
05:14n1kayaa GHC clojure would probably solve that
05:15n1kayaplus the source code for the implimentation might actually look somewhat sane in constrast to the java sources for clojure
05:16n1kayaI'm not dissing clojure's source code I'm just saying it's highly unusual as far as java code goes.
05:16Fossii'd rather do an erlang one
05:16Fossior actually dalvik first
05:17n1kayaouuuhhh mobile clojure.
05:20Fossiit works, but it's slow as hell
05:21hoeckn1kaya: running clojure on top of python could probably achieve sth. similar
05:26Fossithe hardest part are the datastructures anyway
09:35octehow can i define a macro that defines a function with params that are not passed to the macro and use them? for example: http://pastebin.com/dB9EJjj6
09:35octegives "can't use qualified name as parameter"
09:36fliebelocte: I think you need to use some weird combination of quoting and unquoting for that.
09:37fliebelClojure turns one into foo.bar/one, which isn't valid.
09:37morphlingocte: `(defn ~'foo ~'[bar])
09:38fliebelBesides that, it is considered bad style to do that, unless you really need to.
09:38octefliebel, i don't really need to, just experimenting
09:38fliebelocte: In that case, go ahead, there is a lot more funky quoting to be explored.
09:39octeindeed
09:46TimMcWhere can I go to learn how namespaces, symbols, vars, and quoting work in Clojure?
09:47TimMcI feel like this is the last bit of the basics that I just don't get.
09:48cemerickTimMc: If you carefully read everything on clojure.org, you'll have the basics. Specifically, see clojure.org/libs and clojure.org/vars
09:48cemerickBeyond that, there are some very good books available. :-)
09:48TimMcheh
09:48_fogushear hear!
09:48TimMcI completely forgot that I'd bought a Clojure book.
09:49_fogusTimMc: It left a deep impression on you clearly. ;-)
09:49TimMcmeep
09:51TimMcI think today will be a reading day.
09:51TimMcJust you and me, Stuart.
09:51TimMc(I hope that didn't sound creepy.)
09:52TimMcAnyway, part of what's tripping me up is my Scheme background, where symbols are pretty simple, for the most part.
09:53TimMcI never had to learn the interned/uninterned thing, though.
10:13pdkwhat's different in the handling of symbols in scheme vs clojure
10:13TimMcpdk: I don't recall namespaces in Scheme. 'foo was just 'foo
10:14TimMcThey were used the way keywords are in Clojure.
10:39TimMc,(.toUpperCase \a)
10:39clojurebotjava.lang.IllegalArgumentException: No matching field found: toUpperCase for class java.lang.Character
10:39TimMcIt's interesting that Clojure doesn't support calling static methods as instance methods, while Java does.
10:40companion_cube(.toUpper \a)
10:40companion_cube,(.toUpper \a)
10:40clojurebotjava.lang.IllegalArgumentException: No matching field found: toUpper for class java.lang.Character
10:40TimMc,(Character/toUpperCase \a)
10:40clojurebot\A
10:40TimMc(Don't get me wrong, I think this is a good thing.)
10:42ChousukeTimMc: I think it might have something to do with the fact that the java compiler can figure out at compile time whether the method is static or not.
10:43TimMcIt might also be a convenience for the Java compiler implementors, since they can then treat any unqualified method call as this.method()
10:44TimMc...though I suspect this was very much in the initial specs.
10:46TimMc$findfn true true
10:46sexpbot[clojure.set/union clojure.set/intersection clojure.set/difference clojure.core/== clojure.core/time clojure.core/dosync clojure.core/true? clojure.core/with-loading-context clojure.core/distinct? clojure.core/boolean clojure.core/doto clojure.core/macroexpand-1 cloj... http://gist.github.com/847475
10:55sritchie_hey all -- is there a command in clojure to reload the current namespace?
10:56sritchie_I'm working with the cake textmate bundle... it has a nice load-file key command, but the problem is that if I'm in a namespace, load-file doesn't reload the definitions inside that namespace
11:07raeksritchie_: (require 'the-ns :reload)
11:08sritchie_raek: I know that *ns* refers to the current namespace --
11:08sritchie_is there a way to get the symbol from *ns*, rather than the namespace?
11:09raekhrm. yes. I just found ns-name
11:09raekso you should be able to do something like (require (ns-name *ns*) :reload)
11:11sritchie_great, let me check that out
11:12sritchie_looks like (in-ns (ns-name *ns*)) works great
11:12sritchie_od
11:12sritchie_d
11:14raekswitch namespace to the current namespace?
11:21sritchie_raek: well, yes
11:22sritchie_raek: because load-fle doesn't load any new vars
11:22sritchie_if you're in the current namespace
11:22sritchie_but calling in-ns forces that
11:23raekI don't understand. in-ns just sets which namespace is the current one
11:23sritchie_raek: this might be a cake issue
11:24sritchie_but at the repl, if I load a a file, do (in-ns 'the.namespace),
11:24sritchie_then add something like (def testtext "test!") to the file, and call load-file again
11:24sritchie_testtext isn't available
11:24raek(doc load-file)
11:24sritchie_I get "unable to resolve symbol"
11:24clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
11:25raekI would recommend using (require ... :reload) instead
11:26sritchie_that doesn't work, though
11:26raeksritchie_: if you are use'ing the vars from another namespace, new vars from that namespace will not automatically be use'd
11:26sritchie_raek: I'm talking about the same namespace
11:26raekwhy doesn't the requier way work?
11:26sritchie_so, if i"m in project.playground, add a var, then load that file
11:26sritchie_I keep getting "unable to resolve symbol")
11:27sritchie_now, once a var exists, load-file updates its definition
11:27sritchie_new vars just don't get registered
11:27raekthat's odd..
11:27raeksritchie_: and you quoted the namespace name in the require call?
11:28sritchie_yeha
11:28raek(or used (ns-name *ns*))
11:28sritchie_yeah*
11:28sritchie_no, I tried both ways
11:28sritchie_raek: it's a problem that I'd only have noticed because of how textmate loads files, in the swannodette textmate-clojure bundle
11:28raekare you sure that there isn't any typos in the source file?
11:28sritchie_I'm usually in emacs, and this is fine
11:28sritchie_raek: yeah, because (in-ns 'the.namespace) works without any changes
11:29sritchie_picks up the var immediately
11:29raekwhat does *ns* eval to after you do the load-file call?
11:30sritchie_#<Namespace forma.playground>
11:30semperoshow would I redirect *out* to a Swing component, e.g. JTextArea?
11:30raekthe same namespace you were in before loading?
11:31raekand this is direcly in the clojure repl?
11:31raekwhen the source file is evaluated, the vars change directly.
11:32raekthere should not be any "cache" or anything that needs to be flushed
11:33sritchie_yeah, in the repl
11:33sritchie_same namespace
11:33sritchie_I get that, that's why it's so odd
11:57amalloyocte: whoa i srsly disagree with the quoting advice you got earlier
11:58amalloyoh no, i see, you're doing unhygenic stuff on purpose
11:58amalloymove along, nothing to see here
11:59octeamalloy, yeah
11:59octe:)
12:01amalloyand actually you sometimes have to do this even in a hygenic macro, eg (defmacro foomacro [name] `(defn ~name [one# ~'& two#] (do stuff with one# and two#)))
12:22octeamalloy, what's the difference of an unhygenic macro?
12:22octeerr, definition*
12:23amalloyocte: meh, i think it's kinda vague. i use it to mean "polluting the caller's scope with symbols the caller hasn't given you explicit permission to use"
12:23amalloythere's a specific name for my definition, but i can't remember it. anaphoric, maybe
12:24octewell, that's what i thought
12:34sritchie_raek:
12:34sritchie_hey, are you still around?
12:35sritchie_The comment in this answer on SO seems to point to the issue --
12:35sritchie_http://stackoverflow.com/questions/5023349/if-i-load-a-file-with-ns-my-namespace-in-it-why-doesnt-it-switch-my-current-n/5023707#5023707
13:01drewr,,(first (.getBytes "foó" "UTF-16"))
13:01clojurebot-2
13:01drewr,(first (.getBytes "foó" "UTF-16"))
13:01clojurebot-2
13:01drewrinteresting; that hangs my swank repl
13:01drewrbut UTF-8 doesn't
13:07fliebeldrewr: A negative number?
13:07drewrfliebel: yeah, BOM
13:07drewrthat's expected
13:07drewrthe hang is not
13:07fliebelBOM?
13:07clojurebotchouser: I really did wonder why you had all those photobombers on slide 2.... audio is so useful :)
13:08raekdrewr: I think you need to set swank and slime to use UTF-8
13:08drewrraek: it's not by default?
13:08raekit has hanged for me when I had mismatching settings
13:08amalloyfliebel: byte order mark
13:08raekno, slime defaults to latin-1 I tihnk
13:08raekwhich is sad...
13:15hiredmanfor many things
13:16bennyluthow a clojure project is configured? i have two clj files in the same directory each defines a namespace, when i (use...) one file from the other i cannot compile it cause i got the exception: java.io.FileNotFoundException: Could not locate dep__init.class or dep.clj on classpath: (test.clj:0)
13:19drewrslime-net-coding-system is utf-8-unix (not sure if that's the right setting)
13:23swartis this the best place to get help with leiningen or is there a separate chat for that?
13:23amalloyswart: it's a good-enough place
13:23swarttrying to get it installed behind a socks proxy, but having no joy
13:23swartany suggestions?
13:23amalloyand technomancy is around right now, even if only to mock CL :)
13:25pyrhi and evening!
13:25pyri'm trying to understand why my clojure macros munge my strings in characters
13:25pyri've gotten down to the point where:
13:26pyr(defmacro stuff [[test]] `(let [test# ~test] (println "got:" test#)))
13:27technomancyswart: you may have to put that stuff in maven settings.xml; I'm not sure
13:27ossarehpyr: "munge my string in characters" ?
13:28pyri would expect this to yield "found: foo" for (stuff "foo"), but instead i get a "found: f" and f is a java Character, not String
13:28ossarehchange your arglist to [test] not [[test]]
13:28ossarehpyr^
13:28raeksritchie: yes. I assumed you were in the ns before you did the loading
13:28pyroh
13:28swartI have maven working okay, it's wget that's the problem right now. it may just be the initial dowload that's hanging
13:29pyrossareh: of course...
13:29pyrwhat an ass
13:29pyrsorry then, and thanks!
13:29ossarehpyr: nps - glad it helped
13:38bennylutin order to create a clojure project (with emacs) should i use Leiningen or emacs have some build-in tool?
13:39technomancybennylut: there's nothing built-in to Emacs
13:39RaynesCake or Leiningen are for creating and managing projects.
13:39RaynesEmacs is for editing them.
13:40bennyluttechnomancy, lol i mean to ask if i can manage the clojure project through emac
13:41amalloytechnomancy: heh. out of context, that is the biggest lie imaginable
13:41amalloyi should paste that for your buddies in #emacs
13:42technomancynooooo
13:43technomancybennylut: there's an Emacs front-end to Leiningen called elein
13:43technomancyand another one called M-x eshell =)
13:44bennyluttechnomancy, thanks!, i will google it
13:44technomancyyou still need leiningen for it though
14:59CozeyHi. What's your opinion on large let blocks in Clojure? Isn't using them a bit of a imperative programming habit? They're not easily testable by themselves, and computation there is not pure.
15:00brehautwhats not pure about a let block?
15:00Cozeyfor example see resultset-seq code
15:01Cozeywell it is pure in a sense that it depends on the function arguments
15:02brehauta let block is not pure or impure based on its size
15:02Cozeybut when you have a binding (let [ ..some bindings... foo (fn [] here-previous-bindings-used)] some code using (foo))
15:02Cozeythen when tehre is a bug in foo, it's not so easy to trace
15:03Cozeybrehaut: in a literal way, of course not.
15:03brehauti'm not familiar with resultset-seq, but if its impure its because its dealing with a mutable java object
15:04amalloyCozey: it sounds almost like you're objecting to lexical closures
15:04Cozeyhttps://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4937
15:05Cozeyamalloy: well. It sounds like it bit me but once
15:05Cozeyso I'm wondering what is a good functional practice
15:06pdklexical closures are fine, sometimes you'll need the localized side effects
15:06CozeyI try myself not to put anything what's not directly obvious enough not to write a test for it.
15:07brehautCozey: if the RHSs of your let expressions are just function calls passing the arguments to the fn or values from your prior let bindings, then it should be easily testable
15:08Cozeywhat if they are creating closures?
15:08midsisn't clojure.core a bit of a special case?
15:08Cozeymids: why?
15:08midsI assume most of it is optimized for speed and to reduce external dependencies
15:08brehautmids: by line 5000 i think its largely idiomatic ;)
15:09Cozeyyou mean (defmacro ns...) jesus
15:09brehauttheres nothing particularly ugly or mind bending in that macro
15:10brehautits just long
15:10Cozeyanyway. i guess this means i should just feel when I should move out a let into a separate fn
15:10midsbreak em up if it makes you happy
15:10midsI know I have a trouble grokking such huge functions
15:11brehautuse reuse and complexity of sub expressions as a guide to what you should extract
15:12brehautyou should be looking for what is inherent complexity in the problem the code solves and what has been accidentally introduced
15:13CozeyCould you elaborate?
15:13brehauti can try.
15:13Cozey:-) sorry, just 'inherent' and 'accidental' points my mind at medieval metaphysics
15:13brehautwell, its fairly central to the design of clojrue
15:14brehautso you're going to have to relearn that :P
15:14brehautthere are some great presentations by various clojure core devs such as rhickey and stuart halloway that cover ti well
15:15brehautbut im fialing to find it
15:16Cozeyhm i'd like to see that
15:16brehautbasicly inherent complexity is the things that make up the problem and that you need to solve. accidental complexity is the things that the programmer, the language, enviroment etc have introduced that you need to work around to solve the actual problem
15:17brehautso a simple example is that if you look at a for loop in an imperative language,
15:17brehautthere is a lot of busy work around maintaining loop counters and whatnot
15:17brehautif you just want to map over a collection and produce a new collection
15:18brehautyou'll have save one line for the mapping buried deep in about 4 or 5 lines of code
15:18Cozeyi get it.
15:18brehautcompare that with the map function
15:18brehautcool
15:18Cozeyi'm enlightened
15:18brehautif you want to go back to your let question, consider the length a code smell rather than an evil
15:18Cozeyreally, it was something i noticed but i didn't know it's called by this name
15:19brehautif you have a long let you might want to have a look for accidental complexity
15:19brehautsure
15:19Cozeythat programming lisp forces you to make good design, and if you introduce complexity accidentally, lisp will kick your ass
15:19brehautthats not really true
15:20brehautits more that as you become fluent, you have more tools available to deal with it
15:20brehautyou can still create a monstrosity
15:20Cozeyyes, but in an imperative language you can get away with more than in lisp, i believe
15:21Cozeywhich of course is a bad thing, since it will result in a catastrophe sooner or earlier
15:21brehautpersonally i dont like to ascribe magical powers to any language
15:21Cozeyin lisp i feel you need to back out
15:21Cozeyit's not magic, it's form isn't it?
15:22brehautgiant quote ahoy ‘At PARC we had a slogan: “Point of view is worth 80 IQ points.” It was based on a few things from the past like how smart you had to be in Roman times to multiply two numbers together; only geniuses did it. We haven’t gotten any smarter, we’ve just changed our representation system. We think better generally by inventing better representations; that’s something that we as computer scientists recognize as one o
15:22brehautmain things that we try to do.’ - Alan Kay
15:26Cozeynice
15:28ysphis there any generic build tool written in clojure (think ant replacement)?
15:31brehautysph: maybe https://github.com/stuarthalloway/lancet ?
15:32ysphi saw that, but i think it was mainly intended as example for the book, and hasn't been maintained
15:32brehautyeah that might be true
15:32cemerickysph: leiningen and cake are the closest you'll get
15:33ysphok, thanks
15:34technomancyre: lancet: http://twitter.com/stuarthalloway/status/5690154628
15:36brehauttechnomancy: can you quote the text? stupid new twitter is having a fail for me
15:36technomancybrehaut: this also works: http://mobile.twitter.com/stuarthalloway/status/5690154628
15:36brehauttechnomancy: brilliant, thanks
15:38Despite"scotch-soaked jerk" is my new favorite insult
15:44vrajmohan#bye
16:02fliebeltechnomancy: "from"?
16:32semperosI'm using (proxy) on SwingWorker to perform a background task
16:32semperosI know that an instance of SwingWorker can only be executed once
16:33semperosbut as I fire off the event to run the SwingWorker, proxy isn't making a new instance and thus I can't run it more than once
16:35brehautsemperos: im not familiar with the swingworker so this may seem like a stupid quest, but why not just use a clojure background processing tool?
16:36semperoswant a GUI action performed at start of process and when finished, used to the swingworker paradigm
16:38brehautsemperos: sorry i dont follow
16:39semperosI want the GUI to be updated at the start of my SwingWorker process (doInBackground method) and when it's finished (done method); I've read stuartsierra's post on "Agents of Swing" and have seen doing background processing using Clojure's own structures
16:39semperosbut I'm used to the SwingWorker paradigm and I'm "just" running a single function, not dealing directly with state at this level
16:39semperosand would rather not invent more state just to (send) a command off to an agent to run a function
16:42brehautok sure. im still not sure i understand it, but thats really besides the point. each call to proxy should generate a new object
16:42brehautcan you put up a snippet of your code somewherE?
16:45semperossure
16:49semperosbrehaut: https://gist.github.com/848090#L34
16:49semperosthat's where the proxy call is
16:50brehautsemperos: whats up with the reader skipped strings?
16:50brehautwhy not just use a comment?
16:50semperos;
16:50semperosdoes crazy indenting if I accidentally hit it
16:51semperosso I just do #_ sometimes
16:51semperosnot really that important :)
16:51semperosalso stands out to me visually
16:51brehautindeed however single ; is for an end of line comment, use a ;; and your editor should be fine
16:51brehaut(emacs clojure-mode is for me)
16:52bennyluthi all, i install leiningen, start new project, open swank using lein, connect to it through emacs and i have only two files in the project each open new namespace : 'test' and 'dep', test using dep : (use 'dep), i hit C-c C-k in with test selected and receive : test.clj:1:1:
16:52bennylut error: java.io.FileNotFoundException: Could not locate dep__init.class or dep.clj on classpath: (test.clj:0)
16:52semperosI use the same, just didn't realize
16:52semperosdouble-colons played nicely
16:52semperosthanks
16:52brehautno worries :)
16:52bennyluti dont know what i doing wrong - please help :(
16:55brehautsemperos: is on-action your own macro or taken from somewhere else?
16:55technomancybennylut: probably your files aren't placed in the right spots; try looking at src/ in some existing projects to see how it's supposed to look.
16:55semperosit's stuart sierra's
16:55brehautok cool
16:55bennyluttechnomancy, i will try, just a sec..
16:57brehautsemperos: #(= false %) is otherwise known as false?
16:57brehaut(line 28)
16:58semperosheh
16:58semperosyeah
16:58semperosthx
16:58brehautso i cant see why it wouldnt be creating a new SwingWorker proxy on each event
16:59semperosme either
16:59semperosthanks for looking at the code
16:59brehautcan you rewrite it so that you have the proxy in a let
16:59semperosyeah, I can
17:00brehaut(let [sw (proxy [SwingWorker] …)] (prn sw) (.execute sw)))
17:00semperosI tried doing smoe local binding to see if that would help, hadn't had a chance to test it yet
17:00semperosyeah
17:00semperosI'll give that a shot
17:01brehautit should print the memory address as part of the default ToString
17:02brehautid also move the (.setText lbl-status …) outside the proxy
17:03brehautsame with the .isSelected
17:03brehauti dont think you should be mucking with the UI values in the background thread in any way
17:06semperosisSelected isn't in a bg thread
17:07brehautis doInBackground not executed in the background?
17:07semperosoh, thats isSelected
17:07semperossorry, looking higher up
17:07semperosmy bad
17:07brehautno worries
17:09semperosbrehaut: not sure how I'd pass the isSelected value through to doInBackground
17:11brehaut(let [scrape-and-dl (.isSelected chkbox-scrape-and-dl)] (.setText lbl-status …) (doto (proxy [SwingWorker] [] … (if scrape-and-dl …)) .execute))
17:11semperosofc
17:12brehautdont forget that let has an implicit do, which is handy in these situations
17:12semperosright
17:12brehaut:)
17:12semperosbrehaut: thanks for pointing out the obvious through my brain fry
17:12brehautalso, i think something like (defn do-work [doInBackground done]
17:12brehaut (future (let [result (doInBackground)]
17:12brehaut (javax.swing.SwingUtilities/InvokeLater #(done result)))))
17:13brehaut(untested, i just cobbled it tgether)
17:13semperosnice
17:14bennyluttechnomancy, i dont seem to find any major difference in the project files - i downloaded some example project - but it happened with this project to, if there is no dependency then i can compile it, but on the first dependancy it fails
17:15technomancybennylut: each swank session is project-specific. do you have a separate lein swank for each project?
17:15bennyluttechnomancy, meybe i dont do somthing right - how to know where emacs is looking when he need to find dependencies?
17:16bennyluttechnomancy, i only have one project at a time each time starting swank (using lein swank) from the directory were the folder is located
17:18bennylutdo i have to supply any other option to lein?
17:20technomancyif you can't do C-c C-k on a lein swank in one of the files in https://github.com/technomancy/mire then something's wrong with your setup, but I can't think of what it would be; I've never heard of that problem before.
17:25bennyluttechnomancy, is there a way to check what is my current classpath for this swank session?
17:27amalloybennylut: (System/getProperty "java.class.path") should work
17:27amalloyit's a bit verbose, though :P. may want to split it at ":" or something
17:31bennyluttechnomancy, amalloy, thanks! i found the problem i had a "unicode" folder name and for some reason my shell didnt like it when using lein so it set the class path to ...????/???
17:31amalloylol nice
17:32bennylutchanging the folder name fix the problem :)
17:32springifyGood evening everybody. Is anybody here using midje? I'm experiencing a weird problem when using metaconstants.
17:32bennylutthe hours that i wasted lol :)
17:32technomancybennylut: could you create a bug report for that?
17:32technomancybennylut: there's also "lein classpath"
17:32amalloyspringify: i tried to use midje but experienced weird problems when trying to understand how to use any of the features :)
17:33springifyamalloy: lol, probably easier to understand when you're used to top-down, behaviourist-style TDD with object-oriented languages :)
17:34amalloyspringify: no, i loved all the features midje claims to have, but i couldn't figure out how to test anything at all
17:34amalloyit's been a while though; maybe i'll give it another try soon
17:34springifyI recommend Brian's screencast, then.
17:35bennyluti think its a problem with my os - cause i didnt fully install support to my lang..
17:35amalloyooo, linkylinky?
17:35bennylutbut if you want i can
17:35technomancybennylut: it's no big deal to close the issue if it turns out not to be reproducible
17:36bennylutok, i will fill a bug report not a problem :)
17:36springifyamalloy: http://vimeo.com/19404746
17:37springifyWell, not screencast, but video demo of midje.
17:39springifyHmm, can't figure out why function under test returns nil whenever I use metaconstants as return values in the "provided" block :(
17:43springifyHeh, talking about it helped. Just figured it out myself. Apparently the multimethod used internally by compojure's defroutes doesn't work with whatever type midje's metaconstants are and returns nil.
17:52amalloyspringify: anytime you need me to help you solve a problem by not doing anything, let me know
17:52springifyamalloy: Will do :)
18:03bennyluttechnomancy, https://github.com/technomancy/leiningen/issues/179 , thank you again for all your help!!!
18:59david`do you all suppose that some day clojure will have a framework comparable to rails? there's no reason why it couldn't/wouldn't right?
19:01brehautdavid`: i believe the goal of sandbar (?) is to provide something similar to that, however, most of the ring using community is more focused on modular components
19:02brehautdavid`: one of the big features of the rails/django model IMO is that it has an ORM
19:02brehautbut an ORM isnt really necessary if you dont have objects
19:02david`interesting
19:03brehautdavid`: if you are interested in getting started with web dev in clojure i can flick you a few links
19:03david`yea, that'd be great
19:03david`how does clojure simplify SQL calls without using an ORM?
19:04brehautso ring provides the basic web server api; its equivalent in ruby is rack and in python is wsgi: https://github.com/mmcgrana/ring
19:04brehautdavid`: one answer to that is github.com/lauJensen/clojureql/
19:04david`sweet
19:04david`is everyone still using lint?
19:04david`or lein
19:04brehautive started using clojureql on my development version of my site and its pretty aweet; theres some teething issues on corner cases but its proving very nice
19:05brehautlein or cake are the predominate choice
19:05david`cool
19:05brehautpeople coming from java also might use maven
19:06brehautdavid`: check out http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html and other entries on http://mmcgrana.github.com/
19:06david`I just went through the clojure koans btw
19:06david`they were a huge help
19:07brehautive not looked at them myself
19:07david`they're beginner-ish but they're a pretty awesome intro
19:07brehauti believe that mmcgrana uses compojure for routing on top of ring, the other option there is moustache; either is a solid choice and for a beginner i think it mostly comes down to taste
19:07david`awesome. thanks for the links.
19:07brehautno problem
19:08brehautyou will also want to check the ring wiki (on its github)
19:08brehautand in particular https://github.com/mmcgrana/ring/wiki/Libraries is a good first call for any specific solutions you might
19:08brehautneed
19:10brehautdavid`: lasty i would urge you to look at enlive for templating; its a very sophisticated system even if its a bit more complex than hiccup. github.com/cgrand/enlive/ and the tutorial: github.com/swannodette/enlive-tutorial
19:10david`cool
19:11brehauta lot of people are of the opinion that hiccup is better for single developer projects, but ive found that enlive is actually fantastic; i end my templates in textmate and use the built in html preview to see what it looks like
19:11brehautwithout ever having to go through the app
19:11brehauthave i missed anything?
19:12david`I think that's everything I'd need to build a nice web app stack
19:13brehautoh yeah, laujensen has some worked examples on his github https://github.com/LauJensen/SocialSite https://github.com/LauJensen/bestinclass.dk
19:13brehautsweet as.
19:14david`wow
19:14brehautdavid`: if you stick with ring et al you might want to look at http://groups.google.com/group/ring-clojure in the future too
19:15david`cool, I just watched the ring clojure conj video this weekend
19:15david`it was good
19:15brehautyeah it is
19:15brehautthat should set you on a good footing
19:19amalloy_fogus: i'm trying to use the clojure syntaxhighlighter brush you used for marginalia, and it keeps tripping on <, >, and &; it looks like the regexes are being run against the html-encoded entities instead of the decoded versions. did you have similar problems, and if so how did you solve them?
19:46@rhickeyI pushed a load time opt, interested in experience reports. Improves startup time by about 25% on my machine
20:01sattvikrhickey: Sounds good. Trying it out now on Android.
20:02@rhickeysattvik: that will be interesting, as the tradeoff involves using Class.newInstance() - dunno how well Android does with that
20:08sattvikI'll let you know. I haven't finished merging my 1.2.x changes to master, so I'll try comparing before and after your latest change to see what impact it has on load times.
20:47sattvikrhickey: I am seeing a bit of a differnce. With a basic Hello app on a more or less modest device, the latest change takes about 4.7s to load instead of around 5.2s. So about 10% savings.
20:48@rhickeysattvik: ok, thanks
20:58phenom_hey folks, I'm new to clojure and running into an issue ... let's say I've got an application that accepts messages over a network and invoked some busienss logic internally. the business logic is not network aware but I'd like the application to be specific-network-library agnostic ... in OO land I'd have an interface and a factory that reads from a config ... how would something like this be done in clojure ?
20:59brehautphenom_: first bit: a factory is just a function
20:59brehautthe easiest way to get started with config is just a namespace
21:01brehautthe specifics of interfaces and implementations is very broad and really depends on what you are doing with it
21:02brehautphenom_: if your factory is extensible from outside the core of your program, then you might want to look at multimethods to implement it
21:03sattvikrhickey: On a higher end device with a newer OS version, I am also seeing about a 10% improvement, though it's a difference of about 0.2s there.
21:10phenom_brehaut: what do you mean by namespaces ?
21:11brehautphenom_: if my project has simple config requirements, i just create a projectname.settings namespace and populate it with my configuration
21:12brehautsome other people here have more sophisticated config systems that are still based on a file full of clojure datastructures
21:28simardwhat do you use to debug clojure code ?
21:29simardie.. what version of jswat
21:51TimMcAny way to recur with apply?
21:52amalloyTimMc: no, but you can do the opposite
21:52amalloymake your loop take a list which it destructures
21:52TimMcI was thinking about the other recur, actually.
21:53amalloyTimMc: so? you want to recur to a function? make your user-facing function immediately call an inner function that takes a list
21:54TimMcyeah
21:54amalloythat's effectively the same as a loop, of course
21:56simardmay I ask again: what do you use to debug clojure code ?
21:57brehautsimard: i use prn and amalloy's ? macro
21:57brehautwhich is to say, not the answer you are looking for
21:57simardwhat does the ? macro do ?
21:58brehauthttps://gist.github.com/c93c37345c49c47dcfa2
21:58brehautit prints an expression and what it evaluates to
21:58amalloybrehaut, the #clojure jedi: these are not the tools you are looking for
21:59TimMcamalloy: I suppose recur goes directly to the call method of the same arity, and apply actually goes through arity dispatch, so the semantics of combining them isn't even meaningful.
22:00brehautsimard: i use the repl and lein test with them
22:00simardhum.... that is weird, my code suddenly worked when I added the (? ... ) form
22:00simardalright, perhaps it's time to understand that code :D
22:01TimMcsimard: Leave it in, I guess! :-P
22:01semperosbrehaut: figured out my proxy issues from earlier
22:01amalloylol
22:01brehautsemperos: oh yeah?
22:01semperosobviously wasn't any issue with proxy :)
22:01eckroth`anyone here use cake? I don't know how to get stacktraces of crashes when I run a swing app from either cake repl or using cake run
22:02semperoswhen I first coded the program, I put the (def stateful-var ...) stuff at top-level
22:02semperosso when trying to re-run the proxied instance, it was creating a new one
22:02semperosbut my data structures were all in a state of "complete" according to my program logic
22:02semperosso it appeared that it just wouldn't start; instead it just finished immediately
22:03semperosbound my state in a let form and everything works beautifully
22:03semperosthanks for all your help
22:09anonymouse89I'm looking at the Java VisualVM profiler and am seeing ~60% of time being spent on clojure.lang.MultiFn.getFn. Is there something terribly wrong, or does this seem expected? Is there a better way to profile that will give me an idea of what's happening closer to my code?
22:12brehautsemperos: no problem
22:15Despiteanonymouse89: It sounds like your multimethods lookups are really slow.
22:16amalloyDespite: but then the profiler ought to say that most of the time is spent in foo.mylib.myfn.invoke
22:18anonymouse89Despite: that's what it would have seemed like to me, but I have no multimethods
22:18DespiteOh I see.
22:19anonymouse89I guess now I want to see if there's a way to profile, but only in the scope I care about (my code)
22:20DespiteYou can filter the results in VisualVM
22:20DespiteI haven't really found a better way
22:24anonymouse89Despite: the only things I see in my namespace in visualvm are .invoke()'s which take <0.3% of the runtime. thanks though, I hadn't seen the filter box at the bottom
22:26Despiteanonymouse89: Yeah, the results in visualvm seem to be skewed. I saw 50%+ in the threads that were reporting back to VisualVM, so the overall results weren't that useful.