#clojure log - Jun 16 2011

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

2:49 terom: ,(take 2 (sort > [14 6 43 195 3214 31]))

2:49 clojurebot: (3214 195)

3:56 TobiasRaeder: Morning :)

4:37 tsdh: Hi

4:40 I have a macro that expands into a function definition. That function should have meaningful parameters, but of course I don't want to interfer with locals the user uses in the macro. How do I handle that?

4:41 gko: How can I change the value of io/*buffer-size* ? I have a java.lang.Exception: Can't create defs outside of current ns

4:43 I mean duck-streams/*buffer-size*

4:43 hoeck1: tsdh: you could change the :args item of the metadata the functions var carries to have the tools (slime, doc etc.) display nice signatures for the generated function

4:44 gko: binding, set! or ultimatively (on the repl) alter-var-root

4:44 hoeck: tsdh: you could change the :args item of the metadata the functions var carries to have the tools (slime, doc etc.) display nice signatures for the generated function

4:45 gko: binding, set! or ultimatively (on the repl) alter-var-root

4:46 tsdh: hoeck: I'd like to use keyword parameters, cause I have three args that are exclusive and equally likely to be used. Do you have an expample at hand?

4:46 gko: hoeck: oh, binding works through namespaces? OK, I'll try.

4:48 hoeck: gko: of course, just namespace-qualify the var you want to bind, note that in 1.3, binding is limited to vars declared ^:dynamic

4:49 gko: hoeck: OK thanks. Regarding declare, it's better to do (declare my-dynamic-variable) than (def my-dynamic-variable xxx)?

4:49 hoeck: in the 2nd case, it's nicer when testing functions from some random source file...

4:50 hoeck: as there won't be undefined error messages

4:50 hoeck: and no need to (def ...) the variables...

4:51 TobiasRaeder: Anyone here using the current clojure-mode/clojure-jack-in?

4:51 When starting it i get an exception "Exception in thread "main" java.lang.IllegalArgumentException: No value supplied for key: 15692 (NO_SOURCE_FILE:1)" which makes sense since there is just the port as a parameter parsed.

4:52 hoeck: gko: declare is for when you need to 'forward' declare something, because of two functions calling each other, I wouldn't use it for defining unbound dynamic vars

4:52 gko: and rather use (def ^:dynamic *my-var*) for unbound vars

4:54 tsdh: so are the parameters exclusively determined by the macro, or has can the user of the macro add additional ones?

4:55 tsdh: hoeck: They are fixed by the macro.

4:58 hoeck: ,(:arglists (meta #'sort))

4:58 clojurebot: ([coll] [comp coll])

4:59 hoeck: tsdh: you can look at existing functions to see how their arglists are formatted

5:03 tsdh: just a list of their normal argument vectors, some clojure.core functions even have some kind of mini BNF in their :arglists

5:03 tsdh: hoeck: I think formatting is not enough here. If I use keyword parameteres, the user will have to use the real names anyway, like (my-generated-fn :foo 17).

5:05 hoeck: tsdh: but instead of binding them using destructuring you could grab the keyword arg map directly

5:06 tsdh: hoeck: You mean, my generated function would be `(defn my-generated-fn [& [keys#]]) and users would call (my-generated-fn {:foo 17})?

5:06 hoeck: i.e. the macro defines a function (defn gen123 [& args_123] generated_body)

5:07 tsdh: right, keyword arg destructuring is just some sugar over & rest args

5:09 tsdh: hoeck: Hm, well, I'd prefer if (my-generated-fn :foo 17), but in this case, I think passing a map is fine as well. Thanks.

5:09 hoeck: tsdh: you can do that

5:11 ,((fn [& keyword-args] (let [argmap (apply hashmap keyword-args)] (:key argmap))) :key 'here)

5:11 clojurebot: java.lang.Exception: Unable to resolve symbol: hashmap in this context

5:11 hoeck: ,((fn [& keyword-args] (let [argmap (apply hash-map keyword-args)] (:key argmap))) :key 'here)

5:11 clojurebot: here

5:11 hoeck: tsdh: ^

5:11 tsdh: ,((fn [& map] (apply hash-map map)) :foo "foo")

5:11 clojurebot: {:foo "foo"}

5:11 tsdh: hoeck: Just found out on my own. :-)

5:11 hoeck: tsdh: great :)

5:12 tsdh: Totally awesome.

5:15 clgv: what is the easiest way to measure (additional) memory consumption within a clojure function?

5:16 hoeck: tsdh: and then let you macro expand to: (defn foo {:arglists '([:keys [foo bar baz]])} [& args] nil) to get a nicer arglist

5:17 clgv: informal or reliable?

5:19 clgv: for informal investigation I'd just fire up jvisualvm, run the function manually a few times and watch the graph memory graph moving up or down

5:19 clgv: hoeck: informal

5:19 ok that would be an option

5:22 ah k about 30MB. more than I would have guessed

5:24 gko: hoeck: OK, thanks!

5:24 clgv: 0.5 MB per constructed instance. but I am constructing them lazy anyway

5:32 hmm is there a way to measure the consumed memory of a given data item in clojure exactly? e.g. (mem-usage {:hello 'world})

5:32 hoeck: clgv: no, please invent one

5:33 clgv: hoeck: damn... ;) ok maybe there is a java way ...

5:33 hoeck: clgv: in {:hello 'world}, at least the keyword is only referenced, and hello may be an interned string, how do you mesure those?

5:33 fliebel: clgv: Even in Java they mostly say "you shouldn't care"

5:33 hoeck: measure

5:34 clgv: ah well , it's just motivated by curiosity and no real problem behind it ^^

5:34 hoeck: clgv: there are java memory profilers, but their output is a mess, especially considering the clojure persistent hashmaps and all their different anonymous node classes

5:37 Vinzent: When I hit enter in auto-complete-mode in REPL, the current input string is evaluated, so auto-complete doesn't work. How can I avoid that?

5:46 gko: I'm trying to use (duck-streams/to-byte-array (.getInputStream socket)) but it times out whereas it works with (.read ins array) + (pos? read-size) (> (.available ins) 0)...do I need to do something special after copy?

5:46 noctux: hello guys, I'm a little bit into java programming and know oop/imperial programming stuff. So I wanted to get some insight into functional programming. As Clojure is for the jvm, it seemed to fit for me. so I'm searching for a nice tutorial. Has anyone here checked http://blip.tv/clojure/clojure-for-java-programmers-1-of-2-989128 already? Is it ok, to start with?

5:51 raek: gko: I think it tries to read the whole stream all the way to EOF

5:51 Vinzent: noctux, I had not watched it, but many people advised it for beginners, so I think it'd a good start. Also, checkout http://learn-clojure.com/

5:52 raek: gko: also, duck-streams has been superseded by clojure.java.io

5:54 TobiasRaeder: Anyone ever had the problem that (System/getProperty "java.home") returned something else then echo $JAVA_HOME in a shell?

5:56 bsteuber: TobiasRaeder: it sometimes returned nil for me after really severe exceptions happened

5:57 raek: noctux: Those videos (Clojure Concurrency is very nice too) is what I started with. They are a great overview of what's in the (core) language.

5:57 TobiasRaeder: @bsteuber my problem is normally its /opt/java but from the repl its /opt/java/jre which is bad because i need classes that are in the jdk only

5:58 @bsteuber and i cant seem to find why it is set to something else

5:58 bsteuber: TobiasRaeder: sorry, can't help you with that

5:59 TobiasRaeder: @bsteuber thx anyways :)

5:59 bsteuber: noctux: the videos are great, but please note there've been some API changes since then, so not all details are true anymore

6:01 raek: yeah, the laziness stuff is slightly different. any more changes?

6:03 sure, more stuff has been added (datatypes and protocols, for example)

6:04 tsdh: hoeck: The :arlist work great, except that the args show up qualified by namespace. Can that be turned off?

6:04 hoeck: tsdh: yep, use ~'argname in the macro, instead of argname

6:05 raek: noctux: 1.0 changes 1.1: https://github.com/clojure/clojure/blob/1.1.x/changes.txt

6:06 noctux: 1.1 to 1.2 changes: https://github.com/clojure/clojure/blob/1.2.x/changes.txt

6:06 tsdh: hoeck: Works fine. Thanks.

6:06 bsteuber: raek: also, next vs rest was changed later I think

6:07 and for 1.3 a lot of other stuff like long-arithmetic without overflow check as default

6:07 raek: but they still check for overflow, don't they?

6:08 but an exception is thrown instead of turning it to a BigInteger

6:08 ah, "auto-promotion" is the word

6:10 bsteuber: raek: right, I got that wrong - just tested

6:10 no auto-promotion but still an exception

6:11 * raek thinks allowing silent overflows is scary

6:11 raek: s/allowing/using/

6:19 noctux: raek: sry, was afk. Thanks a bunch for the advise. Lets hope clojure is for me :D

6:21 zakwilson: I think primative math by default is a mistake. Autopromotion should be the default and things like +' should be the operators that overflow, throw or otherwise treat numbers like bits instead of numbers.

6:49 gko: raek: ok, i'll check clojure.java.io.

6:49 thanks

7:48 timvisher: hey all

7:48 i'm struggling to install lein-search. is it still supported?

8:18 sunnibo: hello

8:20 TobiasRaeder: hi :)

8:21 sunnibo: :)

8:29 Here is a question: I made a web page including "utf-8" characters with the Compojure. All characters are shown "????" in a web browser. Any tips?

8:31 raek: sunnibo: include the "Content-Type" "text/html; charset=utf-8" header in the response

8:32 the servlet container "helpfully" converts "text/html" to "text/html; charset=iso-8859-1"

8:35 sunnibo: raek: oh. thank you. how can i insert that string into the header?

8:35 shanmu: hi, I was using swank-clojure on windows, happily launching swank server and connecting from withing emacs fine... from swank-clojure 1.3.1 swank does not launch fine from withing emacs

8:35 is that a known problem

8:36 raek: sunnibo: can you give an example of how you generate the response now?

8:37 sunnibo: shanmu: this is not the right answer, but why don't you use a ClojureBox?

8:38 raek: shanmu: how do you launch swank from emacs?

8:38 shanmu: also: http://technomancy.us/149

8:40 sunnibo: raek: I just tested with a compojure example (https://github.com/weavejester/compojure-example)

8:41 shanmu: sunnibo: thanks, I use commonlisp ccl as well - so I need a full fledged emacs + slime :) as I said swank-clojure 1.3.0 works but swank-clojure 1.3.1 does not - the problem seems to be with the {:encoding "iso-latin-1-unix"} map entry being passed to swank.swank/start-server - it complains that iso-latin-1-unix is missing a key entry

8:41 raek: shanmu: launching the swank server from emacs with swank-clojure.el (typical usage: M-x slime, or M-x swank-clojure-project, this is what clojurebox uses) is deprecated. consider using the new clojure-jack-in approach

8:41 shanmu: raek: thanks! clojure-jack-in does not work from windows

8:42 raek: shanmu: there is known problems (see the clojure mailing list thread) wich I think there is workarounds for

8:42 shanmu: raek: checking the mailing list....

8:43 sunnibo: clojure-jack-in doesnt work in windows? i didn't know that. that's too bad..

8:43 shanmu: also, lein plugin install swank-clojure 1.3.1 does not work from windows...

8:43 raek: shanmu: also consider using UTF-8. swank-clojrue will default to it in recent versions. if you use the latest version of clojure-mode, you dont need to customize-variable slime-net-coding-system to utf-8-unix

8:43 shanmu: also, are you using the latest lein version?

8:44 shanmu: you should file a bug report on https://github.com/technomancy/swank-clojure/issues if it's not there

8:44 shanmu: raek: yes... 1.5.2 I think

8:44 raek: Leiningen 1.5.2 on Java 1.6.0_24 Java HotSpot(TM) Client VM

8:46 raek: sunnibo: wrap the html5 form like this: (-> (html5 ...) (response) (content-type "text/html; charset=utf-8"))

8:46 shanmu: even with utf-8-unix encoding, it is returning "java.lang.IllegalArgumentException: No value supplied for key: utf-8-unix (NO_SOURCE_FILE:0)"

8:46 raek: sunnibo: and (:use [ring.util.response :only [response content-type]])

8:46 shanmu: try "UTF-8"

8:50 shanmu: raek: emacs itself throws an error for "UTF-8" - if: Invalid slime-net-coding-system: UTF-8. (iso-latin-1-unix iso-8859-1-unix binary utf-8-unix emacs-mule-unix euc-jp-unix)

8:52 sunnibo: raek: i got an exception: java.lang.Exception: Unable to resolve symbol: content-type in this context

8:52 ah. i did'nt add USE. sorry. :p

8:54 raek: wow. i can see Korean chars

8:55 thank you so much. i've googled this problem about a hours, but i couldn't find any answers. :p you're my hero

8:55 raek: shanmu: ah, does it work to have utf-8-unix as slime-net-coding-system?

8:56 shanmu: the swank-clojure side accepts the names as "UTF-8", I think (so that's why I suggested it)

8:56 shanmu: are you providing the "iso-latin-1-unix" option?

8:57 shanmu: raek: hmmm...looks like slime does not accept it... let me dig through

8:57 raek: no, thats the defauly

8:57 raek: shanmu: not in recent versions

8:57 of swank-clojure

8:57 shanmu: raek: thats probably why its erroring... hmmm

8:58 raek: my recommendation: use the defaults for swank-clojure (make sure you don't have any old version in project.clj or ~/.lein/plugins/) and config slime to use utf-8-unix

8:58 the last step is not needed if you use the clojure-mode.el from last night

8:59 shanmu: raek: just did a git pull

8:59 trying again

9:01 raek: clojure-jack-in works with latest clojure-mode and windows cmd command shell (I was using msys shell earlier) checking the old way of launching

9:03 raek: swank-clojure-project does not work - it complains about the utf-8-unix key missing... but then as clojure-jack-in works, I am fine for now... still wondering why one would want to change character encoding identifier strings!!

9:05 raek: shanmu: swank-clojure-project is deprecated

9:06 but for some reason some piece of code gives it utf-8-unix instead of utf-8

9:06 shanmu: raek: yes... thanks, will use clojure jack in from now :D. you are a star, as usual!!

9:16 sunnibo: raek: can you explain or give me a link why (-> (html5 ...) (response) (content-type "text/html; charset=utf-8")) works? i want to know why...

9:21 raek: sunnibo: do you know what a response is?

9:23 shanmu: with the latest swank-clojure, when I hit C-c C-c in an sexp in a clojure script file, it does not compile in the correct namespace.. Is this is a known issue as well?

9:24 tsdh: With kw args [{:keys [...] :or {...} :as everything}] is there something just like the :as but contains the complete map after applying the defaults declared in the :or?

9:24 sunnibo: raek: no. i'm a newbie.. :(

9:25 raek: sunnibo: ok. :) then I guess you haven't seen this: https://github.com/mmcgrana/ring/blob/master/SPEC

9:26 I recommend reading it; it's not very long

9:26 the functions i used are very simple:

9:26 (defn response [body] {:status 200, :headers {}, :body body})

9:27 (defn content-type [response ctype] (assoc-in response [:headers "Content-Type"] ctype))

9:27 so you manily use them to not have to type so much :)

9:28 shanmu: I get that behavior if I don't eval the ns for m first

9:29 after the ns form is evaluated, it seems to remember what namespace belongs to that file

9:31 sunnibo: raek: oh. very simple! thank you. i'll read the link, too.

9:32 raek: shanmu: so I usually press C-c C-k the first time to eval the whole file. after that I can use C-M-x to eval the current top-level form

9:36 sunnibo: i want to merge two map {:a 1 :b 2} {:c 3 :d 4} to {:a 1 :b 2 :c 3 :d 4}. which function can i use?

9:38 chouser: sunnibo: merge

9:45 * gfrlog loves it

9:45 gfrlog: There should be a word for the kind of refactoring where you just delete characters in your code and it ends up doing the same thing

9:46 like (let [x (foo bar)] x) => (foo bar)

9:46 I feel like that happens unusually often in clojure

9:50 opqdonut: simplifying, evaluating, expanding

9:59 shanmu: raek: it works fine if I remove loading an external slime!! hmm... I have to breakout my common lisp programming to a different way...

10:02 sunnibo: chouser: thanks. there was an answer in my question, haha.

10:20 Cozey: can clojure call a java method with variable argument list ?

10:22 scgilardi: I think so. under the covers a varargs list is an array of objects. from clojure, you need pass that explicitly.

10:24 * DanC is a web/python/emacs guy, being dragged into the JVM world, struggling to learn to build .war apps; isn't ready to convert to the maven religion; hopes to soak up advice here

10:24 Cozey: scgilardi: ah, ok this explicitnes is what I was asking about - thanks for confirming

10:25 chouser: I'm a maven unbeliever living in a maven world.

10:25 DanC: chouser, do you practice maven, then? or use something else?

10:26 chouser: I allow maven to use me ...er, I mean yes, I use maven.

10:27 DanC: ok.

10:27 in ant, copying a .war file to the jboss deployment directory is one line.

10:27 can I do that with maven? or is that heresy?

10:28 I gather there's an orthodox way to do .war deployment

10:28 it seems that maven wants to control the .war container

10:29 maybe there's some orthodox way to use jboss.

10:29 * DanC finds http://mojo.codehaus.org/jboss-maven-plugin/

10:30 cemerick: DanC: There's no reason why you can't use Ant — but in that case, make sure you use the ant maven plugins so you can have sane dependency management.

10:30 chouser: I haven't done .wars in maven yet. In fact, I managed to pawn that task off to a co-worker recently.

10:30 So maybe now I'll never have to.

10:31 cemerick: chouser: Not sure you won that one. ".wars in maven" is a one-line change to the pom.

10:31 :-)

10:31 chouser: nope, definitely a win

10:31 DanC: ok, that's the 2nd suggestion of ant+maven plugins.

10:31 cemerick, I'm curious what you use; care to say?

10:32 Cozey: and this: http://cargo.codehaus.org/ ?

10:32 cemerick: DanC: To be clear, I certainly don't *recommend* it, but if you're predisposed to ant, I won't argue with that.

10:32 Cozey: Cargo is tough. It's original author has stepped away AFAIK (he's the jclouds lead now FWIW).

10:33 s/It's/Its

10:33 DanC: I've got a few hours invested in ant, but nothing I'm not willing to throw away. (I have decades invested in plain old make)

10:33 cemerick: DanC: I'm all-maven over here.

10:33 DanC: Since you asked: http://cemerick.com/2010/03/25/why-using-maven-for-clojure-builds-is-a-no-brainer/

10:34 DanC: I certainly agree with "It’s the community, stupid."

10:34 cemerick: It sounds like you want to control jboss locally for development purposes?

10:35 DanC: the java community is so so enterprise-y; the web is so often treated as secondary. so I struggle with that a bit

10:36 cemerick: Funny, I linked to Cargo myself in that post! :-P

10:36 sunnibo: question: there is a map, {:outer 3 :inner {:a 1 :b 2}}. can i extract :outer and :a? {:outer 3 :a 1}

10:36 Cozey: sonatype polyglot - nice

10:37 DanC: FWIW, "Fun and Frustration with Scala" gives a bit of my background w.r.t. the JVM http://www.advogato.org/person/connolly/diary/71.html

10:37 cemerick: Scala in jedit and textmate? *shudder*

10:37 sunnibo: select-keys seems to works only with one-level (not-nested) map.

10:39 cemerick: DanC: Also FWIW, some posts of mine related to deployment, etc: http://cemerick.com/category/devops/

10:39 There's a painfully-long screencast in the most recent one that you may or may not find useful. :-P

10:40 chouser: sunnibo: with what other input? something like [:outer] and [:inner :a], or ...?

10:43 Cozey: Does anyone know of any real debugger for clojure initiative ?

10:45 raek: Cozey: http://georgejahad.com/clojure/swank-cdt.html is one

10:45 cemerick: Cozey: http://georgejahad.com/clojure/cdt.html — but that's probably not what you mean by a debugger

10:45 raek: I think there is at least one other

10:45 Cozey: i read about cdt but setup process scared me a bit

10:45 gfrlog: debugger == println, right?

10:45 chouser: DanC: try Ctrl-\ instead of Ctrl-C for backtrace fun on the JVM

10:45 Cozey: so i put it on pending list of my todo... and it's still there

10:45 is it good?

10:45 DanC: many thanks, cemerick; just what I was looking for

10:46 yes, chouser, I got that clue from the ##scala folks; I should have updated the blog post

10:46 raek: https://github.com/davidsantiago/swank-clj

10:46 cemerick: Cozey: It's the best game in town at the moment.

10:46 sunnibo_: chouser: here is a example: user> tt

10:46 {:a 2, :b 3, :user {:inner_a 5, :inner_b 9}}

10:46 user> (merge (select-keys tt [:a]) (select-keys (:user tt) [:inner_a]))

10:47 cemerick: ccw and Enclojure both have debuggers, and they're essentially easy-to-use, but don't have nearly the same level of Clojure-specific functionality as CDT

10:47 Cozey: i'll try it, thanks!

10:47 redinger: I'm curious to hear reports on this one: https://github.com/hugoduncan/swank-clj

10:48 Cozey: for me the lack of good debugger is a big showstopper for clojure adoption

10:49 chouser: sunnibo: hm. Is that better than this? {:a (-> tt :a) :inner_a (-> tt :user :inner_a)}

10:51 sunnibo: chouser: looks good. but i have many keys to extract..

10:52 gfrlog: ,((comp (partial apply hash-map) (juxt (constantly :a) :a (constantly :inner_a) (comp :inner_a :user))) {:a 2, :b 3, :user {:inner_a 5, :inner_b 9}})

10:52 clojurebot: {:a 2, :inner_a 5}

10:52 gfrlog: ^ don't do it that way

10:53 * gfrlog couldn't resist

10:53 sunnibo: user> (def tt {:a 2 :b 3 :c 4 :inner {:i1 5 :i2 6 :i3 7}})

10:53 #'user/tt

10:53 user> (merge (select-keys tt [:a :b]) (select-keys (:inner tt) [:i1 :i3]))

10:53 {:i1 5, :i3 7, :b 3, :a 2}

10:53 how about this one?

10:53 not bad?

10:54 gfrlog: sunnibo: I'd probably extract the inner map first: (let [other-map (tt :inner)] (merge ...))

10:54 dunno

10:57 chouser: (into {} (for [ks [[:outer] [:inner :a]]] [(last ks) (get-in {:outer 3 :inner {:a 1 :b 2}} ks)]))

10:58 DanC: cemerick, I just hit the part of your maven screencast where you mention you use netbeans. My machine bogs down when I try to use eclipse or netbeans or intellij. It's an Ubuntu linux box with 4GB RAM. What am I doing wrong?

10:59 (I'm also running 3 web browsers and oracle sql developer)

10:59 I can't tell whether linux is doing something stupid or whether the working set size of this stuff is just more than 4GB or somethine else

11:02 raek: (merge (dissoc tt :inner) (get tt :inner))

11:07 cemerick: DanC: That's old; I've used Eclipse + counterclockwise for almost a year now.

11:07 But…4GB is certainly sufficient.

11:07 I use Eclipse heavily as just one of 20+ apps I have running at a time on a 4GB laptop.

11:08 DanC: ok; that suggests that what I'm doing wrong is using linux.

11:10 bsteuber: does leiningen allow a global project.clj like cake?

11:10 sunnibo: raek: thanks

11:11 bsteuber: kind if weird adding the swank-clojure dev-dependency to every single project

11:11 *of

11:13 the-kenny: bsteuber: You don't have to do this with newer versions of leiningen

11:14 lein plugin install swank-clojure <version> and then simply lein swank

11:25 bsteuber: the-kenny: oh, cool, I'll try that :)

11:52 TimMc: DanC: I can't imagine that's the trouble.

11:53 DanC: hmm... got any other theories?

11:53 TimMc: Not really. Does the system monitor show Eclipse as being a big CPU hog?

11:54 * DanC hesitates to perform the experiment, as it sometimes takes the machine down completely

11:54 TimMc: ouch

11:54 Do other Java apps do the same?

11:55 DanC: sometimes I think so

11:55 other times, it seems that evolution is the culprit

11:55 TimMc: In my opinion, Evolution is *always* the culprit, even when it isn't installed.

11:55 But that's just me.

11:59 DanC: unfortunately, I'm in a Novell Groupwise enterprise.

11:59 manutter: DanC: can you just to "top" at the command line?

11:59 s/just to/just do/

11:59 DanC: I'm not aware of any alternative native client. the groupwise web client looks better every time evolution goes haywire, though

12:00 I can do "top" as long as the machine isn't so bogged down that i can't get the CPU cycles to get a terminal window to the foreground

12:00 sometimes I ctrl-alt-1 and log in at the raw console and run top

12:00 TimMc: Wow, you really mean it when you say "bogged down"...

12:01 cemerick: DanC: is this a 4GB hamster wheel or something?

12:01 * cemerick missed the background :-P

12:02 manutter: DanC: fwiw, you can do "top -n 1" to get just a one-shot snapshot of your current machine state

12:02 DanC: no, I think the machine was new about 6 months ago.

12:02 ordinary looking HP PC

12:02 TimMc: DanC: I don't suppose there's any weird suckware installed, like antivirus, etc.

12:02 manutter: and it's running linux? Which flavor?

12:03 TimMc: Ubuntu

12:03 DanC: no, I did a clean Ubuntu install myself.

12:03 ok, since I've got several people holding my hand, I'll try it; and I'll start top first...

12:03 manutter: my favorite Ubuntu cycle-hog is the search indexer, whatever the name of that thing was

12:04 DanC: oh crap! I haven't turned that off

12:04 anyway... let's see...

12:05 * DanC struggles to remember how to get top to sort by RES

12:05 TimMc: aha

12:05 I wouldn't be surprised if Eclipse generates a lot of filesystem flack with all its auto building and preference writes.

12:06 DanC: < and > to choose column

12:06 zakwilson: SQL has the ability to do "select ... join table1 foo on... join table1 bar on..." to join the same table twice. Can I do that with ClojureQL? How or why not?

12:06 TimMc: DanC: Alternatively, time to learn Emacs. :-)

12:06 gfrlog: Definitely not vim, you'll be stuck forever

12:07 DanC: I'm an emacs addict, but I don't see the relevance

12:07 manutter: It's always time to learn emacs, even if you don't need it now you'll need the head start ;)

12:07 DanC: evolution 10%, chromium 9.1, firefox-bin, java, chromium, java, e-calendar-fact, ...

12:08 gfrlog: emacs: it's macs brought into the internet age

12:08 DanC: Mem: 3950224k total, 3871192k used, 79032k free, 8740k buffers

12:08 firing up netbeans...

12:08 manutter: DanC: I'm a netbeans fan myself, but clojure seems to work best for me in an emacs setting

12:08 TimMc: DanC: Relevance? Well, if you want to write you some Clojure, Emacs is pretty nice.

12:09 manutter: Man, you have 3.8G used *before* firing up netbeans? Wow

12:09 What's eating all your ram?

12:09 TimMc: I wonder if you're thrashing your swap.

12:09 DanC: I still struggle to read linux memory numbers. I think most of that is cache

12:10 Swap: 4086780k total, 2546920k used, 1539860k free, 284912k cached

12:10 * gfrlog too

12:11 DanC: I'd be quite content to stay in emacs, but it's hard to find documentation on how to do anything without eclipse or the like

12:11 technomancy: o_O

12:11 TimMc: DanC: For Clojure?

12:12 technomancy: that's ironic, because the #1 problem that people report with using Emacs with Clojure is that there is too much documentation.

12:12 DanC: truth be told, closure isn't a big part of actual task. I'm just sort of a reluctant java guy, and I like my of the closure sensibilities

12:13 I'm trying to learn about ant vs ivy vs maven for building .war files

12:13 s/my/many/

12:14 cemerick: the hazards of phone tethering for internet :-/

12:15 halfprogrammer: Can I create a common-lisp style maplist in clojure with (reduce ...) or something?

12:15 https://gist.github.com/1029596

12:15 This is my current implementation. I want to see if I am missing something obvious...

12:16 DanC: "a broken appliance always works properly for the repairman." the machine isn't doing the bog-down thing, at least not badly

12:18 * DanC considers trying eclipse, but leans toward getting back to maven etc.

12:18 * DanC indulges in http://cemerick.com/category/python/

12:19 chouser: halfprogrammer: I don't think Clojure's got anything quite like that built in.

12:19 * dnolen almost sees how he can make DCGs in core.logic 2e3X faster ...

12:19 cemerick: DanC: oh, the sordid past!

12:19 DanC: Eclipse and maven are entirely orthogonal.

12:19 halfprogrammer: chouser: okay

12:19 technomancy: cemerick: if only that were true =(

12:19 dnolen: cemerick: how did the meetup go yesterday? sad I couldn't make it.

12:19 technomancy: some shops use eclipse as their build tool

12:19 * technomancy has heard horror stories

12:19 chouser: halfprogrammer: your impl would be fine if you wrap the when-not not in (lazy-seq ...)

12:20 ...and change the when-not to (when (some seq colls) ...)

12:20 cemerick: technomancy: oh, yes. Evil, that. Eclipse is hardly alone among the IDEs in semi-encouraging bad behaviour w.r.t. local builds tho.

12:20 halfprogrammer: chouser: I will do that.

12:20 cemerick: local == interactive, unrepeatable

12:21 manutter: DanC: Nepomuk/Virtuoso, that was the name of the cycle-hog on my machine

12:21 cemerick: The Eclipse plugin development process is a particularly pernicious instance, tho.

12:21 halfprogrammer: chouser: I was looking into the implementation of 'map'. There is a function (step) being used. What does it do?

12:21 chouser: halfprogrammer: without the lazy-seq, it'll overflow the stack for large colls

12:21 'step' there should be local

12:21 halfprogrammer: I could not find any documentation step

12:22 chouser: ah yes, 'step' is defined in the enclosing 'let'

12:22 cemerick: dnolen: Good. Not a huge turnout — probably half due to the short notice of the talk, half to its content ;-) But, a good group, all new-ish to Clojure. Mostly the right audience, I think.

12:22 halfprogrammer: oops. Din't look at it properly

12:22 :D

12:22 cemerick: I was glad to catch up with Rich and pepper him with some questions.

12:24 halfprogrammer: cemerick: any interesting q&a with Rich?

12:26 cemerick: halfprogrammer: The most interesting discussion was about programming language ontologies, provoked by his seeing how Clojure Atlas is implemented.

12:26 Also some minutiae about type declarations and such.

12:26 * halfprogrammer referring to chouser's book for lazy-seqs

12:31 dnolen: ... hmm with groundness testing many core.logic program can just leverage Clojure's ridiculously fast operations on sequences and avoid the overhead of vars and unification entirely ...

12:40 zakwilson: I don't intend any offense here, but I'm starting to get the impression ClojureQL is a bit half-baked. Am I right to think that, or am I doing it wrong?

12:40 dnolen: zakwilson: what's the problem? I haven't used it much, what little I did I liked.

12:41 zakwilson: I can't find a way to alias table names when doing a join.

12:41 manutter: I think it's more a question of "not fully implemented yet"

12:42 I haven't looked at it in a while, though

12:43 zakwilson: I suppose unfinished might be a better way of putting it. I don't think the concept is ill-conceived - quite the opposite. My objection is that I keep not being able to do things.

12:43 dnolen: zakwilson: do you mean provide your own alias?

12:44 manutter: select * from foo f1 left join foo f2 on f1.parent_id = f2.id

12:45 Does it let you do stuff like that, or is that the problem?

12:45 zakwilson: dnolen: what manutter said.

12:45 http://pastebin.com/c5bNeVFj <-- this is what I actually want to do. I don't care about aliases as such; I just want to join the same table twice.

12:50 http://pastebin.com/364rcjv9 <-- this returns the sort of result I want, but using three queries instead of a join is the Wrong Thing.

12:52 dnolen: zakwilson: I'm taking it that the first thing just produces the wrong SQL.

12:53 zakwilson: dnolen: pretty much - it produces SQL that would be valid IF it could alias the name of the users table.

12:56 dnolen: zakwilson: clojureql seems pretty small and clean.

12:58 zakwilson: dnolen: conceptually, it seems brilliant. It just seems like it isn't *done*.

12:58 dnolen: what I mean is probably not be much effort to patch.

12:59 gfrlog: zakwilson: what do you feel like is missing?

12:59 zakwilson: gfrlog: right this second? A way to join the same table twice.

12:59 manutter: I just did some googling on "ClojureQL self join" and it looks like it's intended to support self joins

12:59 gfrlog: zakwilson: you mean join A to B twice?

13:00 manutter: select * from foo f1 left join foo f2 on f1.parent_id = f2.id

13:00 gfrlog: ah

13:00 * gfrlog goes to putter in his repl

13:01 zakwilson: To be specific, I mean this: http://pastebin.com/c5bNeVFj

13:04 gfrlog: yeah I'm having trouble using the table aliases :(

13:04 but it will produce ambiguous SQL for a self-join :)

13:09 timvisher: hey all

13:09 is lean-search still-supported?

13:09 lein*

13:11 technomancy: timvisher: it's included in lein 1.6

13:11 (due out one of these days)

13:11 but it's only for search now, not for editing project.clj

13:12 timvisher: https://github.com/technomancy/lein-search/tree/lucene works with older versions though

13:15 timvisher: technomancy: Ah! I had quoted the version number.

13:19 gfrlog: man IRSSI is so bad I might have to learn emacs :(((

13:19 hiredman: ~guards

13:19 clojurebot: SEIZE HIM!

13:20 gfrlog: hiredman: the jabber plugin seems to "work" but I can't for the life of me figure out how to list contacts or initiate conversations

13:20 hiredman: never used it

13:20 technomancy: jabber from irissi is probably done better via bitlbee than directly

13:20 not that I advocate irissi

13:21 gfrlog: sides if I switched to emacs then I could be a part of the perpetual "what is wrong with my slime" conversations

13:22 timvisher: gfrlog: but slime is so much fun.

13:22 as are the conversations. ;)

13:22 technomancy: the intellectual stimulation from such discussions should not be discounted

13:22 ~swank

13:22 clojurebot: swank is try the readme. seriously.

13:22 gfrlog: ~vim

13:22 clojurebot: Gesundheit!

13:22 timvisher: my wife actually hangs out behind me watching the irc go by as we talk about it. It's that impressive.

13:23 gfrlog: timvisher: that's a property of slime?

13:23 technomancy: why else would people ask their questions in here rather than reading the readme?

13:23 timvisher: yeah. she came with the download too!

13:23 gfrlog: also maybe I would finally know the difference between slime and swank :) (answer: only the second one comes before "server")

13:24 timvisher: also you could 'bang on files' in dired mode.

13:24 gfrlog: :-| wut?

13:24 timvisher: which has become my favorite phrase in the last 2 days

13:24 technomancy: timvisher: you mean wdired?

13:24 timvisher: no, just plain dired

13:24 mark a bunch of files and then press !

13:25 does a shell command only on those files

13:25 in a number of different ways

13:25 and it's awesome

13:25 technomancy: like interactive xargs?

13:25 timvisher: as in self-actually awesome

13:25 gfrlog: I guess I can use emacs for erc without having to use it for text editing at first

13:25 timvisher: hmm

13:25 gfrlog: presumably...

13:25 amalloy: technomancy: more like interactive find -exec, i'd imagine

13:25 timvisher: not even sure what you'd mean be interactive xargs

13:25 amalloy: yes

13:26 gfrlog: or like interactive "open windows explorer and perform your task on each file manually one-by-one" but automatically too

13:26 timvisher: now you're getting the picture!

13:26 gfrlog: :)

13:27 * technomancy thinks wdired still wins for wow-factor

13:27 timvisher: technomancy: if you've never read the '37.8 Shell Commands in Dired" section of the manual, you really should. :)

13:27 I regret having gone so long without it.

13:27 is wdired in vanilla emacs?

13:28 or do I have to install it?

13:28 technomancy: I think it was added in 23?

13:28 timvisher: google answered me

13:28 technomancy: http://www.youtube.com/watch?v=qhTLb59Eumo

13:28 timvisher: ah

13:28 gfrlog: emacs-chess??

13:28 timvisher: I didn't even know that was called that

13:28 I _love_ that feature of dired

13:29 especially combined with find-dired

13:29 gfrlog: and Go!

13:29 gfrlog: aw golly

13:29 okay I'm about to try erc for the first time

13:29 * timvisher claps euphorically

13:30 gfrlog: well, if I can figure out how to start it :(

13:30 Scriptor: gfrlog: good luck! erc is awesome, especially since you can split the screen and watch multiple channels a the same time

13:30 M-x erc?

13:30 hiredman: oh come on, does any console irc client not have the ability to split screen?

13:30 Scriptor: hiredman: console? No :p

13:31 gfrlog_: hiredman: I don't know how to do it in centerim or irssi; but I am lazy about looking stuff up

13:31 Scriptor: but in case he's coming from a gui irc backgroun

13:31 gfrlog: test from erc

13:31 amalloy: how does the kool-aid taste?

13:32 gfrlog: well; don't know how to do nothing :) but if I keep this screen session running forever, I can just leave it open and not worry about how I got it open in the first place

13:34 emacs got jabber too?

13:34 technomancy: gfrlog: yeah, there are two jabber clients, but most people prefer bitlbee

13:35 (one in pure lisp, one based on libpurple)

13:35 gfrlog: technomancy: technomancy: is your emacs workshop @SL filled up yet?

13:35 technomancy: gfrlog: not as far as I know =)

13:36 gfrlog: technomancy: okay, so I can avoid any difficult learning until then, and you will magically make me an expert?

13:36 technomancy: depends, how do you feel about potions and elixirs?

13:36 are you or are you not comfortable with the act of quaffing?

13:36 gfrlog: technomancy: you're referring to Ctrl-alt-meta key combinations?

13:37 amalloy: technomancy: more of an art than an act

13:37 * gfrlog has to admit he has no idea what the difference between a potion and an elixir is

13:37 technomancy: actually I'd recommend watching the peepcode before the workshop

13:38 gfrlog: dang if I can find it on their site OR google

13:38 oh wait

13:38 DanC: ok, enough soaking it in... trying out maven... holy cow! 75.3 MB!

13:38 gfrlog: hagelberg is a better search term than technomancy apparently

13:39 technomancy: http://peepcode.com/products/meet-emacs I do believe

13:40 gfrlog: technomancy: please tell me some of this money goes to you

13:40 technomancy: gfrlog: the peepcode royalties are very generous, yes =)

13:40 gfrlog: okay good

13:40 technomancy: highly recommended if you are looking for a publisher for that matter

13:41 hiredman: tens of bitcoins a year

13:41 gfrlog: that's a million dollars in future money

13:41 Scriptor: technomancy: do you have to get the recording software yourself? What about editing?

13:41 technomancy: Scriptor: for the two that I did in 09 I just provided the script and sample projects

13:41 hgoodman: selling point looks like the return of Wordstar! :-)

13:42 technomancy: Scriptor: I think now they prefer it if you can do rough video silent recordings and they do all the editing and voice-overs

13:43 gfrlog: ha: their "comments" section has an apparently outdated: “The PeepCode Emacs screencast is the awesomesauce and worth far more than $9 if you're just starting with Emacs.”

13:43 I hope "far more than $9" is >= $12

13:44 * technomancy blames inflation

13:44 technomancy: and wall street

13:44 gfrlog: yeah! blame bush!

13:44 and jimmy carter!

13:45 anyhow, thants for all the emacs tips folks

14:03 Scriptor: has anyone here ever used the emacs plugin that gives you vim keybindings?

14:07 ilyak: hi *

14:07 Is it possible to type hint an aget?

14:07 I have an array of strings

14:08 I do a lot of (aget array n)

14:08 and I get a lot of reflection warnings

14:08 hiredman: you need to type hint the array and type hint n

14:09 ilyak: n is a constant

14:09 How do I hint the array of String?

14:09 I mean, n is a literal

14:10 hiredman: ^objects should be good enough

14:14 ilyak: Cool! Thanks a lot

14:18 dnolen_: ,(class (make-array String 10))

14:18 clojurebot: [Ljava.lang.String;

14:18 dnolen_: ilyak: ^

14:19 ilyak: dnolen_: Are you sure you can say ^[LString in clojure?

14:19 dnolen_: ^"[Ljava.lang.String;"

14:21 cemerick: Some very surprising results in the survey so far…

14:21 dnolen_: cemerick: ?

14:21 timvisher: cemerick: which survey?

14:22 cemerick: ah, I've found the unconverted! :-D

14:22 timvisher: http://wp.me/p10OJi-94

14:22 gfrlog: everybody uses vim?

14:22 cemerick: Anyone here who hasn't completed the survey, please do so: http://wp.me/p10OJi-94

14:22 gfrlog: Nice try. :-)

14:22 manutter: Everybody loves Raymond. SOME people use vim.

14:23 :)

14:23 gfrlog: are the results publicly viewable somewhere?

14:23 Scriptor: cemerick: leak us some results pleease? :)

14:23 cemerick: gfrlog: they will be once the survey is closed

14:24 gfrlog: okay

14:24 cemerick: Scriptor: Nope, no cheating! :-)

14:24 gfrlog: same shtick as last year, FWIW: http://cemerick.com/2010/06/07/results-from-the-state-of-clojure-summer-2010-survey/

14:24 online votes with open results just beg to be gamed

14:25 gfrlog: what makes it more gameable?

14:26 jcromartie: seeing the gamed result is an incentive to game it, in itself

14:26 cemerick: providing feedback seems to provide some sense of motivation for box-stuffers

14:26 gfrlog: does Clojure-in-Clojure lead almost immediately to Clojure-in-JavaScript?

14:26 cemerick: Maybe that's not actually true, but there's no downside to holding back results for a week.

14:27 Scriptor: gfrlog: it opens it up to other platforms, but it wouldn't be immediate

14:27 cemerick: gfrlog: it makes things a helluva lot easier, at least for those aspects of Clojure that are possible on the host

14:28 Scriptor: although I think there's something like clj->js already out there

14:28 gfrlog: I guess you have a lot of decisions to make about interaction with the host platform

14:28 Scriptor: https://github.com/kriyative/clojurejs

14:28 cemerick: Scriptor: Big difference between clojure-generating-javascript (e.g. scriptjure) and Javascript-as-clojure-runtime.

14:30 halfprogrammer: cemerick: filled the survey form :)

14:30 gfrlog: there was something called clojurescript somewhere right?

14:30 Scriptor: cemerick: what else is needed beyond the code generation? Better interop?

14:30 cemerick: halfprogrammer: fabulous. Get 5-10 of your Clojure-using, Clojure-tinkering friends to do the same.

14:30 halfprogrammer: cemerick: sure

14:31 cemerick: gfrlog: Yup, that's chouser's baby.

14:33 Scriptor: Things like scriptjure and clojurejs perform a naive source-to-source translation. Useful as far as it goes, but there's no runtime, no compiler, namespaces, proper data structures, reference types, protocols…

14:35 gfrlog: no integer data types :)

14:35 technomancy: =(

14:35 gfrlog: I don't know how you can call something a programming language when it doesn't have integers

14:36 dnolen_: cemerick: of course it's not clear how much of Clojure is useful in JS ... Featherweight Clojure ?

14:37 gfrlog: I think it'd be useful. You could finally write client-side code you were proud of

14:39 dnolen_: gfrlog: a lot of things would be difficult to port or pointless. I'd be happy with Clojure 1.1 sans immutable datastructures (just copy on write)

14:39 gfrlog: I think new-javascript provides immutability

14:39 Object.freeze or something like that

14:40 and you can imitate immutability otherwise

14:40 Scriptor: immutable data structures are more than that though

14:40 cemerick: dnolen_: I think that's probably what the target would be

14:40 gfrlog: Scriptor: sure, but all you need is the building block

14:41 without that you have to use closures

14:41 Scriptor: gfrlog: well, you really don't even need Object.freeze, maybe as a way to prevent mistakes

14:41 chouser: or improve performance

14:41 gfrlog: Scriptor: how else to implement immutability?

14:41 Scriptor: but immutable data structures could be done in the js we have now

14:42 chouser: I translated Rich's whole bit-partitioned hash-trie for maps and vectors to JavaScript

14:42 They work today, if you really want them.

14:42 stuartsierra: chouser: What was perf like?

14:42 gfrlog: chouser: how do you prevent modification?

14:42 chouser: stuartsierra: I don't think I ever really tested that

14:42 stuartsierra: ok

14:43 chouser: gfrlog: I didn't, but if you use conj and assoc, nothing would get modified.

14:43 gfrlog: right

14:43 dnolen_: Scriptor: *dog slow* immutable data structures you mean.

14:43 Scriptor: dnolen_: sure, but object.freeze isn't going to change that

14:43 chouser: gfrlog: if you go poking around in the internals, doing my_hash.whatever = "thing", well, you're on your own.

14:44 gfrlog: I like hard-immutability better :)

14:44 Scriptor: gfrlog: it's not about preventing modification

14:44 well

14:44 gfrlog: Scriptor: java does it

14:44 __name__: gfrlog: Building tree based persistent datastructures?

14:44 That do not involve copying stuff around.

14:44 chouser: gfrlog: you don't have truely enforced immutability in Java Clojure either.

14:44 Scriptor: gfrlog: for a deeper look, read into purely functional data structures

14:44 by okasaki

14:44 chouser: reflection, using mutables as keys and values, etc.

14:45 gfrlog: Scriptor: I know how the data structures are built

14:45 Scriptor: gfrlog: so you can see why you wouldn't need to explicitly freeze them?

14:45 gfrlog: I tried writing an enforced-immutability library in javascript; got bogged down

14:46 Scriptor: yes, if you're the only one using them and you trust yourself, you don't need to enforce immutability

14:46 chouser: back when I was working on contrib/clojurescript, rhickey kept telling me to just do copy-on-write for the collections, but I went ahead and did the whole thing anyway. Was good for learning, but perhaps not very useful otherwise.

14:46 gfrlog: I implemented a finger-tree-like data structure in erlang once

14:47 Scriptor: gfrlog: as long as the interface to the data structure doesn't mutate anything it should be fine

14:47 gfrlog: Scriptor: as long as you always go through the interface

14:48 JavaScript doesn't enforce that sort of thing

14:48 I don't know why it bothers me

14:48 Scriptor: sure, but if you're doing a clojure->js thing, then you can have it so that at least from the point of view of writing clojure code

14:49 there is *only* that interface

14:49 gfrlog: Scriptor: true true

14:49 but you lose it when calling-clojure-from-JS

14:49 and presumably you might build JS-interop into clojure, so even from clojure it's not guaranteed

14:51 chouser: gfrlog: {:a (atom 42)} ; mutable collection in Clojure

14:51 gfrlog: chouser: the value is always that atom

14:51 hiredman: atoms are not a value

14:51 chouser: but the value of the atom can change

14:52 gfrlog: hiredman: I meant value in the key-value-of-a-map sense

14:52 hiredman: atoms are mutable references

14:52 gfrlog: chouser: sure, but you expect that, and you're explicit about it

14:52 chouser: my point is that's not a "safe" collection. It does not provide the guarantees we expect from immutable collections

14:52 hiredman: gfrlog: the big win of immutability is computations based on values, and you just lost it

14:52 chouser: and Clojure allows it, without java interop or other hackery

14:53 hiredman: doesn't even provide stm type guarantees since it is an atom

14:53 gfrlog: chouser: it does provide the guarantees

14:53 you can't overlook the atom's value mutating because you have to deref it

14:53 that key will always map to that atom

14:53 amalloy: gfrlog: wut. you're totally wrong that it provides guarantees

14:54 gfrlog: amalloy: how so?

14:54 amalloy: you can't use that "mutable map" as a key in a map, for example, because it will hash differently depending on its current value

14:54 Scriptor: chouser: what did you mean by using copy-on-write for the data structures, every time you conj you just copy the array and append the new element onto it?

14:54 gfrlog: amalloy: an atom hashes differently when you update it?

14:54 chouser: Scriptor: exactly. which is what Clojure's collections do now when they're mall anyway.

14:54 small

14:54 Scriptor: ah

14:55 all collections? Even lists?

14:55 amalloy: ,(let [a (atom 1)] [(hash a) (swap! a inc) (hash a)]) ; let's try it and see

14:55 clojurebot: [15530730 2 15530730]

14:55 chouser: oh, no.

14:55 gfrlog: that's what I would expect

14:55 chouser: just vectors, hash-maps and array-maps I think.

14:55 gfrlog: same java object

14:56 Scriptor: are you guaranteed that it'll use the same memory address?

14:56 gfrlog: if you want to put mutable objects in your immutable data structures that's your responsibility, but it doesn't change the immutability of the data structure

14:56 hiredman: gfrlog: but an atom or a ref or an agent is not a value, so it does not matter if it is the same object

14:56 chouser: ok, let's back up a step. My point at the moment is that Clojure provides tools and expectations about immutability, not guarantees.

14:56 gfrlog: you can't swap the atom out for a ref

14:56 hiredman: gfrlog: so?

14:56 chouser: and it could do the same on a JS runtime.

14:56 dnolen_: amalloy: atoms hash consistently regardless of what value they hold.

14:56 amalloy: dnolen_: yeah, so i see

14:56 gfrlog: hiredman: the context is that I'm saying the java immutable data structures provide stronger guarantees than naive JS implementations

14:57 Scriptor: gfrlog: how so?

14:57 gfrlog: because in Java/clojure I cannot change the objects in an immutable collection

14:57 hiredman: gfrlog: given java reflection that seems naive

14:57 chouser: gfrlog: but you *can*

14:57 gfrlog: if they are ref objects, I can change their values, sure

14:57 chouser: reflection, mutable java objects as keys or values, etc.

14:58 gfrlog: reflection sure

14:58 I feel like it's valid to consider just the set of things you can do in java without reflection, but if nobody else is interested in that, then nevermind

14:58 hiredman: ,(let [a {:a (atom 0)}] (= a (do (swap! (:a a) inc) (println a) a)))

14:58 clojurebot: {:a #<Atom@1a30706: 1>}

14:58 true

14:59 gfrlog: hiredman: that doesn't change what I was saying

14:59 you still have a map with the key :a pointing to the atom 1a30706

14:59 hiredman: but the atom is not a value

15:00 so the map is not a value

15:00 gfrlog: no, but in a naive JS implementation, you could change the map itself

15:00 mutably add keys

15:01 hiredman: *shrug* you are obviously wrong, but I have things to do

15:01 gfrlog: chouser: reflection would let you mutably add values to a vector, e.g.?

15:01 chouser: gfrlog: I believe so, yes. You'd change some private fields to public, and then mutate them. It's all Java arrays inside.

15:02 gfrlog: does nobody understand the distinction I'm making?

15:02 dnolen_: gfrlog: I agree with you.

15:02 gfrlog: dnolen: thanks :)

15:02 chouser: gfrlog: To the extent that I understand your distinction, I don't think it matters.

15:02 gfrlog: chouser: I could grant you that

15:02 dnolen_: gfrlog: in fact I think it's a point that you can leverage in an interesting way.

15:03 amalloy: gfrlog: can't you really-actually hide information in js, by returning a closure?

15:03 gfrlog: amalloy: yeah, that's how I'd do it

15:03 amalloy: and then it's actually immutable afaict

15:03 gfrlog: amalloy: https://github.com/fredericksgary/persistent_js

15:03 chouser: even without reflection, just with normal java interop you can make clojure's immutable collections mutable enough to for the distinction to be useless

15:03 gfrlog: that's nowhere near functional, but that was my approach

15:03 chouser: how's that? does it have to be that way?

15:04 chouser: the reason that's not a problem in clojure is because we have good tools to accomplish our jobs without that. clojure makes it easy to do the right thing.

15:04 no matter how possible doing the wrong thing still is.

15:05 who gave this analogy recently -- was it Halloway? It's like how sidewalks are still useful even without guardrails to keep us on the path.

15:05 amalloy: cemerick: had a good time reading last year's results just now. thanks for the link

15:06 rhickey: chouser: I did

15:06 gfrlog: chouser: sometimes I get too interested in orthogonal issues :)

15:08 chouser: rhickey: ah yes, in Fogus' interview. Sorry.

15:10 rhickey: nothing to be sorry about, you were just asking

15:10 Stu will be saying it soon enough :)

15:12 hiredman: I have this theory that rhickey and halloway are the same person, they say the same things, never seen a photograph of them together, never both in #clojure at the same time, etc

15:12 gfrlog: did halloway introduce rhickey @conj?

15:12 devn: yes.

15:13 Scriptor: I saw them next to each other once

15:13 hiredman: it persists even though I saw both of them on the bus at the conj

15:13 devn: i saw them both. they are two separate people.

15:13 there may be some vulcan mind-melding at play, though...

15:13 Scriptor: stunt double?

15:13 gfrlog: if he alternates between the two identities really fast, maybe it is enough to convince you there are two people

15:14 chouser: I think it's more likely that they're both 3-dimentional aspects of the same multidimentional being

15:14 hiredman: perhaps a transporter accident..

15:15 redinger: It's just a trick with mirrors

15:44 TimMc: hiredman: So, atoms are not values, but contain values?

15:45 ,(atom (atom 5)) WHERE IS YOUR GOD NOW

15:45 clojurebot: #<Atom@19d5fe6: #<Atom@103074e: 5>>

15:45 hiredman: I never said atoms contain values

15:45 I said atoms are mutable references

15:46 gfrlog: :)

15:47 ha -- just noticed that http://clojure-log.n01se.net/ highlights "rhickey" in red

15:48 amalloy: gfrlog: could be because he has ops, not special-cased on name

15:48 hiredman: it is special cased on his nick

15:50 gfrlog: if only the statements were highlighted instead of the nick

15:54 Scriptor: he's not always opped though, chanserv has guard on here

15:58 TimMc: hiredman: Seriously, though -- why do you not consider a mutable reference to be a "value"?

15:58 I'm confused about how you define that term.

15:58 gfrlog: I think it's a more abstract concept

15:58 for which mutability doesn't make sense

15:59 hiredman: because values are immutable

15:59 TimMc: Ah! Fair enough.

15:59 hiredman: 1, 2, 3, :foo, "bar", etc

15:59 [1 2 3]

15:59 TimMc: but not (ArrayList.)

15:59 hiredman: correct

15:59 gfrlog: nor (atom)

15:59 hiredman: indeed

16:00 bdesham: so if you're playing a game and your score goes from 80 to 90, then yes, your score changed, but the *values* 80 and 90 certainly didn't change

16:00 hiredman: correct

16:00 gfrlog: unless it's a drinking game

16:00 bdesham: gfrlog: haha

16:00 TimMc: Yeah, now rich's value/state/reference thing is coming back to me.

16:00 hiredman: your score is a mutable reference to a series of values over time

16:00 TimMc: http://clojure.org/state

16:08 Scriptor: the Clojure/core reading list page has some nice articles linked: http://clojure.com/reading.html

16:09 gfrlog: I like how it all starts with HDD

16:10 redinger: gfrlog: Almost like it was planned that way. ;)

16:12 Scriptor: heh, I accidentally discovered hdd in an essay writing course

16:13 gfrlog: Scriptor: it was part of the course?

16:13 Scriptor: gfrlog: nah, we were supposed to come up with our own topic

16:14 gfrlog: Scriptor: and you were interested in hammocks?

16:14 Scriptor: and I've done some of my best thinking with pencil and paper

16:14 ehh, metaphorically :)

16:14 gfrlog: aah; you meant the concept, not the talk

16:15 Scriptor: oh, sorry for the confusion, right

16:58 dnolen_: ooh cond w/ :let binding syntax from cgrand https://github.com/cgrand/parsley/commit/6c12b27f86de26c41bb811e2f2ecf4d2169edab1#L0R13

16:58 * dnolen_ likes Scheme's cond => ism

17:00 gfrlog: reusing a symbol in (let) feels like multiple assignment

17:02 jcromartie: gfrlog: you mean like...?

17:02 ,(let [x 1 x (inc x) x (inc x)] x)

17:02 clojurebot: 3

17:02 jcromartie: yeah

17:02 but at least it's all right there

17:03 gfrlog: I guess it's not quite as powerful as multiple assignment because you can't do it iteratively

17:03 jcromartie: right

17:03 and each let is its own scope

17:03 so you avoid the problems where a re-assignment happens in some godforsaken nested if block

17:04 you know you've been doing FP too long when you refer to if blocks as "godforsaken"

17:04 gfrlog: ah right -- the outer one is still accessible

17:05 you merely referred to _nested_ if blocks though; not as extreme

17:09 rsenior: I am getting an error when I try and run "lein compile" on windows that it can't find javac.exe

17:10 I have the JAVA_HOME setup, and I can run lein deps and it will work without issue, but it can't seem to compile, is there an environment variable I would need in windows that I don't need in Linux?

17:23 TimMc: rsenior: What happens if you just try to run javac from the command line?

17:24 (I guess that would be a PATH issue, though.)

17:24 rsenior: TimMc: it runs (displaying help output)

17:24 TimMc: interesting

17:24 gfrlog: yeah I figured "lein deps" wouldn't work otherwise

17:25 rsenior: TimMc: I'm up and running now, I removed Java and reinstalled it in a place that doesn't have spaces in the path, reset JAVA_HOME an PATH and it seems to be working

17:25 TimMc: huh

17:25 gfrlog: good ole whitespace

17:25 gets worse when you add bell characters

17:25 rsenior: I don't work much in windows and don't know much about Windows 7, so I was kind of stabbing in the dark anyway

17:41 mreynolds: What's the "right" way to specify use/require/etc with ns? Is it (ns x.y.z (:use ... or (ns x.y.z (use... ?

17:42 technomancy: clojurebot: ns?

17:42 clojurebot: transients are not mutable data structures: http://technomancy.us/132 or at least as far as you're concerned.

17:42 technomancy: clojurebot: ns is unfortunately more complicated than it needs to be, but http://blog.8thlight.com/articles/2010/12/6/clojure-libs-and-namespaces-require-use-import-and-ns may be helpful.

17:42 clojurebot: In Ordnung

17:42 dnolen_: http://lambda-the-ultimate.org/node/4293, if only we had Prolog built into our typechecker, ha!

17:43 technomancy: mreynolds: ^^

17:43 hiredman: yes, well

17:44 I was reading some f# blog post where the guy used the type system to constrain code to only being run on a particular thread

17:44 which seems pretty crazy

17:44 brehaut: hiredman: do you have a link for that?

17:45 hiredman: mmmm, tab seems to be gone

17:47 offby1: Now, there's a bot that should really do URL shortening

17:47 Cozey: good evening, how to run maven task 'sources-jar' in clojure source?

17:48 mreynolds: technomancy: gracias!

17:48 brehaut: hiredman: oh well, thanks anyway

17:51 gfrlog: hiredman: was it something you could do in Java as well? like subinterfacing runnable, and subclassing thread with the singleton pattern?

17:58 brehaut: gfrlog: at a guess, its probably using phantom types or a similar approximation

17:58 gfrlog: ooh, more learning

17:58 brehaut: gfrlog: its pretty trippy stuff :)

17:58 gfrlog: if I'm gonna learn emacs, I may as well learn haskell...

17:59 brehaut: you definately should learn some haskell

17:59 gfrlog: whatabout just a haskell?

17:59 brehaut: is that an option pun?

17:59 gfrlog: no

18:00 $google learn you a haskell

18:00 brehaut: pity

18:00 gfrlog: dangit where's sexpbot?

18:00 sexpbot: whatup?

18:00 clojurebot: go find your friend

18:00 clojurebot: No entiendo

18:15 TimMc: ouch

18:15 rejected

18:18 hiredman: ~google learn you a haskell

18:18 clojurebot: First, out of 174000 results is:

18:18 Learn You a Haskell for Great Good!

18:18 http://learnyouahaskell.com/

18:21 gfrlog: clojurebot is more useful than I thought.

18:29 Cozey: Hi, has anybody managed to get swank-cdt to evals under cake ?

18:29 amalloy: Cozey: last i heard swank-cdt wasn't compatible with cake

18:29 Cozey: mhm so this is still the case

18:29 goddamnit!

18:30 amalloy: Cozey: yeah, lance hasn't heard from george for quite a while, so i'd guess he's not really working on it

18:31 Cozey: spring came

18:31 gfrlog: sexpbot came back and personally apologized to me for his absence

18:32 hiredman: ~search for useful

18:32 clojurebot: <#clojure:gfrlog> clojurebot is more useful than I thought.

18:32 <#clojure:chouser> who gave this analogy recently -- was it Halloway? It's like how sidewalks are still useful even without guardrails to keep us on the path.

18:32 <#clojure:chouser> back when I was working on contrib/clojurescript, rhickey kept telling me to just do copy-on-write for the collections, but I went ahead and did the whole thing anyway. Was good for learning, but perhaps not very useful otherwise.

18:32 <#clojure:gfrlog> I think it'd be useful. You could finally write client-side code you were proud of

18:33 gfrlog: clojurebot is even more useful than I thought

18:33 amalloy: interesting that only gfrlog and chouser ever say the word "useful"

18:33 hiredman: you can page through results with a "page" number in square brackets

18:33 amalloy: limit 4 per "page"

18:34 ~search for useful [1]

18:34 clojurebot: <#clojure:chouser> back when I was working on contrib/clojurescript, rhickey kept telling me to just do copy-on-write for the collections, but I went ahead and did the whole thing anyway. Was good for learning, but perhaps not very useful otherwise.

18:34 <#clojure:gfrlog> I think it'd be useful. You could finally write client-side code you were proud of

18:34 <#clojure:dnolen_> cemerick: of course it's not clear how much of Clojure is useful in JS ... Featherweight Clojure ?

18:34 <#clojure:cemerick> Scriptor: Things like scriptjure and clojurejs perform a naive source-to-source translation. Useful as far as it goes, but there's no runtime, no compiler, namespaces, proper data structures, reference types, protocols…

18:34 amalloy: hiredman: yes, i know that isn't the whole result set

18:34 hiredman: anyway, also works in private message

18:35 gfrlog: hiredman: sweet

18:35 hiredman: someday I'll get around to a web ui for it

18:36 gfrlog: ~sexpbot

18:36 clojurebot: sexpbot is there is another

20:13 carllerche: I'm trying to use :gen-class to generate a log4j Layout, but when I refer to the layout in the log4j.properties file, it doesn't seem to find the class. Am I doing something wrong? https://gist.github.com/7874cd65ed655f2ce59a

20:26 amalloy: carllerche: you probably have to specify the class in the :aot list of your project.clj?

20:26 and then lein/cake compile it

21:12 gfrlog: is AOT only relevant for gen-class?

21:48 halfprogrammer: how do i get a sorted vector datastructure?

21:51 i would like to to be able to conj to the datastructure (maintaining order) in less than o(n)

21:52 scgilardi: will a sorted-set do the trick?

21:52 halfprogrammer: actually it would. but I would'n it take a lot more memory?

21:52 s/would'n/wouldn't

21:52 sexpbot: <halfprogrammer> actually it would. but I wouldn't it take a lot more memory?

21:53 * halfprogrammer has got something wrong with his typing since morning

21:53 scgilardi: I think the memory used would be ballpark similar. do you have a huge dataset or very limited memory available?

21:55 halfprogrammer: i am writing some utilities. I don't know how i will be using it later. i thought i could use as little memory as possible

21:59 scgilardi: sorted-set seems like the right tool. Here's some more info about how Clojure's persistent vector is implemented: http://blog.higher-order.net/2009/02/01/understanding-clojures-persistentvector-implementation/ . Most of Clojure's persistent data structures are trees under the hood.

22:01 halfprogrammer: thanks for the share. will look at it now.

22:02 scgilardi: you're welcome

22:10 hiredman: technomancy: I wonder if clojure mode could interact with clojure over slime to do things like highlight locals different from globals, etc

22:43 duck1123: I have a question that I'm unable to find a good answer. I have a ring app that I'm building with maven. I'm using mongodb for the db, but that shouldn't matter as much. I simply want a different set of config options to be used when testing

22:43 I'm currently using lazytest, but I might be willing to switch at this point

22:44 seancorfield: i just ran into java.lang.Exception: Cyclic load dependency when compiling... i added a new :import of a java class in one of the namespaces that my code being compiled depends on... any suggestions on approaches to fix that?

22:46 without the :import it compiles, with it... boom... the code being compiled is a log4j appender, the imported class is the c3p0 ComboPooledDataSource

22:47 it looks like c3p0 depends on log4j so i guess that's what is causing the problem :(

22:48 hmm, adding that import to the code being compiled causes a fairly immediate compilation failure on that namespace alone...

22:51 from the stacktrace, it looks like compiling the namespace actually runs code in that namespace?

22:52 i see at worldsingles.logging.dbappender$loading__4532__auto__.invoke(dbappender.clj:5) in the stack trace - which points at the (ns) call... guess that makes sense... executing that tells it what / how to compile...

23:07 the solution was to break the chain of dependencies by removing the :require in the compiled code and using (resolve) to load the necessary symbol at run time

Logging service provided by n01se.net