#clojure log - Feb 23 2009

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

0:00 rlb: Chouser: got it -- it was a misunderstanding of ByteBuffers. You don't want .clear, you want .flip (presumably means "flip" it from writing to reading). Now it works. Thanks again.

0:16 arohner: man, laziness makes your stack traces confusing

0:24 cp2: oi -- whats this ClojureCLR in clojure-contrib?

0:24 hiredman: ~google microsoft CLR

0:24 clojurebot: First, out of 246000 results is:

0:24 Common Language Runtime - Wikipedia, the free encyclopedia

0:24 http://en.wikipedia.org/wiki/Common_Language_Runtime

0:25 cp2: yeah i know hiredman

0:25 im just curious what they are doing with it

0:25 hiredman: port to the clr

0:25 cp2: This project is a native implementation of Clojure over the Microsoft .Net Framework

0:25 programmed in C# and using the Dynamic Language Runtime.

0:25 yeah, readme.txt always useful

0:25 hiredman: it is on the google group

0:33 pilkarn: http://paste.lisp.org/display/76007#2 <- there is what i have bow, i dont know what im doing wrong. noclassdeffounderror

0:33 yeah its java code but those bastards arent very helpful

0:46 anyone have an url to a vdieo?

1:16 cooldude127: i really hate the way java just loves immutability

1:16 s/immutability/mutability

1:17 * cooldude127 has a working BFS path finder in clojure that he has to port to java. that's gonna blow

2:00 fffej: has anyone ever seen an issue where :use with a namespace causes a Java heap space exception?

2:00 ,(ns foo (:use java.security MessageDigest))

2:01 clojurebot: java.io.FileNotFoundException: Could not locate java/security__init.class or java/security.clj on classpath:

2:11 durka42: fffej: no, but :use is for clojure code. :import is for java

2:12 fffej: thanks - yeah, I realized that after I sent that, but I still get the out of memory (even with 1GiB heap)

2:13 but updating to the head revision of everything seems to have solved my problem

3:44 cgrand: digash: thanks for the (add-remote-javadoc "" "http://www.google.com/search?btnI=I%27m%20Feeling%20Lucky&q=allinurl:") trick, I added it to clojure.contrib.javadoc

4:56 hoeck: 'foo

6:19 Lau_of_DK: Hey hey :)

6:30 alinp: ~def time

6:41 rfgpfeiffer: ~def pl

7:05 AWizzArd: kotarak: achso, is ja jetzt frei! Und hier ist auch Karnevall ;)

9:45 stuarthalloway: is it to be expected that the new lazy sequences are functions returning themselves?

9:45 scratch that: returning themselves *realized*?

9:47 Chouser: stuarthalloway: that's what they are, though Rich described that as an "implementation detail"

9:47 stuarthalloway: Chouser: thanks. Didn't see that in the web docs -- do I need to go back and read all the irc logs? :-)

9:48 Chouser: It's ok, I read them for you.

9:49 :-)

9:49 http://groups.google.com/group/clojure/msg/bfa1b376cd144735

9:49 stuarthalloway: which reminds me, what do the A and I an AFn and IFn mean?

9:50 Chouser: Abstract and Interface

9:50 the classes provided by clojure use that frequently -- have you seen my chart?

9:50 stuarthalloway: ys

9:51 Chouser: the idea is that Interface defines a formal interface with no method bodies at all

9:51 stuarthalloway: right, this is Java stuff. For some reason I thought there was a more Clojurish meaning

9:51 Chouser: Abstract then often provides a bunch of helpful method definitions to fill out parts of the Interface that would be repetitive.

9:51 ah. no.

9:52 shoover: is it humanly possible to read #clojure logs AND comp.lisp.lang?

9:52 stuarthalloway: my confusion was around ifn? and fn?

9:52 Chouser: The important part is to pronounce "ifn" with a country twang.

9:53 are you straight on 'ifn?' and 'fn?' now?

9:54 stuarthalloway: yes, I just think the names are confusing

9:54 Chouser: The key to lazy-seq is that it must return an object that holds onto a closure, and when it's seq() method is called that it run the closure and cache the result.

9:55 right now it just so happens that you can also call the object directly and it does the same thing as if you called seq on it, but I don't think that's a promise.

9:55 stuarthalloway: in my world ifn? would do what fn? does, and there would be another world for fn's behavior

9:56 Raynes: stuarthalloway: Hi. :)

9:56 Chouser: I put up a bit of a fuss at the time: http://clojure-log.n01se.net/date/2008-11-25.html#09:19

9:57 I just failed to come up with an acceptible alternative.

9:57 stuarthalloway: Chouser: Yeah, I got nothing.

10:07 Chouser: I wonder if rhickey could be talked into importing clojure.lang automatically, just like java.lang.

10:11 Raynes: A possible new Clojurer on Stackoverflow.com "When I went to the site I was immediately turned off by what it talked about -- differences from other lisps, how to get it running under the jvm. Where's my hello world! "

10:11 Now /that/ is what I call idiocy.

10:12 danlarkin: just coming from a different place

10:12 mattrepl: turnkey programming

10:13 gnuvince: *sigh*

10:13 Does everything have to be spoon-fed to these people?

10:13 Raynes: I even talked with him for a moment, what he said next was "my problem with it, is that as a new learner, those are the things I am absolutely least interested in. I view having to work in the jvm, and deal with any java stuff as a minus not plus. When I look at a new language's site, I want to see *how to code in it.*"

10:14 http://stackoverflow.com/questions/563356/which-lisp-should-i-learn/569399#569399 <---

10:14 Our comments are in Greg Hewgill's post.

10:16 cemerick: gnuvince: you need the spoon-fed "track" in order to gain critical mass, whatever level of activity that is

10:17 I don't think clojure should have that track just yet, as lots of important things are still in flux (although I'll bet stuarthalloway would disagree for business reasons)

10:18 Raynes: cemerick: There is a wiki with everything he's looking for but he wont click the fuckin link.

10:18 stuarthalloway: cemerick, Raynes: Actually, I would say "not quite yet" for the spoon-fed track

10:18 one way that shows up in the book is my refusal to write a tutorial on "How to do Clojure in IDE X"

10:19 Raynes: stuarthalloway: I hate books that do that. <3 you and your book.

10:19 cemerick: Raynes: not good enough. Go to http://www.ruby-lang.org/en/ -- boom, the spoon-feeding is *right up top*.

10:20 mattrepl: it's not like there's a "hello world" on sbcl.org - seems that he's not going to find a spoon-fed track for any lisp

10:20 Raynes: cemerick: Ruby was the first thing that came to mind when he said "Wheres my Hello World!"

10:21 cemerick: I don't know ruby from a rock on the ground, but they've been very successful in attracting the people who simply want to get things done, not be impressed by whatever gizmo or technical advantage some language has

10:21 gnuvince: The Java or C# sites don't have hello world plastered on their front pages either. C and C++ don't even have web pages.

10:21 stuarthalloway: I hope that chs 1 and 2 of the book at least help the spork-fed crowd :-)

10:21 Raynes: Ruby gives me that "In ur language, ruinin' ur fun" kind of feeling.

10:21 leafw: "Try ruby (in your browser)" link is quite compelling.

10:21 cemerick: mattrepl: goodness, let's not follow anything in the CL world w.r.t. marketing/community/whatever.

10:22 marklar: stuarthalloway: I read an excerpt chapter 2 and I really liked it. I'm from an imperative background too

10:22 cemerick: at some point, clojure could *easily* provide that spoon-fed track, and have an immediate leg up within the masses

10:22 gnuvince: The "Road to Clojure" thread on c.l.l was really enlightening about their community.

10:22 mattrepl: cemerick: of course not! just pointing out that the fellow is in for a rude awakening if he refuses to investigate languages that don't have "hello world" plastered on the front page

10:22 Bracki: Is there a way to print to a given output stream?

10:23 Chouser: Ruby is well positioned for spoon-feeding. It's imperative and oop so it's not going to challenge the way you solve problems up front

10:23 gnuvince: Maybe a Python.org-like tutorial wouldn't be out of order

10:23 Chouser: It's dynamic, so you'll get up to speed faster than with Java or C#

10:23 cemerick: gnuvince: Java, C, and C++ all have established userbases -- being able to say that 1M people (or whatever) use a particular platform is enough of a signal to someone that those are "safe" choices

10:23 leafw: Bracki: use binding of *out*

10:23 Bracki: leafw: *out* is bound already.

10:23 gnuvince: cemerick: I'm sure closure has at least 1000000 users... in binary :)

10:23 cemerick: C# is a special case being from Microsoft, so it gets a pass from *thousands* of MS shops

10:24 gnuvince: :-)

10:24 gnuvince: ,2r1000000

10:24 clojurebot: 64

10:24 Raynes: Clojure has atleast 135 users.

10:24 gnuvince: or at least 135 lurkers

10:24 cemerick: gnuvince: whoa, I've never seen that numeric notation

10:25 gnuvince: cemerick: works from 2 upto 36 :)

10:25 ,36rz

10:25 clojurebot: 35

10:25 leafw: Bracki: (binding [*out* (get-a-stream)] (println "hello")) ---> prints to stream.

10:25 cemerick: gnuvince: that's fantastic. What's the 'z'?

10:26 Chouser: 35 in base 36

10:26 gnuvince: cemerick: the base-36 digit

10:26 ,16rBEEF

10:26 clojurebot: 48879

10:26 cemerick: oh, I see

10:26 gnuvince: ,36rCEMERICK

10:26 clojurebot: 972199975844

10:26 Chouser: gnuvince: seriously, where'd you dig that up? I didn't know it either.

10:26 gnuvince: Chouser: it's in the doc

10:26 Chouser: unbelievable.

10:26 cemerick: jeez, that's sick

10:26 Chouser: ;-)

10:26 cemerick: gnuvince: link?

10:26 gnuvince: Hang on

10:26 (slow link here)

10:27 cemerick: Chouser: how did we not know about this? ;-)

10:27 Bracki: leafw: Yeah but can I rebind insinde a binding?

10:27 Chouser: hm, not in the reader->forms->Numbers section as I would expect.

10:27 Bracki: yes!

10:27 gnuvince: Hmmm

10:27 cemerick: yeah, I was just scanning /reader frantically

10:28 gnuvince: I was sure it was in the reader doc...

10:28 Chouser: Bracki: your new binding pushes on like a stack

10:28 cemerick: that's one crazy easter egg!

10:30 gnuvince: I can't find the doc anymore

10:30 But I'm quite sure I saw it somewhere.

10:30 Raynes: That guy I was talking about a moment ago "Things I like: good library support (me=spoiled by python), good environments, unicode support."

10:31 "spoiled by python".

10:31 That explains it.

10:31 gnuvince: Well CLojure has good library support, good environments and unicode support.

10:32 Raynes: gnuvince: Doesn't have a website that spoon feeds.

10:32 gnuvince: Raynes: neither does Python. You need to go in the documentation to find the tutorial

10:32 cemerick: ...all in good time

10:32 Chouser: ah, found it. It's documented right here: http://tinyurl.com/b9t3og

10:32 Raynes: gnuvince: But Clojure doesn't have /any/ of that type of documentation unless you click "wiki" AND HE WONT DO IT!

10:33 gnuvince: :)

10:33 well then

10:33 mattrepl: Chouser: thanks

10:33 gnuvince: Is it really a loss?

10:33 Raynes: gnuvince: It just makes my chains rattle a bit :|

10:34 Chouser: Raynes: leave him alone. He'll try it later.

10:34 gnuvince: I agree.

10:34 Raynes: Chouser: I'm not even bothering him.

10:34 Chouser: oh, I didn't mean it like that

10:34 cemerick: heh, I just got why the literal uses 'r', and not 'b' (for base) :-P

10:34 * cemerick is SLOW with all things math

10:35 gnuvince: ,0b10

10:35 clojurebot: Invalid number: 0b10

10:35 Chouser: I just meant he may go try Common Lisp first, or Scala, or who knows what. Eventually he'll be frustrated by the ways they aren't Clojure (whether he understands that's why they're frustrating or not) and will try again.

10:36 or he'll become enamored with inferred static typing and we'll lose him forever. :-)

10:37 gnuvince: You may still lose me to that :)

10:42 Chouser: I need to get past Qi's goofy type syntax so I can grok it and understand how it could work with Clojure.

10:44 gnuvince: Rich has talked a couple times about Qi's type system and how he wouldn't dislike bringing that to Clojure to provide � la carte static typing.

10:44 mattrepl: I'm still hoping we'll get gradual typing down the road. both to help spot bugs and get a speed boost.

10:44 stuarthalloway: what's the best way to write fibo with the new laziness?

10:44 mattrepl: such as: http://portal.acm.org/citation.cfm?id=1408681.1408688

10:45 stuarthalloway: clojure.contrib.lazy-seqs version is broken (and was broken before)

10:45 I came up with http://paste.lisp.org/display/76021

10:48 Bracki: So how do I rebind insinde a binding?

10:49 jbondeson: is anyone else having problems building the latest clojure?

10:51 Bracki: My *out* is already bound but I need to rebind.

10:51 stuarthalloway: Bracki: just do another [binding ...]

10:51 Bracki: Can I use loop as well?

10:52 stuarthalloway: jbondeson: 1299 builds fine for me

10:53 gnuvince: How come this doesn't work? (def lazy-fibs (lazy-seq (cons 0 (cons 1 (map + lazy-fibs (rest lazy-fibs))))))

10:53 jbondeson: odd, i have seq objects complaining about not overriding next

10:54 bah

10:54 i know what happened.

10:54 it didn't delete files that were renamed

10:55 very odd.

10:55 lisppaste8: leafw pasted "untitled" at http://paste.lisp.org/display/76022

10:56 cgrand: stuarthalloway: (seq-utils/rec-cat fib [0 1] (map + fib (rest fib))) :-)

10:56 leafw: Bracki: see the double binding example.

10:56 stuarthalloway: cgrand: cheating!

10:56 leafw: Bracki: ... that I just pasted.

10:56 Bracki: Where?

10:56 gnuvince: cgrand: how come using cons+map inside lazy-seq gives a stackoverflow?

10:57 cgrand: gnuvince: where?

10:58 * Chouser is glad cgrand is using rec-cat so he doesn't have to.

10:58 gnuvince: How come this doesn't work? (def lazy-fibs (lazy-seq (cons 0 (cons 1 (map + lazy-fibs (rest lazy-fibs))))))

10:58 cgrand: gnuvince: it's the the call to rest I think

10:59 * Raynes hugs gnuvince.

10:59 gnuvince: Raynes: ?

10:59 Raynes: :)

10:59 <3

10:59 gnuvince: cgrand: either next or rest causes a stack overflow.

10:59 cgrand: when you realize this seq, (cons 0 (cons 1 (map + lazy-fibs (rest lazy-fibs)))) is evaluated

11:00 Raynes: clojurebot: svn?

11:00 clojurebot: svn is http://clojure.googlecode.com/svn/trunk/

11:00 slashus21: (def lazy-fibs (lazy-seq (cons 0 (lazy-seq (cons 1 (map + lazy-fibs (rest lazy-fibs)))))))

11:01 cgrand: and to evaluate that you need lazy-fibs (ok) and (rest lazy-fibs) which needs to realize lazy-fibs

11:01 lisppaste8: bracki pasted "what's wrong with the loop?" at http://paste.lisp.org/display/76023

11:01 gnuvince: Shouldn't it only need to realize as much as is needed?

11:01 Bracki: My loop won't stop.

11:02 gnuvince: Bracki: which one?

11:02 The one which is clearly infinite?

11:02 Bracki: If you say so. I meant the inner one.

11:03 stuarthalloway: slashus21: try this on yours: (rem (nth (lazy-fibs) 100000) 1000)

11:03 gnuvince: Bracki: you have no termination condition.

11:03 It'll always print input and recur with outs

11:03 You never tell it when to stop recurring

11:03 cgrand: gnuvince: rest "advances" the seq

11:03 if you use drop 1 instead of rest it works:

11:03 slashus21: stuarthalloway: ouch

11:03 Bracki: So how do I check if outs is empty?

11:03 cgrand: (def lazy-fibs (lazy-seq (cons 0 (cons 1 (map + lazy-fibs (drop 1 lazy-fibs))))))

11:04 gnuvince: advances the seq?

11:04 slashus21: stuarthalloway:

11:04 Is that not correct behavior?

11:05 stuarthalloway: slashus21: runs out of memory on my box

11:05 Bracki: Or should I just check *out*?

11:05 stuarthalloway: but http://paste.lisp.org/display/76021 correctly returns 875

11:06 slashus21: trying yours as a function now....

11:07 Bracki: gnuvince: What should the termination condition be?

11:07 cgrand: gnuvince: (drop 1 s) holds a reference on s (including the head) while (rest s) really returns the rest of s, that's why it needs to realize s: simply to be able to discard the head

11:07 gnuvince: Bracki: I don't know, it's your app, but there should be a when or if in there to return a value once you're done looping.

11:08 Bracki: Well what do I check against that I know I'm done looping?

11:09 stuarthalloway: slashus21: I can't convert your lazy-fibs to a function, same problem as the impl in clojure.contrib

11:10 leafw: Bracki: you are looping *connections*. What do you know about this list? When no more elements, stop.

11:17 Bracki: Sorry I'm at a loss here. @*connections* will give me back the whole list.

11:17 So checking against it doesnt make sense.

11:18 gnuvince: Well you need to figure it out.

11:18 Because otherwise, you're always gonna be stuck in that infinite loop.

11:24 Chouser: is there any appetite for combining :use and :require syntax?

11:24 stuarthalloway: is fn* an undocumented special form?

11:25 Chouser: stuarthalloway: it's the real special form that the 'fn' macro uses.

11:25 jbondeson: Chouser: that would be nice to have a consistent syntax

11:25 stuarthalloway: there's also if*, and i believe a few others

11:26 Chouser: if* is new -- 'if' is now a macro that does the lazy-seq assert and uses 'if*'

11:26 let is a macro that does destructuring and then uses let*

11:26 stuarthalloway: are the semantics of fn* and list* documented anywhere?

11:27 Chouser: but the clojure docs seem to specifically obscure this distinction

11:27 Bracki: Hm, while loop works now it doesn't do what I had expected.

11:27 Chouser: (doc if)

11:27 ,(doc if)

11:27 clojurebot: "([tst & etc]); "

11:27 stuarthalloway: I am considering introducing rec-cat into the FP chapter of the book, which requires explaining how list* and fn* work

11:28 Chouser: list* is different -- it's just a normal function

11:28 stuarthalloway: so you would use it instead of cons if you knew you had a list?

11:29 and list* could be replaced with cons?

11:29 danlarkin: Chouser: how would the new use/require work? like use or like require?

11:30 Chouser: If I understand your question, yes. (list* 1 2 [3 4 5 6]) is the same as (cons 1 (cons 2 [3 4 5 6]))

11:30 danlarkin: both! (demand '[my.lib :all]) would be like (use 'my.lib)

11:31 stuarthalloway: Chouser: thanks

11:31 Chouser: (demand '[my.lib :only (foo)]) would be like use

11:31 (demand '[my.lib :as bar]) would be like require

11:31 jbondeson: haha love the name

11:32 Chouser: stuarthalloway: I wouldn't recommend discussing the implementation of rec-seq

11:32 stuarthalloway: Chouser: believe me I don't want to~

11:33 Chouser: That's pretty tightly married to the current implementation of lazy-seq

11:33 lisppaste8: bracki annotated #76023 "*out* isn't rebound properly." at http://paste.lisp.org/display/76023#1

11:33 cemerick: is demand a proposal? I haven't seen it discussed anywhere...?

11:34 danlarkin: Chouser: how about cutting some unnecessary nesting: (:demand my.lib.*) would be use, (:demand my.lib :only (foo bar)), (:demand my.lib), (:demand my.lib :as mylib)

11:34 Bracki: What I just pasted, shouldnt that work?

11:34 print last readline to every known out?

11:34 hiredman: (doc if)

11:35 Chouser: danlarkin: hm ... if no features are lost, I think I'd like that.

11:36 lots more quoting in the fn case though. (demand 'my.lib :as 'mylib)

11:36 cgrand: stuarthalloway: if you want to show an implementation of rec-seq/rec-cat, I think it would be better to show one that uses an atom, not the one in contrib (which relies on current implementation details)

11:36 stuarthalloway: cgrand: cool. I am going to post a question over on the mailing list and see what people think.

11:36 danlarkin: Chouser: true, but how often is it used outside of an ns expression

11:36 Chouser: cgrand: couldn't rec-seq be defined in terms of lazy-seq, perhaps with an inner fn?

11:37 cgrand: Chouser: hmmm....

11:40 lisppaste8: Chouser pasted ":demand" at http://paste.lisp.org/display/76025

11:41 hiredman: hmmm

11:41 far too few parens

11:41 Chouser: heh. are you serious?

11:41 hiredman: if you take out parens like that how will people know it's a lisp?

11:41 No.

11:41 Chouser: ok, just checking.

11:42 cemerick: looks good to me -- easy enough to port existing code

11:42 jbondeson: Chouser: how would you do an straight require vs. straight use?

11:42 basically how would you tell the difference

11:42 danlarkin: ahh that looks so much more aesthetically pleasing

11:42 Chouser: jbondeson: I would default to 'require' since I don't like straight use

11:42 * danlarkin wants demand

11:42 cemerick: I'm still hoping that imported classes have their corresponding libs automatically required someday

11:42 Chouser: jbondeson: and maybe add :all to get use behavior

11:42 jbondeson: Chouser: makes sense, would you add an :all ?

11:42 slashus21: looks good

11:42 jbondeson: haha

11:43 Chouser: jbondeson: :-)

11:43 hiredman: danlarkin: you demand demand?

11:43 Chouser: which would to the same as my.lib :exclude ()

11:44 should each lib be grouped to be more like :import?

11:44 or should :import not be group -- check for dots in the symbol to know if its a package or class.

11:46 jbondeson: damn, forgot to ask rich if he still wanted the empty-seq in if checking.

11:46 i know it works cause i just caught one in swank-clojure.

11:46 lisppaste8: Chouser annotated #76025 "each lib grouped in :demand" at http://paste.lisp.org/display/76025#1

11:47 danlarkin: ahh the parens are back

11:47 Bracki: Hm somehow I had assumed doseq in combination with binding is the same as loop but it isn't.

11:47 jbondeson: Chouser: i like the explicit parens to be honest. i could see the paren-less version getting messy

11:47 Bracki: So doseq does it.

11:49 cemerick: +1 on the parens

11:50 danlarkin: hurumph

11:52 lisppaste8: cgrand pasted "rec-seq without ugly details" at http://paste.lisp.org/display/76027

11:52 Holcxjo: And now combine demand and import into some common construct?

11:53 Chouser: Holcxjo: I think they're different enough to keep separate. import is for Java classes.

11:53 cgrand: Chouser: yup rec-seq can be defind that way

11:53 Chouser: use and require are both working on libs

11:55 * gnuvince is fucking tired of doing web development :(

11:55 WizardofWestmarc: so do it in clojure instead? :)

11:55 gnuvince: web development should be renamed to "most frustrating programming job EVER"

11:55 WizardofWestmarc: it's not the language, it's the nature of the work

11:56 WizardofWestmarc: gnuvince: I think that depends at this point. Stuff like jQuery has been working on removing the multi-browser retardation to help webdevs keep sanity

11:57 ...which is why I'm working on a web side project w/django front end and clojure for back end processing that requires actual beef.

11:57 cemerick: I'm hoping javafx matures into something that eliminates all pain, forever (for our purposes, anyway)

11:57 ;-)

11:57 hiredman: cemerick: that will never happen

11:58 cemerick: thus the wink

11:58 hiredman: because all is suffering

11:58 cemerick: ah, well, I wasn't thinking existentially

11:58 hiredman: (when doing front end developement)

11:58 gnuvince: WizardofWestmarc: here's an example; we have a client who wanted to list the numerous advantages members of her organizations benefited from. She said they changed so rarely that she didn't mind if we did the updates. With that in mind and the way she wanted the page to work, we used PHP and jQuery to make the content dynamic, save us a lot of typing and have a copy under revision control.

11:59 WizardofWestmarc: this morning she called to say that finally she wanted to be able to modify that page herself, and she wanted the thing to be super simple.

11:59 * hiredman dies

11:59 gnuvince: And to top it all off, she needs us to do it in about 1 hour and 30 minutes, because that's all the time that's left in her time bank.

11:59 shoover: Chouser: all else being equal, whatever gets the point across with the least boilerplate (i.e. quoting) because this stuff is the first thing you see in every lib. In terms of names, use is intuitive, but require and demand sound more about declarative security than loading code. I prefer variations of use and load.

12:00 WizardofWestmarc: gnuvince: that's client issue not webdev issue, though I appreciate the pain there.

12:00 gnuvince: Fucking site is a Drupal site (thank God we switched to Django for all other sites)

12:00 slashus21: yey django

12:00 WizardofWestmarc: I've really come to like Django from my limited experience with it. Been watching Django from the Ground up to get up to speed quickly

12:00 gnuvince: WizardofWestmarc: the hard webdev part is figuring out how I'm gonna do this so that she doesn't have to learn ANYTHING

12:00 jbondeson: out of morbid curiosity, what's the point of the 'nil?' function?

12:01 gnuvince: jbondeson: testing if something is nil?

12:01 jbondeson: oh you mean (if x) ?

12:01 WizardofWestmarc: gnuvince: that can be hard in a LOT of arenas, the problem is mostly expectations seem different for people in relation to web pages for some reason.

12:01 gnuvince: jbondeson: that could be false too.

12:01 jbondeson: nil is just always false in an if

12:01 gnuvince: jbondeson: you may want/need to differentiate between

12:01 Chouser: shoover: The name 'demand' is just a placeholder.

12:02 jbondeson: i guess

12:02 gnuvince: WizardofWestmarc: the big one I see coming from a mile and a half away is that she's gonna want to put colors and bold text and crap like that.

12:02 slashus21: "its pretty"

12:02 jbondeson: if you think you may have booleans AND objects in your function...

12:02 slashus21: it's*

12:03 gnuvince: Do you think expecting the user to edit a JSON file is too hard?

12:04 slashus21: probably

12:04 gnuvince: damn

12:05 danlarkin: oh man y'all are going to love my django port then, bahaha!

12:06 slashus21: danlarkin: Porting django to?

12:06 danlarkin: clojure of course

12:06 slashus21: yey

12:07 fogus: So would it be called Djjango? I'm so confused.

12:07 cratuki: How do I go about embedding clojure into an existing java application? Can I spawn an interpreted in a thread?

12:08 WizardofWestmarc: needs a different musician name

12:08 but still has to have a j :)

12:08 gnuvince: jimi

12:08 Chouser: do people use the prefix feature of use and require? (require '(clojure [set :as cset] [xml :as xml]))

12:08 fogus: djimi

12:09 Chouser: cratuki: clojure is not interpreted

12:09 slashus21: cljango

12:09 ?

12:09 gnuvince: hell no, this isn't Common Lisp

12:09 slashus21: the cl sort of look like a d

12:09 danlarkin: no it won't be called django, no it will not have a J in the name, end in -jure or start with clj

12:09 Chouser: cratuki: but you can compile clojure and clojure-generated code and java compiled code all into one app and have it all call each other.

12:09 hiredman: Yawfie!

12:09 slashus21: okay okay

12:10 Chouser: clabango!

12:10 danlarkin: nooooo

12:10 don't give lau the idea that's a good name

12:10 cratuki: Chouser: not interpreted - OK. But there's a REPL, yes? What's the difference between a language with a REPL and an interpreted language?

12:10 hiredman: clojurebot: Yawfie is danlarkin's port of django to clojure

12:10 clojurebot: Ack. Ack.

12:11 danlarkin: bah!

12:11 clojurebot: svn rev 1300; lazy-seq perf tweaks

12:11 rsynnott: isn't Ruby (pre 1.9) about the only major pure-interpreted langauge with a repl?

12:11 rhickey: svn 1300 support lazy-seq metadata and better perf, if-lets no longer needed

12:13 jbondeson: rhickey: Chouser said that you were willing to take a patch to the lazy-seq assert logic to also add empty-list asserts as well. is that still the case?

12:15 Chouser: rhickey: very cool.

12:17 Drakeson: walters: ping ..... what version of JNA do I need for JGIR? I've got 3.0.9-1 from debian. is that enough?

12:18 Chouser: cratuki: clojure.lang.Repl used to be a Java app that provided a clojure repl.

12:18 now it's written in clojure.

12:19 hiredman: ooooh

12:19 cratuki: If I could get old code, are there any good reasons not to embed clojure as a scripting language-come-app development language? The software I'm thinking of embedding in is integration softwar.e

12:19 hiredman: neat

12:19 walters: Drakeson: for JGIR from svn you'll need https://jna.dev.java.net/issues/show_bug.cgi?id=98 too

12:19 rhickey: jbondeson: still thinking about that - could be lots of false positives

12:19 hiredman: cratuki: the fiji guys embedded it somehow in their image processing software

12:20 walters: Drakeson: if you can convince the debian maintainer to add that patch until the next JNA release that'd be great

12:20 jbondeson: rhickey: i haven't had too bad a time with it yet, but i haven't put it through a ton of paces.

12:20 Drakeson: walters: great, thanks

12:21 rhickey: jbondeson: what did you test for?

12:22 jbondeson: rhickey: i went very broad and started with any empty list, and not an identical object to the EmptyList

12:22 cgrand: rhickey: thanks!

12:22 Chouser: cratuki: Should work well.

12:22 rhickey: cgrand: you're welcome!

12:23 jbondeson: i think that may be a little broad. though technically you could have different levels of checking from paranoid to light if you wanted to.

12:25 are other swank-clojure users getting NullPointerExceptions when you try to tab complete?

12:27 bah, figured out what happened. something i did for debugging was forcing a delayed object.

12:27 cratuki: Chouser - thanks for help

12:33 jbondeson: can anyone think of a reason why (first coll) would return an empty list (not null) for any reason other than an explicit empty list is in the sequence?

12:33 technomancy: have people suggested removing parens from clojure already, or is this the first time?

12:33 (on the mailing list)

12:34 I'm wondering if there's some kind of universal constant that states it must happen when the size of the community exceeds a certain point.

12:34 replaca: Q: When I use derive & multimethods, am I guaranteed to get the "most specific" method or do I have to call prefer-method? That is, if I have (derive ::b ::a) and (derive ::c ::b) and then (defmethod foo ::a...) (defmethod foo ::b ...) and (defmethod foo ::c...) am I guaranteed to get the last one when I call with ::c even though isa? matches all of them?

12:34 jbondeson: debugging swank is going to be the end of me...

12:35 replaca: This matches my O-O sensibility, but isn't specified in the doc

12:37 Chouser: replaca: I think that's right.

12:38 jbondeson: dorun is tripping my empty-list in if with the (or (first coll) true) construct...

12:39 replaca: Chouser: thanks. This probably should be added to the doc. Either it's not there or my head was cloudy when I read it. :-)

12:41 lisppaste8: Chouser annotated #76025 ":use already does most of :demand" at http://paste.lisp.org/display/76025#2

12:42 jbondeson: Chouser: can you think of any reason do run couldn't be changed to use a do construct?

12:43 dorun that is

12:44 Chouser: dorun takes a seq -- you want it to force the seq returned by a block?

12:44 (dorun foo bar (map inc coll)) ? foo and bar are each run once, then map is forced?

12:45 jbondeson: the current dorun forces the evaluation in an if statement by calling first on the collection, which is what is tripping the empty-list logic, changing it to (do (first coll) (recur coll)) would pull it out of an if

12:46 but i don't know if there is some reason it didn't already do that.

12:46 wonder if (or (first coll) true) is faster than relying on a do construct

12:47 danlarkin: don't micro-optimize like that

12:47 you'll just end up reading your code later saying... wtf was I trying to do here

12:47 jbondeson: well we're talking about the dorun in clojure.core

12:48 i think forcing the evaluation in an if like that is a little ugly personally, but rich is much smarter than me, so i'm trying to think of why he did that.

12:48 danlarkin: well that's what I get for not reading the context I guess

13:05 ozzilee: Can anyone tell me if Compojure works with the Clojure trunk? (use 'compojure) gives me the dreaded "Don't know how to create ISeq from: Symbol".

13:05 jbondeson: welp, changing it to a (do (first coll)...) fixed the tripping of empty-list in seq

13:05 and actually, i think i could trip the lazy seq in the exact same way

13:05 stuarthalloway: ozzilee: building from the vcs head of all projects seems to work

13:06 jbondeson: i'll have to talk to rich about that the next time he's in irc

13:08 ozzilee: stuarthalloway: Let me try rebuilding them both again.

13:12 stuarthalloway: Still no dice. It works if I use the clojure.jar that comes with compojure, but not with the clojure.jar from trunk.

13:12 stuarthalloway: ozzilee: dunno then. worked for me when I rebuilt the dependencies for the book samples this morning

13:14 ozzilee: stuarthalloway: That's frustrating. Ok, thanks.

13:16 jbondeson: hah, yep, (doall (list (lazy-seq nil))) will trip the lazy-seq assert logic

13:18 Kerris7: woot http://skillsmatter.com/event/java-jee/clojure-for-java-programmers

13:19 hiredman: london

13:19 technomancy: whoa; rich got a haircut

13:19 =)

13:20 jbondeson: he needed that last bit of performance and the hair was slowing him down

13:21 technomancy: jbondeson: there was no way to lazy-load it, I guess.

13:21 Kerris7: hiredman: since I'm a skint student this may be a once in a lifetime opportunity for me to set my eyes on a creator of a programming language :V

13:22 technomancy: if that's your goal you should try oopsla

13:22 you'll run into twenty language creators before lunchtime

13:22 Lau_of_DK: Good evening gents

13:28 danlarkin: hiya lau

13:28 cgrand: Hi Lau!

13:35 jbondeson: ,(if (lazy-seq nil) "true" "false)

13:35 clojurebot: EOF while reading string

13:35 jbondeson: ,(if (lazy-seq nil) "true" "false")

13:35 clojurebot: "true"

13:36 jbondeson: guess clojurebot doesn't have the assert logic on

13:36 Chouser: he used to, but I guess you're right.

13:36 hiredman: oh, I must not have turned it the last time I built clojure

13:47 jochu: jbondeson: I noticed that with swank-clojure as well - it makes it noisy and angry sometimes. (dorun ..) uses it in an: (or (first coll) true) so it's not broken per se.

13:47 jbondeson: And since I figured the asserts were just a tool to help convert to lazy-seqs, which is only done once, I just turned it off let it go.

13:54 jbondeson: jochu: yeah, i guess, but i still think the dorun form shouldn't do that.

13:54 jochu: oh, yeah and thank you for fixing swank-clojure debugging those infinite loops was driving me batty last week.

13:54 Chouser: jbondeson: I think you're right.

14:05 jochu: jbondeson: Heh, it was driving me nuts too. Well - if you're using swank-clojure with asserts on, sorry about the dorun stuff. If I remember right, they're pretty debilitating.

14:07 Chouser: jbondeson: I think you should bring up dorun and your example on the google group.

14:08 jochu: Chouser: I think I saw one on there before, let me see if I can find it

14:09 Chouser: http://groups.google.com/group/clojure/browse_thread/thread/f0248e837b9d27a/5a84e5e6a1eaf9f4

14:09 Chouser: ah, indeed.

14:10 rhickey: did you see that one? I think I missed it somehow.

14:10 jbondeson's example failure is useful too: (doall (list (lazy-seq nil)))

14:12 Lau_of_DK: Chouser: What happend with Textjure ?

14:12 Chouser: Lau_of_DK: I got distracted?

14:13 jbondeson: PPADD: Programming Project Attention Deficit Disorder

14:15 danlarkin: I have that

14:21 clojurebot: svn rev 1301; removed dorun calls to first

14:21 Chouser: The spirit of rhickey is with us.

14:21 AWizzArd: can I change the metadata of a function?

14:22 Chouser: AWizzArd: no

14:22 AWizzArd: you can change the metadata of a Var, though, which is what's normally done.

14:22 but I suspect you know that

14:23 AWizzArd: can you give a short example?

14:23 Chouser: sure

14:23 jochu: Yay, that was quick

14:25 hiredman: someone should fix ring for lazy

14:26 danlarkin: hiredman: ring has been working for me

14:26 although I'm really only using the jetty interface

14:27 hiredman: hmmm

14:27 maybe it is just an old contrib

14:27 I hate that it comes with it's own contrib and clojure

14:29 tomsw: why can't I use javax.swing.filechooser.FileNameExtensionFilter? "(import '(javax.swing.filechooser.FileNameExtensionFilter))" followed by "FileNameExtensionFilter" gives me a "no source file" exception. I don't have problems using other swing classes...

14:29 hiredman: you are not using import correctly

14:29 Hun: the last . shouldn't be there

14:29 hiredman: (import '(javax.swing.filechooser FileNameExtensionFilter))

14:30 tomsw: doh!

14:30 danlarkin: hiredman: yeah that's the wrong way to do things in my opinion (packaging dependencies). I don't like that it seems like a trend

14:31 hiredman: :(

14:31 I keep getting:

14:31 java.lang.Exception: Unable to resolve symbol: lazy-cons in this context (core_utils.clj:33)

14:32 which makes sense because lazy-cons is gone

14:32 just cannot figure out where core_utils.clj is

14:35 technomancy: danlarkin: well until an automated way to specify and fetch dependencies becomes widespread, it's going to continue.

14:35 danlarkin: I agree that it's bad for libraries. for applications I think it's better than the alternative.

14:39 drewr: Have any of you experienced a JVM issue where it hangs on FUTEX_WAIT after -main runs?

14:40 Chouser: drewr: did you use 'future' or agents?

14:40 drewr: I have a logging agent.

14:41 Am I supposed to do something to him when I'm done?

14:41 Chouser: shutdown-agents

14:41 hiredman: ugh

14:43 drewr: Ah, excellent.

14:43 So a System/exit will block if there are threads somewhere?

14:44 AWizzArd: Chouser: btw, maybe I misunderstood it, but I thought you have a little example ready, where one changes the metadata of a Var :)

14:45 Chouser: No, I think System/exit will quit. But just returning from 'main' waits for thread pools to shut down.

14:46 AWizzArd: oh, I misread your question.

14:46 drewr: Chouser: I'm calling System/exit as the last expression in -main.

14:46 I'll see if shutdown-agents helps though.

14:47 hiredman: ah

14:47 lazy-cons in clj-html

14:48 Chouser: ,(alter-meta! #'take assoc :add-some :meta)

14:48 clojurebot: {:add-some :meta, :ns #<Namespace clojure.core>, :name take, :file "core.clj", :line 1531, :arglists ([n coll]), :doc "Returns a lazy sequence of the first n items in coll, or all items if\n there are fewer than n."}

14:48 Chouser: AWizzArd: ^^^

14:49 that's probably not recommended for other namespace's vars, though.

14:49 ,(:add-some ^#'clojure.core/take)

14:49 clojurebot: :meta

14:50 drewr: ...and it didn't.

14:50 Chouser: drewr: hm... do you have a thread blocking on something?

14:50 AWizzArd: Chouser: thanks

14:51 hiredman: ok, what other html generating libs are there besides clj-html?

14:51 drewr: Chouser: I don't think so, but I'm probably not looking at every possibility.

14:52 Everything I'm doing is wrapped in macros that release resources and close database connections.

14:53 I'm using pmap, so maybe I've retained a head somewhere that would keep its threads?

14:53 Just guessing.

14:53 Chouser: drewr: well, you're beyond my experience. Let us know when you figure it out.

14:53 :-)

14:53 drewr: Yay!

15:12 tomsw: how do I deal with Java constructors that take a variable number of arguments? For example, (javax.swing.filechooser.FileNameExtensionFilter. (String. "Test") (String. "exe")) returns "java.lang.String cannot be cast to [Ljava.lang.String"

15:13 Chouser: tomsw: they expect an array instead of the variable part of the args

15:14 (,(javax.swing.filechooser.FileNameExtensionFilter. "Test" (into-array ["exe"]))

15:14 ,(javax.swing.filechooser.FileNameExtensionFilter. "Test" (into-array ["exe"]))

15:14 clojurebot: #<FileNameExtensionFilter javax.swing.filechooser.FileNameExtensionFilter@13b792[description=Test extensions=[exe]]>

15:15 tomsw: Chouser: thanks. I had a feeling (apply FileNameExtensionFilter. ["a" "b" "c"]) wouldn't work...

15:15 Chouser: :-) nope.

15:16 drewr: OK, I had (flush) (shutdown-agents). Reversing those makes exit work.

15:16 hiredman: hmmm

15:17 cp2: hi guys

15:18 tomsw: also, its not all important, but you do not need to create a new String object if you are using literals

15:18 Chouser: drewr: wow

15:18 cp2: eg, (String. "abc") is stll "abc"

15:18 except "abc" is automatically interned (i think)

15:18 Chouser: cp2: right

15:18 cp2: so if anything, (String. "literal") is more expensive

15:19 hiredman: ,(identical? (String. "abc") "abc")

15:19 clojurebot: false

15:19 AWizzArd: is there something similar to resolve which does not return a Var but instead the function object of a symbol? (get-function '+) ==> #<core$_PLUS___3251 clojure.core$_PLUS___3251@c9537b>

15:19 Chouser: ,(identical? "abc" "abc")

15:19 clojurebot: true

15:19 Chouser: ,@(resolve '+)

15:19 clojurebot: #<core$_PLUS___3251 clojure.core$_PLUS___3251@63b660>

15:19 AWizzArd: good

15:38 gnuvince: Anybody knows what Mark Volkman's deal is?

15:38 WizardofWestmarc: syntax thread?

15:39 gnuvince: Any thread really.

15:39 hiredman: I have wondered that myself

15:40 WizardofWestmarc: ...

15:40 * WizardofWestmarc just saw his new thread.

15:41 danlarkin: he's an interesting fellow

15:41 gnuvince: I don't know how long he's been around, I would estimate 3-4 months, kind of like me, but he always seems to have questions that are answered in the documentation or these weird propositions that would take Clojure to a place I'd rather not see it go.

15:42 hiredman: he has an article or two in a few java trade magazines

15:42 gnuvince: that is my feeling as well

15:42 about, uh, ANTLR I think they were

15:42 danlarkin: if you have nothing nice to say then you shouldn't say anything at all!

15:43 gnuvince: danlarkin: I'm not bashing him or anything, I just find him peculiar

15:43 hiredman: (obviously, I googled the guy and the company mentioned at the bottom of his posts)

15:46 stuhood: does clojure have the equivalent of a switch statement?

15:46 i know about cond, but it requires a bit of repetition to do (= value cond1) (= value cond2)

15:46 danlarkin: stuhood: condp

15:47 (doc condp)

15:47 clojurebot: Takes a binary predicate, an expression, and a set of clauses. Each clause can take the form of either: test-expr result-expr test-expr :>> result-fn Note :>> is an ordinary keyword. For each clause, (pred test-expr expr) is evaluated. If it returns logical true, the clause is a match. If a binary clause matches, the result-expr is returned, if a ternary clause matches, its result-fn, which must be a unary function, is ca

15:47 gnuvince: ,(resolve 'condp)

15:47 clojurebot: #'clojure.core/condp

15:47 hiredman: ,(condp = :x :x :a :y :b)

15:47 clojurebot: :a

15:47 gnuvince: built-in?

15:47 hiredman: yep

15:47 gnuvince: Is that new?

15:47 stuhood: awesome, thanks guys

15:48 hiredman: not too new

15:48 stuhood: new enough to not be in the online docs, heh

15:48 hiredman: 21st of Dec new

15:49 svn rev 1180

15:49 clojurebot: come on, are you kidding?

15:49 clojurebot: Titim gan �ir� ort.

15:49 hiredman: svn rev 1300

15:49 clojurebot: svn rev 1300; lazy-seq perf tweaks

15:50 hiredman: "I don't think we should pander to the

15:50 masses"

15:50 *sigh*

15:51 WizardofWestmarc: hiredman: ?

15:51 hiredman: http://twitter.com/technomancy/statuses/1241615252

15:51 WizardofWestmarc: from a post to the google group

15:52 WizardofWestmarc: haha

15:52 it's so true

15:52 I remember those discussions on C.L.L. when I still followed it regularly

15:54 stuhood: i remember hickey praising python for its syntactic simplicity, but i guess a lisp is a lisp

15:54 WizardofWestmarc: nod

15:55 I found it interesting when GvR mentioned he was looking at clojure

15:56 gnuvince: WizardofWestmarc: he did?

15:56 danlarkin: on twitter

15:57 gnuvince: ok

15:57 WizardofWestmarc: yeah, one sec I'll find the tweet

15:57 gnuvince: I found it ;)

15:57 http://twitter.com/gvanrossum/status/1228991275

15:57 danlarkin: heh, there's not really much to see...

15:57 hiredman: you know in red china, the chairman of the party (mao) used to create all these grandiose plans and ideas that where "ideologically pure" rice crops failed and people lied about shortages etc etc, then he died and there was a power struggle, and some dude whose name I cannot recall became chairman and said "hey, true from facts" and now china is a power house in the global economy

15:58 WizardofWestmarc: danlarkin: true, but it's still interesting

15:58 especially since he's at google

15:58 danlarkin: yeah for sure

15:58 WizardofWestmarc: and I know Norvig already knows about it since Rich sent him a spelling program for that one language shootout of his.

15:59 danlarkin: I work in python all day long at work, it's a great language and I have loads of respect for guido, maybe he'll have some constructive input :)

15:59 WizardofWestmarc: yeah Python was probably my first "love" language

15:59 and I'm jealous you get to use it for work.

15:59 gnuvince: Python is nice, but it's Guido who could learn from Rich IMO :)

16:00 leafw: WizardofWestmarc: do you have a link for Norvig's page?

16:01 WizardofWestmarc: norvig.com is just too many links

16:01 zakwilson: I think Python makes it hard to write confusing code, which I believe was a goal for Java.

16:01 WizardofWestmarc: leafw: one sec

16:01 gnuvince: leafw: http://www.norvig.com/spell-correct.html

16:01 table at the bottom

16:01 (Link is dead though)

16:01 * technomancy hopes this "alternate syntax" thread will just die

16:01 gnuvince: technomancy: so say we all

16:02 leafw: thank you.

16:02 * WizardofWestmarc shakes his fist at gnuvince for being faster.

16:02 hiredman: doesn't look like it will

16:02 WizardofWestmarc: it never will

16:02 Hun: it didn't for 50 years

16:02 WizardofWestmarc: C.L.L. has so much proof of that fact...

16:02 gnuvince: Well, as long as people keep killing them :)

16:02 technomancy: nothing against people experimenting with things they find interesting, it's the "we should use this to promote clojure" angle that bothers me

16:02 hiredman: everyone needs their 2� in

16:02 jbondeson: quick someone alter the parser to inverse the use of []/()

16:03 gnuvince: To me, it would create two classes of Clojure programmers: sexp guys and mexp guys.

16:03 fogus: Why is it that no one ever suggests a Java syntax with less parens?

16:03 gnuvince: Kind of like C# and VB.NET in the .NET world

16:03 fogus: because curly braces are good

16:03 ending a class with 12 closing brackets is a sign of a serious program

16:03 hiredman: fogus: because their are so many stake-holders in java it is almost impossible to get everyone on board

16:04 WizardofWestmarc: if I can't have my ((())))))(()()()))() I'd rather have meaningful whitespace, personally

16:04 gnuvince: ending a Lisp function with 12 parens is a "toy"

16:04 zakwilson: Alternate syntax comes up all the time in Lisp communities. It always creates a long thread, sometimes somebody implements it. Hardly anybody actually cares.

16:04 leafw: hum, the clojure spelling corrector would be so much more readable spread over at least twice as many lines

16:04 fogus: gnuvince: Well, curly brace certainly rolls off the toungue

16:04 jbondeson: or better yet, i'm make Clojure sharp and just replace all the parens with {} that way C and Java programmers will feel at home

16:04 Hun: WizardofWestmarc: saw a cool emacs-mode for that recently

16:04 hiredman: ,(pl inc $ inc $ 0)

16:04 clojurebot: 2

16:04 jbondeson: {let [a b] {do {some stuff} }}

16:04 gnuvince: jbondeson: heheh :)

16:04 Chouser: Something has interfered with lisp being more popular than it is.

16:05 WizardofWestmarc: One part of it, IMO, is the mystical "it's an AI language" thing

16:05 Chouser: I think Clojure has found a couple of these and fixed them

16:05 WizardofWestmarc: some reason that idea gets in peoples heads and they think "oh I don't need that"

16:05 gnuvince: Chouser: I doubt it's the parentheses. People *think* it is, but it's the "I'm my own world" philosophy that also killed Smalltalk.

16:05 hiredman: ,(pl (map inc � first [[1 2] [3 4]]))

16:05 clojurebot: (2 4)

16:05 fogus: Turning a parser from recognizing (foo 1 2 3) to f(1 2 3) is a piece of cake. Would that really solve the problem?

16:06 Hun: WizardofWestmarc: http://www.foldr.org/~michaelw/emacs/

16:06 look at mwe-color-box

16:06 Chouser: "programs writing programs" always threw me -- sound like not just AI but *hard* AI.

16:06 hiredman: ,(pl (?map range $ 3 inc))

16:06 clojurebot: (1 2 3)

16:06 gnuvince: I say that if people can use C++'s and Perl's syntax, there's no reason why they should fear Clojure's and Lisp's in general.

16:06 Chouser: gnuvince: excellent point

16:07 WizardofWestmarc: Hun: oh, color box, I think I've heard of this

16:07 gnuvince: thing is a lot of people first learned on C like language syntax

16:07 Hun: program writing programs are pretty usual stuff. people do it all the time, maybe without realizing it

16:07 Chouser: calling perl's syntax "c-like" is a bit of a stretch.

16:08 gnuvince: WizardofWestmarc: your brain doesn't shut down after you learn C

16:08 WizardofWestmarc: Chouser: ok true

16:08 Hun: Chouser: but but but... it has {} and ;!

16:08 gnuvince: (well, hopefully not)

16:08 WizardofWestmarc: gnuvince: Mine doesn't, no

16:08 but a lot of people don't seem to want to learn new types of syntax

16:08 gnuvince: Except if it's XML

16:08 or JSON

16:08 Hun: or YAML

16:08 WizardofWestmarc: XML isn't a language to them, it's data payload

16:08 sily I know

16:09 gnuvince: I'm preaching to the choir here

16:09 WizardofWestmarc: but *shrug*

16:09 gnuvince: Let me join ##c and explain to them why they should use sexp!

16:09 Hun: gnuvince: wrong channel for this flamewar :)

16:09 WizardofWestmarc: a lot of programmers don't actually give a damn about expanding their programming skills.

16:09 fogus: WizardofWestmarc: sad but true

16:09 hiredman: I think that is fine

16:09 It's a Living

16:10 WizardofWestmarc: If they're good enough they don't make my job harder maybe ;-)

16:10 Chouser: sure, but there's another set -- those who say "I want to learn one of these 'new' languages -- I hear about ruby, python, haskell, clojure. They're all so new and confusing. Which should I learn?"

16:10 hiredman: yeah, but that is true in every field

16:11 Chouser: a mess of parens and talk of AI may be all it takes for them to go after python instead

16:11 WizardofWestmarc: True hiredman.

16:11 doesn't mean I want to deal with them ;-)

16:11 gnuvince: I think it's sad that people don't want to improve the craft they spend their days executing

16:11 It might just be that we're insane

16:11 hiredman: I know, I just get this attitude from programers that programming is so great art that everyone should learn

16:12 WizardofWestmarc: oh I don't think THAT

16:12 I just think if you're going to do it you should be serious about it

16:12 well if you're going to do it as more then a hobby

16:12 gnuvince: I don't either, but I couldn't understand why a car salesman would not want to flip through a car magazine to learn about new models, technologies, trends, etc.

16:13 hiredman: gnuvince: I am sure many do not

16:14 WizardofWestmarc: and many car salesmen suck and I wouldn't want them to be the ones pitching cars to me either.

16:14 hiredman: I work at a painting company, I don't know shit about painting, or care to, really

16:15 sometimes a job is just a job

16:18 zakwilson: It's sad when a job is just a job. I feel sorry for anyone in that situation.

16:20 shoover: Chouser: don't forget the money quote from indyaltnet: "With or without competition, Lisps isn't going to take off."

16:21 hiredman: #%@#$%

16:21 bastards

16:21 gnuvince: My current job is so boring and annoying that I've decided that it's time to go to university. At least there was a nice by-product of having a bad job.

16:22 WizardofWestmarc: gnuvince: hah, for anything in particular or dunno yet?

16:22 hiredman: I need to do that

16:24 gnuvince: WizardofWestmarc: I live in Quebec where there two types of establishment who give "superior educations": colleges (which we call cegeps) and universities. I graduated from a college about 5 years ago in the computer program (can't call it computer science). I'm gonna go into computer science and hopefully open doors to more interesting jobs. When I hear Rich talk about what he does, my jaw drops cause I think it must be really

16:24 shoover: hiredman: sorry, didn't mean to ruin your day with the negativism. It was said as a joke, I think, from historical observation, except that historically there is competition

16:25 WizardofWestmarc: gnuvince: yar I know how that is

16:25 I've been considering looking at getting a math bachelors to go with my CS as what math skills I _DID_ have have attrophied with doing all CRUD apps for the entirety of my professional career

16:26 hiredman: shoover: nah, don't worry about it :P

16:26 gnuvince: I'm doing my pre-req math classes, calculus 1. It's pretty hard by correspondance with no teacher however :-/

16:26 hiredman: I was joking as well

16:26 shoover: hiredman: whew

16:26 fogus: I'm considering attending one of those wizard schools. ;)

16:26 WizardofWestmarc: I hated calculus

16:27 actually found a textbook for linear algebra + workbook w/answers online that I grabbed to work my way through

16:27 danlarkin: oh please let's not talk about calculus :(

16:27 hiredman: I have to rember to use my sarcasm marker ?

16:28 jbondeson: i loooved my math courses.

16:28 course i've never used a line integral outside of pysics =/

16:28 +h

16:28 WizardofWestmarc: heh yeah

16:29 hiredman: my last math course, the instructor had no record of me taking the final, so he failed me, and I didn't notice until six months later when I tried to take another math course

16:29 jbondeson: hiredman: yowch

16:29 hiredman: because I figured I must have passed, because I just sort of sailed through the class

16:30 it was a bit of a set back, I haven't been back in a classroom for about a year now

16:33 Bracki: How should public static final Strings be defined in clojure? As *STATIC_STRING* ?

16:33 technomancy: what does that even mean?

16:33 hiredman: (def a "string")

16:33 jbondeson: ^^^

16:33 hiredman: *name* is for stuff that maybe rebound with binding

16:33 Bracki: Nah, what I meant is, is there any convention on the names?

16:34 technomancy: lower case, dash separated words

16:34 WizardofWestmarc: if you really want it to stand out, just use the earmuffs

16:34 other then that, eh

16:34 Bracki: earmuffs?

16:34 technomancy: WizardofWestmarc: that doesn't mean "this should stand out", it means "this will change".

16:34 WizardofWestmarc: *avar*

16:34 eh?

16:34 I thought ** were non-changing

16:35 hm

16:35 jbondeson: usually they're refs

16:35 technomancy: WizardofWestmarc: you're thinking of markdown where *foo* means bold. =)

16:35 hiredman: like *out*

16:35 it means stuff that maybe rebound in a the context of a thread

16:35 technomancy: jbondeson: I don't use that for refs; I think using @ to deref is enough of a visual cue

16:40 Chouser: This keeps coming up, which surprises me. Most things in Clojure code are constant, so putting ++ around them or something would mean you'd have to do that for almost every symbol.

16:43 technomancy: sounds like a FAQ entry. =)

16:44 maybe we could put "hey guys I haven't used lisp that much, but I have this great idea about how it could be more popular by getting rid of parens [...]" on the FAQ too.

16:45 jbondeson: there's this bar i frequent here in dever that has a great entry under side items called "Stupid Questions: $0.94", and then a FAQ that says "Yes we really do charge for stupid questions."

16:45 hiredman: clojurebot: FAQ?

16:45 clojurebot: FAQ #1 is http://groups.google.com/group/clojure/msg/8fc6f0e9a5800e4b

16:45 WizardofWestmarc: ...jbondeson: Which bar?

16:45 jbondeson: Falling Rock

16:45 WizardofWestmarc: hah

16:46 Bracki: How can I zeropad numbers in clojure? (test-is "001" (zeropad 1))?

16:46 WizardofWestmarc: that's downtown yes?

16:46 hiredman: FAQ #2 is def is for constants

16:46 Chouser: FAQ #1 is out of date

16:46 Bracki: ,(doc test-is)

16:46 clojurebot: java.lang.Exception: Unable to resolve var: test-is in this context

16:46 hiredman: ~FAQ #2 is def is for constants

16:46 clojurebot: c'est bon!

16:46 hiredman: Chouser: care to update?

16:46 jbondeson: WizardofWestmarc: Blake between 19th and 20th

16:46 Chouser: ,(format "%03" 1)

16:46 clojurebot: java.util.UnknownFormatConversionException: Conversion = '0'

16:47 * Chouser sighs

16:47 Chouser: ,(format "%03d" 1)

16:47 clojurebot: "001"

16:47 Chouser: hiredman: I mean, it's gone. The problem no longer exists.

16:47 ,(count (.getMethods Integer))

16:47 clojurebot: 41

16:47 hiredman: ~FAQ #1 is a solved problem

16:47 clojurebot: Roger.

16:54 triddell: Does anyone know where clojure-contrib stands in terms of the recent clojure lazy changes? When I tried to compile contrib to class files I got some errors.

16:54 technomancy: triddell: the most popular libraries have been updated

16:55 there may be some stragglers

16:56 triddell: technomancy: ok, thanks... I'll just try the jar file and see if it works... I think I'm only using the file io stuff on this project.

16:56 AWizzArd: triddell: only yesterday I did run ant on a recent clojure-contrib, and it worked without problems

16:56 jochu also updated clojure-swank, which now also works again. Thx :)

16:57 technomancy: triddell: you don't even have to compile at all; you can just put "[...]clojure-contrib/src/" on your classpath

16:57 triddell: AWizzArd: saw that, that's one reason I wanted to move my stuff today.

16:57 AWizzArd: did you do something like this: ant -Dclojure.jar=../clojure/clojure.jar

16:58 AWizzArd: no

16:58 triddell: otherwise I think it's just jarring the source

16:58 AWizzArd: I did: svn checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure-contrib then cd clojure-contrib then ant

16:58 triddell: I was trying to get the compiled class files

16:59 just to speed things up a bit

16:59 AWizzArd: it produced a clojure-contrib.jar and there was also a dir classes in which the .class files were stored.

16:59 But I don't need/want the .class files when I have the clojure-contrib.jar file.

17:01 triddell: AWizzArd: previously, using the method I noted, the class files would be in the jar file which would save the compilation at runtime (I belive)

17:02 danlarkin: triddell: Ahead-of-Time compiling doesn't speed up code execution, just loading time (slightly)

17:02 Bracki: Do bindings work "globally"?

17:02 danlarkin: Bracki: that question doesn't really make sense

17:03 hiredman: ~javadoc String

17:03 :)

17:03 triddell: danlarkin: ok, thx... I knew there was a reason I wanted to qualify that statement with "I believe" :-)

17:03 technomancy: Bracki: bindings have absolute effect inwardly. but they don't change anything outside the call to bindings.

17:04 Vargr_: In ring, how do I restart jetty, or better yet, how can I reload a function without jetty restarting? I called ring.jetty/run from a REPL, server runs, but someone seems to have forgotten a stop function or at least a ref to the server instance :)

17:05 hiredman: ~jdoc java.util.Collection

17:05 Bracki: technomancy: OK regarding mire, you couldn't have moved the *name* binding to another function, right?

17:05 That is have (read-name) handled as part of (execute input).

17:05 technomancy: Bracki: that's right; it needs to wrap everything that needs that value of *name*

17:07 wow, wikipedia is surprisingly unhelpful on the topic of dynamic binding.

17:09 WizardofWestmarc: aww, simple.wikipedia.org doesn't have a s page for Dynamic Binding

17:09 * WizardofWestmarc has started looking there first for Wiki entries.

17:09 durka42: you mean, in that it has almost no content and a trivial morbid example

17:10 technomancy: durka42: it's not even about FP dynamic binding. it's about some silly OOP notion.

17:13 hiredman: clojurebot: Object Computing, Inc is <reply>see Subject Computer, Inc

17:13 clojurebot: You don't have to tell me twice.

17:13 hiredman: clojurebot: Object Computing, Inc is <reply>see Subject Computing, Inc

17:13 clojurebot: Ack. Ack.

17:16 AWizzArd: clojurebot: Object Computing, Inc?

17:16 clojurebot: see Subject Computing, Inc

17:19 durka42: ~google subject computing inc

17:19 clojurebot: First, out of 20500000 results is:

17:19 Mallorn Computing Copyright Notice

17:19 http://www.mallorn.com/legal/copyright.html

17:20 durka42: http://www.google.com/search?q=subject+computing+inc&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a

17:20 hiredman: ha ha, Nice.

17:20 "did you mean object computing?"

17:23 ~jdoc org.apache.struts.action.RequestProcessor

17:24 ~jdoc clojure.lang.IFn

17:24 too bad

17:42 stuhood: i really love laziness =)

17:42 technomancy: I'll love laziness when I need to.

17:43 gnuvince_: hahahah

17:43 Chouser: ha!

17:43 stuhood: hehe

17:50 is there shorthand for making a list that still executes the body?

17:51 i was using '(:blah (map...)) to create a list, but the map wasn't actually being executed

17:51 technomancy: stuhood: you can wrap it in a dorun iirc

17:51 jbondeson: ^^^

17:52 stuhood: hm. thats not short =)

17:52 technomancy: stuhood: but the question is why you want to control when it executes

17:52 Chouser: stuhood: you're sure you need a list and not a vector?

17:52 technomancy: that seems like the wrong thing to want. if you have side-effects in the function you're mapping with, you shouldn't be using map

17:52 stuhood: i basically want the equivalent of (list :blah (map ...))

17:52 hiredman: eh?

17:52 stuhood: Chouser: because i have a hunch that vectors are slower

17:52 jonafan: hello i am a fool for not learning clojure yet. I've been trying to get an old OOP program i've written to have fine grained locking and i've determined that it's basically impossible to do anything but a global lock. that is all

17:53 stuhood: i'm creating a tuple!

17:53 Chouser: stuhood: [:blah (map ...)] may just do what you want.

17:53 technomancy: stuhood: so why do you care about execution time?

17:53 err--about when it executes

17:53 Chouser: stuhood: otherwise (list :blah (map ...)) or `(:blah ~(map ...))

17:54 stuhood: because it will never be executed unless a callee unescapes the map

17:55 technomancy: stuhood: oh yeah; I see. right; list is what you want

17:55 Chouser: stuhood: don't optimize prematurely.

17:55 stuhood: Chouser: yea, you're right... the vector is the clearest

17:56 hickey probably has optimizations for small vectors

17:56 Chouser: stuhood: if the speed difference between vector and list actually matters for you application, you'll want to profile to be sure.

17:56 technomancy: could use cons as well if you're trying to emphasize the fact that they're pairs

17:57 stuhood: heh... i'm sure it doesn't... just a bit of OCD

17:57 Chouser: stuhood: it's ok. but be OCD about program clarity. :-)

17:57 technomancy: your future self will thank you.

17:57 stuhood: Chouser: indeed =)

18:02 tomsw`: what's the best / correct way to map a function across a collection for immediate side-effects - like mapc?

18:02 technomancy: tomsw`: use doseq

18:02 shoover: jonafan: have you _still_ not learned clojure after realizing this?

18:03 jonafan: yep, my fault

18:03 shoover: get busy!

18:03 jonafan: how do mutable java classes/controls/etc work in clojure?

18:04 hiredman: java is java

18:04 jonafan: are they like agents?

18:04 stuhood: jonafan: they do exactly what they would if you modified them in java

18:05 jonafan: so potential for race conditions is still high

18:05 technomancy: jonafan: you can wrap them in clojure collections that guarantee immutability

18:05 jonafan: ah

18:06 hiredman: mostly you just use clojure and touch java only when you need it

18:06 tomsw`: is there anyway to use doseq inside doto, so as to ,er, do a collection of things to the victim?

18:06 Or do you have to use a let?

18:06 hiredman: uh

18:07 reduce

18:07 technomancy: tomsw`: doseq isn't *quite* like map

18:07 hiredman: ,(reduce #(do (%2 %1) %1) thing [function1 funciton2])

18:07 clojurebot: java.lang.Exception: Unable to resolve symbol: thing in this context

18:07 technomancy: it binds for you

18:08 tomsw`: (doto (new Obj) (.method1 "arg1") (doseq #(.method2 %) coll)) -- that method2 isn't going to work

18:08 hiredman: uh

18:08 No.

18:08 No No

18:08 technomancy: ~(doc doseq)

18:08 clojurebot: Pardon?

18:08 hiredman: (doc doseq)

18:08 clojurebot: Repeatedly executes body (presumably for side-effects) with bindings and filtering as provided by "for". Does not retain the head of the sequence. Returns nil.; arglists ([seq-exprs & body])

18:09 technomancy: ~(doseq [x [1 2]] (println x))

18:09 clojurebot: Pardon?

18:09 technomancy: ,(doseq [x [1 2]] (println x))

18:09 clojurebot: 1 2

18:09 technomancy: tomsw`: make it look like that

18:16 tomsw`: I'll change the question (thanks for correcting my doseq): to repeatedly call a method on an object over the values of a collection, doto is nogo?

18:19 technomancy: looks like it

18:19 there may be a way, but it isn't obvious

18:21 tomsw`: I was only asking because of the vague similarities with "with" in various languages, that lets you call lots of methods on the same object - in a loop if you want

18:22 you can probably guess I'm making a real pig's arse of GUIs in clojure...

18:23 durka42: when trying to compile c.c.lazy-seqs: java.lang.VerifyError: Cannot inherit from final class

18:26 stuhood: working back and forth between java and clojure makes me wish for so many changes in java

18:26 want a List literal? Arrays.asList(new String[]{"hello", "world"})

18:26 uggh.

18:26 technomancy: wow

18:27 Raynes: What is this new clojure-sources.jar for?

18:28 technomancy: have there been any recent attempts to use terracotta w/ clojure?

18:32 Raynes: rhickey: What is this new clojure-sources.jar for?

18:36 stuhood: Raynes: I believe it has to do with CI: http://groups.google.com/group/clojure/browse_thread/thread/5f5f63bb0ac6dbd/9316e4e13aab2caf?hl=en&lnk=gst&q=tapestry#9316e4e13aab2caf

18:37 Raynes: Oh. Thanks.

19:37 hiredman: ~def ensure

19:40 technomancy: hah; best comment on the removing parens thread: "Wait; hang on--those are load-bearing parentheses!"

19:42 stuhood: lol

19:46 clojurebot: svn rev 1302; mod fix [issue 23], patch from timothypratley

19:54 slashus2: hiredman: Should I use ensure inside of a transaction to look at a ref value?

19:56 clojurebot: svn rev 1303; unwrap InvocationTargetException's around Errors in reflective calls [issue 44]

19:58 rhickey: slashus2: you only need to use ensure if a) you are not changing that ref, and b) you are making a decision that would be invalid if the ref were changed by another transaction

19:59 slashus2: rhickey: Okay, thank you.

20:01 durka42: do we know why building contrib dies with a VerifyError (in lazy-seqs) with svn head?

20:01 hiredman: durka42: I build it earlier today and it did not die

20:02 durka42: hmm, that's interesting

20:02 * hiredman tries again

20:02 hiredman: BUILD SUCCESSFUL

20:02 Total time: 2 seconds

20:03 durka42: but did you give -Dclojure.jar=/path/to/clojure.jar to have it actually build the class files?

20:04 hiredman: nope

20:04 <-- contrib rookie

20:04 durka42: ,(use 'clojure.contrib.lazy-seqs)

20:04 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/lazy_seqs__init.class or clojure/contrib/lazy_seqs.clj on classpath:

20:04 durka42: well, anyway try that and the VerifyError comes up

20:05 hiredman: still didn't

20:05 but I may be doing it wrong

20:05 durka42: all right a clean build worked

20:05 strange

20:07 jbondeson: i blame the gremlins.

20:10 durka42: re: gremlins http://my.safaribooksonline.com/1565925254/ch10-21965

20:12 jbondeson: gotta love the "smash your face on the keyboard" testers...

20:24 AWizzArd: Is there a function that can be used instead of (first (filter ...))?

20:24 similar to CLs find-if

20:26 clojurebot: max people

20:26 clojurebot: max people is 149

20:28 hiredman: AWizzArd: does that seem reasonable to you?

20:28 Chouser: (some #(when (f %) %) coll)

20:28 durka42: with lazy seqs (first (filter ...)) doesn't actually do any extra work

20:28 Chouser: (first (filter f coll))

20:29 durka42: ,(let [li (lazy-cat [1 2 3 (lazy-seq (prn "hi"))])] (first (filter #(= 3 %) li)))

20:29 clojurebot: java.lang.NoClassDefFoundError: clojure/core$lazy_cat__4398$fn__4400

20:29 hiredman: huh

20:29 durka42: clojurebot: you are not lazy enough. please refrain from doing work

20:29 clojurebot: lazy is hard

20:29 durka42: user=> ,(let [li (lazy-cat [1 2 3 (lazy-seq (prn "hi"))])] (first (filter #(= 3 %) li)))

20:29 3

20:31 wait, why doesn't this work

20:31 lisppaste8: durka42 pasted "lazy" at http://paste.lisp.org/display/76054

20:33 durka42: i would expect that to print out "hi"

20:33 AWizzArd: ,(doc drop-while)

20:33 hiredman: durka42: it makes a nested list

20:33 which doesn't = 5

20:34 durka42: oh

20:34 how are you supposed to use lazy-seq

20:36 AWizzArd: rhickey: is it intended in the doc for drop-while to mention only nil? It could for example also read: "... for which (pred item) returns nil or false."

20:36 Chouser: ,(first (filter #(= 3 %) (lazy-cat [1 2 3] (lazy-seq (prn "hi")))))

20:37 AWizzArd: bot is still offline

20:37 Chouser: oh, clojurebot's gone. Anyway, that doesn't print "hi", but get rid of 'first' and it will

20:37 durka42: cool

20:37 Chouser: lazy-cat doesn't buy you anything over concat there, I think.

20:38 durka42: it needs lazy-cat or lazy-seq, but not both

20:39 hiredman: ,(first (filter #(= 3 %) (lazy-cat [1 2 3] (lazy-seq (prn "hi")))))

20:39 clojurebot: 3

20:39 durka42: ,(first (filter #(= 3 %) (lazy-cat [1 2 3] (prn "hi"))))

20:39 clojurebot: 3

20:39 durka42: ,(first (filter #(= 3 %) (concat [1 2 3] (lazy-seq (prn "hi")))))

20:39 clojurebot: 3

20:40 hiredman: ,(doc lazy-cat)

20:40 clojurebot: "([& colls]); Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluated until it is needed. (lazy-cat xs ys zs) === (concat (lazy-seq xs) (lazy-seq ys) (lazy-seq zs))"

20:40 hiredman: ,(doc concat)

20:40 clojurebot: "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls."

20:41 hiredman: ah

20:41 I see

20:43 lisppaste8: xitam pasted "fumbling with state" at http://paste.lisp.org/display/76057

20:44 AWizzArd: maybe concat is now what lazy-cat was in the past?

20:44 xitam: would someone be kind enough to look at this and give me a hint? pretty sure i'm just being an idiot somehow :)

20:56 hiredman: ~jdoc Float

21:05 Chouser: xitam: I'm having a hard time picking out desired behavior from undesired

21:05 xitam: can you trim down your example a bit?

21:06 xitam: Chouser: yeah, i'll work on it. it's supposed to be adding the generated nodes to both maps together in the function add-to-open, so i dont see how they come out different sizes

21:08 cmvkk: If I want to use proxy to extend java.io.InputStream, which requires implementing the method 'write' which takes no arguments and returns the next byte

21:08 for example, if i wanted to use a lazy seq to do that...is it possible to do that without using some sort of mutation?

21:09 i'm not sure how to do it, short of using an atom or something

21:10 hiredman: uh

21:10 ~jdoc java.io.InputStream

21:10 yeah

21:11 InputStream doesn't have a write method

21:11 cmvkk: heh

21:11 i meant 'read'

21:11 :/

21:11 hiredman: yeah, you will need to use an atom or a ref

21:12 cmvkk: thanks, that's what i thought.

21:12 hiredman: Chouser: contrib should have a method that returns an InputStream backed by a seq

21:13 er

21:13 function

21:15 Chouser: a seq of Characters?

21:15 hiredman: ugh

21:15 nm

21:15 yeah

21:15 that is right, java it's types

21:15 ugh

21:18 walters: i thought it was for the inputstream use case that the streams work came about? it's not a seq since it's stateful

21:19 xitam: unfortunately, i'm trying to come up with a simplified example and everything works exactly as expected

21:20 walters: oh wait nevermind, reverse of what i thought, InputStream *from* a seq

21:20 hiredman: walters: I think streams are shelved, and scopes are going to be used for resource management

21:22 walters: are seqs still referentially transparent?

21:24 Chouser: walters: yes

21:25 hiredman: ~scope

21:25 clojurebot: itym horizon

21:33 gnuvince_: clojurebot: scope is at http://paste.lisp.org/display/73838

21:33 clojurebot: Ok.

21:49 Chouser: xitam: I think it's the dissoc, but i'm not sure why yet.

21:53 hm, nope

21:58 xitam: I think it's the sorted-map

21:58 ,(sorted-map-by #(even? %2) 1 1, 2 2, 3 3)

21:58 clojurebot: {1 3, 2 2}

22:00 Chouser: specifically, your scoring function f sometimes indicates two unequal things are the same

22:00 xitam: Chouser: the weird thing is if i do (dosync (alter my-sorted-map assoc that-right-node nil)) it'll take it

22:01 from the repl, i mean

22:02 but that's probably the reason somehow - i thought the comparator was only for sorting, and it would check hashes for equality

22:03 Chouser: I'll see if I can confirm it in the code.

22:04 yeah, that's got to be it.

22:05 it's using the func as a Comparator, and if it returns 0 it assumes they're equal

22:05 hashes don't guarantee equality anyway, but it's not even use the = function.

22:11 xitam: wow, turns out i was totally wrong, i won't in fact take that node into the set no matter what i do. dunno how i thought otherwise

22:11 thanks chouser

22:12 Chouser: np.

22:12 it's a painful way to learn, but it's a way.

22:12 xitam: yeah. i need to understand comparators

22:13 Chouser: clojure fns of 2 args implement comparators automatically

22:13 ,(instance? java.util.Comparator #())

22:13 clojurebot: true

22:14 hiredman: ~jdoc java.util.Comparator

22:15 Chouser: but the .compare method provided expects the function itself to return true/false

22:17 I think. I'm not finding the code. hm...

22:17 ah, either boolean or number

22:17 hiredman: I it was true/false or 1,0,-1

22:18 Chouser: http://code.google.com/p/clojure/source/browse/trunk/src/jvm/clojure/lang/AFunction.java#27

22:18 hiredman: thought

22:18 Chouser: hiredman: you're right

22:18 rhickey: what's the question?

22:18 hiredman: using fns as comparators

22:18 Chouser: rhickey: no question, we've got it all figured out.

22:18 rhickey: great!

22:18 Chouser: <-- smug

22:19 xitam and i didn't know sorted maps relied entirely on the comparator fn to determine equality of keys

22:19 now we do.

22:20 rhickey: has to

22:21 Chouser: because the keys may not be comparable any other way?

22:21 hiredman: I didn't know either, but Chouser won't shutup about it, so the secret is out

22:22 rhickey: Chouser: right, it's an arbitrary function, might only use parts of values for instance

22:23 the numeric version has explicit = via 0, the boolean does x < y, y < x, if neither true, then =

22:23 but the sort doesn't know how much or what parts of the values matter, can't compare whole values with =

22:25 xitam: the javadoc for comparator is very enlightening about the issue -- clearly this isn't a mistake a more experienced programmer would make, but a note or link in the docs might help newbies

22:27 Chouser: xitam: so you can just make sure your sort-by function only returns 0 when you really mean it to.

22:27 rhickey: using a simple boolean predicate is often easiest

22:28 Chouser: he's trying to sort by a cost function

22:28 rhickey: like < ?

22:28 still boolean

22:29 Chouser: but equal cost does not mean same node

22:29 http://paste.lisp.org/display/76057

22:29 rhickey: ah

22:30 hen you've got duplicates from the perspective of the map/set

22:30 then

22:30 you'll have to further distinguish on equal cost

23:05 Drakeson: I am not sure if clojure-contrib is installed properly. How can I check it? is (require 'clojure.contrib.cond) supposed to work, for instance?

23:05 Chouser: (use 'clojure.contrib.repl-utils)

23:06 try that

23:07 Drakeson: thanks. (does not work, so it means my setup is the culprit.)

23:07 (java.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath) ...

23:07 Chouser: just put clojure-contrib/src in your classpath

23:08 Drakeson: I have put path to clojure-contrib.jar in a CLASSPATH env var. that is not enough then.

23:09 Chouser: the jar itself needs to be in your classpath

23:10 Drakeson: is that enough, though? (export CLASSPATH=$HOME/.local/jars/*)

23:11 Chouser: or java.ext.dirs needs to include the directory that contains the jars

23:11 put -Djava.ext.dirs=$HOME/.local/jars on your java command line

23:12 Drakeson: so I need to set both CLASSPATH and java.ext.dir ?

23:12 Chouser: no, one or the other

23:22 Drakeson: hmm, it's strange ..., I set CLASSPATH to a both clojure.jar and clojure-contrib.jar. Maybe swank-clojure is disrespecting CLASSPATH env var altogether?

23:22 Chouser: paths separated by :

23:22 Drakeson: yes

23:23 hiredman: watchout, Chouser is a vim user

23:24 Drakeson: can it be that java ignores CLASSPATH env var when swank-clojure uses -cp ... when calling java?

23:24 hiredman: yes

23:25 Chouser: hm, yeah, you said "swank", I'm out. :-)

23:25 hiredman: -cp disregards CLASSPATH

23:25 Drakeson: I see, thanks

23:26 Chouser: heh :)

23:52 cmvkk: one thing about clojure is that it's hard to complain about a problem with a java library when all you have is clojure code as an example.

23:56 danlarkin: Whyyyyyyyy: http://github.com/an-and/pleajure/tree/master

23:56 jbondeson: haha

23:57 it's like screaming "I don't get it" at the top of your lungs.

23:57 danlarkin: 1) -jure name 2) wtf syntax?

23:57 jbondeson: it's not even parenless or anything

23:58 cmvkk: well, there's nothing...wrong with it, per se

23:58 jbondeson: you're really are just getting rid of parens on forms you put on a newline

23:59 hiredman: ugh

Logging service provided by n01se.net