#clojure log - Jul 22 2010

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

0:00 tomoj: btw, does choas's version have some good stuff I need? I'm just using stu's

0:00 defn: he just updated it for 1.2.0

0:00 tomoj: your way worked

0:00 thanks for that

0:01 tomoj: ah

0:01 groupId/artifactId are not necessarily related to the namespaces defined

0:01 mmarczyk: seancron: strangely enough, it seems to me that the dataset function in Incanter isn't prepared to cope with empty dataset definitions... or maybe I'm just too sleepy to think clearly

0:02 defn: tomoj: yeah that's always been sort of finicky

0:02 seancron: (def data (dataset ["time" "up?"] [[]])) does the same thing

0:02 mmarczyk: seancron: right. see above

0:02 defn: im trying to teach my friend clojure right now and getting him "set up" seems to be a pretty big feat

0:03 he has to learn: git, slime, paredit, and clojure of course

0:03 mmarczyk: seancron: you could always construct

0:03 seancron: an incanter.core.Dataset yourself...

0:03 defn: i guess on paper it doesn't seem like it's all that bad, but for someone who is unfamilliar it's a tall order to just start writing some code

0:03 mmarczyk: seancron: (incanter.core.Dataset. ["time" "up?"] {})

0:03 defn: i know there are other methods but he happens to know emacs so...

0:04 tomoj: why git?

0:04 I mean, if you want to contribute to any projects, sure

0:05 defn: well we're working on a project together

0:05 he just finished his undergrad CS degree and im trying to get him up to speed with "real life" development

0:05 :)

0:05 tomoj: hehe

0:05 defn: so we're doing clojure + hadoop + twitter nozzle + opennlp + git + jfugue

0:05 with some machine learning for fun

0:06 jacortinas: sounds cool

0:07 tomoj: what the hell does jfugue have to do with the rest of that?

0:07 defn: yeah the basic idea is we're going to generate music based on tweets by using NLP

0:07 :)

0:07 tomoj: haha

0:07 please share if successful

0:07 jacortinas: why the hadoop?

0:07 defn: we're going to store results

0:08 and then tag them for quality

0:08 mmarczyk: awesome :-)

0:08 jacortinas: ahh I see, so you need to map reduce over them after storage

0:08 should be a ton of data

0:08 defn: yeah it's insane -- i was just playing with "nozzle" earlier and I had a callback that was (println tweet)

0:08 so im staring at my repl thinking: hm that's weird, the stream is open where are the tweets?

0:09 i go to my terminal about 40 minutes later and see tweets screaming by lol

0:09 i think at first we're just going to start with a single day of tweets and see what happens

0:09 Bahman: Hi all!

0:10 defn: some fun ideas are we're going to use syntax like , ; : and ' to modify duration of words/notes

0:10 and also do some intelligent part writing techniques to try and find common chord progressions based on groupings of characters

0:10 so "The" becomes "ACE" an a major triad

0:11 and so on from there

0:11 there is also some neat stuff in the opennlp library which allows you to chunk phrases, which could be interesting to explore like they are musical phrases

0:11 but anyway -- we'll see if it ever gets finished! :)

0:12 jacortinas: sounds cool

0:14 defn: totally useless, but a fun chance at a code art project

0:17 * defn wishes so much that clojars had the date a jar was posted

0:18 rjevans: defn: you can check the last modified date if you go to: http://clojars.org/repo/

0:18 but I also wish it was on the actual pages for a jar

0:19 defn: rjevans: oh right, good thinking

0:20 rjevans: clojars needs some work -- i should really fork and try to improve it

0:20 searching needs improvement, as does the ability for a maintainer to take "ownership" of a repository, or to make their repo the "official" version

0:20 maybe parse the pom and discover which version of clojure.core it was built for

0:22 rjevans: improved searching and more info on the actual pages for a jar would be a great step

0:24 seancron: mmarczyk: hmm, I'm getting ClassNotFoundExceptions when I try to use (incanter.core.Dataset. ["time" "up?"] {}) How do I include the Dataset class?

0:30 talios: jacortinas: clojars is maven based already. it's a maven repo.

0:30 jacortinas: yeah I know that

0:30 talios: even ivy uses maven

0:31 qbg: ,(some not [true true false true])

0:31 talios: and we use it cause no one else has anything better

0:31 clojurebot: true

0:31 jacortinas: Would you guys want to organize something better?

0:31 defn: `ryan`: how about "some"

0:31 jacortinas: whatever your opinion is on Ruby, the Rubygems system is amazing

0:32 defn: ,(some #(= true %) [false false false true])

0:32 clojurebot: true

0:32 defn: ,(some #(= false %) [true true true])

0:32 clojurebot: nil

0:33 `ryan`: oh yeah that's perfect, thanks

0:33 defn: you could also use (every?) or (not-every?)

0:33 in the same fashion

0:33 talios: jacortinas: probably not, mostly as I want something that's polyglot across clojure, scala, java etc. etc. JVM centric.

0:33 defn: (not-any?) would work also

0:33 fwiw

0:33 jacortinas: hmmm

0:34 talios: that's a good point

0:34 talios: gems is nice, but doesn't differentiate between build-time or run-time. which may or may not be a good thing.

0:34 maravillas: ,(some identity [false false true])

0:34 clojurebot: true

0:36 `ryan`: oh thanks maravillas, I was wrapping identity in a #() because I don't know what I'm doing

0:37 just got in the habit

0:38 jacortinas: ,(doc identity)

0:38 clojurebot: "([x]); Returns its argument."

0:38 maravillas: no prob

0:38 jacortinas: ,(doc some)

0:38 clojurebot: "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)"

0:39 maravillas: oh yeah, that's maybe a little bit more readable... #{true} instead

0:40 jacortinas: ,(some #{true} [false false true])

0:40 clojurebot: true

0:40 tomoj: jacortinas: why wouldn't we use somethin maven based?

0:41 jacortinas: ,(some #{true} [false false false])

0:41 clojurebot: nil

0:41 jacortinas: tomoj: for the eventual move away from being completely jvm dependent

0:41 tomoj: oh, yes

0:41 fuck that :P

0:42 jacortinas: tomoj: haha, I'm coming to clojure for a love of lisp, but I still hate Java

0:42 qbg: A larger problem than a build tool is all of the JVM dependent code

0:42 jacortinas: yup

0:42 tomoj: it's not a problem :(

0:42 it's a blessing

0:42 jacortinas: haha

0:42 xml libs and stuff like that

0:43 in my opinion for a language to be taken very seriously it needs to "eat it's own dogfood"

0:43 as much as possible should be "pure"

0:43 and only the very very lowest level things should be platform dependent

0:44 don't think that I hate that Clojure is on the JVM

0:44 tomoj: maybe someday in the far future

0:44 jacortinas: it's great that the JVM allowed clojure to be designed so well

0:44 tomoj: without the JVM clojure would be nothing, though

0:44 talios: jacortinas: but a maven repository, is just HTTP + XML metadata - nothing "jvm" about that itself

0:44 jacortinas: that's what I'm saying

0:45 IMO XML metadata == JVM

0:45 haha

0:45 talios: mmm riiiiiight.

0:45 jacortinas: and maven is not really a JVM agnostic tool

0:45 **platform agnostic**

0:46 talios: sure it is - it works on openjdk, sun jdk, ibm jdk

0:46 bea

0:46 jacortinas: true

0:46 tomoj: we're distributing jars

0:46 talios: that's like saying we shouldn't use linux cause its all C

0:46 tomoj: JVM agnosticism is not very important for a tool for distributing jars

0:46 talios: tomoj: a jar is just a zip file. call it a .car :)

0:47 tomoj: ok, if the jars contain no .class files, sure

0:48 jacortinas: I don't feel like it's saying don't use linux

0:48 talios: Does clojure.net distribute .dll's? :)

0:48 jacortinas: I feel like it's more like writing the clojure language in ruby

0:48 and then using rubygems to distribute clojure code

0:48 tomoj: hmm?

0:49 talios: nothing wrong with that actualy - if gems make a play for your infrastructure

0:49 tomoj: a clojure written in ruby sounds like a disaster

0:49 jacortinas: it feels based in the underlying implementation a little too much

0:49 talios: just like nothing with using puppet, or chef to distribute/configure your apps

0:49 jacortinas: tomoj: and I know that, it's a hypothetical

0:49 tomoj: oh, I misunderstood

0:50 jacortinas: tomoj: in my hypothetical situation Ruby == Java

0:50 tomoj: right

0:50 jacortinas: right

0:50 tomoj: we'd need to get to a point where we didn't need java libs anymore, though

0:50 jacortinas: ahh

0:50 tomoj: which I don't guess is going to happen any time soon

0:50 jacortinas: that's a great point

0:51 I would love to get to that point

0:51 talios: tomoj: even if a lot of apps were pure clojure, for enterprise integration, you're probably going to talk to a JEE server or something somewhere anyway

0:51 qbg: Rewriting Swing in Clojure would suck

0:51 talios: The sooner I can some clojure running in our OSGi setup I'll be a happier man :)

0:53 tomoj: how would you even go about writing swing in clojure?

0:53 end up like ruby with gems written in C?

0:54 or maybe some bundled ffi?

0:54 talios: at that point we may as well just go haskell

0:54 jacortinas: I see that as the equivalent of having all of clojure's libs really just using java libs

0:54 tomoj: hooray

0:54 talios: and complain about not understanding monads

0:54 jacortinas: lol

0:54 I love monads

0:54 ... I want to love monads

0:55 ... It would make a smarter person

0:55 :*{

0:55 ... if I understood them

0:55 talios: :)

0:55 qbg: What I know about monads: let = identity monad, for = list monad

0:56 jacortinas: that's haskel you're writing?

0:56 qbg: (the clojure constructs let and for are the identity monad and list monad respectively)

0:58 tomoj: for isn't exactly the list monad, is it?

0:59 qbg: Isn't much of a difference, from what I know

0:59 tomoj: concatenation?

0:59 qbg: There is a series of articles about monads in clojure

1:00 http://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ and http://intensivesystems.net/tutorials/monads_101.html

1:01 And there is clojure.contrib.monads

1:02 mmarczyk: for's :while goes beyond what the list monad can normally do, I believe

1:02 :when translates to guard in Haskell

1:14 defn: isnt that a running joke in Haskell?

1:14 How many monad tutorials does it take to make a Haskell programmer?

1:14 just one more...

1:16 jacortinas: haha

1:17 you know what's crazy?

1:17 I said "haha" in the #c room

1:17 and I was basically told to shutup until I had something intelligent to say

1:20 defn: oh dude. that's par for the course

1:20 * defn wonders if CDreamer is still around

1:20 * defn doesn't join #c to find out

1:21 jacortinas: it's really "douchy" in there

1:21 some admin saying that stupid people make a lot of noise

1:29 fualo: I started emacs and it asked me if I wanted to download clojure (after trying to get it installed) - what package does this? in *Messages* it looks like it was downloaded from rep.technomancy.us

1:29 I had swank/slime/etc installed from ELPA

1:38 tomoj: the technomancy-approved way is to use lein-swank

1:39 then it doesn't matter whether emacs downloads clojure or not

1:40 just add swank-clojure to your lein project's :dev-dependencies, `lein swank`, and M-x slime-connect

1:45 seancron: mmarczyk: Thanks for your help. I figured out that dataset doesn't like it when the data is "[[]]". It works when the data is just "[]"

1:47 mmarczyk: seancron: oh, so it does -- thanks for pointing this out, I actually thought it was a bug :-/

1:48 seancron: shouldn't stay at the keyboard this long, I guess

2:45 Raynes: mmarczyk: Remember that weird sexpbot bug that happened when sexpbot was run through a swank server, and you tried to use rseq or iterate? I just tried it locally with 1.2-beta1, and it worked. :o About to try it remotely.

2:49 Hrm, no dice. Odd. Before, it wouldn't even work locally.

2:49 Bleh, back to the shell script. :\

2:50 Oh. The dependencies are screwed up. That can't be good.

2:51 I absolutely love maven...

2:51 * talios wakes up

2:51 Raynes: talios: Not a word from you. :p

2:51 talios: maven maven maven :)

2:51 and yes - I do have a highlight notification on the word 'maven' :)

2:52 you'd have the same issue with leiningen tho - bad dependency references are bad dependencie references

2:52 Raynes: Different jars are being pulled down on Licenser's server than they are on my machine.

2:52 talios: It is Leiningen.

2:52 talios: oh :)

2:52 Raynes: But it uses maven.

2:52 talios: true true

2:53 I guess you ( or the other server ) has a ~/.m2/settings.xml file with mirrors defined

2:53 technomancy: Raynes: sometimes the maven central mirrors get screwed up

2:53 talios: maybe

2:53 technomancy: depending on which mirror you hit, you get a different jar. it's Magical.

2:53 talios: local mirrors/repos for the win.

2:53 Raynes: technomancy: I have two clojure-http-client jars, the wrong clojure-contrib jar...

2:53 All sorts of stuff.

2:54 I'm guessing that one of my own projects is the cause of the former.

2:54 I probably forgot to push a new clj-github snapshot or something.

2:54 defn: "It's magical."

2:54 * defn chuckles

2:55 talios: Maven is part of slitherin house.

2:55 The bad kind of magic.

2:55 -i+y

2:55 * Raynes tramps in and checks into each jar's project.clj to find the culprits.

2:57 * talios wonders how clojures works with transitive dependencies if you can just scp a file. I guess it doesn't...

2:57 * talios should try it and find out. never actually used clojars for publishing

2:57 tomoj: I think maven has this "I couldn't find it so I won't try to find it again for X amount of time" thing?

2:58 talios: it does for -SNAPSHOTS

2:58 tomoj: does leiningen do that too?

2:58 talios: but you can override that with -U

2:58 tomoj: aha

2:58 technomancy: talios: you have to scp a pom with the jar.

2:59 talios: technomancy: ahh right. good good

2:59 tomoj: I think by default its once a day it checks for new SNAPSHOTS, but thats configurable in ~/.m2/settings.xml ( which I suspect should solve it for lein as well )

3:01 tomoj: John Smart has a good post on this: http://www.wakaleo.com/blog/246-maven-mythbusters-maven-automatically-updates-for-every-build

3:02 Raynes: Ah yes, thus solves the mystery of the two clojure-http-client jars. I haven't uploaded a new snapshot, and the old one depended on a version of clojure-http-client under my own groupid

3:02 talios: mmm, thats more debunking the 'always downloads' myth actually

3:03 Time to run off for Thursday Night Curry anyways - night all!

3:08 Raynes: Oh, clj-sandbox's version range is causing the other problem.

3:08 I'll have to wait for Licenser to wake up and throw up a new version without the version range, then all our sexpbot woes should be fixed.

3:08 * Raynes will just keep sexpbot down until then.

3:09 Raynes: Version ranges are horrible beasts.

3:09 I only recently learned that projects you depend on can require one "soft" version, but your project's version is preferred.

3:33 bsteuber: where am I supposed to put (non-maven) dependency jar files using leiningen?

3:33 I guess not lib as they'll get deleted on every clean

3:35 defn: is it more idiomatic to do: (defn deserialize [f] (with-open [r (PushbackReader. (FileReader. f))] (let [rec (read r)] rec)))

3:35 Licenser: Raynes: I am just pushing the sandbo

3:35 defn: or should i make the let => (fn [r] (read r))

3:35 Raynes: Licenser: Cool stuff. Are you about to head to work or something? I have a sandbox question when you have some time. :)

3:36 Licenser: I have a few minutes

3:36 bsteuber: defn: (let [x y] x) is identical to just y, no?

3:37 so just (read r)

3:37 defn: bsteuber: yeah im trying to figure out why i would have written a let there

3:37 :)

3:37 Raynes: A guy made an issue on try-clojure, pointing out that (doc slurp) and doc on anything not whitelisted fails. I suppose this is by design, but is there any way around this, and is there any particular reason that this should fail in the first place? I'm pretty sure you can't pass *anything* to doc that isn't a symbol.

3:37 bsteuber: :)

3:38 Licenser: yes since doc takes a variable not a symbol

3:38 Raynes: Licenser: Aye, but you can't do anything malicious with doc, can you?

3:39 Licenser: a way around it would be rolling your own doc that is a macro escapes the symbol and then have doc

3:39 *

3:39 that looks up the doc on a symbol and is whitelisted

3:39 and yes I am a genius

3:40 hmm while it might be hard to internalize a macro I'm not entirely sure how that works

3:40 would need to execute it upon startup and declare a doc* function

3:40 like (doc* [x] (doc (resolve x))

3:41 and (defmacro doc [x] `(doc* '~x))

3:44 Raynes: Man, I hate that "cannot change nickname while banned on channel" stuff.

3:44 Licenser: Raynes: 0.4.1 is pushed

3:45 Raynes: Licenser: Awesome.

3:45 Thank you.

3:53 Hrm, still happens. Weird, but d'oh well.

4:09 defn: is (meta) off limits to the sandbox?

4:10 Raynes: Yes.

4:10 I believe so.

4:11 sid3k: yo

5:33 bsteuber: technomancy: is lein uberjar currently broken? for me it deletes lib but doesn't populate it again

5:37 bartj: hi all

5:38 can someone reproduce this error message with an example - "Parameter declaration method-name should be a vector"

5:54 lozh: ,(defn a (a) a)

5:54 clojurebot: java.lang.IllegalArgumentException: Parameter declaration a should be a vector

5:54 lozh: ,(defn a (method-name) a)

5:54 clojurebot: java.lang.IllegalArgumentException: Parameter declaration method-name should be a vector

5:55 lozh: fix by putting [method-name] instead

7:30 sthuebner: Is (read-line) supposed to work with SLIME?

7:30 I'm using SLIME-20091016 with swank-clojure-1.1.0

7:31 and (read-line) doesn't come back on the REPL

7:31 but if I execute (read-line) in the *inferior-lisp* buffer, it works as expected - returning what I've typed until I hit ENTER

8:22 lpetit: hello all

8:23 serp_: hi

8:23 lpetit: cemerick, ericthorsen: just read -and then answered- to the post in enclojure's ml

8:55 defn: hi lpetit

8:55 lpetit: defn: hi!

8:57 defn: lpetit: how goes the clojre hacking

8:59 lpetit: defn: I wish I had more time on it !

8:59 defn: how goes the joyful book hacking ? :)

9:15 defn: lpetit: joy of clojure?

9:15 lpetit: well it

9:16 lpetit: well it's not my book of course, that's fogus and chousers' baby

9:17 cryptic_star: morning all - as far as I'm aware, a Java array is a type of seq, but is there an easy sort of way to convert it into a list?

9:19 lpetit: defn: I'm really not awaken today !

9:20 eckroth: Using Swing from Clojure gives me a blank gray window; right-click works (for incanter windows), but the main window does not draw; same effect if I use a simple repl with this code: http://www.dreamincode.net/code/snippet3252.htm ; however, JDK demos work fine (independent of Clojure)

9:20 defn: lpetit: a list is a seq

9:20 errr sorry

9:20 cryptic_star: a list is a seq

9:21 cryptic_star: seqs are an abstraction

9:21 eckroth: Why would only Java windows called from Clojure show as blank, and only the main window (tooltips, right-click menus, etc. work)

9:21 LauJensen: Has anyone here tried wrapping a Clojure program in an installer, which checks for the presence of the JVM - for Windows? If so, any recommended tools?

9:21 defn: eckroth: perhaps your version of the JVM?

9:22 eckroth: defn: I'm on Arch Linux, JVM version is 1.6.0_20

9:22 rhudson: eckroth: openjdk or sun?

9:23 defn: eckroth: i had a similar problem on ubuntu, perhaps it is openjdk vs sun

9:23 im guessing you need sun

9:23 Raynes: Oh boy.

9:23 bozhidar: OpenJDK is very buggy

9:23 eckroth: rhudson: defn: it's Sun

9:23 bozhidar: when it comes down to swing

9:23 Raynes: eckroth, defn: I actually wrote that code last march. I had no idea what I was doing back then.

9:23 raek: cryptic_star: arrays are not seq themselves (but they are seqable). you can make a seq from an array with (seq the-array)

9:24 eckroth: Raynes: yours is the dreamincode.net link?

9:24 cryptic_star: @defn @raek many thanks!

9:24 Raynes: It worked at the time, but I can't promise that it is decent in any way.

9:24 defn: rhudson: is raek thanks for fixing that for me :) i was just looking up the sequence docs

9:24 chouser: raek: yay. I was about to say that. I love it when I don't have to say things. :-)

9:24 Raynes: eckroth: Yeah.

9:24 defn: err rake: thanks ^^

9:24 bozhidar: I haven't used clojure that much for Swing development, but I've used Java a lot - and you I hate bug reports submitted from OpenJDK users...

9:24 defn: raek*, gah, sorry for the typos folks

9:24 eckroth: Raynes: ah, cool; well, I don't know why it would not work now..

9:25 * Raynes tests to see if it still works for him.

9:25 defn: chouser, raek: could you explain to me the difference between something being a sequence and being seq'able?

9:26 eckroth: Raynes: ah are you the 'famous' Try Haskell / Try Clojure / Try Ruby guy, as seen on HN?

9:26 defn: eckroth: he's the try clojure guy :)

9:26 Raynes: eckroth: I'm just the Try Clojure guy.

9:26 eckroth: Raynes: ok I just misremembered; you showed up on HN recently right?

9:26 Raynes: Yeah.

9:26 eckroth: Raynes: ok, cool! congrats on the publicity

9:27 triyo: I'd like to give counterclockwise a try. Does it play nicely with leiningen

9:27 Raynes: I think that tryclojure thread was the only one I've posted in there.

9:27 eckroth: Indeed, thanks. It was overwhelming. I never expected people to be so crazy about trylanguage sites. :p

9:27 defn: Raynes: yeah, really, a hacker new reference is like the nerd version of digg

9:28 Raynes: eckroth: And that code actually does still work for me.

9:28 defn: it's kind of a big deal

9:28 eckroth: Raynes: yeah I've never used them myself, but I'd like to try them as a teaching aid someday, if I ever get the pleasure of teaching a dynamic language (I'm a CS grad student)

9:28 defn: you rode the front page for almost a day i think

9:28 eckroth: Raynes: ok so it works; I wonder why clojure-swing apps won't draw for me, but regular java ones will

9:28 Raynes: defn: Yeah, you know when people start telling you how bad something is, it's popular.

9:29 chouser: defn the 2 or 3 paragraphs in the book describing the differences between seq, seqs, sequentials, and things that support seq went back and forth between us and rhickey 3 or 4 times trying to get all the terminology just so.

9:29 defn: chouser: ill re-read that section in JoC

9:30 chouser: oooooo! At the same time, a wide variety of objects satisfy this interface. Every Clojure collection provides at least one kind of seq object for walking through its contents, exposed via the seq function described above. Some collections provide more than one, for example vectors support rseq and maps support the functions keys and vals. All of these functions return a seq or, if the collection is empty, nil.

9:30 Raynes: eckroth: Well, it kind of works. Half of the first button can't be seen, and I believe I have it set so you can't resize the window.

9:30 * defn epiphany.

9:31 defn: so lists are collections which have a way in which they are seq'able?

9:31 * Raynes is amused that someone stumbled upon his ancient snippet.

9:31 chouser: defn: PersistentLists are a bit of an exception, actually, in that they support the ISeq interface directly.

9:31 eckroth: What's weird is that I can generate an incanter plot window, but I see nothing but gray; yet if I right-click I get a menu, and I can save the plot as a PNG, and the PNG looks fine; I even get tooltips on the gray plot window, but no plot, no matter how much I resize, etc.

9:32 cryptic_star: triyo: I use counterclockwise, but never with leiningen, mostly because I used counterclockwise when on Windows, and getting leiningen set up with Windows didn't look fun :) I believe leiningen has a way to start an eclipse project and then build off of it - however, I don't know if you can execute leiningen inside eclipse

9:32 eckroth: Raynes: it's somewhere down the list of google results for "clojure swing"

9:32 Raynes: Oh, that is horrible.

9:32 There has to be better examples out there.

9:32 defn: chouser: that actually makes sense -- since vectors (correct me if im wrong here please), seem to be a more complex version of the ISeq interface

9:33 and the same with maps and sets, they're sort of evolved versions of ISeq, where the list is the analog to them both

9:33 chouser: am i barking up the wrong tree?

9:33 chouser: defn: you're very close. :-) Vectors themselves provide a more complex interface (assoc, conj, pop, peek, etc.) so in that sense yes. But again, they don't support ISeq directly -- you call seq on a vector to get a thing that supports ISeq.

9:33 cryptic_star: triyo: there may be a way to do it from the external tools configuration - I've set up gradle to run from there before (Run -> External Tools -> External Tools Configuration)

9:34 chouser: ,(seq? [1 2 3])

9:34 clojurebot: false

9:34 defn: chouser: ah-ha!

9:34 chouser: ,(seq? (seq [1 2 3]))

9:34 clojurebot: true

9:34 chouser: ,(class (seq [1 2 3]))

9:34 clojurebot: clojure.lang.PersistentVector$ChunkedSeq

9:34 lpetit: triyo: ccw will not get in your way with lein, but does not use lein yet

9:34 defn: ,(class (seq '(1 2 3)))

9:34 clojurebot: clojure.lang.PersistentList

9:34 chouser: so seq on a vector returns an instance of a "chunked-seq-on-a-vector" class

9:35 defn: ,(class (seq #{1 2 3}))

9:35 clojurebot: clojure.lang.APersistentMap$KeySeq

9:35 defn: chouser: yeah! that makes perfect sense now

9:35 you've completely demystified it for me. :)

9:35 raek: for java folks it might be useful to think of seqs as iterators

9:35 defn: iteration has no place in FP! *kidding of course*

9:35 Raynes: And for me.

9:35 chouser: defn: well, great! Now why didn't the book do it... *glares at the book*

9:35 lpetit: triyo, cryptic_star: there's a work in progress in Stephan Mülhstrasser's fork (a contributor of ccw) where he is already able to use lein to get dependencies of labrepl and create a labrepl project

9:36 Raynes: chouser: I faintly remember reading that section like 3 times, and still not quite *getting* it.

9:36 chouser: :-(

9:36 raek: I think this abstraction is one oof the most beatiful things about clojure...

9:36 triyo: lpetit: thanks for that info

9:36 Raynes: I don't think anyone has really explained it to me quite well until now.

9:36 chouser: Just throw this IRC excerpt into the book. ;p

9:36 defn: chouser: could i suggest you show examples of (class (seq [1 2 3])) into the book

9:37 i think that really helps

9:37 chouser: raek: maybe, though the word "iterator" may also bring in thoughts of mutable semantics that are entirely unhelpful.

9:37 defn: yeah, I think you're right.

9:37 raek: true.

9:37 defn: chouser: it demonstrates that pivot point between seq and how they're actually implmeneted

9:38 implemented

9:38 chouser: I agree the seq abstraction and its use is one of clojure's most beautiful points, but it's just enough different from anything else we have words for that it's hard to talk about without tripping up.

9:39 defn: yeah, it sort of becomes a dialog in a lot of ways i think

9:39 Raynes: chouser: To be fair, you're still doing an excellent job with all of that.

9:39 defn: because here, i can say: so you mean it works like this? and you sharpen the definition ever so slightly

9:39 raek: I think that it would be useful for beginners if one could turn off the "call seq on its argument" convenience feature of first and rest when learning

9:40 Raynes: I still hate manning. They never emailed me back. :(

9:40 defn: Raynes: what was your issue again?

9:40 not being able to download the latest?

9:40 i just use my original email from them with the yahoo order number

9:40 Raynes: defn: I need to sign in to get the latest MEAP, but it wont let me create an account, and told me to email support. That didn't work.

9:40 I don't have my original email.

9:40 defn: you don't need to sign in

9:41 wha? where'd it go?

9:41 email is cheap, no need to delete ;)

9:41 Raynes: I have no clue where it is. Probably in my old root.disk files, in thunderbird's trash. I have no clue how to get to it.

9:41 I never delete emails.

9:41 Ever.

9:41 Doesn't mean I don't misplace them. ;)

9:41 defn: Raynes: that's pretty lame that manning didn't reply

9:41 who did you email

9:41 Raynes: support

9:42 defn: hrmph -- bummer

9:42 Raynes: It isn't that big of a deal. I can wait for chapter 8, I suppose.

9:42 chouser: Raynes: do you provide an email address or something when you order the MEAP? Do you know which email address you used?

9:42 defn: im awfully excited to see the last few chapters

9:42 Raynes: chouser: Yeah, because they send me stuff.

9:43 chouser: Raynes: let me see if I can use my contact to get any traction for you.

9:43 Raynes: PM your email address to me?

9:43 Raynes: Sure.

9:43 defn: the "When to use refs/agents/atoms/primitive locking/futures/promise and deliver/pmap/cells/per-thread bindings stuff is absolutely want I want to hear more about

9:43 "

9:43 Raynes: I appreciate that.

9:43 defn: wow my typing is getting worse and worse today

9:44 Plouj: forgive my ignorance, but if clojure is a dynamically typed language, does that mean that it requires more unit-testing to make one feel more confident about the correctness of the code?

9:44 Raynes: defn: It's because I was talking about Perl6. It has you all mixed up.

9:44 defn: :D

9:44 Plouj: more than a staticly typed language like Haskell

9:44 defn: Plouj: it depends on what you're doing

9:45 Raynes: Unit testing is always good.

9:45 defn: Plouj: if you have I/O going on then testing will be more important

9:45 Plouj: defn: I'm wondering in general because I'm trying to decide whether to focus on learning Haskell or clojure for their concurrent tools

9:45 defn: Plouj: clojure is less restrictive

9:45 and for that reason i prefer clojure

9:46 i dabbled with haskell -- it's a beautiful language with lots of interesting ideas

9:46 chouser: Plouj: I'm sure they're both worth learning. I've only dabbled with Haskell -- some day I need to give it a more serious look.

9:46 defn: but clojure is more "flexible" -- i dont feel constrained by the rules of the language

9:46 lpetit: Plouj: people generally don't use this criteria to choose between the two

9:46 Raynes: The argument of dynamic typing versus static typing isn't as simple as "with static typing, you can be more confident that your code is correct"

9:46 defn: that's a good point also

9:47 Raynes: But Haskell is a great thing to learn.

9:47 Plouj: lpetit: heh, I might be listening to wrong advice, but I wouldn't want to learn a language that later requires me to write unit tests for every piece of code :)

9:48 Raynes: Knowing either is a benefit to the other.

9:48 I learned stuff with Clojure that helps me write better Haskell code, and vice versa.

9:48 chouser: unit testing is less prevelent in the clojure community that in, say, the ruby community. Whether this is justifiable or not is something else...

9:48 Raynes: I don't actually write much (any, lately) Haskell code though.

9:49 defn: im going to go out on a very, very long limb here

9:49 and suggest that unit testing in ruby is partly due to the high number of novice programmers

9:49 that's going to get my head chopped off

9:49 but i think it's encouraged as much as it is to offer a more tangible "guarantee"

9:50 Raynes: I suggest that the lesser prevalence of unit-testing in the Clojure community is related to Clojure being more functional-oriented.

9:50 defn: well yeah there's that too of course

9:50 Raynes: There isn't much to test in pure functions.

9:50 defn: yeah, i tried doing unit testing on some stuff i was writing and it just felt like i was re-writing my code

9:51 Plouj: heh, ok, I guess not all is as bad as I thought :)

9:51 defn: like asserting that (inc 1) is 2 or something

9:51 of course it's 2

9:51 chouser: heh

9:52 defn: and when you build that up to a complex function, if the function contains pure elements like inc

9:52 then there is nothing to test

9:52 Hodapp: I've talked to a lot of people who paid massive amounts of lip service to the idea of unit tests... and hardly ever wrote them.

9:53 raek: making seams in clojure is really simple

9:53 defn: i can echo that -- however, in Ruby there are /lots/ more reasons to have them

9:53 dnolen_: Plouj: also remember that Haskell makes certains kind of generic programming difficult. Adopting a strong type system means you give something up.

9:53 raek: if a function uses another complex function, that one can be dynamically rebound with (binding ...)

9:53 Plouj: I guess I'll learn that once I use clojure/Haskell more

9:55 defn: mutable vs immutable => the reason for unit testing EVERYTHING versus only some things

9:56 Plouj: try to open a file, read it, write to it, execute a line of code contained inside of it

9:56 * Hodapp glares at the entire room, and goes sulking back to his desk to write more C++.

9:57 defn: Hodapp: working at Google, eh? ;)

9:57 chouser: Hodapp: no worries ... these days I'm debugging in PHP! :-D

9:58 Plouj: defn: what about testing that the types that your variables take are what you actually expect? How big of a reason is that for unit testing?

9:58 defn: oh god chouser ... say it isn't so

9:58 Plouj: consider that the main "real" outside inputs will be few

9:58 think about a google search...

9:58 chouser: PHP is a fascinating language, in a sort of anthropological sense.

9:59 raek: Plouj: in some cases, that can be done with pre- and postconditions

9:59 defn: that too

9:59 but in general i dont find it necessary

9:59 bortreb: is there something like perl's CGI:Ajax module for clojure yet?

9:59 defn: because 90% of my code is relying on code above it

9:59 if the inputs were bad to begin with, we wouldnt be at this depth

10:00 abstract i know, but you just dont need to pay much attention to it -- if you treat your input like a string, and make sure it receives a string from the next level up the function chain

10:00 then there's nothing to worry about

10:00 clojurebot: @ has nothing to do with whether sth is evaluated or not

10:00 Hodapp: defn: nah, not Google. I thought they mostly were Python or something.

10:01 defn: Hodapp: GMail is C++ to the max

10:01 Plouj: heh, ok

10:01 defn: their interviewers get mad if you write Java on the whiteboard

10:01 Plouj: interesting

10:01 defn: Hodapp: they do a lot of python too, but GMail and such is heavy C++

10:02 Plouj: does anyone know of any trading companies using clojure?

10:02 wwmorgan: how do you pronounce the macros -> and ->>?

10:03 lpetit: thread-first , thread-last

10:03 defn: heh

10:03 i call them arrow and double arrow

10:03 and know how they work

10:03 Raynes: wwmorgan: Hyphen left arrow and hyphen right arrow right arrow. ;)

10:03 s/left/right/

10:03 sexpbot: wwmorgan: Hyphen right arrow and hyphen right arrow right arrow. ;)

10:04 mefesto: i wonder how much google has been dog fooding their go language

10:04 defn: mefesto: i think they've been doing quite a bit with it

10:04 lpetit: google releases a lot of things "in the wild"

10:05 defn: after all of the unfavorable publicity ive seen some "updates" to go which actually made it looks quite good

10:05 Raynes: I'm more interested in Rust.

10:05 defn: what big company is sponsoring rust?

10:05 * defn evil grin

10:06 Raynes: What big company is sponsoring Clojure? :p

10:06 Bahman: Hi all!

10:06 defn: Raynes: Mozilla is developing Rust

10:06 Raynes: I know.

10:06 defn: Clojure is riding a lisp wave to heaven right now

10:07 I'm still sort of amazed that the mainstream has held an interest

10:08 Raynes: in any event, re: rust vs go -- they're decided to do specific things in-house

10:09 "structural" typing is kind of a dead giveaway when it comes to go vs rust

10:09 they're both structurally typed

10:11 FAQ on Rust: Why did you do so much work in private?

10:11 A certain amount of shyness. Language work is somewhat political and flame-inducing.

10:11 Languages designed by committee have a poor track record. Design coherence is important. There were a lot of details to work out and the initial developer (Graydon) had this full time job thing eating up most days.

10:11 * defn makes me feel warm and fuzzy about clojure

10:12 defn: Rich isn't shy, but he won't bend to the whim of committee

10:12 Raynes: I bet he is having all sorts of fun at emerginglanguagescamp

10:13 defn: at just about any conf right now clojure is getting a lot of attention

10:13 im going to strange loop and like 40% of the talks are on clojure

10:13 btw chouser: looking forward to your talk at strangeloop :)

10:14 chouser: excellent! I'm looking forward to being there.

10:14 raek: I *really* want to go to strangeloop

10:14 defn: raek: so go then! :)

10:14 raek: I must investigate some more if the university might sponsor this

10:14 chouser: 40% might be a slight exaggeration

10:15 raek: it will cost at least about $ 1000 for me to get there

10:15 chouser: but one talk on clojure in nearly every time slot is nothing to sneeze at.

10:18 defn: :)

10:19 In the middle of MO, no less! :)

10:21 chouser: im sure you've seen this, but you know how a lot of books have those cards that you can tear out?

10:22 the "quick reference" thing?

10:22 chouser: http://faustus.webatu.com/clj-quick-ref.html

10:22 ive been helping my friend learn clojure and this has become invaluable -- it's a very nice mix

10:22 dpritchett: Has anyone else encountered a problem with the cljr install trying to invoke X11? I don't have X installed at all and I'm getting this: ~$ java -jar ./cljr-installer.jar Exception in thread "main" java.awt.HeadlessException: No X11 DISPLAY variable was set, but this program performed an operation which requires it. at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:173)

10:23 chouser: defn: yeah, I saw that -- a very nice quick reference. Not exactly small, altogether.

10:24 defn: chouser: yeah fair enough -- but it seems to hit all of the points, and give a nice overview without being reductive or overly verbose

10:25 chouser: food for thought anyway

10:25 chouser: I agree that page fills a gap in the existing docs.

10:26 cemerick: dpritchett: sounds like the installer is trying to do some UI stuff, and is in headless mode that doesn't allow it.

10:26 (or importing certain classes is enough to trigger that)

10:26 dpritchett: It does sound that way - I am surprised that I can't get away with installing on an X-less machine. Guess I'd better check to make sure that I really purged X like I thought I had.

10:27 AWizzArd: cemerick: After spending trillions of hours with Ant I must now admit that it very much sucks for non-trivial projects. OMG I hate it.

10:27 dpritchett: su

10:27 * dpritchett blushes

10:28 cemerick: dpritchett: If that's actually the problem, then whether X is around or not isn't going to help.

10:28 Plouj: defn: how does Rust benefit Clojure or am I missing something?

10:28 dpritchett: That's what I'd think but it's possible I only removed half of X and so the installer is detecting it and assuming my machine isn't completely wonky.

10:28 cemerick: AWizzArd: Agreed. The same goes for any task/target-oriented build system AFAICT.

10:28 dpritchett: Either way I submitted a ticket to cljr on github

10:28 http://github.com/liebke/cljr/issues/issue/12

10:29 Lajla: What's the exact difference between symbols and keywords?

10:29 THat keywords evaluate to themselves?

10:30 AWizzArd: cemerick: I can't say enough about it, as I don't know how Maven or Ivy or Gradle or Leiningen are doing it.

10:30 dpritchett: Yes Lajla

10:30 at least that's what it says on page 29 of JoC

10:31 cemerick: AWizzArd: Ivy just adds maven-style dependency mgmt and compat to ant.

10:31 Lajla: dpritchett, JoC?

10:31 Joy of Child rape?

10:32 cemerick: I've not looked at gradle for more than an hour, but I'm really not excited by the notion of using yet another language in connection with a less mature build tool. *shrug*

10:32 AWizzArd: cemerick: I would like to have one build script for all 24 projects that site under my src/ folder. And I want to specify with each call: 1) which project I want to build, 2) do I want to compile it into a build/ dir?, 3) do I want to jar it? 3a) do I want to include the deps into the jar? 3b) do I want to include the sources into the jar?

10:32 Raynes: That was majorly inappropriate.

10:32 dpritchett: ಠ_ಠ

10:33 AWizzArd: ant {:project "name", :compile false, (jar :sources false, :deps true)}

10:33 dpritchett: http://joyofclojure.com/

10:33 AWizzArd: this is a horror with ant

10:36 arkh: at strangeloop, will there be video of the conferences, a. la. TED?

10:36 dpritchett: I just discovered strangeloop last week - hours after I'd committed to a fishing trip for that same weekend. I only live 7 hours' drive away too :(

10:37 chouser: I think the talks will be recorded, but I don't know how those will be released.

10:37 cemerick: AWizzArd: I'm not sure about the whole idea of nested dependent projects (which is what it sounds like you have), but FWIW, you can do all that in maven, once, and have all of your projects "inherit" that behaviour.

10:38 Lajla: dpritchett, I was close, wasn't I?

10:38 cemerick: chouser: I still pine away for a few of the talks from the ILC. :-(

10:46 chouser: cemerick: me too

10:47 but understandable, I guess. Video on the web is hard. It's not like there are services where you can make video files downloadable for free...

10:47 defn: youtube...

10:47 * chouser googles youtube

10:48 cemerick: chouser: I think it just fell on the floor -- Dan's surely got way more important things on his plate.

10:48 http://ilc2009.scheming.org/node/15

10:48 Hodapp: defn: interesting, did not know they used that much C++ there.

10:49 (delayed response, I know)

10:50 defn: Hodapp: no worries

10:52 bortreb: does anyone know of a good compojure tutorial/ can you do AJAX-y things with it? sorry for being such a noob...

10:52 defn: Lajla: How in the hell does JoC translate to what you said? You're sick. Seek medication.

10:52 stephyn: I have a question about an idiom in Clojure. I'm watching SICP and it seems to be idiomatic in Scheme to nest define's. I discovered that this doesn't have the desired effect in Clojure. What is the idiom in Clojure? I can think of two things: use let or make the defn's ns private. The 2nd feels Java-ish to me...but what do I know.

10:53 defn: stephyn: let is functionally equivalent to nested fn's

10:53 it's the identity monad

10:53 Chousuke: stephyn: there's letfn

10:54 Lajla: defn, well, it is greatly inappropriate, but since by your own admission I have asperger, you can never ever blame me for this because I don't understand social rules.

10:54 stephyn: chousuke: interesting. I have in mind as the canonical example of this the sqrt by approximation example.

10:55 Lajla: Chousuke, besides, my Finnish is all proper, isn't it?

10:55 En puhu lapsiseksistä suomeksi.

10:55 Hodapp: wtf did I walk into

10:55 arkh: cemerick: that was over a year ago :(

10:55 cemerick: arkh: yeah, I know. I've basically assumed the vids are gone now.

10:56 Which is a huge shame in a couple of cases.

10:56 defn: Lajla: and yet, due to the forces of reality, you could be expelled from the clojure community because people do not understand your strange mix of asperger's and tourettes

10:56 * Hodapp looks at defn

10:56 Lajla: defn, that would be so unfair, I can't help it.

10:57 arkh: If he sent me the DV's, I'd do it (for free of course)

10:57 Lajla: Instead, you should grant me an excuse to do whatever I want because I can't help myself and aspies are sooooo sad because they can't get a girl.

10:57 cemerick: arkh: stuff like that is what I was thinking with my "crowdsourcing" suggestion.

10:57 Raynes: defn, Lajla: -> #clojure-casual

10:57 defn: i'll pass on continuing this conversation

10:57 moving on

11:00 * stephyn I also had a problem figuring out a particular destructuring. (func 0.9 ({:a 1, :b 2} {:a 2, :b 1})) I was able to figure out how to get the keys I was interested in: [x [{a :a} {b :b}]] but I couldn't figure out where to put the :as to refer to each individual map. Any pointers?

11:01 chouser: stephyn: you want a seq of the maps? basically the second arg to func?

11:03 stephyn: [[x [{a :a} {b :b} :as ms]]

11:03 stephyn: chouser: what I had was a double and a list of 2 maps. I wanted to both be able to extract specific keys and refer to the 2 maps as whole. What I ended up doing was [x [a b]] and then just using (a :a) and (a :b) as needed.

11:04 and then a and b as needed.

11:05 AWizzArd: What is the idiomatic solution for two namespaces requiring each other?

11:05 stephyn: I don't think that [x [{a :a} :as a1 {b :b} :as b1]] worked, IIRR.

11:06 cemerick: AWizzArd: "don't do it" is idiomatic. Everything else is a hack. :-)

11:06 chouser: stephyn: [[x [{a :a :as a1} {b :b :as b1}]]

11:07 stephyn: chouser: interesting. thanks.

11:10 dpritchett: I feel silly that I had to read fogus's blog to figure out that dosync.posterous.com is written by HN/github user swannodette

11:10 dnolen: dpritchett: that's me

11:11 tomoj: are you trying to fracture your identity?

11:12 dpritchett: Maybe he's trying to avoid being recruited ;)

11:18 pdk: ANYway

11:23 lpetit: So, who is talented, and has time to grow a pretty logo for counterclockwise ? What about the suggestion made by Konrad ?

11:26 You know you've done too much ccw, when you encounter this in your code "DSLConstListType.newType(this, projectName, ni.getIdentifier())", and, in order to make "ni.getIdentifier()" replace the parent call, hit Alt + R (Raise over) without success ...

11:34 must leave, cu

11:41 cemerick: If there's only one method of a given name and arity, clojure interop should select and call it without complaint (or reflection, for that matter), no?

11:42 Here I'm referring to java.awt.geom.GeneralPath.moveTo(float, float), which seems to require (float x) wrapping to call.

11:43 cor|n: ,(println "corin and afkafka and iryuu and bot0 are faggots")

11:43 clojurebot: corin and afkafka and iryuu and bot0 are faggots

11:43 cor|n: nice one clojurebot. lol

11:44 ,(println "#wrongplanet will be owned. come and troll it. :-)")

11:44 clojurebot: #wrongplanet will be owned. come and troll it. :-)

11:44 cor|n: nice advise clojurebot, rofl

11:47 bortreb: cemerick: I've had the same problem -- it looks like you actually have to wrap it in (float)

11:48 cemerick: wtf is going on with the bizarre/insulting msgs today? :-(

11:48 bortreb: it certainly seems like a regression

11:49 danlarkin: :-/ trolls

11:49 Drakeson: how can I get the list of currently "require"d namespaces that start with a given prefix?

11:50 cemerick: danlarkin: Hrm, not entirely. I'll not repeat what was said earlier.

11:51 dpritchett: balrogs

11:55 Bah, Raynes logged out just as I wanted to recommend a magnet school in his area

12:00 arohner: Drakeson: I don't know about the required part, but c.c.find-namespaces might help

12:03 Drakeson: arohner: thanks. That ns solves another problem, though :p

12:04 arohner: Drakeson: aha, then deref clojure.core/*loaded-libs*

12:05 it's private, so you'll have to use the var trick

12:05 ,@#'clojure.core/*loaded-libs*

12:05 clojurebot: #<Ref@157c2bd: #{clojure.contrib.accumulators clojure.contrib.def clojure.contrib.error-kit clojure.contrib.except clojure.contrib.generic clojure.contrib.generic.arithmetic clojure.contrib.io clojure.contrib.macro-utils clojure.contrib.monads clojure.contrib.properties clojure.contrib.seq clojure.contrib.seq-utils clojure.contrib.sql clojure.contrib.sql.internal clojure.contrib.string clojure.contrib.types clojure.core cl

12:06 Drakeson: arohner: aha, thanks a lot

12:12 stephyn: is there a shorter anonymous function literal that always returns 1 than #(identity 1)?

12:12 bortreb: #(1)

12:12 * stephyn that doesn't work...says 1 is not a Fn.

12:12 arohner: ,(#(1))

12:12 clojurebot: java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn

12:12 arohner: ,((fn [] 1))

12:12 clojurebot: 1

12:13 Chousuke: (constantly 1)

12:13 bortreb: ,(#(*))

12:13 djpowell: cemerick: have you figured out your GeneralPath problem yet?

12:13 clojurebot: 1

12:13 cemerick: djpowell: aside from the (float arg) workaround, no

12:13 stephyn: bortreb: weird...why does that work?

12:14 cemerick: I don't have time to spelunk in the clojure compiler today. :-)

12:14 arohner: stephyn: that's the identity on multiplication

12:14 (#(+))

12:14 djpowell: GeneralPath *does* have overloads. it got retrofitted at some point. you may be looking at old javadocs

12:14 bortreb: because the zero-element under multiplication is 1

12:14 arohner: ,(#(+))

12:14 clojurebot: 0

12:14 stephyn: oh, that's right.

12:14 I'm not sure I want to rely on *that*. ;)

12:15 bortreb: I don't think you can do shorter tho :)

12:15 djpowell: ,(filter #(= (.getName %) "moveTo") (seq (.getMethods (class (java.awt.geom.GeneralPath.)))))

12:15 clojurebot: (#<Method public final synchronized void java.awt.geom.Path2D$Float.moveTo(float,float)> #<Method public final synchronized void java.awt.geom.Path2D$Float.moveTo(double,double)>)

12:15 stephyn: no, that's true...you did meet the requirements admirably.

12:16 cemerick: djpowell: Crud. Well, I'm an idiot. :-x

12:16 djpowell: good catch. My usual javadocs are 1.5; I'm using 1.6 for this particular project.

12:16 djpowell: in earlier java or something it had float params, but then they made it a subclass of some other class

12:16 apparently it is legacy now

12:21 dpritchett: #(inc 0)

12:22 cemerick: djpowell: yeah, the change was in 1.6. I should upgrade my on-disk javadocs, clearly.

12:25 hugod: anyone know of something like enlive, but in javascript?

12:25 cemerick: hugod: hahahaha. Good one, mate.

12:26 Oh, you're serious. ;-)

12:26 hugod: cemerick: :)

12:26 why can't I program my browser in clojure!

12:27 Raynes: hugod: Because of the price of tea in China.

12:27 cemerick: hugod: The real question is, will chouser respond better to subtle hinting or outright bribery?

12:27 hugod: Raynes: tea has started revolutions before now

12:28 arkh: hugod: it wasn't really the tea they had qualms about ;)

12:29 hugod: arkh: the rum?

12:29 pdk: so, quick q with vimclojure setup

12:30 when i go to run ant in the installation steps (for winxp) it gives me "build.xml:66: could not find clojure.lang.Compile"

12:30 arkh: hugod: aye, the rum

12:35 pdk: wish I knew something about ant but it sounds like it can't find the clojure.jar in your path

12:35 classpath? idk ...

12:36 pdk: hm just checked my classpath under control panel -> environment vars

12:36 even after adding full paths to clojure.jar and clojure-contrib.jar then restarting the console, still gives the error

12:36 or is lang.Compile yet another extra clojure.org download

12:37 arkh: pdk: no, it should be in clojure.jar

12:37 pdk: though i think i had this crap yesterday

12:37 where if i updated PATH

12:37 arkh: pdk: is clojure.jar in your system path, e.g. does it show up when you type 'PATH' at the command prompt

12:38 pdk: even when restarting the console window the new PATH wouldnt take effect until i rebooted or just added it manually every time i opened a console

12:38 ok that's stupid as hell it has to be in PATH

12:38 i just went and put it in CLASSPATH

12:39 arkh: when in doubt, do both ;)

12:39 pdk: nah that doesnt fix it

12:41 arkh: this is a kludge, but what if you copied it into your ./classes subdirectory, under build.xml ?

12:41 Blaine: I wish clojuredocs.org would automatically link glossary terms to their definitions

12:52 pdk: hmmm

12:52 there's an idea arkh

12:52 do you mean a classes subdir in the vimclojure folder

12:52 arkh: or wherever other jars are vimclojure depends on

12:53 pdk: nah didnt fix it

12:53 arkh: :(

12:56 pdk: sometimes you just wish there was a version of notepad or something with lisp autoindent

12:59 Blaine: pdk: trying to get vimclojure set up?

12:59 pdk: yeah

12:59 ant is being stupid and saying it can't find clojure.lang.Compile even after a few attempts to coax it

12:59 Blaine: how is that relevant to vimclojure?

12:59 :P

13:01 pdk: well kotka's site says that's an install step so :p

13:01 cause there's some vimclojure.jar i need to compile via ant

13:01 Blaine: aw dude, nah

13:01 pdk: oh can you skip this step

13:01 that's news for sore ears... eys

13:02 yeah EYS

13:02 not eyes!

13:02 Blaine: just download http://www.vim.org/scripts/script.php?script_id=2501

13:02 pdk: the hell

13:02 Blaine: and copy autoload, doc, ftdetect, ftplugin, indent and syntax folders to your .vim dir

13:02 pdk: i dled it from there

13:02 hmm

13:02 Blaine: and you're golden

13:02 pdk: will i still have access to nailgun if i do it that

13:02 cause one blog post was saying

13:02 Blaine: no idea

13:03 pdk: "i don't like nailgun so i did it in <the way blaire described>"

13:03 Blaine: are you new to clojure?

13:03 I am, and I don't know what that is

13:03 but I don't think I need it

13:03 haha

13:04 I just copied all those dirs to ~/.vim and I get syntax highlighting, nifty indendation, and rainbow parenthesis

13:04 I went by this blog post: http://writequit.org/blog/?p=386

13:04 pdk: yeah all things considered thats basically all i wanted to get out of an editor

13:05 since id still need to get actual practice with the "put stuff in and watch it happen instantly on the repl" sort of editing :p

13:07 Blaine: yeah dude

13:07 you won't need that stuff until later, probably

13:08 doing what I did will get you a good editor at least

13:08 rhall: Hi all, can I jump in with a completely unrelated question ?

13:08 Blaine: rhall: too late, you already did

13:08 rhall: yeah... I know... it's irc after all :)

13:08 but I try

13:08 anyway

13:08 is there a "notnil?"

13:08 literally the opposite of "nil?"

13:09 Blaine: (not nil)?

13:09 rhall: I'm looking for something I can use in filter

13:09 Blaine: :P

13:09 rhall: (filter notnil? (function-that-returns-a-seq-some-items-of-which-are-nil))

13:09 so I want to filter out the nils

13:09 stephyn: pdk, blaine: yeah, I use that set up and it's great. I wish I'd know about screen years ago for irb, ./script/console development in rails.

13:10 bortreb: (comp not nil?)

13:10 pdk: why not (fn [x] (not (nil? x)))

13:10 rhall: yeah... you type faster than me...

13:10 pdk: for the function arg to your filter call

13:10 rhall: that's what I've been using

13:10 but wondered if there was a "sugared" form

13:10 pdk: actually is the screen stuff going to work in gvim on windows

13:10 better yet will i have to do all this crap twice to make it work in both cmdline vim and gvim

13:10 raek: (complement nil?)

13:11 pdk: or do settings and crap carry over between the two

13:11 yeah

13:11 Blaine: (defn not-nil? [x] (not (nil? x)))

13:11 raek: (remove nil? seq)

13:11 pdk: complement nil? would prob return the same function i just wrote

13:11 basically complement just

13:11 takes a 1-argument function

13:11 Blaine: pdk: you're working on a windows box?

13:11 pdk: and returns a function that just returns falce when that function returns true and vice versa

13:11 yeah winxp

13:11 i know thats gonna draw some glares :p

13:11 stephyn: pdk: I wouldn't think so; unless the dos prompt has a version of screen...you might need cygwin.

13:11 rhall: raek: both of those work... thx!!

13:12 pdk: hmm

13:12 raek: pdk: exactly, but complement works for functions of any arity

13:12 pdk: oh yeah

13:12 so in this case

13:12 raek: if and when have if-not and when-not counterparts

13:12 pdk: (complement nil?) would just return something that acted the same as (fn [x] (not (nil? x)))

13:12 raek: and filter has remove

13:13 pdk: yeah

13:13 raek: pdk: correct

13:13 pdk: you could do (remove nil? ...) instead of (filter (complement nil?) ...)

13:13 filter only keeps the items for which the condition function returns true

13:13 remove only keeps the items for which the condition function returns false

13:13 rhall: yeah... forgot about remove

13:14 <----- is total clojure newb but loving it

13:15 stephyn: <-- same here; for some reason, I'm getting more traction with it than trying to learn Haskell :O

13:15 raek: one should never be ashamed of asking questions... :)

13:16 pdk: one thing practical clojure is good about is that it has these references for sets of functions relating to a certain topic all over the place

13:17 so at least once per chapter you run into a list of functions relating to stuff like seqs or whatever, fairly handy

13:17 plus the documentation you tend to get with (doc function) is terse as hell

13:17 very often just 1 unclear sentence

13:18 bortreb: empty? is about as close as I can find for a core function that is sort of "not-nil," but that's the CL in me coming through...

13:19 rhall: raek: I have no fear of showing my ignorance lucklly

13:19 pdk: [13:15] <stephyn> <-- same here; for some reason, I'm getting more traction with it than trying to learn Haskell :O <- maybe cause we don't have the type system :p

13:20 bortreb: is there any snazzy way of doing ajax stuff with clojure --- like bind a div to be updated by a certain function (sort of like perl's CGI::Ajax0?

13:21 stephyn: that's probably part of it. I also think the impurity is handled more gracefully in Clojure but I'm not afraid to say that perhaps Ruby has rotted my brain as far as dynamic typing goes. I can barely Java anymore.

13:21 bortreb: heh, you guys should try coding in bluespec some day :)

13:21 mfex: bortreb: conjure has some ajax functionality

13:21 bortreb: it makes java look like the most dynamic language ever

13:22 pdk: let's go back to the days of no typing scheme!

13:22 everything is pointers

13:22 Chousuke: bortreb: empty? isn't used that often. The recommended idiom is "(if (seq x) ...)"

13:23 bortreb: bluespec is so strongly typed, even the TYPES are typed (I'm not kidding)

13:23 technomancy: hugod: here's an enlive-like for JS: http://github.com/cohitre/baconl

13:23 Chousuke: bortreb: Haskell has that too doesn't it?

13:24 kind of

13:24 I'm still not very proficient with the type wizardry in haskell

13:24 hugod: technomancy: thanks! looks interesting

13:25 bortreb: Chousuke: yeah but bluespec does it in a more literal way since everything utlimately compiles down to transistors

13:25 Chousuke: for more complicated types, I get confused about what are the type constructors and what are its parameters.

13:25 technomancy: hugod: I don't know if it's used for anything or just atoy

13:26 pdk: is it a hardware design language

13:27 stephyn: I'm afraid I'll probably have to learn Haskell some day...but Clojure seems to be a good 2nd choice for now.

13:33 pdk: blaire

13:34 do i stick these plugins files in a subdir of vim's $HOME

13:41 rhall: I'm seeing the need for an "antonym" cross-ref in the docs

13:41 for instance my filter vs remove question earlier

13:41 now I'm looking for the opposite of (keyword x)

13:41 if I want to pull out and print the keyword in a map, and print it without the colon

13:42 pdk: (str :keyword) gives you a string

13:42 then you can do (. (str :keyword) substring 1) to get a string with the : chopped off

13:42 rhall: pdk: cool

13:42 pdk: or (rest (str :keyword)) to get a sequence of chars without the :

13:42 ,(rest (str :for-example))

13:42 clojurebot: (\f \o \r \- \e \x \a \m \p \l \e)

13:42 chouser: rhall, pdk: name

13:42 ,(name :foo)

13:42 clojurebot: "foo"

13:42 pdk: OR THAT

13:43 why ya gotta ruin our fun man

13:43 * chouser beams

13:43 rhall: good stuff

13:44 raek: ,(let [kw :foo/bar] [(namespace kw) (name kw)])

13:44 clojurebot: ["foo" "bar"]

13:44 rhall: I think I have read and re-read, and re-re-read the api page

13:44 is that (iterate (read api)) ?

13:45 pdk: ba dum tschh

13:48 rhall: pdk: two drums and cymbal?

13:48 pdk: indeed

13:52 * Hodapp looks at pdk

13:53 pdk: UMMMMMMM

13:53 you see nothing!

13:53 Hodapp: where ya been?

13:53 pdk: this is like one of those "SO WE MEET AGAIN" moments

13:53 havent been to #zdoom in like 2 or 3 years haha

13:53 kinda got the feeling i wasnt wanted then but i guess it wasnt so bad so might as well pop in again sometime probably

13:53 * Hodapp /msg pdk okay, what's your paypal again? thanks for doing that. now #clojure will think I have some cred.

13:53 Hodapp: er

13:53 whoops

13:53 disregard

13:54 pdk: yeah it's all gravy for #clojure

13:54 Hodapp: I'm still in #zdoom, trolling BBG and saying weird stuff.

13:54 pdk: is bbg still there

13:55 doin the stoner gun nut thang

13:55 Hodapp: yeah

13:55 he's a riot sometimes because he takes himself so seriously

13:56 pdk: the more things change the more things stay the same then

13:56 dude was like

13:56 every other day it was a political argument with him and zark/darknation

13:56 also one choice bit of wisdom i learned from him

13:56 Hodapp: and tries to do his whole "my street smarts trump your formal education every day, which is why I still live with my parents and make minimum wage"

13:56 pdk: chess has a random chance factor!

13:56 Hodapp: that was classic

13:57 pdk: does he just do that when it comes to politics/gun rights issues

13:57 or is he like that with other stuff he has no clue in like comp sci

13:57 Hodapp: when it comes to comp sci

13:57 pdk: i recall him defending the windows .exe .txt etc scheme once

13:57 Hodapp: he finds a way to talk about guns or politics instead

13:57 pdk: and his mac hate

13:57 actually i dont think i heard where he works

13:58 Hodapp: idk, but he barely makes shit and still lives with his parents

13:58 which he tries to spin into superiority over everybody else

13:59 pdk: wasn't he saying he was getting a degree in gunsmithing

13:59 and talking like smith and wesson would snap him right up

13:59 Hodapp: that boy hasn't set foot in a classroom or a lab for like a decade

13:59 stephyn: is there an equivalent of a ruby file's if $0 = __FILE__; // stuff; end for a Clojure script?

13:59 pdk: or at the very least taking some specialized course on making guns

14:00 * stephyn oops...that should be ==

14:00 pdk: maybe just mentioned it on dwforums once

14:00 Hodapp: he mostly just spends all his income on acquiring more guns, ammo, and gun parts

14:00 edbond: why Math/abs doesnt works in .clj file but works in repl? No matching method: abs

14:00 pdk: see if importing java.Math helps

14:01 hm how about the rest of the #zd crew then

14:01 edbond: pdk: added (:import (java.lang Math)), doesn't help

14:01 qbg: edbond: Perhaps you are calling it with the wrong type

14:01 ,(Math/abs 5)

14:01 clojurebot: 5

14:01 pdk: bs always kinda struck me as being kinda serious about it too in #zd when i was there

14:01 qbg: ,(Math/abs [1 2 3])

14:01 clojurebot: java.lang.IllegalArgumentException: No matching method found: abs

14:01 pdk: though i hardly see him talk in #ud

14:01 Hodapp: how old is that guy?

14:02 pdk: i thought he was around 26

14:02 by the by #ud is on quakenet now

14:02 Hodapp: he banned me once for like 2 months because he was being pissy and I said "stfu periodbleeder"

14:03 pdk: yeah it just felt like a lot of the #zd crew was that way at the time

14:03 though you cant blame everyone else 100% either way i guess

14:04 though fraggle was cool

14:04 and he keeps graf in check when he talks about how everyone should be using c++ :p

14:05 Hodapp: screw that language

14:05 edbond: qbg: thanks, you're right.

14:06 pdk: prob not the place to get into it here but some buds tell me stories of two 14 year old versions of graf over on a board i used to visit

14:06 raek: there's no need to import things in java.lang.* since they are imported by default

14:07 edbond: next question: how to get double from '/' not Ratio ?

14:08 raek: ,(double 1/3)

14:08 clojurebot: 0.3333333333333333

14:08 raek: the java.lang.Math library only supports its own type

14:08 ,(class 1/3)

14:08 clojurebot: clojure.lang.Ratio

14:08 pdk: clojure has (int) (float) etc functions for coercing stuff to java primitives

14:08 AWizzArd: ,(class (int 15))

14:08 clojurebot: java.lang.Integer

14:09 raek: the ratios are provided by clojure

14:09 pdk: and (unchecked-add) (unchecked-subtract) etc for doing native java math on them without overflow checking

14:09 AWizzArd it's going to box primitives up automatically when you take them back into clojure to work on them

14:09 but this lets you pass primitive args to java functions etc

14:13 raek: stephyn: there is the gen-class stuff where you can make a main method

14:13 in that case, you can use the generated class as the main class

14:13 stephyn: ah, but it only works with compiled code not interpreted?

14:14 raek: but when making scripts, AOT compilation might not be the most convenient alternative

14:14 yes

14:14 stephyn: thanks.

14:14 raek: when ran as a script, the *command-line-args* var contains the arguments

14:15 I think clojure source files tend to be used as either a library or a script, but not both

14:15 (as far as I know)

14:16 * stephyn yeah, I think that's really the standard anyway. ruby has some interesting, er, features?

14:16 raek: the AOT compiled main methods are the closest counterpart to the python if __name__ == "__main": I can think of

14:17 I can see that it's convenient to be able include testing code that way

14:19 stephyn: well, I'm fooling around with a GA in Clojure right now and every time I reload the file it runs it once. I guess I could go all SICP on it and enclose it in a lambda so the computation is delayed until the lambda is called. :)

14:19 raek: hehe

14:20 I mostly use emacs + slime + swank and reevaluate only the functions I change

14:21 (defonce can be used for code that should only, well, be defined once)

14:21 stephyn: yeah, I use the vim setup with screen...it's nice but every so often I like to make sure that the state in REPL would actually be produced by my code.

14:22 bortreb: stephyn: you can't always rely on *command-line-args* because you might call your script with no args,

14:22 raek: you can always do a (remove-ns 'name.of.namespace)

14:24 bortreb: stephyn: I like : (defn command-line? [] (.isAbsolute (java.io.File. *file*))) because it works for no args too

14:25 stephyn: It's not a big deal...I'm just trying to get a feel for the constraints. I like the fact that I can do AOT compilation. I'm getting ready to start work on my dissertation and ruby just can't cut it for running reinforcement learning algorithms. Additionally, I'd like to take advantage of any concurrency I can get. Funny though...Lisp in general isn't taught in most AI courses anymore...I'm thinking of adding Clojure to mine next summer

14:25 late for this year).

14:25 raek: maybe a (defn reset-ns [ns-sym] (remove-ns ns-sym) (require ns-sym)) is useful to´have...

14:26 (or a :reset option for require)

14:26 bortreb: stephyn: then you can do at the bottom: (if (command-line?) main) or smtg

14:26 also you can totally use your files for libraries and command line scripts with this method

14:28 cemerick: I'm surprised no one here is liveblogging the oscon talk :-)

14:29 _fogus__: ,(use ,(clojure.pods/podify [:a :b])

14:29 clojurebot: EOF while reading

14:29 _fogus__: Hmmmm, I guess pods haven't made it into core yet. :p

14:30 cemerick: I've no idea what they do, but the name is a little goofy. :-)

14:30 _fogus__: ,(clojure.pods/podify [:a :b])

14:30 clojurebot: java.lang.ClassNotFoundException: clojure.pods

14:30 _fogus__: oh well

14:30 bortreb: stephyn: I'm also working on AI -- I'm doing cross-modal clustering. want to compare notes some time?

14:30 _fogus__: Are they not related to cells?

14:30 * stephyn bortreb: it doesn't like that, "java.lang.Exception: Can't take value of a macro: #'clojure.core/defn (ga.clj:1)"

14:31 * stephyn ("that" refers to (defn command-line? [] (.isAbsolute (java.io.File. *file*))))

14:32 bortreb: that's weird... I don't see anything there that would be a macro

14:32 * stephyn yeah, that would be great. I think you're playing in a different part of the landscape than I am though...it's a huge field. I'm thinking of paring down my AI class to just GOFAI.

14:32 stephyn: me either.

14:32 bortreb: ,*file*

14:32 clojurebot: "NO_SOURCE_PATH"

14:33 stephyn: I teach it just in the summer...13 weeks...3 hours a sitting...I think it kills the peeps...if it's 8:15 PM, it must be A* search...oh, there was neural networks...*wave*.

14:33 * dnolen is curious about Pods

14:34 bortreb: stephyn: what does *file* resolve to for you? maybe it got redefined?

14:34 technomancy: dnolen: are you at emerging langs?

14:34 stephyn: some as here, "NO_SOURCE_PATH"

14:34 technomancy: http://p.hagelb.org/pod.jpg

14:34 dnolen: technomancy: no, just following along here and on twitter

14:35 technomancy: nice

14:35 * qbg wants a video of that talk later

14:36 * leifw does too

14:36 dnolen: haha Pod Power!

14:37 leifw: http://healthhabits.files.wordpress.com/2008/12/pod-people-invasion-of-the-bodysnatchers.png

14:37 dnolen: sounds like next level cells

14:37 stephyn: in a sort of related question, if you use java.io.File do you have to import it still or is it like Java where if you use the fully qualified name, you don't need to import?

14:37 qbg: The second

14:38 stephyn: LOL...I do that all the time, except I say "a" or "b".

14:41 hiredman: we demand copies of rhickey's slide deck from the emerging lang con

14:41 * qbg really wants to be there now :(

14:42 scgilardi: a pod here, a pod there, pretty soon you're talking real process

14:43 danlarkin: pods!?!?!

14:43 qbg: rhickey, open the pods

14:43 danlarkin: please open the pod bay doors, HAL

14:44 qbg: <rhickey> I'm sorry qbg, I can't do that

14:47 leifw: http://www.bandswallpapers.com/data/media/16/pod2_1024x768.jpg

14:47 pdk: thank goodness

14:47 props blaire, now this looks like it'll fit the bill

14:47 assuming the plugins work the same in gvim

14:49 oh that's dumb

14:49 using a different gvim color scheme makes all the rainbow parens the same color except for the outermost block

14:56 stephyn: bortreb: ah...it does work...somewhere along the line I deleted the opening paren in one of my function definitions and it was reporting the wrong line number by a large margin of error.

14:57 bortreb: yay!

14:58 wilig: Hey all. Stupid macro question: http://gist.github.com/486410 I desperately want to get rid of e# but I'm unclear on how to accomplish it. Anyone have a moment to enlighten me?

14:59 qbg: ~'errors

14:59 clojurebot: It's greek to me.

14:59 stephyn: is there a way to get a fresh repl without quiting repl?

15:00 bortreb: stephyn: then, if your flavor of linux supports it, you can put something like #!java -cp "whatev" clojure.main at the top and then run it directly

15:00 wilig: qbg: thanks, I knew I was being thick.

15:01 stephyn: bortreb: ah yeah, right.

15:01 cmbntr: is there more on pods online? http://p.hagelb.org/pod.jpg

15:02 dsantiago: Whoa. What the heck is that.

15:03 rhall: really really basic question: if I run a script in clojure.main that contains "(map (fn [x] (println x)) (range 5))" why do I get no output

15:04 leifw: rhall, map is lazy

15:04 you need to force execution

15:04 rhall: damn

15:04 leifw: try (doseq (fn [x] (println x)) (range 5))

15:04 AWizzArd: hmm?

15:05 ,(macroexpand-1 '(doseq (fn [x] (println x)) (range 5)))

15:05 clojurebot: java.lang.IllegalArgumentException: doseq requires a vector for its binding

15:05 qbg: ,(doseq (map println (range 5)))

15:05 clojurebot: java.lang.IllegalArgumentException: doseq requires a vector for its binding

15:05 qbg: ,(dorun (map println (range 5)))

15:05 clojurebot: 0 1 2 3 4

15:05 AWizzArd: Hi kotarak

15:05 leifw: there it is

15:05 kotarak: AWizzArd: mann bist Du schnell...

15:06 AWizzArd: ,(dotimes [i 5] (println i))

15:06 clojurebot: 0 1 2 3 4

15:06 kotarak: ieh

15:06 pdk: ,(doc iterate)

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

15:06 AWizzArd: dotimes may run side effects

15:07 rhall: so any "rule of thumb" on coding such that effects in the repl are the same as scripts?

15:07 or just watch for the "lazy" in the doc strings ?

15:07 kotarak: rhall: watch for no "do" in the name

15:07 AWizzArd: rhall: the rePl includes P for print

15:07 It forces lazy things

15:07 rhall: AWizz: good point

15:08 "do..." in the name also good

15:08 AWizzArd: when you have on toplevel a (map ...) then map evals and immediately returns an object that needs to be accessed

15:08 technomancy: rhall: if you (def _ (map my-fn my-coll)) it will avoid the printy-ness, making it work like "the real world"

15:08 fualo: Is there a prototype in clojure (or actually any lisp) that shows what's going on behind lazy evaulation? i.e. how I could implement laziness without lazy-seq?

15:08 kotarak: So are cells now called pods?

15:08 rhall: technomancy: I'll have to ponder that one

15:09 dnolen: kotarak: sounds like cells, minus the things rhickey didn't like, renamed to Pods

15:09 qbg: fualo: Lazyness is like delay

15:10 cmbntr: POD != pain old datastruct

15:10 technomancy: more or less

15:11 kotarak: fualo: you can for example use a closure. (fn [] (thing to-be done la ter)) and later you do (previously-created-fn).

15:11 cmbntr: are pods already on the github tree? where to start looking for these?

15:12 raek: pods == cells?

15:12 AWizzArd: seems so

15:12 dnolen: cmbntr: no, and cells never got past a gist.

15:13 AWizzArd: dnolen: well, I am using them :-)

15:13 cmbntr: dnolen: so this stuff is way beyond 1.2?

15:14 stephyn: Scheme has (trace). Does Clojure have something similar or is there a nice simple, similar debugger for Java to use with Clojure?

15:15 raek: there is clojure.contrib.trace, but I haven't used it myself

15:16 ,clojure.contrib.trace/dotrace

15:16 clojurebot: java.lang.ClassNotFoundException: clojure.contrib.trace

15:16 dnolen: cmbntr: yup. 1.2 is in beta, all we're going to see is bug fixes there.

15:19 raek: is there a video stream of rhickeys's talk?

15:33 arohner: what's the type hint for an array of Objects?

15:33 qbg: ^objects

15:34 arohner: qbg: thanks

15:38 I'm working on a macro, and I'm trying to optionally insert something. Is there a way to make it show up, or not at all?

15:38 i.e.

15:38 `(foo ~(if expand? stuff nil) [1 2])

15:38 but if expand? is false, a nil gets stuffed into the form, as opposed to nothing

15:39 qbg: `(foo ~@(if expand? [stuff] nil) [1 2])

15:39 arohner: qbg: thanks!

15:39 tomoj: whoa

15:39 I thought that was impossible

15:40 qbg: nice!

16:02 technomancy: raek: video in a few weeks is the hope

16:08 bhenry: what's the best clojure way to copy image files from one location to another?

16:08 Blaine: what's a binding-form?

16:09 that term is all over the docs, and I have a suspicion of what it is, but I feel it should be defined somewhere

16:09 bhenry: blain it's the [a 1] in (let [a 1] a)

16:09 blaine*

16:09 Blaine: suspicion confirmed, thanks

16:09 technomancy: bhenry: I believe clojure.java.io/copy works with java.io.File objects

16:10 bhenry: argh. rtfm i guess

16:11 Blaine: so, when the docs use the term binding-form, it's referring to similar behavior as let?

16:11 i.e. in other functions

16:12 bhenry: yes like in for, if-let etc.

16:13 tomoj: I think the binding-form in (let [a 1] a) is a

16:13 Blaine: so specifically, binding-form is the name/symbol/whatevs

16:14 ?

16:14 e.g. a

16:14 tomoj: or [a b] in (let [[a b] [1 2]])

16:14 mfex: tomoj has it: bindings => a 1, binding-form is a name or de-structuring form

16:16 tomoj: why does if-let have an & oldform param?

16:16 seems like you aren't allowed to pass anything to it

16:18 * Blaine sees a need for a glossary or something

16:18 mfex: Blaine, the whole explanation is at http://clojure.org/special_forms in the (let section

16:21 Blaine: mfex: ah, yes, makes sense now

16:21 regardless, seems very unintuitive

16:21 and that term is littered everywhere

16:22 like, the syntax used to describe it: (binding => binding-form init-expr) -- just looks confusing at first glance

16:22 I dunno, just my 0.02USD

16:23 I wouldn't have known to search for special_forms, and then to look for the let function, and then realize that the definition for a binding-form would be there

16:23 hence my desire for a glossary

16:24 hiredman: my guess is oldform is left backwards compat stuff, from before the Great Binding Form Consistency Check

16:24 tomoj: but it's not backwards compatible if it throws an exception when you pass anything at all to oldform, is it?

16:24 hiredman: e.g. if-let may have used to not have a binding vector

16:24 tomoj: left over and now vestigial

16:24 leifw: I believe that's known as "backwards loudpatible"

16:25 hiredman: all compatibility with stuff before the binding forms clean up is broken/gone now

16:25 tomoj: oh, hmm

16:25 now you will get an error that says "requires a binding vector" or whatever instead of "wrong number of parameters"

16:26 so I guess it isn't totally vestigial

16:32 mfex: Blaine, that is a bit of a knowledge bootstrapping issue. The special forms page is part of the reference on clojure.org. The "programming clojure" book has an entry for bindings in the index

16:33 Blaine: sweet

16:33 I think I'll go through the book then

16:34 * Blaine still wants a glossary

16:34 Blaine: :)

16:35 tomoj: start keeping a list of terms that confuse you, maybe?

16:35 hiredman: binding forms like that are common among functional languages, just bracketing is different

16:35 defn: Yeah I was just going to say write your own

16:36 hiredman: special forms are a lisp concept, they are the forms that the compiler supports directly

16:36 tomoj: might be harder for someone who's been with clojure for a while to make a glossary

16:36 or at least to pick the words

16:37 defn: to talk about at a dinner party maybe, but in general writing it down helps solidify the concept

16:37 improve as you go

16:40 Blaine: a'ight

16:47 dpritchett: If I'm running a .clj file in one pane and slime in another in emacs is there a way to pass "eval the current line" to slime from the other pane?

16:48 technomancy: dpritchett: C-x C-e evals the form before the point

16:49 C-M-x does the whole top-level dep

16:49 *def

16:50 dpritchett: when i try C-M-x i see something in the status bar at the bottom suggesting that my code was evaluated but i'd like to see the results executed in the repl. am i doing it wrong?

16:50 technomancy: dpritchett: C-x C-e will put it in the minibuffer; don't know if there's a way to put it in the repl.

16:51 dpritchett: let's say I have (ns my-namespace) as the first line in a file thanks to leiningen. i would love to be able to go to the frist line and then push a chord to have my repl suck that down, execute it, and have its namespace switched from user to my-namespace

16:51 technomancy: dpritchett: C-c M-p for that

16:51 once it's compiled

16:51 bhenry: so if i do (def f (file "path/to/file")) how do i save the file or make something actually write to disk? i don't do much io stuff...

16:52 qbg: ,(doc spit)

16:52 clojurebot: "([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."

16:52 dpritchett: thanks phil

16:53 bhenry: i'm having trouble using copy since it needs a File/OutputStream/Writer for the output.

16:54 i've got a collection of file objects that i want to copy into a tmp dir

17:01 tomoj: dpritchett: https://gist.github.com/013b2bd0c2b80c7c3836

17:02 raek: bhenry: do you need the contents of the file, or do you just want the OS to copy them?

17:02 bhenry: just copy

17:03 raek: ^

17:03 dpritchett: Thanks tomoj! Now I need to bind a key to that

17:04 tomoj: I have (define-key lisp-mode-shared-map (kbd "C-c r") 'eval-print-repl)

17:05 that the method for do-copy [File File] uses input and output streams seems strange

17:06 dpritchett: That works perfectly, thanks tomoj

17:07 tomoj: oh I guess you need some external dep to get a sane copy

17:08 raek: bhenry: all I find is this http://openjdk.java.net/projects/nio/javadoc/java/nio/file/Path.html#copyTo%28java.nio.file.Path,java.nio.file.CopyOption...%29

17:08 but that is in java 1.7

17:08 the upper right corner says "DRAFT-b102"

17:09 if you use the clojure.java.io/copy solution, all the data will pass though your application

17:10 bhenry: hmm.

17:10 raek: you could use java.io.shell/sh to run the "cp" command on unicies

17:10 bhenry: i may go that route.

17:11 raek: all java examples I can find copy through Input- and OutputStreams

17:12 tomoj: commons-io has something

17:12 but :/

17:12 raek: this? http://commons.apache.org/io/api-1.4/org/apache/commons/io/FileUtils.html#copyFile%28java.io.File,%20java.io.File%29

17:12 it's really weird that this stuff is not in Java

17:13 I mean, one of the selling points of Java is that it's supposed to be platform independent

17:14 tomoj: which is probably why this stuff is not in java..

17:14 dnolen: dpritchett: emacs does that, C-c M-p

17:14 oops, irc window was scrolled up

17:14 dpritchett: thanks

17:15 raek: tomoj: exactly. apache seems to be one of the actors that has been "filling the gaps" in Java... :)

17:16 s450r1: raek: yeah, I thought it was weird there wasn't any "copyFile" in Java too... I went the apache commons io route, which worked fine.

17:21 raek: hrm, I should continue with my pipes-and-filters/sources-and-sinks/functional-io/blocking-lazy-sequences/streams lib

17:21 ...as always, the naming is the hardest part

17:22 sthuebner: I've got a questions regarding closures: In Common Lisp I could do something like (let ((a 1)) (setq a 2) a).

17:23 How can I do a similar thing in Clojure?

17:23 raek: the frustration that motivated this lib is the lack of a general "put item" and "take item" interface for bytes/lines/deserialized objects from/to (In|Out)putStreams/Queues/etc

17:23 technomancy: sthuebner: locals are immutable in clojure

17:24 sthuebner: you can close over an atom if you must

17:24 raek: sthuebner: mutation is handled more explicitly in clojure. there are multiple strategies

17:24 one could be to use an atom:

17:24 (def a (atom nil))

17:24 (reset! a 2)

17:24 sthuebner: I'd like to define two functions, that act on the same variable - a socket-server object

17:25 on starts the server and stores the server object in the var, the other one stops it

17:26 raek: to stop it, the variable does not have to change, right?

17:26 sthuebner: I didn't want to expose that server as a global *server*

17:26 raek: no

17:26 raek: there is defvar- in clojure.contrib.def for these situations

17:26 the hyphen means "private"

17:27 sthuebner: raek: OK

17:27 raek: (a clojure convention is to only name globals with *earmuffs* when they are public variables meant to be reboundable)

17:27 (sthuebner: you might be interested in this too http://clojure.github.com/clojure-contrib/server-socket-api.html)

17:28 for some application I have made myself, where I only have one server that is active during the whole program execution, I put it straight in a var

17:28 (def server (...create-server...))

17:29 or (defvar- server (...

17:29 sthuebner: raek: I use that server-socket. quiet handy!

17:29 quite, I meant

17:30 raek: you can mutate global variables with def

17:30 but

17:30 that is most oftenly only use to redefine a broken function with a working one

17:31 or other kinds of changes that would not happen in the final system

17:31 sthuebner: raek: thanks for all the hints

17:31 I think I can stick with the (def server (create-server...)) for now

17:32 raek: that is what you see in most hello world servers, anyway

17:34 tomoj: careful

17:35 sthuebner: raek: It's simple enough.

17:35 tomoj: might need defonce depending on how you work

17:36 sthuebner: tomoj: good point

17:37 tomoj: I wish assert-args weren't private

17:41 bhenry: when using clojure.java.shell/sh what directory is the command run from? the dir of the file holding the sh form? or the project dir?

17:42 defn: the project root im guessing

17:42 clojurebot: what time is it?

17:42 defn: clojurebot: you're annoying

17:42 clojurebot: No entiendo

17:44 raek: probably from the dir the jvm was started from

17:45 technomancy: bhenry: the JVM doesn't have a useful notion of a working directory. it's just wherever you happen to launch from.

17:45 raek: I think I heard somewhere that the working directory of the jvm cannot be changed

17:58 rhudson: bhenry: there's a :dir option to sh that lets you set its cwd

18:06 bhenry: rhudson i just read that. thanks.

18:07 neotyk: ping tomoj

18:07 tomoj: hello

18:08 neotyk: updated ahc-clj, take a look if you like it better: http://github.com/neotyk/ahc-clj/tree/issue-1

18:11 raek: what would you feel about programming network clients and servers this way: http://gist.github.com/486687 ?

18:12 se.raek.pipes is a library for making it easier to code the largest part of a network based program in a functional manner

18:13 tomoj: neotyk: looks cool

18:13 I feel a bit weird calling string on the response instead of the body

18:13 but it's fine

18:15 neotyk: I've seen it in http.agent, but felt the same

18:16 it could handle both

18:18 tomoj: I think it's fine this way

18:19 looks like you were right originally about baos vs. bais

18:20 neotyk: I always have to check which one is which ;-)

18:20 it get's even worse with ByteBuffers

18:21 raek: flip! :)

18:22 neotyk: raek: exactly

18:23 simplicity was not a requirement for java.nio

18:23 kwertii: s/java.nio/java/g

18:23 sexpbot: kwertii: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try $help sed

18:24 neotyk: sexpbot: you should support global replacements ;-)

18:24 raek: imagine that, plus that you have to return from the method every now and then when the out buffer gets full or in buffer gets empty

18:25 and that you have to remember which state you were in when you returned, in order for you to continue from there

18:25 and, doing all this in java

18:26 welcome to the world of implementing CharsetDecoder!

18:26 http://github.com/raek/utf8-with-fallback/blob/master/src/se/raek/charset/Utf8WithFallbackCharsetDecoder.java

18:28 neotyk: it is good that most of time one can totally avoid those corners

18:42 bhenry: raek, technomancy and anyone else who was helping me with the file copy. this is what i came up with. http://gist.github.com/486723

18:44 lozh: technomancy: running lein swank, I get two processes, one has args -e (use 'leningen.core) (-main "swank") the other has something a lot bigger starting with a classpath. Would you expect the first one to hang around?

18:44 raek: bhenry: clojure.java.io can do the File(Reader|Writer) step too

18:45 tomoj: if there's a way to get it to not hang around, that would be awesome

18:45 raek: ,(doc input-stream)

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

18:45 raek: ,(doc clojure.java.io/input-stream)

18:45 clojurebot: "([x & opts]); Attempts to coerce its argument into an open java.io.InputStream. Default implementations always return a java.io.BufferedInputStream. Default implementations are defined for OutputStream, File, URI, URL, Socket, byte array, and String arguments. If the argument is a String, it tries to resolve it first as a URI, then as a local file name. URIs with a 'file' protocol are converted to local file names. Should

18:46 rhudson: bhenry, take a look at clojure.core/with-open

18:46 technomancy: lozh: that's how it works right now; could be changed in the future.

18:47 raek: you can do it with (copy (input-stream str-in) (output-stream str-out))

18:48 the strings gets turned into Files or URLs, then into Input/OutputStreams

18:48 lozh: thanks

18:49 technomancy: lozh: well, it may be possible. ant is pretty lousy at being unixy, so who knows if exec is even on the table.

18:49 raek: if you want to force the string to be interpreted as a file and not as an URL, you can do it like this: (copy (input-stream (file str-in)) (output-stream (file str-out)))

18:51 lozh: I just wondered if it was another windows gremlin, I'm not worried if that's how you're expecting it to work

18:52 bhenry: raek. that looks good.

18:55 technomancy: there's lots of windows gremlins, but that's not one of them.

18:55 raek: the point of clojure.java.io is to be able to avoid the "PrintWriter pw = new PrintWriter(new BufferedWriter(new InputStreamReader(new FileInputStream(filename))));" pattern of java

18:56 modulo the PrintWriter part, the clojure way is (writer filename)

18:57 (also: replace the input/reader parts of my previous utterance with corresponding output/writer)

19:39 lozh: if I've got an int[] can I convice aget to give me an int rather than an Integer?

19:48 chouser: lozh: aget does return a primitive int

19:49 ,(use '[clojure.contrib.repl-utils :only [expression-info]])

19:49 clojurebot: java.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath:

19:49 chouser: oh. well, do that and then: (expression-info (aget (int-array [1 2 3]) 0))

19:51 raek: {:class java.lang.Integer, :primitive? false}

19:54 chouser: what!?

19:55 here I get: {:class long, :primitive? true}

19:56 leifw: different versions of clojure maybe? what are you each running?

20:06 lozh: chouser: thanks for that, very useful tool to know about :)

20:20 fanatico: Has Rich posted the slides from his emerginglangs talk today?

20:28 aria_42: If anyone is interested, I've written a Dropbox client library, clj-dropbox, for interacting with the "Dropbox FS". Its at http://github.com/aria42/clj-dropbox

20:31 auser: nice aria42

20:40 aria_42: asuer: thanks! let me know if you get anything out of it.

20:53 hiredman: aria_42: you use a for inside your with-user macro at the bottom of the examples, for is lazy, so I don't think that will work out well

21:06 cais2002: morning guys

21:07 aria_42: hiredman: thanks. fixed.

21:09 cemerick: jkmkjhgftydrftgyikol,kofr65dftgyjuikl,uiku87178i9w34e4bh nmnbvcxsaqiky621t6yuijuhyte4w32qwkmlu5r4jn m,hy7t65rkmjihytrdcfv nhy5431SWE4R5BJN MMN545JMN ,,M8L,.

21:09 aria_42: hiredman: that's what I get for not copying from my test code

21:13 cemerick: mmm, sorry

21:13 * cemerick promises never to clean the keyboard while connected to irc :-)

21:21 mmarczyk: RFC on my letrec macro: http://gist.github.com/486880

21:21 :-)

21:22 I'm not even sure if it works... but the ev? / od? example does

21:42 chouser: mmarczyk: ooh, a code walker. did you know about letfn?

21:42 mmarczyk: yup

21:43 a better example might be (letrec [xs (lazy-seq (filter even? ys)) ys (range 10)] xs)

21:44 I was hoping to do some mutual recursion of sequences, which turns out to be a bit of a challenge for various reasons... not having a letrec appeared to be one of them

21:47 tomoj: I don't get it

21:47 mmarczyk: (letrec [x (delay y) y :foo] @x) :-)

21:47 ,(let [x (delay y) y :foo] @x)

21:47 clojurebot: java.lang.Exception: Unable to resolve symbol: y in this context

21:47 tomoj: what would that do differently than (let [ys (range 10)] (filter even? ys)) ?

21:48 mmarczyk: tomoj: well, not much, except slow things down a tiny bit

21:48 tomoj: but I was hoping to build mutually recursive things like, say, tying the knot in Haskell etc.

21:48 Lajla: ,(let [Who + Worships 1 His 2 Shadow? 3] (Who Worships His Shadow?))

21:48 clojurebot: 6

21:49 tomoj: oh, I see the difference

21:49 didn't notice that the reference to ys was before the ys binding

21:49 mmarczyk: right

21:58 slyrus: the other day (yesterday?) I was asking about test vs src/test

21:58 let me try to rephrase that...

21:59 i have a project.clj with a src directory. I run lein swank. <some magic happens>. how does leiningen know which files to load? and does it load the test directory too?

22:00 tomoj: I don't believe it loads anything

22:00 slyrus: what's clojurish for (cl:list-all-packages)?

22:01 ah, all-ns

22:02 aria_42: lein sets the classpath of the swank server to src/ resources/ and lib/*jar by default

22:02 slyrus: ok, I see...

22:02 mmarczyk: slyrus: see also c.c.find-namespaces

22:02 * slyrus keeps hoping that if he ignores CLASSPATH long enough it will go away

22:02 aria_42: I thought it also did test/

22:03 mmarczyk: test/ is included too

22:03 tomoj: ,(System/getProperty "java.class.path")

22:03 clojurebot: java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)

22:03 tomoj: well,

22:04 mmarczyk: slyrus: it'll go and hide under your bad, then keeping making weird noises as you try to sleep

22:04 s/bad/bed/

22:04 sexpbot: slyrus: it'll go and hide under your bed, then keeping making weird noises as you try to sleep

22:04 slyrus: yes, like loading my jar instead of my source files... argh...

22:04 can I just have my fasls back please? :)

22:05 I was hoping that lein would be smart enough to see that I have what I want in checkouts and not put the jar on the classpath.

22:05 tomoj: it puts the source stuff first

22:05 so it shouldn't matter

22:06 slyrus: I thought it did too, but not here.

22:06 mmarczyk: apparently this: http://stackoverflow.com/questions/2761253/graph-representation-in-dr-scheme can be translated to Clojure with my funky letrec :-)

22:06 well, this makes me a happy panda

22:06 tomoj: slyrus: 1.2.0?

22:06 slyrus: "...:/Users/sly/projects/chemiclj/lib/shortcut-0.0.0.jar:/Users/sly/projects/chemiclj/lib/dev/swank-clojure-1.3.0-20100502.112537-1.jar:/Users/sly/projects/chemiclj/checkouts/shortcut/src:/Users/sly/projects/chemiclj/checkouts/shortcut/classes"

22:06 mmarczyk: chemiclj sounds interesting :-)

22:06 slyrus: hmm... well, maybe not.

22:07 tomoj: http://github.com/technomancy/leiningen/commit/d6c50fbc28920f4ea51b04b55ca2826f2d08b8c7

22:07 slyrus: thanks mmarczyk

22:07 yeah, thanks tomoj

22:08 mmarczyk: it's just getting started, but I'm thinking of rewriting my (also somewhat nascent) chemicl in clojure. chemicl is here: http://git.cyrusharmon.org/cgi-bin/gitweb.cgi?p=chemicl.git;a=summary

22:08 chemiclj is why i needed shortcut (my undirected graphs package) for representing molecules.

22:09 mmarczyk: oh, this is cool

22:10 slyrus: chemiclj?

22:10 i mean chemicl

22:10 mmarczyk: yup

22:10 :-)

22:10 slyrus: thanks!

22:10 lancepantz: slyrus: you should also check out http://github.com/ninjudd/jiraph

22:10 slyrus: hopefully it will be cooler when it's chemiclj

22:11 although I'm not looking forward to rewriting the smiles parser...

22:11 and I should move the rest of my code to github :)

22:11 heh. I thought about giraff for the graphics package name.

22:12 sounds like i should talk to ninjudd

22:12 mmarczyk: :-)

22:13 slyrus: s/should talk/should have talked/

22:13 sexpbot: sounds like i should have talked to ninjudd

22:13 mmarczyk: incidentally, I could definitely use a Clojure graph library...

22:14 slyrus: great, now you have 3!

22:16 mmarczyk: hm? really?

22:17 I only know of c.c.graph

22:17 but it doesn't do what I need

22:17 slyrus: shortcut and jiraph being the other two

22:17 mmarczyk: shortcut? interesting

22:17 jiraph advertises itself as a graph db

22:17 slyrus: mmarczyk: http://github.com/slyrus/shortcut

22:18 mmarczyk: I want a library of algorithms for use with some representation of graph algorithms convenient to use in Clojure code

22:18 cool, thanks

22:18 slyrus: and i want somebody who knows clojure, as opposed to common lisp, to review my code for me and tell me what common-lisp-isms i need to get over :)

22:19 mmarczyk: sounds great :-)

22:19 lancepantz: the other option is neo4j, i benchmarked the two and jiraph was an order of magnitude faster

22:19 that being said, we didn't implement the full blueprint property graph that neo4j is

22:20 mmarczyk: slyrus: I mean, I'll definitely read it, so I'll share my impressions ;-)

22:20 slyrus: cool, thanks!

22:20 lancepantz: we store edges on the nodes themselves, instead of in a separate hash, so each walk essentially has half as many seeks

22:20 i say we, ninjudd did the heavy lifting on jiraph

22:21 mmarczyk: slyrus: then if sth that I need is missing, I'll definitely try to work towards becoming competent to contribute :-)

22:21 lancepantz: interesting!, thanks

22:23 slyrus: lancepantz: why do you say it has half as many seeks? you still have to look up the edges, right?

22:23 lancepantz: nope, they are stored in a protocol buffer on the node, so they are already loaded

22:24 slyrus: umm... assuming the node is loaded. I guess I'm not sure what you mean by loaded though.

22:24 lancepantz: actually, less than half as many seeks

22:24 in memory

22:24 there is 1 seek per node instead of 1 seek per edge and node

22:26 slyrus: oh, right, but then your nodes have to know about edges. I wanted to be able to use things like 1 and "node1" and #:chemiclj.core.atom{... as nodes.

22:27 tomoj: lancepantz: I still don't understand jiraph. do you think it might be helpful for neural networks?

22:27 didn't really seem like it when I looked last

22:29 aria_42: People still use neural nets?

22:29 lancepantz: tomoj: not really, i haven't done neural nets before, but most ai stuff usually works better with matrices

22:30 tomoj: just think of it as a database with arbitrary relationships between rows, and no tables

22:31 we use it represent family trees, another use would be social graphs

22:41 slyrus: mmarczyk: so you have three choices :) c.c.graph in which there is _no_ representation of graphs or edges, but you need to provide a function that takes a node and returns its neighbors, shortcut which has no explicit representation of nodes, but provides a representation of edges and things that contains nodes and edges and jiraph which is something like an old-school network database, IIUC

22:41 with a corresponding (heavyweight?) representation of nodes and edges

22:42 mmarczyk: slyrus: these choices might leave me wondering to which project to contribute the code I'll have to write ;-)

22:42 slyrus: though from an initial glance, shortcut might save me some pain

22:45 it's far too late -- actually too early -- here for me to look into this just now, but I'll definitely try to squeeze every last drop of that "potion of don't-make-me-do-this-myself +3" from your lib ;-)

22:47 slyrus: cool. hopefully someone who understands defprotocol/deftype/clojure-in-general than I do will weigh in with some suggestions.

22:47 mmarczyk: slyrus: btw

22:48 slyrus: I see you're using (first queue) / (subvec queue 1) where queue is a vector

22:48 slyrus: a clojure.lang.PersistentQueue would probably be better

22:48 slyrus: why?

22:48 clojurebot: http://clojure.org/rationale

22:48 mmarczyk: clojurebot :-)

22:49 ,(peek (conj clojure.lang.PersistentQueue 1 2 3))

22:49 clojurebot: java.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IPersistentCollection

22:49 mmarczyk: ,(peek (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))

22:49 clojurebot: 1

22:49 mmarczyk: ,(peek (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)))

22:49 clojurebot: 2

22:50 mmarczyk: ,(peek (conj (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)) 4))

22:50 clojurebot: 2

22:50 mmarczyk: conj at end, peek / pop at front

22:50 also, subvec prevents the vector you're calling it on from being GC'd

22:51 slyrus: ok, i'll take a look. thanks!

22:51 it would be nice if there were cleaner clojure syntax for queue support though

22:52 mmarczyk: it's both nicer as a queue because of how all the sequence functions "do the right queue-y thing" with it *and* more efficient

22:54 (defn queue ([] clojure.lang.PersistentQueue/EMPTY) ([xs] (into (queue) xs))) ? :-)

22:54 or maybe [& xs]

22:56 slyrus: some reader support for clojure.lang.PersistentQueue/EMPTY would be nice :)

22:57 #[] or some such

22:57 hiredman: QUEUE FISH

22:57 http://clojure-log.n01se.net/date/2010-05-14.html#01:34g

22:58 slyrus: mmarczyk: I don't understand why you evaluate everything into variables in your letrec macro

22:59 why not put btes inline instead of in the let?

23:00 and bssl and bexs might better with a destrcutred let of (apply map list (partition 2 binding))

23:01 I take it from this that letfn acts more like flet than labels?

23:06 mmarczyk: queue fish! cool :-)

23:06 slyrus: hmm, let me think a moment

23:07 slyrus: what is queue fish?

23:08 mmarczyk: ,(conj clojure.lang.PersistentQueue/EMPTY :<=<=<=)

23:08 clojurebot: #<PersistentQueue clojure.lang.PersistentQueue@82f7129c>

23:08 mmarczyk: awwww, doesn't work anymore

23:08 see the link above

23:09 slyrus: what do you mean by "inline" (btes)?

23:09 slyrus: I mean delete btes from the let and replace the use of it below with the form that you were using for the value of btes

23:10 there's no point in having a variable you use once like that is there? I mean there _can_ be a point (readability) but I don't think it applies here :)

23:10 mmarczyk: as for letfn vs. flet / labels, I'm not a CLer, so wouldn't want to say; it's similar enough to a restricted letrec where all binding expressions evaluate to functions

23:11 slyrus: ah, ok then, got it now :-)

23:11 it's written this way because that's how I wrote it ;-)

23:12 I knew what I wanted btes to look like when I got to that point, then I've written down the `(let [~arrs ~arrv] ... thing, then I've written down the map... no other reason really

23:13 but if there might be a slight readability edge to this approach, why would I obfuscate it now ;-)

23:17 slyrus: actually, if I understand the hyperspec correctly, letfn is quite similar to labels, but I wanted Scheme's letrec

23:23 tomoj: isn't there some problem that makes letrec impossible (or just really hard?) in clojure?

23:24 * slyrus doesn't get the difference between let and letrec

23:24 mmarczyk: tomoj: I don't know -- and I sincerely hope mine isn't broken ;-)

23:25 slyrus: in Scheme, let-bound names are not in scope of the value expressions of the binding forms of their let form

23:25 slyrus: with letrec, they are

23:26 (let ((od? (lambda (n) (if (zero? n) #t (ev? (sub1 n))))) (ev? (lambda (n) (if (zero? n) #f (od? (sub1 n)))))) (od? 10)) won't work -- or if it will, it'll be because of ev? and od? being bound in the enclosing scope

23:26 with letrec, it'll work as intended

23:27 there is a requirement that it be possible to evaluate all the value expressions without using the other values

23:27 slyrus: right, so letrec ~= cl:labels, right?

23:28 mmarczyk: sort of, but I thought CL's labels only allows you to define local functions

23:28 lancepantz: is there any difference between (declare foo) and (def foo nil)?

23:28 mmarczyk: whereas in Scheme you can do, say, (letrec ((x (delay y)) y 10) (force x))

23:29 slyrus: sure, but x is still local, right?

23:29 tomoj: lancepantz: try it

23:29 mmarczyk: lancepantz: declare apparently adds {:declare true} to the Var's metadata

23:29 tomoj: (declare foo) then foo

23:29 then (def foo nil) then foo

23:29 lancepantz: fair enough tomoj :)

23:29 tomoj: error, then nil

23:30 mmarczyk: ah, right... (declare foo) is more like (def foo)

23:30 but with the extra piece of metadata attached -- I wonder what's it for

23:30 slyrus: right

23:30 tomoj: I don't see that metadata

23:31 user> (do (declare baz) (meta #'baz))

23:31 {:ns #<Namespace user>, :name baz}

23:31

23:31 mmarczyk: hm, funny

23:31 tomoj: did I do it wrong?

23:31 mmarczyk: no, not that I can see

23:32 lancepantz: as far as evaluation they both seem to behave the same

23:32 mmarczyk: tomoj: aha! (declare ^String foo)

23:32 tomoj: (def foo) and (declare foo) ?

23:32 lancepantz: i dont get an exception on either

23:32 tomoj: huh?

23:32 lancepantz: (def foo nil) and (declare foo)

23:32 tomoj: try (declare baz), then baz

23:32 mmarczyk: I wonder if vary-meta should act differently when there's no metadata already present

23:33 tomoj: I see, :declared true now, weird

23:33 lancepantz: tomoj: correct, you're right

23:33 tomoj: hmm

23:33 is that a bug?

23:34 mmarczyk: slyrus: Haskell's let is like Scheme's letrec, by the way... coupled with lazy evaluation, this enables some interesting code, which is what I'm trying to recreate in Clojure

23:34 tomoj: dunno, but if it is, it's in vary-meta

23:35 I think.

23:36 aaaaaaa.

23:36 no it isn't in vary-meta

23:38 tomoj: swank.core/break inside a macro is weeeird

23:38 mmarczyk: what is it?

23:38 slyrus: mmarczyk: what am I missing: (letfn [(ev? [n] (if (zero? n) true (od? (dec n)))) (od? [n] (if (zero? n) false (ev? (dec n))))] (ev? 10))

23:38 why do you need your letrec?

23:38 mmarczyk: tomoj: see (def ^{:declared true} baz), then (meta #'baz)

23:39 slyrus: I don't for this

23:39 slyrus: have a look at the other two examples in the Gist

23:39 slyrus: ok, the second one: (let [ys (range 10) xs (lazy-seq (filter even? ys))] xs)

23:39 tomoj: mmarczyk: why does that happen?

23:39 mmarczyk: tomoj: beats me

23:40 slyrus: ah, I see. for third one your hosed.

23:40 mmarczyk: tomoj: I'm considering a trip to clojure/lang/Compiler.java to find out, but it is 5.40 am ... :-)

23:40 tomoj: haha

23:41 mmarczyk: slyrus: right! :-)

23:41 tomoj: similarly (def ^{:file "foo"} baz)

23:42 mmarczyk: slyrus: the ultimate goal would be to tie the knot in Clojure :-)

23:42 tomoj: includesExplicitMetadata is involved in the conspiracy

23:42 mmarczyk: tomoj: hah! sniffing around then? :-)

23:42 slyrus: mmarczyk: so your macro basically generates this: (letfn [(NY [] (list "NY" (delay [(London) (Paris)]))) (Paris [] (list "Paris" (delay [(NY)]))) (London [] (list "London" (delay [(NY)])))] (ffirst @(first (nfirst @(second (NY))))))

23:42 tomoj: but I'm giving up now because I don't really care anyway

23:46 mmarczyk: slyrus: hrmpf :-P

23:48 slyrus: I'm not sure I can produce an example which couldn't be rewritten with letfn with "scalars" and seqs hidden behind functions-producers

23:49 slyrus: are you convinced it'll always be possible?

23:51 slyrus: I'm under the impression that "tying the knot" relies on a "full" letrec being available, but I won't say I'm sure...

23:51 (here's the link to what I'm talking about, btw: http://www.haskell.org/haskellwiki/Tying_the_Knot)

23:54 aria_42: Sure, this has been asked to death, but any slides for rhickey's pod-talk?

23:54 mmarczyk: tomoj: DECLARED_KEY is interned in RT.java and used in that one function in Compiler.java... otherwise it isn't used anywhere

23:54 tomoj: :declared only appears in clojure.core/declare

23:55 tomoj: apparently Clojure doesn't care about this lone piece of metadata at all...

23:58 tomoj: odd

Logging service provided by n01se.net