#clojure log - Aug 02 2009

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

0:01 mebaran151_: svn always seemed too much for me

0:01 Anniepoo: so is *compile-path* an atom, or what? it's not very useful to tell us it needs to

0:01 mebaran151_: the nice thing about mercurial, you don't need any server

0:02 Chouser: *compile-path* is a var. Use 'set!' to change it at a repl.

0:02 Anniepoo: A loader classfile will produced in my/domain/lib__init.class, under *compile-path*, which must be in the classpath

0:02 thanks

0:03 ok, amazingly

0:03 it persists the state of the repl

0:03 LOL

0:03 I think that's how I 'corrupted' my old project

0:09 mebaran151_: oh that's happened to me a couple times

0:09 wondered why my nice fixed functions were neither nice nor fixed

0:09 clojurebot: http://clojure.org/rationale

0:10 Anniepoo: yes, but I've been working on this project for a couple weeks, have rebooted the machine many times

0:10 just how long is that supposed to persist?

0:11 mebaran151_: does IntelliJ give you an option to reset th repl?

0:11 Anniepoo: I work inside the Second Life environment. LSL has this problem - there's no save, only passivate,

0:12 so you can have scripts that have weird old state

0:13 mebaran151_: smalltalk had a solution to this whole conundrum but I forgot what it was

0:13 Chouser: heh

0:13 JAS415: save the whole damn thing?

0:13 mebaran151_: explicit saving is bad because it means you can lose work, but non-saving means you have less control of what actually goes in

0:14 in smalltalk you dev'ed inside this pretty neat image that saved saved the entire state of the app, not just the src

0:15 Anniepoo: there's a commercial product sold in second life that lets you record and play back an animation on an object

0:16 mebaran151: ,(= (fn []) (fn []))

0:16 clojurebot: false

0:16 mebaran151: ah nuts, you can't test function equality

0:16 Anniepoo: it works by recording into a list. Many people have used this to make other commercial products, all of which depend on their state not being reset

0:16 JAS415: ,(let [x (fn [])] (= x x))

0:16 clojurebot: true

0:17 JAS415: you can test equality they're just different object or w/e

0:17 mebaran151: but I wanted to see if two separately instantiated functions that were the same bytecode wise would compare the same

0:18 it also means I probably can't usefully use functions as keys in my index map :|

0:29 Anniepoo: ok, superstition reigns

0:30 before I try to use sh again I'm going to check everything into SVN

0:30 LOL

0:30 JAS415: superstition and voodoo are the ways of software development :-)

0:31 but you have to have superstition and voodoo locally bound when you are macroexpanding your forms or else you get a null pointer error which you can't locate

0:32 Anniepoo: I worked at a place, they had a programmer who had heard about some crazy method of

0:32 saving a few cycles in an assembler loop - so he did this all the time with his java

0:39 JAS415: i do maintenance on code of the 'spaghetti' variety, so its not so much a matter of figuring out the best way to fix it, it is the minimizing the negative side effects of bugfixes

0:39 is not so much software engineering, but controlling chaos

0:41 Anniepoo: I worked at a place where the boss was going slowly insane. Literally.

0:42 it didn't help his code much

0:42 clojurebot: http://www.khanacademy.org/

0:43 JAS415: i can imagine it would make for amusing comments though

0:43 Anniepoo: no, sadly just scary ones

0:44 JAS415: that's too bad :-/

0:45 Anniepoo: he was a rather polite guy, a 'jolly chinaman' sort. We started finding wildly obscene comments in his code

0:45 groan, I just noticed I imported all my class files

0:45 mebaran151: how would one convert an integer into 4 bytes in clojure

0:46 I seem to be failing

0:46 poor guy

0:53 Chouser: ,(seq (.toByteArray (.toBigInteger 23456M)))

0:53 clojurebot: (91 -96)

0:53 Chouser: mebaran151: there's probably a better way

0:54 JAS415: you can probably do something with byte masking

0:54 mebaran151: (into-array

0:54 (reverse (map

0:54 #(byte (bit-and (bit-shift-right n (* %1 8)) 0x000000FF))

0:54 (range 0 4)))

0:54 ))

0:54 JAS415: ?

0:55 mebaran151: this is what I've got

0:55 I think it's right but I'm not one hundred percent confident especially with negative numbers (where's uint when you need it...)

0:56 Chouser: ,(map #(byte (bit-and % 255)) (take-while pos? (iterate #(bit-shift-right % 8) 23456)))

0:56 clojurebot: (-96 91)

1:00 mebaran151: heh, yours is cooler, but I think we do the same thing

1:00 except you can handle longs with your fancy iterate method

1:01 now what I really want is lexographically orderable numbers (ie the largest into would be straight 1's and the smallest integer would be straight 0'))

1:01 clojurebot: (pl reverse $ (↕reduce range $ 10 () λxy (↕conj inc $ y x)))

1:02 Anniepoo: ok, putting all this in a repository is going to wait

1:03 after classpath hell I'm not in the mood to deal with it

1:04 mebaran151: eh

1:04 mercurial is super easy

1:04 hg init

1:04 hd addremove

1:04 hd commit -m "I'm done!"

1:04 *hg

1:05 Anniepoo: well, I know how to use svn

1:06 with the tortoise client it's pretty brainless as well

1:06 but I don't want to sort through what does and doesn't get added

1:07 before I go back to sh hell I'm going to go relax a bit

1:07 see ya

1:08 mebaran151: good luck

1:08 JAS415: oh man

1:08 clojure checks the namespaces inside of (comment *) things

1:08 mebaran151: huh?

1:08 JAS415: yeah for serious

1:09 mebaran151: how does it check?

1:09 Chouser: what do you mean by "checks the namespaces"?

1:09 JAS415: i had for example (twitter-api/blah-function stuff)

1:09 wrapped in a comment

1:09 ooh

1:09 mebaran151: and if you want a super comment #_() is your best bet

1:09 Chouser: ,(comment made-up/stuff blah/blah)

1:09 clojurebot: nil

1:09 JAS415: no it was checking

1:09 it was checking the tokens themselves

1:10 i had (comment (foo twitter-api/ ))

1:10 Chouser: ,(comment made-up/)

1:10 clojurebot: Invalid token: made-up/

1:10 Chouser: yeah, it has to be readable.

1:10 ,(command ###)

1:10 clojurebot: No dispatch macro for: #

1:10 JAS415: ,(comment ######)

1:10 clojurebot: No dispatch macro for: #

1:11 JAS415: oh well

1:11 mebaran151: it actually reads my contractions just fine (things like I'd and extra periods..)

1:11 JAS415: ,(comment i'd rather not write the code this way, but such is life)

1:11 clojurebot: nil

1:12 JAS415: ,(comment i'd rather not write the code this way; but such is life)

1:12 clojurebot: EOF while reading

1:13 Chouser: real block comments are on the to do

1:16 mebaran151: I've just been using ;;

1:16 doesn't #() work?

1:16 ,(comment I'd rather not work this hard)

1:16 clojurebot: nil

1:17 mebaran151: #_(comment I'd rather/ not work this hard)

1:17 ,#_(comment I'd rather/ not work this hard)

1:17 clojurebot: Invalid token: rather/

1:17 mebaran151: oh it still reads it: interesting

1:24 Anniepoo: and, without changing the code any, when I get back to my sh problem it now has a different error

1:25 8cD

1:25 JAS415: o

1:25 what's the error now

1:27 mebaran151: this channel by far has the most functional ircbot

1:30 clojurebot: they like me! they like me!

1:35 Anniepoo: the new error is more reasonably my problem

1:36 it's all working now

1:36 I don't like all the hidden 'what's my directory' games

1:37 8cP The next error, fittingly for today, is that repainting is triggering the process that launches photoshop

1:52 is sh taking place in a transaction? it shouldn't get retried

1:56 mattrepl: hrmm, CPBezierPath appears to no longer have a setStroke:, setFill:, or set: to indicate the color used when drawing. I must be missing something

1:57 Anniepoo: it probably picks up the Java2D stroke/fill?

1:58 and what lib is this?

1:58 cause I could use a bezier

1:58 mattrepl: oh my.. it's late here... =) that was meant for #cappuccino. sorry for the noise

2:52 mebaran151: is let a special form in clojure or does it do it scheme style by translating the let block into an anonymous closure (at least how I understand it)

2:56 hoeck1: mebaran151: its a special form, but compiles into a inner class, like fn does

2:56 r/a/an

2:57 mebaran151: compiler doesn't do a straight substitution?

3:04 hoeck1: mebaran151: oh, you're right, seems it doesn't generate the same code as with fn

3:05 mebaran151: interesting

3:06 the fn solution always seemed really pure

3:06 that scope was determined by execution

3:06 hiredman: sure "pure" but so is cons cells made from lambdas

3:06 but no one does that either

3:07 I have not looked at clojure's specificly, but the logic for handling lambdas can be significantly more complex then what is needed for let

3:09 mebaran151: all lets could be resolved at compile time can't they?

3:10 hiredman: resolved?

3:12 tomoj: I wonder how long it will take me to have any clue what the hell you people are talking about in here

3:12 mebaran151: as in you wouldn't need to keep any trace of them around

3:13 there shouldn't be any need to have the extra layer of functional indirection so I guess it's a wise compile time optimization

3:13 hiredman: I dunno, my interpreter handles lambdas and lets, but I have gotten around to adding handling of anything besides λ to the compiler

3:14 haven't

3:16 mebaran151: tomoj, I was just wondering if clojure handled lets the way scheme does, by building essentially an anonymous function

3:17 tomoj: I guess it would be helpful if I had learned scheme and really learned lisp well. only toyed around with lisp some.

3:19 mebaran151: let [x y 1 2] (g x y) => (fn [x y] (g x y)) 1 2)

3:19 see

3:19 hiredman: (mentioned in the mit sicp videos)

3:20 mebaran151: I read the book rather than watching the movie :)

3:23 hoeck1: mebaran151: you can use sth. like http://java.decompiler.free.fr/ to decompile clojure generated bytecode

3:23 and see how it handles lets and fns

3:24 mebaran151: might do it

3:31 hiredman: clojurebot: en to sp metaphor

3:31 clojurebot: Huh?

3:31 hiredman: clojurebot: translate en to sp metaphor

3:31 clojurebot: translate en to es metaphor

3:31 :(

3:36 mebaran151: I've gotta admit, clojurebot is the most functional ircbot I've seen in the programming channels on freenode

3:37 hiredman: his translation function seems to have bitroted

3:40 clojurebot: translate to es: metaphor

3:40 clojurebot: metáfora

3:41 hiredman: still works, I just forgot how to use it

3:55 jwhitlark: What do you do in clojure when you would use an event loop in another language?

3:56 idiomatic clojure, I mean.

3:57 hiredman: depends

3:57 there is always loop/recur

3:57 jwhitlark: mmm, just an infinite loop that way, ok, that makes sense.

3:58 mebaran151: is there a programmatic macro to express every loop recur as a while?

3:59 I find myself writing a lot of loop (if blank recur) (return result stuffs)

4:01 hiredman: while only breaks the loop if the test ever becomes nil, which can only happen via some kind of side-effect

4:01 so loop/recur is more general

4:02 the other option is to replace an infinite loop with an infinite seq

4:02 possibly using interate or repeatedly

4:04 jwhitlark: huh, as simple as (loop [] recur))

4:04 hiredman: ,(loop [] (recur))

4:05 clojurebot: Execution Timed Out

4:05 hiredman: ,(take 10 (iterate inc 0))

4:05 clojurebot: (0 1 2 3 4 5 6 7 8 9)

4:08 jwhitlark: tnx. that does the trick. I just wanted to make sure i wasn't learning a bad habit.

4:12 mebaran151: hiredman, if I have a let binding that references a global variable which I rebind inside a function body, will the variable I assigned using let point to the old global or the new thread local?

4:13 hiredman: mebaran151: you can use a lexical binding to capture a dynamic binding

4:13 mebaran151: okay

4:13 I think that'll work out

4:14 hiredman: ,(binding [+ 1] (let [+ +] (future +)))

4:14 clojurebot: #<Object$Future$IDeref@1ab6c1c: 1>

4:14 hiredman: ,(binding [+ 1] (future +))

4:14 clojurebot: #<Object$Future$IDeref@108f060: :pending>

4:14 hiredman: zounds

4:15 mebaran151: (defn scoper []

4:15 (let [g *global*]

4:15 (binding [*global* 2]

4:15 [g *global*])))

4:15 this works as it should actually (sorry about the flood)

4:32 lbj: Morning guys

4:39 LauJensen: I've decided on a nick! :)

4:39 Does anyone here have a Youtube account ?

4:40 * kotarak has one?

4:40 LauJensen: Hey my friend

4:40 kotarak: Hi Lau!

4:40 LauJensen: Tell me - Hows uploading handled? Does it accept all formats and converts them to a fixed size?

4:40 kotarak: Oerk.

4:41 I uploaded something there once, and it was bad quality afterwards. :/

4:41 But there are a lot of information on the net, which codec to use and which format.

4:41 LauJensen: Im working on a site which accepts video uploads and I need some hints on how to handle it

4:43 kotarak: Just some random google result: http://www.pcmag.com/article2/0,2817,2330990,00.asp

4:43 There is much more.

4:44 But I don't know the details. I'm happy that I got done the screencasts like they are now. :) Let alone tune things...

4:45 LauJensen: Alright, thanks

4:47 Wow, I'll need a new server, they accept 1GB uploads

5:40 tomoj: is there a nokogiri for clojure?

5:40 or should I just use java stuff?

5:47 enlive looks promising

6:07 lisppaste8: Sofra annotated #84536 "untitled" at http://paste.lisp.org/display/84536#1

6:42 LauJensen: tomoj: I dont know about nokogiri, but if youre looking for a functional parser, best bet is Enlive

6:42 tomoj: LauJensen: thanks, just got it working a minute ago, looks great

6:43 LauJensen: Yea, check out clj-me.blogspot.com for more from the creator

6:43 tomoj: I do like being able to type css selectors as strings better, but eh

6:58 LauJensen: Att Chouser rhickey or whoever manages clojure.org, there are still links pointing to google code under libraries.

7:10 rhickey: LauJensen: thanks, fixed

7:10 LauJensen: rhickey: np :)

7:14 rhickey: Did you have a specific argument for not implementing import foo.*, or is it something thats coming later?

7:28 rhickey: LauJensen: import * makes a mess

7:29 imports are runtime-enumerable, not just a compiler thing

7:29 and, given only selective imports, we might be able to use them to do more inference on host calls (not yet implemented)

7:31 LauJensen: Ah ok - Good to know. I had the impression that this was strictly something that the compiler needed to handle, so why should I be bothered? :) Thanks for clearing it up

7:33 Btw rhickey. I have put some working into wrapping JMonkey, which ultimately is making a bunch of Java classes and then extending them. like VehicleClass would be extended with cannons etc to become a tank class. Im currently using only gen-class, but is this a use case of new new ?

7:35 rhickey: the intended usage of new new is: define (or use existing) statically-named interfaces, make factory fns that call new new to make anonymous implementations of those interfaces. If that fit, sure, use it

7:35 in many cases people use named classes and explicit ctor calls when they shouldn't

7:38 LauJensen: That doesnt fit unfortunately, I was looking forward to using it. Im not sure I understand how you would make the distinction between when its correct to use named classes and explicit ctor calls though.

7:38 rhickey: only when forced to

7:40 LauJensen: k

8:26 I have a project with many namespaces nested. In the top namespace foo, I want to import a static javaclass that I can reference like Priority/DEBUG. Can I make that automatically available to all namespaces beneath foo, like foo.bar, foo.baz, foo.bar.baz etc without having to specificially import priority in those namespaces, and without giving a fully qualitfied name

8:29 Chousuke: LauJensen: As far as I know, no.

8:36 LauJensen: Ok

10:00 l0st3d: newbie question: if I have a lazy list of things, how do I find out if the count is larger than a number or not, without necessarily traversing the whole list

10:00 rhickey: l0st3d: there isn't a built-in limited count like that

10:01 easy enough to write, but you will realize as much of the list as needed

10:02 l0st3d: rhickey: ok, so I guess I'd like a little help in writing that

10:02 rhickey: do I take-while?

10:04 rhickey: I'm not sure how to write the predicate without a temporary variable

10:05 rhickey: l0st3d: loop/recur should work. Give it a try and paste something

10:05 lisppaste8: url

10:05 lisppaste8: To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.

10:08 lenst: (defn count-larger? [coll n] (> (count (take (inc n) coll)) n))

10:10 l0st3d: lenst: oh - thanks ... that's a much better solution that the one I was in the middle of concocting

10:16 Jomyoot: do you guys recommend vanila emacs or cocoa emacs for OS X?

10:16 cooldude127: Jomyoot: cocoa emacs is now the official one

10:16 Jomyoot: emacs 23 uses cocoa, and it is now the stable release

10:16 Jomyoot: what do you mean?

10:17 but it is still different from the aquamacs?

10:17 i was talking about aquamacs sorry

10:17 cooldude127: i recommend plain emacs 23

10:17 aquamacs has had certain things not work for me that work on other platforms

10:18 colorschemes in particular are a problem

10:21 Jomyoot: cooldude127: what do you use for directory browser, or project browser?

10:22 cooldude127: nothing. i use ido-mode for easy file navigation in the minibuffer but that's about it

10:22 gko: Yep, I also use standard Emacs on my Mac, no Aquaemacs.

10:22 cooldude127: Jomyoot: you could use ecb or speedbar if you wanted though

10:25 l0st3d: Jomyoot: I like eproject : http://wiki.github.com/jrockway/eproject - it's also available in ELPA

10:39 lisppaste8: l0st3d pasted "compare the length of a seq" at http://paste.lisp.org/display/84623

10:40 l0st3d: lenst: decided on this - thanks

10:46 rhickey: important enhancement to mutable vectors in chunks branch: http://github.com/richhickey/clojure/tree/chunks

10:47 now protects against use in multiple threads, prevents use after immutable! call

12:02 Lioness: What does the EPL mean? Are all programs that have been programmed in Clojure, automatically under EPL because clojure.jar is necessary? Or can you choose other licenses for programs (GPL, BSD, proprietary)?

12:13 danlarkin: Lioness: the latter

12:16 Lioness: danlarkin: Thanks for the information. But how could I have found that out myself? I read the text of the EPL, but I find it not easy to understand. For example, in "3 Requirements": if I distribute object code I must do so in compliance with the terms and conditions of the EPL (wo I guess under the EPL), if I distribute source code, it must be "under this Agreement". What do I misunderstand? It's probably easy, once you have experience with

12:18 danlarkin: the EPL doesn't cover code you write (unless you want it to, of course), only clojure itself

12:18 Lioness: Okay, so the difference to the GPL is what is usually called "viral" and the EPL is not "viral", right?

12:19 danlarkin: you can use gcc (GPL) to compile proprietary code, can't you?

12:19 Lioness: only by special exception for libgcc (which I would see quite similar to clojure.jar)

12:22 danlarkin: oh, is that correct? That's not my understanding

12:23 Chousuke: yeah, the GCC licence contains an exception

12:24 Lioness: libgcc2.c says: "In addition to the permissions in the GNU General Public License, the Free Software Foundation gives you unlimited permission to link the compiled version of this file into combinations with other programs, and to distribute those combinations without any restriction coming from the use of this file. (The General Public License restrictions do apply in other respects; for example, they cover modification of the file, and di

12:24 clojurebot: this is not a bug

12:28 danlarkin: Lioness: well I see your point now more clearly

12:29 Chousuke: Lioness: the EPL FAQ says that you can combine EPL-licenced code with proprietary code. However, it seems that if you actually modify the EPL-licenced code itself and distribute it, you need to distribute the modifications as well.

12:31 so it seems you can't take Clojure, modify it, and then start distributing closed-source copies of it. You can, however, take clojure as is, use it with proprietary code, and distribute the result under your own licence.

12:34 Lioness: I have no idea how the topics "linking" or "derivative" are generally dealt with in the Java world, coming more from a C background. I was just thinking about the FSF's stance, that all Emacs Lisp programs have to be GPL'ed. But I see I'll have to read the EPL FAQ in detail (thanks, I didn't know it existed) and understand, which situations are covered by answer 17 ("the EPL portion") and what exactly is deemed a "module".

12:34 Chousuke: But your interpretation sounds plausible and sensible.

12:36 Chousuke: with lisp, it gets even messier because of macros :P

12:36 *technically* if you use a clojure macro in a lisp program, you're introducing EPL code to it.

12:38 danlarkin: interesting

12:38 Lioness: Chousuke: Sure, but I'm doing it with every special form, not just defmacro. Even when using a macro the result should be *my* work, since I have defined the transformation, right?

12:38 Chousuke: since I suppose it can't be argued that you've *modified* the code, it should not be a derivative work. And I'm sure it's not Rich's intent either.

12:41 Lioness: if the macro is defined in the Clojure library, you're not the one who defines the output; you're simply passing it the parameters and the macro generates code for you.

12:41 Templates in C++ are similarly problematic I suppose.

12:43 wtetzner: well, technically macros are just functions, right?

12:43 Chousuke: well, yeah

12:43 wtetzner: it's just that they're called at compile time

12:44 mebaran151: is there any more elegant way to pass a macro like a function

12:44 Chousuke: mebaran151: that rarely makes any sense.

12:45 but if you need to, you can use #'macroname

12:45 mebaran151: I was thinking of something like (reduce and [all my booleans])

12:45 actually I guess I could use every now that I think about it

12:45 Lioness: Chousuke: Yes, but I think it doesn't differ substantially from other special forms. I cannot use "def ..." with the JVM, I need clojure.jar. Using Clojure's language features surely involves CLojure's code. And that's basically where my question arouse: I depend on EPL code not unlike the C concept of "linking"

12:46 mebaran151: isn't this the whole reason for a classpath exception?

12:47 Chousuke: mebaran151: hm. yeah, you definitely should use every

12:47 Lioness: The FSF takes a really broad stance in that regard, btw: They consider all Emacs Lisp code to be covered by the GPL, as far as I know.

12:47 Chousuke: though the vars of macros have an interesting property:

12:47 ,(#'and 1 nil 3)

12:47 clojurebot: (clojure.core/let [and__4012__auto__ 1] (if and__4012__auto__ (clojure.core/and nil 3) and__4012__auto__))

12:47 Lioness: mebaran151: That's probably the Java counterpart to the libgcc- and the system library exception?

12:49 Chousuke: Vars forward calls to them to the underlying value, which in the case of a macro happens to be the function that produces the macro expansion :P

12:49 not very useful in practice though.

12:49 mebaran151: interesting

12:50 Chousuke: and you can make a macro out of any function by calling .setMacro on it.

12:52 ,(.setMacro #'+)

12:52 clojurebot: nil

12:52 * Chousuke breaks Clojurebot thus

12:52 Chousuke: ,(let [foo 1] (+ foo 1))

12:52 clojurebot: java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.Number

12:52 Chousuke: ,(alter-meta #'+ dissoc :macro)

12:52 clojurebot: java.lang.Exception: Unable to resolve symbol: alter-meta in this context

12:52 Chousuke: ,(alter-meta! #'+ dissoc :macro)

12:52 clojurebot: {:ns #<Namespace clojure.core>, :name +, :file "clojure/core.clj", :line 629, :arglists ([] [x] [x y] [x y & more]), :inline-arities #{2}, :inline #<core$fn__4091 clojure.core$fn__4091@14ef239>, :doc "Returns the sum of nums. (+) returns 0."}

12:53 Chousuke: ,(alter-meta! #'and dissoc :macro)

12:53 clojurebot: {:ns #<Namespace clojure.core>, :name and, :file "clojure/core.clj", :line 503, :arglists ([] [x] [x & next]), :doc "Evaluates exprs one at a time, from left to right. If a form\n returns logical false (nil or false), and returns that value and\n doesn't evaluate any of the other expressions, otherwise it returns\n the value of the last expr. (and) returns true."}

12:53 Chousuke: ,(and 1 2)

12:53 clojurebot: (clojure.core/let [and__4012__auto__ 1] (if and__4012__auto__ (clojure.core/and 2) and__4012__auto__))

12:53 Chousuke: :P

12:54 ,(alter-meta! #'and assoc :macro true)

12:54 clojurebot: {:macro true, :ns #<Namespace clojure.core>, :name and, :file "clojure/core.clj", :line 503, :arglists ([] [x] [x & next]), :doc "Evaluates exprs one at a time, from left to right. If a form\n returns logical false (nil or false), and returns that value and\n doesn't evaluate any of the other expressions, otherwise it returns\n the value of the last expr. (and) returns true."}

12:54 Chousuke: hm

14:46 gnuvince: "C'est à mon mononcle!" -Guerre de Tuques

15:01 MarkVolkmann: The doc for commute says "At the commit point of the transaction, sets the value of ref to be:

15:01 (apply fun most-recently-committed-value-of-ref args)".

15:01 Looking at the source code in LockingTransaction.java, that doesn't seem to be the case.

15:01 I see this:

15:01 f.fn.applyTo(RT.cons(vals.get(ref), f.args))

15:02 vals is a HashMap of in-transaction values, not most recently committed values.

15:02 Is it possible the doc string for the commute function is wrong?

15:05 LauJensen: Big question :)

15:06 MarkVolkmann: I'll ask it again on the mailing list.

15:14 LauJensen: Good idea

15:15 I have a question also. I'm implemented a small webchat which updates by polling a servlet for recent posts in the chatroom. How would I go about removing the polling and instead pushing to the clients ? (ala, CLs Symbolic Web)

15:16 walters: LauJensen: the typical trick is to do a HTTP request which only returns when there are changes

15:16 LauJensen: How long will one such linger?

15:16 walters: as long as possible, if it breaks just do another

15:18 LauJensen: Ok - Do you have example of this floating around somewhere, it sounds interesting

15:19 walters: LauJensen: http://xmpp.org/extensions/xep-0124.html

15:20 LauJensen: I'll have a read, thanks

16:00 cgrand: MarkVolkmann: look at the if(!sets.contains(ref)) a few lines above, it retrieves the latest value

16:03 mebaran151: where should I put test packages?

16:50 slaney: I am messing around in the REPL, and finding that using integers as keys for maps, so I can randomly generate the keys, doesn't work as I expected.

16:50 http://gist.github.com/160207

16:53 hiredman: Doubles are Doubles

16:53 Integers are Intergers

16:53 LauJensen: slaney: Baz is a Long

16:53 slaney: I figured it was something to do with Typing

16:53 hiredman: Longs are Long

16:53 slaney: heh

16:54 hiredman: etc

16:54 slaney: when I called (integer?) on them, they both return true

16:54 but, you are saying that doesn't matter?

16:54 LauJensen: Call class

16:54 slaney: k

16:54 hiredman: ,(doc integer?)

16:54 clojurebot: "([n]); Returns true if n is an integer"

16:54 hiredman: ,(integer? (double 1))

16:54 clojurebot: false

16:55 hiredman: hrrm

16:55 slaney: ok, so 1 is an Integer, and bar is a Long

16:55 hiredman: Math/round returns a long

16:55 slaney: can I cast it?

16:55 hiredman: sure

16:56 slaney: k

16:56 I will look that up

16:56 hiredman: int, long, double, etc

16:56 slaney: thanks

16:56 got it

16:56 thanks

16:56 user=> (foo (int bar))

16:56 "foot"

16:57 hiredman: ,(class (first (keys foo)))

16:57 clojurebot: java.lang.Exception: Unable to resolve symbol: foo in this context

16:57 slaney: yeah, it returns in Integer

16:58 *an

16:58 hiredman: hmmm

16:58 ,({1 :foo 2 :bar} (int 1))

16:58 clojurebot: :foo

16:58 hiredman: ,({1 :foo 2 :bar} (long 1))

16:58 clojurebot: nil

16:58 hiredman: ,({1 :foo 2 :bar} (Integer. 1))

16:58 clojurebot: :foo

16:59 hiredman: *shrug*

16:59 slaney: heh, those are more succinct examples, but yeah

16:59 hiredman: I would start a new repl to make sure everything is as you think it is

16:59 slaney: true

16:59 LauJensen: ~seen blackdog

16:59 clojurebot: no, I have not seen blackdog

16:59 LauJensen: Anybody know what happend to him ?

17:05 arbscht: blackdog's last appearence in my log is in March

17:14 LauJensen: Thats a shame, he had an interesting take on webdevelopment

17:15 But - Denmark is approaching midnight, good night to all in Clojure land :)

19:47 JAS415: classpath so frustrating

19:47 argh! :-P

19:52 ah there we go...

21:53 mebaran151: does apply work with lazy-seqs?

21:53 (apply #(lazy-cat %) (drop 1 (iterate fetcher from))) << needs to be lazy

22:09 Chouser: mebaran151: I don't think that'll come back, but it's more because of lazy-cat than apply

22:09 what are you actually trying to do?

22:09 mebaran151: I'm reworking by wrapping fetcher to return a lazy-seq

22:10 Chouser: ok

22:10 mebaran151: I'm trying to fetch records from a bdb n at a time

22:10 so I have a function fetcher that knows how to get 10 more records

22:12 and I'd like to automatically get more records when the user iterates past the ones we've already gotten

22:19 to get more I can pass the collection, fetch the last one and restart the cursor from there

22:27 if I concatted a collection created from iterate, it would maintain its laziness correct?

22:49 Chouser: sure

23:48 huh. gen-class isn't a good substitute for gen-sym

23:48 of gensym for that matter

Logging service provided by n01se.net