#clojure log - Apr 16 2010

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

0:05 johnmn3: I mean, what kind of record are we talking about here? The first time I saw it, I thought they were talking about an sql thing.

0:09 * johnmn3 reads clojure-log.n01se.net from 10:12 today

0:17 remleduff_: In emacs, iIf I've got a pretty old repl and some files that have had a bunch of edits, is there a way to compile fresh and make sure that all the changes make it to the repl? I was working today, and had some stuff that had functions defined in the wrong order but I didn't notice because my repl state itself was fine.

0:17 carkh: remleduff_: no

0:17 johnmn3: ok, so with defrecord we can treat an object like a map, with the keys/vals as getters and setters?

0:18 ok, I think I see.

0:46 technomancy: remleduff_: if you have one namespace that requires all the others, you can require it with reload-all: (require 'my-root-namespace :reload-all)

0:46 and all the dependent ones will get loaded

1:33 Licenser_: greetings

1:51 zmila: re

2:49 vIkSiT: hmm. quick question. I'm fetching some data using http.agent and the result comes out as a clojure.lang.lazyseq.

2:49 I was wondering - how do I convert this to text? (The result is actually in JSON format, from the representation)

2:50 oh got it.

2:50 zmila: lazy seq of what? you can convert seq into text by (str )

2:52 slyphon: anyone run into problems like: java.lang.IllegalArgumentException: interface com.atomikos.datasource.pool.Reapable is not visible from class loader

2:52 this code works on Mac OS-X, but linux seems unhappy with me

3:01 piccolino: I'm having a bit of trouble understanding the docs for deftype etc. Is it possible to extend a Java class, maintaining the implementations of the functions you don't override?

3:05 mae: hi, need a job

3:05 in california

3:05 close to bakersfield

3:07 piccolino: Oops, there it is, nevermind.

3:07 mae: boom.

3:08 slyphon: goes the dynamite

3:08 mae: ice ice baby...

3:08 so here is my lament, if anyone cares:

3:09 i have been involved in open source with the ruby/ror and haskell/happstack

3:09 took steady boring job, administrating windows, bla bla, we make carrots

3:10 now i like clojure, but stuck at nice but boring (not using my skills) job

3:10 the end

3:10 slyphon: such is life?

3:11 mae: anyone want a free programmer to see if i am any good? for prospects of future jobs?

3:11 *sombered look*

3:11 ok time to go make some baby bottles

3:11 the irc monologue is *definitely* not represented on twitter

3:11 so alas i am here

3:19 wrong channel i guess

3:21 Licenser_: morning

3:21 mae: morning

3:21 Licenser_: mae: I feel your pain

3:22 So I'd take a free programmer but I don't have a job for you :P

3:25 mae: lol

3:25 thats the bottom of the bottom

3:25 so uh, what do you do then?

3:26 Licenser_: mae: why is that the bottom of the bottom :P I don't need one for commercial work, I'm not that low ;

3:26 )

3:26 we're installing servers for TelCo's

3:26 mae: cool

3:27 Apage43: mae: I am on a support/operations team at work

3:27 mae: the problem i face is that my job is way easy, and my skills are atrophying

3:27 Apage43: i have clojure on my box

3:27 and use it in pressing situations to quickly write things like log-file analyzers and monitors for things

3:27 Licenser_: mae: yea that is why I write open source stuff in my free time so I don't get rusty

3:27 mae: heh

3:27 i will not bcome a blog

3:27 ugh

3:27 blob

3:28 Licenser_: a blob?

3:28 mae: yes

3:28 Licenser_: as in a table cell that can helpd binary data?

3:28 mae: Licenser_: must be nice, does it pay well

3:28 Licenser_: writing open source? does not pay :)

3:28 mae: no kidding

3:28 i hate that

3:28 i could get 3 sap jobs

3:29 Licenser_: well it gives me the fluffy warm feeling of doing something good

3:29 mae: before i get one open source job

3:29 its not good if no one uses it for something useful

3:29 it is practically masturbation

3:29 Licenser_: well look at rhickey he writes clojure open source and it is a darn good thing

3:29 mae: true

3:29 Licenser_: mae: is science mastrubating?

3:29 pd: if it's good science

3:30 Licenser_: heh

3:30 mae: lol

3:30 LauJensen: Mornin team

3:30 Licenser_: morning LauJensen

3:30 mae: but what i need, to make clojure rock, is a useful thing to create, for a real purpose

3:30 so that way i can find the bugs

3:30 and it is achieving something

3:30 Licenser_: there are no bugs, there are only feature

3:30 mae: until i have a real reason, it will be crap

3:30 this is my opinion

3:31 Licenser_: mae: clojure is so young that you still can write usefull tools/libs that contribute to the comunity

3:31 mae: Licenser_: spoken like a true glass-half full kind of guy :)

3:31 Licenser_: mae: I am :)

3:31 mae: Licenser_: yes, but I am not looking to write tools for fun, i am looking to write programs for money so i can feed my family :)

3:31 heh

3:31 Apage43: mae: just try and use clojure for the next thing you need to do

3:31 Licenser_: unless it comes to work related topics I am a hopeless optimist

3:31 mae: Licenser_: same here.

3:31 * Apage43 has a clj lying around i used to generate C code >.>

3:32 LauJensen: mae: So whats the problem? Get to it

3:32 mae: Apage43: i haven't done anything, thats the point, i haven't been using that skillset, i'm a sysadmin

3:32 LauJensen: heh, well thats why i'm here

3:32 Apage43: What kind of sysadmin?

3:32 mae: i'm looking for something useful to program

3:32 Licenser_: mae: technically I am a system integrator, still I write clojure code to optimize as much stuff as I can

3:32 mae: and someone with a bit of business sense

3:33 Licenser_: interesting

3:33 * Licenser_ has thousand things to rpogram that is usefull :P but no buisness sense here I love making my code open and free

3:33 Apage43: I threw this together at work to monitor the output of netstat | grep somehost | wc -l on a box without watch while researching a database load issue http://gist.github.com/368131

3:33 for example.

3:34 mae: mae: open and free and useful welcomes maintenance and evolution, but it doesn't lead to money. don't you want to do what love while making money? heh

3:34 so you have to find a money use in my opinion

3:34 LauJensen: mae: Just reading the log I'd really advice against offering free services

3:34 pd: mae: having your name attached to popular projects, even if only in a handful of commits fixing minor bugs is a big ++ in getting your next gig

3:35 mae: LauJensen: i guess i was going for a bait and switch :)

3:35 pd: open source doesn't pay but sometimes open source friends know people who do

3:35 mae: pd: really, does that work for you?

3:36 pd: it has, yes, and i've seen it work even better for people who, erm, "invest in the community" more than i do

3:36 mae: i have a few days when i could program

3:36 Licenser_: mae: I got a friend a job at my company because I worked with him before and truste dhim

3:36 mae: 5 days off from work, hanging out at home

3:36 starting saturday

3:36 pd: heh

3:36 pd: i guess i'm lazy

3:37 i know i can fix bugs but it doesn't seem glamourous

3:37 Apage43: in my experience.. you really can't just decide "I have time, so.. i'm going to come up with a kickass idea to program during that time/"

3:37 Licenser_: mae: I'm nut sure either lazy or smart :P

3:37 mae: i'm a bit of a premadonna in case you haven't noticed

3:37 but i'm a talented one

3:37 : )

3:37 Apage43: ideas don't manifest themselves under that kind of pressure for me

3:37 mae: <-- conceited

3:37 Apage43: *shrug*

3:37 mae: heh

3:37 yeah

3:37 well

3:37 Licenser_: but Apage43 I agre either you have a great idea or you don't

3:38 mae: for me to spend time i think it has to be "i'll pay you x for doing y" kind of thing, but just a small project, not lrage.

3:38 large *

3:38 i'll even do it dirt cheap

3:38 Apage43: mae: think about anyone you know that might be able to pay for for a project

3:38 mae: as long as the goals are concrete

3:38 Apage43: i see

3:39 Apage43: so feed off of someone elses creativity? that doesn't sound like a bad idea

3:39 Apage43: i for one just found out the place my roommate works might be willing to pay someone to replace some software they use (because it sucks).

3:39 not creativity leeching, the place happens to have a need that isn't adequately filled currently.

3:39 Just see if there's someone who's life you can make easier :]

3:39 pd: you could try door-to-door programming

3:40 mae: Apage43: market thineself?

3:40 Licenser_: mae: so seriousely I think this is the wrong place to look for a job for some reasons A) most people here do stuff for free that is cool B) not may people here use clojure for comercial stuff C)if someone is actuall looking for a coder they most likely won't know you and rahter hire someone who hands them some kind of portfolio

3:40 Apage43: mae: rather, network.

3:41 mae: Apage43: i think avoiding language zealotry is pretty much a solid requirement for doing stuff like that, i have to be a jack of all trades. i think i am still a zealot.

3:41 Apage43: i didn't ask around

3:41 people who know me know what i can do so when they hear that thing X needs doing they know I can do it.

3:42 mae: Apage43: that sounds like a good way to approach it

3:42 * Apage43 is also 19 and working as a programmer for a living

3:43 mae: Apage43: i guess i find it hard to find a target market in my town for advanced programming tasks, i know how to find ms access jobs, or other similar tarded platforms

3:43 Apage43: good for you

3:43 Apage43: not that i enjoy my day job >.>

3:44 mae: hehe

3:44 i think you could probably make it enjoyable

3:44 Apage43: yeah. corporate politics.

3:44 mae: my problem is i am underpaid for my position, and upward growth is hard right now

3:44 Apage43: i have alot of politics

3:44 Apage43: and an anomalous situation resulting in me being paid.. not very much at all for what i do.

3:45 I am.. probably more skilled than most folks I've met and paid the least.

3:45 mae: Apage43: i feel as if i am in a similar boat

3:45 i wouldn't believe it if you said it on twitter though

3:46 on irc i do believe it

3:46 Licenser_: is irc a more trustworthy medium? o.O

3:46 mae: well

3:47 lets just say the 'OG's of open source tend to be on irc

3:47 the flashy ruby crowd started the twitter thing :)

3:47 Licenser_: there are a lot of smart ruby folks

3:47 mae: yeah i know

3:47 just saying

3:48 Apage43: *shrug* stuff like me being the only person on the team who knows that FTP opens more than one connection in different directions and that the manner in which its failing points to a firewall issue and noone calling the firewall team for hours regardless of what I say

3:48 mae: i consider an irc'er to be of a higher pedigree than a twitter person

3:48 generally speaking of course

3:48 Apage43: lol1

3:48 the ftp thing is interesting

3:49 Apage43: or not believing me when I tell them the guy telling them to "recycle the ftp client service on your side" is bullshitting them and there isn't an "ftp client service" and he's trying to get them off the phone so he can go to lunch

3:49 mae: i am the only sysadmin out of 3 that has any real linux experience, and really understands networking

3:49 they for instance, couldn't even calculate a subnet mask to save their lives

3:50 Apage43: yeah. I finally get on the phone with our actual network guys and start talking at low level about the protocol the app in question uses and what it does and everyone's eyes glaze over and crap gets fixed and everybody's like "Yay!"

3:50 "I have no idea what you just said."

3:50 mae: haha

3:50 let me guess

3:50 "what port is it?"

3:51 Apage43: well this was a NAT issue so it was a bit more complex than that

3:51 mae: most people think that blocking certain ports will prevent certain services

3:51 http running on 80, for instance

3:51 anyone with half a brain knows thats not true

3:52 i think that computer professionals have started to fit on the bellcurve

3:52 there is os much demand that quality will vary alot

3:52 (for computer services, for example)

3:53 Apage43: on top of this I've programmed changes to some of our apps that literally saved 20hrs off the work week of several people. I've saved the company more money than they'll ever pay me =P

3:54 mae: so you get thrown in with interviewing against someone who is very below you in terms of real skill. its no comfort that skill rarely comes into play anyways, usually impressions and politics

3:54 yeah quantifying that stuff is hard sometimes

3:55 in any case, i am going to keep looking, suggestions welcomed

3:55 Apage43: fun fun, enjoy.

3:55 mae: and in the meantime i will continue to slay the business objects beast (now sap) daily

3:56 Apage43: *shudder*

3:56 we're undergoing a huge SAP upgrade right now

3:56 mae: fantastic!

4:33 vegai: what graphics libraries does clojure/java provide, for gaming purposes?

4:35 hoeck: vegai: clj-processing, a third party lib to processing

4:35 vegai: or use java gaming frameworks, eg. slick2d

4:36 vagai: clojures java interop features are so good, you often won't need a specific clojure wrapper for those java libs

4:37 vegai: aye

4:38 I've effectively avoided touching Java for a long time, so I'm a bit blind to whatever it provides

4:39 AWizzArd: vegai: maybe you want also have a look at http://github.com/ztellman/penumbra which allows you to access gpl, be it for display or complex and fast calculations on your video card.

4:39 hoeck: for very simple games, a use swing JPanel and its update method wich lets you draw directly via point, line etc methods

4:40 LauJensen: vegai: For Gaming you have 2 good options, 1) Penumbra, 2) JMoneyEngine, the latter being a complete gaming engine

4:43 eevar2: vegai: jogl, if you just want plain opengl drawing

4:47 LauJensen: or Slick2D, but I couldnt get any decent performance out of it

4:47 (I might be the problem in that case though =))

5:18 AWizzArd: Moin cemerick.

5:18 Was there some update yesterday, regarding auto constructors/factories for records?

5:20 cemerick: AWizzArd: :-)

5:20 It sounded like the status quo will hold for a little while.

5:21 AWizzArd: cemerick: I tend to like the idea to simply keep (Foo. ...) as the only constructor for 1.2 and then see how it is going to be used. And in 1.3 new stuff can be added if needed. Better than removing things later on.

5:22 cemerick: It certainly sounds like user-defined factory fns are in the works, but support for more than one per defrecord, so perhaps not a default /create, etc. *shrug*

5:24 Chousuke: hm

5:24 LauJensen: I didn't understand the objection to the c/create syntax - Is it because it would then replace the period sugar ?

5:24 Chousuke: why is it that when I'm writing an answer to a question on the group, by the time I post it several people have already posted theirs ;P

5:28 AWizzArd: cemerick: yes, in the end I am certain we will need user defined factories. Currently for all my deftypes I have a (defn make-foo [] ...).

5:28 And indeed, for some I have (defn (make-foo [a] ...) (make-foo [a b c] ...))

5:29 edbond: vimclojure problem: Could not determine the Namespace of the file. how to fix?

5:30 cemerick: Chousuke: I think that's the direction that the factory fns will come in. Otherwise, I figure, why not reuse Foo. and (new Foo ...)...

5:30 edbond: solved: CLASSPATH=src ~/vimclojure/bin/ng-server

5:30 AWizzArd: LauJensen: I thought Rich wanted a static method Foo/create so that this can be more than a mere class constructor, not be bound to Java constructors.

5:30 cemerick: or, I should say, Foo. is going to be there regardless, so why bother with another form for a simple ctor.

5:31 LauJensen: Simpler is better

5:31 licoresse: if I wanted to write (comp dec dec dec) using some sort of repeat, how to?

5:31 cemerick: LauJensen: ach, my last to Chousuke was for you ^^

5:31 it's too early

5:31 LauJensen: ah

5:31 AWizzArd: cemerick: yes, Foo. would be enough imo, when people are writing their make-foo's anyway

5:34 The most annoying thing about an auto-generated create-Foo would be that uppercase ‘F’.

5:34 cemerick: stuff like that is just the tip of the iceberg w.r.t. auto-generated fns IMO

5:35 AWizzArd: ;-)

5:35 LauJensen: Whats the deal with that. If you define some kind of class via Clojure, you then automatically get a fn called create-Class ? Seems so hacked together

5:36 cemerick: no, you don't

5:36 it's been proposed, though

5:36 AWizzArd: In the end it’s all aesthetics, because from a technical side there is no real problem. But then again, programming languages are there for aesthetics and not so much more. They help us because we humans are lousy programmers.

5:36 cemerick: it's not all aesthetics

5:36 LauJensen: AWizzArd: I must admit I cant see far enough into the future to predict if either model will produce problems

5:36 cemerick: if there's one way to create a thing in clojure, that's good

5:37 LauJensen: Agreed

5:37 AWizzArd: LauJensen: same here, so I propose to just keep it with Foo. for now, and then wait until 1.3 to decide if autogens are helpful.

5:37 LauJensen: After reading some Ruby code, I've really come to appreciate how all Python code looks so much the same

5:38 cemerick: If there's to be more than one, the others should be discoverable and different enough in functionality to warrant the distinction.

5:39 AWizzArd: And the question is, if create-Foo is auto-generated, what more can it offer than Foo.?

5:39 okay, can be used in (map create-Foo (bar))

5:40 But then I would still have to write my own (defn make-foo [a b] (create-Foo a (bar b)))

5:47 cemerick: do you know if it is possible to write print-dup output into a FileOutputStream into which I write java-serialized data, via ObjectOutputStreams .writeObject?

5:48 cemerick: you could probably do it, but it wouldn't be pretty

5:48 AWizzArd: Because I would like to serialize j.io.Serializable objects into there via .writeObject, but also put my defrecords into the same file, but there support print-dup.

5:48 cemerick: OIS and the reader can both read off one form at a time, and you could probably sniff for a leading # to determine clojure vs. java serialized forms

5:48 AWizzArd: i.e. one output file containing all serialized data

5:49 cemerick: seems like a painful, difficult path tho

5:49 LauJensen: OIS?

5:49 cemerick: ObjectInputStream

5:49 LauJensen: thx

5:49 AWizzArd: Or, I could have a Java class ClojureRecord with the fields recordType and serializedString and have those serialized?

5:51 then (.writeObject (ClojureRecord. (type my-rec) (with-out-str (binding [*print-dup* true] (print my-rec)))))

5:51 cemerick: yeah, you *could*. The whole thing is way over the line of being a custom database format tho.

5:52 AWizzArd: in fact i need this for a db format :-)

5:52 my soon-to-be-released Clojure DB

5:52 cemerick: oh, right, you write your own databases

5:53 IMO, all those options are going to be horribly slow and difficult to maintain.

5:53 Especially any time you're using the clojure reader to deserialize data, that's a slow, slow path.

5:54 LauJensen: really? Why

5:56 cemerick: In the simplest case, writing and reading a number as a string vs. using DataOutputStream et al. is slow.

5:56 there's just much, much more to do

5:57 LauJensen: Yea ok. And the Java strings are huge

5:57 AWizzArd: the C way is nice where one can just write out a sequence of bytes and read it back in and then have exactly the same object agani

5:58 cemerick: LauJensen: huge?

5:58 LauJensen: 2 bytes per char

5:58 AWizzArd: But in the end any kind of data needs to be mapped to some representation which can be mapped to that specific object

5:58 cemerick: right, UTF-16 internally. Welcome to an international world. :-)

5:59 LauJensen: you should appreciate that :-)

5:59 LauJensen: cemerick: Actually I dont , but I live with

5:59 it

5:59 cemerick: LauJensen: you'd rather have a multitude of slightly different encodings?

5:59 AWizzArd: I would appreciate that more if the primitive chars would be 4 bytes and can each represent any unicode char.

6:00 LauJensen: Danish is a vile language only surpassed by swedish, dutch and finnish which ads nothing good to the world. So I think we should just stick with English in the IT business :)

6:00 cemerick: AWizzArd: BMP's not wide enough? ;-)

6:00 ha

6:00 An American Imperialist in Denmark! :-D

6:01 LauJensen: cemerick: Dont get me wrong - I didn't say a single good thing about America, nor the language you stole :)

6:01 cemerick: Embrace and extend.

6:01 AWizzArd: cemerick: for the first version i need something simple and human-readable, even if it is performance wise not the fastest serialization/deserialization

6:02 cemerick: I should get my clj-dbm project out there. That might be interesting to some.

6:02 AWizzArd: Too bad that the US did not vote to have german as their primary language

6:02 There was this (probably wrong) rumor, than german lost only by 1 or 2 voices ;)

6:02 http://german.about.com/library/weekly/aa010820a.htm

6:02 sexpbot: German the Official US Language?

6:03 cemerick: that's funny

6:15 AWizzArd: I want: (foo Integer) ==> "java.lang.Integer"

6:15 ,(str Integer)

6:15 clojurebot: "class java.lang.Integer"

6:16 AWizzArd: for my own defrecord, producing the classname + ns

6:16 cemerick: ,(.getName Integer)

6:16 clojurebot: "java.lang.Integer"

6:16 AWizzArd: works, thanks

6:17 Although in the macro it looks like ~(.getName (eval type))

6:17 (my-macro Foo) ==> "user.Foo"

6:18 LauJensen: AWizzArd: if you're in Emacs, hit C-c I and type Integer, that'll give you a list of all its methods

6:18 (and statics and fields)

6:18 AWizzArd: LauJensen: good trick, thx

6:19 LauJensen: np

6:22 AWizzArd: is there a clojure functions which shows me all superclasses and interfaces of a given class/object?

6:23 ,(parents Integer)

6:23 clojurebot: #{:clojure.contrib.math/integer java.lang.Number :clojure.contrib.json.write/pr :clojure.contrib.pprint.examples.json/pr java.lang.Comparable}

6:23 AWizzArd: ok

6:23 LauJensen: That and ancestors might be of interest to you

6:24 AWizzArd: Oh good.

6:25 hoeck: ,(-> {} class supers)

6:25 clojurebot: #{clojure.lang.APersistentMap clojure.lang.IObj clojure.lang.IPersistentCollection java.lang.Iterable clojure.lang.Obj clojure.lang.AFn clojure.lang.Seqable clojure.lang.IEditableCollection clojure.lang.Counted clojure.lang.Associative java.util.Map java.lang.Object clojure.lang.IPersistentMap clojure.lang.IMeta java.util.concurrent.Callable java.io.Serializable clojure.lang.ILookup clojure.lang.IFn java.lang.Runnable}

6:25 LauJensen: Wow I cant believe my luck, this complete stranger just wrote "Dear friend, I wanted to transfer $12.000.000.000 to your country" and all he needs is a little money to get started! brb

6:25 hoeck: :)

6:34 AWizzArd: cemerick: btw, can Java only deserialize objects of Classes that were not dynamically produced?

6:34 I mean, is that the reason why defrecords need to be AOTed to be deserializable?

6:34 cemerick: it can only deserialize objects of classes that have stable names

6:35 AWizzArd: But defrecords now do have stable names I think.

6:35 cemerick: Yes, that's my impression as well.

6:35 AWizzArd: (defrecord Foo ...) always produces namespace.Foo

6:35 But this still can not be deserialized.

6:35 Rich said it must be AOTed first.

6:35 cemerick: the question is whether any inner classes and such have stable names too, which I doubt.

6:36 AWizzArd: ok

7:00 LauJensen: Brians Brain on the frontpage of Lambda-the-ultimative - It just lives on and on :)

7:29 AWizzArd: Maybe Contrib could provide an efficient and general way for serialization.

7:30 Something that can be added to classes that did not implement j.io.S, or records for which the author also didn't implement that interface or which can't be AOTed.

8:22 cemerick: could we have in 1.2 something else than print-dup, based on Protocols (vs. defmethod print-dup ..)?

8:22 Licenser_: (doc print-dup)

8:22 clojurebot: "; "

8:22 Licenser_: wow that is helpful :P

8:23 cemerick: print-dup is undocumented on purpose

8:23 AWizzArd: hmm

8:23 Licenser_: so noone uses it?

8:23 cemerick: it's really quite experimental, for all these reasons

8:23 no, it's used :-)

8:23 AWizzArd: but not encouraged

8:23 Licenser_: just noone knows what it does :P

8:23 cemerick: AWizzArd: yeah, that's possible. Likely not until/unless rhickey adds some kind of dispatch precedence to protocols, tho.

8:23 AWizzArd: Licenser_: you can use it via (binding [*print-dup* true] (print your-object)

8:24 Licenser_: hmm I am always thinking of how to improve the clojure documentation and I'm not entirely sure what the best way would be

8:24 AWizzArd: cemerick: what are the options? I thought it will dispatch on the type of the first arg? Maybe with Multiprotocols this would change.

8:24 cemerick: the options for what?

8:25 AWizzArd: for dispatch precedence?

8:25 cemerick: I'm definitely not the person to look at for that. Multimethods are pretty good in that area, though somewhat verbose.

8:26 The prefer mechanism can likely be grafted onto protocols, but I get the impression that there's an appetite for a better solution.

8:26 AWizzArd: They can dispatch on more than one arg, whereas Protocols support exactly one as I understand it.

8:27 * cemerick says confidently, as if he knows what's going on. :-P

8:27 AWizzArd: They ==> Multimethods

8:27 cemerick: right, multimethod dispatch is wide-open

8:27 they can dispatch on the phase of the moon if you want

8:27 AWizzArd: They are nearly as nice/powerful as Pattern Matching :)

8:27 Licenser_: wooh that would be kind of cool

8:27 you could implement a wear wolf with that

8:28 or a wear app

8:28 cemerick: (defmulti craziness (fn [& args] (if (= :full (phase-of-moon)) :do-this :do-that)))

8:28 ^^ not meant as a joke, you could do it

8:30 Licenser_: cemerick: I figure

9:07 AWizzArd: Can records now get type hinted? (defrecord Foo [x]) ... (defn bar [#^Foo f] ...)

9:26 cemerick: AWizzArd: I would think so.

9:30 licoresse: What is defrecord for?

9:31 ,(doc defrecord)

9:31 clojurebot: excusez-moi

9:32 chouser: licoresse: It's a cross between defstruct and deftype

9:36 licoresse: ok

9:46 AWizzArd: Btw, could Contrib need for 1.2 a general revision from Multimethods to Protocols?

9:46 (and Core maybe too)

9:47 LauJensen: I'd say absolutely - There's already a lot of code which looks really old

9:48 chouser: AWizzArd: for what, print-method and print-dup I guess?

9:48 AWizzArd: chouser: exactly those I had in mind.

9:49 Oh, one thing I would love to see included for this guideline on how to write code for Contrib: “Have (set! *warn-on-reflection* true) in every file.”

9:50 Chousuke: Hm, I wonder if making print-method a protocol would solve the problem of re-evaluating core.clj during runtime? :/

9:50 if you try to do it currently it blows up because print-method gets redefined and loses all the defined methods

9:50 chouser: AWizzArd: that actually came up already, in the "coding standards" thread, and got beat back. Thankfully.

9:51 Chousuke: it could be in a comment though, just to remind people ;P

9:51 AWizzArd: chouser: is there a list pro/con for that?

9:52 Raynes: Has sexpbot been good whilst I slept? :>

9:52 chouser: AWizzArd: you really want every single var and local typehinted?

9:54 AWizzArd: I am personally trying to type-hint as much as possible

9:54 Chousuke: actually *changing* the value of *warn-on-reflection* in library code would be rude

9:55 AWizzArd: Well, it could be set to true only before compilation then, to make the author(s) aware of reflection warnings.

9:55 chouser: I try to type-hint as

9:55 Chousuke: that might be useful

9:55 AWizzArd: Probably maven can do that automatically ;-)

9:56 chouser: I try to type-hint as little as possible

9:57 AWizzArd: type-hinting does not reduce productivity, can (potentially) be switched invisible with your editor, can be used by automatic documentation tools and may become useful in the future, for optional typing in Clojure.

9:57 Chousuke: well, getting rid of reflection in library code is a good thing

9:57 even if it is in a function that is not a bottleneck

9:58 chouser: it is ugly, hosty, and can pin things to specific type unnecessarily

9:58 Chousuke: "hosty" :P

9:59 AWizzArd: ugly: editor-switch to invisible, hosty: needs to be tuned for the specific plattform, because it should help right there. Pinning things unnecessarily can always happen if people don't know what they are doing.

10:00 On the other hand it is providing the host with more information. You are communicating to the compiler what your spec is and what you want.

10:00 cemerick: is it hard to turn on reflection warnings when one cares to see them?

10:01 * cemerick won't bring up easy maven configuration. Seriously.

10:01 LauJensen: cemerick: You mean those cute 38 (!!!) lines from your video ?

10:02 cemerick: LauJensen: I said I wasn't going to bring it up. ;-)

10:02 oh, can other people see those /me msgs? :-D

10:03 AWizzArd: chouser: if contrib uses libs of the underlying host to replace low-level stuff with functional beauty, then the .clj file can't get more hosty than that. Such code would not run under .NET anyway.

10:03 LauJensen: Oh thats right... I just pains me when people say "I'm cant ever learn Clojure, there's just too much XML" and I'm like "what? You're thinking of Chas Emerick, he's into Maven, thats not Clojure".. "Oh okay, but I just hate the fact that I have to install this huge bloated 350 MB Netbeans IDE to use it", and Im like "what?? Dont be scared, just use Emacs" :)

10:03 AWizzArd: When people use host-specific methods, then why shouldn't do hosty communication?

10:04 LauJensen: ~google define: hosty

10:04 clojurebot: First, out of results is:

10:04 zmila: just install 299MB Eclipse! :)

10:05 AWizzArd: technomancy: how difficult would it be to have a visible/invisible switch for type hints in clojure-mode? ^^

10:10 Raynes: "I'm installing Eclipse because Emacs is bloated." - Some guy, somewhere on the internet.

10:11 LauJensen: The google Ajax API doesn't support define: or math.

10:16 rsynnott: Hmm, I've a system with a large number of interlinked objects in-memory. I'd like to be able to take periodic snapshots of this state and be able to reload from this in case of the application crashing. What approach would people use for tih?

10:20 chouser: rsynnott: make sure they're all in refs, then in a transaction deref them all and pass them outside the transaction where you can write them to disk

10:21 AWizzArd: rsynnott: or wait 2-3 weeks until I release my Clojure DB :-)

10:23 chouser: LauJensen: now you're getting it.

10:23 LauJensen: chouser: I somehow knew that would catch your attention :)

10:25 AWizzArd: Anyone here using Cells?

10:25 LauJensen: AWizzArd: And if so, would they please write a little tutorial

10:25 Raynes: +1

10:26 Considering I have no clue what 'cells' are in this context.

10:26 ;)

10:26 YamNad: ohai

10:26 YamNad: Hi.

10:26 AWizzArd: I have a little problem now that I am using the new version http://gist.github.com/306174 - so far I placed in my .clj file after the (ns ..) declarations a (load-file (str (File. (.getParentFile (File. #^String *file*)) "cells.clj")))

10:27 But this outputs now ‘java.lang.ClassNotFoundException: user.Editable (cells.clj:20)’

10:27 If I start a fresh repl and load the file manually I don’t get this warning. And after doing so I can also compile my code without warnings.

10:28 Just when I start a repl and try to compile my code the first time. A direct second recompile works fine then.

10:31 licoresse: Does it matter what order the namespaces appear in :require?

10:32 Chousuke: it shouldn't

10:32 cemerick: it does if the namespaces are doing stateful, interdependent things.

10:32 Chousuke: ie. if they're broken ;

10:32 P

10:32 licoresse: right...

10:32 Chousuke: like my smiley there

10:38 rsynnott: chouser: ah, yes, that's sort of obvious :) Thanks

10:38 AWizzArd: what is the nature of your clojure DB? :)

10:38 chouser: I'm all about the obvious answers.

10:39 slyphon: technomancy: hey, if i'm using a particular jar for lein-swank "lein-swank-1.2.0-20100308.145053-2.jar" and i want to lock my project to that particular version, is there a way to do that?

10:40 AWizzArd: one sec, about my load-file problem here: http://pastie.org/923220

10:40 * slyphon is having classloader issues on linux that he didn't have on mac-os

10:40 AWizzArd: If somebody could please have a look at this and point out a way how to load the cells.clj without triggering this warning.

10:41 If you already have a fresh build of master, including defrecord then it is basically just putting my foo.clj into some dir, as well as cells.clj and try to compile it.

10:42 LauJensen: AWizzArd: You should check out gist.el

11:00 Raynes: Aw. You can't merge into defrecords. :(

11:01 AWizzArd: What would you like to do?

11:01 Raynes: (merge (Stfu. 3 3) {}), essentially.

11:03 stuartsierra: Raynes: 'into' might work

11:03 Raynes: stuartsierra: Ooh, good idea.

11:03 stuartsierra: That did it. :D

11:04 I'm trying to avoid changing as much code in sexpbot as possible, while converting it to my own IRC library, which uses a defrecord.

11:12 whidden: Is there a practical limit on the number of functions 'comp will work with?

11:12 AWizzArd: no

11:13 stuartsierra: in a single invocation, yes

11:13 probably the JVM method size limit

11:13 unless it's recursive

11:13 so no

11:14 * whidden rubs his hands with maniacal glee

11:14 stuartsierra: But eventually your stack traces will look like fn__1234$fn__2345$fn__3456$...

11:15 whidden: yes, but that's ok for me at the momemt.

11:16 because i hardly never make errors.

11:16 stuartsierra: heh

11:17 Chousuke: hmm

11:17 ,(apply comp (repeat 10000 +))

11:17 clojurebot: #<core$comp__4952$fn__4971 clojure.core$comp__4952$fn__4971@e4cde8>

11:17 stuartsierra: ((apply comp (repeat 10000 +)) 1)

11:18 ,((apply comp (repeat 10000 +)) 1)

11:18 clojurebot: 1

11:18 stuartsierra: wow

11:18 Chousuke: comp doesn't actually create a new function

11:18 stuartsierra: ,((apply comp (repeat 10000 inc)) 1)

11:18 Chousuke: a new class, that is

11:18 stuartsierra: extra space

11:18 ,((apply comp (repeat 10000 inc)) 1)

11:18 clojurebot: 10001

11:19 stuartsierra: ah

11:19 whidden: ,(time ((apply comp (repeat 10000 inc)) 1))

11:19 clojurebot: 10001

11:19 "Elapsed time: 27.01 msecs"

11:19 stuartsierra: So comp with 10000 args doesn't create 10000 fns.

11:19 It just creates 1 fn that calls the 10000 fns in order?

11:20 Chousuke: yes. comp only creates a closure of an existing function that composes its parameter functions

11:20 stuartsierra: ok

11:20 I guess you'd overflow the stack otherwise.

11:20 Chousuke: in general, only a (fn ...) form in code actually creates a new class

11:21 stuartsierra: right

11:21 Chousuke: any function returning functions won't generate classes, but instances of a single class

11:22 stuartsierra: Right, only one class per *literal* (fn...). I always forget that.

11:25 AWizzArd: hmm, did Cells change recently?

11:25 Such that a LockCell does not have a lock anymore? ;)

11:31 yup, a little bug

11:32 The-Kenny: test

11:32 AWizzArd: Hi The.

11:33 The-Kenny: huh, sorry. Erc said my connection was closed.

11:33 Hi, AWizzArd :)

11:41 LauJensen: The-Kenny: Odd - I had a disconnect with ERC about an hour ago which stalled Emacs

12:14 sergey_miryanov: ,{:keys [x] {:x 1}}

12:14 clojurebot: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 3

12:15 sergey_miryanov: hi all

12:15 somebody can explain what wrongs with {:keys [x] {:x 1}}?

12:17 carkh: hum you're mixing stuff

12:17 (let [{:keys [a]} {:a 1 :b 2}] a)

12:17 ,(let [{:keys [a]} {:a 1 :b 2}] a)

12:17 clojurebot: 1

12:18 carkh: {:keys [a]} <- this is a destructuring pattern

12:18 {:a 1 :b 2} <- this is literal map syntax

12:19 destructuring patterns go in binding forms like a let or maybe a doseq

12:19 or the parameter list of a function

12:20 sergey_miryanov: o! thanks! you get me a point - I just typo {:keys [x] {:x 1}} -> should be -> {:keys [x]} {:x 1}

12:20 carkh: ah =)

12:20 sergey_miryanov: *i should go sleep* -_-

12:21 thanks in any case! :)

12:21 carkh: =)

12:30 AWizzArd: rhickey offline to code without interruptions? ^^

12:32 mtm: I get the strangest feeling that 1.2 is imminent (but maybe that's just the 4 shots of espresso I drank this morning talking...)

12:42 AWizzArd: Uh, 1981, a 1gb hd from ibm: http://img147.imagevenue.com/aAfkjfp01fo1i-5704/loc54/66568_1gb_hard_disk_ibm_1981_122_54lo.jpg

12:46 Ah, there he is :)

12:46 wb rhickey

12:47 rhickey: hey

12:47 everyone rockin' with defrecord?

12:48 AWizzArd: absolutely

12:48 Today i rearranged my code to use it everywhere.

12:48 But btw, I don’t know if it is related, I may have discovered a little bug in Cells.

12:49 If you (load-file "/path/cells.clj" and then do this in the repl, what do you get? (:lock (LockCell. (java.util.concurrent.locks.ReentrantLock.) 1 2))

12:52 For me this results in nil. May have to do with deftype and the use of :lock as an accessor? *shrugs*

12:52 When I use cell-sentry instead of :lock as accessor, then I get the lock. There are seven places where :lock is used in cells.clj. After I changed them to (cell-sentry cell) my code was working again.

12:52 LauJensen: Can somebody link some help explanation+example of defrecord please?

12:52 AWizzArd: LauJensen: very similar to defstruct

12:53 LauJensen: How far can you stretch 'very' ?

12:53 AWizzArd: just more efficient

13:10 slyphon: the icicles completion guy is scary

13:12 timcharper: slyphon: Drew?

13:14 slyphon: yeah

13:14 dude has thought *way* too much about completion

13:14 timcharper: slyphon: hah

13:15 slyphon: the sheer volume of documentation on emacswiki is humbling

13:15 carkh: is icicles bette rthan ido-mode ?

13:15 slyphon: ehhh

13:15 i'm still debating that

13:15 i think ido-mode for buffers is probably better

13:16 AWizzArd: rhickey: can you confirm that? (:lock (locked-cell 100)) ==> nil

13:16 timcharper: slyphon: when the way to install icicles was downloading code off of pages from a wiki, I stopped there.

13:16 slyphon: timcharper: :)

13:16 yeah, i remember those days

13:30 hamza: (- (complex -1.0 -1.0) (complex -0.9 -0.9)) throwing java.lang.ClassCastException: clojure.lang.PersistentStructMap cannot be cast to java.lang.Number is this a bug this used to work?

13:30 _brian2_: noob question> what is idiomatic way of defining a function that has variable states for a map like this (map f(state1) ... ?

13:31 jonasen: Is this a bug in defrecord or am I doing something wrong? http://paste.lisp.org/display/97880

13:31 carkh: _brian2_: can you expand a little bit on your qustion ?

13:31 dakrone: _brian2_: what do you mean by a function having variable states for a map?

13:34 _brian2_: well a simple example f(state1 ) (+ 1 %) , f (state1 (+ 2 %)

13:34 sorry state2

13:34 f(state2 (+ 2 %))

13:36 isn't that an fp trait ?

13:36 carkh: you mean something like this ? (map #(%1 some-value) [f1 f2 f3])

13:36 dakrone: still not getting what you're trying to do

13:37 _brian2_: well, its a function whose behaviour is conditioned by state

13:38 sh10151: what you have there is not conditioned by state

13:38 it's conditioned by a variable

13:38 _brian2_: yes

13:39 but im trying to segregate the variables

13:39 to make the code easier to read

13:39 sh10151: (map (fn [x] ((make-function state1) x)) xs)

13:40 _brian2_: ok

13:40 weissj: _brian2_: i'm not sure how what you want is any different than a fn that takes an argument

13:40 sh10151: or (let [f (make-function state1)] (map f xs))

13:40 weissj: oh i see

13:41 sh10151: (doseq [f (map #(make-function %) [state1 state2 state3])] (map f xs))

13:41 _brian2_: ok

13:41 carkh: ,(let [adder (fn [x] #(+ x %))] (map (adder 2) [1 2 3])) ;the cannonical example

13:41 clojurebot: (3 4 5)

13:41 _brian2_: yea

13:42 Chousuke: sh10151: note: #(make-function %) is equivalent to make-function

13:42 unless of course make-function is a macro

13:43 sh10151: Chousuke: hehe, thanks :)

13:43 Chousuke: i almost wrote the same out for (map f xs)

13:43 _brian2_: thnks

13:45 Chousuke: small things can improve code readability quite a bit

13:46 I had to learn out of the habit of typing #(foo %) all the time too :P

13:46 I think I use partial and comp more as a result, but #() has its place.

13:47 one just needs to be careful not to overuse it and make the code look like perl

13:48 carkh: ok just for Chousuke :

13:48 ,(map (partial + 2) [1 2 3])

13:48 clojurebot: (3 4 5)

13:48 Chousuke: heh

13:49 carkh: i think it's harder to understand for a new user

13:49 Chousuke: I think (partial + 2) is easy enough

13:49 any new user will just read partial's docstring and get it right away

13:49 weissj: i had a lot of trouble wrapping my head around partial at first

13:50 carkh: you'll find yourself having to explain it in terms of lambdas

13:50 weissj: Chousuke: i read the docstring and said "what??" read it again.. and again

13:50 i get it now, but it's not an easy thing for a noob

13:50 Chousuke: I've seen much worse point-free expressions in Clojure. Those are the mind-benders

13:51 I think one contained at least 4 partials and 3 comps

13:51 carkh: you can go quite far with those update-in things too

13:51 always a pleasure =)

13:52 Chousuke: (doc partial)

13:52 clojurebot: "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args."

13:53 Chousuke: hmm, I suppose that isn't so clear if you're not yet used to thinking about functions as values

13:54 * nipra_ had a hard time understanding -> and ->>

13:55 Chousuke: heh

13:55 I guess those require a basic understanding of what a form is.

13:56 so that the docstring makes any sense... "if form blah isn't a list, it is wrapped in a list" makes no sense in most programming languages :)

14:00 nipra_: Chousuke, That was the exact part of the doc that took time for me to grasp. Anyway.. I find both of them very useful. :-)

14:05 chouser: Why is javax.xml.parsers.SAXParserFactory producing a SAXParser that generates events for non-existent HTML and HEAD tags?

14:09 ,(-> (javax.xml.parsers.SAXParserFactory/newInstance) .newSAXParser (.parse (java.io.ByteArrayInputStream. (.getBytes "<foo>bar</foo>")) (proxy [org.xml.sax.helpers.DefaultHandler] [] (startElement [_ _ n _] (prn n)))))

14:09 clojurebot: java.lang.RuntimeException: java.lang.IllegalStateException: Var null/null is unbound.

14:09 chouser: huh

14:10 fogus: ,64r1

14:10 clojurebot: Radix out of range

14:10 fogus: Did that ever work?

14:12 jonasen: I asked this earlier but didn't get an answer then, maybe someone can help me now..

14:12 chouser: hm. I don't think so -- always case-insensitive? so tops out at 32

14:12 36

14:13 jonasen: Is this a bug in defrecord or am I doing something wrong? http://paste.lisp.org/display/97880

14:13 chouser: jonasen: defrecord will behave like a map, so 'count' is already implemented to give the number of key/value pairs it's holding.

14:14 jonasen: if you want to define a type that has its own logic for what 'count' means, that's exactly when you want to use deftype instead of defrecord

14:14 jonasen: @chouser: ok, thanks

14:17 timcharper: So, I have this monkey patch that makes the closure test library use clj-stacktrace for errors.

14:17 http://pastie.org/923567

14:17 However, when I try to load files that reference this under Swank-Clojure, I get an error message:

14:18 _brian2_: sorry, this is my last question, which is my real question is how to use a multimethod in a map (ie this is a syntax question), ie is this ok? (defmethod count-cat [:toys] [category] [var] ( do .. (find all instances of toys var hashes and do something)))

14:18 timcharper: http://pastie.org/923569

14:18 clojure.test$report__59 cannot be cast to clojure.lang.MultiFn

14:19 technomancy: timcharper: clojure-test-mode rebinds report IIRC. if you want to use your hack with swank-clojure you might have to disable or hack clojure-test-mode

14:19 timcharper: Is there an easy way to tell instead of closure if the application is running under Swank-Clojure?

14:20 technomancy: as in emacs clojure-test-mode ?

14:20 emacs is not failing here

14:21 the Clojure process fails because of some environmental difference induced by swank-server (it seems)

14:21 technomancy: c-t-m has to hack clojure.test in order to get pass/fail stats

14:21 it's not because of swank-clojure

14:21 AWizzArd: ~seen jcowan

14:21 clojurebot: jcowan was last seen parting #clojure, 5125 minutes ago

14:21 timcharper: technomancy: oh... okay, so it actually hacks the running Clojure instance?

14:22 technomancy: I think I would just prefer to conditionally disable my active running from within clojure-test-mode (if that's the case)

14:22 ^my active^my patch from

14:23 fogus: @chouser: Thanks!

14:24 cemerick: chouser: I wonder if that condition could be detected and warned about with a better message.

14:24 That'll become a FAQ pretty quick otherwise, I'll bet.

14:32 timcharper: technomancy: is there some way I can check to see if clojure-test-mode extensions have been loaded from within Clojure?

14:39 chouser: can anyone answer my xml question?

14:42 vegai: fogus: oh, you noticed my nitpicks #2 :P

14:43 fogus: are these typo/style suggestions helpful to you?

14:44 _brian2_: noob question> how do I correctly call a multimethod in a map : http://clojure.pastebin.com/8KHgdMMY

14:45 technomancy: timcharper: I don't know of a way other than wrapping your defmethod in try/catch; sorry

14:46 c-t-m is a little haphazard; it could definitely be better-behaved

14:46 oh, you could test for the presence of the clojure.test/old-report var; that would d oit.

14:50 timcharper: technomancy: that'd work (I don't know I didn't think about that)

14:50 (wrapping it)

14:52 AWizzArd: technomancy: how difficult would it be to have a visible/invisible switch for type hints in clojure-mode? ^^

14:54 technomancy: AWizzArd: I don't think it'd be too hard. I'm not too familiar with the necessary APIs, but I know they exist.

14:54 cool idea

14:55 LauJensen: technomancy: Is there some kind of folding in cm now ?

14:56 technomancy: nothing yet

14:56 LauJensen: Must be something from CL that we can loot :)

15:02 _brian2_: can someone tell me if you can call a multimethod in a map? ie, this doesn't work http://clojure.pastebin.com/8KHgdMMY

15:03 timcharper: technomancy: the try/catch trick worked, all are happy now. Thank you!

15:04 technomancy: ^5

15:04 would love to see that in action

15:04 dnolen: _brian2_: you put a multimethod into a map?

15:05 _brian2_: yes, is that possible ?

15:05 or plain wrong

15:11 arohner: _brian2_: you can call multimethods from a map, though your syntax is wrong

15:11 I don't know how to fix it because I don't know what you want to happen

15:11 (map #(cc {:category :toys} %) [ 1 2]) is closest to working

15:11 though that (inc v) won't work

15:12 nm, what I wrote should work

15:12 _brian2_: ok, thnks I need to take a look

15:13 Chousuke: it looks like you're trying to call functions using foo(bar) syntax :/

15:14 _brian2_: arohner> "(inc v) won't work", what will?

15:14 Bendlas: hi folks

15:14 has there been anything done on clojurescript lately?

15:15 LauJensen: Bendlas: Not that I know of, but recently a similar lib named Scripjure was put on Github I believe

15:16 arohner: _brian2_: actually, (map #(cc {:category :toys} % ) [1 2])

15:16 produc

15:16 produces (2 3)

15:16 _brian2_: is that what you want?

15:16 _brian2_: oh, ok

15:16 arohner: Bendlas: there's http://github.com/arohner/scriptjure

15:16 Bendlas: LauJensen, thanks, that looks interesting

15:16 arohner: http://arohner.blogspot.com/

15:16 sexpbot: "/dev/rohner"

15:16 arohner: I mean

15:16 http://arohner.blogspot.com/2010/04/writing-jquery-code-with-scriptjure.html

15:16 sexpbot: "/dev/rohner: Writing JQuery code with Scriptjure"

15:18 Bendlas: I wrote something very similar last night, but wanted to investigate before putting more work in

15:19 arohner, that seems very much like what i was looking for

15:20 arohner: Bendlas: great

15:26 dnolen: _brian2_: sorry, yeah, keep fns out of maps

16:05 timcharper: the error screens in slime are driving me nuts. Is there any way to make it so errors just appear in the mini buffer instead of switching my focus to a new split?

16:06 (when I evaluate Clojure code via c-c c-r, or use repl in swank-clojure)

16:14 licoresse: timcharper: yeah, that IS annoying

16:14 growl support would be nice, if you are on a mac

16:15 I guess there is growl for win as well

16:15 http://www.emacswiki.org/cgi-bin/wiki/growl.el

16:15 timcharper: licoresse: yeah, anything that doesn't take your focus away so when you resume typing you're like "what the heck?"

16:16 licoresse: for the small messages, I would like it to pop up afloat and not stealing focus

16:21 this one seem more up-to-date: http://github.com/elim/emacs-growl/blob/master/growl.el

16:22 timcharper: The trick is tracking down where the function sldb-get-buffer is called

16:37 licoresse: extract the notes from slime-compilation-finished in slime.el

16:37 and growl the extraction

16:43 timcharper: licoresse: I can't tell where the debug window is being allocated and focused though, can you?

16:44 licoresse: yes

16:44 brb

16:44 timcharper: allocated, sldb-get-buffer

16:44 But where is it focused?

16:45 licoresse: the fouus thing is a pref

16:45 at my system, the frame is just divided

16:45 timcharper: Which pref? (Here too)

16:45 licoresse: but focus does not shift, M-x apropos compiler notes

16:46 timcharper: focus shifts here

16:46 :S

16:46 on slime 20091016

17:02 a_strange_guy: hi there

17:02 can somebody help me with my swank-clojure problems?

17:03 after compiling the latest clojure from git

17:04 i get a "java.lang.ClassNotFoundException: clojure.main" when starting up slime

17:05 using the jar normally with java -jar works

17:05 hiredman: that means your clojure.jar is not on the classpath of the jvm that slime is trying to start

17:06 a_strange_guy: that is strange

17:06 is there any way to find out the classpath which swank-clojure passes to the jvm?

17:06 some variable in emacs?

17:08 technomancy: a_strange_guy: have you tried the instructions in the swank-clojure readme? there are several ways to launch a session.

17:08 Bendlas: swank-clojure-classpath

17:12 a_strange_guy: ah found the reason

17:12 swank-clojure-jar-home got unset somehow

17:12 bozhidar: anybode knows the criteria on which some core functions are marked as built-ins in clojure-mode, where other aren't?

17:12 a_strange_guy: thx anyway

17:12 bozhidar: http://paste.lisp.org/display/97895

17:13 I cannot understand why even? is there, but odd? isn't

17:13 a_strange_guy: bozhidar: there is a big list of clojure functions in clojure-mode.el

17:13 bozhidar: a_strange_guy: I know how big the list is - I'm looking at it :-)

17:13 but it should be a lot bigger IMO

17:14 otherwise the font locking seems non uniform

17:14 a_strange_guy: there was a post by Lau Jensen in his blog on how to scrape the api page for functions to add

17:17 unlink: hi

17:17 Is anyone using Clojure to trade with Interactive Brokers?

17:19 bozhidar: a_strange_guy: I found the post and while it presents a workaround it doesn't offer an explanation

17:19 about what insight made the developers include only those particular functions

17:20 I can easily alter the mode myself, but I'm curious as to the current state of affairs and what led to it...

17:20 a_strange_guy: probaply it's a hassle to keep the list up to date

17:20 and ccorrect with the latest versions of clojure

17:21 as long it doesn't interface with slime, it will miss some functions

17:24 AWizzArd: rhickey: did you get my messages about Cells from 5 hours ago?

17:24 bozhidar: a_strange_guy: certainly

17:25 I hope that one day will get the same level of slime integration for Clojure that exists today for CL

17:25 clojure + slime have come a long way, but I still envy the CL guys for some stuff

17:26 The-Kenny: Yeah, me too. Debugging and stuff like list-callees is very nice

17:27 scottj: unlink: nope, but I've thought about it and talked to another person that was thinking about it. If you write a wrapper and open source it I'm sure it would be of interest to others

17:28 technomancy: bozhidar: I can think of one great way to make that happen... =)

17:29 bozhidar: technomancy: me coding less Java and more Emacs Lisp I presume ;-)

17:29 a_strange_guy: well the problem is that clojure-mode and swank-clojure are distinct

17:32 unlink: scottj: Yeah I'm pretty sure I am going to.

17:34 bozhidar: a_strange_guy: even with common lisp - swank and lisp-mode are separate

17:34 and I find this reasonable

17:34 you have access to slime-complete-symbol from lisp/clojure buffers

17:35 it would have been nicer is something like that is used to generate dynamically the list of symbols to font lock

17:36 I might try to conjure something up after I'm done with my current projects...

17:36 mabes: Could someone explain what "clojure.lang.RT" does here? (let [entry (. clojure.lang.RT (find map (first keys)))]

17:37 ^ taken from (source select-keys)

17:37 Raynes: http://spikeypillow.com/2010/04/what-programming-languages-are-people-learning/ "There might be a lot of hype about languages like Clojure, Scala and Smalltalk but the numbers show there just are not that many people picking them up."

17:37 sexpbot: "Hello World: Which programming languages are people learning? - Spikey Pillow"

17:37 lancepantz: that's absurd

17:37 Raynes: I'm sure that's why over 400 people signed up for the Clojure course at rubylearning.

17:37 lancepantz: he's comparing clojure to smalltalk?

17:38 Raynes: lancepantz: He has a graph.

17:38 bozhidar: Raynes: don't you find it amusing that rubylearning are doing a clojure course? :-)

17:39 Raynes: Apparently, according to his graph, more people are picking up Forth and Fortran than Clojure.

17:39 bozhidar: Indeed. It's beautiful.

17:40 bozhidar: there is this massive switch to clojure from ruby that I've noticed

17:40 I guess that Rails really played them a bad joke...

17:40 Raynes: Parens are all the rave these days.

17:40 hiredman: the seattle clojure group has a lot of pythonistas

17:40 clojurebot: clojure is not groovy

17:40 Raynes: The truth.

17:40 He speaks it.

17:40 bozhidar: Raynes: parens have been the rave for the last 50 years :)

17:41 lancepantz: bozhidar: i've notices the same re: ruby->clojure

17:41 it's the path i'm coming down

17:41 bozhidar: lancepantz: me too

17:41 lancepantz: we've convinced my boss to migrate all of our backend to clojure

17:41 bozhidar: but I have to admit that before ruby I was fond of Common Lisp

17:41 mabes: lancepantz, bozhidar: same, but I think that says more about the ruby community than anything else.. (early adopters)

17:41 Raynes: I believe technomancy is/was a Ruby guy as well.

17:41 Chousuke: mabes: clojure.lang.RT is a class that contains many static methods used by clojure.core

17:42 bozhidar: I like the language, but there weren't that good deployment options for CL apps

17:42 clojure changed that...

17:42 lancepantz: we basically realized there was nothing we could do to make our ruby backend faster... in ruby

17:42 mabes: Chousuke: Why is it being used in that context though? It seems like the select-keys would work fine with just (find map (first keys)).

17:42 lancepantz: some of our early benchmarks have clojure 100x faster

17:43 Chousuke: mabes: find is not a clojure function

17:43 lancepantz: there's also some db changes, but still

17:43 bozhidar: lancepantz: I also disliked a little the overly frivolous syntax - it seemed to me it added some unneeded complexity

17:43 mabes: ,(doc find)

17:43 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

17:43 Chousuke: oh, it is? heh

17:44 maybe it's newer than select-keys :/

17:44 mabes: Chousuke: ok, I suspected it could be cruft, thanks

17:44 lancepantz: bozhidar: well and as you try to implement more complex features that all work together you end up with a huge abstracted mess

17:45 Chousuke: does anyone actually use that find function?

17:45 AWizzArd: ,(find {:a 1, :b 1} 1)

17:45 clojurebot: nil

17:45 bozhidar: lancepantz: indeed

17:45 Raynes: (doc find)

17:45 clojurebot: "([map key]); Returns the map entry for key, or nil if key not present."

17:45 Chousuke: get and map-as-fn make it kind of irrelevant

17:45 AWizzArd: ,(find {:a 1, :b 1} :b)

17:45 clojurebot: [:b 1]

17:45 mabes: ,(source find)

17:45 clojurebot: Source not found

17:45 Raynes: ~def find

17:45 mabes: Well, this is the source: map key] (. clojure.lang.RT (find map key)))

17:45 Chousuke: ah, right, it returns the entry.

17:46 AWizzArd: Raynes is our bot operator :-)

17:46 Raynes: :p

17:46 mabes: Too bad tinyurl broke

17:48 Raynes: mabes: That's why sexpbot uses bit.ly. :>

17:49 Sadly, it doesn't have the definition lookup stuff.

17:49 :\

17:49 But! It has walton.

17:49 $walton doseq

17:49 sexpbot: Raynes: http://getclojure.org:8080/examples/doseq

17:49 mabes: ah, very nice

17:50 Raynes: defn: <3

17:53 mabes: Raynes: where does sexpbot's code live?

17:53 remleduff: Is the "id" attribute not supposed to be unique? I'm looking at the walton page source and it has <div id="post"> for every post. Wish they'd get out from port 8080 so I could use the site at work :\

17:53 mabes: Raynes-: : where does sexpbot's code live?

17:55 Raynes: mabes: Sorry about that.

17:55 Wouldn't let me send.

17:55 * Raynes shakes his fist at freenode.

17:55 Raynes: mabes: It's http://github.com/Raynes/sexpbot

17:57 mabes: nice, thanks

18:02 defn: hehe Raynes :)

18:03 * defn realizes he is going to have to fix the doseq examples page soon

18:07 Bendlas: /j #clojure-casual

18:59 can you tell me the reason why `java -cp classes/ clojure.main` won't work, when `java -cp clojure.jar clojure.main` does?

19:00 fails with java.lang.ExceptionInInitializerError caused by a NullPointerException

19:09 cemerick: is there anyone maintaining a clojure 1.2-compatible compojure 0.3.2 branch?

19:45 shales: maven just downloaded a new clojure-contrib 1.2.0-SNAPSHOT and I'm getting this error Could not locate clojure/contrib/duck_streams__init.class or clojure/contrib/duck_streams.clj on classpath:

19:46 sure enough, I don't see anything in the clojure-contrib.jar for duck_streams. Anyone seeing this error too?

19:47 remleduff: Sounds like you need to use clojure.contrib.io instead (it moved)

19:47 But you must have been on a really old 1.2.0 snapshot

19:47 shales: I'm not using duck_streams anywhere that I know of though

19:48 Raynes: shales: A library you depend on might be trying to use it. Check the stacktrace and see if it talks about a file in a jar you're depending on.

19:48 shales: I ended up having to update 3 different projects to use Clojure 1.2 yesterday to update sexpbot to Clojure 1.2.

19:49 shales: oh, good point. I'll check the other libraries

19:51 hmm, I'm using the latest version of the libs that are on clojars, but that might not be good enough

20:33 slyphon: is it possible that the classloader would behave differently on linux and mac os-x when stuff is being loaded through slime

20:33 ?

20:33 https://gist.github.com/a3a4516a79c4ce0fe109

20:34 lancepantz: anyone know how github computes their language popularity lists?

20:36 technomancy: lancepantz: it's by number of repositories that contain at least one file of a given lang

20:37 slyphon: technomancy: hai!

20:37 technomancy: what do you know about classloaderS?

20:37 technomancy: less than I should?

20:37 * slyphon sighs

20:37 hiredman: there be dragons

20:37 lancepantz: that makes sense

20:38 technomancy: github languages ranked by bytes: sonia

20:38 slyphon: its' weird, i get that traceback above when running on linux but not on mac os-x

20:38 technomancy: rather: http://gist.github.com/118810

20:38 weird... IME classloader issues are a lot more common on OS X due to the hacks they have for "native-feeling" swing

20:39 slyphon: there are a bunch of hits on google related to Spring and other containers, but i don't know enough to even start

20:39 well, that might be overstating it

20:40 hiredman: you didn't use add-classpath did you?

20:40 technomancy: dependency injection doesn't play nice at all with Clojure in my experience

20:40 slyphon: hiredman: nope

20:40 hiredman: just making sure

20:40 technomancy: but that was with Maven's, not Spring

20:41 hiredman: wow

20:41 slyphon: i even grabbed the standalone jdk distro from sun and same thing happens

20:41 (just to make sure it wasn't the package maintaner being cute)

20:42 also

20:43 when i run lein repl, and run the tests (how that bug gets triggered) it works fine

20:43 it's only from slime that it throws that exception

20:43 which is interesting

20:44 hiredman: perhaps you need to restart slime?

20:45 slyphon: tried that

20:45 couple of times

20:45 it's really strange that swank-clojure "causes" the issue

20:45 hiredman: what about slime connecting to lien swank?

20:46 slyphon: that's the thing

20:46 *that* is when the issue happens

20:46 lein repl it works fine

20:46 hiredman: and what about swank-clojure-project?

20:47 slyphon: that i dont' have set up because i need to pass properties on the command-line

20:47 i guess i could get around that by loading them when i init my stuff

20:48 * slyphon tries that

20:49 technomancy: swank-clojure-extra-vm-args may also do it

20:49 * slyphon nods

20:49 slyphon: only thing that's kind of annoying about that is there doesn't seem to be a way of making that per-project

20:50 technomancy: you can use .dir-locals to set it in elisp

20:50 if you're on emacs 23+

20:50 * slyphon sighs

20:51 slyphon: on linux i'm using 22, font rendering is AFU in ubuntu in 23

20:51 spent a few hours chasing this one down: https://bugzilla.redhat.com/show_bug.cgi?id=517272

20:52 technomancy: weird; never seen that one. is that the emacs-snapshot package?

20:52 slyphon: nope

20:52 wlel

20:52 both, actually

20:52 emacs23 and emacs-snapshot

20:52 *and* i checked out the code and built by hand, but i pulled from a git repo, and i think it was an old cut of the code

20:55 hrm

20:55 what happened to java-utils in clojure-contrib?

20:56 technomancy: it got split up into a number of other nses

20:56 slyphon: ah

20:56 technomancy: c.c.io, c.c.properties, possibly more

20:56 slyphon: ahh

20:58 * slyphon just customizes slime.clojure.extra.vm-args

21:00 slyphon: oh ffs

21:06 hiredman technomancy: running it with swank-clojure-project works...

21:06 * slyphon is confused

21:07 technomancy: so lein swank runs in a subclassloader in order to keep leiningen's deps separate from your project's

21:08 repl hasn't been fixed to do this yet (though that's a bug)

21:08 so there must be something about the root classloader that isn't getting propagated to the project classloader

21:08 the only other time this has been an issue is with OS X gui classes

21:08 slyphon: and how is swank-clojure-project different?

21:09 it's java.lang.reflect.Proxy.getProxyClass()

21:09 referenced in a number of other posts

21:09 technomancy: swank-clojure-project calculates the classpath in elisp rather than clojure

21:09 so it lets your project use the root classloader

21:09 slyphon: ahh

21:09 technomancy: you can force leiningen to fork a new JVM for your project instead of using a subclassloader

21:09 it'll be slow, but it will probably sidestep the problem

21:10 you can do it by setting a dummy value for :native-path in project.clj

21:10 * technomancy makes a mental note to make a better way to do that next release

21:10 slyphon: hm

21:11 well, i'm ok with running swank-clojure-project

21:11 so

21:11 emacs question

21:11 do you have to set swank-clojure-extra-vm-args inside the "custom-set-variables" sexp

21:11 ?

21:11 or can you just do setq ?

21:12 technomancy: setq is fine

21:12 slyphon: mm'kay

21:12 technomancy: gotta jet; hope you get it figured out

21:12 slyphon: yeah, thanks for the hlep

21:12 :D

21:12 technomancy: you can post to the lein mailing list if you get stuck

21:12 slyphon: kk, tyvm

21:30 defn: how do we use the new version of contrib? im using clojure-contrib 1.2.0-master-SNAPSHOT

21:30 how do i add the one in which we have .io instead of .duck-streams, etc.

21:30 hiredman: lose the master

21:31 defn: wonderful -- thanks

21:32 Raynes: defn: Did you ever checkout irclj?

21:32 check out*

21:32 * Raynes is sleepy.

21:32 defn: Raynes: that question i just asked is directly related to me playing with irclj :)

21:32 I needed to get the new SNAPSHOT to use .io etc.

21:33 Raynes: Ah. :p

21:33 slyphon: argh

21:33 Raynes: defn: If you see anything obvious that needs added, leave me a $mail or something. It's definitely lacking right now. At least it's enough for sexpbot for now. :>

21:33 slyphon: anti-aliasing is the *worst* idea

21:34 defn: in emacs 23? respectfully disagree.

21:34 slyphon: no no

21:34 firefox

21:34 defn: oh

21:34 * slyphon *almost* has pretty fonts

21:34 defn: Raynes: I will definitely do that

22:07 slyphon: is the stderr output captured when you do swank-clojure-project?

22:08 oh, nvm

22:15 defn: slyphon: you fixing up swank-clojure-project?

22:15 slyphon: well, i got it workin' for me

22:15 defn: slyphon: i believe there is a problem with it picking up the resources directory -- not sure if that's in the scope of things you're messing with

22:15 but that'd be a nice thing to fix

22:16 slyphon: hrm, i just link the stuff i need from resources/ into classes/ which is probably The Wrong Way

22:16 i only have 1-2 properties files i use

22:16 defn: *nod*

22:17 slyphon: i think you should be able to put that in swank-clojure-extra-classpaths

22:19 defn: slyphon: oh right, that makes sense

22:21 slyphon: i mean, it'd be nice if it picked that up automagically, but i dunno how to do that without reading through the .el

22:27 defn: no worries, just thought id ask

22:53 slyphon: hrm

22:59 sooo, if i want to tweak one or two methods on c.test/report, what's a good way to do that?

22:59 "methods" look like Special Creatures

23:08 is it possible to copy a method impl?

23:09 or rather a "multi", then tweak your version, like "subclassing"

23:29 technomancy: what kind of things could cause the JVM to exit even after shutdown-agents is run?

23:29 maybe some rogue thread kept alive?

23:29 slyphon: to not exit?

23:30 usually it's a rogue non-daemon thread

23:30 in my experience

23:30 technomancy: do you know if it's possible to override a single defmethod ?

23:30 like, if you wanted to override clojure.test/report :end-test-var

23:31 technomancy: I think you can just defmethod over the same dispatch value

23:31 but I don't know how to preserve the old one

23:31 slyphon: yeah, i'm actually writing a post to the group about that

23:31 it doesn't seem possible, really, looking at c.t.junit

23:31 and reading the defmulti code

23:31 technomancy: you could probably do it with some Java calls

23:32 * slyphon horks up a little in his mouth

23:32 technomancy: yeah, not great

23:34 you could just write a defmulti whose default method just calls the old one

23:34 slyphon: HMM

23:35 technomancy: nothing wrong with that apart from one extra call

23:35 slyphon: yeah, but i have to bind over clojure.test/report

23:35 before running the tests

23:35 technomancy: oh, can't do that in 1.2

23:35 slyphon: can't do what?

23:35 technomancy: oh, never mind

23:36 slyphon: maybe aliasing the original?

23:36 technomancy: direct binding inhibits you from rebinding most functions bound to vars beginning with "clojure"

23:36 but clojure.test/report is explicitly excluded

23:36 slyphon: ah

23:38 technomancy: remleduff: hey, are you going to submit that repl patch as an assembla issue?

23:39 remleduff: I don't have a CA in place at the moment, go ahead if you want to :)

23:39 technomancy: ok, cool

23:53 slyphon: technomancy: w00t!

23:54 technomancy: http://gist.github.com/369247

23:59 technomancy: heh; what's harpo?

23:59 slyphon: oh, heh, that's my project i'm working on, i name all our major infrastucture projects after Marx Brothers

Logging service provided by n01se.net