#clojure log - Dec 30 2009

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

0:01 wdouglas: Hrm yea I can't seem to get slime-connect to work using :dependencies [[org.clojure/clojure "1.0.0"]]

0:01 To lein swank that is

0:02 technomancy: devlinsf: applied and pushed your patch

0:02 (after removing the tabs =)

0:02 devlinsf: technomancy: Cool

0:02 technomancy: thanks!

0:02 devlinsf: Glad I could help

0:02 wdouglas: I'll try to use clojure 1.1 and try a M-x slime and see if that will do completion or fail

0:04 technomancy: wdouglas: that will probably cause errors anyway

0:04 bytecode compiled from clojure 1.0 won't work with 1.1

0:04 you'll need to remove all the .class files from the swank-clojure jar =\

0:05 (in the future swank-clojure will not be AOT'd for this reason)

0:05 wdouglas: Ah that makes sense

0:05 Hrm well I'll figure out how to remove the .class files. I haven't worked in java really so that will be interesting

0:06 technomancy: wdouglas: you could also try http://repo.technomancy.us/swank-clojure-1.0.2.jar

0:06 that is a build without AOT

0:06 though it's a newer version

0:06 wdouglas: Worth a shot.

0:07 technomancy: you'd want to confirm it works in 1.0, then see if moving to 1.1 breaks it

0:07 thanks for looking at this!

0:07 wdouglas: No problem, thanks for all the effort in getting this going. Seriously I'd be stuck with some hackity system without your glue

0:08 technomancy: I wish I had time to give it the attention it deserves

0:09 wdouglas: This alone could be somebody's full time job, can only do so much

0:10 In another year though I'm sure there will be even more people working away on the start you've made with all of it

0:17 technomancy: You took care of the reader macro warning too, I should have been using this version =)

0:18 Okay same error with clojure 1.0

0:19 When trying to do a slime-connect

0:19 So I'll try out and see if 1.1 will work in the same way 1.0 did

0:27 technomancy: wdouglas: cool; can you post your findings to the swank-clojure mailing list?

0:27 I'm taking off for the night

0:31 wdouglas: technomancy: will do, later

2:02 KirinDave: Um

2:02 ,(str (doall (interpose "[^A-Z]*" "TEST")))

2:02 Why doesn't that doall work?

2:03 Oh wait nevermind

2:03 Problem with coding after 11

2:03 Lol

2:12 vy: tomoj: I couldn't spot Language class in the J2SE6 API Spec. Would you mind showing it?

2:30 polypus: is it safe to so this `(if p (let [x# :foo] ...) (let [x# :bar] ...)). letting x# twice in a syntax quote?

2:31 s/so/do

2:33 mitchellh: polypus: You may want to macroexpand that to see whats going on. I'm not too experienced so I'm not sure but I'd assume they'd expand to the same variable, but the inner let would shadow the outer let

2:34 polypus: mitchellh: the lets aren't nested

2:34 mitchellh: polypus: Ah, then in my opinion sure, why not

2:34 polypus: k, ty

2:37 checked and yeah they expand to the same var, but then right, no matter

2:52 LauJensen: polypus: Sure you don't mean (if ~p ...) ?

2:53 polypus: LauJensen: sure but i wasn't so concerned with that in the example

2:55 but thx for pointing it out

2:55 LauJensen: np - sometimes copy/paste errors can take a while to hunt down :)

5:18 morphling: hi guys, is there a common mistake that leads to a java.lang.UnsatisfiedLinkError?

5:42 vy: IMHO, an integration of Clojure into SCons would be an interesting study.

7:27 CalJunior: Another classpath question: for the Clojure TextMate bundle this time.

7:28 since add-classpath has been deprecated, how can I add my jar files to the classpath in TextMate?

7:44 I feel like I'm driving a FIAT into a Ferrari dealership and asking how to fill up the tank.

7:45 I have it up and running on emacs, but I'm giving TextMate one last spin before I decide if I will move over to the dark side.

7:46 unfo-: CalJunior, shouldn't you be asking this in #TextMate then?-)

7:48 CalJunior: True. Off to the FIAT shop :-)

8:21 fliebel: What is the goal of Clojure-CLR? Being compatible with the JVM Clojure? Or more like implementing the ideas of Clojure while being as close as possible to the CLR, like Clojure is close to the JVM?

8:21 I mean… A CLR string is not going to have the same methods as a JVM string I guess....

8:22 unfo-: fliebel, you talkin' about .NET CLR or something completely homonymous?

8:22 fliebel: the net one

8:22 unfo-: oooo *googles*

8:23 altho as with ironruby DLR is prolly the place it'll end up instead of CLR

8:24 iirc John Lam said he spent too many nights trying to magick ruby into CLR before going with DLR

8:25 fliebel: I know nothing about net stuff… I was just wondering if it it a version of Clojure running on net or a lisp that resembles Clojure running and using the net thing.

8:25 unfo-: -- Implement a feature-complete Clojure on top of CLR/DLR. -- Stay as close as possible to the JVM implementation.

8:25 http://github.com/richhickey/clojure-clr it says Goals right there :)

8:27 fliebel: But does that mean it's going to emulate a java string?

8:28 unfo-: ah. That I do not know

8:28 just git cloned it :)

8:29 fliebel: I'm curious how similar the 2 vm's are...

8:37 chouser: I'm not sure that's all been worked out yet

8:38 but I suspect that core (and probably contrib) functions in Clojure will work on either kind of String, while direct method calls will be platform-specific.

8:39 fliebel: hmm, that sounds reasonable.

8:39 noidi: does anyone here use lein-swank?

8:40 when I "M-x slime-connect" to the swank started with "lein swank", "(use 'clojure.test)" fails with "java.lang.ExceptionInInitializerError"

8:40 but it works fine in "lein repl"

8:42 rrc7cz: in Practical Clojure there is the following statement, "If you implement this method as a generic dispatcher for “messages” sent to the closure, it can have the beginnings of a full objet system". Can somebody explain this a bit more, maybe with an example? He also says, "...closures can be viewed as an object with a single method."

8:42 fliebel: Is there any decent documentation on for? The api doc is very terse. I'd like to know some more about the modifiers, especially while and when.

8:44 unfo-: fliebel, Programming Clojure at least has some examples of its use

8:45 fliebel: onfo-: I don't own that book.

8:45 unfo-: there is one way to remedy that ^^ but I was just pointing it out as I do and it has proved valuable :-)

8:46 fliebel: I see...

8:47 Is it correct that :where only executes body if the expression is true and :while only goes through the seq until it's false?

8:47 chouser: rrc7cz: "Programming Clojure"?

8:47 rrc7cz: nah, Practical Clojure from Apress

8:47 they have a 25% xmas sale so I picked up the first four chapters (alpha program)

8:48 I wasn't going to get it because I already have Stuart's book (which is excellent) but I'm glad I did because it's covering some fp concepts not covered in Prog. C

8:48 fliebel: I got a for loop with a :when that should itterate over all the files for which :when is true, but it does so only for the first one...

8:48 chouser: Ah, it's title has been a bit different in a couple places.

8:49 rrc7cz: aha. the PDF says Practical Clojure, at least for now

8:50 the third chapter covers closures and currying which is really nice

8:50 but I'm not sure I understand his statement about closures being able to simulate an object system

8:51 fliebel: My assumption seems correct, since (for [x (range 10) :when (odd? x)] x) returns (1 3 5 7 9).

8:53 unfo-: fliebel, http://gist.github.com/266062

8:53 yeah similar example from the book as you just wrote

8:53 chouser: rrc7cz: an object is something that holds data and has some methods you can call that have access to that data. A Clojure fn is also an object -- you can think of the locals it closes over as being its instance data, and calling it is like calling the single method of that object.

8:53 rrc7cz: does that do anything for you? :-)

8:54 fliebel: unfo-: thanks… that confirms how I think it should work, but not how my code can fail… :(

8:54 rrc7cz: chouser: but where does the closure some into play?

8:54 Chousuke: rrc7cz: you can can close a function over other functions essentially tying them to the object.

8:54 or any object, I guess

8:54 rrc7cz: I was thinking you could have a fn-creator which has bindings x, y, z, and it creates fns with closures on x, y, z and so those fns are basically methods acting on the field members x, y, z

8:55 Chousuke: something like that.

8:55 rrc7cz: okay

8:55 Chousuke: I'm still not sure if my understanding of object and ADTs is correct though :/

8:55 rrc7cz: and if x, y, z are some mutable type like refs, then you really do have a real mutable object

8:55 Chousuke: objects*

8:56 unfo-: fliebel, use the gist, luke! ^^

8:56 fliebel, btw http://github.com/richhickey/clojure/blob/master/src/jvm/clojure/lang/StringSeq.java http://github.com/richhickey/clojure-clr/blob/master/Clojure/Clojure/Lib/StringSeq.cs

8:56 fliebel, in simple cases the code is quite identical ^^

8:57 rrc7cz: chouser: so without closures, you're limited to single-method objects, unless you use globally defined vars, but then it's not really an obj because it's not encapulated. So closures are the release valve that allow you to have more than a single method object

8:58 chouser: hm...

8:59 Chousuke: you don't really need methods bound to the data anyway.

9:00 fliebel: unfo-: I see your gist. My problem is that the body of the loop is called, and at the same time isn't. The result is there, but putting any print in the loop or used function gets only called once.

9:00 triyo: I'm trying to catchup on the whole deftype and defprotocol stuff. Where can I give it a test drive? branch?

9:00 rrc7cz: chousuke: what do you mean? if the data is only locally bound in the fn via let or some arg, then it would be garbage collected once the fn returns if there were no other fns holding a closure to that data

9:01 chouser: rrc7cz: I suppose you can think of a non-closure fn as a method of the global data space. But I don't see how that relates to multiple methods per object.

9:01 Chousuke: rrc7cz: I mean you can do things using ordinary functions :)

9:01 unfo-: fliebel, I meant paste your code ^^

9:02 rrc7cz: Chousuke: definitely, I'm just trying to figure out Luke's statement in this book

9:02 fliebel: unfo-: ah, I see… I'll do so, but it's not something you can understand from the snippet alone I think. One moment.

9:02 Chousuke: well, hm

9:03 fliebel: http://gist.github.com/266068

9:03 unfo-: fliebel, that doesn't sound like functional programming to me! side effects lurking about?-)

9:03 triyo: anyone? is protocol stuff in the master or some specific branch?

9:03 Chousuke: triyo: new

9:03 rrc7cz: chouser: right, but then if you don't want methods on a global data space, you need fns holding closures since they can operate on locally bound data

9:03 Chousuke: the 'new' branch that is

9:04 fliebel: unfo-: hmmm, it's with files, so not that functional, but id the files are the same so should the result.

9:04 triyo: Chousuke: thx

9:05 unfo-: fliebel, why do you use pages (do-action :files (file-seq...)) instead of just file-seq?

9:05 rrc7cz: I'm thinking something like this: http://gist.github.com/266069

9:05 fliebel: unfo-: That is my plugin system

9:06 unfo-: It calls all functions registered for :files with the files as argument.

9:06 Chousuke: fliebel: where's the code?

9:06 fliebel: http://gist.github.com/266068

9:06 rrc7cz: you could then call (def person (create-person-object)) and later ((person "set-name") "Rob")

9:06 Chousuke: rrc7cz: that would be evil though, since it's mutable :)

9:06 unfo-: fliebel, well that would be the place I'd look for trouble if you are only getting the first file with for [pages ..

9:07 rrc7cz: well it uses reffs

9:07 unfo-: fliebel, hard to say since i don't know the dependencies of your other functions and their possible side-effects

9:07 rrc7cz: and if you're making objects, I suspect you'd want mutability

9:07 Chousuke: rrc7cz: well, that doesn't really help if the refs are just used to emulate mutability.

9:08 fliebel: unfo-: Don't think so… the plugin happens outside the loop, putting a print inside the loop fires only once. Besides that, there is no plugin registered for :files currently.

9:08 Chousuke: the more functional approach would be just to do (def person (ref (make-person))) (alter person assoc :name "rob")

9:08 ... alter in dosync, of course

9:08 rrc7cz: Chousuke: I completely understand

9:08 unfo-: fliebel, remove the call then and see if it works with for [pages (file-seq ... )]

9:09 rrc7cz: Chousuke: in this book, Luke is explaining that closures can be used to create an object system, and I'm just trying to figure out how

9:09 Chousuke: rrc7cz: well, you pretty much have it.

9:09 rrc7cz: looks like

9:09 unfo-: now it's time to head home!

9:09 fliebel: unfo-: I'll remove all I can and tell you what happened...

9:10 rrc7cz: since fname and lname are not global data, but rather local with X methods holding closures to them

9:10 Chousuke: rrc7cz: another way would be to have a monadic kind of approach

9:11 rrc7cz: where your objects are still functions, but are passed to functions that know how to access things "inside" the object.

9:11 and return new objects

9:16 fanatico: rrc7cz: if you have the time, check out chapter three of SICP. they implement objects using closures and a dispatch method during a discussion on mutable data. really enlightening.

9:18 rrc7cz: fanatico: great, I have the book but haven't gone through it yet

9:33 triyo: Is there a way to generate docs from clojure doc-strings?

9:34 For example, I am pointing to *new branch now of clojure and wish to generate the docs form the doc-strings

9:34 fliebel: trivo: don't know how, but I believe the clojure api is made that way...

9:34 Chousuke: hm, aren't they online already?

9:34 I think the doc generating code is somewhere too

9:34 CalJunior1: it seems the textmate clojure bundles are just not up to scratch and are starting to smell like abandonware. the dark side it is then: emacs.

9:36 slime seems to work just fine. the only issue I have is that the code seems to evaluate in the mini-buffer rather than the slime-repl buffer.

9:36 fanatico: triyo: I think the http://richhickey.github.com/clojure/ docs use http://github.com/tomfaulhaber/contrib-autodoc.

9:38 incanter uses it as well, if I remember correctly.

9:38 fliebel: AAAARGH, laziness bit me :S Is it possible that certain things do not work due to laziness? My for loop did work when I doseqed over it on the repl.

9:38 chouser: doseq should force a 'for' seq

9:38 CalJunior1: I want the emacs repl to work like it does for Rich in his magical presentations. I am using C-x C-e for evaluation. I am doing it wrong?

9:38 chouser: clows: Rich uses clojure-mode, not slime, I believe.

9:39 fliebel: chouser: then how is this possible? I'm going to try some more, but depending on how I threat the result of the for loop my actions run or not.

9:43 chouser: yea, as long as I do not use the result it does not run the actions. But now the question remains why in my application it behaves like I'm using one of them.

9:44 How do I un-lazy an seq?

9:44 replaca: triyo: the doc generator stuff is at github.com/tomfaulhaber/contrib-autodoc (soon to change name to just autodoc). But it is tricky to set up in its current incarnation.

9:45 I'm about to have a version that will be easier to run on anything

9:45 rhickey: fliebel: if you care about its contents, doall, otherwise, dorun

9:45 fliebel: rhickey: thanks :)

9:46 replaca: and then I will implement multi-branch support and we'll publish the docs for the new branch on the site

9:46 rhickey: replaca: awesome

9:46 is everybody ready for 1.1? no problems with rc3?

9:47 fliebel: rhickey: thanks again! that solved the problem I had for over a day now....

9:47 replaca: rhickey: seems good to me

9:47 saml: can I see load-path (emacs variable) in clojure repl? so that i can pretty print it

9:48 rhickey: fliebel: yes, well, you should look again at the side effects in your seq

9:48 fliebel: a lot of time people build the IO into the seq, when instead they should generate the data functionally first, then run it through doseq for IO

9:49 devlinsf: rhickey: Is the binding stuff in 1.1 intended for end users?

9:49 rhickey: I don't think there are any usage docs

9:50 fliebel: rhickey: Hmmm, that is something to think about.

9:50 rhickey: devlinsf: there aren't usage docs for many things, just reference docs

9:51 devlinsf: rhickey: True. Back to the first question Should normal clojure devs use it?

9:51 Or it internal to stuff in core?

9:52 rhickey: devlinsf: normal devs can use it, but all such use points to issues with dynamic vars vs implicit threads

9:52 devlinsf: Okay. So it's something we want to highlight.

9:53 rhickey: devlinsf: what is? the problem or these functions?

9:53 devlinsf: That's what I'm trying to figure out

9:53 I think you've answered it

9:55 rhickey: devlinsf: the problem people are having is real, and these functions address the symptoms via manual effort, that's why they were added

9:55 but I don't want to encourage greater use of dynamic vars

9:56 devlinsf: rhickey: right. The disconnect I'm having is I can't find anyone that's written about them. No one has posted something saying "This is my problem, and here's how the binding stuff fixe it"

9:56 rhickey: I haven't come up with a replacement yet

9:56 fliebel: rhickey: How am I supposed to create data functionally if all I'm doing is processing files? This is what I do: function 1 gets a file seq and calls function 2 for every valid file, function 2 reads the file and returns the processed data back to function 1 which returns a lazy seq of that.

9:57 chouser: devlinsf: you'd talking about with-bindings and friends?

9:57 you're

9:57 devlinsf: chouser: Yes

9:57 saml: if i do (ns saml) at the top of the file, I cannot refer to *some-constant* in the same file?

9:58 chouser: there was a pretty comprehensive thread on the topic. Either the ticket or on the g.group.

9:58 rhickey: devlinsf: push-thread-bindings is marked as low-level plumbing

9:59 devlinsf: rhickey: Okay

9:59 rhickey: Then I think we're documented. There are lots of people writing about the other stuff

10:00 cemerick: devlinsf: I wrote this a bit ago, FWIW: http://muckandbrass.com/web/display/~cemerick/2009/11/03/Be+mindful+of+Clojure%27s+binding

10:00 devlinsf: cemerick: Thanks

10:03 fliebel: rhickey: Have you noticed my question about your statement about side effects in a for loop?

10:03 devlinsf: chouser: Found the ticket, #169

10:03 rhickey: fliebel: that's fine, you just have to think of it like this - running lazy seq fns over IO seqs is creating a recipe for the IO, not doing it. It won't be done until consumed, and thus your IO context must exist until you consume it.

10:03 devlinsf: Thread is attached

10:03 LauJensen: rhickey: regarding rc3 did you fix the argument ordering issue with nth yet ?

10:04 rhickey: LauJensen: yes

10:04 LauJensen: Great, thanks

10:04 devlinsf: rhickey: So nth will break?

10:04 Confused

10:04 fliebel: rhickey: I suppose closures take care of that?

10:04 rhickey: devlinsf: no, this just a running joke

10:04 devlinsf: Oh

10:04 saml: (re-split #"\n+" some-str) is this good enough to split new line?

10:05 LauJensen: it is?

10:05 saml: how do you do CRCF ?

10:05 rhickey: LauJensen: I'm laughing, aren't you?

10:05 devlinsf: saml: I use #"[\n\r]"

10:05 LauJensen: No, not really

10:05 saml: clrf

10:05 stuarthalloway: I need to make a minor fix to clojure.contrib.with-ns. Should I make a patch, or (since I am a committer) just do it?

10:07 rhickey: http://groups.google.com/group/clojure/browse_frm/thread/456ded569d6a7280/b88c172db2aff8dc?#b88c172db2aff8dc

10:08 chouser: stuarthalloway: if you're quite sure it's a good fix, I'd say just do it.

10:08 rhickey: stuarthalloway: if it is plainly broken, seems like a fix from any committer should be ok. If it is really an enhancement, then some discussion might be warranted

10:08 chouser: whew

10:09 stuarthalloway: pretty simple: with-temp-ns should remove the ns in a finally block. (I hit this issue when testing)

10:09 right now it only removes the ns if things finish unexceptionally

10:09 devlinsf: stuarthalloway: How 'bout creating a ticket to documenting the finding & closing of the issue?

10:09 stuarthalloway: devlinsf: can do

10:10 just want to establish the "simplicity boundary" beneath which I don't need to get another committer to review and sign off

10:10 fliebel: rhickey: I'm a little confused why my IO context might get lost. You mean the files might get deleted? I thought closures would make sure my things stay in scope.

10:11 * devlinsf wants 1.1 out the door so we can talk 1.2

10:11 chouser: stuarthalloway: I'm a fan of bookkeeping when it's useful. Though perhaps that just restates the problem.

10:11 devlinsf: me too!

10:11 stuarthalloway: I would think if you can describe the problem being fixed sufficiently in the commit comment, that's less work for you now and less for people trying to understand the commit later.

10:12 LauJensen: rhickey: Good to know the reasoning behind, thanks

10:13 stuarthalloway: chouser: agreed. Would you be pleased or pissed if I made a well-documented, trivial fix in one of your contribs without getting your signoff first?

10:13 chouser: pleased!

10:14 stuarthalloway: that's my answer then, till somebody is pissed. :-)

10:14 chouser: If we disagreed about whether your change was "well-documented" or "trivial" or a "fix", it would be easy enough for me to start a conversation at that point.

10:15 and if I really really hated it, I could immediately revert and then start the conversation.

10:16 I don't think I'd approach "pissed" until you re-reverted my revert (prior to a consensus). :-)

10:16 saml: (line-seq (java.io.BufferedReader. (java.io.StringReader. some-str))) how do I make that lazy sequence apply .trim and return only if it's not equal to "" ?

10:17 Chousuke: (filter empty? (map #(.trim %) ...)?

10:17 +)

10:17 hm, I guess that shouldbe remove empty?

10:17 devlinsf: ,(empty? "")

10:18 saml: ah thanks

10:18 devlinsf: Hmmm... not clojurebot

10:18 saml: is map lazy?

10:18 Chousuke: yes.

10:18 LauJensen: (->> "str" StringReader. BufferedReader. line-seq (filter #(.trim %)) ?

10:18 Chousuke: most sequence functions are

10:18 saml: greatz

10:18 Chousuke: LauJensen: that will return the ""s as well

10:19 LauJensen: Yep

10:19 devlinsf: Use a comp

10:20 LauJensen: I vote comp to be removed from core :)

10:20 Chousuke: nah.

10:20 it's useful.

10:20 devlinsf: AH!

10:20 Chousuke: point-free style is not a perfect fit for clojure, but sometimes it's neat.

10:20 * devlinsf has a minor heart attack

10:23 saml: http://codepad.org/y5Tny1CX is this good?

10:23 LauJensen: devlinsf: whats up ?

10:24 devlinsf: I use comp every 3rd expression, that's all

10:24 Chousuke: saml: doesn't empty work? /:

10:24 empty?*

10:25 saml: oh #(not (empty? %1)

10:25 Chousuke: also (filter #(not ...)) is slightly better as (remove ...)

10:25 devlinsf: LauJensen: that, or partial

10:25 Chousuke: so just (remove empty? ...)

10:25 saml: coolz thanks Chousuke

10:26 Chousuke: devlinsf: as long as your expressions don't resemble the monstrosity I saw in Clojurebot's code once I have nothing against your use of comp and partial

10:27 devlinsf: Chousuke: Well, I'm one of those guys that has single character aliases for comp & partial in my own libs...

10:28 Chousuke: it was prior to --> and was like (-> foo ((partial map blah)) foo bar ((partial filter zonk)) :quux)

10:28 ->>*

10:28 except approximately thrice as long

10:28 devlinsf: Yeah, I like comp better than ->>, because it preserves the fn application idea

10:29 ->> seems backwards

10:29 Chousuke: it's good for pipelines.

10:29 devlinsf: Oh, I agree

10:29 Chousuke: long comps can be difficult to understand :/

10:29 or if there are many of them, mixed with filters and mappings.

10:29 devlinsf: No! I LOVE those

10:30 * devlinsf suspects he might be in the minority here...

10:30 Chousuke: it's harder to keep track of the data than with explicit parameters

10:30 LauJensen: ->> is one of the best things to hit Clojure since the compiler

10:30 devlinsf: Given (foo (bar (baz x)))

10:30 I like ((comp foo bar baz) x) more than (->> x baz bar foo)

10:31 The comp looks (to me) more like the original code

10:31 Chousuke: I mostly like comp as filter or map functions

10:31 not as the primary operator

10:31 any stacked parentheses are a code smell to me :

10:31 P

10:32 fliebel: devlinsf: I like -> because it looks less like the original thing.

10:32 devlinsf: huh

10:32 fliebel: Interesting

10:32 Chousuke: minor correction: stacked opening parentheses

10:33 mostly because (((foo bar) morefoo) morebar) requires me to scan the closing parens to know what is happening

10:33 devlinsf: Chousuke: Point taken. I'll often take that comp and def it

10:33 fliebel: devlinfs: I find it easier to read left to right and top to bottom, with comp and nested stuff you have to read inwards out.

10:34 devlinsf: fliebel: comp is more like math, though

10:34 Chousuke: fliebel: that's just a matter of what you're used to.

10:34 people fluent in arabic might prefer reading from right to left.

10:34 fliebel: Chousuke: I'm an european, we read left to right to to bottom all day ;)

10:35 Chousuke: and Japanese people read from any direction ;/

10:35 fliebel: lol

10:35 saml: (re-get #"Revision:\s+(\d+)" "Revision: 123") ==> "123" is there such function?

10:35 Chousuke: well, except down to up

10:35 but seriously, sometimes I get confused when I see something and think it's written left-to-right and then it's right-to-left

10:36 fliebel: Chousuke: I always put each command in a -> macro on it's own line to avoid confusion.

10:37 chouser: saml: (second (re-find ...))

10:37 saml: chouser, oh thanks!

10:37 fliebel: Doing so with com would leave you reading bottom up.

10:37 devlinsf: fliebel: Yup

10:38 I also like the "Closures in, Closures out" you get from point-free

10:38 fliebel: devlinsf: not even Japanese read that way… what is so cool about that?

10:38 devlinsf: It's math

10:38 chouser: I find (def foo (comp ...)) to be a mental burden compared to an equiv (defn foo ...), because in the former the args aren't shown explicitly -- I have to dig into the function body itself just to see what the fn's contract is.

10:39 fliebel: devlinsf: what is point-free?

10:39 chouser: docstrings can aleviate this a bit, but I have a hard time trusting them.

10:39 devlinsf: chouser: Yeah, I have to explicty add metadata

10:39 saml: to search for an element that makes (pred element) true, you do (first (filter ...) ) ?

10:39 Chousuke: fliebel: creating functions without explicitly defining parameters

10:39 fliebel: via composition and partial application

10:41 devlinsf: The truth is I do a lot of database babysitting during the day, and there are often ugly mapping operations.

10:41 Chousuke: hmm

10:41 devlinsf: Being able to write a comp on one row, and then map it is great

10:41 unfo-: fliebel, given no "ZOMG IT WORKS" I am assuming the do-all :files didn't help :-)

10:41 Chousuke: how is comp implemented btw? does it create "stacked" functions?

10:41 devlinsf: No, I think it's reduce

10:42 I'd have to check the source

10:42 Chousuke: too bad clojurebot is missing.

10:43 chouser: for 3 or fewer args to comp, for 3 or fewer args to the resulting fn, there's a pre-computed nesting of fn calls

10:43 cross either of those threshholds and the current implementation drops to recur/apply at runtime.

10:44 devlinsf: So that's why there's multiple sigs. Huh

10:44 fliebel: unfo-: In fact it did… But I'm not happy with it because I can't figure out why it does not work to leave it lazy. rhickey said something about the IO context, but did not explain that yet.

10:44 chouser: but unlike a recent blog post I read, using comp doesn't create any new classes.

10:44 nor does using partial

10:44 devlinsf: juxt?

10:45 chouser: nope

10:45 devlinsf: Good to know

10:46 chouser: only special forms or macros that expand to them will create new classes, and then almost exclusively at compile time.

10:46 hm. Maybe that's a little too broad. proxy can create a new class at runtime.

10:47 devlinsf: Well, that's its job

10:47 chouser: yes. :-)

10:47 saml: ,(.matches "23" "\\d+")

10:48 chouser: saml: (re-matches #"\d+" "23")

10:49 saml: ,(filter (re-matches #"\d+" %1) ["a" "23" "c34"])

10:49 fliebel: unfo-: ZOMG IT WORKS!!! it turns out all print things I put in there to test it ended up in a with-out-str I was using at the moment the seq was required.

10:50 unfo-: fliebel, :-D

10:50 fliebel, well gj! :)

10:50 chouser: saml: (filter #(re-matches #"\d+" %1) ["a" "23" "c34"])

10:50 fliebel: I wish prxml could just return all it's output instead of print it… :S

10:51 chouser: saml: or point-free: (filter (partial re-matches #"\d+") ["a" "23" "c34"])

10:51 devlinsf: :)

10:51 saml: hrm. but maches does not return boolean value

10:51 re-matches

10:51 chouser: yes, but it returns nil on a failed match which is all 'filter' (or anything expecting a boolean) needs.

10:52 saml: "other than false or nil, everything else is true"

10:52 chouser: it's a thing of beauty. love it. :-)

10:52 LauJensen: fliebel: read about pointfree here http://kotka.de/blog/2009/12/Pointfree_vs_Pointless.html and here http://kotka.de/blog/2009/12/Point-free_Style_revisited.html

10:53 chouser: oh good, he fixed it. I had missed that.

10:55 fliebel: LauJensen: thanks

10:55 saml: let [a 1, b (+ a 1)] b this will always be 2 right? order of binding is top to bottom

10:55 chouser: But except for that, I agree with everything he said in the first post.

10:55 saml: yes

10:55 LauJensen: chouser: Yea the point is still good, strictly speaking of style

10:55 saml: and no way to create mutual reference using let

10:56 let [a b, b (+ a 1)] something like that... maybe to create lazy stream

10:56 JonSmith: hmm

10:57 isn't there a letrec

10:57 you might have to use some of the lazy functions like iterate to do that example, however

11:01 rhickey: JonSmith: there is letfn

11:02 JonSmith: ah, that's it

11:02 i always forget the name

11:05 fliebel: LauJensen: So pointless…free style is just coding without defining any values(and doing so in a clear way)?

11:06 LauJensen: Well I wouldn't say clear, but yes

11:06 fliebel: I like that...

11:07 LauJensen: pointless style is supposed to be very cool in Haskell, but in Clojure I've only seen bad examples

11:07 fliebel: It would be cool if we had named pipes like unix, not anything containing a value, but just defining where the data will flow to.

11:07 devlinsf: LauJensen: That's because it's still very young in Clojure

11:07 LauJensen: hehe

11:08 Maybe - I think clarity is important and you can be sorta pointfree with macros like -> and ->>, so thats good enough for me

11:09 fliebel: -> an d->> are fine for me, although I need to mix positions sometime.

11:09 Chousuke: pointfree style is much nicer in haskell because there's special syntax for it.

11:09 and automatic currying

11:09 it makes a HUGE difference.

11:10 devlinsf: LauJensen: They don't return a closure, and that limits their usefulness

11:10 LauJensen: Chousuke: Yea, interesting the only thing Rich made provision for in the syntax was regex?!?! :)

11:11 devlinsf: So experiment

11:11 fliebel: devlinfs:

11:12 the enter key should be banned form the keyboard...

11:12 * devlinsf falls over dead

11:12 fliebel: Are there any cool things for pointless style that can be done with a fn or macro?

11:13 devlinsf: I wanted to remove your name from an untyped message and hit enter...

11:14 devlinsf: Here's a few exmaples I use

11:14 http://github.com/francoisdevlin/devlinsf-clojure-utils/blob/master/src/lib/sfd/pred_utils.clj

11:14 Check out every-pred? & any-pred?

11:15 predicates in, predicate out

11:16 fliebel: cool

11:16 devlinsf: fliebel: Also, A large reason I use point-free (point-less is a bit inflamatory, please don't use), is to avoid write macros

11:18 If I write a fn, and not a macro, I know I can chain the result in a map/filter/comp etc.

11:18 fliebel: true

11:18 devlinsf: I find that to be very useful

11:19 fliebel: I tried once to use -> in a map...

11:20 devlinsf: Yeah, everyone tries to use a macro in a map.

11:20 tolstoy: devlinsf: Enjoyed your videos. Can't wait for you to explain deftype and defprotocol....

11:21 devlinsf: tolstoy: Thanks. That'll be a little while, once we're closer to 1.2

11:21 fliebel: devlin: suggested solution?

11:21 devlinsf: Well, either wrap the macro in a #()

11:21 tolstoy: devlinsf: I looked at what docs I could see, but would appreciate a "working programming" explanation. ;)

11:21 devlinsf: or, use for/doseq

11:22 fliebel: I used reduce once to mimic -> :)

11:23 devlinsf: Cool

11:24 Licenser: devlinsf: you've videos?

11:24 devlinsf: Yeah

11:24 Licenser: mind to hand me a link?

11:24 devlinsf: http://vimeo.com/channels/fulldisclojure

11:24 fliebel: devlinsf: (reduce #(%2 %1) 1 [inc inc inc])

11:24 Licenser: nice name :) thanks!

11:24 Chousuke: I watched those. good videos.

11:24 the template one especially was neat.

11:25 devlinsf: Yeah, I didn't expect to do that one

11:25 Licenser: I enjoy learning more and more about clojure every day :)

11:25 devlinsf: It just kinda happened

11:25 Chousuke: mostly because that's the only feature I wasn't really acquaintainted with yet

11:25 tolstoy: Yes, I like videos NOT aimed at language implementors....

11:26 devlinsf: tolstoy: I learned rails from Railscasts

11:27 tolstoy: Thought I'd try for something similar

11:53 saml: how do you do OOP?

11:53 wait that's a bad question. let me come up with a better one

11:54 arohner: saml: differently.

11:55 is there a function for seqable?

11:55 saml: i am porting things like: x = new X(a,b,c,d,e,f,g,h); x.f(y,z) ...

11:55 Chousuke: most often, you don't :)

11:55 arohner: I found seq? and sequential?

11:55 saml: but in clojure, i have to do (f x a b c d e f g h y z)

11:55 pass all arguments all the time

11:56 Chousuke: saml: you can make an data structure holding x and the arguments

11:56 the call (f thething)

11:57 saml: okiez

11:57 Chousuke: actually, have x be a datastructure holding a-h :P

11:57 tolstoy: aren't objects really just an implied first parameter to all its methods?

11:57 Chousuke: yeah

11:57 or you can split x into multiple data structures if that makes sense.

11:58 often, the most idiomatic approach in clojure is not to have custom types (even just "logical" types), but plain old vectors and maps

12:01 tolstoy: Does that language "Fantom" have a lot of users, I wonder?

12:01 http://fantom.org/

12:02 pdk: first time i've heard of it

12:21 gravity: I want to iterate through two different sequences and compare each item. Is there an idiomatic way to do this, or should I just use for?

12:22 arohner: gravity: what do you mean by compare?

12:23 do you want to see if each item is equal?

12:23 gravity: arohner: I want to return a list where each item is the greater of the two

12:23 arohner: that sounds like a job for map

12:24 rhickey: ,(map max [1 3 5] [2 2 6])

12:24 gravity: Aha, I had no idea map could take more than one collection. Thank you both!

12:36 saml: in emacs, M-x pwd is .../src . and I have .../src/settings.clj . I try (require 'settings) but it says it can't find settings.clj in classpath

12:37 arohner: saml: emacs pwd and the jvm classpath are different things

12:37 saml: is there a way to modify swank or slime so that emacs pwd is automatically included to jvm classpath?

12:38 arohner: that would require a lot of work. If your classpath contains the root of your source tree, require should work fine

12:39 saml: so, should I update CLASSPATH env variable and restart emacs? no way to type something up in repl?

12:40 arohner: yes, update classpath, and restart the jvm

12:40 saml: there's add-classpath

12:40 technomancy: saml: you probably want to use M-x swank-clojure-project

12:40 see the readme for swank-clojure

12:40 arohner: add-classpath is deprecated. it doesn't work in all situations

12:53 saml: I tried M-x swank<TAB> but no completion :(

12:53 I want to do M-x swank-clojure-project

12:56 LauJensen: saml: Did you see my blogpost on getting the basics set up ?

12:56 saml: LauJensen, actually google returned your post. i'm just using Clojure Box on windows

12:57 LauJensen: Ok - In my .emacs file in the bottom, you see how to add custom classpaths

12:57 saml: you mean http://www.bestinclass.dk/index.php/2009/12/clojure-101-getting-clojure-slime-installed/ ?

12:58 LauJensen: yep

12:58 saml: can you really do M-x swank-clojure-project ?

12:58 i don't want to modify .emacs every time i work on a new project

12:59 LauJensen: Yes, I really can :)

13:21 saml: how do you start a clojure project on emacs? M-x swank-clojure-project hangs

13:21 i think it kills slime process so it can't connect to slime

13:23 defn: saml, are you using lein?

13:23 saml: i'm using Clojure Box (emacs, slime, swank-clojure)

13:24 defn: k -- im not familliar with clojure box, but for me, i needed to add :dev-dependencies [[org.clojure/swank-clojure "1.0"]], and run lein deps which pulls down the swank-clojure jar and places it in lib/ in my project directory

13:24 which allows me to use swank-clojure-project

13:24 you could do that manually

13:26 tolstoy: saml: I gave up on all that swank-clojure-proj thing.

13:26 saml: I just start up a swank server via a shell script (after loading up my classpath)

13:26 saml: Then I use M-x slime-connect to get to it.

13:27 saml: Makes things SO much easier (if your aim is to USE emacs, but not program it).

13:27 saml: oh darn

13:27 did you blog it by chance?

13:27 tolstoy: Nope. But I can paste you some stuff if you want.

13:27 * saml is not emacs, lisp, swank, slime user

13:28 saml: that'd be great! especially shell script part tolstoy

13:28 tolstoy: Okay. Hm.

13:29 saml: then i'll modify Clojure Box start up so that it won't start swank

13:29 tolstoy: saml: I found it good to just write main.clj scripts and run them over and over, using a normal editor. Once I got used to Clojure, I used elpa to install slime.

13:30 saml: ok. i think i'll do this project in python. i spent like 3 days in clojure with nothing to commit :P

13:30 my boss will get mad at today's scrum meeting

13:30 defn: heh

13:30 just look smug and mutter something about how you don't "do" mutable state anymore

13:30 that oughta teach him

13:32 tolstoy: saml: Still working on the paste. You're on a unix?

13:32 Is paste.lisp.org down? Sheesh!

13:32 saml: tolstoy, no, vista

13:32 windows

13:32 tolstoy: saml: oh. hm. I wonder if the scripts will translate.

13:33 saml: i can translate using my quad core brain

13:33 tolstoy: Heh heh. Good! ;)

13:35 defn: When you have 4 cores 1 second is faster

13:38 lisppaste8: tolstoy pasted "swank separate from emacs" at http://paste.lisp.org/display/92825

13:39 tolstoy: oops. M-x slime-connect, not M-z. Ah, well.

13:39 polypus: (let [p true] `(let [x# 7 y# 8] ~(if p `x# `y#)))

13:40 in the above code i'd like to be able to reference x# and y# within the if statement

13:40 defn: ,(macroexpand-1 (let [p true] `(let [x# 7 y# 8] ~(if p `x# `y#)))

13:40 ,(macroexpand-1 (let [p true] `(let [x# 7 y# 8] ~(if p `x# `y#))))

13:40 awww clojurebot is dead

13:41 fliebel: What happened to it?

13:41 polypus: i.e. i want to build a macro which conditionally includes code so that the condition does not occur at run time

13:41 defn: i dunno

13:41 q2: (resurrect! :clojurebot)

13:41 :(

13:41 polypus: clojurebot: rise!

13:41 Chousuke: polypus: (defmacro foo [condition] (if condition `(some code) `(other code)))

13:42 defn: (future (resurrect! :clojurebot))

13:42 Chousuke: polypus: of course, the condition must be evaluable at compile time :)

13:42 fliebel: It took me a while to realize you're actually just doing regular Clojure with a special syntax to create a list.

13:43 polypus: well i'm not actually writing a macro in my code, i'm just using syntax quote to write an expression which gets eval'd

13:43 and i need to reference those outer x# y#

13:43 (let [p true] `(let [x# 7 y# 8] ~(if p `x# `y#)))

13:43 Chousuke: fliebel: yeah. macros are functions of s-expressions to clojure code :P

13:43 defn: weeeee

13:43 polypus: but the inner ones are expanded separately

13:44 Chousuke: polypus: yeah, you need to use gensym directly. autogensyms won't work for you

13:44 fliebel: polypus: I learned yesterday that.. what chousuke is saying

13:45 polypus: ok will have to think about it some more. still waking up. ty

13:45 Chousuke: (let [p true x (gensym) y (gensym)] `(let [~x 7 ~y 8] ~(if p x y)))

13:46 polypus: Chousuke: ty, i think that should do it

13:47 saml: tolstoy, thanks

13:47 tolstoy: saml: Does that help at all?

13:48 polypus: fliebel: i learned it yesterday also. well, i thought i had

13:48 saml: tolstoy, i'm reading. i'll ask you questions if any. thanks!!!!!!!!!!!!1 merry christmas

13:52 piccolino: Is there some way to access "this" in a deftype? How would I write a helper function that multiple methods in the deftype could use?

13:53 chouser: piccolino: :as this-name

13:53 piccolino: see the docstring for details

13:54 piccolino: Ah, OK, I see that on the assembla page now, I missed it. Thanks.

13:58 chouser: hard to make such facts stick in one's head until they're needed.

14:18 rrc7cz: how do you tell lein about additional classpath entires? for example, my enlive templates are in a different project in some other dir, but that dir needs to be on the classpath so enlive can compile the templates

14:32 ska23421: is it generally considered important that special operators in Clojure are called special forms. Is there an important concept at work I didn't recognize yet?

14:34 rhickey: ska23421: as long as you understand that they might have special evaluation of their args, no

14:35 chouser: I think technically a special form is a use of a special operator, but I don't think the difference is meant to be significant.

14:36 ska23421: rhickey: yes I am well aware of that; coming from CL and not Java I just wondered whether the different naming hints to sth important. Thanks.

14:38 rhickey: ska23421: ok, no, 'special form' will probably be dropped in a more proper spec

14:39 ska23421: On a similar track: do you distinguish between an expression and a form? I seem to find them to be basically just two names for the same thing.

14:39 rhickey: sorry to be nitpicking :-)

14:41 rhickey: ska23421: np, fine question

15:11 fliebel: Is there a way to make the result of an if expression available inside the chosen path? Like: (if "something" (println tha-value) (print "something else"))

15:11 chouser: if-let

15:12 (if-let [x something] (println x) (println "else"))

15:12 arohner: rhickey: I have a patch for http://www.assembla.com/spaces/clojure/tickets/231. I should attach it as a patch to the bug?

15:13 and do you want tests?

15:16 fliebel: chouser: I knew there would be something like that.

15:17 rhickey: That language of yours is very… different, but it seems you thought deeply about everything. :)

15:18 Chousuke: fliebel: you can also do (print (or something "something else"))

15:19 fliebel: Chousuke: that is true… or is short-circuiting and returns the value or false doesn't it?

15:19 Chousuke: yeah.

15:19 chouser: ,(or nil :foo :bar)

15:19 clojurebot!!

15:20 Chousuke: hiredman: Where's clojurebot? :(

15:20 chouser: that returns :foo

15:35 tolstoy: eps-132

15:39 fliebel: What is a good looping function that will allow me to got up to a certain point item by item and then break and get rest?

15:48 lopex: drop-while

15:56 fliebel: ah, split-with returns both sides...

15:58 When I map over a map, I get a seq, how do I get back to a map?

15:58 devlinsf: Hehehe

15:58 fliebel: You don't, not directly

15:58 (into {} (map .....))

15:59 fliebel: huh? ([:a "b"] [:c "d"])

16:00 how is that supposed to become a map?

16:00 devlinsf: Oh, right right..

16:01 Did you try the code?

16:01 read (doc into)

16:01 fliebel: thery are actually clojure.lang.MapEntry not a vector… is that important?

16:01 devlinsf: Nope, into makes it go away

16:01 fliebel: I did try to insert the code directly, but then it are vectors...

16:02 rhickey: arohner: thanks! will apply after 1.1 goes out

16:02 Chousuke: fliebel: you can conj both pairs and mapentries to maps

16:02 fliebel: devlinsf: In some magic way I don't understand it works!

16:03 Chousuke: I think vectors of two elements implement MapEntry or something

16:03 or at least some interface.

16:03 devlinsf: fliebel: see Chousuke

16:03 fliebel: hmmm, could be, a vector just works anyway.

16:04 devlinsf: fliebel: It has to do with how conj work

16:05 fliebel: thanks

16:05 devlinsf: chouser: speaking of map operations...

16:06 arohner: rhickey: great

16:59 ordnungswidrig_: hi everybody

17:00 LauJensen: Hey

17:08 neotyk: Hi

17:09 ,(.replace (.replace (str "abc") "a" "A") "c" "C")

17:09 the-kenny: neotyk: clojurebot isn't available

17:09 But there is a better approach than nesting .replace-calls

17:09 neotyk: the-kenny: oh my, and I'm looking for this better way

17:10 the-kenny: (apply str (replace {\a \A, \c \C} "abc"))

17:10 neotyk: the-kenny: I like it :)

17:10 thanks

17:11 the-kenny: You're welcome

17:11 neotyk: what's up with bot?

17:11 the-kenny: Don't know

17:12 Preparations for not-blowing-up on 1. January 2010? :D

17:17 wdouglas: LauJensen: Have you been able to use slime-fuzzy completion when connecting to a remote swank using slime-connect?

17:17 LauJensen: wdouglas: Haven't tried on a remote connection

17:19 the-kenny: wdouglas: Was working for me, irrc

17:21 wdouglas: the-kenny: what version of slime were you using?

17:21 the-kenny: uhm.. the one from elpa

17:21 wdouglas: Hrm were you using lein swank?

17:22 the-kenny: No, but I don't think it should make any difference if you're local or remote

17:23 wdouglas: No it shouldn't but I blow up trying to use slime-fuzzy from a slime-connect

17:23 Using elpa default config

17:37 ska2342: did anybody ever thought about giving defn an ol' lispers security check which prevents people from giving the docstring after the arglist?

17:43 neotyk: technomancy: issue 8 is fixed

17:44 technomancy: I've sent you pull reqeust

17:44 ska2342: good grace! Is the definition of defn consider idiomatic style? The repeated tests and rebindings of fdecl are not really pleasing, are they? Funny that defn is not a macro, though, I expected to see one there.

17:44 arohner: ska2342: no, defn is not idiomatic

17:45 ska2342: huh? the metadata of defn says, it /is/ a macro. This seems to be due to (. (var defn) (setMacro)) in core.clj. Can someone explain that to me, please?

17:45 arohner: defmacro is also a macro

17:45 and defmacro is defined after defn

17:46 so defn has to make itself a macro "by hand"

17:46 ska2342: arohner: strange, need to read that source for a while I think.

17:47 arohner: my guess is you're used to self-hosting lisps. Clojure isn't there yet

17:49 ska2342: arohner: I more or less expected to find defmacro being implemented in Java, I think. Somewhere in the reader, probably.

17:50 arohner: the compiler handles macros. (def defmacro) is the user facing side

17:52 ska2342: arohner: still havn't located macro expansion time, yet ;-)

17:53 arohner: ska2342: in Compiler.java, search for macro. You'll find some interesting stuff

17:54 reader macros are of course, in the reader

17:54 ska2342: arohner: you can't somehow read my screen, can you?? just opened it. The full 5159 lines. Ugh.

17:55 arohner: yes, I studied the Reader in the last few days a little.

18:00 arohner: ska2342: one of the upcoming major projects is called cinc, clojure in clojure. The plan is to make it self-hosting. The compiler should get a lot shorter then

18:01 ska2342: arohner: yes I am following cinc on the surface. Still cross my fingers that clojure will still be a java library afterwards, but R.H. already said so.

18:04 too late to read java. Guten Rutsch, as we say in Germany

18:26 arohner: /join #postgresql

19:02 defn: with doseq does the binding get reset every time the body is evaluated?

19:02 like if i want to use the inital binding to compose two other bindings at the same time that will change for every time, is that possible

19:02 or should i use (doseq [] (let []))

19:04 the-kenny: defn: I think you want a simple loop

19:04 (with recur)

19:04 (Altough I'm not absolutely sure what you're talking about.. sorry)

19:05 defn: i have this function that checks for the same filename in two places and returns the intersection of both sets of files

19:05 so then what i want to do is take both files (which exist in two locations)

19:05 and append one to the other, and then output that to another directory

19:06 so i have this set which is only the list of duplicates, so i do (doseq [f my-intersected-set]) to go through all of them

19:07 the question is, do i do something like (doseq [f my-intersected-set file-number-1 (file-str "/some/other/dir/" f) file-number-1 (file-str "some/other/dir/" f)]

19:07 or should i make the doseq, and then have a let binding to create those two paths

19:20 chouser: defn: probably the latter, though you can use :let inside the doseq binding vector.

19:20 (doseq [x xs, y ys] ...) nests y within x, just like 'for'

19:38 defn: chouser: thanks

20:19 grrr, im trying to use compojure's link-to to create a link to a file named _->>

20:19 it's turning it into _-&gt;&gt;.html

20:19 any ideas?

20:20 nevermind, fixed it

20:30 mabes: I've had several false starts and can't seem to write, what would seem easy, function.. any help would be appreciated: http://gist.github.com/266552

20:31 I didn't post any of my current solutions since none of them are working correctly..

20:31 defn: (map #(link-to % (strip-dot-html (str %))) (rest (file-seq *doc-output-dir)))

20:31 how can i place a [:br] between each link

20:32 devlinsf: defn: Did interpose work?

20:32 defn: devlinsf: let me try

20:32 indeed it did

20:32 thanks devlinsf

20:33 devlinsf: n/p

20:39 q2: tips on merging a list of lists, to just one big one

20:43 nm figured it out: (reduce into (map list '("a" "b" "c")))

20:43 devlinsf: q2: did you try concat

20:44 q2: that seems even better. and lazy.

20:44 thanks.

20:44 devlinsf: also look at lazy-cat

22:09 aldebrn: devlinsf, where are these videos of yours?

22:09 devlinsf: http://vimeo.com/channels/fulldisclojure

22:10 Updated mondays

22:10 Luyt: very nice. Are there also direct download links? My webbrowser doesn't play flash video, but VLC can.

22:11 devlinsf: Should be on each page

22:11 I've test VLC specifically, it works

22:12 Luyt: I assume VLC plays Flash content well, sure. But I don't see the direct download links on http://vimeo.com/channels/fulldisclojure

22:12 Only a message: To watch this video, you need Flash 10

22:12 devlinsf: Did you click on the individual episode?

22:12 Luyt: Individual episodes are not clickable.

22:13 devlinsf: Hmmm...

22:13 http://vimeo.com/8399758

22:13 Luyt: But the direct URLs to download the flv files would do...

22:13 devlinsf: Yeah, I didn't look into that yet

22:14 Does that URL work?

22:14 Luyt: Nope... Don't you have an URL like http://site.com/xyz.flv ?

22:16 devlinsf: Well, this sucks...

22:16 Mec_: I'm passing the following sort of sequence to filter, but for some reason filter is only passing 1 argument to the predicate function: ((1 1) (2 2) (3 3)). Any ideas?

22:17 devlinsf: Luyt: What do you see when you got to the following URL

22:17 http://vimeo.com/8399758

22:17 Mec_: err well theres the problem, I should be using reduce :x

22:17 Luyt: devlinsf: I think Vimeo wants to make it as hard as possible to make their content downloadable, since it is in their interest to offer it as a stream only, so they can place as much advertisements as possible before the visitors's eyeballs.

22:17 I'll make a screenshot of that link, moment.

22:17 devlinsf: Luyt: Yeah, but I PAID to make my content downloadable

22:18 GRRR

22:20 Luyt: devlinsf: file:///home/user/vimeo.png

22:20 eh moment

22:20 ftp://motoom.net/pictures/vimeo.png

22:20 duh, forgot to copy/past ;-)

22:21 devlinsf: Okay, it turns out you need a vimeo account (free) to download content

22:22 I'll look into an FTP option, but it's not near the top of my list of things to do

22:22 Luyt: downloadable via HTTP would be fine too, imho.

22:22 devlinsf: Yeah, true. I need to set up FTP on my end

22:22 * devlinsf is seeing what severs he has available...

22:23 jolby: devlinsf: Just watched the future/promise screencast - great stuff - thanks for posting those.

22:23 Luyt: I'll see how I can register with Vimeo with too much damage

22:23 without*

22:23 devlinsf: jolby: glad to help

22:39 Luyt: Succeeded... their download links are crazy tho: http://vimeo.com/download/video:13468104?v=2&e=1262234371&h=dcad4e03e830698f47f0640b37270a89&uh=fa32d30b8017efd0b34da7e559bc2872

22:39 Is that the bright future of the web and what global internet promised us?

22:40 chouser: I get it's a temporary link

22:40 devlinsf: Boo

22:40 chouser: bet

22:41 devlinsf: Hmmm... I'll add creative common licensing text next episdoe

22:41 chouser: Mec_: filter always passes only one arg to it's predicate.

22:41 Mec_: but you can use destructuring to get both items out of the inner seqs, like (filter (fn [[a b]] ...) ...)

22:43 devlinsf: Any recovering perlmongers in the house?

22:43 Luyt: devlinsf: Anyway, I managed to get the following files: http://codepad.org/A4Wy4SlR (in the Quicktime format?!) compiling VLC now...

22:43 devlinsf: Yeah, mp4

22:44 Luyt: Ok, that's allright then, np.

22:44 chouser: yeah, of coure. loved perl

22:44 Mec_: chouser: Ya, i was wanting reduce, and staring at the reduce documentation, but for some reason wrote filter into the code

22:44 devlinsf: chouser: Where would I find official perl docs?

22:44 chouser: devlinsf: man pages I think :-/ or just google for other peoples' copies.

22:44 devlinsf: Wow

22:44 Yuck

22:45 Luyt: http://www.perl.org/docs.html ?

22:45 Certainly not at http://isperldeadyet.com/

22:46 devlinsf: Thanks

22:48 Luyt: devlinsf: Your screencasts are running fine now, on my system.

22:48 devlinsf: Okay, cool

22:48 I want to support VLC, thanks for testing

22:48 Luyt: I see you use emacs and slime?

22:48 devlinsf: Luyt: What do you run?

22:49 Luyt: Yeah, but I'm no emacs ninja

22:49 Luyt: (AS in OS)

22:49 Luyt: FreeBSD 7.2-stable

22:49 devlinsf: Okay, cool

22:49 Luyt: VLC plays Apple Quicktime on unix, windows and osx, as far as I know.

22:50 These days VLC even has a Santa hat ;-)

22:50 There is no escape from Santa.

22:50 devlinsf: I'm excited about their upcoming video editor

22:50 No, there is no escape from Santa

22:51 Luyt: Well, tomorow (today) evening is the old-and-new here in Holland and after that stuff turns to normalcy again

22:51 devlinsf: Yeah, it's the same in the US

22:51 * Luyt looks forward to the spring and summer and the ending of all festivities.

22:52 Luyt: Maybe at this time the australians are already lighting their fireworks?

22:55 arohner: hrm. I want partial to take no args, so I can do ((partial first) 1 2 3)

23:01 chouser: do you mean ((partial first) [1 2 3]) ?

23:03 devlinsf: Why?

23:03 arohner: yeah, maybe that doesn't do what I want

23:04 (defn first* [& args] (first args))

23:04 (first* 1 2 3)

23:04 it seems like there should be a way to define first* using something like partial

23:05 devlinsf: Well, you could write it

23:05 (I don't think it exists)

23:06 (defn de-apply [f] (fn [& args] (f args)))

23:06 arohner: interesting.

23:06 chouser: ,(list 1 2 3)

23:06 ?

23:07 arohner: In this case, I'm using merge-with

23:07 so (merge-with first* {:a 1 :b 2} {:a 3 :c 4})

23:08 so that could be (merge-with (unapply first) ...)

23:11 chouser: (comp first list)

23:11 devlinsf: Yeah

23:11 chouser +1

23:12 arohner: nice

23:14 chouser: all of these seem too complicated

23:14 I guess ignoring args isn't a common task?

23:14 devlinsf: wait

23:15 reverse your map list

23:15 merge will keep the last value

23:15 in this case, your intended first

23:16 arohner: that's too easy

23:16 :-)

23:19 _mst: ,(#(first %&) 1 2 3)

23:19 clear as mud :)

23:20 devlinsf: arohner: Oh, you could use a custom reduce-fn

23:20 (fn [a b] a)

23:21 arohner: I still like your de-apply most

23:21 devlinsf: okay

23:22 I'd go with the reduce-fn myself, but de-apply will work

23:22 arohner: I like the fact that de-apply is a higher order function with a name, rather than "just" making a function

23:23 I really like that in clojure, there's a word for most operations

23:23 devlinsf: Yeah

23:23 arohner: i.e. map / filter / reduce rather than for loops

23:37 Mec_: How do i get emacs to send output to the clojure repl instead of displaying it in the little box at the bottom?

23:48 technomancy: when you create a closure, how does that interact with locals-clearing? does it copy the scope it's created in rather than just keeping a reference to it?

23:48 I'm wondering how something like http://p.hagelb.org/locals.clj.html is possible

23:53 devlinsf: technomancy: Weird

23:55 I tried closing over x, no luck

23:55 technomancy: devlinsf: it gets weirder; the problem doesn't occur if you throw the exception directly in the try block

23:55 only if you call a function that throws an exception

23:56 danlarkin: weird behavior on new branch, expected behavior on master?

23:57 technomancy: danlarkin: all the way back to 1.0.0, believe it or not.

23:57 nothing to do with the new fine-grained local-clearing

23:57 danlarkin: ah ha

23:58 I just tried to M-. in Safari

23:58 * danlarkin hangs head in shame

23:58 devlinsf: technomancy: This looks like sme kind of bug

23:58 technomancy: devlinsf: oh definitely

23:59 I just don't know enough about how Clojure implements lexical scope to know where to look next.

23:59 devlinsf: chouser: ?

23:59 technomancy: I just know it's different from my naive scheme interpreter. =)

23:59 it's also extra-weird since delay is a very thin wrapper around fn

Logging service provided by n01se.net