#clojure log - Jul 12 2010

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

2:21 Licenser: Good Morning my lispy friends

2:56 unfo-: {{citation needed}} to prove we are lispy! (too much wikipedia...)

2:58 Licenser: unfo-: {{citation}} You are lispy

2:59 unfo-: lol ;)

3:48 benatkin: thirddog: I'd be interested in an iBatis-inspired sql library, too.

4:33 LauJensen: Good morning all

4:34 ponzao____: Hi, I've got a Java method that takes a variable amount of arguments. I noticed I have to wrap the arguments inside an array for it to work in Clojure. Is there a clean way to avoid this?

4:34 Licenser: Morning LauJensen

4:35 LuminousMonkey: Moring LauJensen

4:35 Licenser: ponzao____: I think what java does with variable Rgs is exactly that, wrapp ing ghem in an array

4:38 ponzao____: Licenser, yes that is what it does, but it is a lot cleaner to do Arrays.asList(1, 2, 3, 4) instead of (Arrays/asList (to-array [1 2 3 4])).

4:39 Licenser: ponzao____: Well you can always make a wrapper function ;)

4:39 But if you want a list isnt there a way to cate it from a collection

4:39 ponzao____: Licenser, yeah, I was just wondering if there already was a solution I didn't know of, no sense in reinventing the wheel :)

4:40 Licenser, that was just an example, my actual use case is different, but syntactically the same.

4:41 Licenser: Ah okay

4:41 well make a .* macro :)

4:41 You even could get it with reflections eww

4:41 W

4:43 ponzao____: Licenser, ok. I am very new to Clojure and I've been very impressed with its Java interoperability. The varargs was the first inconvenience and a very minor one at that.

4:45 Licenser: *nods* yap sopunds not perfe but actually no problem for me wipth that upto now

5:01 LauJensen: ponzao____: Is it a generic class you had problems with ?

5:10 ponzao____: LauJensen, the method signature is: public Q from(Expr<?>... args)

5:11 LauJensen: ponzao____: I was wondering about the concrete name, as I wanted to experiment with it, and see it if could pass in collections

5:12 ponzao____: LauJensen, concrete name, sorry I am not following.

5:12 LauJensen: like java.lang.String

5:16 ponzao____: LauJensen, com.mysema.query.sql.AbstractSQLQuery

5:16 LauJensen: thanks

5:23 mmarczyk: LauJensen: just watched your latest Emacs screencast... that is *awesome*!!!

5:24 LauJensen: may I express hope that I you might some day release your Emacs config (I do not dare to ask for a commentary) :-)

5:34 * Lajla eats Bahman's faeces.

5:35 * Bahman hides in a corner holding his shotgun tight.

5:35 Lajla: Bahman, don't tell me you're that prude.

5:35 Besides, it saves you the cost of a toilet.

5:36 Bahman: Lajla: Any unknown creature may be dangerous ;-)

5:37 Lajla: Bahman, I am the second best programmer in the world, right after the Microsoft Chief Software Architect, you should know that by now.

5:38 Bahman: Lajla: If he's the best programmer of the world, then I'm Albert Einstein for no doubt.

5:38 Lajla: Bahman, but he invented the long filename system on NTFS!

5:38 ोAnd BASIC seems to be his favour language!

5:42 Bahman: Lajla: Well these are admirable inventions except that he's just 20 years late to come up with them.

5:43 * Bahman is still holding his shotgun though.

5:44 Lajla: Bahman, but he is rich, he must be the best!

5:51 Bahman: Lajla: Yes he's the best. But best of what?

5:51 Perhaps he's got all that money because of the inventions you said earlier.

5:52 Lajla: Bahman, but he gave us net based applications.

5:52 Bahman: It's interesting that being 20 years late in inventing is so money-making.

5:52 Timing is everything.

5:52 Lajla: And enabled us to send XML messages.

5:52 Through SOAP

5:52 THROUGH SOAP!

5:52 Bahman: Praise him!

5:53 These men are bloody rare.

6:08 sandos: xb

6:30 Lajla: Bahman, you are my fire,

6:30 my one desire

6:30 believe when I say

6:30 that I want it that way.

6:30 Bahman: Lajla: Oh yes. I hope you're just high.

6:31 Lajla: Bahman, I don't even drink man.

6:31 I don't need it

6:31 I get high on stealing candy from babies.

6:45 ponzao____: LauJensen, the class is from Querydsl (http://source.mysema.com/display/querydsl/Querydsl). I was just testing during the weekend if I could get Clojure working with it.

6:46 LauJensen: You can get just about anything working. I was just wondering if you get get around (into-array [1 2 3]) and only pass [1 2 3] for varargs hidden in arrays

6:51 mmarczyk: if you mean simply passing in a vector instead of an array to a method -- without some sort of wrapper macro or the explicit into-array -- then no

6:58 LauJensen: sure

7:09 _willtim_: a LINQ style API for clojure would be nice

7:10 the 'from' function would need to do a dispatch (for multiple providers) and be a macro in order to get at the expression trees

7:10 tricky

7:25 ponzao____: willtim, doesn't ClojureQL do something like that already?

7:40 willtim: ClojureQL looks really nice but afaik only does SQL

7:42 Lajla: willtim, you are a teddy bear filled with used batteries, that makes you cute.

7:42 willtim: What's nice about LINQ is that it unifies comprehensions and SQL

7:43 whereas ClojureQL doesn't really integrate with the for macro

7:43 or work-like the for macro

7:49 cemerick: Lajla: I often fail to comprehend many of your messages.

7:50 willtim: it seems the challenge would be to make a "clojure LINQ" as capable/natural to use as all the usual seq tools we have.

7:50 Lajla: cemerick, I get that a lot.

7:51 I do have a diagnosis schizophrenia running around though, it might be related.

7:53 cemerick: willtim: after looking at a few LINQ samples (it's been a while), how would for not do the job as-is

7:53 ?

7:56 willtim: yes for is very powerful

7:57 although it lacks groupby, orderby

7:57 there is a nice paper by SPJ and Wadler called 'Comprehensive Comprehensions'

7:57 would be very easy to implement in Clojure (no type complexity!)

7:58 cemerick: well, for is intended to be lazy, so grouping and ordering aren't germane in that context

7:58 willtim: but LINQ would also render a comprehension into SQL

7:58 cemerick, very true

8:04 cemerick: If I were querying SQL databases (been a while there, too), I think I'd much rather write SQL than use something like LINQ. There's always that edge case that the underlying database supports, but the driver/provider papers over.

8:05 That said, it'd be interesting to see a stab at it in Clojure. I wonder how much it'd pay off to mix with the various datalog stuffs that have been done.

8:06 willtim: we certainly wouldn't have to modify the compiler to produce expression trees ;)

8:07 ponzao____: cemerick, type-safety is a huge advantage when using LINQ.

8:08 cemerick: ponzao____: I suppose, if that sort of thing is important to you. :-)

8:09 ponzao____: cemerick, when using a language in which ones mindset is set on the compiler helping you then yes it is very important :)

8:09 cemerick: sure

8:10 and I hear tooling is a big draw for linq usage -- being able to complete on database columns (turned into object fields?) in the same editor as your C#, etc. Doesn't excite me though.

8:19 ponzao____: cemerick, same advantage exists in a lot of query languages, I find it useful. I am guessing LINQ doesn't restrict you from doing native SQL if needed for that special case.

8:22 cemerick: execStream

8:22 bah

8:23 Yeah, I'm certain it's useful, as long as your database/language/tooling choices line up. In my current typical case of couchdb/clojure/enclojure, that's not the case though. :-)

8:26 ponzao____: cemerick, Sure. Eclipse is fantastic for Java development and I couldn't live without it, but for Lua and now Clojure I go with a normal editor, I won't mention the name because I am guessing most of the people here are Emacs users...

8:27 cemerick: hardly all ;-)

8:27 but most, perhaps

9:07 Licenser: Weeh work Day Done :D

10:24 ct_: why does (take 5 (fib3)) always print 'm' ? (defn fib3

10:24 ([]

10:24 (fib3 0 1))

10:24 ([m n]

10:24 (lazy-seq (do

10:24 (println "m:" m)

10:24 (cons m (fib3 n (+ n m)))))))

10:29 arg. I see it. (take 5) is _always_ the first time through. Defining a var to the take result and then iterating through that doesn't print m.

10:31 Hmm. no. of course the new seq doesn't print m. I still don't know why (take 5) _always_ prints m. I thought lazy-seq cached the results...

10:37 Lajla: ct_, I worship your shadow

10:38 ct_: what does that mean?

10:39 Raynes: It means he's being an idiot.

10:39 ct_: Oh, heh..

10:41 Lajla: ct_, http://en.wikipedia.org/wiki/I_Worship_His_Shadow

10:46 neotyk: ct_: fib3 could provide different results each run, not that it does

10:46 but in general it would not be to good to memoize all lazy-seq

10:47 ,(doc memoize)

10:47 clojurebot: "([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."

10:49 ct_: Thanks. I'm stuck atm. I'd really like memoize to be used. I'm using fibonacci to just get an understanding of how I can create a lazy-seq of a seq created by a fn where the seq is not infinite.

10:49 neotyk: ct_: shameless plug http://codemeself.blogspot.com/2010/06/clojurecorelazy-seq-makes-sense.html

10:50 ct_: though it should cache if I look at

10:50 ,(doc lazy-seq)

10:50 clojurebot: "([& body]); Takes a body of expressions that returns an ISeq or nil, and yields a Seqable object that will invoke the body only the first time seq is called, and will cache the result and return it on all subsequent seq calls."

10:50 ct_: nice article. I read it last night.

10:50 neotyk: ct_: thanks!

10:51 slyrus: morning

10:51 anyone know of a clojure library for _undirected_ graphs?

10:55 ct_: Maybe I'm still misunderstanding lazy-seq. I'd like to create a seq of 20 items. each item is created by a fn. I only want the fn to be called once for each item. I think I'm wrapped around the axel on this..

10:57 neotyk: ct_: check this out http://github.com/richhickey/clojure-contrib/blob/78ee9b3e64c5ac6082fb223fc79292175e8e4f0c/src/main/clojure/clojure/contrib/lazy_seqs.clj#L82

10:58 Chousuke: ct_: can't you use map or repeatedly or something?

10:58 ct_: Thanks. I've seen that too.

10:58 repeatedly works for infinite sequences.

10:58 Chousuke: ct_: using lazy-seq directly is not often necessary.

10:58 ct_: I actually tried that.

10:58 Chousuke: it works for finite seqs too :)

10:58 (take n (repeatedly ...)) :P

10:58 ct_: I returned 'nil' after my fns are done but ...

10:58 hmm.

10:59 Chousuke: or take-while somepred ....

10:59 ct_: take-while sounds interesting

11:00 Q: (take n (repeatedly ...)) - I did this, but I didn't know how to limit the size of the seq. returning nil didn't stop take

11:00 (take kept going what it was told and returning nil for items beyond 20 :-)

11:01 going->doing

11:24 neotyk: ct_: lazy-seq is cacheing

11:24 ,(let [a (lazy-seq (cons (do (println "one") 1) (lazy-seq (cons (do (println "two") 2) nil))))] (first a) (first a))

11:24 clojurebot: 1

11:24 one

11:24 neotyk: ct_: notice that one is printed only once

11:25 issue might be that you define it as fn

11:36 ct_: what you write makes perfect sense. Your article shows 1/one very well. I'm not sure why lazy-seq is not caching fib3: (defn fib3 [m n] (lazy-seq (do

11:36 <ct_> (println "m:" m)

11:36 <ct_> (cons m (fib3 n (+ n m)))))))

11:36 m is printed every time - as if lazy-seq isn't caching.

11:37 (take 5 (fib3))

11:39 Chousuke: ct_: calling the function always generates a new seq

11:39 neotyk: ct_: because you are creating new lazy-seq each time you call fib3

11:39 ct_: heh

11:39 tyvm

11:54 arohner: is there a function to replace the value of an expression with another value?

11:55 I want something like (replace (foo) {1 "1", :a :b})

11:55 which would return "1" if foo returned 1, and :b if foo returned :a

12:03 hiredman: arohner: how is that in anyway different from ({1 "1", :a :b} (foo))

12:04 arohner: hiredman: I want the expression to return foo's value if it is not present in the replacement map

12:04 (or (get map (foo)) (foo)), without the double evaluation

12:04 hiredman: you don't need to use get for that

12:05 ct_: Chousuke/neotyk - thanks again ! I have everything working on my end. I really appreciate your help.

12:05 arohner: hiredman: actually, get has a not-found, which may do what I want

12:35 Licenser: aloa my lispy friends

12:36 TeXnomancy: Licenser: cookies?

12:36 Licenser: TeXnomancy: Way thank you but it is too hot, even for cookies :(

12:42 esj: Ello Licenser

12:42 Licenser: aloa esj

12:54 konr: What was that function like filter that returned matching elements inside a nested structure?

14:01 rbxbx: After reading http://gist.github.com/470031 (jkk's examples gist) I've changed my mind and decided it's a good thing :D

14:15 jkkramer: rbxbx: you thought getting examples at the repl was a bad idea previously?

14:44 rbxbx: jkkramer: I thought it was superfluous :(

14:44 but I've since seen the error of my ways.

15:35 * Licenser waves back

15:36 dsop: ?

15:37 * dsop waits for someone to take a look at his contrib.crypto.digest proposal

15:37 technomancy: dsop: is there a specific reason you think it belongs in contrib instead of in a 3rd-party library?

15:38 dsop: technomancy: I think a lot of people need sha-1 or md5, so that's why I think it belongs to contrib

15:39 technomancy: dsop: right now stuart H is pushing for a more modular build of contrib, so I think it's not a good idea to add new namespaces right now

15:39 especially with 1.2 around the corner.

15:40 I suggest releasing it as a 3rd-party lib anyway, it's not like it's hard to add third-party libraries.

15:40 dsop: technomancy: yes that's okay. I can wait and redo the proposal if contrib contributors like the general idea

15:40 technomancy: it's not like the old days

15:41 dsop: technomancy: well maybe it's because of my scripting languages background but I found it very handy to have sha-1 distributed with contrib

15:41 hiredman: meh

15:41 contrib

15:41 technomancy: well some of us are trying to reduce our contrib usage

15:41 hiredman: make a jar, push to clojars

15:41 technomancy: if you make it a third-party library, you will be able to accept patches without a CA, and you'll also be able to release new versions at your own discretion.

15:42 dsop: hiredman: that's exactly what I don't like

15:42 hiredman: why not?

15:42 dsop: because a developer doesn't know if the maintainer of the 3rd party library doesn't do BC breaks or something

15:42 hiredman: BC breaks?

15:42 dsop: if it's in contrib you can rely on some basic backward compatbility

15:43 hiredman: dsop: you can just use an old version

15:43 dsop: hiredman: oh certainly, until you once you have to upgrade for whatever reason

15:43 technomancy: dsop: http://semver.org

15:43 hiredman: dsop: not always

15:43 lancepantz: think it makes as much sense in contrib as other stuff, like clojure.contrib.graph

15:44 technomancy: lancepantz: lots of stuff made it into contrib for historical reasons

15:44 lancepantz: but i am dying for contrib to be split up

15:44 technomancy: lancepantz: it used to be that was the only non-painful way to distribute your code

15:44 hiredman: and you are just pushing the load of keeping the code up to date from the library writer to whoever is involved in the contrib release process

15:44 dsop: technomancy: I know semantic versioning. It's just that I would trust contrib to be bc more than 3rd party libraries

15:44 lancepantz: right

15:44 hiredman: which slows releases

15:45 and makes a burden for others who might not give a damn about your code, instead of, you know, having the person who cared enough to write it in the first place keep it up to date

15:45 technomancy: dsop: we've had lots of backwards-compatibility issues in contrib; it's part of the reason I am trying to reduce usage of it.

15:45 dsop: technomancy: yes, and it's probably worse in 3rd party libraries

15:46 technomancy: dsop: it varies in 3rd-party libraries

15:46 hiredman: nope

15:47 dsop: technomancy: exactly, and contrib will probably move into the direction of more stable releases

15:47 technomancy: anyway I got your point, I was just hoping to get some feedback on the general idea

15:47 technomancy: because I'm new to clojure and my approach might not be very lispy

15:47 hsarvell: sha1 feels like something basic enough to be in contrib

15:48 hiredman: your funeral

15:48 * hiredman goes on not using contrib

15:50 dsop: :)

15:56 neotyk: Hello my favorite irc channel

15:59 AWizzArd: Hi neotyk. Sorry about yesterdays football match :)

16:00 neotyk: AWizzArd: I overslept it

16:01 kotarak: AWizzArd: it was bad karma

16:01 neotyk: my kids do that all the time to me, I think I put them in bed, but it is other way around :)

16:02 dsop: overslept a football match?

16:02 the final..

16:02 neotyk: AWizzArd: my team didn't even qualify to group :P

16:02 dsop: true, true

16:03 if NL would win, I would be woke up. Most likely

16:03 and I prefer Cojure than football

16:04 kotarak: Well, NL thought it was kind of Kung Fu championship, not soccer.

16:06 AWizzArd: kotarak: ;)

16:35 islon: i'm trying to run lein 1.2 RC2 under windows with last clojure from gi but when i execute "lein swank" it raises an exception "Exception in thread "main" clojure.lang.LispReader$ReaderException: java.lang.Exception: Invalid token: C:"

16:35 *git

16:41 cmcclell: Quick question: I have slime 07062010 working against ccl&sbcl, but cannot get it to work with clojure (against swank-clojure 1.3.0). No special forms will execute - it just hangs emacs. Any ideas?

16:44 arohner: cmcclell: I'm not entirely sure that version of slime is compatible

16:44 cmcclell: try this one http://github.com/technomancy/slime

16:45 cmcclell: arohner: I'll try it. My alterative is to split my .emacs file, and use load-file to bring in the common-lisp one when I don't want to use clj

16:50 (when

16:50 (load

16:50 (expand-file-name "~/.emacs.d/elpa/package.el"))

16:50 (package-initialize))

16:51 Using elpa, that seems to be enough to be able to connect to a clojure:swank started by maven

16:52 using slime 04042010

17:19 epochwolf: Is http://pragprog.com/titles/shcloj/programming-clojure still a good book for learning Clojure?

17:21 lancepantz: epochwolf: its better than nothing, but i think the joy of clojure is much better

17:22 neotyk: epochwolf: is very good start

17:23 epochwolf: do I need java experience?

17:23 or better, is there a website for my newbie questions

17:24 qbg: As long as you stay in Clojure land you shouldn't need much java experience

17:25 rbxbx: epochwolf: http://news.ycombinator.com/item?id=1508609 ;)

17:27 cmcclell: Joy of Clojure shouldn't be a first read for a person new to clojure

17:27 epochwolf: lancepantz, neotyk, rbxbx: thanks

17:30 cmcclell: epochwolf: Practical Clojure is also decent; Clojure In Action is shaping up to be nice, but it is not out yet :(

17:30 neotyk: epochwolf: or better write clojure code and ask here :)

17:35 kib2: Hi. Does someone knows where can I find an article/tutorial on how to transform sexpressions to xml/html ?

17:36 jkkramer: kib2: hiccup is a lib that does that

17:36 kib2: well, to HTML, not XML per se

17:36 kib2: jkkramer: Yes I know, but it is just for personal satisfaction :)

17:37 jkkramer: kib2: you could look at the sources to hiccup to see how it's doing it

17:37 arohner: kib2: then read the source for hiccup. It's pretty short

17:37 enlive may do that as well

17:43 jneira: hi people

17:44 nickik: Hello, I'm new to emacs and I want to install rainbow parens. But I have no idea how that works. Where do I put this script and make it default=

17:45 http://stackoverflow.com/questions/2413047/how-do-i-get-rainbow-parentheses-in-emacs

17:45 jneira: when i am writing a function I always think that there will be a better version in contrib or somewhere :-/

17:46 cmcclell: Anyone have any good information on clojure performance in general? We are evaluating the language as our functional alternative on the JVM A lot of discussions seem way out of date.

17:46 nickik: I know what you mean

17:46 jneira: jum personally i dont like rainbow parens ...

17:46 i didnt try install it

17:48 kotarak: jneira: this is not always the case: see reductions

17:49 jneira: jum @cmcclell i think, generally speaking clojure can have the same performance than java

17:49 konr: What was that function like filter that returned matching elements inside a nested structure?

17:49 jneira: is not reductions good?

17:51 cmcclell: jneira: thanks. Basically, when it comes down to debate I know the three things people will use to say no to clojure at my company will be: performance, tool support and "lisp is hard to teach"

17:53 jneira: konr with clojure.zip i think you could do so

17:53 qbg: cmcclell: What do you want to use clojure for?

17:53 konr: jneira: thanks!

17:54 dnolen: cmcclell: outside of code involving a lot of primitive arithmetic operations, I've rarely heard people complain about Clojure's performance.

17:54 technomancy: clojurebot: performance?

17:54 clojurebot: http://clojure.org/java_interop#toc46

17:54 cmcclell: qbg: We have sets of problems that will be easily solved by functional means. Currently, we use .NET and the JVM. On the .NET side of the house F# has been used for a while to great effect. On the JVM side of the house, we've been java or bust for a while. But now, we're going to pick a language we will support on the JVM for problems best solved via fn programming.

17:55 technomancy: clojurebot: performance is http://meshy.org/2009/12/13/widefinder-2-with-clojure.html

17:55 clojurebot: Ok.

17:56 jneira: jum "yes sir" would be better

17:57 i have wrote a function wich extracts the value o a n-dimension matrix

17:58 Already exists somewhere?

17:59 kotarak: jneira: reductions in contrib was terribly out-of-date. The new core version is much faster.

17:59 jneira: fe (nthn [[[4]]] [0 0 0]) -> 4

17:59 kib2: sorry, guys: baby problem. Thanks for your answers, I've already read hiccup source, but found them difficult to understand (I'm a Clojure newbie)

18:00 cmcclell: technomancy: thanks good article

18:00 jneira: kotarak: jum ok but sure the old version is better than mine :-P

18:02 kib2: In fact I've found an article (in Common Lisp) here: http://cybertiggyr.com/lh/ and translated the code to Clojure. But then I realized the author was doing it wrong: he just forgot about escaping "<",">", etc. chars.

18:02 jneira: this is my take http://gist.github.com/473128 sure there is a better version ;-)

18:06 jkkramer: ,(get-in [[[4]]] [0 0 0])

18:06 clojurebot: 4

18:06 kotarak: jneira: (reduce nth coll coords)

18:07 ,(reduce nth [[[4]]] [0 0 0])

18:07 clojurebot: 4

18:07 jneira: ñam always reduce

18:07 i am rusty

18:08 thanks kotarak!

18:09 kotarak: jneira: loop with accumulator cries for reduce, jkkramer also has an idea with get-in, but maybe nth is faster on vectors?

18:09 dunno

18:10 jneira: jum

18:19 note to myself: when do you have a recursive accumulative function think in a possible reduced reduce version (or fold)

18:41 akhudek: hey everyone, is there a reason that the sh function in clojure.java.shell prints its arguments?

18:42 assume it's just debug code that is still present?

18:42 lancepantz: akhudek: the latter, there was a mention of it on assembla recently

18:42 i think it got patched

18:42 akhudek: ok, thanks

18:49 mudphone: Sivajag: hi Siva

19:32 bhenry: ,(def test "test")

19:32 clojurebot: DENIED

19:33 bhenry: ,(let [test "test"] test)

19:33 clojurebot: "test"

19:35 bhenry: with ring, how might i serve up static files from a dynamically decided path (based on a "get" variable from the query string)? eg. http://localhost:8080/?dir=/Users/bhenry/Pictures/wallpaper would show me all the pictures from that dir on a page of html. right now i have it showing me all the full paths to each picture in dir.

19:51 tomoj: ring has some helper function for serving up static files that are on the classpath

19:51 but I think nothing for arbitrary files on the host

19:53 bhenry: guess i have to make a script asking for dir when starting up the clj file rather than getting it from the url afterwards.

19:53 tomoj: oh, and I was wrong

19:53 there is ring.middleware.file and ring.middleware.static

19:54 bhenry: i looked at those but couldn't figure out how to go about doing what i wanted.

19:59 lancepantz: what is the penalty for having lots of files on the classpath with the jvm though?

19:59 i know it would start up slower

19:59 would those files also get put in memory?

20:00 bhenry: no

20:00 my new idea is to just have the program write a static html file with the file:// links to images. and then open the static html file.

20:01 the problem i was having is from http://localhost i can't click on file:// links for browser security features.

20:01 but if i have clojure spit out an index.html i can just have it pop it open in the default browser as file://path to dir/index.html

20:46 redalastor: For a new clojure project, would you suggest to go with the latest github sources and transition to 1.2 when it is released or go with 1.1?

20:46 lancepantz: redalastor: github

20:47 redalastor: well actually, just pull the jar from repository

20:47 technomancy: clojurebot: compiling clojure is rarely necessary to do yourself.

20:47 clojurebot: Ack. Ack.

20:48 redalastor: I regularly checkout the code with git, compiling is more convenient than downloading to me.

20:49 technomancy: well sure, if you download with wget or whatever. =)

20:56 brweber2: hey stuarthalloway, can you help with an array type hint question (when using :gen-class)?

20:56 stuarthalloway: hey brweber2, how are ya?

20:56 and maybe

20:56 brweber2: great

20:56 stuarthalloway: if I can't, Stuart Sierra is sitting next to me

20:56 brweber2: and you? you home today or travelling?

20:56 awesome

20:56 stuarthalloway: home

20:56 brweber2: don't know if Liebke told you

20:57 but Near Infinity will be hosting clojure hack nights in NOVA

20:57 we should probably coordinate with you guys

20:57 to help do some useful stuff

20:57 technomancy: how big are your hack nights?

20:57 brweber2: help out if we can

20:57 technomancy: we just find a coffee shop with big tables and it works great. =)

20:57 brweber2: technomancy, first one will be scheduled after capclug this Thursday

20:58 technomancy where do you live?

20:58 technomancy: brweber2: seattle

20:58 we generally get 7-12 attendees

20:58 (disclaimer: we have really big coffee shops here)

20:58 brweber2: stuarthalloway so my question... is it possible to do array type hints for a method parameter on :gen-class? I've tried every hack I could think of

20:58 including some that might work on a defn

20:58 stuarthalloway: what kind of array

20:59 brweber2: technomancy we're hoping for about 50% of capclug so that would be around 10 folks

20:59 technomancy but we'll have to see

20:59 stuarthalloway: usually the string form of the JVM spec name works, e.g. "[B"

20:59 brweber2: I think it would be awesome if the groups could coordinate with clojure/core and help out

21:00 I tried "[Ljava.lang.String;" but that didn't work there with trunk

21:00 stuarthalloway: seems like that should work

21:00 what kind of non-working symptom did you get?

21:01 technomancy: brweber2: better to be prepared, I guess

21:01 brweber2: Exception in thread "main" java.lang.Exception: Unmatched delimiter: ] (seven.clj:3)

21:01 at clojure.lang.Compiler.compile(Compiler.java:6042)

21:02 maybe it is a bug in trunk, I haven't tried with 1.1 yet....

21:02 stuarthalloway: that definitely seems wrong -- can you make a gist of the whole thing?

21:03 brweber2: stuarthalloway absolutely

21:03 I'll trying debugging here to in a minute, I have the source checked out

21:04 * stuartsierra is here to save the day

21:05 abedra: lol

21:05 technomancy: super friends!

21:05 brweber2: stuarthalloway http://gist.github.com/473303

21:05 abedra: i believe he goes by Flash now :)

21:05 technomancy: who got stuck with Aquaman?

21:05 abedra: luckily nobody

21:06 it would be like the one who has superpowers but only in mutability

21:06 * stuarthalloway is green lantern

21:07 stuartsierra: Yes, I don't get along with Apple.

21:07 brweber2: stauarthalloway at clojure.lang.LispReader$UnmatchedDelimiterReader.invoke(LispReader.java:1021)

21:07 stuarthalloway: technomancy: we are trying to test the new build box

21:07 http://clojure01.managed.contegix.com/snapshots

21:08 but when I point lein there it grab a less-than-most-recent build

21:08 stuartsierra: brweber2: you have a type hint ("#^...") with no symbol to follow it

21:08 stuarthalloway: is there possibly some magic in leiningen that knows about the official build ip address?

21:09 brweber2: stuartsierra agreed, but that is how method on :gen-class works

21:09 stuarthalloway: abedra is http://en.wikipedia.org/wiki/Martian_Manhunter

21:09 stuartsierra: brweber2: that can't be right, the Clojure reader can't parse that

21:09 technomancy: stuarthalloway: how did you point lein there? hacking the lein source or adding it to :repositories in project.clj?

21:09 or something like an /etc/hosts entry?

21:09 brweber2: stuartsierra or you are saying I need to get rid of the quotes?

21:09 stuartsierra: no

21:10 technomancy: aquamaaaaaaan! http://www.harkavagrant.com/index.php?id=260

21:10 stuarthalloway: technomancy: repositories entry in project.clj

21:10 * stuartsierra searches through drafts of my book

21:10 brweber2: stuartsierra agreed :) it isn't working so I def agree with you! I'm not sure it is possible... I'd love to believe that it is though

21:10 technomancy: stuarthalloway: the b.c.o repositories URL is added in lein itself; I'm not sure what the precedence rules are.

21:10 however, you can set :omit-default-repositories true

21:11 in your project.clj

21:11 stuarthalloway: technomancy: perfect!

21:11 dsop: stuarthalloway: stuartsierra one you are here, what about the digest proposal on clojure.user?

21:11 stuartsierra: sorry, not up to date with mailing list

21:11 dsop: k

21:11 stuarthalloway: dsop: I haven't looked at the code, but based on my experience with crypto apis in Java i would support a convenience layer

21:12 dsop: stuarthalloway: at the moment it's just digest that wraps MessageDigest.

21:12 technomancy: stuarthalloway: I'm taking off now; feel free to email me if you need any more help with the new build box.

21:12 stuarthalloway: technomancy: I am sure the whole community will blame lein (you!) if we break it. Bwa ha ha :-)

21:12 stuartsierra: brweber2: don't use meta for types in :method args lists, see http://gist.github.com/473303#comments

21:13 technomancy: no doubt! =)

21:13 cheers

21:13 dsop: stuarthalloway: anyway, I'll wait until you guys look at it. it's probably not good clojure code anyway

21:13 brweber2: stuartsierra that works for primitives and classes, but not arrays... any idea about arrays specifically?

21:13 stuarthalloway: brweber2: task for capclug: review dsop

21:14 's proposal for digest, possibly extend to other crypto apis

21:14 stuartsierra: brweber2: I *think* it can just be a string, like my second comment http://gist.github.com/473303#comments

21:14 stuarthalloway: would be cool to add clojure.contrib.java.crypto

21:16 brweber2: stuarthalloway do you have a link?

21:16 stuarthalloway: brweber2: http://github.com/dsp/clojure-contrib/commit/77c9f7dbe071d90bf6cb385db4859e76d5e8ff19

21:19 brweber2: stuartsierra ah, I see the error of my ways! thank you!

21:19 stuartsierra: brweber2: welcome.

21:19 * stuartsierra feels like being 'Red Mist'

21:20 dsop: brweber2: there is also a follow up commit thats add a default charset

21:21 brweber2: dsop stuarthalloway ok, I'll follow up after Thursday's capclug to let you know when the group will meet

21:22 dsop: ?

21:22 capclug, group, meet?

21:25 ah okay found

21:27 stuarthalloway: dsop: where are you based?

21:27 dsop: stuarthalloway: karlsruhe, germany

21:27 stuarthalloway: bit of a hike to capclug :-)

21:28 dsop: hehe

21:28 stuarthalloway: you could come hang at JAOO in Aarhus though

21:28 Rich and I will be there

21:29 dsop: hm sounds good

21:30 brweber2: dsop capclug is national capital area clojure user's group

21:30 dsop the group will be meeting

21:30 soon

21:32 dsop stuart h. was suggesting that the group review it

21:32 dsop: brweber2: ah okay. at least you will have something to laugh, I'm not very lisp experienced :)

21:32 anyway, looking forward for feedback to make the code better

21:32 brweber2: dsop I think most clojure devs aren't....

21:33 dsop: I'm off, it's later here, 3:30 am

21:33 brweber2: I wonder if they will figure out what Class/forName "[B" means ;)

21:34 brweber2: dsop several of them will know :) the rest will have blank stares

21:35 stuartsierra is stuarthalloway making you work late tonight? ;)

21:36 stuartsierra: We're meeting in the Justice League Justice Cave or whatever it is.

21:36 'cause it's always a cave

21:36 brweber2: stuartsierra I'm not sure what to make of the clojure justice league... beats vampires I suppose!

21:37 stuartsierra: Well, sonian already claimed the Clojure Avengers

21:45 tomoj: hmm.. careful with swank.core/break: if one of the locals is an infinite sequence, your repl dies off

21:46 brweber2: stuartsierra what build box hacking are you doing? trying to get the build green again or something entirely different?

21:46 stuartsierra: setting up new Hudson/repository box

21:46 * hiredman has never actually done anything useful with swank.core/break

22:06 bhenry: if clojure justice league was instead clojure league of justice, the initials would be clj. you could also abbreviate it cloj

22:26 TimMc: :-D

22:37 cheluis: hi good evening... can someone tell me why this works (apply str "string") and this doesn't (apply (fn [x] (str x)) "string")

22:40 hiredman: cheluis: the fn takes a single arg, str does not

22:41 rhudson: cheluis: (apply f "string") is equivalent to (f \s \t \r \i \n \g)

22:41 cais2002: hi guys, how do I do this: bool e=false; for (int i=0; i<100; i++) if (vec[i]==true) then e=true; // now do something with e

22:41 I am using doseq for the for loop

22:42 cheluis: oh.. I see.. thanks

22:47 rhudson: cais2002: (let [e (some true? myvec)] ...) ; e will be true or nil

22:51 cheluis: if I want to duplicate every char on a string?

22:52 qbg: ,(apply str (map str "hello" "hello"))

22:52 clojurebot: "hheelllloo"

22:52 rhudson: for example?

22:52 cheluis: yep

22:52 "hheelllloo"

22:52 qbg: Probably a better way to do it

22:54 cheluis: don't you think that is a problem that there's so many ways to solve a problem on clojure?

22:57 rhudson: makes it more likely that you'll find at least 1 solution :)

22:59 cais2002: rhudson: how to do it in a more generalized way, assuming (vec[i]==true) is a test function and I am also doing something for side effects within the for loop?

23:02 rhudson: cais2002: I generally think of a way to use reduce if I want to "accumulate" some value across a sequence

23:03 aria42: Hey, anyone having swank-clojure issues; anything that should throw an error now loops in the mini-buffer "error in process filter: wrong argument type characterp, nil"

23:03 On the latest slime, slime-repl, etc.

23:09 rhudson: cais2002: something like (let [e (reduce #(or %1 %2) false (for [i (range 100)] (v i)))] ... )

23:20 mikem: ,(macroexpand-1 '(unless false (println "this should print")))

23:20 clojurebot: (unless false (println "this should print"))

23:21 mikem: hm, according to Programming Clojure, that should expand to (if false nil (println "this should print"))

23:21 bhenry: ,(doc unless)

23:21 clojurebot: Titim gan éirí ort.

23:22 mikem: hm, ok, how about this:

23:23 ah, ok, never mind :) seems it's working

23:23 since unless isn't actually defined anymore

23:24 bhenry: yeah seems with the quoted expression you'll get whatever you put there no matter what.

23:25 rhudson: ,(macroexpand-1 '(when foo bar baz))

23:25 clojurebot: (if foo (do bar baz))

23:25 mikem: ,(macroexpand-1 '(when-not foo bar baz))

23:25 clojurebot: (if foo nil (do bar baz))

23:27 bhenry: ,(macroexpand-1 '(im-so-drunk-right-now false (println "this should print")))

23:27 clojurebot: (im-so-drunk-right-now false (println "this should print"))

23:27 bhenry: which is why it worked with unless

23:27 goodnight everyone.

23:27 rhudson: If the first symbol in the quoted list isn't a macro, there's nothing for macroexpand-1 to do

23:27 bhenry: right

23:57 Bahman: Hi all!

23:57 qbg: Hi

Logging service provided by n01se.net