#clojure log - Feb 28 2011

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

2:38 Null-A: When the repl evals a record, how control its printed value?

2:39 its not calling toString, I tried overriding that

2:44 tomoj: it's the print-method multimethod

2:44 e.g.: (defrecord Foo []) (defmethod print-method Foo [f w] (.write w "foo!"))

2:56 Null-A: tomoj: thanks

3:00 tomoj: do question marks in protocol fn names cause trouble?

3:08 amalloy: i don't think so

3:11 tomoj: huh, this is odd

3:11 https://github.com/ztellman/lamina/blob/master/src/lamina/core/observable.clj#L23-37

3:11 even if I change it to is-consumer, I get "Can't define method not in interfaces: is_consumer"

3:12 wonder if it could be a checkout dep problem..

3:14 wtf

3:15 lein 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"

3:16 oh, somehow the lein-install'd version doesn't have that protocol fn

3:18 because it's not the code that was sitting there when I `lein install`d...

3:18 ..because I didn't run `lein deps`. d'oh

3:23 and shucks, with the jar actually in place I get the same old "can't define method not in interfaces"

3:26 amalloy: tomoj: 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

3:26 tomoj: I figured it was an arity problem, but I've triple checked

3:27 amalloy: i can verify that question marks aren't an issue, though - found a project of mine with an after? protocol method

3:28 tomoj: switched to is-consumer and leininstall'd just to be sure, same problem

3:28 inexplicably

3:29 I'll just hope ztellman runs into this problem too

3:29 seems like he probably wouldn't have committed it if so, though, it actually breaks the entire library

3:31 wait, but the tests run fine

3:31 shoot

3:31 AOT'd crap from older versions in my project

3:33 and I guess the reify gets checked at compile-time before the C-c C-k would have eval'd the new protocol in

3:33 or something crazy like that

5:09 n1kaya: When can I expect to see Clojure on GHC ?

5:12 Chousuke: Is someone working on that?

5:13 n1kaya: no thats why I'm in here trying to spur one of you to do so :D

5:14 right now people complain they can't use clojure for system programming because of it's slow startup time.

5:14 a GHC clojure would probably solve that

5:15 plus the source code for the implimentation might actually look somewhat sane in constrast to the java sources for clojure

5:16 I'm not dissing clojure's source code I'm just saying it's highly unusual as far as java code goes.

5:16 Fossi: i'd rather do an erlang one

5:16 or actually dalvik first

5:17 n1kaya: ouuuhhh mobile clojure.

5:20 Fossi: it works, but it's slow as hell

5:21 hoeck: n1kaya: running clojure on top of python could probably achieve sth. similar

5:26 Fossi: the hardest part are the datastructures anyway

9:35 octe: how 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

9:35 gives "can't use qualified name as parameter"

9:36 fliebel: octe: I think you need to use some weird combination of quoting and unquoting for that.

9:37 Clojure turns one into foo.bar/one, which isn't valid.

9:37 morphling: octe: `(defn ~'foo ~'[bar])

9:38 fliebel: Besides that, it is considered bad style to do that, unless you really need to.

9:38 octe: fliebel, i don't really need to, just experimenting

9:38 fliebel: octe: In that case, go ahead, there is a lot more funky quoting to be explored.

9:39 octe: indeed

9:46 TimMc: Where can I go to learn how namespaces, symbols, vars, and quoting work in Clojure?

9:47 I feel like this is the last bit of the basics that I just don't get.

9:48 cemerick: TimMc: If you carefully read everything on clojure.org, you'll have the basics. Specifically, see clojure.org/libs and clojure.org/vars

9:48 Beyond that, there are some very good books available. :-)

9:48 TimMc: heh

9:48 _fogus: hear hear!

9:48 TimMc: I completely forgot that I'd bought a Clojure book.

9:49 _fogus: TimMc: It left a deep impression on you clearly. ;-)

9:49 TimMc: meep

9:51 I think today will be a reading day.

9:51 Just you and me, Stuart.

9:51 (I hope that didn't sound creepy.)

9:52 Anyway, part of what's tripping me up is my Scheme background, where symbols are pretty simple, for the most part.

9:53 I never had to learn the interned/uninterned thing, though.

10:13 pdk: what's different in the handling of symbols in scheme vs clojure

10:13 TimMc: pdk: I don't recall namespaces in Scheme. 'foo was just 'foo

10:14 They were used the way keywords are in Clojure.

10:39 ,(.toUpperCase \a)

10:39 clojurebot: java.lang.IllegalArgumentException: No matching field found: toUpperCase for class java.lang.Character

10:39 TimMc: It's interesting that Clojure doesn't support calling static methods as instance methods, while Java does.

10:40 companion_cube: (.toUpper \a)

10:40 ,(.toUpper \a)

10:40 clojurebot: java.lang.IllegalArgumentException: No matching field found: toUpper for class java.lang.Character

10:40 TimMc: ,(Character/toUpperCase \a)

10:40 clojurebot: \A

10:40 TimMc: (Don't get me wrong, I think this is a good thing.)

10:42 Chousuke: TimMc: 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:43 TimMc: It might also be a convenience for the Java compiler implementors, since they can then treat any unqualified method call as this.method()

10:44 ...though I suspect this was very much in the initial specs.

10:46 $findfn true true

10:46 sexpbot: [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:55 sritchie_: hey all -- is there a command in clojure to reload the current namespace?

10:56 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:07 raek: sritchie_: (require 'the-ns :reload)

11:08 sritchie_: raek: I know that *ns* refers to the current namespace --

11:08 is there a way to get the symbol from *ns*, rather than the namespace?

11:09 raek: hrm. yes. I just found ns-name

11:09 so you should be able to do something like (require (ns-name *ns*) :reload)

11:11 sritchie_: great, let me check that out

11:12 looks like (in-ns (ns-name *ns*)) works great

11:12 od

11:12 d

11:14 raek: switch namespace to the current namespace?

11:21 sritchie_: raek: well, yes

11:22 raek: because load-fle doesn't load any new vars

11:22 if you're in the current namespace

11:22 but calling in-ns forces that

11:23 raek: I don't understand. in-ns just sets which namespace is the current one

11:23 sritchie_: raek: this might be a cake issue

11:24 but at the repl, if I load a a file, do (in-ns 'the.namespace),

11:24 then add something like (def testtext "test!") to the file, and call load-file again

11:24 testtext isn't available

11:24 raek: (doc load-file)

11:24 sritchie_: I get "unable to resolve symbol"

11:24 clojurebot: "([name]); Sequentially read and evaluate the set of forms contained in the file."

11:25 raek: I would recommend using (require ... :reload) instead

11:26 sritchie_: that doesn't work, though

11:26 raek: sritchie_: if you are use'ing the vars from another namespace, new vars from that namespace will not automatically be use'd

11:26 sritchie_: raek: I'm talking about the same namespace

11:26 raek: why doesn't the requier way work?

11:26 sritchie_: so, if i"m in project.playground, add a var, then load that file

11:26 I keep getting "unable to resolve symbol")

11:27 now, once a var exists, load-file updates its definition

11:27 new vars just don't get registered

11:27 raek: that's odd..

11:27 sritchie_: and you quoted the namespace name in the require call?

11:28 sritchie_: yeha

11:28 raek: (or used (ns-name *ns*))

11:28 sritchie_: yeah*

11:28 no, I tried both ways

11:28 raek: it's a problem that I'd only have noticed because of how textmate loads files, in the swannodette textmate-clojure bundle

11:28 raek: are you sure that there isn't any typos in the source file?

11:28 sritchie_: I'm usually in emacs, and this is fine

11:28 raek: yeah, because (in-ns 'the.namespace) works without any changes

11:29 picks up the var immediately

11:29 raek: what does *ns* eval to after you do the load-file call?

11:30 sritchie_: #<Namespace forma.playground>

11:30 semperos: how would I redirect *out* to a Swing component, e.g. JTextArea?

11:30 raek: the same namespace you were in before loading?

11:31 and this is direcly in the clojure repl?

11:31 when the source file is evaluated, the vars change directly.

11:32 there should not be any "cache" or anything that needs to be flushed

11:33 sritchie_: yeah, in the repl

11:33 same namespace

11:33 I get that, that's why it's so odd

11:57 amalloy: octe: whoa i srsly disagree with the quoting advice you got earlier

11:58 oh no, i see, you're doing unhygenic stuff on purpose

11:58 move along, nothing to see here

11:59 octe: amalloy, yeah

11:59 :)

12:01 amalloy: and 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:22 octe: amalloy, what's the difference of an unhygenic macro?

12:22 err, definition*

12:23 amalloy: octe: 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:23 there's a specific name for my definition, but i can't remember it. anaphoric, maybe

12:24 octe: well, that's what i thought

12:34 sritchie_: raek:

12:34 hey, are you still around?

12:35 The comment in this answer on SO seems to point to the issue --

12:35 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:01 drewr: ,,(first (.getBytes "foó" "UTF-16"))

13:01 clojurebot: -2

13:01 drewr: ,(first (.getBytes "foó" "UTF-16"))

13:01 clojurebot: -2

13:01 drewr: interesting; that hangs my swank repl

13:01 but UTF-8 doesn't

13:07 fliebel: drewr: A negative number?

13:07 drewr: fliebel: yeah, BOM

13:07 that's expected

13:07 the hang is not

13:07 fliebel: BOM?

13:07 clojurebot: chouser: I really did wonder why you had all those photobombers on slide 2.... audio is so useful :)

13:08 raek: drewr: I think you need to set swank and slime to use UTF-8

13:08 drewr: raek: it's not by default?

13:08 raek: it has hanged for me when I had mismatching settings

13:08 amalloy: fliebel: byte order mark

13:08 raek: no, slime defaults to latin-1 I tihnk

13:08 which is sad...

13:14 * technomancy blames Common Lispers

13:15 hiredman: for many things

13:16 bennylut: how 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:19 drewr: slime-net-coding-system is utf-8-unix (not sure if that's the right setting)

13:23 swart: is this the best place to get help with leiningen or is there a separate chat for that?

13:23 amalloy: swart: it's a good-enough place

13:23 swart: trying to get it installed behind a socks proxy, but having no joy

13:23 any suggestions?

13:23 amalloy: and technomancy is around right now, even if only to mock CL :)

13:25 pyr: hi and evening!

13:25 i'm trying to understand why my clojure macros munge my strings in characters

13:25 i've gotten down to the point where:

13:26 (defmacro stuff [[test]] `(let [test# ~test] (println "got:" test#)))

13:27 technomancy: swart: you may have to put that stuff in maven settings.xml; I'm not sure

13:27 ossareh: pyr: "munge my string in characters" ?

13:28 pyr: i 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:28 ossareh: change your arglist to [test] not [[test]]

13:28 pyr^

13:28 raek: sritchie: yes. I assumed you were in the ns before you did the loading

13:28 pyr: oh

13:28 swart: I have maven working okay, it's wget that's the problem right now. it may just be the initial dowload that's hanging

13:29 pyr: ossareh: of course...

13:29 what an ass

13:29 sorry then, and thanks!

13:29 ossareh: pyr: nps - glad it helped

13:38 bennylut: in order to create a clojure project (with emacs) should i use Leiningen or emacs have some build-in tool?

13:39 technomancy: bennylut: there's nothing built-in to Emacs

13:39 Raynes: Cake or Leiningen are for creating and managing projects.

13:39 Emacs is for editing them.

13:40 bennylut: technomancy, lol i mean to ask if i can manage the clojure project through emac

13:41 amalloy: technomancy: heh. out of context, that is the biggest lie imaginable

13:41 i should paste that for your buddies in #emacs

13:42 technomancy: nooooo

13:43 bennylut: there's an Emacs front-end to Leiningen called elein

13:43 and another one called M-x eshell =)

13:44 bennylut: technomancy, thanks!, i will google it

13:44 technomancy: you still need leiningen for it though

14:59 Cozey: Hi. 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:00 brehaut: whats not pure about a let block?

15:00 Cozey: for example see resultset-seq code

15:01 well it is pure in a sense that it depends on the function arguments

15:02 brehaut: a let block is not pure or impure based on its size

15:02 Cozey: but when you have a binding (let [ ..some bindings... foo (fn [] here-previous-bindings-used)] some code using (foo))

15:02 then when tehre is a bug in foo, it's not so easy to trace

15:03 brehaut: in a literal way, of course not.

15:03 brehaut: i'm not familiar with resultset-seq, but if its impure its because its dealing with a mutable java object

15:04 amalloy: Cozey: it sounds almost like you're objecting to lexical closures

15:04 Cozey: https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L4937

15:05 amalloy: well. It sounds like it bit me but once

15:05 so I'm wondering what is a good functional practice

15:06 pdk: lexical closures are fine, sometimes you'll need the localized side effects

15:06 Cozey: I try myself not to put anything what's not directly obvious enough not to write a test for it.

15:07 brehaut: Cozey: 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:08 Cozey: what if they are creating closures?

15:08 mids: isn't clojure.core a bit of a special case?

15:08 Cozey: mids: why?

15:08 mids: I assume most of it is optimized for speed and to reduce external dependencies

15:08 brehaut: mids: by line 5000 i think its largely idiomatic ;)

15:09 Cozey: you mean (defmacro ns...) jesus

15:09 brehaut: theres nothing particularly ugly or mind bending in that macro

15:10 its just long

15:10 Cozey: anyway. i guess this means i should just feel when I should move out a let into a separate fn

15:10 mids: break em up if it makes you happy

15:10 I know I have a trouble grokking such huge functions

15:11 brehaut: use reuse and complexity of sub expressions as a guide to what you should extract

15:12 you should be looking for what is inherent complexity in the problem the code solves and what has been accidentally introduced

15:13 Cozey: Could you elaborate?

15:13 brehaut: i can try.

15:13 Cozey: :-) sorry, just 'inherent' and 'accidental' points my mind at medieval metaphysics

15:13 brehaut: well, its fairly central to the design of clojrue

15:14 so you're going to have to relearn that :P

15:14 there are some great presentations by various clojure core devs such as rhickey and stuart halloway that cover ti well

15:15 but im fialing to find it

15:16 Cozey: hm i'd like to see that

15:16 brehaut: basicly 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:17 so a simple example is that if you look at a for loop in an imperative language,

15:17 there is a lot of busy work around maintaining loop counters and whatnot

15:17 if you just want to map over a collection and produce a new collection

15:18 you'll have save one line for the mapping buried deep in about 4 or 5 lines of code

15:18 Cozey: i get it.

15:18 brehaut: compare that with the map function

15:18 cool

15:18 Cozey: i'm enlightened

15:18 brehaut: if you want to go back to your let question, consider the length a code smell rather than an evil

15:18 Cozey: really, it was something i noticed but i didn't know it's called by this name

15:19 brehaut: if you have a long let you might want to have a look for accidental complexity

15:19 sure

15:19 Cozey: that programming lisp forces you to make good design, and if you introduce complexity accidentally, lisp will kick your ass

15:19 brehaut: thats not really true

15:20 its more that as you become fluent, you have more tools available to deal with it

15:20 you can still create a monstrosity

15:20 Cozey: yes, but in an imperative language you can get away with more than in lisp, i believe

15:21 which of course is a bad thing, since it will result in a catastrophe sooner or earlier

15:21 brehaut: personally i dont like to ascribe magical powers to any language

15:21 Cozey: in lisp i feel you need to back out

15:21 it's not magic, it's form isn't it?

15:22 brehaut: giant 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:22 main things that we try to do.’ - Alan Kay

15:26 Cozey: nice

15:28 ysph: is there any generic build tool written in clojure (think ant replacement)?

15:31 brehaut: ysph: maybe https://github.com/stuarthalloway/lancet ?

15:32 ysph: i saw that, but i think it was mainly intended as example for the book, and hasn't been maintained

15:32 brehaut: yeah that might be true

15:32 cemerick: ysph: leiningen and cake are the closest you'll get

15:33 ysph: ok, thanks

15:34 technomancy: re: lancet: http://twitter.com/stuarthalloway/status/5690154628

15:36 brehaut: technomancy: can you quote the text? stupid new twitter is having a fail for me

15:36 technomancy: brehaut: this also works: http://mobile.twitter.com/stuarthalloway/status/5690154628

15:36 brehaut: technomancy: brilliant, thanks

15:38 Despite: "scotch-soaked jerk" is my new favorite insult

15:39 * technomancy is fond of "Ten points from Hufflepuff."

15:44 vrajmohan: #bye

16:02 fliebel: technomancy: "from"?

16:32 semperos: I'm using (proxy) on SwingWorker to perform a background task

16:32 I know that an instance of SwingWorker can only be executed once

16:33 but 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:35 brehaut: semperos: 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:36 semperos: want a GUI action performed at start of process and when finished, used to the swingworker paradigm

16:38 brehaut: semperos: sorry i dont follow

16:38 * brehaut goes and reads some docs

16:39 semperos: I 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:39 but I'm used to the SwingWorker paradigm and I'm "just" running a single function, not dealing directly with state at this level

16:39 and would rather not invent more state just to (send) a command off to an agent to run a function

16:42 brehaut: ok sure. im still not sure i understand it, but thats really besides the point. each call to proxy should generate a new object

16:42 can you put up a snippet of your code somewherE?

16:45 semperos: sure

16:49 brehaut: https://gist.github.com/848090#L34

16:49 that's where the proxy call is

16:50 brehaut: semperos: whats up with the reader skipped strings?

16:50 why not just use a comment?

16:50 semperos: ;

16:50 does crazy indenting if I accidentally hit it

16:51 so I just do #_ sometimes

16:51 not really that important :)

16:51 also stands out to me visually

16:51 brehaut: indeed however single ; is for an end of line comment, use a ;; and your editor should be fine

16:51 (emacs clojure-mode is for me)

16:52 bennylut: hi 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:52 error: java.io.FileNotFoundException: Could not locate dep__init.class or dep.clj on classpath: (test.clj:0)

16:52 semperos: I use the same, just didn't realize

16:52 double-colons played nicely

16:52 thanks

16:52 brehaut: no worries :)

16:52 bennylut: i dont know what i doing wrong - please help :(

16:55 brehaut: semperos: is on-action your own macro or taken from somewhere else?

16:55 technomancy: bennylut: 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:55 semperos: it's stuart sierra's

16:55 brehaut: ok cool

16:55 bennylut: technomancy, i will try, just a sec..

16:57 brehaut: semperos: #(= false %) is otherwise known as false?

16:57 (line 28)

16:58 semperos: heh

16:58 yeah

16:58 thx

16:58 brehaut: so i cant see why it wouldnt be creating a new SwingWorker proxy on each event

16:59 semperos: me either

16:59 thanks for looking at the code

16:59 brehaut: can you rewrite it so that you have the proxy in a let

16:59 semperos: yeah, I can

17:00 brehaut: (let [sw (proxy [SwingWorker] …)] (prn sw) (.execute sw)))

17:00 semperos: I tried doing smoe local binding to see if that would help, hadn't had a chance to test it yet

17:00 yeah

17:00 I'll give that a shot

17:01 brehaut: it should print the memory address as part of the default ToString

17:02 id also move the (.setText lbl-status …) outside the proxy

17:03 same with the .isSelected

17:03 i dont think you should be mucking with the UI values in the background thread in any way

17:06 semperos: isSelected isn't in a bg thread

17:07 brehaut: is doInBackground not executed in the background?

17:07 semperos: oh, thats isSelected

17:07 sorry, looking higher up

17:07 my bad

17:07 brehaut: no worries

17:09 semperos: brehaut: not sure how I'd pass the isSelected value through to doInBackground

17:11 brehaut: (let [scrape-and-dl (.isSelected chkbox-scrape-and-dl)] (.setText lbl-status …) (doto (proxy [SwingWorker] [] … (if scrape-and-dl …)) .execute))

17:11 semperos: ofc

17:12 brehaut: dont forget that let has an implicit do, which is handy in these situations

17:12 semperos: right

17:12 * semperos wants to take a break from Swing world

17:12 brehaut: :)

17:12 semperos: brehaut: thanks for pointing out the obvious through my brain fry

17:12 brehaut: also, i think something like (defn do-work [doInBackground done]

17:12 (future (let [result (doInBackground)]

17:12 (javax.swing.SwingUtilities/InvokeLater #(done result)))))

17:13 (untested, i just cobbled it tgether)

17:13 semperos: nice

17:14 bennylut: technomancy, 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:15 technomancy: bennylut: each swank session is project-specific. do you have a separate lein swank for each project?

17:15 bennylut: technomancy, meybe i dont do somthing right - how to know where emacs is looking when he need to find dependencies?

17:16 technomancy, i only have one project at a time each time starting swank (using lein swank) from the directory were the folder is located

17:18 do i have to supply any other option to lein?

17:20 technomancy: if 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:25 bennylut: technomancy, is there a way to check what is my current classpath for this swank session?

17:27 amalloy: bennylut: (System/getProperty "java.class.path") should work

17:27 it's a bit verbose, though :P. may want to split it at ":" or something

17:31 bennylut: technomancy, 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:31 amalloy: lol nice

17:32 bennylut: changing the folder name fix the problem :)

17:32 springify: Good evening everybody. Is anybody here using midje? I'm experiencing a weird problem when using metaconstants.

17:32 bennylut: the hours that i wasted lol :)

17:32 technomancy: bennylut: could you create a bug report for that?

17:32 bennylut: there's also "lein classpath"

17:32 amalloy: springify: i tried to use midje but experienced weird problems when trying to understand how to use any of the features :)

17:33 springify: amalloy: lol, probably easier to understand when you're used to top-down, behaviourist-style TDD with object-oriented languages :)

17:34 amalloy: springify: no, i loved all the features midje claims to have, but i couldn't figure out how to test anything at all

17:34 it's been a while though; maybe i'll give it another try soon

17:34 springify: I recommend Brian's screencast, then.

17:35 bennylut: i think its a problem with my os - cause i didnt fully install support to my lang..

17:35 amalloy: ooo, linkylinky?

17:35 bennylut: but if you want i can

17:35 technomancy: bennylut: it's no big deal to close the issue if it turns out not to be reproducible

17:36 bennylut: ok, i will fill a bug report not a problem :)

17:36 springify: amalloy: http://vimeo.com/19404746

17:37 Well, not screencast, but video demo of midje.

17:39 Hmm, can't figure out why function under test returns nil whenever I use metaconstants as return values in the "provided" block :(

17:43 Heh, 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:52 amalloy: springify: anytime you need me to help you solve a problem by not doing anything, let me know

17:52 springify: amalloy: Will do :)

18:03 bennylut: technomancy, https://github.com/technomancy/leiningen/issues/179 , thank you again for all your help!!!

18:59 david`: 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:01 brehaut: david`: 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:02 david`: one of the big features of the rails/django model IMO is that it has an ORM

19:02 but an ORM isnt really necessary if you dont have objects

19:02 david`: interesting

19:03 brehaut: david`: if you are interested in getting started with web dev in clojure i can flick you a few links

19:03 david`: yea, that'd be great

19:03 how does clojure simplify SQL calls without using an ORM?

19:04 brehaut: so ring provides the basic web server api; its equivalent in ruby is rack and in python is wsgi: https://github.com/mmcgrana/ring

19:04 david`: one answer to that is github.com/lauJensen/clojureql/

19:04 david`: sweet

19:04 is everyone still using lint?

19:04 or lein

19:04 brehaut: ive 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:05 lein or cake are the predominate choice

19:05 david`: cool

19:05 brehaut: people coming from java also might use maven

19:06 david`: check out http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html and other entries on http://mmcgrana.github.com/

19:06 david`: I just went through the clojure koans btw

19:06 they were a huge help

19:07 brehaut: ive not looked at them myself

19:07 david`: they're beginner-ish but they're a pretty awesome intro

19:07 brehaut: i 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:07 david`: awesome. thanks for the links.

19:07 brehaut: no problem

19:08 you will also want to check the ring wiki (on its github)

19:08 and in particular https://github.com/mmcgrana/ring/wiki/Libraries is a good first call for any specific solutions you might

19:08 need

19:10 david`: 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:10 david`: cool

19:11 brehaut: a 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:11 without ever having to go through the app

19:11 have i missed anything?

19:12 david`: I think that's everything I'd need to build a nice web app stack

19:13 brehaut: oh yeah, laujensen has some worked examples on his github https://github.com/LauJensen/SocialSite https://github.com/LauJensen/bestinclass.dk

19:13 sweet as.

19:14 david`: wow

19:14 brehaut: david`: 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:15 david`: cool, I just watched the ring clojure conj video this weekend

19:15 it was good

19:15 brehaut: yeah it is

19:15 that should set you on a good footing

19:19 amalloy: _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 rhickey: I pushed a load time opt, interested in experience reports. Improves startup time by about 25% on my machine

20:01 sattvik: rhickey: Sounds good. Trying it out now on Android.

20:02 rhickey: sattvik: that will be interesting, as the tradeoff involves using Class.newInstance() - dunno how well Android does with that

20:08 sattvik: I'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:47 rhickey: 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 rhickey: sattvik: ok, thanks

20:58 phenom_: 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:59 brehaut: phenom_: first bit: a factory is just a function

20:59 the easiest way to get started with config is just a namespace

21:01 the specifics of interfaces and implementations is very broad and really depends on what you are doing with it

21:02 phenom_: if your factory is extensible from outside the core of your program, then you might want to look at multimethods to implement it

21:03 sattvik: rhickey: 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:10 phenom_: brehaut: what do you mean by namespaces ?

21:11 brehaut: phenom_: if my project has simple config requirements, i just create a projectname.settings namespace and populate it with my configuration

21:12 some other people here have more sophisticated config systems that are still based on a file full of clojure datastructures

21:28 simard: what do you use to debug clojure code ?

21:29 ie.. what version of jswat

21:51 TimMc: Any way to recur with apply?

21:52 amalloy: TimMc: no, but you can do the opposite

21:52 make your loop take a list which it destructures

21:52 TimMc: I was thinking about the other recur, actually.

21:53 amalloy: TimMc: so? you want to recur to a function? make your user-facing function immediately call an inner function that takes a list

21:54 TimMc: yeah

21:54 amalloy: that's effectively the same as a loop, of course

21:56 simard: may I ask again: what do you use to debug clojure code ?

21:57 brehaut: simard: i use prn and amalloy's ? macro

21:57 which is to say, not the answer you are looking for

21:57 simard: what does the ? macro do ?

21:58 brehaut: https://gist.github.com/c93c37345c49c47dcfa2

21:58 it prints an expression and what it evaluates to

21:58 amalloy: brehaut, the #clojure jedi: these are not the tools you are looking for

21:59 TimMc: amalloy: 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:00 brehaut: simard: i use the repl and lein test with them

22:00 simard: hum.... that is weird, my code suddenly worked when I added the (? ... ) form

22:00 alright, perhaps it's time to understand that code :D

22:01 TimMc: simard: Leave it in, I guess! :-P

22:01 semperos: brehaut: figured out my proxy issues from earlier

22:01 amalloy: lol

22:01 brehaut: semperos: oh yeah?

22:01 semperos: obviously wasn't any issue with proxy :)

22:01 eckroth`: 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:02 semperos: when I first coded the program, I put the (def stateful-var ...) stuff at top-level

22:02 so when trying to re-run the proxied instance, it was creating a new one

22:02 but my data structures were all in a state of "complete" according to my program logic

22:02 so it appeared that it just wouldn't start; instead it just finished immediately

22:03 bound my state in a let form and everything works beautifully

22:03 thanks for all your help

22:09 anonymouse89: I'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:12 brehaut: semperos: no problem

22:15 Despite: anonymouse89: It sounds like your multimethods lookups are really slow.

22:16 amalloy: Despite: but then the profiler ought to say that most of the time is spent in foo.mylib.myfn.invoke

22:18 anonymouse89: Despite: that's what it would have seemed like to me, but I have no multimethods

22:18 Despite: Oh I see.

22:19 anonymouse89: I guess now I want to see if there's a way to profile, but only in the scope I care about (my code)

22:20 Despite: You can filter the results in VisualVM

22:20 I haven't really found a better way

22:24 anonymouse89: Despite: 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:26 Despite: anonymouse89: 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.

Logging service provided by n01se.net