#clojure log - Nov 18 2010

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

0:40 sandGorgon: i have a 3rd party jar that i want to use in my leiningen project - I cannot bundle it to clojars. how do i use it ? because copying it in the "lib" folder causes it to be deleted whenever i do "lein clean"

0:41 amalloy: sandGorgon: i'm not an expert here, but if you can build their jar with maven i can help

0:42 LauJensen: "im no expert here, so if you drink my poison I may be of some assistance" :)

0:42 amalloy: LauJensen: more or less

0:42 _ato: sandGorgon: one way is to install it to your local maven repository (~/.m2). Leiningen will look for a jar there before it goes searching clojars etc

0:42 sandGorgon: amalloy, well i have the jar itself lying with me

0:43 _ato, let me try that... kinda inconvenient though

0:43 amalloy: sandGorgon: that's basically my suggestion too :P

0:43 _ato: something like this, I think: mvn install:install-file -Dfile=foo-1.0.jar -DgroupId=org.some.group -DartifactId=foo -Dversion=1.0

0:43 LauJensen: sandGorgon: That would be my suggestion too, 'cake install jarfile.jar'

0:48 _ato: might be able to stick it in ~/.lein/plugins too

0:48 I'm not sure if that gets appended to the project's classpath or only lein itself's classpath

0:49 won't get bundled with uberjar though

0:54 sandGorgon: hmm.. there is :native-path

1:06 ahh... copy the 3'rd party libs to the "lib" folder itself. Just set ":disable-implicit-clean true" . lein wont delete-recreate the lib folder

1:56 joshua__: I have a vector of vectors. How can I insert two vectors into the middle of this vector of vectors. Like [stuff stuff (create-two-vectors) more-stuff] would produce [stuff stuff created created more-stuff]?

1:59 Sorry if this isn't even possible. From what I've read it is suppose to very easy to do whatever you want in lisp by typing (turn-off-gravity). Actually that was python, but still.

2:02 amalloy: joshua__: it's possible, but usually you shouldn't

2:02 vectors have fast random access, and fast append, but slow insert

2:03 (that's one of the reasons there's no easy way to do it)

2:03 joshua__: kk

2:04 So how about good documentation for hiccup?

2:04 amalloy: but concat would be the way to go, if you wanted to (i think)

2:06 joshua__: I was just trying to write more dryly with hiccup, I'm pretty sure there has to be a more dry way to add labels to these form input fields. =(

2:06 amalloy: don't know anything about hiccup, i'm afraid

2:09 but here's a really gross way to do what you asked: ##(let [vs [[1 2] [3 4] [5 6]] [before after] (split-at 1 vs)] (apply conj (vec before) [7 8] [9 10] after))

2:09 sexpbot: ⟹ [[1 2] [7 8] [9 10] [3 4] [5 6]]

2:09 joshua__: Bad pun 1: Don't worry I won't hold my breath. Bad pun 2: You don't know it, I'm scared now! What templating library should I use!?! Look you scared away the hiccups.

2:11 amalloy: i'm sure LauJensen will come by any moment to tell me how dreadful my answer is...

2:11 joshua__: Yea, I'll pass on that. Don't sweat this one I can make it through without fixing it, it is no problem at all.

2:12 You already made me dance for joy, your doing great! ;P

2:12 amalloy: my life's work is complete

2:12 therefore: i will go to bed. enjoy clojure, joshua__

2:12 joshua__: Thanks, have a good night sleep!

2:18 LauJensen: joshua__: hiccup is php for clojure, try Enlive

2:19 joshua__: Thank you so much! I was really not enjoying hiccup, but was going to keep trecking on.

2:20 LauJensen: joshua__: Enlive gives you 100% code/presentation separation, bestinclass.dk is totally enlive generated and opensource

2:30 joshua__: Oh your that guy! Some of your articles got me interested in clojure! You also helped me set up emacs. =)

2:32 I'm going to head to bed, thanks for the advice. Going to dive into enlive tomorrow.

2:48 LauJensen: Great, see you tomorrow :)

2:49 bobo_: naw, dont call hiccup php, nothing deserves to be compared to php :-/

2:49 but i see your point =)

2:49 LauJensen: bobo_: right...except hiccup :)

2:50 bobo_: i showed a frontend guy how enlive works at work... he didnt belive me it could work

2:50 he thought his jquery templates was as good as it gets

2:58 kotrin: jquery templates?

3:01 bobo_: its a plugin to jquery

3:01 it has for loops and craps in the html

3:01 and it puts html in your javascript

3:02 LauJensen: bobo_: Its essentially the same as Pure in that regard. Its a proven technique :)

3:05 bobo_: Pure?

3:06 LauJensen: Pure is a javascript lib which has similar capabilities, just without the awesomeness

3:06 raek: jk_: pong!

3:09 bobo_: Pure looks 10 times cleaner then the crap he used. why did he use that crap *sigh*

3:15 raek: bobo_: btw, did you see the "guestbook" ampleyfly and I did for the last Linköping Clojure User Group meeting?

3:16 ring + moustache + enlive + 90's HTML

3:17 http://services.raek.se/guestbook/

3:17 if you look at it for too long time, you will go blind

3:17 LauJensen: raek: Man you could patent ugly

3:18 raek: :)

3:18 bobo_: raek: no i didnt!

3:18 omg!

3:19 kotrin: holy batmans this is an awesome website

3:24 _ato: it needs a frameset, blink tag and a marquee

3:24 I like the mouse following cat thing

3:42 raek: https://github.com/raek/lcug-guestbook

3:54 hiredman: *cough*

3:54 pardon me

5:00 Tordmor: Hi! Any idea on how to rephrase that? http://pastie.org/1307987

5:03 raek: if you use refs, you don't need the exceptions

5:05 (defn new-player [players name] (if (contains? players name) false (alter players assoc name (ref (make-player name)))))

5:07 sorry. ...(contains? @players name)...

5:07 and (do (alter ...) true)

5:07 but with atoms, I think throwing an exception is the only way to abort the change

5:09 Tordmor: ok, thanks. How is the performance/memory with refs as opposed to atoms?

5:09 raek: you could perhaps factor out the function you pass to swap!

5:10 and call it something like non-replacing-assoc

5:10 atoms are more lightweight, but limited

5:11 Tordmor: :)

5:11 wrong window, sorry

7:03 blubber: Hi, any emacs guru around that can tell me how to change the color of parenthesis in clojure-mode?

7:16 hsuh: first time i needed mutable state and i'm having trouble... is there a better way to express those forever-running loops (code doesnt work because swap! takes a function): http://pastie.org/1308193

7:19 AWizzArd: hsuh: there is also reset!

7:19 Which takes no function.

7:20 Your defn example is best be (reset! your-atom 10)

7:20 if there were not reset! you would say (swap! yout-atom (constantly 10))

7:20 hsuh: ow! thanks a lot man

7:20 how should a beginner find about that? i was looking at http://clojure.org/atoms

7:21 Tordmor: hsuh: by asking on irc :)

7:22 AWizzArd: hsuh: you could search all docstrings for "atom" and see where it shows up.

7:22 (find-doc "atom")

7:22 hsuh: hm, right...

7:22 AWizzArd: It also lists reset!.

7:23 hsuh: ooops, also forgot to deref

7:54 jk_: raek: u there?

7:54 raek: yes

7:54 jk_: raek: http://tinypic.com/r/11iha34/7

7:55 raek: that's how you run a snippet in the current repl in ccw

7:55 raek: you were asking about it last night but i wasn't at a computer

7:56 raek: ah, I got the answer from someone else

7:56 jk_: that was me :)

7:56 i was on my phone last night

7:56 raek: neat that it has the same keyboard binding as in emacs...

7:57 jk_: raek: i don't know if it's a conflicting binding with another pluging or what but the kb shortcut doesn't work. i actually have to click it, which is mildly annoying

7:57 raek: i have a ton of plugins loaded so i'll need to look at that a bit closer

8:02 AWizzArd: JFYI, interesting: http://www.infoq.com/interviews/functional-langs

9:20 edw: Any Incanter users here?

9:20 blubber: Hi, any emacs guru around that can tell me how to change the color of parenthesis in clojure-mode?

9:24 aan4nd: Hello folks. Is anyone able to either link me to, or walk me through, the most basic possible set of steps for getting a REPL running in vimclojure? I feel I have exhausted Google's usefulness.

9:40 rhickey: ,(.. Runtime getRuntime totalMemory)

9:40 clojurebot: 28307456

9:40 rhickey: take that, -> :)

9:41 chouser: oh, fine.

9:41 stuartsierra: :)

9:42 chouser: rhickey: btw, thanks for sticking up for ... well, whatever you're sticking up for in LtU. Seriously out of my depth.

9:42 stuartsierra: chouser: I'm watching your Strange Loop talk right now.

9:42 * rhickey grumbles at fogus for throwing us into the LtU weeds :)

9:43 chouser: stuartsierra: you won't learn anything about Clojure there, but I hope you enjoy it anyway. :-)

9:44 stuartsierra: Doing an article on the same topic, wanted to check out other explanations.

9:46 rhickey: chouser: I liked your talk and wished more of the LtU commenters had watched it, just to see the modesty of the argument. There's such a cult of novelty and precedence there, and Clojure doesn't really play that, being mostly unoriginal

9:47 chouser: I probably should have read a few more papers than I did before claiming to talk about a subject like that.

9:47 rhickey: hm, interesting point.

9:47 stuartsierra: chouser: nah, you got it :)

9:47 rhickey: chouser: I do think you undersold protocols a bit, saying the only advantage was perf

9:48 chouser: rhickey: thanks for saying you liked it. That means a lot to me.

9:48 rhickey: compared to multimethods? what else do you get?

9:48 rhickey: advantages are also - grouping of related functions, good bridge to host, concrete mixin and implementation composition

9:48 fogus`: rhickey: Whoops. I was certain there would be a more thoughtful discussion. :-(

9:49 chouser: Mmm, bridge to host is indeed a bigger deal than I made of it.

9:49 rhickey: fogus`: no worries, I think they are coming around :)

9:49 chouser: the grouping of related functions I intentionally dropped, as it wouldn't be hard to build something for that ad-hoc on top of multimethods

9:50 rhickey: chouser: really? I wonder

9:51 without circumscribing the dispatch, what do you hang the grouping on?

9:52 what is the equivalent of satisfies?

9:52 fogus`: chouser: I thought it was a very nice talk. I rarely post on LtU, but thought your talk was a nice reason to break my silence.

9:54 chouser: the grouping with protocols is mainly useful from the host perspective, and sure "satisfies"

9:54 since name resolution is still at the namespace level

9:54 rhickey: and documentation

9:55 chouser: yes

9:55 rhickey: and mixin composition

9:55 stuartsierra: Is "disj" suitable as "remove from generic unordered collection"?

9:56 rhickey: stuartsierra: that's not a set?

9:56 stuartsierra: not a set per se

9:56 rhickey: if it has dupes what does disj do?

9:57 stuartsierra: no dups

9:57 abedra and I wrote a consistent hashing impl

9:57 rhickey: so a collection of unique items that's not a set? hrm

9:57 stuartsierra: I made it implement conj, disj, and ILookup

9:58 rhickey: how is it not a set?

9:58 stuartsierra: stu halloway thought we were abusing deftype by calling it an IPersistentSet

9:59 rhickey: in what way was it not?

9:59 stuartsierra: If you call "get" or IFn.invoke, it acts like a map. If you call conj or disj, it acts like a set.

10:00 rhickey: maybe you're abusing get and IFn

10:00 stuartsierra: hrm

10:01 rhickey: or, it's really a map

10:01 stuartsierra: I think it's both map-like and set-like.

10:01 You want set-like behavior when you add or remove nodes.

10:02 And map-like behavior when you look up the node for a given input key.

10:02 rhickey: you're pushing it with the latter

10:03 in that sense all functions are map-like

10:03 just use a named function

10:03 stuartsierra: hmm, ok.

10:04 tonyl: morning

10:04 stuartsierra: It was just really convenient to say (map my-consistent-hash bunch-of-inputs)

10:07 rhickey: stuartsierra: well, the IFn thing is less bad than get

10:09 IFn doesn't break IPersistentSet

10:09 stuartsierra: And "get" does?

10:10 rhickey: yes, you break with the semantics of get

10:10 for sets

10:10 stuartsierra: ah, ok, that makes sense

10:17 raek: blubber: I only know of this: http://dishevelled.net/elisp/rainbow-parens.el

10:27 mattmitchell_: i'm trying to find a way to test that a string is not empty, is there something like ruby's blank? string method?

10:28 stuartsierra: ,(empty? "")

10:28 clojurebot: true

10:28 stuartsierra: ,(clojure.string/blank? " ")

10:28 clojurebot: java.lang.ClassNotFoundException: clojure.string

10:28 stuartsierra: (require 'clojure.string)

10:29 mattmitchell_: stuartsierra: awesome thanks.

10:30 ok cool, looking at the string api now :)

11:04 Tordmor: blank? doesn't seem to know unicode whitespace

11:04 ,(let [s (str \uFEFF \uFEFF)] (prn s (count s) (clojure.string/blank? s)))

11:04 clojurebot: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: clojure.string

11:05 stuartsierra: It's going by java.lang.Character/isWhitespace

11:10 Tordmor: Ah, as opposed to isSpaceChar

11:11 makes sense

11:22 rata_: hi

11:23 is there any difference between (merge-with into ...) and (merge-with merge ...)?

11:23 (besides into being more general, as it also works with any kind of seq, not just maps)

11:26 chouser: rata_: in general, into can be used anywhere you use merge, except that into take exactly 2 args where merge can take more

11:32 rata_: chouser: ok, thanks

11:33 in the case of merge-with, that's not a problem, because into will always receive two args

11:33 chouser: right

11:33 rata_: and is there any difference on performance between them?

11:36 chouser: into currently uses transients, while merge does not. Hm, but merge uses .reduce on the seq chunks.

11:36 rata_: I guess I'd use 'into' unless you have a specific need for merge, or measure if you care enough to see which is faster in your use cases.

12:09 AWizzArd: ,(quote ?[]) ; ==> ?[]

12:09 clojurebot: ?

12:11 hiredman: AWizzArd: what are you doing?

12:12 ?[] is a symbol followed by an empty vector and quote quotes one thing

12:17 AWizzArd: hiredman: can ?[] not be a symbol?

12:18 amalloy: AWizzArd: [] are not legal symbol characters

12:18 AWizzArd: I see.

12:18 amalloy: &(symbol "?[]")

12:18 sexpbot: ⟹ ?[]

12:18 amalloy: er

12:18 wow

12:18 AWizzArd: Not legal when the reader is doing it.

12:18 * amalloy is a liar

12:19 hiredman: right, the reader's dispatch table sees [ and starts a vector

12:21 chouser: well, I think it's correct to say they're not legal and that 'symbol' doesn't check for legality.

12:22 chances are eventually either that will become legal and get a reader syntax (perhaps |?[]|), or 'symbol' will check and reject it.

12:23 amalloy: chouser: good point. now that i think of it, you can get all kinds of actually-illegal symbols and keywords that way

12:23 &(keyword "this has spaces in it")

12:23 sexpbot: ⟹ :this has spaces in it

12:28 Lajla: chouser, is (symbol "true") a legal symbol?

12:29 ->(symbol "true")

12:29 &(symbol "true")

12:29 sexpbot: ⟹ true

12:29 amalloy: Lajla: true is certainly a legal symbol

12:29 chouser: Lajla: sure

12:30 ,(= true 'true)

12:30 clojurebot: true

12:30 chouser: oh

12:30 Lajla: That still doesn't prove its symbolhood

12:30 &(symbol? true)

12:30 sexpbot: ⟹ false

12:30 Lajla: That disproves it though

12:30 chouser: &(symbol? 'true)

12:30 sexpbot: ⟹ false

12:30 amalloy: Lajla: no it doesn't

12:30 Lajla: True is a self evaluating boolean

12:30 Seems to me.

12:30 Not a symbol

12:31 amalloy: &(let [x 1] (symbol? x))

12:31 sexpbot: ⟹ false

12:31 amalloy: x is obviously a symbol here

12:31 Lajla: Yes

12:31 but that's not my issue

12:31 The point if is true is a symbol.

12:31 Like nil and T are in CL.

12:31 chouser: Lajla: your examples were not what you meant, but I see your point.

12:31 it is a good point

12:31 Lajla: And if a symbol composed of the chars t, r, u, and e, is a legal symbol.

12:32 What I mean is, that the reader has a praecidence of the boolean over the symbol doesn't per se mean that such a symbol cannot exis.t

12:32 Or be created by other means.

12:32 Like (symbol "true")

12:32 &(= (symbol "true") true)

12:32 sexpbot: ⟹ false

12:33 amalloy: &(symbol? (symbol "true"))

12:33 sexpbot: ⟹ true

12:41 Lajla: amalloy, so yeah, the reader basically gives praecidence to the boolean over the symbol.

12:41 Not sure if a symbol like that is legal.

12:41 well, it is.

12:41 &(symbol? (symbol "Ich liebe dich, und I worship your shadow {][[]p][]."))

12:41 sexpbot: ⟹ true

12:42 Lajla: Seems clear to me that it's a possible symbol, there's just no reader syntax for it.

12:42 Not too unusual.

12:42 &(= #(+ 1 %) '#(+ 1 %))

12:42 sexpbot: ⟹ false

12:42 Lajla: Hmm

12:43 Memory location maybe

12:43 &('#(+ 1 %) 2)

12:43 sexpbot: java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn

12:43 amalloy: Lajla: they're different classes

12:43 Lajla: Hmm

12:43 list eh

12:43 &'#(+ 1 %)

12:43 sexpbot: ⟹ (fn* [p1__6287#] (+ 1 p1__6287#))

12:43 Lajla: Ahaa

12:44 raek: that is what the evaluator gets

12:44 Lajla: &(conj 3 '#(+ 1 %))

12:44 sexpbot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IPersistentCollection

12:44 Lajla: Whoops

12:44 wrong order

12:44 &(conj '#(+ 1 %) 3)

12:44 sexpbot: ⟹ (3 fn* [p1__6303#] (+ 1 p1__6303#))

12:52 alexyk: I'm trying to use incanter after already using io, get: java.lang.IllegalStateException: copy already refers to: #'clojure.contrib.io/copy in namespace: user (NO_SOURCE_FILE:0)... how do I hide copy again?

12:54 amalloy: (use '[clojure.contrib.io :exclude [copy]])?

12:55 alexyk: there's also ns-unmap: ##(doc ns-unmap)

12:55 sexpbot: ⟹ "([ns sym]); Removes the mappings for the symbol from the namespace."

12:55 alexyk: amalloy: yes, the copy is already in scope and need to be purged

12:55 amalloy: right. so ns-unmap once (or restart the repl), and after that :exclude

12:55 alexyk: this is really annoying as IllegalState prevents Incanter to be loaded

12:56 amalloy: alexyk: nonsense

12:56 alexyk: in some cases we get a warning, so I didn't expect an f-up

12:56 amalloy: (require) instead of (use)

12:56 hiredman: use clojure.java.io instead of the clojure.contrib.io

12:56 alexyk: hiredman: ah ok

12:57 amalloy: which is a good habit anyway, so that you and/or people reading your code can tell where the functions came from: (:require [foo.bar.io :as io])

12:57 hiredman: hmm, actually, that is loopy

12:57 incanter is bringing in it's own copy when you :use it?

12:57 alexyk: hiredman: yep

12:58 hiredman: well then you need to require

12:58 I would recommend :require incanter and :use clojure.java.io

13:02 alexyk: incanter is very fragmented, everything is in a different namespace... have to use all with an :as I guess

13:04 hiredman: you might look at nstools, it's googleable

13:48 imphasing: I'm attempting to format a number with google refine, so that commas are inserted every 3 digits, as per US custom. Does anyone know if there's an easy way to do this with clojure?

13:51 LauJensen: Gentlemen, after 2.5 hard years Im excited to announce ClojureQL is now released in 1.0.0 beta! Screencast + Blogpost showing the basics here: http://bestinclass.dk/index.clj/2010/11/clojureql--1.0.0-now-in-beta.html - Feedback is encouraged :) There's also a #clojureql for those who need support

13:54 chouser: & (.format (java.text.NumberFormat/getInstance) 12345678)

13:54 sexpbot: ⟹ "12,345,678"

13:54 chouser: imphasing: but I think that's locale-dependant

13:55 imphasing: chouser: Ah, ok. I decided to just make a dirty webservice in PHP to interface with refine

13:56 chouser: & (.format (java.text.DecimalFormat. "##,##.00") 12345678)

13:56 sexpbot: , java.lang.Exception: EOF while reading

13:56 clojurebot: Invalid token: java.lang.Exception:

13:56 sexpbot: .00") 12345678) java.lang.Exception: Unable to resolve symbol: .00 in this context

13:56 chouser: ,(.format (java.text.DecimalFormat. "##,##.00") 12345678)

13:56 sexpbot: , java.lang.Exception: EOF while reading

13:56 .00") 12345678) java.lang.Exception: Unable to resolve symbol: .00 in this context

13:56 clojurebot: "12,34,56,78.00"

13:56 Invalid token: java.lang.Exception:

13:57 chouser: weird

13:57 hm probably want ##,###.00 instead

13:57 sexpbot: , java.lang.Exception: EOF while reading

13:57 #.00 instead java.lang.Exception: No dispatch macro for: .

13:57 clojurebot: Invalid token: java.lang.Exception:

13:58 chouser: oh, I see. I'm making sexpbot start it's message with a , which triggers clojurebot to fail. hooray.

13:59 mroessler: @LauJensen: Have you thought about windowing in ClojureQL? For example, from you aggregate example that is the equivalent of "SELECT corr(x+y) from users", how about implementing "SELECT corr(x+y) over (partition by something order by somethingelse) from users"?

14:01 LauJensen: mroessler: I haven't thought about that yet

14:16 ninjudd: mroessler: that would be a great feature to add in clojureql 1.1

14:19 stuartsierra: anybody have the link for Stu Halloway's Protocol slides from JAOO?

14:21 LauJensen: stuartsierra: http://tinyurl.com/2cpm5gb

14:22 stuartsierra: yeah, eventually that got me there

14:22 but not the particular slides I wanted

14:22 Here's what I was looking for: http://gotocon.com/dl/jaoo-aarhus-2010/slides/StuartHalloway_ClojureProtocolsArenotInterfaces.pdf

14:22 LauJensen: stuartsierra: http://cloud.github.com/downloads/stuarthalloway/clojure-presentations/ClojureProtocolsJAOO.pdf not that one?

14:23 stuartsierra: ah!

14:25 mroessler: @ninjudd My suspicion is that it is quite difficult to implement. I'm trying to figure out how to do windowing type analysis in just Clojure code. For example, given a sequence or a structmap like apply an aggregate (corr,min,max,etc.) over partitions within it. This enables analysis of moving averages for example to data that includes >1 grouping.

14:27 hiredman: mroessler: please stop @'ing at people

14:27 irc is not twitter

14:27 ninjudd: mroessler: how standard is WINDOW and OVER in sql? i know postresql supports it

14:28 mroessler: hiredman: is the proper way using name: I don't know I'm new to IRC.

14:29 hiredman: nick: or nick,

14:29 : requires shift, but , doesn't

14:29 ninjudd: who's nick?

14:30 hiredman: ninjudd: http://tools.ietf.org/html/rfc2812#section-3.1.2

14:30 mroessler: ninjudd: windowing became part of sql in SQL:1999 and was expanded in SQL:2003. Yes, it is very well supported by Postgresql in the open source area. Greenplum SNE and Greenplum also support it excellently. Then to my knowledge all the standard proprietary db like Oracle, MSQL also support it. Just not in mysql.

14:31 Chousuke: neither : or , require the shift key if you use tab completion :P

14:31 mroessler: hiredman: thanks to you and nick, I now how to use IRC.

14:34 ninjudd: mroessler: if you're interested in helping add it to 1.1, let me know, and we can discuss syntax ideas and details in #clojureql

14:35 KirinDave: I am having a Bad Clojure Day™

14:36 mroessler: ninjudd: yes. I'll look for you in #clojureql in near future.

14:37 KirinDave: Can anyone recommend a better way to go about doing this: https://gist.github.com/705478

14:37 I didn't see a way to magically do this in clj-time

14:37 LauJensen: ClojureQL now in HN: http://news.ycombinator.com/item?id=1918954 :)

14:38 KirinDave: But it's weird to me that both clj-time and JodaTime seem to have problems trying to fuzzy-match.

14:38 amalloy: chouser: man, i step away for an hour, and i come back to see you've started the robot wars

14:38 KirinDave: Any advice on how to make it clearer and easier?

14:39 I feel like it's ugly code.

14:39 LauJensen: Oh damn man, this is relevant to my interests.

14:39 hiredman: jodatime just plain refuses to parse human readable timezones like PST, it surprises me that people continue to sing it's praises

14:39 chouser: amalloy: :-)

14:40 KirinDave: hiredman: codahale was saying that people love it because of things like its interval handling that actually has all kinds of little details (like offsets and leap years and older calendars). But I too am surprised.

14:40 hiredman: Any advice on how to make that code less terrible?

14:42 hiredman: I have no advice

14:44 KirinDave: At least I didn't have to say class DateParsingStrategy ... :P

14:44 hiredman: besides watch out for the bug on ubuntu where if you use a 32bit jvm on a 64bit system if you call getResource before trying to use SimpleDateParser (from the jre) it will parse all timezones as GMT

14:44 KirinDave: God I hate code like that.

14:44 hiredman: For HTTP 1.1 it is the clients error if they send me timestamps that are not UTC

14:44 hiredman: and since clojure code is loading via getResource …

14:44 KirinDave: hiredman: So I think i will be okay in that regard. but I didn't know that, thanks for the warning.

14:45 hiredman: KirinDave: right, well, sticking to the rfc doesn't often survive contact with reality

14:46 KirinDave: hiredman: Hopefully someone will submit a patch for it then. I'm just trying to get the remaining logic and states into some semblance of order before I drop a point release and put clothesline up on clojars.

14:46 hiredman: sure

14:47 KirinDave: Are you guys at all interested in clothesline? I know it's sorta pre-mature for real use

14:48 hiredman: we don't do any webstuff in clojure

14:49 we have some rest apis we expose built on ring, but nothing very complex, all internal

14:49 mroessler: hiredman: what else to use that has something like getFirstDayOfWeek(); if not joda?

14:49 dnolen: LauJensen: congrats!

14:50 LauJensen: dnolen: thanks buddy :)

14:50 hiredman: mroessler: I don't care about the first day of the week, I just want to be able to parse dates

14:51 mroessler: hiredman: that makes a good argument to stick with joda.

14:51 hiredman: no

14:51 joda cannot parse timezones

14:51 non-starter

14:52 our data parser is a list of about 10 functions and growing, each one gets tried in turn to parse the date

14:53 I swear to you, I have seen date headers that have the timezone as {5}, curly braces and all

14:54 dnolen: LauJensen: ClojureQL looks real sweet now. Makes writing SQL look positively fun. Whodda thunk?!

14:54 stuartsierra: A theoretical question:

14:54 LauJensen: hehe, thats right! Like Chris said, bringing Relational Algebra back to Relational Databases. I have high hopes for this project :)

14:55 stuartsierra: Are static methods overloaded on argument type a solution to the Expression Problem?

14:55 (in Java)

14:57 hiredman: stuartsierra: you cannot add a new static method for a new set of argument types later

14:57 stuartsierra: yes

14:58 mjg123: hello folks. What is the fn for adding an item to the _end_ of a list?

14:58 LauJensen: mjg123: doesnt exist

14:58 amalloy: mjg123: use a vector instead

14:58 mjg123: :)

14:58 fair enough.

14:58 LauJensen: amalloy: you should be busy reading my blogpost, arent you following bestinclass.dk yet?!

14:58 stuartsierra: (concat the-list (list the-item))

14:59 amalloy: &(map #(conj % 10) [1 2 3] '(1 2 3))

14:59 sexpbot: java.lang.IllegalArgumentException: Wrong number of args (2) passed to: sandbox4381$eval6376$fn

14:59 amalloy: &(map #(conj % 10) [[1 2 3] '(1 2 3)])

14:59 sexpbot: ⟹ ([1 2 3 10] (10 1 2 3))

14:59 hiredman: stuartsierra: that adds lazy-seq overhead everytime you do it and you will blow the stack when you try to read it

14:59 amalloy: LauJensen: i actually did read (some of) it!

14:59 but then i got to the screencast and it was like, blah, not gonna watch that at work

15:00 LauJensen: Its very work related though

15:00 mjg123: OK - I've been using stuartsierra's technique but I wondered why there wasn't a core fn for doing that

15:00 hiredman: ,(first (nth (iterate #(concat % [1]) []) 20000))

15:00 clojurebot: java.lang.StackOverflowError

15:00 dpro: hi

15:00 amalloy: LauJensen: sadly not, at the moment. i'm working with cassandra, not sql

15:00 mjg123: cheers

15:01 amalloy: mjg123: because you shouldn't add to the end of an immutable linked list

15:01 it's super-inefficient

15:01 dpro: I'm playing around with labrepl, what do I need to import from compojure so I get the (html ...) function ?

15:01 tomoj: LauJensen: coincidentally I was just thinking "hmm.. wonder how clojureql is coming along" while staring at c.c.sql nasty

15:01 looks awesome

15:01 clojureql punts on table creation, right?

15:01 LauJensen: punts?

15:01 amalloy: LauJensen: gives up

15:02 tomoj: I mean, there's nothing in there for creating tables, is there?

15:02 i.e. "it's not my problem"

15:02 LauJensen: contrib.sql is imported in clojureql.core, so use those functions

15:02 hiredman: dpro: html was split out into a seperate project, check weajester's github repos, I forget what it is called

15:02 LauJensen: One of the ways to get this done in 2 weeks was to piggy back a little on contrib

15:02 tomoj: LauJensen: thanks

15:02 LauJensen: np

15:04 dpro: hiredman: thx

15:04 hiredman: it's "hiccup"

15:05 LauJensen: hiccup, aka. PHP for Clojure :)

15:07 dpro: LauJensen: why ? I guess (html :foo "bar") is still more idiomatic than (str "<tag> " "text" ...)

15:07 LauJensen: the latter really looks like echo "...."

15:07 LauJensen: dpro: The common complaint about PHP is that it mixes code and presentation, and then most people turn around and do the exact same thing in Clojure. Use Enlive templates instead, 100% separation

15:08 dpro: LauJensen: I might eventually, I'm not planning a webapp, just wanted to get through with the laprepl chapters

15:08 LauJensen: ah ok

15:09 chouser: we have whole files full of PHP without any HTML in site. No mixing of presentation with code. It's still not a good language.

15:09 LauJensen: chouser: How does it feel to be boasting about the architecture of your PHP code? :D

15:10 amalloy: LauJensen: it's like kosher hot dogs at a hot-dog-eating competition

15:10 tonyl: i like the language

15:10 dpro: chouser: php is an abomination, but usually it's chosen by the less gifted, and then the bright people get the calls to "fix it by tomorrow"

15:11 lrenn: LauJensen: I'd prefer to have the full power of my language available. I'll enforce the no code/presentation seperation myself thank you.

15:11 LauJensen: tonyl: You like PHP?

15:11 lrenn: How does that comment fit in the context?

15:11 tonyl: yeah, I don't really hate any language though

15:11 lrenn: LauJensen: that hiccup is somehow ad.

15:12 chouser: Mmmmm PHP architecture. This isn't just code, it's form-following-function. It's design elegance and practical delivery coupled loosely into the height of reliability and maintainability.

15:12 lrenn: LauJensen: bad*

15:12 LauJensen: hehe

15:12 chouser: When did you get into marketing? :)

15:12 tonyl: the only thing that bothers me is the functions don't follow a naming scheme, but that is not a big hurdle to climb

15:13 LauJensen: lrenn: I must admit I dont see the point in using hiccup if you enforce separation yourself

15:13 dpro: tonyl: nevermind they also randomly operate on your data in place and returning results at other times

15:13 chouser: We have really learned how to generate customer drive and to enhance end to end reliability as our main focus.

15:14 tonyl: yup

15:15 amalloy: chouser: all very nice, but are your core values future-compatible?

15:15 rickmode: Monad question: I'm trying to use state-m and m-seq together.. anyone up on monads?

15:16 amalloy: rickmode: don't you want to use a monad transformer?

15:16 rickmode: amalloy: doesn't seem to fit

15:16 lrenn: LauJensen: because I'd rather use clojure than http://enlive.cgrand.net/syntax.html. I'm not saying enlive is bad, I'm just saying hiccup isn't evil.

15:17 LauJensen: lrenn: Are you sure you understand Enlive? It doesnt sound like it

15:17 chouser: amalloy: Maybe not yet, but I'm not worried, because first we have to gain business drive.

15:17 mroessler: LauJensen: Excellent video presentation on ClojureQL

15:17 LauJensen: mroessler: Thanks a lot

15:19 rickmode: amalloy: I have a list of state-m monad functions that take a map and return a [value and the map (possibly in a new state)]. In one situation I want the to run the map through the entire list, so using state-m and m-seq works fine.

15:19 tonyl: chouser: where do you work at? if you don't mind me asking

15:19 rickmode: amalloy: now I want to run the map through the list of function until a particular value arises

15:19 amalloy: rickmode: i don't actually have much practical experience with monads; it just sounded like you were trying to transform things based on my reading of the tutorials

15:21 rickmode: amalloy: ah... i've read the tutorials, read the source, read the group. The use of monads in clojure isn't widely discussed. I suspect I'd have to learn me some haskell to master monads.

15:21 lrenn: LauJensen: probably not. Reading up now.

15:21 chouser: tonyl: http://www.sentryds.com/ We actually have a really great team of smart, effective developers. But like most places, we also have old design decisions that need to be addressed.

15:22 dnolen: lrenn: I'm sneaking in some Clojure into the New York Times w/ Enlive :D It rules. I have a lengthy tutorial on it if you want to dig in. cgrand's documentation is ... spare.

15:22 tonyl: chouser: no way, that company was in my list to apply for a job this past summer. what a coincidence.

15:22 hiredman: chouser: you guys should totally use php.lisp

15:23 tonyl: oh yeah, I've heard about php.lisp. gotta take a look at it. hopefully it is not just another abstraction level

15:23 rickmode: dnolen: would you recommend enlive over only hiccup even for a smallish site?

15:24 hiredman: well, uh, there was some stupid php in parens thing, that really had nothing to do with lisp except adding extra parens

15:24 which made the frontpage in progreddit

15:24 dnolen: rickmode: having editing markup mixed with logic for years - hiccup and templating languages now drive me insane.

15:24 hiredman: then there is php.lisp which is my lisp interpreter written in php

15:25 I started work on a compiler but got side tracked

15:25 lrenn: dnolen: actually reading your tutorial now.

15:25 tonyl: hiredman: is it this one https://github.com/lunant/lisphp ?

15:25 hiredman: no

15:26 chouser: tonyl: you should. we're hiring, and it's a great team to work with.

15:26 tonyl: oh, was it just for a summer internship?

15:26 hiredman: tonyl: that may be the pile of garbage I mentioned that made the reddit frontpage, but I don't recall

15:26 lrenn: dnolen: but for example, look at the size of your looping section :) I'd rather just use for :)

15:26 rickmode: dnolen: I don't mean mixed use. I've had a dream of entirely code generated markup and am having a stab at it. Seems good (ideal) situation when developer has full control of design. I can totally see how this would break down if I was working with a graphic designer.

15:27 dnolen: rickmode: something to consider is that you often need to style things based on first and last or even odd and it needs to work in ever browser - putting that into your markup (whether HTML or Clojure) stinks. Enlive makes it way cleaner and you get CSS3 and crazier matching control.

15:27 hiredman: https://github.com/hiredman/php.lisp is php.lisp, and I was of course, joking when I suggested that chouser use it

15:27 dnolen: lrenn: I don't mention that Enlive has a for already. in anycase for non-trivial things it's cleaner. Cuz you ending up having for everywhere in a real page.

15:27 lrenn: dnolen: I don't maintain a giant site, so my needs are different. i can obviously see the need for something like this.

15:28 dnolen: lrenn: yes, if other browsers don't matter much to, hiccup is simpler.

15:28 rickmode: dnolen: why doesn't a separate CSS class work in that case? can the rules not all be expressed in CSS?

15:28 tomoj: LauJensen: clobbering the transient fns in clojureql.core seems unfortunate

15:28 rickmode: er.. those cases, I mean

15:28 dnolen: rickmode: not in CSS that works in every browser no.

15:28 LauJensen: tomoj: (use [clojureql.core :as cql]) if you need them

15:29 I just had never seen a namespace which both worked on transients and databases before :)

15:29 rickmode: dnolen: gotcha... well.. enlive is now on my TODO list ;)

15:29 tomoj: require, rather?

15:29 LauJensen: right

15:29 tomoj: hmm

15:29 lrenn: dnolen: yeah, i love the scrapping stuff. thanks for the tutorial.

15:29 LauJensen: tomoj: If its a problem I can let them drop to clojure.core if they get passed something other than a table, like sort/take/drop

15:29 dnolen: lrenn: np.

15:31 tonyl: chouser: no, I was actually looking for a full-time job. I think I might apply to it when my contract is over here

15:32 hiredman: thanks I'll check it out

15:32 tomoj: LauJensen: wow, hadn't noticed those

15:32 LauJensen: tomoj: You didnt watch the screencast yet?

15:32 rickmode: dnolen: i did notice some of the tutorials do indeed use hiccup with enlive. Anyway... is there a newer version of enlive? the "master" on github still uses clojure 1.1 (perhaps this doesn't matter?)

15:32 tomoj: nope

15:32 LauJensen: tomoj: okay well.. go watch :)

15:32 tomoj: just read the README

15:33 hiredman: tonyl: if you want, it's a "my first interpreter" kind of project

15:33 chouser: tonyl: you should. And don't forget to mention you know me. :-)

15:37 tonyl: hiredman: I was actually thinking of doing a lisp interpreter in php :P this would be a good exploration

15:38 KirinDave: We might have another opening for a dev @ banksimple. This is a clojure+scala friendly environment.

15:38 tonyl: chouser: great! I will. This was random

15:41 Raynes: neotyk: ping

15:42 neotyk: Raynes: pong

15:42 Raynes: neotyk: Did you ever get a moment to read that? raek rewrote a paragraph in the Leiningen section.

15:42 It's not all that important though. Mostly a correction.

15:43 Just wondering if you've got any feedback before I publish it in a little while.

15:43 mroessler: KirinDave: Go banksimple! I like hearing about you guys.

15:43 neotyk: Raynes: yes, I've send you my notes in priv chat

15:44 KirinDave: mroessler: Heh.

15:44 Raynes: You did, or are going to? I haven't received anything yet.

15:44 neotyk: I did

15:45 Raynes: Do it again, please. :p

15:45 dnolen: rickmode: doesn't really matter, I'm using Enlive with 1.2.0.

15:47 rickmode: dnolen: cool. I guess lein / cake won't pull in an older version of a dependency than the main project

15:50 neotyk: does any other build tool than Maven support multi module builds?

15:51 LauJensen: neotyk: Clojuresque

15:51 neotyk: $google Clojuresque

15:51 sexpbot: First out of 159 results is: kotarak / clojuresque / overview – Bitbucket

15:51 http://bitbucket.org/kotarak/clojuresque

15:51 LauJensen: thats the one

15:52 neotyk: LauJensen: thank you

15:52 LauJensen: np

15:53 dnolen: rickmode: I would assume not.

15:54 neotyk: I don't find Groovy so groovy :(

15:55 LauJensen: yea me either neotyk

16:00 bobo_: hm, does enlive remove the xmlns attribute from the html tag?

16:08 LauJensen: bobo_: no

16:14 bobo_: it sure seems to remove it for me, maybe im just tired. il do a testproject tomorow.

16:14 tonyl: hiredman:ping

16:15 hiredman: pong

16:15 tonyl: where do you start your php.lisp? the vm.php file?

16:16 hiredman: lisp.php is the interpreter, it just interprets php.lisp

16:17 no repl or anything, I was running this from mod_php

16:19 the vm stuff was something I was fiddling with but never wnet anywhere

16:20 tonyl: alright, so how do you feed php.lisp (or any *.lisp file) to the interpreter?

16:20 nvm

16:20 hiredman: :)

16:20 tonyl: i see it at the end of lisp.php

16:20 this is cool, it uses a clojurish implementation on the host (php)

16:21 hiredman: compiler.php you can feed abitrary files into, but I don't think I ever finished the compiler

16:21 the sample input to the compiler was a.lisp

16:22 and it is actually a different lisp from the interpreter

16:22 tonyl: so as of now lisp.php does it

16:22 hiredman: does it?

16:23 tonyl: transforms the lisp syntax to php

16:23 hiredman: lisp.php doesn't

16:24 it is actually an interpreter

16:24 the compiler is what turns lisp in to php

16:24 tonyl: ok, yeah my bad. that is what I meant.

16:24 nice work

16:25 hiredman: you are, too kind

16:25 huh, interesting comma there

16:25 tonyl: probably but I am still learning lisp

16:27 hiredman: writing one is a good way to get a feel for the design space

16:28 tonyl: yeah, I am thinking about it, probably in C or C++ to resharpen those dull knifes

16:29 hiredman: an interpreter in C was my next target, I got as far as starting to write an object system...

16:30 tonyl: that might be a hurdle, but maybe a not full-blown object system would be necessary ...

16:31 hiredman: well it was just structs with pointer to a table of function pointers

16:32 the table was a linked list and method looks up were O(n) :(

16:33 tonyl: oh

16:34 maybe a implementing a hash array

16:34 hiredman: talk about yak shaving...

16:34 chouser: step 3, write garbage collector...

16:35 Chousuke: LauJensen: wow, quick response to my little issue report on cql :P

16:35 LauJensen: Chousuke: Yea we're a pretty intense team. But your comment was 100% correct and chouser had also made it a few hours ago, so its in the pipe

16:35 hiredman: chouser: I just used boehm

16:36 Chousuke: LauJensen: I didn't even have time to navigate away from the page :)

16:36 LauJensen: Chousuke: Well, we dont want to keep the community waiting. Now its bedtime for me though, good night to you all

16:36 chouser: hiredman: psh. why didn't you just use CL?

16:37 hiredman: uh, well, cl is digusting the code makes my skin itch

16:37 chouser: heh

16:38 tonyl: wonder how a no-garbage-collected lisp will look

16:38 hiredman: there was an mit ai memo about it

16:38 "lets just pretend we have infinite ram and crash when it runs out"

16:38 Chousuke: There is one that's used for game development, right?

16:39 hiredman: "crashing is faster than gc anyway"

16:39 Chousuke: or at least was.

16:39 tonyl: lol or maybe just add a function that garbage collects anything

16:39 Chousuke: like free()? :P

16:40 tonyl: an on-called gc

16:40 yeah

16:40 :P

16:40 hiredman: yetch

16:40 any way, using boehm is really easy, just link in and use

16:41 cemerick: rhickey: "I'm not a Lisp expert. Helpful suggestions are always welcome." – Rich Hickey http://dotlisp.sourceforge.net/dotlisp.htm :-D

16:41 Chousuke: oh right, this one http://en.wikipedia.org/wiki/Game_Oriented_Assembly_Lisp

16:41 hiredman: thank god he ignores so many suggestions

16:43 cemerick: I remember tinkering with jFli and jFoil years ago. Amazing how things change.

16:48 pdlogan: tonyl: "wonder how a no-garbage-collected lisp will look"...

16:49 way back in the days of the lisp machine, we'd often run as long as possible w/out GC then just reboot.

16:50 hiredman: I was reading a paper about an os written in ml, and apparently ml, or at least the ml they used is stackless

16:50 everything is in the heap

16:51 pdlogan: several near-real-time lisp and smalltalk systems I am familiar with would pre-allocate a lot of stuff into pools, turn off GC, and "manually" allocate and free.

17:04 hsuh: anyone knows if you can use a connection pool with ClojureQL?

17:06 dnolen: hsuh: you can

17:09 lancepantz: hsuh: you can either imbed c3p0 or use a jndi resource

17:09 *embed :)

17:13 belun: hi what exactly does derefing mean ?

17:14 cemerick: belun: obtaining a value from a reference type (atoms, refs, futures, etc) using @ or deref

17:14 hiredman: ,(macroexpand '@foo)

17:14 clojurebot: (clojure.core/deref foo)

17:14 belun: there is no other way ?

17:15 hiredman: ^- what deref'ing means

17:15 depends on the reference type

17:15 belun: why are those data types called reference types\

17:15 hiredman: deref is just a function that calls the .deref method of something that implements the IDeref interface

17:16 belun: (i only know they are used for concurrency)

17:16 ok what is the purpose of that interface ?

17:17 cemerick: belun: This might help explain the higher-order objective: http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey

17:19 belun: will watch for that

17:19 thx for help

17:19 cemerick: whew, that was a low-bandwidth connection

17:49 lancepantz: KirinDave: you guys are using both scala and clojure at banksimple, correct?

17:49 KirinDave: Yes.

17:50 lancepantz: both backend?

17:50 KirinDave: yes, although some of both will likely make it into the frontend

17:50 Because it's most likely gonna be jruby up in there

17:51 Padrino + jruby, I think they're suggesting

17:51 lancepantz: interesting, haven't heard of it

17:51 headius: jruby up in there?

17:52 jruby all up in my sh*t

17:53 KirinDave: headius: We'd like to.

17:53 headius: I have come around from that time where I was skeptical @ Powerset. :D

17:53 headius: jruby in the front with something else in the back is a popular JVM combination these days

17:53 linkedin's another big one very happy with that combination

17:56 KirinDave: headius: Well, the ability to share code between langs is really exciting to me

17:56 headius: I can write some clojure that talks to jruby and is also seating scala modules. That's wild.

17:56 headius: we've started to use that as a selling point of JRuby over other Ruby impls in fact

17:57 accepting that Ruby's not the only kid on the block and showing how easy it is to use the right tool for the right tier

17:57 KirinDave: Yeah

17:59 Sgeo: So

17:59 Heard about the O(log_32 n) != O(log n) debacle, or at least part of it

18:00 hiredman: once you start writing business logic on top of your crud being polygot is a pain if you cannot share the business logic

18:02 quizme: https://github.com/thirdreplicator/levenshtein/blob/master/src/levenshtein/core.clj <-- is there a better way to parallelize this?

18:06 Sgeo: Just to be sure, everyone is aware that log_32 x = log_b x * a_constant (I think a_constant = 1/log_b 32)

18:12 Chousuke: Sgeo: There was no "debacle". Just people being more or less rigorous with their notation :P

19:08 rata_: hi

19:12 Raynes: Has the getting started stuff on assembla been moved to confluence yet? I need to link to it, but I don't know where *to* link.

20:25 mattmitchell_: aye, could someone tell me why this isn't printing? I'm guessing it has to do with lazy seqs? (map #(prn ( * 2 %)) [1 2 3 4])

20:25 amalloy: mattmitchell_: got it in one. lazy seqs

20:25 wrap the whole thing in a (dorun)

20:25 mattmitchell_: amalloy: i have so much to learn :)

20:26 amalloy: ha yeah that works, i need to read up on lazy seqs

20:26 thanks!

20:38 joshua__: Hi! I'm using Compojure, Enlive, and Appengine Magic. I was wondering what the best way of getting from a change to the code to a refresh of the browser is. Like is there a way to avoid having to restart the server and recompile after every typo?

20:40 tomoj: does swank-clojure work on app engine? :)

20:42 I suppose not

20:42 joshua__: I think that it does, not sure.

20:43 The appengine magic package mentioned you could use some datastore services within swank at least.

20:44 _ato: according to the appengine magic README the normal development workflow is develop locally against jetty

20:44 tomoj: wait, are you talking about seeing the changes on GAE?

20:44 or on your local jetty?

20:45 joshua__: local jetty

20:45 tomoj: and do you use swank already?

20:45 joshua__: Yea.

20:46 tomoj: sounds like a problem with the magic package to me..

20:46 joshua__: I've been using lein repl since I woke up though...

20:46 tomoj: it's easy to make it so that when you C-c C-k the handler you passed to jetty, the changes are automatically in effect

20:46 joshua__: So I guess I should use swank?

20:46 Alright.

20:46 tomoj: ah, I'd give it a try, yeah

20:47 when you def-appengine-app, you might have to pass #'handler instead of handler

20:47 not sure, never used it

20:48 hiredman: right, you do the same thing in ring if you want to pick up changes

20:48 amalloy: tomoj: i read the middle of this conversation first, and "sounds like a problem with the magic package" sounded like when someone wants the computer to just do what you want instead of what you said

20:48 tomoj: I misread their readme and thought they did this part

20:49 (and also thought swank was already in use)

21:12 joshua__: Thanks guys! I understand it now and it is working.

21:25 rata_: technomancy: I was wondering if a (defn-debug ...) that puts a (swank.core/break) at the end of the function (i.e., that lets you see all the locals of the fn) but also lets you see the result of the function would be of interest for the general swank-clojure user

21:26 (result in the sense of returned value)

21:55 quizme: how do you determin how much memory a variable is using in the JVM ? like for example how much memory is (def x {:a 1}) taking up?

21:56 amalloy: quizme: that's a hard thing to define, let alone ask the computer to tell you

21:57 for example, it had to create objects for the :a keyword and the x symbol in order to make that definition. but those will still be around when it leaves, and they're not really part of the data from your POV

21:57 does it count them, or just the 4-byte reference to them?

21:58 quizme: ok

21:59 there isn't anything like (size-of x) ?

21:59 amalloy: quizme: see above. what would it return?

22:02 quizme: i guess the before and after difference of the memory used.

22:04 but including the data structures it relies on

22:04 rata_: quizme: short answer: there isn't

22:05 quizme: how about a way to determine the amount of memory used by the JVM currently.

22:06 rata_: quizme: visualvm

22:06 quizme: rata_ ok cool thanks i'll check it out

22:06 rata_: it let's you profile memory also... maybe that's what you want

22:07 quizme: rata_ yeah thanks. I have been wanting profiling tools.

22:08 rata_: visualvm is the most amazing profiler I've come to know

22:08 but for a reason I don't understand, it doesn't work with swank for me

22:09 I must compile a clojure program to do the profiling

22:09 coming from c++, that's not really an issue =P

22:10 dnolen: rata_: that's weird, visualvm + swank works just fine for me.

22:10 rata_: also, it's probably just something I haven't figure out yet

22:10 yes... I should be doing something wrong

22:12 it was just a quick attempt... I didn't sit down to think what could be causing the problem

23:10 tonyl: good night

23:14 technomancy: rata_: I don't like the idea of changing the code for debugging purposes. you could do something less invasive using the same strategy as stubbs: http://technomancy.us/141

23:14 basically just alter-var-root for all defns that have :break metadata or something.

23:14 or add-hook rather

23:15 KirinDave: technomancy: Hey man, I was hoping to get your advice on something. A piece of code I wrote has been bugging me.

23:15 technomancy: Got a sec?

23:16 technomancy: sure

23:16 KirinDave: technomancy: This seems liek a lot of code for a fairly simple task of parsing HTTP 1.1 compliant dates. Any advice?

23:16 https://gist.github.com/705478

23:19 technomancy: I would use for rather than keep with a fn literal

23:19 KirinDave: technomancy: Oh?

23:20 technomancy: I wouldn't say that's particularly a lot of code to perform that task

23:20 KirinDave: technomancy: How about for the strategies?

23:20 Is there a more elegant way to do that, you think?

23:20 technomancy: I mean, it depends on how forgiving you want to be, but the JDK doesn't give you much to work with

23:20 rata_: technomancy: I like the idea of the :break in the metadata... it's that part what really matters... btw, is there a leiningen plugin that does just that?

23:21 KirinDave: technomancy: Well this is using Joda, which is also kinda tedious for fuzzy date matching

23:21 technomancy: we use something fairly similar for our date parsing

23:21 just run through a list of strategies, sanest first

23:22 oh actually for may not be quite right to replace keep there

23:22 Licenser: technomancy: the curl thing is solved the rlwrap and user thing are still present in the master/stable branch

23:22 technomancy: KirinDave: but I'd use filter rather than keep. I would save keep for when you are calling out the fact that you want a false/nil distinction, which is very rare

23:23 Licenser: cool; I'm looking at that ticket now =)

23:23 KirinDave: technomancy: Would using for make the code shorter?

23:23 Licenser: kk

23:24 It contains are required fixes already - I realize that I am probably the only clown using clojure on solaris so I try to only report when I know how to fix it :P

23:24 technomancy: KirinDave: not really; you can use a :when clause, but you still have to make the body of the "for" include the value itself so it's not really much of a win.

23:25 for is more of a win when people use filter and map on the same seq

23:25 Licenser: well it's nice to have people submit bug reports rather than just complaining like the Windows users sometimes do =)

23:25 Licenser: :P

23:26 that is since we are all developpers here - windows people excluded *runs to hide*

23:26 KirinDave: technomancy: Thanks for the input.

23:27 technomancy: KirinDave: sure.

23:27 is clj-time a pretty literal wrapper around joda, or would it make sense to add some timezone-savviness there?

23:28 KirinDave: technomancy: I'm not trying to be the best at dates. The HTTP 1.1 spec says I can demand GMT/UTC.

23:29 * Licenser waves out to make breakfast for his GF,

23:29 Licenser: See you later peope!

23:29 KirinDave: technomancy: But I do think that clj-time could really stand for some of that. JodaTime has a lot of shortcomings

23:29 technomancy: KirinDave: aren't you lucky =)

23:29 KirinDave: technomancy: Ha.

23:29 Evidently a lot of webservers ignore that and allow arbitrary timestamps. I say "eff that"

23:30 technomancy: we have seen such wacky nonsense as: Sat, 1 Sep 2007 00:01:09 +{0}{1}

23:30 I do appreciate how the JDK is relatively sane with things like "the 35th of November" rolling over into December

23:32 tomoj: I had wacky nonsense like 2-00-00

23:33 year 2

23:33 KirinDave: Ha

23:33 I will just throw your shit out if you send that to me on an if-modified-since header.

23:33 "Screw you and the date unparser you rode in on."

23:33 tomoj: oh, that was squirreled away somewhere

23:34 original source -> clojure -> php -> solr :(

23:34 php is the culprit of course

23:34 Licenser: *look clj-time up since he exactly nees things like the current day now*

23:34 technomancy: 406 not acceptable!

23:34 406 This Simply Will Not Do

23:35 in case anyone hasn't seen it yet: http://lizrevision.com/sms-shorthand-for-geeks-using-server-response-codes.html

23:39 KirinDave: 406 Screw You (And The Horse You Rode In On)

23:43 technomancy: User-Agent: Horse (Mozilla 5.0/compatible)

23:52 rata_: oh sorry, yeah the stubbs plugin in the link there shows an example of how you'd do that in a lein plugin

23:57 rata_: technomancy: yes, but it seems a little complicated for a newbie, thus I was wondering if there already exists a plugin for doing what I said using somethink like :break in metadata

Logging service provided by n01se.net