#clojure log - May 24 2010

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

0:02 rdsr: rava: in my emacs/swank setup, if there's a compilation problem, my cursor is placed at the point where the problem is

0:04 rava: is that a config option?

0:04 rdsr: I don't doing any configs

0:05 *remember*

0:05 rava: how are you compiling? C-c C-c ? or slime-compile-file?

0:05 be back in a little while

0:05 * rava away

0:06 DeusExPikachu: why does the builtin classloader change in the repl after each line? So for example, (.deref (clojure.lang.Compiler/LOADER)) is called during different lines in a repl and outputs different classloaders, but when repeated in a dotimes loop is refers to the same value?

0:06 s/value?/object?

0:08 rdsr: C-c CK

0:08 C-c C-k

0:12 rava: It doesn't seem to place the cursor if the error is in a different file/ns

0:13 rava: just prints the line number in the exception mesg

0:36 rava: bk, sorry

0:38 yah, not seeing it run in repl from a yank

0:45 its annoying because it's a wrong args exception, and by looking at doc strings everything seems good.

0:49 johnmn3: I'm having such a hard time getting swing to swing

1:12 remleduff: What's the problem johnmnmn?

1:56 empt: help needed. failed to install labrepl in Netbeans/Eclipse since some error getting incanter, anyone else has encountered such a problem and any suggestions to overcome?

2:02 remleduff: empt: What error? Something about a var already being defined?

2:04 empt: I recall it as cant get incanter downloaded when building labrepl in netbeans

2:04 now I try to do it again to copy the very error

2:06 [ERROR]Transitive dependency resolution for scope: compile has failed for your project.

2:06 [ERROR]Error message: Failed to resolve artifact, possibly due to a repository list that is not appropriately equipped for this artifact's metadata.

2:06 [ERROR] org.incanter:incanter-full:jar:1.2.0-20100327.041516-10

2:06 [ERROR]from the specified remote repositories:

2:06 [ERROR] central (http://repo1.maven.org/maven2),

2:06 [ERROR] clojars (http://clojars.org/repo/),

2:06 [ERROR] incanter (http://repo.incanter.org),

2:06 [ERROR] clojure-snapshots (http://build.clojure.org/snapshots),

2:06 [ERROR] clojure (http://build.clojure.org/releases),

2:06 [ERROR] clojure-releases (http://build.clojure.org/releases)

2:06 [ERROR]Path to dependency:

2:06 unfo-: >_>

2:06 empt: [ERROR] 1) labrepl:labrepl:jar:0.0.1

2:06 [ERROR] 2) org.incanter:incanter-full:jar:1.2.0-SNAPSHOT

2:06 [ERROR]Group-Id: labrepl

2:06 [ERROR]Artifact-Id: labrepl

2:06 [ERROR]Version: 0.0.1

2:06 unfo-: empt, please use paste services

2:06 empt: [ERROR]From file: /home/empt/NetBeansProjects/RelevanceLabRepl/pom.xml

2:06 ------------------------------------------------------------------------

2:06 remleduff: Please don't paste into the channel, put it in a gist or paste

2:06 empt: For more information, run with the -e flag

2:06 sorry

2:06 yes

2:07 remleduff: There's no such incanter version as 1.2.0-SNAPSHOT on clojars

2:08 http://clojars.org/repo/incanter/incanter/

2:08 empt: so?

2:09 I am using the origin without modifying; and should I modify some where to get it work?

2:10 remleduff: Oh, incanter in labrepl is coming from repo.incanter.org

2:11 Maybe there's something wrong with that server or labrepl is using a bad version

2:13 empt: ok, I'm too new to understand the process but it seems I would better wait for them to have the things fixed

2:13 remleduff: Actually, that seems to work fine for me

2:14 empt: bad luck of me :)

2:14 remleduff: Can you reach repo.incanter.org ?

2:14 empt: ok I will try it

2:16 my god that's the issue. the mad ccp gfw seems to have blocked the site here in China

2:17 now I'll try to enable the proxy and retry

2:19 and it's available now from firefox after proxy turned on so I'll retry it

2:20 remleduff: You may need to delete your <HOME>/.m2/repository/org/incanter subdirectories to make sure maven actually retries. Sometimes it will cache a failure and stop trying

2:21 empt: thank you I was just about to ask this :)

2:24 and a 'clean and build ' is sufficient after deleting?

3:33 sjuxax: Hey guys. I am new to Clojure and though I am somewhat familiar with Lisp, I haven't done much hard work in it, which will be apparent by the time I ask my question. I just want to be clear on this. The parentheses represent a block to evaluate, right?

3:34 So, like (filter odd? (nums)) happens because () means eval and first thing is function name, next things are arguments, and odd? doesn't need any extra eval, but I want the nums eval'd because I really want odd? to receive the sequence I had previously defined as "nums", right?

3:34 I just think things would be easier to grok if I understood the parentheses usage : )

3:36 mmarczyk: parens cause the Lisp reader to construct a list, which is then passed on to eval (at a conceptual level, anyway)

3:36 if the list is non-empty, eval takes a look at the first element of the list

3:37 if it is a symbol naming a special form, the whole thing is handed off to a "handler" for that special form

3:37 (e.g. if, fn)

3:37 if it is some other symbol, it is resolved in the current context

3:38 if it happens to name a macro, the macro function is invoked and whatever it returns is fed back to eval

3:38 otherwise we either have a symbol naming a Var which holds a function or something which is not a symbol

3:38 either way, the expression only makes sense if that thing evaluates to a function

3:39 once eval has the function in hand, it proceeds to evaluate all arguments in turn, then passes them to the function

3:39 so, in particular, the "odd?" in your example is evaluated -- the result happens to be a function and that function is passed to filter as its first argument

3:42 also, functions need not be specified by name when in the operator position -- e.g. ((fn [x y] (* x (+ x y))) 3 5) is a perfectly valid expression; macros and special forms do

4:07 sjuxax: thanks mmarczyk

4:31 The difference between defn and fn is that fn is only used for anonymous functions, right?

4:31 Otherwise all the same syntax etc?

4:32 mmarczyk: well, fn forms actually evaluate to functions

4:32 so they can be used in the operator position in expressions etc.

4:32 defn = def + fn

4:32 completely different purpose, evaluates to a Var

4:32 but yeah, the syntax is mostly the same

8:22 angerman: Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: No matching field found: setFaceCountAndAttributes for class de.jreality.scene.IndexedFaceSet

8:22 does that make any sense for http://www3.math.tu-berlin.de/jreality/api/de/jreality/scene/IndexedFaceSet.html

8:22 ?

8:24 spariev_: angerman: can you show code that invokes setFaceCountAndAttributes ?

8:25 hoeck: there is no such _field_ in that class

8:25 angerman: (.. cmp getGeometry setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces)))

8:25 hoeck: Ohh that's right.

8:25 Hmm :/

8:25 * hoeck has quite abandoned the use of .. in favor of ->

8:26 * hoeck has to read the clojure docs to understand ..

8:26 angerman: yea. -> and -?-> are nice :D

8:26 hoeck: is .. the same as -> but only for method-invokation?

8:26 angerman: though I'm always getting confused with ->

8:27 hmm I should use baces

8:27 mmarczyk: hoeck: yup

8:28 hoeck: (-> cmp .getGeometry (.setFaceCountAndAttributes Attribute/INDICES) (DoubleArrayArray$Array. (swap-faces))) ?

8:28 mmarczyk: there's a syntactic difference in that with .. you don't prefix method names with dots

8:28 hoeck: ah, yes

8:28 sorry, maybe you wanted this: (-> cmp .getGeometry (.setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces))))

8:29 angerman: because in your expression, setFaceCountAttrs is called without any args, this might have caused the "no such field" error

8:30 mmarczyk: apparently a lot of people have been calling .. non-idiomatic lately, with -> the preferred replacement... that's too bad, IMO, as I prefer the feel of .. for method chains

8:31 angerman: hoeck: yep, got confused in the .. syntax

8:31 chouser: mmarczyk: rhickey stands by .. last I knew

8:31 mmarczyk: chouser: really happy to hear that, thanks :-)

8:31 chouser: I tried to talk him out of it, but failed. :-)

8:32 mmarczyk: good. :-P

8:32 ;-)

8:34 spariev_: so, with .. it would be (.. cmp getGeometry

8:34 (setFaceCountAndAttributes Attribute/INDICES (DoubleArrayArray$Array. (swap-faces))))

8:36 hoeck: spariev_: from what I've learned right now, right :)

8:37 angerman: Hm. This whole jreality project wished to have immutable datastructures

8:37 and bolted them onto java ...

8:37 Hmm....

8:44 rsh: I want to call a string named some function as the function itself... how would you do it?

8:46 Chousuke: convert to a symbol, resolve the symbol to a var, and call that.

8:47 rsh: calling (var (symbol "+")) gives me error PersistentList can't be cast to Symbol

8:47 Chousuke: var is a special form

8:47 you want (resolve (symbol "+"))

8:48 which either returns nil, a Class instance, or a Var

8:48 rsh: works great, thanks

8:50 Licenser: mmarczyk: I looked at your function problem is it needs to match the beginning of the string, but I'll try to make it a two way test

8:51 rsenior: when creating a new instance of a defrecord, where the defrecord exists in another namespace, do you always have to fully qualify it?

8:52 i.e. even when I'm already pulling in all the items from that namespace via a use

8:53 mmarczyk: Licenser: you mean clj-id?

8:53 ?

8:54 I thought it did match on bos

8:54 Licenser: yap

8:55 mmarczyk: hm :-)

8:55 not sure I understand then

8:57 ohhh, ok, I think I got it :-P

8:57 sorry for the delay ;-)

8:58 well

8:58 there's the option of using the find method on the Matcher

8:59 hoeck: rsenior: yes, because you refer to the defrecord via its classname, you will have to import it if you do not want to fully qualify it

9:00 mmarczyk: and then use .start() to see if the match started at the given position

9:00 then you could drop the ^ from the regex

9:01 (find takes an int to indicate where it's supposed to start matching)

9:01 rsenior: hoeck: thanks, that's what I thought

9:03 Licenser: mmarczyk: it's not really faster

9:04 mmarczyk: Licenser: yeah, I guess the more complicated this becomes, the less likely it is to be of any benefit :-(

9:05 Licenser: *nods*

9:05 mmarczyk: back to optimising regexes then

9:05 oh bother.

9:10 Licenser: hmm mmarczyk it seems it it takes more idents then the original regexp

9:10 mmarczyk: that's possible, I might not have been all that thourough with testing

9:10 any examples?

9:11 Licenser: no just the output of scanning core.clj

9:12 83418 tokens with your code 40663 with mine

9:13 ah there we go

9:13 okay there wasa $ in the end which is wrong in my implementation

9:13 sadly still slower :(

9:14 http://gist.github.com/411839 is what I made out of it

9:15 but I found out why it was 10 times slower :P

9:16 mmarczyk: oh? :-)

9:17 Licenser: yea bug infront of the compulter

9:17 mmarczyk: :-)

9:17 I wonder if this would be faster with the let moved inside the function

9:17 Licenser: see when I read 250ms for 40k tokens

9:17 mmarczyk: hm :-)

9:18 Licenser: I thought okay so (/ 40000 2.5)

9:18 ~ 17k tokens per second

9:18 clojurebot: Titim gan éirí ort.

9:18 mmarczyk: (.. valid-chars (matcher s) (find idx)) isn't faster?

9:18 Licenser: I'm not entirely sure what that does

9:19 oh wait 1.2 has no re- prefixes any more right?

9:20 but find can't take an idex

9:20 mmarczyk: find here is a method on java.util.regex.Matcher

9:21 c.c.string has funny names in 1.2 (with -re at the end), but the names in clojure.core are the same

9:22 so what the above does is (1) take the regex, (2) build a matcher for this regex on top of the given string, (3) find the first match of the regex in the string occurring no earlier than at index idx

9:23 hm, actually you'd probably have to do something like

9:23 (let [m (.. valid-chars (matcher s))]

9:23 ouch...

9:24 (let [m (.. valid-chars (matcher s))] (.find m idx) (== (.start m) idx))

9:24 that would tell you whether there's a match at the starting position you specified

9:24 I think

9:26 oh bother... title case not yet implemented

9:26 Licenser: ah I see

9:26 I think the problem is if you use ^ and index it always returns false

9:26 I tried that I think

9:26 since ^ can't match with an index

9:27 mmarczyk: yes

9:27 therefore you'd drop the ^

9:27 ....um

9:27 Licenser: but then it would match (((123 abc too

9:27 mmarczyk: and totally kill your performance I guess

9:27 Licenser: since abc is a ident

9:27 and make it silly ;)

9:28 mmarczyk: well it would match, but the match would start some way past the index you specified

9:28 Licenser: ^ is needed since it must only match when it is exactly the same

9:28 yes some where past

9:28 mmarczyk: so then you'd call .start, see that the match begins to far to the right

9:28 Licenser: but that would tell me 'in the remaining code there is an ident somewhere' which isn#t exactly what a highlighter needs to know ;)

9:28 mmarczyk: and decide that there's no match where you started (even though apparently there is one further on)

9:28 yeah

9:29 in fact, you're better of not trying to find out :-)

9:29 Licenser: I need to know 'is the next token an ident'

9:29 ^^

9:29 mmarczyk: then maybe it's best to use substring

9:30 Licenser: that is what I do

9:30 mmarczyk: somehow creating all those extra strings seems wasteful, though

9:31 yeah, well then you could see how the regex with ^ with substrings and the .. thing fares

9:31 but actually

9:31 I guess what you really want to do

9:31 is to tokenise the string first

9:31 at a primitive level -- split at whitespace and brackets

9:32 with some complications because of comments, I guess

9:32 and then apply some regex magic to the individual fragments

9:33 then it makes sense to have a function checking whether a particular string -- the whole of it -- is ok as an identifier

9:35 Licenser: mmarczyk: bt that would e wrong

9:35 see (+ 1) split it by a space won't work

9:36 mmarczyk: well, literally splitting at whitespace won't work

9:36 Licenser: to split it you need to scan it sadly

9:36 mmarczyk: but doing a lazy lexing step would

9:36 Licenser: hmm can you explain that?

9:37 mmarczyk: go through the string keeping track of whether you're in a comment, a string / regex literal

9:37 and a stack of open brackets

9:37 (maybe)

9:37 Licenser: mmarczyk: yes that might work for clojure but univerally it likely will not

9:37 a

9:37 mmarczyk: by "in a comment" I mean "inside a line comment"

9:38 I don't think there's any programming language you can't split into tokens in a single traversal :-)

9:39 parsing is another matter, of course, but initial splitting should always be possible

9:40 Licenser: I'm not sure if it wil be faster

9:40 mmarczyk: well, you can be lazy about it

9:40 and then there's some room for optimisations

9:41 Licenser: since it does the string twice

9:41 mmarczyk: e.g. only try regexes which might succeed given the first char of a token

9:41 naeu: how would i create an infinite collection I can take from with a function that is continually applied to the previous result?

9:41 mmarczyk: the first pass does nothing interesting though

9:41 so it won't really slow you down

9:42 and once you do it, you no longer need to allocate huge strings over and over again

9:42 (say, 250k chars for your source at the start, then 250k - the first 10 for the first token, then that - 5 for the second token etc.)

9:42 seths: naeu: have you tried iterate?

9:42 ,doc iterate

9:42 clojurebot: java.lang.Exception: Can't take value of a macro: #'clojure.core/doc

9:42 seths: ,(doc iterate)

9:42 clojurebot: "([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"

9:43 naeu: seths: looks perfect, thanks

9:45 Licenser: hmmm

9:45 mmarczyk: subs doesnot allocate new strings AFAIK

9:47 seths: I think I am trying to misuse reify... should I not use it inside defmacro?

9:47 ,(defprotocol IFoo (bar [_]))

9:47 clojurebot: DENIED

9:47 seths: ack

9:47 mmarczyk: Licenser: hm, can't say that I'm sure about this, but the javadoc would suggest that a new string is return

9:48 seths: anyways, this works: (bar (reify IFoo (bar [_])))

9:48 but this doesn't: (defmacro make-foo [] (reify IFoo (bar [_]))) (bar (make-foo))

9:48 new error to me: Can't embed object in code, maybe print-dup not defined

9:49 Licenser: mmarczyk: I am not 100% sure sadly but I heared this earlyer

9:53 _fogus_: seths: I don't think there is anything inherently wrong with using reify in a defmacro

9:54 seths: actually, to self reply, this works: (defmacro make-foo [] `(reify IFoo (bar [_])))

9:55 now I have to puzzle through my real code which has other problems

9:55 mmarczyk: ,(.. #"asdf" (matcher (StringBuilder. "asdfasdf")) (find 0))

9:55 clojurebot: true

9:55 _fogus_: seths: Does the expansion of your snippet above look correct to you?

9:56 mmarczyk: Licenser: another option :-) -- remove a bit from the front later, trim periodically

9:56 Licenser: but I hope you're right about the strings

9:56 Licenser: I hope too

9:57 mmarczyk: yea I did that first but it didn't made a difference

9:57 mmarczyk: Licenser: nope

9:57 try this:

9:57 (def s "asdfasdf")

9:58 (def w (java.lang.ref.WeakReference. s))

9:58 (def t (subs t 4))

9:58 (System/gc)

9:58 (.get w)

9:58 seths: _fogus_: actually probably not: (clojure.core/reify euler.fu/IFoo (euler.fu/bar [euler.fu/_]))

9:58 _fogus_: I haven't looked at the latest MEAP, does it have the chapter on macros?

9:58 _fogus_: seths: That's what I was thinking. ;-)

9:59 seths: It does.

9:59 Licenser: of case s is still there you defed it

9:59 seths: _fogus_: yay, 'scuse me then

10:00 mmarczyk: well, actually that doesn't prove all that much, does it... but at least now I really need to read about substring somewhere (the docs aren't explicit enough :-/)

10:01 _fogus_: seths: I think in this case capture and/or autogensym might fix your expansion

10:01 mmarczyk: http://dmst.aueb.gr/dds/pubs/conf/2008-PCI-dtrace/html/GS08.html

10:01 search for "methods that have allocated the most objects"

10:02 but anyway, obviously substring needs to allocate a new String object, but whether there's any memory sharing is a different matter... wouldn't really expect it, but hey.

10:02 Licenser: mmarczyk: what I heared is that the substring is not copying the data but refering to it

10:03 meaning also that unless you copy the data the original string won't be GC'ed

10:04 spariev_: mmarczyk: http://fishbowl.pastiche.org/2005/04/27/the_string_memory_gotcha/

10:04 If you call substring(), you will get back a new String object containing a pointer to the same char[] array as the original string, just with a new offset and length to match the chunk you were after

10:06 mmarczyk: spariev_: thanks for the link!

10:06 my Google-fu failed me today :-)

10:07 thanks for improving my Java-fu, Licenser & spariev_

10:07 spariev_: mmarczyk: np :)

10:07 Licenser: mmarczyk: I am sorry :P

10:07 mmarczyk: :-)

10:07 hm? what for?

10:08 Licenser: for improving your java :P

10:08 spariev_: lol

10:08 mmarczyk: oohhhh.

10:08 :-D

10:09 seths: _fogus_: thanks!

10:09 chouser: Is there an object that does similar sharing but on byte arrays instead of chars?

10:10 _fogus_: seths: any time

10:16 spariev_: chouser: here's what i found http://stackoverflow.com/questions/618396/in-java-is-where-a-way-to-create-a-subarray-that-will-point-to-a-portion-of-a-bi

10:19 chouser: spariev_: excellent, thanks.

10:20 spariev_: chouser: glad I helped :)

10:22 angerman: does anyone use os x and a wireless bt keyboard?

10:23 since I got my US layout one, when ever I push M-s I get ß ... which is very not helpful when using emacs with paredit. Well using emacs at all without a meta key is kinda annoying.

10:25 Chousuke: I think alt is not meta on OS X.

10:26 you probably need to set the mac-command/option/whatever-modifier variables to other values to make it work.

10:26 angerman: Chousuke: ah, well it's in Aquamacs at least.

10:27 cemerick: AFAIK, most everyone maps command to meta?

10:27 angerman: (e.g. I've been using that key-combo all along, just since the new keyboard it's scewed up... )

10:27 Chousuke: Probably configured differently from the emacs default

10:27 Licenser: angerman: in aquaemacs there is a setting for meta with german keyboard and such things

10:27 s

10:27 so your alt and stuff work propperly on the keys where you need it

10:27 Chousuke: cemerick: I have caps lock as meta and cmd as control

10:28 angerman: well. the weird thing is, (using the same software, using the same aquamacs, using a US layout macbook) it did work.

10:28 (after installing the BT US layout keyboard) ... it stopped and gave me these special chars.

10:28 Chousuke: maybe the bt keyboard sends a different key code :/

10:29 angerman: to me it looks like os x is somehow grabbing the alt key before any app can.

10:29 Chousuke: no. Best part: _now_ the keyboard on the macbook does the same strange behaviour

10:29 Chousuke: http://www.emacswiki.org/emacs/MetaKeyProblems

10:32 mmarczyk: Licenser: btw, are you using ":" + basic-identifier for non-namespaced-keywords?

10:32 Licenser: yes I think so

10:32 mmarczyk: apparently :123 also creates a keyword

10:33 (not sure why'd anyone want to do that, but...)

10:33 Licenser: o.O

10:33 narf

10:33 mmarczyk: today was the first time I made that typo ;-)

10:34 Licenser: I think you even can create random string keywords

10:34 ,(keyword "I want cookies!!!"

10:34 clojurebot: EOF while reading

10:34 Licenser: ,(keyword "I want cookies!!!")

10:34 clojurebot: :I want cookies!!!

10:34 Licenser: o.O

10:34 that isn't readable :P

10:34 mmarczyk: well, if you call keyboard or symbol, you can make keywords and symbols out of any string

10:34 including empty

10:34 Licenser: ,(pr-str (keyword "I want cookies!!!"))

10:34 clojurebot: ":I want cookies!!!"

10:34 mmarczyk: but :123 is a readable literal

10:34 spariev_: ,(keyword ";-)")

10:34 clojurebot: :;-)

10:34 mmarczyk: not sure if it's documented to be a no-no, possibly it is

10:35 ,(str :;-))

10:35 clojurebot: Invalid token: :

10:35 Licenser: I like my <3 function

10:35 mmarczyk: ,(str :123)

10:35 clojurebot: ":123"

10:35 mmarczyk: :-)

10:35 Licenser: which is entirely valid but rhicky didn't wanted it in c.c :(

10:35 angerman: haha.

10:35 Ok, found it. This was _really_ stupid of me :/

10:36 Aquamacs now features swapping alt as option key using C-;

10:36 sorry guys

10:37 Licenser: hmm hmm

10:50 jfields: if you have an interface with two methods

10:50 void write(ByteArray msg);

10:50 void write(ByteArray msg, int startPosition, int bytesToSend);

10:50 how do you proxy that?

10:51 I tried to define it twice in proxy with different arity, but I get Caused by: java.lang.IllegalArgumentException: Method 'write' redefined

10:52 angerman: did you try to define it using multiple arity?

10:52 Chousuke: you need to use the fn syntax for multiple arities

10:52 angerman: (write ([msg pos send] bleh) ([msg] blah))

10:53 jfields: cool thanks

11:29 seths: _fogus_: I went with a function-making function (using reduce and update-in): https://gist.github.com/dff8b0becc9d2c8b1bc8

11:42 _fogus_: seths: Yay! No macros needed. That's the best way to write a macro... don't ;-)

11:51 alpheus: Since I'm new to clojure, what was the thinking behind this deprecation?"WARNING: reader macro ^ is deprecated; use meta instead"

11:54 _fogus_: alpheus: The intention is to use ^ for type hints

11:55 alpheus: thanks

12:01 replaca: _fogus_, chouser: congrats on your draft!

12:01 chouser: replaca: thanks!

12:02 _fogus_: replaca: Thank you!

12:02 chouser: still plenty to do of course. illustrations, for example. :-)

12:02 _fogus_: oh yeah... those. :p

12:02 replaca: chouser: of course, but we need to celebrate our progress

12:10 chouser: replaca: indeed. Hooray!

12:11 that's one step closer to not writing a book!

12:11 funny how goals change

12:11 _fogus_: I miss the days when I was not writing a book

12:12 chouser: I keep running into situations that want an 'invoke' function these days.

12:13 _fogus_: chouser: You mean making something invokeable.. via some protocol?

12:13 chouser: no, just (defn invoke [f & args] (apply f args))

12:13 joshua-choi: Same here.

12:14 chouser: An Invokable protocol would be good too, but that's something else. :-)

12:14 _fogus_: You want funcall? Why not throw in #'f while you're at it? (just kidding)

12:16 chouser: huh. it is funcall isn't it.

12:16 _fogus_: yes. I was just being snarky

12:17 chouser: but it's a good point.

12:21 replaca: heh: (defmacro invoke [f & args] `(apply ~f ~@args [])) :-)

12:35 iwillig: hey does anyone know how to do 1e-9 in clojure ?

12:36 i need to use a double literal

12:36 _fogus_: ,1e-9

12:36 clojurebot: 1.0E-9

12:37 _fogus_: ??

12:37 iwillig: http://java.comsci.us/etymology/literal/double.html

12:38 mmm that does not work for me

12:38 oh

12:38 never mind

12:39 tanks _fogus_

12:39 thanks

12:39 _fogus_: iwillig: I hope I was helpful.

12:40 iwillig: well you made me realize how silly i was being... so yes :)

13:35 riddochc: I could use some help with a macro I'm writing...

13:36 seths: ,3r20

13:36 clojurebot: 6

13:36 slyphon: how do you refer to state within an instance method?

13:36 (this :state) ?

13:36 chouser: slyphon: for gen-class?

13:36 (.state this)

13:36 slyphon: yeah

13:36 ahh

13:36 and "this" is implicit, right?

13:37 chouser: no

13:37 slyphon: no?

13:37 chouser: first arg of the defn

13:37 slyphon: ah

13:37 ty

13:38 chouser: riddochc: http://clojure-log.n01se.net/macro.html

13:38 riddochc: actually, I'm not sure that form still works, but those are the questions to answer so we can help.

13:41 riddochc: chouser: Very convenient, thanks. Though I see 'clojure' isn't an option in the colorize menu.

13:41 chouser: riddochc: yeah. lisppaste doesn't have a colorizer.

13:41 if someone wants to write one, I think they'd accept it. ...but it has to be written in Common Lisp.

13:49 riddochc: Hm. I think half my problem is that I'm trying to write a macro so I can call another macro, because the second macro basically amounts to `(with-sh-dir "/path/workdir" (sh "/path/bin/program" ~@rest))

13:52 chouser: you can just (apply sh :dir "workdir" "program" rest)

13:52 riddochc: Now that I'm looking at how with-sh-dir works, yeah, that solves my entire problem.

13:52 chouser: yay! :-)

13:53 riddochc: And makes a lot of the rest of my code simpler.

13:54 chouser: riddochc: cool. That actually makes me quite happy. To me, that's a sign of a good API.

13:54 OForero: hello

13:54 defn: shell-out hsa a with-sh-dir?

13:54 cool

13:54 OForero: I remember seeing a video where someone started a local server? with the documentation used for a project

13:55 defn: autodoc

13:55 OForero: probably using lein .... does anyone knows how to do that_

13:55 riddochc: defn: Yeah, and it seemed like the right thing to use, until I realized that the whole dynamic binding thing wasn't what I needed.

13:55 defn: OForero: yeah, that's autodoc

13:55 OForero: ok ... googling

13:55 defn: you need to add autodoc to your dev dependencies

13:55 then run lein deps

13:55 then lein autodoc

13:56 you can get autodoc from clojars.org

14:03 joshua-choi: Has anyone been able to get a Leiningen project that uses Clojure 1.2 to work with Autodoc?

14:04 OForero: just did

14:04 1.2.0-master-SNAPSHOT

14:04 joshua-choi: Do you encounter any errors when you do "lein autodoc" or "lein help"?

14:05 OForero: lein help crash

14:05 a warning about the reader macro and a ClassCastException

14:05 but I can do autodoc

14:05 joshua-choi: Yes. Do you get the same with "lein autodoc"?

14:05 Oh, really?

14:05 I cannot; I get the same error

14:06 OForero: and Swank which is the one why I got lein in the first place

14:06 compile also fails

14:06 joshua-choi: Actually, it's a different error, but it's still an error.

14:06 Do those errors happen only with your projects that use Clojure 1.2?

14:06 OForero: nope ... autodoc works

14:07 I am not sure

14:07 joshua-choi: When I run "lein autodoc", I get, "java.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath".

14:07 OForero: that is because it can not compile

14:07 rdsr: OFreoro: can u try running lein help from inside the lib folder

14:07 I do get the same exception under the project root folder

14:07 OForero: I was having a ton of problems related to those not found Ex

14:07 rdsr: but not under the lib folder

14:08 joshua-choi: OForero: Did you have to do anything to make "lein autodoc" work?

14:08 OForero: until I move my clj files to reflect the namespace names

14:08 with the name of the file being the last part of the name space

14:08 I also used

14:08 :source-path "src/main/clojure"

14:09 joshua-choi: Ah, perhaps that's it.

14:09 redalastor: I want to use berkeleydb 4.0.103 (the latest) and know nothing about maven. I added [com.sleepycat/je "4.0.103"] to my leiningen config but it isn't working. Oracle's page about maven for bdb is here: http://www.oracle.com/technology/software/products/berkeley-db/je/maven.html

14:09 OForero: yep lein help works inside the lib dir

14:10 joshua-choi: Same for me.

14:10 OForero: joshua-choi: not really ... jut add the dep to project.clj, did a lein deps and autodoc

14:10 and inside the source directory

14:11 I have a/b/c/d.clj

14:11 joshua-choi: OForero: Hmm. I wonder what could be the problem. Okay, what version of org.clojure/clojure-contrib are you using? I'm using 1.2.0-master-SNAPSHOT.

14:11 OForero: for a ns named a.b.c.d

14:11 yes that one

14:12 contrib is plain SNAPSHOT without master

14:13 is there anyway to tell autodoc to create docs for the included libraries?

14:14 joshua-choi: OForero: Are you using the new contrib libraries such as clojure.contrib.string?

14:14 If not, that would explain some things...

14:14 OForero: lein compile also works but does nothing ... probably because I am not using any >gen-class

14:14 right now contrib is just there looking pretty

14:15 I am just starting with this

14:15 joshua-choi: I mean, are you using the old libraries (Like clojure.contrib.str-utils) or the new libraries (like clojure.contrib.string)?

14:16 OForero: that is what I mean ... right now my file has no (use ) clause

14:16 it is just 57 lines

14:17 doing some structs and map operations ... and using refs

14:17 that is it ...

14:17 joshua-choi: I see. Could you temporarily add "(require clojure.contrib.string)" to your (ns ...) form at the top of your program and see if it fails?

14:18 OForero: :require?

14:19 joshua-choi: Yeah, sorry. :require.

14:20 OForero: nope ... it works

14:20 I mean lein autodoc

14:20 joshua-choi: Oh, I meant if your program itself fails to compile.

14:20 OForero: could you pastie the error?

14:21 do you need me to add :gen-class also_

14:21 joshua-choi: I pasted the bottom of it above.

14:21 No, that's not necessary.

14:21 Actually, I'm going to try something myself.

14:21 I'm going to check if changing my [org.clojure/clojure-contrib "1.2.0-master-SNAPSHOT"] to [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] will fix it.

14:22 OForero: ah ok

14:22 I do not have master in contrib

14:22 that gave me problems

14:22 master is only for clojure

14:22 [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]

14:22 joshua-choi: Autodoc itself now works!

14:23 Yes, thanks for your help.

14:23 OForero: one question more

14:23 joshua-choi: It looks like the latest master snapshot isn't up-to-date.

14:23 OForero: can autodoc generate docs for the libraries_

14:24 _na_ka_na_: hey guys .. anyone knows how I can get a FIFO queue ds in clojure?

14:24 joshua-choi: OForero: Could you elaborate?

14:24 OForero: like if ones want the documentation relevant only to what you are using in one place?

14:24 chouser: _na_ka_na_: persistent or blocking?

14:24 OForero: well, lets say I use clojure, contrib and another one

14:25 _na_ka_na_: chouser: persistent, is it easy to implement that using existing vector or list?

14:25 OForero: instead of going and searching the doc for each one individually ... generate a local doc directory containing the doc for all of my used libraries

14:26 joshua-choi: OForero: I don't think so, but I'm not sure I understand your question.

14:26 _na_ka_na_: chouser: both vector and list work only from one side efficiently .. whereas a queue should needs both sides ..

14:27 joshua-choi: _na_ka_na_: I think there's a PersistentQueue built into Clojure, but it's kind of hidden because it's not ready for primetime.

14:27 chouser: clojure.lang.PersistentQueue

14:27 _na_ka_na_: joshua-choi: thx, but will it be made available in 1.2?

14:28 chouser: it's perfectly usable and reliable

14:28 joshua-choi: chouser: My mistake. But why are there no functions specifically related to it in the core API? Like a "queue" function.

14:28 _na_ka_na_: hmm .. any ideas why don't we have in native Clojure?

14:29 chouser: only the constructor function is missing. peek, pop, and conj all work

14:29 _na_ka_na_: or it is planned .. but low priority?

14:30 chouser: well, many cases where you want a queue, you actually want a blocking queue for workflow management, and using PersistentQueue for that would be an abuse

14:30 java.util.concurrent.BlockingQueue should be used instead

14:31 OForero: well another way of putting it ...can autodoc generate docs from a jar? given that many clojure jars are just packaged code?

14:31 chouser: I'm not sure what has to happen before rhickey would privide a queue constructor.

14:32 ,(-> clojure.lang.PersistentQueue/EMPTY (conj 1) (conj 2) (conj 3) peek)

14:32 clojurebot: 1

14:33 chouser: it's been around since before 1.0, and hasn't changed substantially in that time.

14:33 hasn't needed to. works great.

14:34 joshua-choi: I was suspicious of it because there's no constructor function. But if it works fine, that's fine.

14:34 chouser: just don't use it for work flow. don't poll it. don't use it to communicate work tasks to threads.

14:34 ...or Rich will yell at me.

14:35 cemerick: I presume it's waiting for a generalized queue abstraction.

14:35 joshua-choi: cemerick: All this time?

14:35 _na_ka_na_: hmm thanks! .. conj, peek, pop all work? what else is needed for a queue? .. how do i check if its empty? (nil? (seq q))

14:35 joshua-choi: No, there was a reason at the time of Clojure 1.0.

14:35 cemerick: joshua-choi: well, bigger fish have needed frying.

14:35 joshua-choi: Perhaps.

14:35 _na_ka_na_: Just use (empty? q).

14:35 chouser: _na_ka_na_: right, it's seqable, so (seq q) or (empty? q)

14:36 cemerick: That, and it's not exactly clear what a generalized queue abstraction should look like. It'd be a corollary to seqs, which took, what, 2 years to be massaged into their current form?

14:37 joshua-choi: cemerick: In any case, I am very excited at the prospect of Clojure's Java interfaces becoming Clojure protocols.

14:37 Well, I got the impression that that was going to happen.

14:37 chouser: yeah, I'm excited too. PFn

14:37 _na_ka_na_: the doc for empty? says - Please use the idiom (seq x) rather than (not (empty? x)) .. why is that?

14:38 Chousuke: I wonder about the fn protocol

14:38 joshua-choi: _na_ka_na_: Yeah, I wondered that too. It's just shorter; that's why.

14:38 Chousuke: how would you actually implement that? :/

14:38 chouser: _na_ka_na_: shorter and less confusing -- no negations.

14:38 _na_ka_na_: hmm :) ok

14:38 chouser: you don't want to not stop saying a thing isn't empty.

14:38 joshua-choi: chouser: Oh, are protocols being named with P prefixes nowadays?

14:39 chouser: joshua-choi: dunno. :-)

14:39 joshua-choi: Heh.

14:40 Chousuke: _na_ka_na_: (not (empty? ...)) is actually equivalent to (not (not (seq ...))) :P

14:40 mabes: _na_ka_na_: right, do a (source empty?)

14:40 _na_ka_na_: Chousuke: Yup I figured that .. just wanted to confirm if there was some gottcha corner cases ..

14:41 mabes: thanks got it!

14:41 joshua-choi: I wish there was a way to attach metadata to functions within (fn ...) forms. Otherwise, it's not possible to give any of the functions in a (letfn ...) metadata.

14:41 OForero: do you guys are all Emacs hardcores?

14:41 joshua-choi: I myself don't use Emacs.

14:41 chouser: nope

14:41 OForero: what do you ude?

14:41 remleduff: dmiller2718: I just wanted to point out RE: your protocols-in-CLR proposal that Protocols aren't allowed to have zero-arg functions. Not sure if that would make a difference in your thinking about how to make properties fit.

14:41 OForero: use?

14:41 clojurebot: chouser is ruthless about breaking other people's code

14:42 Chousuke: I use emacs but I'm not hardcore at all :P

14:42 joshua-choi: clojurebot: Shut up

14:42 clojurebot: I don't understand.

14:42 cemerick: enclojure now -- keeping a close eye on CCW for eclipse

14:42 _na_ka_na_: Hmm .. interesting question .. what % people are using emacs/slime/swank ? guesstimates ?

14:43 OForero: I had to change the ket map ... cause trying to code in emacs with a Swiss mac keyboard is not a pleasant exp ...

14:43 _na_ka_na_: I used vimclojure in the beginning .. but now ccw coz of Java goodies

14:43 joshua-choi: I use TextWrangler, a Mac OS X editor. It's not very good for Clojure, but its Command-B shortcut highlights the current parenthesized phrase, which is very useful

14:43 I am considering using Enclojure, but Netbeans takes a lot of my computer's energy.

14:45 OForero: ok ... I use IntelliJ also... but did not like the REPL

14:45 _na_ka_na_: chouser: what editor do you use?

14:45 any idea what Rich uses?

14:45 :P

14:45 joshua-choi: _na_ka_na_: Rich I know often uses a Mac OS X Emacs editor called Aquamacs or something.

14:46 chouser: Rich has mocked me for my use of vim. He uses emacs and some commercial IDE -- JetBrains or something.

14:46 OForero: yep ... that is why I got that one ... with paredit ...

14:46 joshua-choi: I found Vim a lot easier than Emacs

14:46 chouser: it's all about the keybindings for me.

14:47 joshua-choi: Both are very hard though

14:47 chouser: these days.

14:47 Dawgmatix: 30 mins with the tutorial built into emacs and youre all set

14:47 Raynes: Emacs isn't that hard.

14:47 chouser: really not. But I shouldn't engage in editor discussions.

14:47 _na_ka_na_: i am also so used to vim .. i tried to emacs .. but found it tough ..

14:47 chouser: This is me trying to stop...

14:48 wdouglas: try harder... =)

14:48 joshua-choi: On a different topic, functions now have metadata.

14:48 chouser: yay!

14:48 Raynes: The hardest part about Emacs and Vim is ignoring the people who exaggerate how hard they are to learn.

14:48 joshua-choi: Would it be possible at all to add a metadata parameter to the fn form? And letfn, while we're at it?

14:48 somnium: the emacs default keybindings are just there to keep the user base from growing too rapidly

14:48 OForero: does anyone knows exactly how metadata work_

14:48 ?

14:48 joshua-choi: Raynes: I don't think I'm exaggerating. :(

14:48 Raynes: joshua-choi: I beg to differ. ;)

14:48 zakwilson: OForero: Yes, I'm sure someone does.

14:48 chouser: joshua-choi: can't you just stick reader metadata on the fn name?

14:48 joshua-choi: I really tried both for two months each.

14:49 chouser: Can I?!

14:49 Wait, no

14:49 chouser: hm.

14:49 joshua-choi: Are you talking about the name in (fn name ...)?

14:49 If fn uses that name's metadata, that's awesome

14:49 Raynes: I managed to be able to use both editors in a matter of hours. Some people have different experiences, but I've seen people claim stuff like "it takes years to be able to use these editors" and other garbage.

14:49 cemerick: There was a recent thread somewhere that discussed how multimethods now need to be ns-unmap'd in order to be able to redefine the dispatch fn. Can't find it now -- anyone have a link handy?

14:49 Raynes: I suppose it depends on how you approach it.

14:50 somnium: I like vim's syntax highlighting for .el files

14:50 chouser: joshua-choi: no, I guess it doesn't. looks like you may have to use with-meta

14:50 OForero: I better say it like: does anyone here knows in which file is metadata implemented?

14:51 joshua-choi: chouser: Unfortunately, you can't do that in letfn.

14:51 _na_ka_na_: Raynes: I guess once you are comfortable with one of those .. you really don't like to shift .. it just feels slowwwww ..

14:51 joshua-choi: That actually does matter to me.

14:51 chouser: joshua-choi: what would you do with such metadata?

14:51 joshua-choi: FnParse, a parsing library I'm making, uses function metadata for various things

14:52 _na_ka_na_: I have a general question .. how are people using metadata in actual code? .. I haven't thought of any use till now.

14:52 joshua-choi: letfn is useful for making mutually recursive parsing "rules", which are implemented as functions.

14:52 redalastor: How do I ask leningen to look into other maven repositories? Or do I add that to maven directly?

14:52 joshua-choi: Otherwise, def is required.

14:52 chouser: joshua-choi: I see. putting it on the name gets it passed through to the compiler, but apparently it isn't picked up there.

14:53 joshua-choi: _na_ka_na_: In my experience, metadata isn't useful when you are using maps or records. But it is useful for other things like functions or vectors.

14:53 OForero: :repositories {"clojure-releases" "http://build.clojure.org/releases"}

14:53 chouser: wouldn't be hard to fix, I'd guess.

14:53 remleduff: redalastor: :repositories in your defproject form

14:53 joshua-choi: chouser: It would be *great* if this enhancement was done.

14:53 angerman: how much will I hate obj-c 2 when I'm used to clojure?

14:54 joshua-choi: chouser: The only point of that name parameter, by the way, is otherwise to name the class that that function spawns, right?

14:54 remleduff: Any time you look at the clojure api docs, you're using metadata indirectly that autodoc used to generate the web pages ;)

14:54 _na_ka_na_: joshua-choi: An example for metadata+vectors?

14:54 chouser: joshua-choi: no, it can be used in the body of the function to refer to itself

14:54 joshua-choi: _na_ka_na_: Um, I don't have any. Ha ha. But for functions, I use them to validate them, label them, and so on.

14:54 chouser: Ah. That's right.

14:55 _na_ka_na_: remleduff: I meant usage in your code..

14:55 redalastor: It's working, thanks.

14:55 joshua-choi: _na_ka_na: Anyways, can I file an enhancement request? I don't know how it works or if I'm allowed to.

14:56 Oops, that was to chouser.

14:56 _na_ka_na_: joshua-choi: you meant to ask me? :)

14:57 Raynes: angerman: Stick your hand in a blender and hit "Liquefy" -- That much.

14:57 chouser: joshua-choi: you can bring it up on the clojure or clojure-dev groups

14:57 angerman: Raynes: _that_ bad?

14:57 joshua-choi: chouser: clojure-dev is only for people who signed those contributor forms, though, right?

14:57 chouser: um, probably, yeah.

14:58 Raynes: angerman: Well, maybe not quite that bad. ;)

14:58 joshua-choi: chouser: Yeah, I'll ask on the clojure group then. Hopefully it won't get ignored. :|

14:58 chouser: Last I knew, Rich said he read every message on the clojure group, so presumably no response means he's not interested.

14:58 angerman: Raynes: well, gotta dive in some day :D

14:58 chouser: this is our process. *shrug*

14:59 joshua-choi: angerman: I heard that Clojure is to be eventually implemented in Objective-C, once the compiler is boot-strapped or something.

14:59 chouser: All right. Thanks a lot for your help.

14:59 chouser: I can bring it up on clojure-dev, but my posts there generally don't seem to get very far either.

14:59 angerman: Raynes: wanted to learn Haskell as well ...

14:59 joshua-choi: seriously?

14:59 joshua-choi: angerman: Yeah, definitely. Same for .NET.

15:00 Raynes: angerman: Haskell is cool.

15:00 joshua-choi: It won't be good for the iPhone or iPad though, since neither have garbage collection.

15:00 chouser: the hawaiian's have arrived

15:00 Raynes: If you're into beating your brain with a stick and then setting your skull on fire for a while.

15:00 angerman: Raynes: I do know ocaml though.

15:00 joshua-choi: Raynes: Haskell is easier than Emacs or Vim. Hyuk hyuk

15:00 somnium: haskell has a great emacs mode

15:00 angerman: joshua-choi: hmm. yea, that wouldn't work anyway I guess...

15:01 isn't there that haskell emacs equivalent?

15:01 Raynes: angerman: Still applies.

15:01 joshua-choi: Heh.

15:01 somnium: ymacs? its kinda 30% complete

15:01 angerman: Raynes: Hmm. Will have fun then :D

15:01 Raynes: There is Yi.

15:01 somnium: yi, thats what I meant

15:02 angerman: yes

15:02 _na_ka_na_: joshua-choi: where did u hear about abt .. Obj C ?

15:02 angerman: okay another fancy langauge question, what makes python better then clojure?

15:02 Raynes: technomancy: I thought you were going to factor in Factor this year? When does that parade start?

15:02 joshua-choi: _na_ka_na_: A month (?) ago in this IRC room. You can probably find info if you search the archives.

15:03 angerman: Python is great. But immutability is very, very, very, very good.

15:03 Separating immutable structures from mutable reference objects is *wonderful*.

15:04 It's amazing if doing this is actually performance-practical.

15:04 And it is.

15:04 Raynes: angerman: http://www.bestinclass.dk/index.php/2009/10/python-vs-clojure-evolving/

15:05 _na_ka_na_: I dunno python at all .. so a noobish question .. why is it soo popular?

15:05 angerman: _na_ka_na_: well. it's not php, pretty easy to get into and quite pleasant

15:06 _na_ka_na_: Lots of people who I meet .. say .. oh we're moving to Python .. is it because Google uses it?

15:06 angerman: at least to me it always feels like python is also a little less syntax noisy than ruby.

15:06 OForero: I couldn't do python ... that white space will bring bad memories (cobol)

15:06 angerman: Hm. I did learn python to get going with django.

15:06 joshua-choi: _na_ka_na_: It's because Python is a good and useful language. And yes, Google (and quite a few other companies) are using it.

15:06 chouser: if you limit yourself to languages people have heard of, there aren't actually that many choices

15:07 angerman: chouser: [VBA,VB,C,Java,C++,Python?,Ruby?]

15:07 chouser: among those, python's dynamic behavior gives it fairly little competition.

15:08 angerman: something like that, yeah. :-)

15:08 angerman: oh. I missed PHP :D... and PERL maybe. Though only if you meet peeple with beards

15:08 chouser: probably perl and ... exactly.

15:08 joshua-choi: angerman: I am very fond of Perl. PHP isn't so welcome, but I'm a tad irrational.

15:08 angerman: ok. since the advert of .NET probably C# as well.

15:09 chouser: maybe lua

15:09 angerman: Perl? gives me very bad memories.

15:09 chouser: javascript

15:09 angerman: chouser: only by those who played WoW :D

15:09 joshua-choi: angerman: Lua is actually used in a lot of games. I recall that a ton of games in the Apple App Store use it.

15:10 somnium: anyone checked out scheme2js?

15:10 angerman: I had to use Perl at one of my part time jobs. At a semi large system-on-chip design house. ...

15:11 _na_ka_na_: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

15:11 somnium: it seems like quite a high quality compiler (from INRIA of ocaml fame), but I had to about trip over it to find it

15:11 angerman: It's been the worst time I had ... so maybe my view is biased by the setting I got to know Perl.

15:12 _na_ka_na_: lol that tiobe site .. has Lisp/Scheme/Clojure grouped into one .. haha

15:12 but nice to see Clojure !

15:12 angerman: joshua-choi: well. use it as in use it to develop the game or use it as in allow the user to extend the game?

15:13 _na_ka_na_: any ideas how C is getting more and more popular?

15:13 angerman: since only the letter would make it creep into the users recognition.

15:13 joshua-choi: angerman: In the game itself, in its core logic. I don't think there are any programmable iPhone/iPod games now.

15:13 angerman: joshua-choi: probably

15:13 somnium: _na_ka_na_: curly braces and segfaults have a certain rustic appeal

15:14 angerman: _na_ka_na_: well. what's weird is that obj-c got such a boost.

15:14 _na_ka_na_: somnium: :P then why did it go down few years back .. see the graph

15:14 joshua-choi: angerman: That's because the iPhone and its sister products are doing so well, so companies want in

15:15 _na_ka_na_: well people are crazy about iP*

15:16 well Java seems to heading downnnnn

15:16 angerman: joshua-choi: that's probably right. I only had very little exposure to obj-c, mostly due to fixing some bugs here and there. And some to obj-j

15:16 _na_ka_na_: interesting metric would be. Java and Java+(JVM hosted languages)

15:17 _na_ka_na_: Hmm right

15:17 joshua-choi: _na_ka_na_: Java is still widely used in enterprise server programs. On the mobile and desktop application side, not so much, though JavaFX is interesting

15:17 angerman: I'm wondering whether java has lost to the other languages or if the JVM as a whole is on a decline

15:17 joshua-choi: Java itself is not going away anytime soon any more than C or C++ are

15:17 angerman: joshua-choi: android?

15:17 _na_ka_na_: joshua-choi: Yup Oracle are putting in lots of $$ into JavaFX

15:17 joshua-choi: Android, I guess

15:18 No, I wouldn't count on it, though

15:18 angerman: I'm actually playing with the thought of putting Droid on my iPhone

15:18 * angerman goes with Sun+Oracle should have become Snorcle

15:19 joshua-choi: It'd be Snoracle, wouldn't it?

15:19 angerman: well as close as it can get to snorkel :D

15:20 * angerman doesn't trust oracle just yet.

15:20 joshua-choi: Do you have an reason why the merger matters to you? The JVM?

15:22 _na_ka_na_: As long as they let James Gosling make the decisions.. it'd be fine I guess

15:22 OForero: Gosling left Oracle already

15:22 * joshua-choi doesn't know who Gosling is :(

15:22 angerman: Well I'm probably not young... and langauges will come and go. But I somehow grew up with java and java's been sun.

15:23 OForero: I remember some jokes about the option of he going to the EPFL

15:23 joshua-cho: the main brain behind java and the JVM

15:23 angerman: so I'd just like some perspective stability from oracle.

15:23 _na_ka_na_: OForero: When did he leave?? I attended a sun (ya still sun!) tech days few months back .. and he was still there

15:24 OForero: I remember seeing that news around april ...

15:24 http://www.reuters.com/article/idUSTRE63B4HV20100412

15:26 is there any way to do types in Clojure? ... or I am just having dirty thoughts?

15:26 joshua-choi: OForero: There are now new ways, but they may be strange to you.

15:26 OForero: you mean the protocols?

15:27 joshua-choi: Take a look at http://clojure.org/datatypes and http://clojure.org/protocols

15:27 Yeah

15:27 Or are you talking about type hierarchies?

15:28 I've got to go. Have a nice day, everyone.

15:28 OForero: I think I do not what I am talking about :-)

15:29 just experimenting

15:29 bye thanks for the links

15:30 chouser: I'm working on a staticly typed dsl on top of clojure. It's the least-clojurey thing I've ever expanded into clojure code.

15:30 different rules for resolution of locals, for example.

15:30 it's a bit amazing what I'll do for money. :-)

15:31 Dawgmatix: write code in perl ?

15:31 :D

15:31 OForero: statically typed clojure? any chance I can take a look at it without having to die afterwards?

15:31 angerman: Hmm... so what's so amazing about jMonkeyEngine?

15:31 chouser: OForero: no

15:31 they're not java types

15:32 shouldn't have said anything. I guess my point was you can make clojure be what you want to a large extent.

15:32 OForero: I do not want java types ... I just want safer functions ... like for example working with only a given struct

15:33 remleduff: You can get pretty far with preconditions

15:33 OForero: is that a commercial project? or the secret version of Clojure.Next :D

15:35 structs are maps ... which means ... no concrete type is created, right?

15:36 chouser: structs are dead. use defrecord

15:38 OForero: oh no, I have zombies in my code :D

15:38 I am reading about them right now

15:40 all that explanations on the terms of host make me think about SciFi B movies

15:41 remleduff: It's kind of a shame that all the struct stuff was in core, it would be nice if they were safely in their own, easily ignored namespace

15:58 angerman: I never had a problem with the clojure core.

15:59 but incanter is just huge. esp. if you want to use only a tiny part :(

16:25 ihodes: Would anyone be so kind as to help me with this little problem;having trouble calling .getAbsolutePath on my seq of Files: (map .getAbsolutePath (file-seq (java.io.File. *post-dir*)))

16:26 angerman: ihodes: does (map #(.getAbsolutePath %) (file-seq (java.io.File. *post-dir*))) work?

16:26 ihodes: ah that will work! let me try

16:27 absolutely does

16:27 thanks so much. so Java functions are second-class huh?

16:27 Chousuke: java methods are not functions at all :)

16:27 angerman: well. I don't think it really is a _function_

16:27 ihodes: oh truth.

16:27 Chousuke: they're not first-class even in Java

16:27 Dawgmatix: any pointers to papers on persistent data structures (like the ones clojure implements)

16:27 ihodes: haha absolutely right. man it's been a while since I've thought about Java. makes total sense! thank you so much

16:29 hoeck: ~google chris okasaki

16:29 clojurebot: First, out of 1950 results is:

16:29 Chris Okasaki

16:29 http://www.eecs.usma.edu/webs/people/okasaki/

16:29 hoeck: Dawgmatix: ^^

16:30 Dawgmatix: thanks hoeck, do you mean the book on functional data structures by okasaki ?

16:30 Chousuke: There are also useful blog posts like http://blog.higher-order.net/2009/09/08/understanding-clojures-persistenthashmap-deftwice/

16:31 hoeck: haven't read that, only looked over the paper which describes the idea behind the clojure ds

16:31 Dawgmatix: thanks chousuke

16:32 do you mean "Simple Confluently Persistent Catenable Lists" hoeck ?

16:34 Borkdude: ,(clojure-version)

16:34 clojurebot: "1.2.0-master-SNAPSHOT"

16:34 Borkdude: ,(map #(apply str %) (partition-by identity "1011011000"))

16:34 clojurebot: ("1" "0" "11" "0" "11" "000")

16:35 chouser: neat

16:35 hoeck: Dawgmatix: sorry, don't know which one exactly

16:35 Dawgmatix: np hoeck

16:36 hoeck: Dawgmatix: the clojure source also mentions kahrs and larsen

16:42 Dawgmatix: tarjan shows up in almost all data structures papers :)

16:44 Fossi: the okasaki is quite good

16:44 and rich (obv) built on a lot of stuff in there

16:45 Dawgmatix: okay

16:47 Fossi: it's a good read :)

16:48 Dawgmatix: :)

17:06 wires: clojure rules!! :D

17:10 Borkdude: wires: yeah :)

17:10 Licenser: hmm why is the code run in repl a good bist faster then in a jar?

17:12 chouser: coincidence

17:13 Licenser: sure? Because it is mostly reproducable

17:14 perhaps my self written time is off but I don't see how

17:40 arkahn: can anyone tell me why this bombs? (take 1 (map process (line-seq rdr))

17:40 I get the following: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: core$take (core2.clj:0)

17:41 core2.clj is the file I'm running against clojure

17:42 (map process (line-seq rdr)) works, but returns nothing because it's a lazy seq of a lazy seq

17:44 sorry, last thing - full 'program' can be found here: http://gist.github.com/412458

17:54 Licenser: arkahn: how about using first?

17:54 arkahn: then I get a nearly identical exception: Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: core$first (core2.clj:0)

17:56 Licenser: arkahn: you forgot a )

17:56 arkahn: oh noes...

17:57 Licenser: =)

17:57 arkahn: Licenser: thank you

17:58 Licenser: you're welcome

17:58 AWizzArd: :-)

17:58 Borkdude: ,(-:

17:58 clojurebot: Invalid token: -:

17:59 Borkdude: ,:- )

17:59 clojurebot: :-

18:01 arkahn: currently, is there a dominant editor/ide/combo for writing clojure code?

18:01 er ... that people predominantly use?

18:02 emacs+slime seems to be a fav

18:02 lancepantz_: yep

18:07 Borkdude: I use it too, most people do I think

18:12 arkahn: man, clojure changes everything: how I think and now which editor to use ; )

18:16 lancepantz_: i switched from vim to emacs, it was a really good decision

18:18 Borkdude: arkahn: yes, Clojure made me into an Emacs user as well

18:18 arkahn: I even use it now to talk in IRC...

18:21 gtg, bye

18:21 arkahn: see you

18:41 wires: is there a library that does 'pattern matching' or 'type checking' of clojure values?

18:41 leafw: these are different things

18:41 wires: yes

18:41 leafw: I know of "matchure", for pattern matching

18:42 wires: i want to match types and values, e.g. I want to restrict input to a function to "a map with a key :cheese witch has a value a vector with 3 elements", etc.

18:42 leafw: let met chack matchure, thanks

18:44 leafw: thanks, that looks decent enough for now.

20:23 technomancy: Raynes: nah, Factor is for 2011. this year it's Duby.

20:24 low-level JVM stuffs

20:59 tcrayford: does clojure.java.io/writer fail sometimes to create writers out of sockets?

21:00 (those are java.net.Sockets)

21:03 I can get it working using reader, but not writer

21:20 krumholt_: can i look up the functions for an interface like sequential?

21:43 technomancy: krumholt_: functions or methods?

21:46 krumholt_: technomancy, both preferably

21:49 technomancy: krumholt_: in slime you can do C-c S-i to show all methods on an interface/class

21:49 there's something like that in c.c.repl-utils too, but I only use the slime one

21:49 krumholt_: technomancy, i'll try that thanks

21:49 tcrayford: clojure.contrib.repl-utils/show to be exact

21:50 Raynes: technomancy: Why Duby?

21:51 technomancy: Raynes: for android dev; you need the perf of a low-level language.

21:51 Raynes: persistent data structures suuuuuuuuuck if you don't have a good GC

21:52 Raynes: technomancy: I see. :)

21:52 joshua-choi: I don't we'll be seeing practical Clojure apps in phones for a long time

21:53 emacsen: what are people's favorite sax-like XML parser for clojure?

21:59 AntonyBlakey: Do you specifically want a push-model parser or just something that doesn't create a DOM. I generally prefer using pull parsers.

22:00 emacsen: AntonyBlakey, something that doesn't create a dom, as my input XML ranges from 1 meg to 300gb

22:00 AntonyBlakey: http://www.extreme.indiana.edu/xgws/xsoap/xpp/

22:01 emacsen: this appears to be pure Java

22:01 AntonyBlakey: Pull parsing is so much easier to code for because you effectively build a recursive descent processor using the pull parser as a token source.

22:02 Sure, but why is that a problem - the interface is *very* narrow and it's just a token source.

22:02 emacsen: AntonyBlakey, I don't know Java well, just barely enough to interface it with Clojure

22:03 AntonyBlakey: XML parsing is a commodity technology, so using a Java lib is going to be your best shot.

22:03 And this is just a jar, so you only need to know the interop to use it.

22:04 emacsen: I don't even see any docs

22:05 AntonyBlakey: http://www.xmlpull.org/

22:05 emacsen: thx

23:17 Raynes: mmarczyk: Holy hell! I Just realized it was you that wrote my accepted answer here: http://stackoverflow.com/questions/1931875/when-is-it-ok-to-use-an-ioref

23:18 Thanks for that again, by the way. <3

23:29 technomancy: so @(promise) is my new favourite way to test timeout behaviour.

23:29 down with Thread/sleep!

23:39 danlarkin: @(promise) rocks

23:40 remleduff: How does it help you with timeouts?

23:41 technomancy: remleduff: it just helps you cause them

23:41 since derefing a promise that's not in scope anywhere else is guaranteed to block.

23:42 forevah

23:42 remleduff: ah

23:42 danlarkin: I think there could be some clever tests written that involve promise and empty?

23:48 vIkSiT: hi all

23:48 whats the best method to split an integer into a sequence

23:48 ?

23:52 dnolen: vIkSiT: what do you mean?

23:53 vIkSiT: dnolen, well - converting 1234 to [1 2 3 4]

23:58 dnolen: ,(map #(Integer/parseInt %) (map str (seq (str 1234))))

23:58 clojurebot: (1 2 3 4)

23:59 vIkSiT: hmm, yes I thought of that..

23:59 I was trying to do it another way - divide by 10 and return rem as a sequence element

Logging service provided by n01se.net