#clojure log - Oct 29 2011

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

0:19 callen: technomancy: ubuntu does that a lot.

1:24 Raynes: ibdknox: Ping.

3:17 ibdknox: Raynes: pong

3:17 Raynes: ibdknox: Already forgot what I was going to say.

3:18 But since you're here… Just moved try-clojure to noir in just under 30 minutes.

3:18 Good stuff, man. Good stuff.

3:18 ibdknox: Awesome :)

3:19 I saw the doc clarification, I agree that that's clearer. I'll merge that in tomorrow.

3:19 Raynes: Yeah, it took me a minute to realized why my json looked like it had been converted to a string 86 times.

3:19 ibdknox: lol

8:11 scode: Is this idiomatic?: (read (java.io.PushbackReader. (reader (file "/path/to/file"))))

8:11 Seems awfully verbose just to use the clojure reader to read from a file.

8:11 (Dis-regarding that I'm not closing it in the example.)

8:35 zilti: How do I have to add new functions to a class extended with proxy? With letfn?

8:37 sn197: did you know that (file-seq dir) may return file paths that cannot be opened subsequently, if unicode chars are in the pathnames

8:44 zilti: I have to extend java.awt.Canvas by adding a new variable, a new function and overwrite paint.

8:44 And I have no idea how.

10:43 mbac: does the ->> function have a name?

10:43 s/function/macro/

11:09 MrKotter: ok, I know its probably been asked a million times, but is there a formula for getting emacs to work with the clojure-clr on windows?

11:10 the VS plugin is not cutting it

11:20 zippy314_: I'm looking for people's experience and best-practices writing tests for clojurescript apps. Have folks been using Google Closure's test functions? Anybody tried integrating Jasmine? Any other approaches? What I'd love is something like midje for a more BDD approach...

11:38 zilti: "Parameter declaration proxy should be a vector" What am I doing wrong here?

11:38 Oh. Nevermind

11:40 Copied the wrong thing. "Metadata can only be applied to IMetas" Here it is. I get this every time I validate a file in the SLIME buffer (using C-c C-l)

11:41 Had this the first time today, yesterday everything worked fine.

11:42 scottj: zippy314_: I haven't seen any mailing list posts or blog articles with details

12:10 zilti: Isn't let allowed inside a proxy? I always get "Unsupported binding form".

12:18 raek: I can't see any reason lets shouldn't be allowed. maybe the left hand side of a let binding is incorrect...

12:18 zilti: raek: How could that be? It's just a name there.

12:18 Basically I want to define a new variable inside that class, but how?

12:19 raek: zilti: are you sure you are calling proxy with the correct syntax?

12:19 ah, you meant a let between the (proxy ...) and the method?

12:20 you can do this (let [x 1] (proxy ... x ...))

12:20 and this (proxy ... (foo-method [...] (let [x 1] ...)))

12:21 but you can't do something like (proxy ... (let [x 1] (foo-method ...)))

12:21 zilti: I want that additional var to be available inside that class.

12:21 Ah ok

12:22 raek: let will just give you access to a value

12:22 you can let an atom or a ref though if you want to have state

12:22 (let [state (atom {:a 1, :b 2})] (proxy ...))

12:23 each instance will have each own atom

12:23 zilti: Ah that way around ok

12:23 Good to know

12:23 raek: you have to be explicit when doing mutation in clojure :-)

12:33 zippy314: scottj: thanks!

12:42 zilti: raek: How can I instantiate a proxy then?

12:46 duck1123: zilti: I don't use proxy much, but does (let [klass (proxy ...)] (new klass arg1)) work?

12:47 zilti: duck1123: Right now I have stored the proxy in a def

12:47 duck1123: well, try using it with new

12:48 zilti: I have it in (def canv ...) now, but unfortunately (new canv) doesn't work

12:48 Unable to resolve class name

12:49 duck1123: Are you using proxy for a case where some java code needs to accept a class?

12:50 try (.newInstance canv)

12:50 zilti: duck1123: No, I just have to use that proxy inside my clojure code

12:51 (.newInstance canv) gives me a "no matching field found".

12:51 maybe init-proxy?

12:53 Jup, init-proxy seems to be the way to go

12:55 duck1123: zilti: have you looked to see if deftype might not work for you?

13:03 There was a really good flowchart for determining what type of data structure you need, but I can't seem to find it

13:04 I take that back http://cemerick.com/2011/07/05/flowchart-for-choosing-the-right-clojure-type-definition-form/

13:07 zilti: duck1123: Thanks! Looks like deftype is the recommended. After following the arrows all over the chart ;)

13:09 duck1123: nice. That'll keep you out of interop zone, and should make things easier for you

13:10 zilti: "Each spec consists of a protocol or interface name" so that can be a class name, too, I guess?

13:11 duck1123: no, it only does interfaces and protocols. It won't subclass

13:11 zilti: So there's something wrong in the flowchart

13:12 duck1123: so you're extending a base java class?

13:12 zilti: Using the way "no -> yes -> named type -> no -> no"

13:13 duck1123: yes

13:13 duck1123: if you're extending a base class, wouldn't your first answer be yes?

13:14 zilti: Err, ignore the first "no" ;)

13:14 yes -> named -> no -> no -> deftype ;)

13:15 duck1123: oh, I'm wrong about deftype

13:15 that explains it

13:15 zilti: Oh, someone already wrote this in the comments :)

13:21 duck1123: I hate it, one of the libraries I'm embedding finds it's parts by opening up every jar on the classpath and loading all the classes to see if any of them implement it's interface.

13:23 zilti: weird lib

13:23 duck1123: It's cool if there's not much on the classpath, but with all the dependencies I have, it blows my permgen unless I add just about everything to it's exclusion list

13:24 jamiltron: On that flowchart - why is deftype and defrecord suggested over a regular map if the type is related to performance-sensitive code?

13:26 duck1123: it's not perfect

13:26 jamiltron: What would the benefits be performance-wise using a record + protocol instead of just using a map with namespace'd functions?

13:28 duck1123: Isn't access to a declared field of a record faster than access to the same field in a regular map

13:29 Of course, it's odd to think that anyone would ever say "no, I don't care about performance"

13:30 zilti: hmm now the only problem that's left is how to access functions inside the proxy

13:31 duck1123: (.getFoo this)

13:31 daaku: anyone have suggestions for an embedded db? i'm messing around with some stuff and just want an easy-ish db. i found clj-orient, and i'm trying that out (OrientDB), was wondering if anyone had suggestions

13:32 i don't need sql or anything, just basic id based lookups for the most part

13:33 duck1123: daaku: so this is all key-value data?

13:33 daaku: duck1123: mostly, i think i have a few things indexed by more than one field, but it isn't even that important atm

13:34 duck1123: you might also want to look at jiraph or fleetdb

13:35 daaku: cool, thanks duck1123 -- will check em out

13:35 duck1123: and it has to be embedded?

13:35 zilti: duck1123: Gives me a "no matching method found"

13:37 duck1123: zilti: so you're in one of the proxied methods, and you're trying to call another method of this class?

13:37 zilti: duck1123: No, I'm outside the proxy.

13:38 duck1123: zilti: oh, so do you have an instance of this class?

13:38 zilti: I did (init-proxy canv {}) not sure if that's considered to be an instance

13:39 jamiltron: daaku: You might want to take a look at Chris Granger's simpledb and see if that's something you could use: https://github.com/ibdknox/simpledb

13:40 duck1123: zilti: to be honest, the only time I've used proxy was when a java class wanted an anonymous class

13:41 daaku: jamiltron: nice, it's simple alright: :dependencies [[org.clojure/clojure "1.2.1"]]

13:42 jamiltron: daaku: It's pretty much a wrapper over an atom with some Java concurrency methods thrown in, iirc.

13:43 daaku: It's in memory though, so I don't know if that's a problem, but it should be pretty easily extendable to write to disk.

13:43 duck1123: if you don't need to write, you could look at the config module in my ciste library

13:43 daaku: yep, 50 lines of code -- persists to disk too actually

13:43 jamiltron: daaku: Oh you're right. I haven't used it in a while. I forgot it uses .db files.

13:44 daaku: it's great for prototyping. It replaces sqlite3 for me in that regard

13:45 daaku: jamiltron: i think i want something slightly more sophisticated -- but this is good for other random j0nx

13:48 but i imagine the slow start up time means it's a bit unlikely i'll be doing many of those random scripts in clojure sadly

13:49 duck1123: clojure's better for stuff where the run time outweighs the startup time, but there are ways to have a persistent vm to work around that

13:55 daaku: fleetdb looks pretty cool.. but i haven't found docs about embedding it. duck1123 any ideas if that's a supported way of using it?

13:56 duck1123: yeah, cake makes things pretty good with the persistent vm. i am no longer afraid of starting a repl or running tests ;)

13:58 duck1123: daaku: there used to be docs on how to embed the server component. looking

13:58 narkisr: Hey fellow Clojurians, I keep getting java.lang.NoSuchMethodError: clojure.lang.RT.keyword(Ljava/lang/String;Ljava/lang/String;)Lclojure/lang/Keyword;

13:59 duck1123: you should be able to require fleetdb.server and then call -main

13:59 narkisr: Im trying to migrate to 1.3 using the unoficial compat contrib

13:59 https://github.com/arohner/clojure-contrib

14:00 daaku: duck1123: cool, will try it

14:00 duck1123: narkisr: make sure lein is updated, try cleaning

14:01 narkisr: Iv tried cleaning couple of time, ill try now again :)

14:01 duck1123: a lot of contrib doesn't work with 1.3, and it's really worth looking to see what parts you really need

14:01 narkisr: lein clean and then lein jar result with the same

14:01 Yeah iv started to look on the modular contrib

14:02 but it lacks a lot of things iv used which is why I went trying the unofficial non modular one

14:02 It seems that this error is related to datalog which I use

14:02 duck1123: Personally, I recommend globally excluding the old contrib and then running lein test and adding new contrib libs till it works

14:03 narkisr: Hmm, what do you do about missing things?

14:03 duck1123: where did contrib go?

14:03 clojurebot: where did contrib go?

14:03 clojurebot: well... it's a long story: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

14:03 narkisr: Yeah iv read that one

14:04 still there are small functions that weren't migrated,

14:04 I could try and replace those but in large code bases its not always an option

14:05 duck1123: [org.clojure.contrib/datalog "1.3.0-SNAPSHOT"] was the latest, does that work?

14:05 narkisr: In order to use it ill have to drop the non-modular one I was trying, I guess ill need to use the modular one any how

14:06 classpath hell at its best ;)

14:07 Thank you duck

14:08 duck1123: now we just need someone to care enough about datalog to port it over

14:11 narkisr: Its a nice tool,

14:12 Not sure what it takes to migrate it tough

14:13 duck1123: Upgrading to 1.3 has gotten so much easier. When I first made the switch, almost nothing worked

14:13 thankfully, one more of the libs I use just integrated my patches today. One less fork for me to manage.

14:15 narkisr: Makes me wonder on how many have made the switch, didn't a lot of noise in the mailing list about missing things

14:15 seancorfield: at least this should be a one off and future migrations will be much easier

14:16 and, if clojure's user base grows as we all hope, the number of future users will far exceed the number of current users so only a small number of people will have to deal with the contrib break up

14:17 duck1123: the contrib reorginization is a pain, but it's good for clojure in the long run

14:17 narkisr: sure is but I wonder if they coudln't have made it more gradual

14:18 Raynes: I'm not sure how gradual would have helped anything.

14:18 Instead of doing it all at once and getting it over with, drop a library a week out of contrib?

14:18 They released contrib at the same time they released Clojure.

14:19 If they did it gradually, it would have been done in chunks over the next 20 years.

14:19 seancorfield: i started experimenting with with clojure in spring 2010 but we did start using it at work until the end of 2010 and we didn't go to production until spring 2011 so we were on 1.3.0 before we had much code written

14:20 duck1123: I think it's usually best to move over to modular contrib when you're still in 1.2, then make the jump once everything is still working

14:20 seancorfield: duck1123: agreed - that's why modular contrib must be 1.2.x compatible

14:20 duck1123: most people just go to 1.3 and then fix things till it works again

14:21 narkisr: Is the modular contrib 1.2 compatible?

14:21 seancorfield: now we have the matrix tests, it's easier to see what's 1.2.x compatible

14:21 narkisr: Oh

14:21 seancorfield: narkisr: mandate from clojure/core! :)

14:21 check build.clojure.org for the reality tho'

14:21 not all of them pass the matrix test

14:23 narkisr: I guess the community will have to step up and migrate things also

14:23 duck1123: and then you have the mult-deps support in lein to allow you to work on both versions before making the jump

14:23 narkisr: Time to dig in the datalog source ;)

14:23 seancorfield: if folks care enough about an old contrib library that has no maintainer, they can volunteer

14:23 that's how several have been migrated recently

14:24 duck1123: clojure.?.datalog

14:24 narkisr: I need to sign the CA in order to migrate no?

14:24 duck1123: algo?

14:24 seancorfield: yup

14:24 algo is migrated

14:25 duck1123: I was saying clojure.algo.datalog ?

14:25 seancorfield: ah, no, no one has stepped up to maintain datalog

14:25 narkisr: datalog is in algo?

14:25 seancorfield: isn't it superceded by cascalog tho'?

14:25 duck1123: no, I was proposing a new name

14:25 seancorfield: needs a volunteer maintainer first

14:26 duck1123: narkisr was going to send in his CA :)

14:26 narkisr: I will

14:26 seancorfield: quite a few will die on the vine for want of an active maintainer

14:26 duck1123: that's not a bad thing

14:26 seancorfield: and for the growth of the language, we don't want a bunch of inactive libraries in there

14:27 mornin' cemerick !

14:28 duck1123: narkisr: like seancorfield said, you might want to see if cascalog fits the bill first

14:28 cemerick: seancorfield: :-P

14:28 narkisr: sure

14:29 isn't cascalog an hadoop based framework?

14:29 duck1123: I want to see lamina become clojure.data.channels

14:29 ibdknox: I don't

14:29 I want it to remain free of the CA process

14:30 seancorfield: if a 3rd party library is actively maintained and popular, it doesn't need to become part of the clojure tree

14:30 duck1123: fair enough

14:30 seancorfield: last year there was talk of ring and enlive migrating to new contrib but there's no obvious benefit in doing so really

14:31 narkisr: I was thinking of adding a log based persistency layer for datalog

14:31 seancorfield: although i actually think it would be good for clojure's growth in the web space to have ring be part of contrib...

14:31 ibdknox: but lots of detriment

14:31 cemerick: seancorfield: I don't think either the authors or core suggested those.

14:32 ibdknox: at this point it would also be a nightmare trying to get everything under CA for that to happen

14:32 since they've taken patches I believe

14:33 * Raynes eats a sausage buscuit and deploys try-clojure.org

14:33 duck1123: That's an interesting point. Say I've signed a CA, and I've also contributed a patch to a library. If that library gets ported, do they need a separate agreement from me?

14:34 cemerick: duck1123: http://dev.clojure.org/display/design/Moving+Projects+Into+Contrib

14:34 Raynes: Deployed.

14:34 ibdknox: http://try-clojure.org/ now runs on noir and proudly display's its affection in the footer.

14:34 ibdknox: in short, you have to give up your rights

14:34 Raynes: displays*

14:34 ibdknox: Raynes: :)

14:35 Raynes: ibdknox: If you want to see it, check out the noir branch of tryclojure.

14:35 * ibdknox goes to look

14:35 Raynes: I also remembered what I was going to tell you last night.

14:35 cssgen is pulling in contrib. Looks like technomancy updated it to remove contrib deps, but the only release with that in it is a snapshot.

14:36 cemerick: ibdknox: EPL means retaining copyright doesn't fundamentally matter.

14:36 ibdknox: Raynes: hah! I've been trying to figure out what was doing that.

14:36 cemerick: I see

14:37 cemerick: Responses like that make me nervous. :-P

14:38 ibdknox: lol

14:38 I have only a cursory understanding of licenses

14:39 Raynes: you shouldn't need to add that middleware at the bottom, except for wrap-file. The rest is all handled by noir :)

14:39 Raynes: I wasn't sure. Thanks for the tip.

14:40 ibdknox: I love how simple try clojure is :) Granted it hides a lot behind the sandbox, but still.

14:41 * seancorfield has been dealing with FOSS licenses for ~20 years :(

14:41 ibdknox: seancorfield: I don't envy you

14:42 seancorfield: assignment of copyright is extremely important in gaining legal protection for the project - and reassuring companies that want to use said project

14:44 Raynes: ibdknox: Does it meet your approval? ;)

14:45 ibdknox: Raynes: A+

14:45 Korma is very close to a first release :D

14:46 moogatronic: what is supposed to happen wehn i type tutorial?

14:46 ibdknox: moogatronic: the bottom text will change and give you instructions

14:46 though it seems to be showing the same thing

14:46 moogatronic: doesn't seem to be doing that in chrome.

14:46 ibdknox: Raynes: ^

14:47 Raynes: haha you never defined a page for /tutorial

14:48 Raynes: Yeah, I just noticed that.

14:48 Dur.

14:48 ibdknox: java logging is retarded

14:49 moogatronic: ibdknox: log4j?

14:49 ibdknox: moogatronic: I was using c3p0 which has its own logging mechanism. I was trying to turn it off

14:49 moogatronic: the fix ended up being simple, but it took me forever to figure it out

14:50 moogatronic: yeah, it's a problem when someone uses alternate libs, or reads configuration from weird spots.

14:50 hugod: logback is nicer than log4j, imho

14:50 ibdknox: logback?

14:50 moogatronic: i'm just used to log4j after having used it for so long.

14:50 ibdknox: http://logback.qos.ch/

14:51 hugod: advantages?

14:51 hugod: logback is very similar. It has a contexts and a nice sifting appender

14:51 moogatronic: how many xml files does it take to configure?

14:51 hugod: it has a default config that logs to console

14:51 one file

14:51 moogatronic: win!

14:51 Raynes: ibdknox: Looks like my tutorial handler disappeared entirely. Heh.

14:52 When I refactor, I really refactor.

14:52 ibdknox: that's the way to do it.

14:52 moogatronic: I only checked tutorial, beause I'm tutorializing myself this weekend.

14:52 =)

14:53 ibdknox: hugod: I assume since it's slf4j it'll work with tools.logging?

14:54 hugod: ibdknox: it does

14:54 ibdknox: sweet, I'll have to give it a try

14:54 duck1123: ibdknox: both slf4j and log4j work AFIK

15:00 moogatronic: I'm really finding autocomplete and ac-slime extremely helpful in my noob to noob+1 conversion.

15:06 spoon16: is there an easy way to go from a byte array to a string

15:06 ?

15:07 duck1123: that's one of String's constructors

15:07 (String. ba)

15:07 cemerick: No!

15:08 (String. array "some-encoding")

15:08 system-default character sets are evil

15:08 duck1123: ok, I was about to say that

15:08 cemerick: And, yeah, get off my lawn! ;-P

15:09 duck1123: do you have to init a Charset for that?

15:10 cemerick: No, just use the charset name.

15:10 "UTF-8" is generally the only sane choice, unless you have distinct reasons to go another way.

15:10 * ibdknox hands cemerick a glass of lemonade, as he sits on his porch

15:10 duck1123: (inc cemerick)

15:10 lazybot: ⇒ 4

15:10 cemerick: :-)

15:11 ibdknox: Hot chocolate, perhaps? It's snowing buckets here.

15:11 ibdknox: or that

15:11 lol

15:11 cemerick: high of 76 here today ;)

15:12 Raynes: Man, I really wish I knew JavaScript.

15:12 cemerick: ibdknox: I love snow. :-D

15:12 76º is nice too, other times

15:12 ibdknox: Raynes: no you don't

15:12 cemerick: Raynes: no you don't

15:12 ibdknox: lol

15:13 cemerick: whoa

15:13 that's gotta be a sign

15:13 Raynes: ibdknox: Unfortunately, a large portion of tryclojure is written in it. Knowing it would be in my best interest.

15:13 cemerick: (not= "getting by" "knowing Javascript")

15:13 Raynes: Fair enough.

15:13 cemerick: I prefer the former. Less maddening.

15:14 Raynes: But now I have to google for something. I've got like 15 slides written and it's like a week and a half before the conj. I do not have time for Javascript. x_x

15:14 moogatronic: is there a quick and easy way to reset my REPL if I've accidentally collided functions from multiple namespaces?

15:18 dnolen: emacs is just insane, jira mode

15:24 Raynes: moogatronic: Tutorial should be fixed now. Thanks for pointing that out.

15:25 moogatronic: Raynes: awesome, thanks. Will check it out.

15:25 Raynes: It is… brief.

15:25 moogatronic: I'm trying to hit it from multiple angles. so any help helps. =)

15:25 ibdknox: moogatronic: build a website! ;)

15:26 moogatronic: ibdknox: it's on the list. =) First I need to build some synths and implement some of the GAs and CA systems i alreayd know how to implmeent in other langs.

15:26 got overtone all setup and working last night.

15:27 well, the parts that were missing from before.

15:27 ibdknox: overtone is awesome

15:27 moogatronic: ibdknox: yeah, I couldn't for a while, figure out why (piano) wasn't working.

15:27 but I worked that out after much googling.

15:28 my level of clojure now is pretty low.. I pretty much have to google everything.. How do I open files, how do I iterate over lines, how do I do stuff with contents.. =)

15:28 hell, i have to google how do I iterate. =)

15:29 ibdknox: hehe :)

15:30 cemerick: moogatronic: you could do worse than to read all of the docstrings in clojure.core clojure.github.com/clojure/

15:30 http://clojure.github.com/clojure/ that is

15:30 Years in, I still discover nuggets in there that I hadn't internalized.

15:32 Raynes: jodaro: I got my wunderground swag. They somehow magically knew my tshirt size.

15:33 moogatronic: cemerick: I am reading lots of docstrings too.. C-c C-d d

15:33 that and the ac-slime popus have been really nice

15:37 Raynes: try-clojure is nice. I think it would be pretty cool to "try-clojure"-ify the contents of Friedmans "The Little Schemer". At least to me, these seem to have a similar interaction feel.

15:38 gtrak: ,(. Syste­m/err print­ln "will it run out of disk space if I DOS it?")

15:38 clojurebot: #<CompilerException java.lang.RuntimeException: No such namespace: Syste�m, compiling:(NO_SOURCE_PATH:0)>

15:39 gtrak: &(. Syste­m/err print­ln "test")

15:39 lazybot: java.lang.RuntimeException: No such namespace: Syste�m

15:39 zilti: ,(. java.lang.Syste­m/err print­ln "will it run out of disk space if I DOS it?")

15:39 clojurebot: #<CompilerException java.lang.RuntimeException: java.lang.ClassNotFoundException: java.lang.Syste­m, compiling:(NO_SOURCE_PATH:0)>

15:39 gtrak: huh

15:39 weird!

15:39 tryclojure is just silent on the matter

15:40 Raynes: gtrak: What did you do, rebind *out*?

15:40 gtrak: Raynes, huh? no

15:40 moogatronic: Raynes: you could have pluggable storylines for the interactive code / thought / lecture stuff...

15:41 gtrak: just tried to println :-), it didn't yell at me or anything

15:41 Raynes: Oh. I probably forgot to redirect out./

15:41 gtrak: you may see some messages in your log :-P :-)

15:41 Raynes: I do.

15:42 ibdknox: ,(. *err* println "hey")

15:42 clojurebot: #<IllegalArgumentException java.lang.IllegalArgumentException: No matching method found: println for class java.io.StringWriter>

15:42 gtrak: so what's going on with the bots then?

15:42 ibdknox: ,(. *err* write "hey")

15:42 clojurebot: hey

15:42 nil

15:43 gtrak: ,*err*

15:43 clojurebot: #<StringWriter >

15:44 gtrak: they just can't see java.lang.System?

15:44 Raynes: &(System/exit 0)

15:44 lazybot: java.security.AccessControlException: access denied (java.lang.RuntimePermission exitVM.0)

15:44 gtrak: &(System/out)

15:44 lazybot: ⇒ #<PrintStream java.io.PrintStream@cedaea>

15:45 zilti: Every time I read an "access denied" I hear that Half-Life-"access denied" in my head

15:45 gtrak: &(. System/out println "test")

15:45 lazybot: ⇒ nil

15:45 gtrak: &(. System/err println "test")

15:45 lazybot: ⇒ nil

15:46 gtrak: ,(. System/err println "test")

15:46 clojurebot: nil

15:46 zilti: &(println "test")

15:46 lazybot: ⇒ test nil

15:46 gtrak: huh, maybe i copy-pasted an invalid character

15:46 ibdknox: writing docs: important, but boring.

15:47 Raynes: ibdknox: I spent an hour documenting the shit out of clojail last night.

15:47 ibdknox: yeah I'm writing content for the Korma site

15:47 Raynes: it takes forever

16:04 zilti: I don't understand why I get "No Message. NullPointerException" when wrapping a seesaw dialog inside a function, but it works flawlessly when getting called directly...

16:09 lnostdal_: zilti, "inside a function" can mean many things .. does this function get called at a later time or in a different context where some expected context is missing or have changed?

16:09 arohner: is there a clojure fn for (.getNamespace :foo)?

16:09 zilti: lnostdal_: There is no context. And it never works, not even when I call the function directly in the REPL

16:10 lnostdal_: It's basically just a (defn get-dialog (dialog ...))

16:10 gfredericks: there's no clojure library for complex numbers is there? I'm on my own?

16:11 scottj: gfredericks: clojure.contrib.complex-numbers

16:12 gfredericks: scottj: that's not as empty as it looks?

16:12 scottj: gfredericks: how empty does it look?

16:12 gfredericks: scottj: the API page shows no public functions

16:13 looking in the source I see there's some stuffs. Checking it out.

16:13 scottj: gfredericks: the code will show you that is because the multimethods are defined in clojure.contrib.generic.comparison

16:14 lnostdal_: arohner, do you mean (namespace 'user/some-symbol) ?

16:14 scottj: gfredericks: I haven't used it so I don't know how well it works

16:14 arohner: lnostdal_: yes, thank you

16:14 lnostdal_: seems weird having to explicitly supply the namespace like that though .. hm

16:15 or maybe not

16:15 gfredericks: line 37 shows something I've never seen before: (deftype ::complex complex ...) <-- what does this mean?

16:15 arohner: lnostdal_: my use-case was determining whether a keyword is namespaced

16:15 ,(namespace ::foo)

16:15 clojurebot: "sandbox"

16:16 lnostdal_: ok, arohner

16:16 scottj: gfredericks: that's from before deftype was in clojure there was a different thing called deftype

16:17 gfredericks: scottj: ah ha! so it is. The world is right again.

16:41 zilti: I just noticed that if one has a zero-argument function that returns something, and one needs that something, one has to wrap that zero-argument function in parens so it gets evaluated first...

16:42 I'm not really sure if I should consider this logical or weird.

16:42 gfredericks: zilti: you mean like ##(rand)?

16:42 lazybot: ⇒ 0.3344012713783572

16:43 zilti: gfredericks: No, like if I have the function (defn get-dialog [] (dialog ...)) I have to call it like this: (show! (pack! (get-dialog))) because (show! (pack! get-dialog)) doesn't work

16:44 gfredericks: yeah. Functions are objects too, so you have to distinguish whether you're calling it or just mentioning it

16:45 zilti: There are two ways one can interpret "everything's a value" and obviously I misinterpreted it this time

16:45 * gfredericks isn't sure what that means

16:48 zilti: Well "they" say that in Clojure everything's a value, so one could think that the value of a zero-argument function is its return value

16:48 lazily retrieved at the time it is needed

16:49 gfredericks: zilti: that would kind of mess up those zero-arg functions that return different values each call

16:50 for example, what would you expect (= rand rand) to evaluate to?

16:50 zilti: gfredericks: I don't think so, if they're evaluated lazily.

16:51 gfredericks: Hmm yes I forgot about that :(

16:51 ,(not= (rand) (rand))

16:51 clojurebot: true

16:51 zilti: ,(= rand rand)

16:51 clojurebot: true

16:52 gfredericks: it kind of destroys your ability to reference functions as objects, and at that point you can hardly do functional programming anymore

16:52 e.g., what if I wanted to do ##(sort-by rand [7 38 4 5 6])

16:52 lazybot: ⇒ (4 7 5 6 38)

16:53 gfredericks: instead of passing the rand function, I would have passed a random number, which does me no good

16:56 for some reason I am finding it impossible to obtain algo.generic with leiningen :/

17:02 * gfredericks built it himself and installed it locally and now it's better

17:26 gfredericks: (inc seancorfield) ; <-- for the "Where Did Clojure.Contrib Go" page

17:26 lazybot: ⇒ 2

17:30 cemerick: can you query for people's scores?

17:30 lazybot: cemerick?

17:30 &cemerick

17:30 lazybot: java.lang.RuntimeException: Unable to resolve symbol: cemerick in this context

17:30 cemerick: heh

17:30 Raynes: $help karma

17:30 lazybot: Raynes: Checks the karma of the person you specify.

17:30 cemerick: fancy

17:30 karma cemerick

17:30 lazybot: karma cemerick

17:31 Raynes: $karma cemerick

17:31 Teh brokes.

17:31 Not at all surprising.

17:31 cemerick: (dec cemerick)

17:31 lazybot: You can't adjust your own karma.

17:31 cemerick: sorta brokes

17:31 gfredericks: (dec cemerick)

17:31 lazybot: ⇒ 3

17:31 gfredericks: (inc cemerick)

17:31 lazybot: ⇒ 4

17:31 Raynes: Only get-karma is broken.

17:32 cemerick: an un-deref-able atom.

17:32 gfredericks: (def check-carma (comp inc dec))

17:33 This feels like a principle from physics. The only way to observe the karma also changes it.

17:33 cemerick: clojuredocs still highlights old contrib. :-|

17:47 Raynes: $karma cemerick

17:47 lazybot: cemerick has karma 0.

17:47 Raynes: Close enough.

17:47 Iceland_jack: $karma Iceland_jack

17:47 lazybot: Iceland_jack has karma 0.

17:47 Iceland_jack: Bloody favoritism

17:47 Raynes: Yeah, it's going to give 0 for everybody. But hey, at least it responds now. ;)

17:48 abedra: $karma abedra

17:48 lazybot: abedra has karma 0.

17:48 abedra: s/0/100000

17:48 s/0/100000/

17:48 damn

17:48 I fail at gaming the system yet again

17:49 Raynes: :p

17:49 abedra: Raynes: what is the list of available commands now for the bot?

17:49 Raynes: is there a quick reference?

17:55 gfredericks: lazybot: help

17:55 lazybot: You're going to need to tell me what you want help with.

17:55 gfredericks: lazybot: wut I can say

17:55 technomancy: lazybot: help help

17:55 lazybot: technomancy: Get help with commands and stuff.

17:56 zilti: lol

17:56 * technomancy nods sagely

17:56 abedra: lazybot: help commands

17:56 lazybot: Topic: "commands" doesn't exist!

17:56 zilti: This is the most awesome answer ever

17:56 abedra: lazybot: are you skynet

17:57 gfredericks: $karma lazybot

17:57 lazybot: lazybot has karma 0.

17:57 gfredericks: (dec lazybot) ; $karma is broke

17:57 lazybot: ⇒ -1

18:08 maxbb: ciao list

18:11 Raynes: abedra: There isn't an up-to-date reference.

18:11 abedra: https://github.com/flatland/lazybot/wiki/Commands There is this, but your mileage may vary.

18:13 abedra: One cool thing is that the only reason there isn't an up-to-date list is because I haven't written a command for that yet. It wouldn't be hard to generate docs from within lazybot. :>

18:14 $forecast Eldridge Alabama

18:14 ^ That worked, he just does it in query rather than in the channel.

18:14 I should probably make him point out that he is querying the caller.

18:18 zilti: $forecast Eldridge Alabama

18:18 wow.

18:20 Raynes: zilti: That had HTML encoding in it, didn't it?

18:21 I guess I forgot to unuglify those.

18:21 zilti: yes it did. But only for my hometown since for Elridge it didn't display degrees.

18:21 There was only &deg;

18:22 spoon16: hey in lein when I am defining dependencies

18:22 how do I find the name of the dependency?

18:22 javax.activation/activation (for example)

18:23 where are those values coming from?

18:24 zilti: spoon16: Those are from Maven

18:26 Raynes: Heh.

18:26 zilti: Use a maven search page if you don't know if it's on maven - e.g. http://mvnrepository.com/artifact/javax.activation/activation

18:26 Raynes: Yes, those are maven artifacts. The part before the / is the group id and the part after it is the artifact id.

18:27 * zilti joins the self-help group for computer users suffering crashing programs

18:27 Raynes: If you're trying to find out what a dependency is called, you can search for it. If it's a Clojure library, it's probably on clojars.org. If it's Java, it's probably on maven central. search.maven.org

18:27 Alas, lein (and cake if you're on the develop branch) have a 'search' feature that allows you to search all the maven repos you have configured (clojars and central by default) for artifacts.

18:28 zilti: btw isn't the javax.activation included in the standard jdk anyway?

18:28 Raynes: For example, 'cake search activation' gives me a list of javax.activation/activation artifacts of various versions.

18:36 zilti: Does someone here use Noir?

18:36 I just deployed a "Hello World" packed using "lein ring uberjar" to a Tomcat 6 and get the following error: "java.io.FileNotFoundException: /home/dzilti/public_html/beta/WEB-INF/classes/public (Is a directory)"

18:40 schow: hello?

18:40 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline schow

18:40 Scriptor: hi schow

18:40 schow: I have a newbie question I was hoping someone could help me out with

18:41 zilti: schow: Just ask

18:41 schow: right.

18:41 Raynes: That'd be the purpose of the channel. ;)

18:41 schow: I'm trying to write a simple script that processes stdin. For example as part of a series of unix commands cat input.txt | clj myscript.clj

18:42 I found a posting on stackexchange that describes this

18:42 ;; (doseq [line (line-seq (java.io.BufferedReader. *in*))]

18:42 ;; (println "x" line))

18:43 which gets the job done partially but in addition to the output from my println form I also get the original stdin output

18:44 I've been playing with similar lines such as

18:44 zilti: schow: Yes, that's because "line" contains the input

18:44 schow: (doseq [line (clojure.contrib.io/read-lines "testinput.txt")] (println "y" line))

18:44 and (doseq [line (clojure.contrib.io/read-lines "testinput.txt")] (println "y" line))

18:44 i mean (doseq [line `("A" "B" "C")] (println "z" line))

18:44 zilti: contrib is outdated

18:44 schow: which both produce the expected result

18:44 zilti: ,(doseq [line `("A" "B" "C")] (println "z" line))

18:44 clojurebot: z A

18:45 z B

18:45 z C

18:45 schow: correct

18:45 but when I have A\nB\nC\n in my input file and cat it into the first script I not only get the output prepended with "x" I get the original output as well

18:47 ibdknox: schow: what is it that you're trying to do exactly?

18:47 zilti: ibdknox: He wants to pipe the output of one program to his script

18:47 schow: cat inputfile.txt | <a clojure script>

18:48 zilti: Which works, but the contents of inputfile.txt get printed as well before the output of his script

18:48 cemerick: Does that happen every time now?

18:48 hello?

18:48 clojurebot: BUENOS DING DONG DIDDLY DIOS, fRaUline cemerick

18:48 schow: In my simple test I'm just putting A B C (each on their own line) into my inputfile.txt

18:48 I see the following output

18:48 A

18:48 x A

18:48 B

18:48 x B

18:48 C

18:48 x C

18:48 cemerick: hiredman: step away from the gin. ;-)

18:49 ibdknox: k, one second

18:49 schow: The issue seems to be either with line-seq or java.io.BufferedReader since my other 2 tests seem to produce the expected otuput

18:51 zilti: it can't be line-seq because there's no print function in it

18:52 ibdknox: try binding in

18:52 schow: Another clue which might implicate my use of BufferedReader is the fact that sometimes I see something like this

18:52 A

18:52 B

18:52 x A

18:52 x B

18:52 C

18:52 x C

18:53 "binding in"?

18:53 ibdknox: (binding [*in* (io/reader *in*)] (let [lines (line-seq ....

18:53 gfredericks: it almost seems like when lazy seqs get printed. but if you're using doseq I don't think that would make sense.

18:56 schow: @ibdknox can you post the your full script proposal?

18:57 zilti: ibdknox: *io* is already a reader

18:57 ibdknox: yeah, I'm messing around with it

19:01 zilti: schow: Maybe it's because you do input.txt | clj myscript.clj. Did you try to turn your clj file into a script file? Like adding these three lines at the beginning and make it executable:

19:02 #! /bin/sh

19:02 exec clj "$0" "$@"

19:02 schow: yes I've tried both with a #!

19:02 zilti: !#

19:02 then run it without prepending clj

19:02 schow: cat input.txt | ./test.clj

19:02 as well as

19:02 cat input.txt | clj test.clj

19:02 zilti: Both didn't work?

19:03 schow: same behavior

19:03 ibdknox: I can't get *in* with lein :/

19:04 abedra: Raynes: thanks for the info

19:05 schow: just figured it out

19:05 doh

19:05 ibdknox: ?

19:05 schow: my "clj" script looks like this

19:05 #!/bin/sh java -cp /Users/schow/clojure/helloworld/lib/clojure-1.2.1.jar:/Users/schow/clojure/helloworld/lib/clojure-contrib-1.2.0.jar:/Users/schow/clj/clojure-1.1.0/jline-0_9_5.jar jline.ConsoleRunner clojure.main $1

19:06 (and I cut and copied the same line into my #! at the beginning of my test.clj)

19:06 ibdknox: ah

19:06 schow: in both cases jline is present and the script is being run inside jline.ConsoleRunner

19:06 which appears to be what is adding the extra output

19:06 When I remove that it is fine.

19:07 zilti: show: Nice. And btw, since you're a beginner: Upgrade to Clojure 1.3 and don't touch Clojure Contrib.

19:07 ibdknox: ever

19:08 schow: In case you're curious here is the resulting working test.clj

19:08 #!/usr/bin/java -cp /Users/schow/clojure/helloworld/lib/clojure-1.2.1.jar clojure.main

19:08 (doseq [line (line-seq (java.io.BufferedReader. *in*))] (println "x" line))

19:09 Does 1.3 contain some of the contrib libs within core?

19:09 What are the drawbacks of contrib?

19:10 zilti: yes, a few. And most of the other parts are in its own projects

19:10 brehaut: http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go

19:10 zilti: It's discontinued

19:10 dnolen: schow: io stuff got move to clojure.java.io

19:12 zilti: I just deployed a "Hello World" packed using "lein ring uberjar" to a Tomcat 6 and get the following error: "java.io.FileNotFoundException: /home/dzilti/public_html/beta/WEB-INF/classes/public (Is a directory)"

19:15 Anyone know a solution?

19:18 schow: thx guys. see ya

19:21 cemerick: zilti: that's a bug in ring

19:22 zilti: cemerick: So there's currently no way to deploy a ring application to tomcat (without a lot of handwork)?

19:22 cemerick: Upgrade (or add) your dependency on ring to 1.0.0-RC1

19:23 master5o1: !help

19:23 clojurebot: herp?

19:23 clojurebot: I don't understand.

19:23 zilti: cemerick: Will that overwrite the noir dependency?

19:24 cemerick: zilti: no, noir and ring are separate

19:24 noir depends upon ring

19:24 zilti: yes

19:24 but if I use noir, can I simply add the dependency to ring 1.0.0-RC1 and it will work?

19:25 master5o1: !dice

19:25 :O

19:25 Raynes: It depends on whether or not noir is compatible with it. Your dependency *will* override the noir one, but that doesn't mean noir will run.

19:25 $help dice

19:25 lazybot: Topic: "dice" doesn't exist!

19:25 master5o1: !google herp

19:25 oh.

19:25 $hel

19:25 $help

19:25 lazybot: You're going to need to tell me what you want help with.

19:25 Raynes: I have a dice command somewhere.

19:25 cemerick: zilti: you should have no problem using the newer rev of ring

19:26 zilti: Ok, thanks!

19:26 cemerick: If you do, downstream projects need to get up to speed, as that particular bug is *really* irritating.

19:27 zilti: (inc cemerick)

19:27 lazybot: ⇒ 5

19:27 zilti: :)

19:33 cemerick: Can I trade lazybot karma for miles or something? :-P

19:33 zerokarmaleft: there isn't an exchange rate for conj beers?

19:34 cemerick: oh, that'll work :-D

19:35 Raynes: cemerick: Sure.

19:39 Saturnation: Just going through https://github.com/technomancy/clojure-mode and am a bit stuck on Basic REPL. In particular how does M-x run-lisp us Leiningen? Did the previous packages installs do this, or is there something implied I missed?

19:39 In other words, is there a sanity test for making sure everything has been installed correctly thus far?

19:44 scode: What's an idiomatic way for one method in a deftype to refer to another? Getting a compile time error saying the referee is unknown, presumably because the side-effects of the deftype macro haven't happened yet or some such.

19:44 I'd like to avoid forwarding calls to a function defined with a (defn...) separately.

19:45 Well, (declare ...) works. But feels a bit assymetric to keep that outside of the deftype.

19:46 dnolen: scode referring methods of the same type? or referring to a method in another type?

19:46 if other type, you need declare

19:49 scode: dnolen: Same type.

19:49 dnolen: scode: then you shouldn't need declare.

19:50 since those fns are defined by the protocol.

19:51 scode: *face palm*

19:51 I only added it to my implementations and not the protocol.

19:51 How stupid.

19:51 Sorry :)

19:51 No actually I did add it to the protocol.

19:51 Ok, I must have made some mistake. Will investigate.

19:52 cemerick: scode: don't be so hard on yourself

19:52 :-)

19:53 feel free to paste code if you continue to have trouble

19:53 scode: My mistake was that I had failed to namespace qualify my calls to the protocol methods so they were of course resolving to the namespace of the implentation rather than the protocol..

19:53 cemerick: Thanks :)

19:55 cemerick: oh, that's tricky

19:55 I can see that taking a little while to sort out

19:56 scode: Mostly just the fact that I've written far less clojure than I would want, which is showing. So minor pitfalls like these show up ;)

19:56 cemerick: I generally use a * or -impl suffix on implementing functions, just to keep things like that straight in my head

19:57 scode: I wonder if it's a good idea to actually :use the protocol namespace in the implementing namespace.

19:58 cemerick: using :use without :only is decidedly not idiomatic

19:58 (in general) ;-)

20:00 scode: Yep, I'm not doing it. Was mostly an idle thought for the specific case of an implementation of a protocol. But that assumes the namespace of the protocol is *only* used for the protocol.

21:31 ibdknox: you know you've reached the level of awesome when you've created a DSL for writing your library documentation

21:33 library's, rather

22:08 WuHoUnited: Does anybody know the best way to pass an integer to a java function?

22:12 ibdknox: ,(doc int)

22:13 clojurebot: "([x]); Coerce to int"

22:13 ibdknox: WuHoUnited: ^

22:13 WuHoUnited: nevermind i had a different problem

Logging service provided by n01se.net