#clojure logs

2010-07-22

00:00tomojbtw, does choas's version have some good stuff I need? I'm just using stu's
00:00defnhe just updated it for 1.2.0
00:00defntomoj: your way worked
00:00defnthanks for that
00:01tomojah
00:01tomojgroupId/artifactId are not necessarily related to the namespaces defined
00:01mmarczykseancron: 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
00:02defntomoj: yeah that's always been sort of finicky
00:02seancron(def data (dataset ["time" "up?"] [[]])) does the same thing
00:02mmarczykseancron: right. see above
00:02defnim trying to teach my friend clojure right now and getting him "set up" seems to be a pretty big feat
00:03defnhe has to learn: git, slime, paredit, and clojure of course
00:03mmarczykseancron: you could always construct
00:03mmarczykseancron: an incanter.core.Dataset yourself...
00:03defni 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
00:03mmarczykseancron: (incanter.core.Dataset. ["time" "up?"] {})
00:03defni know there are other methods but he happens to know emacs so...
00:04tomojwhy git?
00:04tomojI mean, if you want to contribute to any projects, sure
00:05defnwell we're working on a project together
00:05defnhe just finished his undergrad CS degree and im trying to get him up to speed with "real life" development
00:05defn:)
00:05tomojhehe
00:05defnso we're doing clojure + hadoop + twitter nozzle + opennlp + git + jfugue
00:05defnwith some machine learning for fun
00:06jacortinassounds cool
00:07tomojwhat the hell does jfugue have to do with the rest of that?
00:07defnyeah the basic idea is we're going to generate music based on tweets by using NLP
00:07defn:)
00:07tomojhaha
00:07tomojplease share if successful
00:07jacortinaswhy the hadoop?
00:07defnwe're going to store results
00:08defnand then tag them for quality
00:08mmarczykawesome :-)
00:08jacortinasahh I see, so you need to map reduce over them after storage
00:08jacortinasshould be a ton of data
00:08defnyeah it's insane -- i was just playing with "nozzle" earlier and I had a callback that was (println tweet)
00:08defnso im staring at my repl thinking: hm that's weird, the stream is open where are the tweets?
00:09defni go to my terminal about 40 minutes later and see tweets screaming by lol
00:09defni think at first we're just going to start with a single day of tweets and see what happens
00:09BahmanHi all!
00:10defnsome fun ideas are we're going to use syntax like , ; : and ' to modify duration of words/notes
00:10defnand also do some intelligent part writing techniques to try and find common chord progressions based on groupings of characters
00:10defnso "The" becomes "ACE" an a major triad
00:11defnand so on from there
00:11defnthere 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
00:11defnbut anyway -- we'll see if it ever gets finished! :)
00:12jacortinassounds cool
00:14defntotally useless, but a fun chance at a code art project
00:18rjevansdefn: you can check the last modified date if you go to: http://clojars.org/repo/
00:18rjevansbut I also wish it was on the actual pages for a jar
00:19defnrjevans: oh right, good thinking
00:20defnrjevans: clojars needs some work -- i should really fork and try to improve it
00:20defnsearching needs improvement, as does the ability for a maintainer to take "ownership" of a repository, or to make their repo the "official" version
00:20defnmaybe parse the pom and discover which version of clojure.core it was built for
00:22rjevansimproved searching and more info on the actual pages for a jar would be a great step
00:24seancronmmarczyk: hmm, I'm getting ClassNotFoundExceptions when I try to use (incanter.core.Dataset. ["time" "up?"] {}) How do I include the Dataset class?
00:30taliosjacortinas: clojars is maven based already. it's a maven repo.
00:30jacortinasyeah I know that
00:30talioseven ivy uses maven
00:31qbg,(some not [true true false true])
00:31taliosand we use it cause no one else has anything better
00:31clojurebottrue
00:31jacortinasWould you guys want to organize something better?
00:31defn`ryan`: how about "some"
00:31jacortinaswhatever your opinion is on Ruby, the Rubygems system is amazing
00:32defn,(some #(= true %) [false false false true])
00:32clojurebottrue
00:32defn,(some #(= false %) [true true true])
00:32clojurebotnil
00:33`ryan`oh yeah that's perfect, thanks
00:33defnyou could also use (every?) or (not-every?)
00:33defnin the same fashion
00:33taliosjacortinas: probably not, mostly as I want something that's polyglot across clojure, scala, java etc. etc. JVM centric.
00:33defn(not-any?) would work also
00:33defnfwiw
00:33jacortinashmmm
00:34jacortinastalios: that's a good point
00:34taliosgems is nice, but doesn't differentiate between build-time or run-time. which may or may not be a good thing.
00:34maravillas,(some identity [false false true])
00:34clojurebottrue
00:36`ryan`oh thanks maravillas, I was wrapping identity in a #() because I don't know what I'm doing
00:37`ryan`just got in the habit
00:38jacortinas,(doc identity)
00:38clojurebot"([x]); Returns its argument."
00:38maravillasno prob
00:38jacortinas,(doc some)
00:38clojurebot"([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)"
00:39maravillasoh yeah, that's maybe a little bit more readable... #{true} instead
00:40jacortinas,(some #{true} [false false true])
00:40clojurebottrue
00:40tomojjacortinas: why wouldn't we use somethin maven based?
00:41jacortinas,(some #{true} [false false false])
00:41clojurebotnil
00:41jacortinastomoj: for the eventual move away from being completely jvm dependent
00:41tomojoh, yes
00:41tomojfuck that :P
00:42jacortinastomoj: haha, I'm coming to clojure for a love of lisp, but I still hate Java
00:42qbgA larger problem than a build tool is all of the JVM dependent code
00:42jacortinasyup
00:42tomojit's not a problem :(
00:42tomojit's a blessing
00:42jacortinashaha
00:42jacortinasxml libs and stuff like that
00:43jacortinasin my opinion for a language to be taken very seriously it needs to "eat it's own dogfood"
00:43jacortinasas much as possible should be "pure"
00:43jacortinasand only the very very lowest level things should be platform dependent
00:44jacortinasdon't think that I hate that Clojure is on the JVM
00:44tomojmaybe someday in the far future
00:44jacortinasit's great that the JVM allowed clojure to be designed so well
00:44tomojwithout the JVM clojure would be nothing, though
00:44taliosjacortinas: but a maven repository, is just HTTP + XML metadata - nothing "jvm" about that itself
00:44jacortinasthat's what I'm saying
00:45jacortinasIMO XML metadata == JVM
00:45jacortinashaha
00:45taliosmmm riiiiiight.
00:45jacortinasand maven is not really a JVM agnostic tool
00:45jacortinas**platform agnostic**
00:46taliossure it is - it works on openjdk, sun jdk, ibm jdk
00:46taliosbea
00:46jacortinastrue
00:46tomojwe're distributing jars
00:46taliosthat's like saying we shouldn't use linux cause its all C
00:46tomojJVM agnosticism is not very important for a tool for distributing jars
00:46taliostomoj: a jar is just a zip file. call it a .car :)
00:47tomojok, if the jars contain no .class files, sure
00:48jacortinasI don't feel like it's saying don't use linux
00:48taliosDoes clojure.net distribute .dll's? :)
00:48jacortinasI feel like it's more like writing the clojure language in ruby
00:48jacortinasand then using rubygems to distribute clojure code
00:48tomojhmm?
00:49taliosnothing wrong with that actualy - if gems make a play for your infrastructure
00:49tomoja clojure written in ruby sounds like a disaster
00:49jacortinasit feels based in the underlying implementation a little too much
00:49taliosjust like nothing with using puppet, or chef to distribute/configure your apps
00:49jacortinastomoj: and I know that, it's a hypothetical
00:49tomojoh, I misunderstood
00:50jacortinastomoj: in my hypothetical situation Ruby == Java
00:50tomojright
00:50jacortinasright
00:50tomojwe'd need to get to a point where we didn't need java libs anymore, though
00:50jacortinasahh
00:50tomojwhich I don't guess is going to happen any time soon
00:50jacortinasthat's a great point
00:51jacortinasI would love to get to that point
00:51taliostomoj: 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
00:51qbgRewriting Swing in Clojure would suck
00:51taliosThe sooner I can some clojure running in our OSGi setup I'll be a happier man :)
00:53tomojhow would you even go about writing swing in clojure?
00:53tomojend up like ruby with gems written in C?
00:54tomojor maybe some bundled ffi?
00:54taliosat that point we may as well just go haskell
00:54jacortinasI see that as the equivalent of having all of clojure's libs really just using java libs
00:54tomojhooray
00:54taliosand complain about not understanding monads
00:54jacortinaslol
00:54jacortinasI love monads
00:54jacortinas... I want to love monads
00:55jacortinas... It would make a smarter person
00:55jacortinas:*{
00:55jacortinas... if I understood them
00:55talios:)
00:55qbgWhat I know about monads: let = identity monad, for = list monad
00:56jacortinasthat's haskel you're writing?
00:56qbg(the clojure constructs let and for are the identity monad and list monad respectively)
00:58tomojfor isn't exactly the list monad, is it?
00:59qbgIsn't much of a difference, from what I know
00:59tomojconcatenation?
00:59qbgThere is a series of articles about monads in clojure
01:00qbghttp://onclojure.com/2009/03/05/a-monad-tutorial-for-clojure-programmers-part-1/ and http://intensivesystems.net/tutorials/monads_101.html
01:01qbgAnd there is clojure.contrib.monads
01:02mmarczykfor's :while goes beyond what the list monad can normally do, I believe
01:02mmarczyk:when translates to guard in Haskell
01:14defnisnt that a running joke in Haskell?
01:14defnHow many monad tutorials does it take to make a Haskell programmer?
01:14defnjust one more...
01:16jacortinashaha
01:17jacortinasyou know what's crazy?
01:17jacortinasI said "haha" in the #c room
01:17jacortinasand I was basically told to shutup until I had something intelligent to say
01:20defnoh dude. that's par for the course
01:21jacortinasit's really "douchy" in there
01:21jacortinassome admin saying that stupid people make a lot of noise
01:29fualoI 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
01:29fualoI had swank/slime/etc installed from ELPA
01:38tomojthe technomancy-approved way is to use lein-swank
01:39tomojthen it doesn't matter whether emacs downloads clojure or not
01:40tomojjust add swank-clojure to your lein project's :dev-dependencies, `lein swank`, and M-x slime-connect
01:45seancronmmarczyk: Thanks for your help. I figured out that dataset doesn't like it when the data is "[[]]". It works when the data is just "[]"
01:47mmarczykseancron: oh, so it does -- thanks for pointing this out, I actually thought it was a bug :-/
01:48mmarczykseancron: shouldn't stay at the keyboard this long, I guess
02:45Raynesmmarczyk: 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.
02:49RaynesHrm, no dice. Odd. Before, it wouldn't even work locally.
02:49RaynesBleh, back to the shell script. :\
02:50RaynesOh. The dependencies are screwed up. That can't be good.
02:51RaynesI absolutely love maven...
02:51Raynestalios: Not a word from you. :p
02:51taliosmaven maven maven :)
02:51taliosand yes - I do have a highlight notification on the word 'maven' :)
02:52taliosyou'd have the same issue with leiningen tho - bad dependency references are bad dependencie references
02:52RaynesDifferent jars are being pulled down on Licenser's server than they are on my machine.
02:52Raynestalios: It is Leiningen.
02:52taliosoh :)
02:52RaynesBut it uses maven.
02:52taliostrue true
02:53taliosI guess you ( or the other server ) has a ~/.m2/settings.xml file with mirrors defined
02:53technomancyRaynes: sometimes the maven central mirrors get screwed up
02:53taliosmaybe
02:53technomancydepending on which mirror you hit, you get a different jar. it's Magical.
02:53talioslocal mirrors/repos for the win.
02:53Raynestechnomancy: I have two clojure-http-client jars, the wrong clojure-contrib jar...
02:53RaynesAll sorts of stuff.
02:54RaynesI'm guessing that one of my own projects is the cause of the former.
02:54RaynesI probably forgot to push a new clj-github snapshot or something.
02:54defn"It's magical."
02:55taliosMaven is part of slitherin house.
02:55taliosThe bad kind of magic.
02:55talios-i+y
02:57tomojI think maven has this "I couldn't find it so I won't try to find it again for X amount of time" thing?
02:58taliosit does for -SNAPSHOTS
02:58tomojdoes leiningen do that too?
02:58taliosbut you can override that with -U
02:58tomojaha
02:58technomancytalios: you have to scp a pom with the jar.
02:59taliostechnomancy: ahh right. good good
02:59taliostomoj: 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 )
03:01taliostomoj: John Smart has a good post on this: http://www.wakaleo.com/blog/246-maven-mythbusters-maven-automatically-updates-for-every-build
03:02RaynesAh 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
03:02taliosmmm, thats more debunking the 'always downloads' myth actually
03:03taliosTime to run off for Thursday Night Curry anyways - night all!
03:08RaynesOh, clj-sandbox's version range is causing the other problem.
03:08RaynesI'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.
03:09RaynesVersion ranges are horrible beasts.
03:09RaynesI only recently learned that projects you depend on can require one "soft" version, but your project's version is preferred.
03:33bsteuberwhere am I supposed to put (non-maven) dependency jar files using leiningen?
03:33bsteuberI guess not lib as they'll get deleted on every clean
03:35defnis it more idiomatic to do: (defn deserialize [f] (with-open [r (PushbackReader. (FileReader. f))] (let [rec (read r)] rec)))
03:35LicenserRaynes: I am just pushing the sandbo
03:35defnor should i make the let => (fn [r] (read r))
03:35RaynesLicenser: Cool stuff. Are you about to head to work or something? I have a sandbox question when you have some time. :)
03:36LicenserI have a few minutes
03:36bsteuberdefn: (let [x y] x) is identical to just y, no?
03:37bsteuberso just (read r)
03:37defnbsteuber: yeah im trying to figure out why i would have written a let there
03:37defn:)
03:37RaynesA 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.
03:37bsteuber:)
03:38Licenseryes since doc takes a variable not a symbol
03:38RaynesLicenser: Aye, but you can't do anything malicious with doc, can you?
03:39Licensera way around it would be rolling your own doc that is a macro escapes the symbol and then have doc
03:39Licenser*
03:39Licenser that looks up the doc on a symbol and is whitelisted
03:39Licenserand yes I am a genius
03:40Licenserhmm while it might be hard to internalize a macro I'm not entirely sure how that works
03:40Licenserwould need to execute it upon startup and declare a doc* function
03:40Licenserlike (doc* [x] (doc (resolve x))
03:41Licenserand (defmacro doc [x] `(doc* '~x))
03:44RaynesMan, I hate that "cannot change nickname while banned on channel" stuff.
03:44LicenserRaynes: 0.4.1 is pushed
03:45RaynesLicenser: Awesome.
03:45RaynesThank you.
03:53RaynesHrm, still happens. Weird, but d'oh well.
04:09defnis (meta) off limits to the sandbox?
04:10RaynesYes.
04:10RaynesI believe so.
04:11sid3kyo
05:33bsteubertechnomancy: is lein uberjar currently broken? for me it deletes lib but doesn't populate it again
05:37bartjhi all
05:38bartjcan someone reproduce this error message with an example - "Parameter declaration method-name should be a vector"
05:54lozh,(defn a (a) a)
05:54clojurebotjava.lang.IllegalArgumentException: Parameter declaration a should be a vector
05:54lozh,(defn a (method-name) a)
05:54clojurebotjava.lang.IllegalArgumentException: Parameter declaration method-name should be a vector
05:55lozhfix by putting [method-name] instead
07:30sthuebnerIs (read-line) supposed to work with SLIME?
07:30sthuebnerI'm using SLIME-20091016 with swank-clojure-1.1.0
07:31sthuebnerand (read-line) doesn't come back on the REPL
07:31sthuebnerbut if I execute (read-line) in the *inferior-lisp* buffer, it works as expected - returning what I've typed until I hit ENTER
08:22lpetithello all
08:23serp_hi
08:23lpetitcemerick, ericthorsen: just read -and then answered- to the post in enclojure's ml
08:55defnhi lpetit
08:55lpetitdefn: hi!
08:57defnlpetit: how goes the clojre hacking
08:59lpetitdefn: I wish I had more time on it !
08:59lpetitdefn: how goes the joyful book hacking ? :)
09:15defnlpetit: joy of clojure?
09:15defnlpetit: well it
09:16defnlpetit: well it's not my book of course, that's fogus and chousers' baby
09:17cryptic_starmorning 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?
09:19lpetitdefn: I'm really not awaken today !
09:20eckrothUsing 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)
09:20defnlpetit: a list is a seq
09:20defnerrr sorry
09:20defncryptic_star: a list is a seq
09:21defncryptic_star: seqs are an abstraction
09:21eckrothWhy would only Java windows called from Clojure show as blank, and only the main window (tooltips, right-click menus, etc. work)
09:21LauJensenHas 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?
09:21defneckroth: perhaps your version of the JVM?
09:22eckrothdefn: I'm on Arch Linux, JVM version is 1.6.0_20
09:22rhudsoneckroth: openjdk or sun?
09:23defneckroth: i had a similar problem on ubuntu, perhaps it is openjdk vs sun
09:23defnim guessing you need sun
09:23RaynesOh boy.
09:23bozhidarOpenJDK is very buggy
09:23eckrothrhudson: defn: it's Sun
09:23bozhidarwhen it comes down to swing
09:23Rayneseckroth, defn: I actually wrote that code last march. I had no idea what I was doing back then.
09:23raekcryptic_star: arrays are not seq themselves (but they are seqable). you can make a seq from an array with (seq the-array)
09:24eckrothRaynes: yours is the dreamincode.net link?
09:24cryptic_star@defn @raek many thanks!
09:24RaynesIt worked at the time, but I can't promise that it is decent in any way.
09:24defnrhudson: is raek thanks for fixing that for me :) i was just looking up the sequence docs
09:24chouserraek: yay. I was about to say that. I love it when I don't have to say things. :-)
09:24Rayneseckroth: Yeah.
09:24defnerr rake: thanks ^^
09:24bozhidarI 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...
09:24defnraek*, gah, sorry for the typos folks
09:24eckrothRaynes: ah, cool; well, I don't know why it would not work now..
09:25defnchouser, raek: could you explain to me the difference between something being a sequence and being seq'able?
09:26eckrothRaynes: ah are you the 'famous' Try Haskell / Try Clojure / Try Ruby guy, as seen on HN?
09:26defneckroth: he's the try clojure guy :)
09:26Rayneseckroth: I'm just the Try Clojure guy.
09:26eckrothRaynes: ok I just misremembered; you showed up on HN recently right?
09:26RaynesYeah.
09:26eckrothRaynes: ok, cool! congrats on the publicity
09:27triyoI'd like to give counterclockwise a try. Does it play nicely with leiningen
09:27RaynesI think that tryclojure thread was the only one I've posted in there.
09:27Rayneseckroth: Indeed, thanks. It was overwhelming. I never expected people to be so crazy about trylanguage sites. :p
09:27defnRaynes: yeah, really, a hacker new reference is like the nerd version of digg
09:28Rayneseckroth: And that code actually does still work for me.
09:28defnit's kind of a big deal
09:28eckrothRaynes: 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)
09:28defnyou rode the front page for almost a day i think
09:28eckrothRaynes: ok so it works; I wonder why clojure-swing apps won't draw for me, but regular java ones will
09:28Raynesdefn: Yeah, you know when people start telling you how bad something is, it's popular.
09:29chouserdefn 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.
09:29defnchouser: ill re-read that section in JoC
09:30defnchouser: 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.
09:30Rayneseckroth: 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.
09:31defnso lists are collections which have a way in which they are seq'able?
09:31chouserdefn: PersistentLists are a bit of an exception, actually, in that they support the ISeq interface directly.
09:31eckrothWhat'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.
09:32cryptic_startriyo: 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
09:32eckrothRaynes: it's somewhere down the list of google results for "clojure swing"
09:32RaynesOh, that is horrible.
09:32RaynesThere has to be better examples out there.
09:32defnchouser: that actually makes sense -- since vectors (correct me if im wrong here please), seem to be a more complex version of the ISeq interface
09:33defnand the same with maps and sets, they're sort of evolved versions of ISeq, where the list is the analog to them both
09:33defnchouser: am i barking up the wrong tree?
09:33chouserdefn: 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.
09:33cryptic_startriyo: 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)
09:34chouser,(seq? [1 2 3])
09:34clojurebotfalse
09:34defnchouser: ah-ha!
09:34chouser,(seq? (seq [1 2 3]))
09:34clojurebottrue
09:34chouser,(class (seq [1 2 3]))
09:34clojurebotclojure.lang.PersistentVector$ChunkedSeq
09:34lpetittriyo: ccw will not get in your way with lein, but does not use lein yet
09:34defn,(class (seq '(1 2 3)))
09:34clojurebotclojure.lang.PersistentList
09:34chouserso seq on a vector returns an instance of a "chunked-seq-on-a-vector" class
09:35defn,(class (seq #{1 2 3}))
09:35clojurebotclojure.lang.APersistentMap$KeySeq
09:35defnchouser: yeah! that makes perfect sense now
09:35defnyou've completely demystified it for me. :)
09:35raekfor java folks it might be useful to think of seqs as iterators
09:35defniteration has no place in FP! *kidding of course*
09:35RaynesAnd for me.
09:35chouserdefn: well, great! Now why didn't the book do it... *glares at the book*
09:35lpetittriyo, 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
09:36Rayneschouser: I faintly remember reading that section like 3 times, and still not quite *getting* it.
09:36chouser:-(
09:36raekI think this abstraction is one oof the most beatiful things about clojure...
09:36triyolpetit: thanks for that info
09:36RaynesI don't think anyone has really explained it to me quite well until now.
09:36Rayneschouser: Just throw this IRC excerpt into the book. ;p
09:36defnchouser: could i suggest you show examples of (class (seq [1 2 3])) into the book
09:37defni think that really helps
09:37chouserraek: maybe, though the word "iterator" may also bring in thoughts of mutable semantics that are entirely unhelpful.
09:37chouserdefn: yeah, I think you're right.
09:37raektrue.
09:37defnchouser: it demonstrates that pivot point between seq and how they're actually implmeneted
09:38defnimplemented
09:38chouserI 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.
09:39defnyeah, it sort of becomes a dialog in a lot of ways i think
09:39Rayneschouser: To be fair, you're still doing an excellent job with all of that.
09:39defnbecause here, i can say: so you mean it works like this? and you sharpen the definition ever so slightly
09:39raekI 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
09:40RaynesI still hate manning. They never emailed me back. :(
09:40defnRaynes: what was your issue again?
09:40defnnot being able to download the latest?
09:40defni just use my original email from them with the yahoo order number
09:40Raynesdefn: 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.
09:40RaynesI don't have my original email.
09:40defnyou don't need to sign in
09:41defnwha? where'd it go?
09:41defnemail is cheap, no need to delete ;)
09:41RaynesI 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.
09:41RaynesI never delete emails.
09:41RaynesEver.
09:41RaynesDoesn't mean I don't misplace them. ;)
09:41defnRaynes: that's pretty lame that manning didn't reply
09:41defnwho did you email
09:41Raynessupport
09:42defnhrmph -- bummer
09:42RaynesIt isn't that big of a deal. I can wait for chapter 8, I suppose.
09:42chouserRaynes: do you provide an email address or something when you order the MEAP? Do you know which email address you used?
09:42defnim awfully excited to see the last few chapters
09:42Rayneschouser: Yeah, because they send me stuff.
09:43chouserRaynes: let me see if I can use my contact to get any traction for you.
09:43chouserRaynes: PM your email address to me?
09:43RaynesSure.
09:43defnthe "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
09:43defn"
09:43RaynesI appreciate that.
09:43defnwow my typing is getting worse and worse today
09:44Ploujforgive 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?
09:44Raynesdefn: It's because I was talking about Perl6. It has you all mixed up.
09:44defn:D
09:44Ploujmore than a staticly typed language like Haskell
09:44defnPlouj: it depends on what you're doing
09:45RaynesUnit testing is always good.
09:45defnPlouj: if you have I/O going on then testing will be more important
09:45Ploujdefn: I'm wondering in general because I'm trying to decide whether to focus on learning Haskell or clojure for their concurrent tools
09:45defnPlouj: clojure is less restrictive
09:45defnand for that reason i prefer clojure
09:46defni dabbled with haskell -- it's a beautiful language with lots of interesting ideas
09:46chouserPlouj: 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.
09:46defnbut clojure is more "flexible" -- i dont feel constrained by the rules of the language
09:46lpetitPlouj: people generally don't use this criteria to choose between the two
09:46RaynesThe 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"
09:46defnthat's a good point also
09:47RaynesBut Haskell is a great thing to learn.
09:47Ploujlpetit: 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 :)
09:48RaynesKnowing either is a benefit to the other.
09:48RaynesI learned stuff with Clojure that helps me write better Haskell code, and vice versa.
09:48chouserunit testing is less prevelent in the clojure community that in, say, the ruby community. Whether this is justifiable or not is something else...
09:48RaynesI don't actually write much (any, lately) Haskell code though.
09:49defnim going to go out on a very, very long limb here
09:49defnand suggest that unit testing in ruby is partly due to the high number of novice programmers
09:49defnthat's going to get my head chopped off
09:49defnbut i think it's encouraged as much as it is to offer a more tangible "guarantee"
09:50RaynesI suggest that the lesser prevalence of unit-testing in the Clojure community is related to Clojure being more functional-oriented.
09:50defnwell yeah there's that too of course
09:50RaynesThere isn't much to test in pure functions.
09:50defnyeah, i tried doing unit testing on some stuff i was writing and it just felt like i was re-writing my code
09:51Ploujheh, ok, I guess not all is as bad as I thought :)
09:51defnlike asserting that (inc 1) is 2 or something
09:51defnof course it's 2
09:51chouserheh
09:52defnand when you build that up to a complex function, if the function contains pure elements like inc
09:52defnthen there is nothing to test
09:52HodappI'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.
09:53raekmaking seams in clojure is really simple
09:53defni can echo that -- however, in Ruby there are /lots/ more reasons to have them
09:53dnolen_Plouj: also remember that Haskell makes certains kind of generic programming difficult. Adopting a strong type system means you give something up.
09:53raekif a function uses another complex function, that one can be dynamically rebound with (binding ...)
09:53PloujI guess I'll learn that once I use clojure/Haskell more
09:55defnmutable vs immutable => the reason for unit testing EVERYTHING versus only some things
09:56defnPlouj: try to open a file, read it, write to it, execute a line of code contained inside of it
09:57defnHodapp: working at Google, eh? ;)
09:57chouserHodapp: no worries ... these days I'm debugging in PHP! :-D
09:58Ploujdefn: 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?
09:58defnoh god chouser ... say it isn't so
09:58defnPlouj: consider that the main "real" outside inputs will be few
09:58defnthink about a google search...
09:58chouserPHP is a fascinating language, in a sort of anthropological sense.
09:59raekPlouj: in some cases, that can be done with pre- and postconditions
09:59defnthat too
09:59defnbut in general i dont find it necessary
09:59bortrebis there something like perl's CGI:Ajax module for clojure yet?
09:59defnbecause 90% of my code is relying on code above it
09:59defnif the inputs were bad to begin with, we wouldnt be at this depth
10:00defnabstract 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:00defnthen there's nothing to worry about
10:00clojurebot@ has nothing to do with whether sth is evaluated or not
10:00Hodappdefn: nah, not Google. I thought they mostly were Python or something.
10:01defnHodapp: GMail is C++ to the max
10:01Ploujheh, ok
10:01defntheir interviewers get mad if you write Java on the whiteboard
10:01Ploujinteresting
10:01defnHodapp: they do a lot of python too, but GMail and such is heavy C++
10:02Ploujdoes anyone know of any trading companies using clojure?
10:02wwmorganhow do you pronounce the macros -> and ->>?
10:03lpetitthread-first , thread-last
10:03defnheh
10:03defni call them arrow and double arrow
10:03defnand know how they work
10:03Rayneswwmorgan: Hyphen left arrow and hyphen right arrow right arrow. ;)
10:03Rayness/left/right/
10:03sexpbotwwmorgan: Hyphen right arrow and hyphen right arrow right arrow. ;)
10:04mefestoi wonder how much google has been dog fooding their go language
10:04defnmefesto: i think they've been doing quite a bit with it
10:04lpetitgoogle releases a lot of things "in the wild"
10:05defnafter all of the unfavorable publicity ive seen some "updates" to go which actually made it looks quite good
10:05RaynesI'm more interested in Rust.
10:05defnwhat big company is sponsoring rust?
10:06RaynesWhat big company is sponsoring Clojure? :p
10:06BahmanHi all!
10:06defnRaynes: Mozilla is developing Rust
10:06RaynesI know.
10:06defnClojure is riding a lisp wave to heaven right now
10:07defnI'm still sort of amazed that the mainstream has held an interest
10:08defnRaynes: in any event, re: rust vs go -- they're decided to do specific things in-house
10:09defn"structural" typing is kind of a dead giveaway when it comes to go vs rust
10:09defnthey're both structurally typed
10:11defnFAQ on Rust: Why did you do so much work in private?
10:11defnA certain amount of shyness. Language work is somewhat political and flame-inducing.
10:11defnLanguages 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:12defnRich isn't shy, but he won't bend to the whim of committee
10:12RaynesI bet he is having all sorts of fun at emerginglanguagescamp
10:13defnat just about any conf right now clojure is getting a lot of attention
10:13defnim going to strange loop and like 40% of the talks are on clojure
10:13defnbtw chouser: looking forward to your talk at strangeloop :)
10:14chouserexcellent! I'm looking forward to being there.
10:14raekI *really* want to go to strangeloop
10:14defnraek: so go then! :)
10:14raekI must investigate some more if the university might sponsor this
10:14chouser40% might be a slight exaggeration
10:15raekit will cost at least about $ 1000 for me to get there
10:15chouserbut one talk on clojure in nearly every time slot is nothing to sneeze at.
10:18defn:)
10:19defnIn the middle of MO, no less! :)
10:21defnchouser: im sure you've seen this, but you know how a lot of books have those cards that you can tear out?
10:22defnthe "quick reference" thing?
10:22defnchouser: http://faustus.webatu.com/clj-quick-ref.html
10:22defnive been helping my friend learn clojure and this has become invaluable -- it's a very nice mix
10:22dpritchettHas 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:23chouserdefn: yeah, I saw that -- a very nice quick reference. Not exactly small, altogether.
10:24defnchouser: yeah fair enough -- but it seems to hit all of the points, and give a nice overview without being reductive or overly verbose
10:25defnchouser: food for thought anyway
10:25chouserI agree that page fills a gap in the existing docs.
10:26cemerickdpritchett: sounds like the installer is trying to do some UI stuff, and is in headless mode that doesn't allow it.
10:26cemerick(or importing certain classes is enough to trigger that)
10:26dpritchettIt 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:27AWizzArdcemerick: 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:27dpritchettsu
10:28cemerickdpritchett: If that's actually the problem, then whether X is around or not isn't going to help.
10:28Ploujdefn: how does Rust benefit Clojure or am I missing something?
10:28dpritchettThat'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:28cemerickAWizzArd: Agreed. The same goes for any task/target-oriented build system AFAICT.
10:28dpritchettEither way I submitted a ticket to cljr on github
10:28dpritchetthttp://github.com/liebke/cljr/issues/issue/12
10:29LajlaWhat's the exact difference between symbols and keywords?
10:29LajlaTHat keywords evaluate to themselves?
10:30AWizzArdcemerick: I can't say enough about it, as I don't know how Maven or Ivy or Gradle or Leiningen are doing it.
10:30dpritchettYes Lajla
10:30dpritchettat least that's what it says on page 29 of JoC
10:31cemerickAWizzArd: Ivy just adds maven-style dependency mgmt and compat to ant.
10:31Lajladpritchett, JoC?
10:31LajlaJoy of Child rape?
10:32cemerickI'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:32AWizzArdcemerick: 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:32RaynesThat was majorly inappropriate.
10:32dpritchettಠ_ಠ
10:33AWizzArdant {:project "name", :compile false, (jar :sources false, :deps true)}
10:33dpritchetthttp://joyofclojure.com/
10:33AWizzArdthis is a horror with ant
10:36arkhat strangeloop, will there be video of the conferences, a. la. TED?
10:36dpritchettI 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:37chouserI think the talks will be recorded, but I don't know how those will be released.
10:37cemerickAWizzArd: 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:38Lajladpritchett, I was close, wasn't I?
10:38cemerickchouser: I still pine away for a few of the talks from the ILC. :-(
10:46chousercemerick: me too
10:47chouserbut 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:47defnyoutube...
10:48cemerickchouser: I think it just fell on the floor -- Dan's surely got way more important things on his plate.
10:48cemerickhttp://ilc2009.scheming.org/node/15
10:48Hodappdefn: interesting, did not know they used that much C++ there.
10:49Hodapp(delayed response, I know)
10:50defnHodapp: no worries
10:52bortrebdoes anyone know of a good compojure tutorial/ can you do AJAX-y things with it? sorry for being such a noob...
10:52defnLajla: How in the hell does JoC translate to what you said? You're sick. Seek medication.
10:52stephynI 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:53defnstephyn: let is functionally equivalent to nested fn's
10:53defnit's the identity monad
10:53Chousukestephyn: there's letfn
10:54Lajladefn, 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:54stephynchousuke: interesting. I have in mind as the canonical example of this the sqrt by approximation example.
10:55LajlaChousuke, besides, my Finnish is all proper, isn't it?
10:55LajlaEn puhu lapsiseksistä suomeksi.
10:55Hodappwtf did I walk into
10:55arkhcemerick: that was over a year ago :(
10:55cemerickarkh: yeah, I know. I've basically assumed the vids are gone now.
10:56cemerickWhich is a huge shame in a couple of cases.
10:56defnLajla: 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:56Lajladefn, that would be so unfair, I can't help it.
10:57arkhIf he sent me the DV's, I'd do it (for free of course)
10:57LajlaInstead, 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:57cemerickarkh: stuff like that is what I was thinking with my "crowdsourcing" suggestion.
10:57Raynesdefn, Lajla: -> #clojure-casual
10:57defni'll pass on continuing this conversation
10:57defnmoving on
11:01chouserstephyn: you want a seq of the maps? basically the second arg to func?
11:03chouserstephyn: [[x [{a :a} {b :b} :as ms]]
11:03stephynchouser: 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:04stephynand then a and b as needed.
11:05AWizzArdWhat is the idiomatic solution for two namespaces requiring each other?
11:05stephynI don't think that [x [{a :a} :as a1 {b :b} :as b1]] worked, IIRR.
11:06cemerickAWizzArd: "don't do it" is idiomatic. Everything else is a hack. :-)
11:06chouserstephyn: [[x [{a :a :as a1} {b :b :as b1}]]
11:07stephynchouser: interesting. thanks.
11:10dpritchettI 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:10dnolendpritchett: that's me
11:11tomojare you trying to fracture your identity?
11:12dpritchettMaybe he's trying to avoid being recruited ;)
11:18pdkANYway
11:23lpetitSo, who is talented, and has time to grow a pretty logo for counterclockwise ? What about the suggestion made by Konrad ?
11:26lpetitYou 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:34lpetitmust leave, cu
11:41cemerickIf 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:42cemerickHere I'm referring to java.awt.geom.GeneralPath.moveTo(float, float), which seems to require (float x) wrapping to call.
11:43cor|n,(println "corin and afkafka and iryuu and bot0 are faggots")
11:43clojurebotcorin and afkafka and iryuu and bot0 are faggots
11:43cor|nnice one clojurebot. lol
11:44cor|n,(println "#wrongplanet will be owned. come and troll it. :-)")
11:44clojurebot#wrongplanet will be owned. come and troll it. :-)
11:44cor|nnice advise clojurebot, rofl
11:47bortrebcemerick: I've had the same problem -- it looks like you actually have to wrap it in (float)
11:48cemerickwtf is going on with the bizarre/insulting msgs today? :-(
11:48cemerickbortreb: it certainly seems like a regression
11:49danlarkin:-/ trolls
11:49Drakesonhow can I get the list of currently "require"d namespaces that start with a given prefix?
11:50cemerickdanlarkin: Hrm, not entirely. I'll not repeat what was said earlier.
11:51dpritchettbalrogs
11:55dpritchettBah, Raynes logged out just as I wanted to recommend a magnet school in his area
12:00arohnerDrakeson: I don't know about the required part, but c.c.find-namespaces might help
12:03Drakesonarohner: thanks. That ns solves another problem, though :p
12:04arohnerDrakeson: aha, then deref clojure.core/*loaded-libs*
12:05arohnerit's private, so you'll have to use the var trick
12:05arohner,@#'clojure.core/*loaded-libs*
12:05clojurebot#<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:06Drakesonarohner: aha, thanks a lot
12:12stephynis there a shorter anonymous function literal that always returns 1 than #(identity 1)?
12:12bortreb#(1)
12:12arohner,(#(1))
12:12clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
12:12arohner,((fn [] 1))
12:12clojurebot1
12:13Chousuke(constantly 1)
12:13bortreb,(#(*))
12:13djpowellcemerick: have you figured out your GeneralPath problem yet?
12:13clojurebot1
12:13cemerickdjpowell: aside from the (float arg) workaround, no
12:13stephynbortreb: weird...why does that work?
12:14cemerickI don't have time to spelunk in the clojure compiler today. :-)
12:14arohnerstephyn: that's the identity on multiplication
12:14arohner(#(+))
12:14djpowellGeneralPath *does* have overloads. it got retrofitted at some point. you may be looking at old javadocs
12:14bortrebbecause the zero-element under multiplication is 1
12:14arohner,(#(+))
12:14clojurebot0
12:14stephynoh, that's right.
12:14stephynI'm not sure I want to rely on *that*. ;)
12:15bortrebI don't think you can do shorter tho :)
12:15djpowell,(filter #(= (.getName %) "moveTo") (seq (.getMethods (class (java.awt.geom.GeneralPath.)))))
12:15clojurebot(#<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:15stephynno, that's true...you did meet the requirements admirably.
12:16cemerickdjpowell: Crud. Well, I'm an idiot. :-x
12:16cemerickdjpowell: good catch. My usual javadocs are 1.5; I'm using 1.6 for this particular project.
12:16djpowellin earlier java or something it had float params, but then they made it a subclass of some other class
12:16djpowellapparently it is legacy now
12:21dpritchett#(inc 0)
12:22cemerickdjpowell: yeah, the change was in 1.6. I should upgrade my on-disk javadocs, clearly.
12:25hugodanyone know of something like enlive, but in javascript?
12:25cemerickhugod: hahahaha. Good one, mate.
12:26cemerickOh, you're serious. ;-)
12:26hugodcemerick: :)
12:26hugodwhy can't I program my browser in clojure!
12:27Rayneshugod: Because of the price of tea in China.
12:27cemerickhugod: The real question is, will chouser respond better to subtle hinting or outright bribery?
12:27hugodRaynes: tea has started revolutions before now
12:28arkhhugod: it wasn't really the tea they had qualms about ;)
12:29hugodarkh: the rum?
12:29pdkso, quick q with vimclojure setup
12:30pdkwhen i go to run ant in the installation steps (for winxp) it gives me "build.xml:66: could not find clojure.lang.Compile"
12:30arkhhugod: aye, the rum
12:35arkhpdk: wish I knew something about ant but it sounds like it can't find the clojure.jar in your path
12:35arkhclasspath? idk ...
12:36pdkhm just checked my classpath under control panel -> environment vars
12:36pdkeven after adding full paths to clojure.jar and clojure-contrib.jar then restarting the console, still gives the error
12:36pdkor is lang.Compile yet another extra clojure.org download
12:37arkhpdk: no, it should be in clojure.jar
12:37pdkthough i think i had this crap yesterday
12:37pdkwhere if i updated PATH
12:37arkhpdk: is clojure.jar in your system path, e.g. does it show up when you type 'PATH' at the command prompt
12:38pdkeven 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:38pdkok that's stupid as hell it has to be in PATH
12:38pdki just went and put it in CLASSPATH
12:39arkhwhen in doubt, do both ;)
12:39pdknah that doesnt fix it
12:41arkhthis is a kludge, but what if you copied it into your ./classes subdirectory, under build.xml ?
12:41BlaineI wish clojuredocs.org would automatically link glossary terms to their definitions
12:52pdkhmmm
12:52pdkthere's an idea arkh
12:52pdkdo you mean a classes subdir in the vimclojure folder
12:52arkhor wherever other jars are vimclojure depends on
12:53pdknah didnt fix it
12:53arkh:(
12:56pdksometimes you just wish there was a version of notepad or something with lisp autoindent
12:59Blainepdk: trying to get vimclojure set up?
12:59pdkyeah
12:59pdkant is being stupid and saying it can't find clojure.lang.Compile even after a few attempts to coax it
12:59Blainehow is that relevant to vimclojure?
12:59Blaine:P
13:01pdkwell kotka's site says that's an install step so :p
13:01pdkcause there's some vimclojure.jar i need to compile via ant
13:01Blaineaw dude, nah
13:01pdkoh can you skip this step
13:01pdkthat's news for sore ears... eys
13:02pdkyeah EYS
13:02pdknot eyes!
13:02Blainejust download http://www.vim.org/scripts/script.php?script_id=2501
13:02pdkthe hell
13:02Blaineand copy autoload, doc, ftdetect, ftplugin, indent and syntax folders to your .vim dir
13:02pdki dled it from there
13:02pdkhmm
13:02Blaineand you're golden
13:02pdkwill i still have access to nailgun if i do it that
13:02pdkcause one blog post was saying
13:02Blaineno idea
13:03pdk"i don't like nailgun so i did it in <the way blaire described>"
13:03Blaineare you new to clojure?
13:03BlaineI am, and I don't know what that is
13:03Blainebut I don't think I need it
13:03Blainehaha
13:04BlaineI just copied all those dirs to ~/.vim and I get syntax highlighting, nifty indendation, and rainbow parenthesis
13:04BlaineI went by this blog post: http://writequit.org/blog/?p=386
13:04pdkyeah all things considered thats basically all i wanted to get out of an editor
13:05pdksince 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:07Blaineyeah dude
13:07Blaineyou won't need that stuff until later, probably
13:08Blainedoing what I did will get you a good editor at least
13:08rhallHi all, can I jump in with a completely unrelated question ?
13:08Blainerhall: too late, you already did
13:08rhallyeah... I know... it's irc after all :)
13:08rhallbut I try
13:08rhallanyway
13:08rhallis there a "notnil?"
13:08rhallliterally the opposite of "nil?"
13:09Blaine(not nil)?
13:09rhallI'm looking for something I can use in filter
13:09Blaine:P
13:09rhall(filter notnil? (function-that-returns-a-seq-some-items-of-which-are-nil))
13:09rhallso I want to filter out the nils
13:09stephynpdk, 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:10bortreb(comp not nil?)
13:10pdkwhy not (fn [x] (not (nil? x)))
13:10rhallyeah... you type faster than me...
13:10pdkfor the function arg to your filter call
13:10rhallthat's what I've been using
13:10rhallbut wondered if there was a "sugared" form
13:10pdkactually is the screen stuff going to work in gvim on windows
13:10pdkbetter yet will i have to do all this crap twice to make it work in both cmdline vim and gvim
13:10raek(complement nil?)
13:11pdkor do settings and crap carry over between the two
13:11pdkyeah
13:11Blaine(defn not-nil? [x] (not (nil? x)))
13:11raek(remove nil? seq)
13:11pdkcomplement nil? would prob return the same function i just wrote
13:11pdkbasically complement just
13:11pdktakes a 1-argument function
13:11Blainepdk: you're working on a windows box?
13:11pdkand returns a function that just returns falce when that function returns true and vice versa
13:11pdkyeah winxp
13:11pdki know thats gonna draw some glares :p
13:11stephynpdk: I wouldn't think so; unless the dos prompt has a version of screen...you might need cygwin.
13:11rhallraek: both of those work... thx!!
13:12pdkhmm
13:12raekpdk: exactly, but complement works for functions of any arity
13:12pdkoh yeah
13:12pdkso in this case
13:12raekif and when have if-not and when-not counterparts
13:12pdk(complement nil?) would just return something that acted the same as (fn [x] (not (nil? x)))
13:12raekand filter has remove
13:13pdkyeah
13:13raekpdk: correct
13:13pdkyou could do (remove nil? ...) instead of (filter (complement nil?) ...)
13:13pdkfilter only keeps the items for which the condition function returns true
13:13pdkremove only keeps the items for which the condition function returns false
13:13rhallyeah... forgot about remove
13:14rhall<----- is total clojure newb but loving it
13:15stephyn<-- same here; for some reason, I'm getting more traction with it than trying to learn Haskell :O
13:15raekone should never be ashamed of asking questions... :)
13:16pdkone 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:17pdkso at least once per chapter you run into a list of functions relating to stuff like seqs or whatever, fairly handy
13:17pdkplus the documentation you tend to get with (doc function) is terse as hell
13:17pdkvery often just 1 unclear sentence
13:18bortrebempty? 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:19rhallraek: I have no fear of showing my ignorance lucklly
13:19pdk[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:20bortrebis 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:21stephynthat'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:21bortrebheh, you guys should try coding in bluespec some day :)
13:21mfexbortreb: conjure has some ajax functionality
13:21bortrebit makes java look like the most dynamic language ever
13:22pdklet's go back to the days of no typing scheme!
13:22pdkeverything is pointers
13:22Chousukebortreb: empty? isn't used that often. The recommended idiom is "(if (seq x) ...)"
13:23bortrebbluespec is so strongly typed, even the TYPES are typed (I'm not kidding)
13:23technomancyhugod: here's an enlive-like for JS: http://github.com/cohitre/baconl
13:23Chousukebortreb: Haskell has that too doesn't it?
13:24Chousukekind of
13:24ChousukeI'm still not very proficient with the type wizardry in haskell
13:24hugodtechnomancy: thanks! looks interesting
13:25bortrebChousuke: yeah but bluespec does it in a more literal way since everything utlimately compiles down to transistors
13:25Chousukefor more complicated types, I get confused about what are the type constructors and what are its parameters.
13:25technomancyhugod: I don't know if it's used for anything or just atoy
13:26pdkis it a hardware design language
13:27stephynI'm afraid I'll probably have to learn Haskell some day...but Clojure seems to be a good 2nd choice for now.
13:33pdkblaire
13:34pdkdo i stick these plugins files in a subdir of vim's $HOME
13:41rhallI'm seeing the need for an "antonym" cross-ref in the docs
13:41rhallfor instance my filter vs remove question earlier
13:41rhallnow I'm looking for the opposite of (keyword x)
13:41rhallif I want to pull out and print the keyword in a map, and print it without the colon
13:42pdk(str :keyword) gives you a string
13:42pdkthen you can do (. (str :keyword) substring 1) to get a string with the : chopped off
13:42rhallpdk: cool
13:42pdkor (rest (str :keyword)) to get a sequence of chars without the :
13:42pdk,(rest (str :for-example))
13:42clojurebot(\f \o \r \- \e \x \a \m \p \l \e)
13:42chouserrhall, pdk: name
13:42chouser,(name :foo)
13:42clojurebot"foo"
13:42pdkOR THAT
13:43pdkwhy ya gotta ruin our fun man
13:43rhallgood stuff
13:44raek,(let [kw :foo/bar] [(namespace kw) (name kw)])
13:44clojurebot["foo" "bar"]
13:44rhallI think I have read and re-read, and re-re-read the api page
13:44rhallis that (iterate (read api)) ?
13:45pdkba dum tschh
13:48rhallpdk: two drums and cymbal?
13:48pdkindeed
13:53pdkUMMMMMMM
13:53pdkyou see nothing!
13:53Hodappwhere ya been?
13:53pdkthis is like one of those "SO WE MEET AGAIN" moments
13:53pdkhavent been to #zdoom in like 2 or 3 years haha
13:53pdkkinda got the feeling i wasnt wanted then but i guess it wasnt so bad so might as well pop in again sometime probably
13:53Hodapper
13:53Hodappwhoops
13:53Hodappdisregard
13:54pdkyeah it's all gravy for #clojure
13:54HodappI'm still in #zdoom, trolling BBG and saying weird stuff.
13:54pdkis bbg still there
13:55pdkdoin the stoner gun nut thang
13:55Hodappyeah
13:55Hodapphe's a riot sometimes because he takes himself so seriously
13:56pdkthe more things change the more things stay the same then
13:56pdkdude was like
13:56pdkevery other day it was a political argument with him and zark/darknation
13:56pdkalso one choice bit of wisdom i learned from him
13:56Hodappand 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:56pdkchess has a random chance factor!
13:56Hodappthat was classic
13:57pdkdoes he just do that when it comes to politics/gun rights issues
13:57pdkor is he like that with other stuff he has no clue in like comp sci
13:57Hodappwhen it comes to comp sci
13:57pdki recall him defending the windows .exe .txt etc scheme once
13:57Hodapphe finds a way to talk about guns or politics instead
13:57pdkand his mac hate
13:57pdkactually i dont think i heard where he works
13:58Hodappidk, but he barely makes shit and still lives with his parents
13:58Hodappwhich he tries to spin into superiority over everybody else
13:59pdkwasn't he saying he was getting a degree in gunsmithing
13:59pdkand talking like smith and wesson would snap him right up
13:59Hodappthat boy hasn't set foot in a classroom or a lab for like a decade
13:59stephynis there an equivalent of a ruby file's if $0 = __FILE__; // stuff; end for a Clojure script?
13:59pdkor at the very least taking some specialized course on making guns
14:00pdkmaybe just mentioned it on dwforums once
14:00Hodapphe mostly just spends all his income on acquiring more guns, ammo, and gun parts
14:00edbondwhy Math/abs doesnt works in .clj file but works in repl? No matching method: abs
14:00pdksee if importing java.Math helps
14:01pdkhm how about the rest of the #zd crew then
14:01edbondpdk: added (:import (java.lang Math)), doesn't help
14:01qbgedbond: Perhaps you are calling it with the wrong type
14:01qbg,(Math/abs 5)
14:01clojurebot5
14:01pdkbs always kinda struck me as being kinda serious about it too in #zd when i was there
14:01qbg,(Math/abs [1 2 3])
14:01clojurebotjava.lang.IllegalArgumentException: No matching method found: abs
14:01pdkthough i hardly see him talk in #ud
14:01Hodapphow old is that guy?
14:02pdki thought he was around 26
14:02pdkby the by #ud is on quakenet now
14:02Hodapphe banned me once for like 2 months because he was being pissy and I said "stfu periodbleeder"
14:03pdkyeah it just felt like a lot of the #zd crew was that way at the time
14:03pdkthough you cant blame everyone else 100% either way i guess
14:04pdkthough fraggle was cool
14:04pdkand he keeps graf in check when he talks about how everyone should be using c++ :p
14:05Hodappscrew that language
14:05edbondqbg: thanks, you're right.
14:06pdkprob 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:06raekthere's no need to import things in java.lang.* since they are imported by default
14:07edbondnext question: how to get double from '/' not Ratio ?
14:08raek,(double 1/3)
14:08clojurebot0.3333333333333333
14:08raekthe java.lang.Math library only supports its own type
14:08raek,(class 1/3)
14:08clojurebotclojure.lang.Ratio
14:08pdkclojure has (int) (float) etc functions for coercing stuff to java primitives
14:08AWizzArd,(class (int 15))
14:08clojurebotjava.lang.Integer
14:09raekthe ratios are provided by clojure
14:09pdkand (unchecked-add) (unchecked-subtract) etc for doing native java math on them without overflow checking
14:09pdkAWizzArd it's going to box primitives up automatically when you take them back into clojure to work on them
14:09pdkbut this lets you pass primitive args to java functions etc
14:13raekstephyn: there is the gen-class stuff where you can make a main method
14:13raekin that case, you can use the generated class as the main class
14:13stephynah, but it only works with compiled code not interpreted?
14:14raekbut when making scripts, AOT compilation might not be the most convenient alternative
14:14raekyes
14:14stephynthanks.
14:14raekwhen ran as a script, the *command-line-args* var contains the arguments
14:15raekI think clojure source files tend to be used as either a library or a script, but not both
14:15raek(as far as I know)
14:16raekthe AOT compiled main methods are the closest counterpart to the python if __name__ == "__main": I can think of
14:17raekI can see that it's convenient to be able include testing code that way
14:19stephynwell, 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:19raekhehe
14:20raekI mostly use emacs + slime + swank and reevaluate only the functions I change
14:21raek(defonce can be used for code that should only, well, be defined once)
14:21stephynyeah, 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:22bortrebstephyn: you can't always rely on *command-line-args* because you might call your script with no args,
14:22raekyou can always do a (remove-ns 'name.of.namespace)
14:24bortrebstephyn: I like : (defn command-line? [] (.isAbsolute (java.io.File. *file*))) because it works for no args too
14:25stephynIt'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:25stephynlate for this year).
14:25raekmaybe a (defn reset-ns [ns-sym] (remove-ns ns-sym) (require ns-sym)) is useful to´have...
14:26raek(or a :reset option for require)
14:26bortrebstephyn: then you can do at the bottom: (if (command-line?) main) or smtg
14:26bortrebalso you can totally use your files for libraries and command line scripts with this method
14:28cemerickI'm surprised no one here is liveblogging the oscon talk :-)
14:29_fogus__,(use ,(clojure.pods/podify [:a :b])
14:29clojurebotEOF while reading
14:29_fogus__Hmmmm, I guess pods haven't made it into core yet. :p
14:30cemerickI've no idea what they do, but the name is a little goofy. :-)
14:30_fogus__,(clojure.pods/podify [:a :b])
14:30clojurebotjava.lang.ClassNotFoundException: clojure.pods
14:30_fogus__oh well
14:30bortrebstephyn: 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:32bortrebthat's weird... I don't see anything there that would be a macro
14:32stephynme either.
14:32bortreb,*file*
14:32clojurebot"NO_SOURCE_PATH"
14:33stephynI 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:34bortrebstephyn: what does *file* resolve to for you? maybe it got redefined?
14:34technomancydnolen: are you at emerging langs?
14:34stephynsome as here, "NO_SOURCE_PATH"
14:34technomancyhttp://p.hagelb.org/pod.jpg
14:34dnolentechnomancy: no, just following along here and on twitter
14:35dnolentechnomancy: nice
14:36dnolenhaha Pod Power!
14:37leifwhttp://healthhabits.files.wordpress.com/2008/12/pod-people-invasion-of-the-bodysnatchers.png
14:37dnolensounds like next level cells
14:37stephynin 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:37qbgThe second
14:38stephynLOL...I do that all the time, except I say "a" or "b".
14:41hiredmanwe demand copies of rhickey's slide deck from the emerging lang con
14:42scgilardia pod here, a pod there, pretty soon you're talking real process
14:43danlarkinpods!?!?!
14:43qbgrhickey, open the pods
14:43danlarkinplease open the pod bay doors, HAL
14:44qbg<rhickey> I'm sorry qbg, I can't do that
14:47leifwhttp://www.bandswallpapers.com/data/media/16/pod2_1024x768.jpg
14:47pdkthank goodness
14:47pdkprops blaire, now this looks like it'll fit the bill
14:47pdkassuming the plugins work the same in gvim
14:49pdkoh that's dumb
14:49pdkusing a different gvim color scheme makes all the rainbow parens the same color except for the outermost block
14:56stephynbortreb: 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:57bortrebyay!
14:58wiligHey 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:59qbg~'errors
14:59clojurebotIt's greek to me.
14:59stephynis there a way to get a fresh repl without quiting repl?
15:00bortrebstephyn: 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:00wiligqbg: thanks, I knew I was being thick.
15:01stephynbortreb: ah yeah, right.
15:01cmbntris there more on pods online? http://p.hagelb.org/pod.jpg
15:02dsantiagoWhoa. What the heck is that.
15:03rhallreally 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:04leifwrhall, map is lazy
15:04leifwyou need to force execution
15:04rhalldamn
15:04leifwtry (doseq (fn [x] (println x)) (range 5))
15:04AWizzArdhmm?
15:05AWizzArd,(macroexpand-1 '(doseq (fn [x] (println x)) (range 5)))
15:05clojurebotjava.lang.IllegalArgumentException: doseq requires a vector for its binding
15:05qbg,(doseq (map println (range 5)))
15:05clojurebotjava.lang.IllegalArgumentException: doseq requires a vector for its binding
15:05qbg,(dorun (map println (range 5)))
15:05clojurebot0 1 2 3 4
15:05AWizzArdHi kotarak
15:05leifwthere it is
15:05kotarakAWizzArd: mann bist Du schnell...
15:06AWizzArd,(dotimes [i 5] (println i))
15:06clojurebot0 1 2 3 4
15:06kotarakieh
15:06pdk,(doc iterate)
15:06clojurebot"([f x]); Returns a lazy sequence of x, (f x), (f (f x)) etc. f must be free of side-effects"
15:06AWizzArddotimes may run side effects
15:07rhallso any "rule of thumb" on coding such that effects in the repl are the same as scripts?
15:07rhallor just watch for the "lazy" in the doc strings ?
15:07kotarakrhall: watch for no "do" in the name
15:07AWizzArdrhall: the rePl includes P for print
15:07AWizzArdIt forces lazy things
15:07rhallAWizz: good point
15:08rhall"do..." in the name also good
15:08AWizzArdwhen you have on toplevel a (map ...) then map evals and immediately returns an object that needs to be accessed
15:08technomancyrhall: if you (def _ (map my-fn my-coll)) it will avoid the printy-ness, making it work like "the real world"
15:08fualoIs 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:08kotarakSo are cells now called pods?
15:08rhalltechnomancy: I'll have to ponder that one
15:09dnolenkotarak: sounds like cells, minus the things rhickey didn't like, renamed to Pods
15:09qbgfualo: Lazyness is like delay
15:10cmbntrPOD != pain old datastruct
15:10technomancymore or less
15:11kotarakfualo: you can for example use a closure. (fn [] (thing to-be done la ter)) and later you do (previously-created-fn).
15:11cmbntrare pods already on the github tree? where to start looking for these?
15:12raekpods == cells?
15:12AWizzArdseems so
15:12dnolencmbntr: no, and cells never got past a gist.
15:13AWizzArddnolen: well, I am using them :-)
15:13cmbntrdnolen: so this stuff is way beyond 1.2?
15:14stephynScheme has (trace). Does Clojure have something similar or is there a nice simple, similar debugger for Java to use with Clojure?
15:15raekthere is clojure.contrib.trace, but I haven't used it myself
15:16raek,clojure.contrib.trace/dotrace
15:16clojurebotjava.lang.ClassNotFoundException: clojure.contrib.trace
15:16dnolencmbntr: yup. 1.2 is in beta, all we're going to see is bug fixes there.
15:19raekis there a video stream of rhickeys's talk?
15:33arohnerwhat's the type hint for an array of Objects?
15:33qbg^objects
15:34arohnerqbg: thanks
15:38arohnerI'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:38arohneri.e.
15:38arohner`(foo ~(if expand? stuff nil) [1 2])
15:38arohnerbut if expand? is false, a nil gets stuffed into the form, as opposed to nothing
15:39qbg`(foo ~@(if expand? [stuff] nil) [1 2])
15:39arohnerqbg: thanks!
15:39tomojwhoa
15:39tomojI thought that was impossible
15:40tomojqbg: nice!
16:02technomancyraek: video in a few weeks is the hope
16:08bhenrywhat's the best clojure way to copy image files from one location to another?
16:08Blainewhat's a binding-form?
16:09Blainethat term is all over the docs, and I have a suspicion of what it is, but I feel it should be defined somewhere
16:09bhenryblain it's the [a 1] in (let [a 1] a)
16:09bhenryblaine*
16:09Blainesuspicion confirmed, thanks
16:09technomancybhenry: I believe clojure.java.io/copy works with java.io.File objects
16:10bhenryargh. rtfm i guess
16:11Blaineso, when the docs use the term binding-form, it's referring to similar behavior as let?
16:11Blainei.e. in other functions
16:12bhenryyes like in for, if-let etc.
16:13tomojI think the binding-form in (let [a 1] a) is a
16:13Blaineso specifically, binding-form is the name/symbol/whatevs
16:14Blaine?
16:14Blainee.g. a
16:14tomojor [a b] in (let [[a b] [1 2]])
16:14mfextomoj has it: bindings => a 1, binding-form is a name or de-structuring form
16:16tomojwhy does if-let have an & oldform param?
16:16tomojseems like you aren't allowed to pass anything to it
16:18mfexBlaine, the whole explanation is at http://clojure.org/special_forms in the (let section
16:21Blainemfex: ah, yes, makes sense now
16:21Blaineregardless, seems very unintuitive
16:21Blaineand that term is littered everywhere
16:22Blainelike, the syntax used to describe it: (binding => binding-form init-expr) -- just looks confusing at first glance
16:22BlaineI dunno, just my 0.02USD
16:23BlaineI 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:23Blainehence my desire for a glossary
16:24hiredmanmy guess is oldform is left backwards compat stuff, from before the Great Binding Form Consistency Check
16:24tomojbut it's not backwards compatible if it throws an exception when you pass anything at all to oldform, is it?
16:24hiredmane.g. if-let may have used to not have a binding vector
16:24hiredmantomoj: left over and now vestigial
16:24leifwI believe that's known as "backwards loudpatible"
16:25hiredmanall compatibility with stuff before the binding forms clean up is broken/gone now
16:25tomojoh, hmm
16:25tomojnow you will get an error that says "requires a binding vector" or whatever instead of "wrong number of parameters"
16:26tomojso I guess it isn't totally vestigial
16:32mfexBlaine, 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:33Blainesweet
16:33BlaineI think I'll go through the book then
16:34Blaine:)
16:35tomojstart keeping a list of terms that confuse you, maybe?
16:35hiredmanbinding forms like that are common among functional languages, just bracketing is different
16:35defnYeah I was just going to say write your own
16:36hiredmanspecial forms are a lisp concept, they are the forms that the compiler supports directly
16:36tomojmight be harder for someone who's been with clojure for a while to make a glossary
16:36tomojor at least to pick the words
16:37defnto talk about at a dinner party maybe, but in general writing it down helps solidify the concept
16:37defnimprove as you go
16:40Blainea'ight
16:47dpritchettIf 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:48technomancydpritchett: C-x C-e evals the form before the point
16:49technomancyC-M-x does the whole top-level dep
16:49technomancy*def
16:50dpritchettwhen 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:50technomancydpritchett: 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:51dpritchettlet'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:51technomancydpritchett: C-c M-p for that
16:51technomancyonce it's compiled
16:51bhenryso 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:52qbg,(doc spit)
16:52clojurebot"([f content & options]); Opposite of slurp. Opens f with writer, writes content, then closes f. Options passed to clojure.java.io/writer."
16:52dpritchettthanks phil
16:53bhenryi'm having trouble using copy since it needs a File/OutputStream/Writer for the output.
16:54bhenryi've got a collection of file objects that i want to copy into a tmp dir
17:01tomojdpritchett: https://gist.github.com/013b2bd0c2b80c7c3836
17:02raekbhenry: do you need the contents of the file, or do you just want the OS to copy them?
17:02bhenryjust copy
17:03bhenryraek: ^
17:03dpritchettThanks tomoj! Now I need to bind a key to that
17:04tomojI have (define-key lisp-mode-shared-map (kbd "C-c r") 'eval-print-repl)
17:05tomojthat the method for do-copy [File File] uses input and output streams seems strange
17:06dpritchettThat works perfectly, thanks tomoj
17:07tomojoh I guess you need some external dep to get a sane copy
17:08raekbhenry: 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:08raekbut that is in java 1.7
17:08raekthe upper right corner says "DRAFT-b102"
17:09raekif you use the clojure.java.io/copy solution, all the data will pass though your application
17:10bhenryhmm.
17:10raekyou could use java.io.shell/sh to run the "cp" command on unicies
17:10bhenryi may go that route.
17:11raekall java examples I can find copy through Input- and OutputStreams
17:12tomojcommons-io has something
17:12tomojbut :/
17:12raekthis? http://commons.apache.org/io/api-1.4/org/apache/commons/io/FileUtils.html#copyFile%28java.io.File,%20java.io.File%29
17:12raekit's really weird that this stuff is not in Java
17:13raekI mean, one of the selling points of Java is that it's supposed to be platform independent
17:14tomojwhich is probably why this stuff is not in java..
17:14dnolendpritchett: emacs does that, C-c M-p
17:14dnolenoops, irc window was scrolled up
17:14dpritchettthanks
17:15raektomoj: exactly. apache seems to be one of the actors that has been "filling the gaps" in Java... :)
17:16s450r1raek: 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:21raekhrm, I should continue with my pipes-and-filters/sources-and-sinks/functional-io/blocking-lazy-sequences/streams lib
17:21raek...as always, the naming is the hardest part
17:22sthuebnerI've got a questions regarding closures: In Common Lisp I could do something like (let ((a 1)) (setq a 2) a).
17:23sthuebnerHow can I do a similar thing in Clojure?
17:23raekthe 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:23technomancysthuebner: locals are immutable in clojure
17:24technomancysthuebner: you can close over an atom if you must
17:24raeksthuebner: mutation is handled more explicitly in clojure. there are multiple strategies
17:24raekone could be to use an atom:
17:24raek(def a (atom nil))
17:24raek(reset! a 2)
17:24sthuebnerI'd like to define two functions, that act on the same variable - a socket-server object
17:25sthuebneron starts the server and stores the server object in the var, the other one stops it
17:26raekto stop it, the variable does not have to change, right?
17:26sthuebnerI didn't want to expose that server as a global *server*
17:26sthuebnerraek: no
17:26raekthere is defvar- in clojure.contrib.def for these situations
17:26raekthe hyphen means "private"
17:27sthuebnerraek: OK
17:27raek(a clojure convention is to only name globals with *earmuffs* when they are public variables meant to be reboundable)
17:27raek(sthuebner: you might be interested in this too http://clojure.github.com/clojure-contrib/server-socket-api.html)
17:28raekfor 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:28raek(def server (...create-server...))
17:29raekor (defvar- server (...
17:29sthuebnerraek: I use that server-socket. quiet handy!
17:29sthuebnerquite, I meant
17:30raekyou can mutate global variables with def
17:30raekbut
17:30raekthat is most oftenly only use to redefine a broken function with a working one
17:31raekor other kinds of changes that would not happen in the final system
17:31sthuebnerraek: thanks for all the hints
17:31sthuebnerI think I can stick with the (def server (create-server...)) for now
17:32raekthat is what you see in most hello world servers, anyway
17:34tomojcareful
17:35sthuebnerraek: It's simple enough.
17:35tomojmight need defonce depending on how you work
17:36sthuebnertomoj: good point
17:37tomojI wish assert-args weren't private
17:41bhenrywhen 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:42defnthe project root im guessing
17:42clojurebotwhat time is it?
17:42defnclojurebot: you're annoying
17:42clojurebotNo entiendo
17:44raekprobably from the dir the jvm was started from
17:45technomancybhenry: the JVM doesn't have a useful notion of a working directory. it's just wherever you happen to launch from.
17:45raekI think I heard somewhere that the working directory of the jvm cannot be changed
17:58rhudsonbhenry: there's a :dir option to sh that lets you set its cwd
18:06bhenryrhudson i just read that. thanks.
18:07neotykping tomoj
18:07tomojhello
18:08neotykupdated ahc-clj, take a look if you like it better: http://github.com/neotyk/ahc-clj/tree/issue-1
18:11raekwhat would you feel about programming network clients and servers this way: http://gist.github.com/486687 ?
18:12raekse.raek.pipes is a library for making it easier to code the largest part of a network based program in a functional manner
18:13tomojneotyk: looks cool
18:13tomojI feel a bit weird calling string on the response instead of the body
18:13tomojbut it's fine
18:15neotykI've seen it in http.agent, but felt the same
18:16neotykit could handle both
18:18tomojI think it's fine this way
18:19tomojlooks like you were right originally about baos vs. bais
18:20neotykI always have to check which one is which ;-)
18:20neotykit get's even worse with ByteBuffers
18:21raekflip! :)
18:22neotykraek: exactly
18:23neotyksimplicity was not a requirement for java.nio
18:23kwertiis/java.nio/java/g
18:23sexpbotkwertii: Format is sed [-<user name>] s/<regexp>/<replacement>/ Try $help sed
18:24neotyksexpbot: you should support global replacements ;-)
18:24raekimagine 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:25raekand that you have to remember which state you were in when you returned, in order for you to continue from there
18:25raekand, doing all this in java
18:26raekwelcome to the world of implementing CharsetDecoder!
18:26raekhttp://github.com/raek/utf8-with-fallback/blob/master/src/se/raek/charset/Utf8WithFallbackCharsetDecoder.java
18:28neotykit is good that most of time one can totally avoid those corners
18:42bhenryraek, 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:44lozhtechnomancy: 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:44raekbhenry: clojure.java.io can do the File(Reader|Writer) step too
18:45tomojif there's a way to get it to not hang around, that would be awesome
18:45raek,(doc input-stream)
18:45clojurebotTitim gan éirí ort.
18:45raek,(doc clojure.java.io/input-stream)
18:45clojurebot"([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:46rhudsonbhenry, take a look at clojure.core/with-open
18:46technomancylozh: that's how it works right now; could be changed in the future.
18:47raekyou can do it with (copy (input-stream str-in) (output-stream str-out))
18:48raekthe strings gets turned into Files or URLs, then into Input/OutputStreams
18:48lozhthanks
18:49technomancylozh: well, it may be possible. ant is pretty lousy at being unixy, so who knows if exec is even on the table.
18:49raekif 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:51lozhI just wondered if it was another windows gremlin, I'm not worried if that's how you're expecting it to work
18:52bhenryraek. that looks good.
18:55technomancythere's lots of windows gremlins, but that's not one of them.
18:55raekthe 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:56raekmodulo the PrintWriter part, the clojure way is (writer filename)
18:57raek(also: replace the input/reader parts of my previous utterance with corresponding output/writer)
19:39lozhif I've got an int[] can I convice aget to give me an int rather than an Integer?
19:48chouserlozh: aget does return a primitive int
19:49chouser,(use '[clojure.contrib.repl-utils :only [expression-info]])
19:49clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/repl_utils__init.class or clojure/contrib/repl_utils.clj on classpath:
19:49chouseroh. well, do that and then: (expression-info (aget (int-array [1 2 3]) 0))
19:51raek{:class java.lang.Integer, :primitive? false}
19:54chouserwhat!?
19:55chouserhere I get: {:class long, :primitive? true}
19:56leifwdifferent versions of clojure maybe? what are you each running?
20:06lozhchouser: thanks for that, very useful tool to know about :)
20:20fanaticoHas Rich posted the slides from his emerginglangs talk today?
20:28aria_42If 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:31ausernice aria42
20:40aria_42asuer: thanks! let me know if you get anything out of it.
20:53hiredmanaria_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:06cais2002morning guys
21:07aria_42hiredman: thanks. fixed.
21:09cemerickjkmkjhgftydrftgyikol,kofr65dftgyjuikl,uiku87178i9w34e4bh nmnbvcxsaqiky621t6yuijuhyte4w32qwkmlu5r4jn m,hy7t65rkmjihytrdcfv nhy5431SWE4R5BJN MMN545JMN ,,M8L,.
21:09aria_42hiredman: that's what I get for not copying from my test code
21:13cemerickmmm, sorry
21:21mmarczykRFC on my letrec macro: http://gist.github.com/486880
21:21mmarczyk:-)
21:22mmarczykI'm not even sure if it works... but the ev? / od? example does
21:42chousermmarczyk: ooh, a code walker. did you know about letfn?
21:42mmarczykyup
21:43mmarczyka better example might be (letrec [xs (lazy-seq (filter even? ys)) ys (range 10)] xs)
21:44mmarczykI 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:47tomojI don't get it
21:47mmarczyk(letrec [x (delay y) y :foo] @x) :-)
21:47mmarczyk,(let [x (delay y) y :foo] @x)
21:47clojurebotjava.lang.Exception: Unable to resolve symbol: y in this context
21:47tomojwhat would that do differently than (let [ys (range 10)] (filter even? ys)) ?
21:48mmarczyktomoj: well, not much, except slow things down a tiny bit
21:48mmarczyktomoj: but I was hoping to build mutually recursive things like, say, tying the knot in Haskell etc.
21:48Lajla,(let [Who + Worships 1 His 2 Shadow? 3] (Who Worships His Shadow?))
21:48clojurebot6
21:49tomojoh, I see the difference
21:49tomojdidn't notice that the reference to ys was before the ys binding
21:49mmarczykright
21:58slyrusthe other day (yesterday?) I was asking about test vs src/test
21:58slyruslet me try to rephrase that...
21:59slyrusi 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:00tomojI don't believe it loads anything
22:00slyruswhat's clojurish for (cl:list-all-packages)?
22:01slyrusah, all-ns
22:02aria_42lein sets the classpath of the swank server to src/ resources/ and lib/*jar by default
22:02slyrusok, I see...
22:02mmarczykslyrus: see also c.c.find-namespaces
22:02aria_42I thought it also did test/
22:03mmarczyktest/ is included too
22:03tomoj,(System/getProperty "java.class.path")
22:03clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read)
22:03tomojwell,
22:04mmarczykslyrus: it'll go and hide under your bad, then keeping making weird noises as you try to sleep
22:04mmarczyks/bad/bed/
22:04sexpbotslyrus: it'll go and hide under your bed, then keeping making weird noises as you try to sleep
22:04slyrusyes, like loading my jar instead of my source files... argh...
22:04slyruscan I just have my fasls back please? :)
22:05slyrusI 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:05tomojit puts the source stuff first
22:05tomojso it shouldn't matter
22:06slyrusI thought it did too, but not here.
22:06mmarczykapparently this: http://stackoverflow.com/questions/2761253/graph-representation-in-dr-scheme can be translated to Clojure with my funky letrec :-)
22:06mmarczykwell, this makes me a happy panda
22:06tomojslyrus: 1.2.0?
22:06slyrus"...:/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:06mmarczykchemiclj sounds interesting :-)
22:06slyrushmm... well, maybe not.
22:07tomojhttp://github.com/technomancy/leiningen/commit/d6c50fbc28920f4ea51b04b55ca2826f2d08b8c7
22:07slyrusthanks mmarczyk
22:07slyrusyeah, thanks tomoj
22:08slyrusmmarczyk: 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:08slyruschemiclj is why i needed shortcut (my undirected graphs package) for representing molecules.
22:09mmarczykoh, this is cool
22:10slyruschemiclj?
22:10slyrusi mean chemicl
22:10mmarczykyup
22:10mmarczyk:-)
22:10slyrusthanks!
22:10lancepantzslyrus: you should also check out http://github.com/ninjudd/jiraph
22:10slyrushopefully it will be cooler when it's chemiclj
22:11slyrusalthough I'm not looking forward to rewriting the smiles parser...
22:11slyrusand I should move the rest of my code to github :)
22:11slyrusheh. I thought about giraff for the graphics package name.
22:12slyrussounds like i should talk to ninjudd
22:12mmarczyk:-)
22:13slyruss/should talk/should have talked/
22:13sexpbotsounds like i should have talked to ninjudd
22:13mmarczykincidentally, I could definitely use a Clojure graph library...
22:14slyrusgreat, now you have 3!
22:16mmarczykhm? really?
22:17mmarczykI only know of c.c.graph
22:17mmarczykbut it doesn't do what I need
22:17slyrusshortcut and jiraph being the other two
22:17mmarczykshortcut? interesting
22:17mmarczykjiraph advertises itself as a graph db
22:17slyrusmmarczyk: http://github.com/slyrus/shortcut
22:18mmarczykI want a library of algorithms for use with some representation of graph algorithms convenient to use in Clojure code
22:18mmarczykcool, thanks
22:18slyrusand 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:19mmarczyksounds great :-)
22:19lancepantzthe other option is neo4j, i benchmarked the two and jiraph was an order of magnitude faster
22:19lancepantzthat being said, we didn't implement the full blueprint property graph that neo4j is
22:20mmarczykslyrus: I mean, I'll definitely read it, so I'll share my impressions ;-)
22:20slyruscool, thanks!
22:20lancepantzwe store edges on the nodes themselves, instead of in a separate hash, so each walk essentially has half as many seeks
22:20lancepantzi say we, ninjudd did the heavy lifting on jiraph
22:21mmarczykslyrus: then if sth that I need is missing, I'll definitely try to work towards becoming competent to contribute :-)
22:21mmarczyklancepantz: interesting!, thanks
22:23slyruslancepantz: why do you say it has half as many seeks? you still have to look up the edges, right?
22:23lancepantznope, they are stored in a protocol buffer on the node, so they are already loaded
22:24slyrusumm... assuming the node is loaded. I guess I'm not sure what you mean by loaded though.
22:24lancepantzactually, less than half as many seeks
22:24lancepantzin memory
22:24lancepantzthere is 1 seek per node instead of 1 seek per edge and node
22:26slyrusoh, 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:27tomojlancepantz: I still don't understand jiraph. do you think it might be helpful for neural networks?
22:27tomojdidn't really seem like it when I looked last
22:29aria_42People still use neural nets?
22:29lancepantztomoj: not really, i haven't done neural nets before, but most ai stuff usually works better with matrices
22:30lancepantztomoj: just think of it as a database with arbitrary relationships between rows, and no tables
22:31lancepantzwe use it represent family trees, another use would be social graphs
22:41slyrusmmarczyk: 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:41slyruswith a corresponding (heavyweight?) representation of nodes and edges
22:42mmarczykslyrus: these choices might leave me wondering to which project to contribute the code I'll have to write ;-)
22:42mmarczykslyrus: though from an initial glance, shortcut might save me some pain
22:45mmarczykit'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:47slyruscool. hopefully someone who understands defprotocol/deftype/clojure-in-general than I do will weigh in with some suggestions.
22:47mmarczykslyrus: btw
22:48mmarczykslyrus: I see you're using (first queue) / (subvec queue 1) where queue is a vector
22:48mmarczykslyrus: a clojure.lang.PersistentQueue would probably be better
22:48slyruswhy?
22:48clojurebothttp://clojure.org/rationale
22:48mmarczykclojurebot :-)
22:49mmarczyk,(peek (conj clojure.lang.PersistentQueue 1 2 3))
22:49clojurebotjava.lang.ClassCastException: java.lang.Class cannot be cast to clojure.lang.IPersistentCollection
22:49mmarczyk,(peek (conj clojure.lang.PersistentQueue/EMPTY 1 2 3))
22:49clojurebot1
22:49mmarczyk,(peek (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)))
22:49clojurebot2
22:50mmarczyk,(peek (conj (pop (conj clojure.lang.PersistentQueue/EMPTY 1 2 3)) 4))
22:50clojurebot2
22:50mmarczykconj at end, peek / pop at front
22:50mmarczykalso, subvec prevents the vector you're calling it on from being GC'd
22:51slyrusok, i'll take a look. thanks!
22:51slyrusit would be nice if there were cleaner clojure syntax for queue support though
22:52mmarczykit'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:54mmarczyk(defn queue ([] clojure.lang.PersistentQueue/EMPTY) ([xs] (into (queue) xs))) ? :-)
22:54mmarczykor maybe [& xs]
22:56slyrussome reader support for clojure.lang.PersistentQueue/EMPTY would be nice :)
22:57slyrus#[] or some such
22:57hiredmanQUEUE FISH
22:57hiredmanhttp://clojure-log.n01se.net/date/2010-05-14.html#01:34g
22:58slyrusmmarczyk: I don't understand why you evaluate everything into variables in your letrec macro
22:59slyruswhy not put btes inline instead of in the let?
23:00slyrusand bssl and bexs might better with a destrcutred let of (apply map list (partition 2 binding))
23:01slyrusI take it from this that letfn acts more like flet than labels?
23:06mmarczykqueue fish! cool :-)
23:06mmarczykslyrus: hmm, let me think a moment
23:07slyruswhat is queue fish?
23:08mmarczyk,(conj clojure.lang.PersistentQueue/EMPTY :<=<=<=)
23:08clojurebot#<PersistentQueue clojure.lang.PersistentQueue@82f7129c>
23:08mmarczykawwww, doesn't work anymore
23:08mmarczyksee the link above
23:09mmarczykslyrus: what do you mean by "inline" (btes)?
23:09slyrusI 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:10slyrusthere'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:10mmarczykas 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:11mmarczykslyrus: ah, ok then, got it now :-)
23:11mmarczykit's written this way because that's how I wrote it ;-)
23:12mmarczykI 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:13mmarczykbut if there might be a slight readability edge to this approach, why would I obfuscate it now ;-)
23:17mmarczykslyrus: actually, if I understand the hyperspec correctly, letfn is quite similar to labels, but I wanted Scheme's letrec
23:23tomojisn't there some problem that makes letrec impossible (or just really hard?) in clojure?
23:24mmarczyktomoj: I don't know -- and I sincerely hope mine isn't broken ;-)
23:25mmarczykslyrus: in Scheme, let-bound names are not in scope of the value expressions of the binding forms of their let form
23:25mmarczykslyrus: with letrec, they are
23:26mmarczyk(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:26mmarczykwith letrec, it'll work as intended
23:27mmarczykthere is a requirement that it be possible to evaluate all the value expressions without using the other values
23:27slyrusright, so letrec ~= cl:labels, right?
23:28mmarczyksort of, but I thought CL's labels only allows you to define local functions
23:28lancepantzis there any difference between (declare foo) and (def foo nil)?
23:28mmarczykwhereas in Scheme you can do, say, (letrec ((x (delay y)) y 10) (force x))
23:29slyrussure, but x is still local, right?
23:29tomojlancepantz: try it
23:29mmarczyklancepantz: declare apparently adds {:declare true} to the Var's metadata
23:29tomoj(declare foo) then foo
23:29tomojthen (def foo nil) then foo
23:29lancepantzfair enough tomoj :)
23:29tomojerror, then nil
23:30mmarczykah, right... (declare foo) is more like (def foo)
23:30mmarczykbut with the extra piece of metadata attached -- I wonder what's it for
23:30mmarczykslyrus: right
23:30tomojI don't see that metadata
23:31tomojuser> (do (declare baz) (meta #'baz))
23:31tomoj{:ns #<Namespace user>, :name baz}
23:31tomoj
23:31mmarczykhm, funny
23:31tomojdid I do it wrong?
23:31mmarczykno, not that I can see
23:32lancepantzas far as evaluation they both seem to behave the same
23:32mmarczyktomoj: aha! (declare ^String foo)
23:32tomoj(def foo) and (declare foo) ?
23:32lancepantzi dont get an exception on either
23:32tomojhuh?
23:32lancepantz(def foo nil) and (declare foo)
23:32tomojtry (declare baz), then baz
23:32mmarczykI wonder if vary-meta should act differently when there's no metadata already present
23:33tomojI see, :declared true now, weird
23:33lancepantztomoj: correct, you're right
23:33tomojhmm
23:33tomojis that a bug?
23:34mmarczykslyrus: 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:34mmarczyktomoj: dunno, but if it is, it's in vary-meta
23:35mmarczykI think.
23:36mmarczykaaaaaaa.
23:36mmarczykno it isn't in vary-meta
23:38tomojswank.core/break inside a macro is weeeird
23:38tomojmmarczyk: what is it?
23:38slyrusmmarczyk: 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:38slyruswhy do you need your letrec?
23:38mmarczyktomoj: see (def ^{:declared true} baz), then (meta #'baz)
23:39mmarczykslyrus: I don't for this
23:39mmarczykslyrus: have a look at the other two examples in the Gist
23:39slyrusok, the second one: (let [ys (range 10) xs (lazy-seq (filter even? ys))] xs)
23:39tomojmmarczyk: why does that happen?
23:39mmarczyktomoj: beats me
23:40slyrusah, I see. for third one your hosed.
23:40mmarczyktomoj: I'm considering a trip to clojure/lang/Compiler.java to find out, but it is 5.40 am ... :-)
23:40tomojhaha
23:41mmarczykslyrus: right! :-)
23:41tomojsimilarly (def ^{:file "foo"} baz)
23:42mmarczykslyrus: the ultimate goal would be to tie the knot in Clojure :-)
23:42tomojincludesExplicitMetadata is involved in the conspiracy
23:42mmarczyktomoj: hah! sniffing around then? :-)
23:42slyrusmmarczyk: 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:42tomojbut I'm giving up now because I don't really care anyway
23:46mmarczykslyrus: hrmpf :-P
23:48mmarczykslyrus: 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:49mmarczykslyrus: are you convinced it'll always be possible?
23:51mmarczykslyrus: 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:51mmarczyk(here's the link to what I'm talking about, btw: http://www.haskell.org/haskellwiki/Tying_the_Knot)
23:54aria_42Sure, this has been asked to death, but any slides for rhickey's pod-talk?
23:54mmarczyktomoj: DECLARED_KEY is interned in RT.java and used in that one function in Compiler.java... otherwise it isn't used anywhere
23:54mmarczyktomoj: :declared only appears in clojure.core/declare
23:55mmarczyktomoj: apparently Clojure doesn't care about this lone piece of metadata at all...
23:58tomojodd