#clojure logs

2009-12-23

00:00technomancysure
00:00defn(anyone is welcome really)
00:00defnhttp://github.com/defn/cljex
00:00defnsrc/cljex/* -- im trying to organize it better
00:00defnit seems like a real mess right now
00:02defni *just* added the controller and view directories, i think that will go a long way in cleaning some of it up
00:02defni guess one of my questions is: is a config.clj ill-advised?
00:02technomancygotta get your .gitignore to skip .# autosaves
00:04technomancydefn: project-root seems to assume that you're always running out of a checkout
00:04defnhaha yes i was just noticing that
00:04technomancyIMHO it's a better idea to keep your app code in one place and your data code somewhere else
00:04technomancys/data code/data/
00:04technomancyanyway, then it won't break if you try to run it out of a jar or a server container or what have you
00:05defnso would you recommend putting public and docs and such in the root?
00:05technomancyyeah
00:05defni know you have a "resources" thing with leiningen, but im not sure how to go about using such a thing
00:05technomancyresources would be for read-only data
00:05technomancyI'd have your config file be a map serialized to disk
00:06defnanother problem ive been having is that when im in a REPL, the output from System/getProperty "user.dir" is always wrong
00:06technomancyyeah, relying on that kind of stuff is troublesome
00:07defnmainly im just trying to get paths nailed down, but ive been having some trouble
00:07technomancyhave a set of default config values, then check (System/getProperty "cljex.config") to see if it points to a map on disk; if it does then merge it with the default config map
00:07technomancyI'd say you should require the data path to be explicitly passed in
00:07technomancyeither through an environment variable or a property
00:07defnah, that's interesting
00:08defnhow do you create such a property: "cljex.config"?
00:08technomancyor a command-line arg
00:08technomancyjust launch it with java -cp [...] -Dcljex.config=/etc/cljex.clj [...]
00:08technomancyyou can have as many -D properties as you like
00:08defnah, cool!
00:09technomancyman... there's so many little things like this that are just not documented in the context of clojure
00:09defnyeah, why do you think im working on this project?
00:09defn;)
00:09technomancyyou have to pick it out of java-specific docs
00:09technomancyheh
00:09defni so do miss the ruby documentation
00:09technomancywell it looks like most of this is clojure-specific
00:09technomancyI'm talking about JVM-level quirks
00:10defnsure sure -- it's not the same thing, but it's along the same lines
00:10defndocumentation is key
00:10technomancyespecially I/O related classes; you just have to figure that stuff out for yourself
00:10technomancyyeah, I mean it makes sense to start with clojure functions etc
00:11defni feel like a big part of the whole endeavor is just getting people to document things like this in a coherent way
00:11technomancybut yeah, I hope this takes off
00:11defnit's slow going, but i hope it does too
00:11defnthanks for the support :)
00:12defni just sent in my contributer agreement to rhickey -- i'm hoping to dig in a bit more so I can document things as they develop
00:12defnthe 1.1.0 stuff is cool, but so sparsely documented
00:13defnif you're lucky you can find 1-3 posts on the internet of people showing how they use it
00:13defn(chunked-seqs, transients, etc)
00:13technomancyI thought the docs for transients were pretty thorough.
00:14somniumthe chunk family doesnt even have doc strings
00:14defnlook at this: http://richhickey.github.com/clojure/clojure.core-api.html#clojure.core/transient
00:15defn*puke*
00:15defnwtf is that?
00:15technomancyoh, I meant http://clojure.org/transients
00:15defnoh sure, but why nothing in the API? it's unnerving to me :\
00:15technomancypresumably the docstring will get fixed before the release
00:16defnthe whole reason i started this project is that guessing at the API docs is a recipe for confusion
00:16defnso many weird references to single character :args meta
00:17defnlike:
00:17defn,(doc chunk)
00:17clojurebot"([b]); "
00:17defnwtf is b?
00:17_mstChunkBuffer!
00:17_mstdon't ask me how to create one though ;)
00:18defn,(doc print-doc)
00:18clojurebot"([v]); "
00:18somniumdefn: at this point the chunk fns dont neem intended for users
00:18defnhow about that one?
00:18defnwhat is v?
00:18defna var?
00:18defna vector?
00:18_mstI guessed var :)
00:18danlarkinuse the source, young skywalker
00:18somniumdefn: when you see doc-strings like that its time to read the source
00:19defndanlarkin: somnium: i can read source, that's all well and good, but it bothers me that it's not more explicit
00:19defnwhy the information-hidey-ness?
00:19danlarkin"patches welcome :)"
00:19defnhaha :) i just sent in my contributer agreement :)
00:20somniumdefn: try doing (defn foo [v]) (doc foo)
00:22defnsomnium: sure, i know how they get there, why they're there and all, i just feel like there needs to be some more elaboration in the API documentation -- the API docs as they stand now are just these automatically generated docstrings pushed to a website
00:23defnim sure this is efficient and easy, but people who are new to the language with no lisp background, with no java background, they're juggling enough as it is without adding another level of complexity to the matter
00:23defni shouldn't have to read and understand the whole of clojure.core source in order to write a program
00:25defni mean, im not opposed to it, i think it's a great learning experience, but there are many folks who are going to give up long before they get to reading source, and i think that's a shame
00:25somniumI would posit that people with no java or lisp background learning clojure have enough intellectual curiosity to poke around in the source when needed
00:25defnsomnium: right now yes, but in the future, that's likely going to change
00:26defnclojure has been getting a lot of attention, lots of noobs afoot
00:26defnmyself included
00:27somniumI think a very thorough explanation of special forms would be good for newbs
00:27somniumafter that clojure.core isnt hard to read IMO
00:27defnnot hard to read no, but i am big on examples, i dunno, in general, writing good documentation to me means diversifying the methods of explanation
00:28somniummy main issue with core is all the java poking up into it, but maybe Ill get over that
00:28defnclojure currently has the core API which is very terse, and it has people who are writing blog posts about how to use it
00:29defni think it could be so much more rich with an API that did some of the blogger's work for them
00:29defn(the documentation i mean)
00:29defn(extended-print-doc)
00:30defn:)
00:31defnsomnium: the java bothered me without a doubt, but im slowly getting used to it -- remembering that java's garbage collection is the reason i use clojure in the first place gives me a bit of pause
00:31somniumdefn: well, I hope your effort takes off. rdoc got me up and running with ruby very quickly
00:32technomancyyeah, the docstrings that just say "see http://clojure.org/special-forms" are rather ill-advised IMO
00:34technomancydefn: is this application meant to be read/write or just a web frontend to some hard-coded data?
00:34somniumits not the java per se that bothers me, all the opaque calls to c.l.RT and etc, and the java tends to have less documentation than the clojure at this point
00:34defntechnomancy: front-end for the time being, but in the future a wiki-esque sort of thing
00:34technomancycool
00:35defntechnomancy: which do you prefer?
00:36technomancyI think a wiki is the right idea, but leaving it at the web I'm not so fond of. Ideally further down the road you could download a jar that would contain all the docs as well as some reader functions
00:36technomancythen you could do (explain chunk) from the repl to see the detailed examples
00:36defnthat's awesome i didn't even really consider that
00:36technomancythat way slime and the IDEs could provide integrated help
00:36technomancyI'm more likely to use docs that don't involve a context switch
00:37defnim so new to the idea of building jars and all that i dont really know what's possible
00:37technomancysure, the jar can contain mostly data
00:37defnkind of like javadoc technomancy?
00:37technomancyI dunno; I've only used javadoc in the context of a browser
00:37technomancyI think it's HTML-only
00:37defnsomething i would love to see done in clojure (that i just dont know enough about clojure to build yet) is something like _why's what_method?
00:37technomancyI'm thinking of repl-level interaction
00:37defn(what-makes "abc" "ABC")
00:38slashus2Is there already a "clojuredoc" generator sort of thing?
00:38defnyes
00:38technomancyslashus2: there is, but it's currently designed only to work with contrib and clojure itself
00:38technomancyhasn't really been generalized
00:38technomancyand it relies on good docstrings; I think defn's effort is meant to supplement the docstrings
00:38defn*nod*
00:39slashus2That sounds like a good idea. I found myself in the beginning reading the core source to learn about the language and how it works.
00:39defnmaybe i should include the source on every page as well...
00:39somniummaybe a metadata database in something like json, then it could be consumed on and offline by whatever app
00:40defn(source ...) is awfully handy
00:40defnsomnium: ! so many good ideas
00:40slashus2Aside from the complex macros, it is very readable.
00:41technomancymy favourite thing about core.clj is how the readability improves as you get further into it.
00:41technomancyit's like a good wine
00:41slashus2very true
00:41defntechnomancy: definitely
00:42defnbut i'd be hard pressed to disagree with any sort of reference to good wine
00:42technomancyactually I'm not sure that good wine is like that
00:42defntbqh
00:42technomancyyeah
00:42ubiibeing a beer drinker myself, I am still learning to develop a taste for wine
00:42slashus2It was really the first language that I bothered to look at the core implementation's source.
00:42q1(bean ...) is good too
00:42technomancymaybe bad beer would be a better analogy
00:43somnium:)
00:43defnone could also be a jerk and say: "it's like women..the more beer you drink..."
00:43somniumclojure.core: like bad beer in a good way
00:44defnby line 1000 of core.clj you start to really enjoy the `~name because it's closing time, and well, you haven't written anything in a long time
00:44somnium,(macroexpand '(for [x (range 10)] (* x x)))
00:44clojurebot(let* [iter__6014__auto__ (clojure.core/fn iter__4083 [s__4084] (clojure.core/lazy-seq (clojure.core/loop [s__4084 s__4084] (clojure.core/when-let [s__4084 (clojure.core/seq s__4084)] (if (clojure.core/chunked-seq? s__4084) (clojure.core/let [c__6012__auto__ (clojure.core/chunk-first s__4084) size__6013__auto__ (clojure.core/int (clojure.core/count c__6012__auto__)) b__4086 (clojure.core/chunk-buffer size__6013__auto__)]
00:44slashus2noes
00:44defnoi vey!
00:45ubiitoo many of the languages that I have started to hack around with are like women, in that they look good from afar, but once you get up close, they really are not that great
00:45defnthe implemented chunks in for now?
00:45defni thought it was only filter and ....
00:45somniumlet* confused the hell out of me at first
00:45slashus2I think Rich did it for all of the higher order functions.
00:45defncool
00:46ubiiwhoops, I should say, like some women
00:46somnium(doc let)
00:46clojurebot"([bindings & body]); Evaluates the exprs in a lexical context in which the symbols in the binding-forms are bound to their respective init-exprs or parts therein."
00:46defnubii: hehe, yeah you wouldn't want to be a /gay/ nerd.
00:46defn(doc let*)
00:46clojurebotTitim gan éirí ort.
00:46somniumhmm, I get the special forms message at my repl
00:47slashus2Have you all noticed that the transient implementation could probably be moved up a little in the core? Maybe it could be used to implement a few of the other core functions? (I may be wrong about this)
00:47defnsomnium: same here, why is that?
00:47defnweird...
00:47somniumlet* is a compiler symbol
00:48somnium,(let* [x 1] x)
00:48clojurebot1
00:48somnium(resolve 'let*)
00:49somnium,(resolve 'let*)
00:49clojurebotnil
00:49defnhe's choking
00:49pdknothing motivates you to begrudgingly take another look at emacs as trying out 3 different ides all not wanting to work
00:49defn,(macroexpand-1 (let* [x 1] x))
00:49clojurebot1
00:50pdkit's as if they magically become impossible when you add clojure into the mix
00:50defnit's as if they were impossible to begin with
00:51ubiipdk: which ides did you try?
00:51pdki tried the clojure plugins in eclipse idea and netbeans so far
00:51pdkwith eclipse it flipped out and cried trying to open an individual clj file
00:51pdksomething about one of the base classes not having a filename property
00:51pdkidea pissed me off with how it refuses to open individual files outside of a project window
00:52somniumhttp://tinypic.com/view.php?pic=2w40c9t&s=6
00:52pdkand netbeans just sits and stares if i try to open a file
00:52somnium^^ why would anyone not want to use emacs? :-)
00:52ubiididn't try eclipse, but had netbeans 6.8 working, before I re-installed the OS on my laptop
00:53pdksome of us would be perfectly happy just to have a notepad++ level editor with proper lisp indenting
00:53defnif it doesn't have paredit-mode
00:53defni dont want to talk about it
00:54pdkhm true
00:54somniumpdk: you say that now, but you havent used paredit
00:54defna lisp editor without paredit-mode is like a human being without genitalia
00:54ubiiin other words, not that fun
00:54pdkok forget the ides for tonight
00:55ubiipdk, I gave up and decided to just man up and use emacs
00:55somniumdefn: Im not sure thats the metaphor I would have used, but enclojure is painful without paredit
00:56somniumon the unfortunate occasions when Ive needed to write .java it comes in handy though
00:57defnsomnium: my metaphor skills are obvious
00:57somnium:)
00:57somniumdefn: looking forward to getclojure.org
00:58defnone thing i have to say, without gushing too much I hope, is how great this community is
00:58defnlots of great personalities amongst us
00:58defnamong us*
00:59defn^^case in point
00:59ubiidefn: is getclojure.org going to be the home of your new app?
00:59defnubii: yeah eventually, im a newb
01:00ubiicool
01:00defnive just never been so taken by a language before. i thought ruby was cool, but the allure of a lisp, concurrency, functional programming, transients, chunked-seqs, so many fantastic ideas and new directions
01:00defnit's very exciting
01:02ubiiI have always been interested in lisp, but just never got around to trying to learn it, now with clojure I have an excuse
01:02defnsame here
01:02defnwatching rich's talks was just mind blowing
01:02somniumI tried common-lisp, and I hated it
01:02defnhis talk "Are we there yet?" and his talk with Brian Beckman
01:02ubiiI am tired of drinking the ruby kool-aid and am looking for a change
01:02defnive watched them like 100 times
01:03ubiihmm, haven't seen that one yet
01:03defnthe are we there yet?
01:03ubiicorrect
01:03defnhttp://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey
01:03defnyou saw the beckman video
01:03defn?
01:04somniumI expect Rich's ideas will have a lot of influence beyond clojure in the years to come
01:04defnsomnium: yeah that's why it's exciting
01:04defni totally agree
01:04defnive tried to explain this to friends and they think im evangelizing, but it's a total paradigm shift
01:05defnone of the questions at the end of the "Are we there yet?" talk is a guy basically saying rich is repeating the history of philosophy with this sort of new synthesis of ideas
01:05ubiiwhat is the link to the beckman video?
01:06defnhttp://channel9.msdn.com/shows/Going+Deep/Expert-to-Expert-Rich-Hickey-and-Brian-Beckman-Inside-Clojure/
01:07defnubii: enjoy. some good stuff there :)
01:07ubiino haven't seen that either
01:07defni think you'll appreciate the are we there yet talk after watching the beckman interview
01:10ubiithe only screencasts that I have watched so far are Rich's 90 minute An Introduction for Lisp Programmers, the peepcode clojure screencast, and a 10 part clojure screencast on youtube
01:10defnthose are good
01:10defnbut the beckman interview is a very conversational introduction which i enjoyed
01:11ubiigoing to watch that right now
01:11defnand then are we there yet talk is sort of a window into the thought process behind clojure
01:11defnwhich i think is very revealing
01:11defnit sort of gives you a framework to understand clojure's trajectory
01:12ubiithough I really should be working on some ruby projects for my clients
01:12defn:)
01:12defni spent 6 hours today at work working on clojure
01:12defni should be fired tbqh
01:12defni feel guilty the whole time, but I can't stop
01:13ubiiI am a freelancer and work from home, so no big brother to worry about :)
01:13defnubii: nice to meet you :)
01:13defn<-devin
01:14ubiiplus, I set my own hours, so if I spent x amount of hours learning clojure and "not" working, then I can alway make it up later
01:14ubiithough there are these things called deadlines, that I sometimes need to worry about
01:15ubiidefn: you too
01:15defnubii: did you just start clojure today?
01:16ubiiseems like most of my clients are trying to squeeze as much as they can in before the end of the year, so the last month or so has been crazy busy
01:17ubiidefn: I starting reading up on it and watching some screencast a couple of months ago, but I have been so busy with work lately, that I haven't been able to "officially" sit down and start learning it until this week
01:19defnubii: i failed a class to work on it -- it takes time with no lisp and java experience
01:19defnbut it's coming along
01:19ubiispent most of my time before, playing around with various editors/ides, including emacs, trying to decide what to use, before I got started actually learning the language
01:20defnlearning emacs is fantastic, paredit-mode is great, slime is great
01:20defnand with it being elisp, you get sort of a mini clojure (lisp) education in the process of messing with your config
01:21ubiinever really touch lisp before, but have worked with Java before, so that aspect is not foreign
01:21ubiis/touch/touched/
01:21defnive worked with java, but never professionally, only silly academic things that didn't need to *work*
01:22defni never had to package up a jar, or if i did, i did it unknowingly via an IDE
01:22ubiimost of my professional java experience has been more on the project management side, with a wee bit of pair programming with one of my developer at my last job
01:22ubiiother than that, I have several college classes on Java
01:23somniumubii: you may find inf-ruby (written by Matz) and Rinari (for rails) will help the 12-step-program move along faster
01:23ubiithough to be honest, it has been years since I have touched Java, so I am beyond rusty
01:24ubiiyeah, I will have to check them out
01:24somniuminf-ruby is what originally gon me hooked on emacs
01:28ubiiwow, Beckman is an Astrophysicst, which is another field that I have interest in
01:28defnsomnium: i haven't used inf-ruby much
01:28defnsomnium: what you're favorite thing about it?
01:29somniumdefn: its like slime-lite
01:29defndoes it link your .rb file with an irb repl?
01:30somniumdefn: it runs an inferier irb process and you can send it whatever you want
01:31defnfrom a source file though, yes?
01:31defnLike C-x C-e
01:31defnto get a method into the inferior ruby?
01:31somniumdefn: sure, from clipboard, from file, jruby, mri, whatever
01:32defncool
01:32defnill have to check that out more
01:32somniumI dont recall the bindings off hand, C-h b is for that
01:32defni tried inf-ruby before i knew antyhing about slime
01:32defnM-. is the greatest function ever
01:32somniummozrepl for js is cool too
01:33somniumnothing matches slime though
01:33defni was amazed when i hit M-. on accident
01:33defni thought i'd have to scroll through core.clj
01:33somniumdefn: what is it mapped to?
01:34defn(slime-edit-definition)
01:34ubiifind a tag
01:34defnLookup the definition of the name at a point.
01:34somniummy keybindings are all over the place now with dvorak + ergoemacs
01:34defnwhy dvorak?
01:35defni read up on it and it doesnt look more efficient
01:35somniumdefn: 80% of keypresses on the home row
01:36defnyeah but it's not really faster
01:36somniummy fingers were starting to hurt from emacs so I decided to learn dvorak and switch to ergoemacs
01:36defnit's like if i invented a new home row that exists on the left half of the keyboard
01:36somniumdefn: ?
01:36defnand then claimed it was more efficient because i put commonly used chars together
01:37somniumdefn: a lot of research went into the design
01:37somniumdefn: finger strength, occurence frequency, etc
01:38somniumanyway, my fingers never hurt now so I quite like it
01:38somniumbut it was an awkward first week
01:38ubiinot feeling the love on the Beckman video, as it is still caching and has not started to play yet :(
01:38defnubii: download the wmv
01:38defnor whatever format
01:38ubiiyeah, I should
01:38defnim watching it again now
01:39defn:)
01:39ubiibad enough that you sent me out to Microsoft related site :)
01:39ubiimaybe that is why it is not working :)
01:41somniumdefn: one question, why is semi-colon on the home row? :)
01:41ubiihmm 526MB download, let me try a differnt format
01:42defnsomnium: touché
01:43defnsomnium: ubii: i have to go -- girlfriend is giving me the eye via text message
01:43ubiilater
01:43defnit was good talking to you both, ill see you around, oh and, contribute to cljex! :)
01:43defnlots of low hanging fruit
01:46somniumcheers
01:50ubiiguess I should bail, so I can get some work done, while I am waiting for this video to download
01:51ubiilater
01:52somniumciao
03:56astertronisticon\help
03:57astertronisticon\nickserv
05:06triyoI have a map of key/value pairs whos keys match to my function's parameter names. How do I utilize destructuring here without needing to use something like let to bind each param individually?
05:07triyoI've seens examples but cat for the life of me remember where.
05:07triyo*seen
05:10cark(defn my-func [{:keys [param1 param2]}] ... )
05:10carkor
05:11cark(defn my-func [{param1 :param1 param2 :param2}] ... )
05:11carki never use the second one so it might be wrong
05:12carkanyways the info is available there : http://clojure.org/special_forms
05:13triyothx cark
05:14carki think there should be a separate page on destructuring on the clojure web site
05:15triyoI agree
05:17carkthere is also a defnk macro somewhere that does that plumbing for you
05:18carkin contrib
05:20triyodef api
05:24fliebel,(doc ->>) ;returns an error on my computer
05:24clojurebot"([x form] [x form & more]); Threads the expr through the forms. Inserts x as the last item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the last item in second form, etc."
05:26fliebelWhat can possibly be the problem? I'm just running Clojure 1.0 Is ->> new or deprecated?
05:26arbschtfliebel: newer than 1.0
05:27fliebelarbscht: so I need to get the 1.1 rc?
05:28talios'lo arbscht
05:28arbschtfliebel: that should help
05:28arbschttalios: hey
05:28talioshow goes?
05:29arbschtalright. haven't written much code this month, hoping to dive into 1.1 rc before the year end :p
05:29fliebelWhere do I get clojure-contrib for 1.1rc?
05:30taliosthey're both on build.clojure.org/snapshots
05:30talios(maven repo
05:34fliebeltalios: hey, that worked!
05:35fliebelAlthough I'm not sure I got a compatible contib now
05:35taliosboth should be 1.1-master-SNAPSHOT I think
05:36talioswhich is what I'm using currently
05:36talioser 1.1.0-master-SNAPSHOT
05:36fliebeltalios: I just picked clojure from the google code thing where the download link goes on the clojure website
05:36taliosah ok - the build.clojure.org is from the hudson continuous build
05:37fliebelI'll pick the other clojure...
05:38taliosmm, I really should finnish up more of this maven DSL
05:38talioswhat are you guys using to build your clojure foo? maven? leiningen?
05:38taliosant? or just the REPL
05:39fliebelI'd like to know that as well...
05:39arbschtlein and ant (separately) for me
05:40taliosfliebel - seems quite a few are using my maven-clojure-plugin, and quite a few people are looking forward to my maven/clojure polyglot work ( which looks similar to leiningen)
05:41fliebelI think most of them use lein… I never looked into building things yet.
05:56fliebelI got something strange: clj does not stop after running a file.
05:57fliebelIt just runs this: java -classpath /opt/local/share/java/clojure/lib/*:. clojure.main $1
05:58fliebelIt just keeps saying "Java" at the top of my terminal.
05:59Chousukefliebel: maybe you need to call shutdown-agents?
06:00fliebelchousuke: The thought didn't even occur to me… Do I need to kill agents? :P
06:02Chousukekill? well, you need to make sure they don't have an action running in an infinite loop :/
06:02Chousukethe jvm won't exit as long as there are threads alive.
06:02fliebelI never used a def on them, so when I'm done it's out of all scopes and could be garbage collected, can't it?
06:03Chousukeshutdow-agents closes the threadpool
06:03fliebelok… I'll try that
06:03Chousukethe agent objects themselves don't really matter.
06:03fliebelok
06:04fliebelWorked!
06:04taliosdoh - bug report on the clojure-maven-plugin 1.2 already :( reproducable, but not sure -why- :(
06:05taliosgrr maven
06:09neotyktalios: do you need some help with maven?
06:10taliosjust looking through my diffs to see what might have triggered it - for some reason my goal isn't getting test deps, even thou the mojo has "@requiresDependencyResolution test"
06:12neotyktalios: have you looked at generated plugin.xml ?
06:14taliosgenerated plugin.xml says test.
06:14taliosmm, actualy - I look in the one in the jar as well
06:15taliosand that was test as well
06:17taliosmmmm, I wonder.... I moved a bunch of things to my Abstract parent class, which doesn't has the @requiresDep... annotation. I guess thats it.
06:18fliebelDoes anyone know a good auto pair plugin for vim? When I type "(" I automatically get ")", but it is a little "arrogant", when I just want a single ( or ) because I added some code in between I have to do some extensive fiddling to get it to do that. I'm now thinking about disabling it, but it's a great thing to have, if it works.
06:39metoo,(-> 2 inc dec)
06:39clojurebot2
06:40metoo,(-> 2 #(+ 3 %))
06:40clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.ISeq
06:40metoo,(-> 2 (#(+ 3 %)))
06:40clojurebot5
06:41metoowhy here i have to add another '()?
06:41metoo,(-> 2 (+ 3))
06:41clojurebot5
06:41metoo,(-> 2 print)
06:41clojurebot2
06:42metoo,print
06:42clojurebot#<core$print__5678 clojure.core$print__5678@15e3abb>
06:42carkwhen the -> macro see a list, it applies the result to the first element (a function) of that list
06:42metoo,#(+ 3 %)
06:42clojurebot#<sandbox$eval__4183$fn__4185 sandbox$eval__4183$fn__4185@39a07>
06:43hiredman,(macroexpand '#(+ 3))
06:43clojurebot(fn* [] (+ 3))
06:43hiredman,(macroexpand '(-> 2 #(+ 3)))
06:43clojurebot(fn* 2 [] (+ 3))
06:43metoohmm
06:45metooso -> think #(..) as a list?
06:45hiredmanit is a list
06:45hiredman#() is expanded by the reader to (fn* ..)
06:46metooic, but this is abit odd
06:46hiredmanit's not
06:46metoo,(-> 2 (fn [x] (+ x 2)))
06:46clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:46hiredmanfn*
06:47cark,(-> 2 ((fn [x] (+ x 2))))
06:47clojurebot4
06:47hiredman~macro
06:47clojurebotmacro are just a game with symbols
06:47hiredmangah
06:47hiredmanclojurebot: forget macro|are|just a game with symbols
06:47clojurebotI forgot macro|are|just a game with symbols
06:48hiredman~macro
06:48clojurebotmacro are just a game with symbols
06:48hiredmanliar
06:48carkit's true that it would be nicer to have it understand it the way metoo wants
06:48carkit wouldn't be that hard
06:48carkmake ti a special case for (fn* and (fn
06:48metoosure
06:49carkjust for fn* actually
06:50hiredmancark: I prefer consistency
06:50carktrue, let's just say it's a close call here
06:51carkthis double parenthesis thing is quite ugly
06:51metoo,(fn [x] (+ x 1) 2)
06:51clojurebot#<sandbox$eval__4201$fn__4203 sandbox$eval__4201$fn__4203@1fb4a7b>
06:51metoooops
06:51fliebelwhat is fn*? my doc doesn't find it.
06:51metoo,((fn [x] (+ x 1)) 2)
06:51clojurebot3
06:52hiredmanfliebel: fn is actually not a special form, it is a macro that emits fn*
06:52hiredmanfn* is the special form
06:52metoo,(-> 2 (fn [x] (+ x 1)))
06:52clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:52metooit's not consistency
06:52hiredmanit is
06:52metoo,(-> 2 (print))
06:53clojurebot2
06:53hiredman,(macroexpand '(-> 1 (fn [] )))
06:53clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.UnsupportedOperationException: nth not supported on this type: Integer
06:53hiredman,(macroexpand '(-> 1 (fn* [] )))
06:53clojurebot(fn* 1 [])
06:53hiredman,(macroexpand '(-> 1 (print)))
06:53clojurebot(print 1)
06:53hiredmancompletely uniform
06:54the-kenny ,(macroexpand '(->> 1 (fn* [] )))
06:54the-kenny,(macroexpand '(->> 1 (fn* [] )))
06:54clojurebot(fn* [] 1)
06:54metoo,(macroexpend '(->1 print))
06:54clojurebotjava.lang.Exception: Unable to resolve symbol: macroexpend in this context
06:54hiredmanmetoo: I just did that
06:54fliebelWhat is a ctor?
06:54hiredmanconstructor
06:56metooprint is a function (fn ...) also function, why act not same?
06:57the-kennymetoo: Where does it differ?
06:57hiredmanmetoo: print is a symbol
06:57hiredman-> is a macro
06:57metooand (fn ..) is a list?
06:57hiredmanit operates before any symbol resolution or function creation
06:58hiredmanit is a list
06:58metooi think ->/->> macro should know (fn..) as special form just like cark said
06:58hiredman(-> 1 print) generates the list (print 1) which when evaluated is a function call
06:59hiredmanmetoo: nope
06:59the-kennymetoo: Then you would have to implement dozens of special cases for every single macro
06:59hiredman(-> 1 (fn* [] )) generates the list (fn* 1 []) when evaluated this is not a valid form
07:01carkthe-kenny : no there would be a single special case
07:01carkbut yes i'm not sure that's a good idea
07:01metoofunction in clojure isnot first class member just like haskell?
07:01the-kennycark: and what should the special case do?
07:02the-kennymetoo: They are, but they are accessed through symbols
07:02carkcheck if the first element iof the list is fn*
07:02hiredmanmetoo: -> is a macro
07:02hiredmanit operates on the datastructures generated by the reader
07:02metoo->/->> thread inside functions
07:03hiredman,(read-string "(fn [] )")
07:03clojurebot(fn [])
07:03hiredman,(list? (read-string "(fn [] )"))
07:03clojurebottrue
07:04metooso, it just a list, not others,right?
07:04hiredman"not others"?
07:04metoothis list eval to one function
07:04hiredman,(list? (read-string "(+ 1 2)"))
07:04clojurebottrue
07:04hiredmanafter macro expansion
07:05fliebelWhy doesn't this work? (-> "/path/to/file"
07:05fliebel (FileWriter.)
07:05fliebel (BufferedWriter.)
07:05fliebel (.write "content"))
07:05hiredman(fn [] ) does not become a function until after -> is done
07:05hiredman,(macroexpand '(Foo.))
07:05clojurebot(new Foo)
07:05metooi got the point, but i think it 's not natural :)
07:06hiredmanFoo. is a reader macro
07:06hiredmanmetoo: it is
07:06hiredmanmetoo: you just don't know macros
07:06fliebelhiredman: so I need to insert the path somewhere in the middle?
07:06hiredmanfliebel: loose the parens
07:06hiredmanlose
07:06hiredman(-> "foo" Foo. Bar. Baz.)
07:08fliebelhiredman: (-> "/path/to/file"
07:08fliebel FileWriter.
07:08fliebel BufferedWriter.
07:08fliebel (.write "content"))
07:09fliebelNo matching method found: write for class java.io.BufferedWriter
07:10hiredmanwell check the javadocs for BufferedWriter
07:10fliebelthe problem is this:
07:10hiredmanfliebel: no
07:10fliebel,(macroexpand '(.write java.io.writer.))
07:10clojurebotjava.lang.ClassNotFoundException: java.io.writer.
07:10hiredmanstop
07:10hiredmanStop!
07:11hiredmando not continue until you have read the java docs for bufferedwriter
07:11fliebelI did....
07:11hiredmanare you sure?
07:12metooWriter?
07:12hiredmanok
07:12fliebelhiredman: It inherits a write
07:13the-kennyfliebel: and write takes a string?
07:13fliebelhiredman: the problem is that .write turns into (. (java.io.Writer.) write)
07:13fliebelhiredman: http://java.sun.com/j2se/1.5.0/docs/api/java/io/Writer.html#write(java.lang.String)
07:14hiredmanthat is not a problem
07:14hiredmanfliebel: works fine here
07:15hiredmanso you must be doing something different
07:15fliebelhmh, I think I found it :$ I wasn't supplying a string, but a list containing a string :$
07:16metooshuld work
07:17fliebelexcept that it did not write anything :( But before starting to worry, let's double check my string :D
07:18the-kennyfliebel: with-open?
07:19the-kenny,(doc with-open)
07:19clojurebot"([bindings & body]); bindings => [name init ...] Evaluates body in a try expression with names bound to the values of the inits, and a finally clause that calls (.close name) on each name in reverse order."
07:19hiredmanfliebel: you have to close your streams
07:19fliebelah...
07:19hiredmanmetoo: go write your own language, please
07:20hiredmanor take some time and learn clojure instead of sitting around saying "should work"
07:20hiredmanwell
07:20hiredmanclose or flush
07:20hiredmanclosing flushes
07:21metoohiredman: i mean fliebel's code should work
07:21fliebelhiredman: so I can't use -> because write returns nothing.
07:22hiredmana. use with-open, b. (-> "foo" Writer. (doto (.write "x") .close))
07:23hiredman(with-open [w (-> "foo" Writer.)] (.write w "x"))
07:24fliebelhmhm
07:25fliebelit worked!
07:58fliebelWhat should I put in a leiningen file for clojure and clojure-contrib?
08:02somnium :dependencies [[org.clojure/clojure "1.1.0-master-SNAPSHOT"] [org.clojure/clojure-contrib "1.1.0-master-SNAPSHOT"]]
08:02the-kenny1.1.0-new-SNAPSHOT is also possible for clojure too
08:02the-kenny(new branch)
08:03fliebelwhat is the difference?
08:03the-kennynew vs. master branch
08:03somniumthe-kenny: I had trouble getting new-SNAPSHOT to work with swank last time I tried, have you had trouble?
08:04fliebelah *looks puzzled, assumes git speak*
08:04the-kennyfliebel: yes, git branches ;)
08:04the-kennysomnium: Yes, I had problems too.. but I had a working setup with new in another project.. strange stuff ;)
08:04somniumthe-kenny: I suspect it might be lein's fault
08:05somniumI had it working when I was doing it by hand
08:05the-kennysomnium: No, I had aot-problems
08:05somniumthe-kenny: even with non-AOT swank jar?
08:05the-kennysomnium: hm... don't know if my swank.jar is aot'd or not
08:06the-kennyit's from clojars
08:06somniumthe-kenny: theres nwo in the repo, the versioned is aot'ed
08:06somnium/s/wno/two
08:06somniumlein installs an AOT'ed one
08:07somniumguess swapping it with the slim should work
08:12neotykWould like to use ClojureQL via Leiningen, what are it's coordinates ?
08:12the-kennyneotyk: http://clojars.org/org.clojars.snuxoll/clojureql
08:13fliebelHow do I get command line arguments, like with the java main function?
08:13the-kenny,*command-line-args*
08:13clojurebotnil
08:14fliebelthat was to simple… :$
08:14neotykthe-kenny: thanks
08:14the-kennyYou're welcome
08:15fliebelDoes this sort of stuff work to get the same behavior via java or clj? (defn -main [& args])
08:15fliebel(apply main *command-line-args*)
08:52fliebelWhoa! Calling shutdown-agents gives me a nasty error… Without it nothing happens, but the application continues to run.
08:53fliebelException in thread "main" java.util.concurrent.RejectedExecutionException (generator.clj:0)
08:55hiredmanyou shutdown the agents, but are still sending actions
08:55hiredmanthe actions are rejected
08:55fliebelSo? await them?
08:56cemerickoh, this is pretty: http://lesscss.org/
08:56hiredmanfliebel: don't touch agents after you shutdown the agent system
08:57fliebelhiredman: I can't see how I do something to an agent after I call shutdown… hmmm....
08:58hiredmanfliebel: you are
08:58fliebelyep, misplaced a paren...
08:58fliebelI indented the shutdown, but the function stopped the line before that.
09:04fliebelCan someone help me with a little concurrency? I got an agent vector that is appended to. At the moment I use await to wait for everything to finish. If I remove that the last few items are missing. How can I start processing those items but also make sure to get all of them?
09:05chouserfliebel: are you using this agent as a work queue?
09:05the-kennyfliebel: From where are you calling await?
09:05fliebeluuhm, one moment...
09:06AWizzArdfliebel: maybe you want http://java.sun.com/javase/6/docs/api/java/util/concurrent/ArrayBlockingQueue.html
09:06rhickeyrc2 is up: http://code.google.com/p/clojure/downloads/list
09:07fliebelI use send-off to append data from files into the agent vector, then from the main thread I call await and then start using the vector.
09:07chouseryay!
09:07rhickeyincludes fixes for sorted collections' empty and arraymap persistent!
09:08chouserrhickey: I saw that. What changed your mind?
09:08fogusthe twitterverse has been notified.
09:09rhickeychouser: I looked more closely at the diff, decided it was minor enough to risk the fact tht it hasn't seen any use
09:09rhickeywhat I'd like to avoid is pre-release breakage
09:10chouserrhickey: yes, entirely reasonable.
09:10hiredmanwow
09:10hiredmansince when did that work
09:11chouserThat bug's been sitting there getting almost no complaints for months
09:11rhickeyI'm thinking also next time I'd like tests for new features to be pre-reqs for release, e.g. transients should have tests
09:12fliebelAWizzArd: How do I use that thing you pointed to?
09:13AWizzArdfliebel: okay, maybe you don't know how many elements you want to put on the queue, so a http://java.sun.com/javase/6/docs/api/java/util/concurrent/LinkedBlockingQueue.html may be even better for you.
09:13rhickeyall branches are now in sync
09:13AWizzArdfliebel: just call the constructor, maybe (let [x (java.util.concurrent.LinkedBlockingQueue.)] ...)
09:13AWizzArdrhickey: oh that's good news, thank you
09:13rhickeyi.e. new has all master patches
09:14chousernot too much painful merging I hope?
09:15fliebelAWizzArd: await takes only 20 ms, so unless it is dead simple to rip out my agent and use your list, I'm leaving it this way.
09:17AWizzArdThe queues to which I pointed you also supports something like await and await-for. But it can also make sure that you get all elements and such.
09:18hiredmanblockingqueue's are great because you can just start processing, and your processing function with wait until it has something to process
09:18fliebelhow about send-off? the point of the whole thing was to go read thos files somewhere in teh future and come back to hem when needed.
09:19rhickeychouser: totally painless
09:27AWizzArdfliebel: where you now have your agent you use the queue. (def my-agent (agent [])) ==> (def my-queue (LinkedBlockingQueue.)) And instead of (send my-agent conj value) you can (.put my-queue value).
09:28arj_I'm having trouble with an anonymous function that returns a map. Defined as #({:id %)), if I call that on a string e.g. I get wrong number of arguments for persistentarraymap?
09:28hiredmanarj_: #() is not (fn ...)
09:28fliebelAWizzArd: thanks
09:28hiredman,(macroexpand '#({:a 1})
09:28clojurebotEOF while reading
09:28hiredman,(macroexpand '#({:a 1}))
09:28clojurebot(fn* [] ({:a 1}))
09:29hiredmanyou are calling the map as a function there
09:29arj_aha
09:29arj_how would I write it then?
09:30chouser#(hash-map :id %) or (fn [v] {:id v})
09:30arj_thanks :)
09:33devlinsfchouser: Hey, 128 got in!
09:33devlinsfchouser: Thanks for cleaning it up
09:34chouserdevlinsf: sure, thanks for the tests
09:34chouserso will your visitor be easier to write now?
09:35devlinsfHehehehe..
09:35devlinsfI'm taking it to a whole new lever
09:35devlinsflevel
09:35devlinsfYou're gonna love it
09:36devlinsfI've still got to put a little polish on the new fn. I'll send you a link when it's done
09:39fliebelCan someone give me a little help with lein? I need to get an external jar included.
09:42fliebelThe faq says I have to install it into ~/.m2, but I never used maven, and typing man maven gives no result, so how should I do this?
09:50neotykfliebel: google for mvn artifact install
09:55fliebelneotk: thanks
09:55neotykfliebel: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
09:56neotykin lein what versions of clojure{,-contrib} I should use? 1.1.0-master-SNAPSHOT 1.1.0-rc2?
09:56fliebelthat is not an easy command, but I'll eventually figure out.
10:01fliebelneotyk: I can figure out file and version, do you have any idea about the others? that would save me a lot of time
10:01neotykfliebel: np
10:03fliebelEspecially artefactid…. no Idea what that means. For packaging I'd try jar, for group id the classpath, is that anywhere near correct?
10:04rhickeydevlinsf: ping
10:05devlinsfrhickey: he
10:05devlinsfrhickey: Hey, thank you too
10:06rhickeydevlinsf: Hi - saw your videos - nice. 2 nits with the transients one:
10:06devlinsfSure
10:06devlinsf(How'd you find them)
10:06devlinsf(Don't post a link yet)
10:06rhickeytransients *do* share structure, in fact, a new transient shares almost all of its structure with the persistent it was created from
10:06devlinsfOoops
10:07rhickeywhat they don't do is offer persistence
10:07rhickeyand when done, the persistent adots almost all of the structure of the transient
10:07chouserdevlinsf: just saw a link to your videos here: http://disclojure.org/
10:07devlinsfAh. I'll ad an adendum to the show nore
10:07devlinsfWOw
10:07rhickeya transient is more like the birthing mode of a persistent
10:07devlinsfHmmm....
10:08devlinsfOkay
10:08devlinsfGood to know
10:09rhickeya second point, a key protection of transients is that they don't support the 'changing' interface of persistents, i.e. conj etc, so if accidentally leaked (before calling persistent!, they can't be used as a changeable persistent, even in the same thread
10:09devlinsfOh yeah. Duh
10:10devlinsfrhickey: I'm working on 2 more now, transients & constraints
10:10devlinsfEh, templates & constraints
10:10rhickeytemplates?
10:10devlinsfYeah. clojure.template
10:11rhickeydo we want to talk about that?
10:11devlinsfI've found a pretty cool use case
10:11devlinsfcheck the github for episdoe 3
10:11devlinsfhttp://github.com/francoisdevlin/Full-Disclojure
10:14hiredmanneotyk: where you able to get clojurebot up?
10:20fliebelwhere is my pom.xml file? (need it for lein)
10:27neotykfliebel: in lein dependencies [[groupId/artifactId "version"]]
10:27neotykhiredman: not yet
10:28fliebelneotyk: So how can I add this? http://code.google.com/p/markdownj/wiki/Maven
10:28hiredmanwell I'm around and in a better place then yesterday
10:29neotykhiredman: trying to leiningenize clojurebot
10:29hiredmanhah!
10:29hiredmanexcellenet
10:29hiredmanI was thinking I should do that some day
10:30neotykhiredman: but we have some issues with netowork at office now (~80% packet lost) so it goes terrible slow
10:30hiredman:(
10:30fliebelneotyk: I understand that I should add org.markdownj and all that stuff, but how do I add the scala-tools repo?
10:31hiredmanlein would be good, since clojurebot's list of deps never seems to shrink, and I never upgrade, so getting the right set of jars would be a hassel
10:34neotykI really like that you can upgrade plugins without restarting bot
10:34neotykif I remember right
10:36fliebelI found the repository keyword, but nothing about it's syntax
10:38neotykfliebel: http://github.com/technomancy/leiningen/blob/master/src/leiningen/deps.clj
10:38neotykfliebel: I think it is [[id url]]
10:38fliebelneotyk: I think so to since using the string or just the url fails
10:38neotykfliebel: if I read it right, though I'm new to clojure
10:40fliebelneotyk: you're right, but it's not yet working...
10:41fliebelwrong version :S
10:43fliebelIt's working now!
10:43neotykfliebel: so how do you use repos?
10:44fliebel:repositories [["scala-tools" "http://scala-tools.org/repo-releases&quot;]]
10:44fliebelcool
10:51djpowellwhat sort of applications does promise/deliver have?
10:51fliebelpromise allows for dataflow programming… I'm trying to understand that :)
10:52fliebelThe basic idea is that you deliver a variable, but nothing happen untill the data arrives.
10:52chouserI keep using it to turn callback-driven RPC into blocking calls.
10:53CalJuniorI am trying to implement a java interface using proxy but keep getting java.lang.RuntimeException
10:54CalJunior(def foo (proxy [SomeJavaInterface] []))
10:55CalJuniorjava.lang.Exception: Can't resolve: SomeJavaInterface (NO_SOURCE_FILE:18)
10:56CalJuniorI did import the interface class: (import '(com.mycompany.client.SomeJavaInterface))
10:58CalJuniorI know this is a boring java interop for noobs question but any suggestions?
10:59cemerickCalJunior: (import 'pkg.ClassName), not (import '(pkg.ClassName))
10:59chouserugh. wow. that probably ought to throw something.
11:01CalJuniorClassNotFoundException. So it's back to the classpath drawing board again ...
11:01hiredmanwell
11:01hiredman(import '(foo)) is importing no classes from the foo package
11:01chouserright
11:02chouserwhich is useless, so almost certainly not what you meant.
11:02hiredmanI suppose it could throw something :/
11:02fliebeldefn: Are you reading? I succeeded in finishing the very basic functionality and built a jar. I send you an email with more information. Anyone else: check out http://github.com/pepijndevos/utterson <<< my first clojure project! :)
11:02cemerickI don't know that that should throw an exception.
11:02cemerickMaybe a warning printed to *err*?
11:03chouserif classpaths weren't tricky and a cause of newbie pain, it might be best to *not* warn or error out.
11:08CalJuniorI'm quite sure I have set the classpath correctly.
11:09CalJunioris there a way to check this in clojure repl?
11:09CalJuniorexcept for the import call returning a class not found exception.
11:10chouserCalJunior: how are you setting the classpath. env variable, command-line arg, or ... ?
11:10cemerick(System/getProperty "java.class.path") (if you set up the classpath in a typical way)
11:10CalJuniorI've set the classpath in a shell script.
11:10chouserCalJunior: using CLASSPATH=... ?
11:11CalJuniorbasically I'm using the Progamming Clojure shell script from Stuart Halloway
11:12CalJunior(System/getProperty "java.class.path")
11:12CalJuniorthe jar is in the classpath according to (System/getProperty "java.class.path")
11:13CalJuniorthe jar includes com.mycompany.client.SomeJavaInterface.class
11:13chouserhm. can you look inside the .jar and see ... hm...
11:13CalJuniorI did.
11:13chouseryeah
11:13chouserany dashes or underscores involved?
11:15CalJuniornope
11:15neotykhow do I use http://github.com/joshua-choi/fnparse from leiningen?
11:16CalJuniorwhen I do (import '(com.mycompany.client.SomeJavaInterface)) - which would be wrong - clojure return 'nil' rather than ClassNotFoundException
11:16chouserCalJunior: yeah, that's essentially a no-op
11:16CalJuniorright
11:16chouser,(import '(i.made.this.up))
11:16clojurebotnil
11:16CalJuniorclear
11:16chouser,(import 'i.made.this.up)
11:16clojurebotjava.lang.ClassNotFoundException: i.made.this.up
11:17chouserCalJunior: could you lisp.paste your actual results from (System/getProperty "java.class.path") and your actual import line?
11:18chouserlisppaste8: url?
11:18lisppaste8To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste.
11:18CalJunioryes I can
11:21lisppaste8caljunior pasted "classpath" at http://paste.lisp.org/display/92539
11:22CalJuniorthis is the actual import line: http://paste.lisp.org/display/92540
11:27CalJuniorthe first .jar contains com/ib/client/EWrapper.class file which is the interface I want to implement using proxy.
11:28CalJuniorthat would be jtsclient.jar
11:30AWizzArdclojurebot: max people
11:30clojurebotmax people is 240
11:32AWizzArdchouser: last year we also peaked in late December/mid January with people here. And I think it was around January of this year when the first Clojure was released. Now we are close to the next one.
11:33pdkchristmas break from work is the best time of year to futz with new languages apparently :p
11:33AWizzArdIf my idea is right then in late January there will be fewer commits to the Clojure repository, and fewer people in here, and fewer postings in the group.
11:33pdkcome to think of it didnt python start as a 2 week christmas break project
11:33AWizzArdhmm :-)
11:34pdkcal: if it returns nil as far as i know that indicates the import worked
11:35pdkbut yeah the syntax with '() around package names is correct
11:35CalJuniorchouser disagrees on this:
11:35CalJunior,(import '(i.made.this.up))
11:35clojurebotnil
11:36pdkhmm
11:36hiredman(importing nothing from any package)
11:36CalJuniorI quote: "yeah, that's essentially a no-op"
11:37CalJuniorthere must be a problem with my shell script.
11:38hiredmanclojurebot: dirt simple?
11:38clojurebotsimple setup is http://www.thelastcitadel.com/dirt-simple-clojure
11:38neotykhiredman: you can check my fork, only fnparse to sort out and all dependencies are solved
11:38hiredmanwow
11:38CalJuniorhiredman: thanks
11:39neotykhiredman: temporary putting FnParse.jar in lib will show that it is last dep to solve
11:40neotykhiredman: now I finally see errors like: "Caused by: java.io.IOException: Cannot run program "git" (in directory "/home/hiredman/clojure"): error=2, No such file or directory" which is great progress
11:40hiredman:|
11:41hiredmanyeah, and horribleness on my part
11:41hiredmanthat would be clode_lookup.clj
11:41hiredmancode
11:41neotykhiredman: I guess it's time for clojurebot.properties from my side :P
11:42hiredmanI having a sneaking suspision that path is hard coded
11:42hiredmanfor that particular plugin
11:42neotykI've already filled issue in FNParse to make it leiningen friendly
11:43hiredmanthe fnparse author was in here the other day talking about splitting fnparse into two libraries
11:43hiredmanwhat I get for using something under active developement
11:43lisppaste8Chouser annotated #92539 "searching for a class file in a jar" at http://paste.lisp.org/display/92539#1
11:44chouserCalJunior: take a look at that paste
11:45chouserI know you said you already looked inside the .jar, but we must be missing *something*. So this has Java do the checking inside the .jar, from the same repl that's failing to load the class.
11:45chousermaybe it'll tell us something.
11:48CalJuniorchouser: thanks, I'm on it.
11:58aldebrnBeen running Rich's ant colony simulation on my i720 with (def ant-sleep-ms 1) and seeing all 8 lines in System Monitor go to ~50% floods me with hope (as someone who has tried to do parallel scientific computing on generic CPUs)
11:59aldebrnThey found all the food :-/
12:01chouseraldebrn: that must not be the Motorola i720 Cell Phone
12:21CalJuniorchouser & hiredman: problem resolved. my clojure setup was busted. thanks for the pointers.
12:24chouserCalJunior: did the jar-entries fn help diagnose at all?
12:37CalJuniorchouser: I got the following Exception when running the jar-entries fn: Unable to resolve symbol: ->> in this context (NO_SOURCE_FILE:5)
12:38CalJunioris it relevant I was running clojure 1.0.0?
12:38hiredmanyeah
12:39hiredman->> is not in 1.0
12:39chouseryeah, sorry. didn't think twice about that.
12:39chouserCalJunior: ok, glad you figured it out anyway.
12:40CalJuniorin 1.1.0 it returns: ("com/ib/client/EWrapper.class")
12:40CalJuniorso it found the class file.
12:41chouserso what was the actual problem?
12:46CalJuniorgood question. still trying to figure that out. the problem only occurs on my desktop. I installed the latest clojure release on my laptop added the jar file to the classpath (essentially the same shell script) and it worked.
12:52CalJuniora telling sign might be that when I run the script it boots clojure 1.0.0 while the clojure.jar file in the classpath is most definitely a more recent version (1.1 rc2 now)
12:53chouserCalJunior: maybe paste your script?
12:53hiredmanclojurebot: -cp and classpath?
12:53clojurebot-cp and CLASSPATH are mutually exclusive
12:53CalJuniorgood point
12:53hiredmanI dunno, just a guess
12:55CalJuniorpaste.lisp.org/display/92545
12:56hiredmanuse clojure.main
12:57hiredman(I doubt that is the problem, but best not use Repl or Script)
12:57CalJunioryes, but that doesn't make a difference
12:57CalJuniorin this case
12:58hiredmanI don't think that it would
13:01CalJuniorI deleted all clojure.jar files except for 1.1 rc2 version and it still boots 1.0.0.
13:03chousermaybe compojure.jar (or something) includes clojure.main?
13:03CalJuniorI have to sign off. dinner beckons (CET). it must be my system setup, probably not clojure specific so I will try to resolve it myself. thanks again.
13:03tolstoyTrying running from a different user account. ;)
13:03CalJuniori tried removing compojure.jar. no change.
13:04chouserCalJunior: ok. let us know what you find, though, for when others run into similar problems.
13:04CalJuniordifferent user account: good idea.
13:05CalJuniorp.s. clojure the lang and the community is great. I happily donated to the 2010 funding drive.
13:06chouserCalJunior: great, thanks!
13:07CalJuniorI donated under my real name, which I prefer to keep off the chat log due to my regularly less than intelligent questions :-)
13:08chouserunderstandable, if not very sporting.
13:08hiredmanhaha
13:09chouserI occasionally go back to the beginning of the logs which surprisingly coincide with me starting to ask questions here.
13:10chouserReading my own questions helps from them helps to keep perspective on everyone else's questions. :-)
13:10hiredmannom de cancre
13:14fogusCalJunior: An Orioles fan?
13:14chouser"ah, for is in the svn" -- 7 Feb 2008
13:15chouser"I just thought recur would be more correct before I realized that it didn't really make sense for lazy-cons" -- 12 Feb 2008
13:17cemerickjeez, I was in here on 2/7/2008
13:18cemerickalmost two years, comin' up
13:18hiredman2008:Nov:11:13:30:11 hiredman is this coljure swag, or libertarian swag?
13:18hiredmanmy first question
13:18chouser"Chouser: But I can't say I like lisp's lack of syntax. Clojure's [vectors] help a little ..."
13:18hiredmansuch wide-eyed innocence
13:19chouserhehe
13:21chouser"Chouser: hash- and sorted-maps are immutable?" sheesh!
13:22cemerick...and I was yammering on about an eclipse plugin back then.
13:22cemerick...using the sbcl eclipse plugin as a base, I think
13:23tolstoyWhen I use languages like Clojure or Groovy (or Erlang), I find I just don't need a big beefy IDE. Textmate works fine.
13:23tolstoyAlthough emacs/slime and swank work for Clojure quite nicely.
13:24tolstoyIs there something like (apropos "some key words") in Clojure?
13:24hiredmanjust wait for my gui repl
13:24the-kennytolstoy: doc
13:24the-kennyoh, sorry. No
13:24hiredmanfind-doc
13:24hiredman(doc find-doc)
13:24clojurebot"([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern"
13:24tolstoyAh, find-doc. Okay.
13:25hiredmanI'm going to have a write-history function that will write the repl's history to file
13:26tolstoyOh, cool! Just (find-doc'd) my way to update-proxy. Might-could use that.
13:30kylesmithAnyone interested in giving me some feedback on my genetic algorithms / genetic programming?
13:31Fossilisp just loves emacs
13:31Fossiespecially with paredit
13:32Fossitakes editing to another level
13:42pdkkylesmith what sort of things are you using it for
13:56wavis_kylesmith: i'm not particularly experienced with those, but i'd love to have a look
14:29fliebelWhy does prxml print? I'd like to have the output, not printing it.
14:29the-kennyfliebel: use with-out-string
14:30fliebelthe-kenny: thanks… I was already looking at setting *out* myself. I hate functions that print. adding print is a small effort, caching printed stuff is harder.
14:54LauJensenI was looking at the Par branch last night - whats going on with that ? Still being worked on? Some of it is destined for merge with master?
15:00drewrLauJensen: I think I remember par being deprecated in favor of forkjoin
15:01rhickeythe par branch is the new forkjoin stuff
15:01rhickeyit will eventually be folded in
15:01drewrah
15:01LauJensenAny docs on the 'forkJoin' stuff I can go have a lookat ?
15:01LauJensen+ \space
15:01rhickeybut we need to have a conversation in the community about java 5, since it won't be supported by forkjoin
15:02rhickeyit would be nive to put forkjoin behind agents, future etc
15:02rhickeynice
15:03drewrwill that be post-cinc?
15:04rhickeydrewr: it's unrelated, so could go before or after, more a matter of time, and focus
15:05drewrthat's more what I meant, focus-wise
15:07rhickeydrewr: TBD, I'm still working on what is the best path. Given deftype/protocols, the possibility exists to bring a lot of the abstractions over. At that point, many interesting things could be on the table. Primitive versions of vectors etc. Integrated par support in some of the algorithms. I also have work going on to enhance the transient support, and a possible new ref type, which interestingly go together very nicely
15:08rhickeycinc can use protocols for its abstractions
15:08rhickeythere is simply a ton to do
15:09chouserwhich is amazing considering Clojure is already more than holding its own
15:10rhickeyyes, its a good feeling that it can be both useful and growing
15:10rhickeywithout a real tension between the two
15:10LauJensenuuuh that sounds interesting - transients connected with refs?
15:11rhickeybut some of these steps might be (at least temporary) disruptive
15:11chouserI'm thinking specifically of our codebase at work, where for any given module we can currently pretty easily choose between C++, Clojure, Java, and JRuby. Clojure doesn't feel fractionally mature compared to C++.
15:12rhickeymany of these things go into the 'perf-enhancing' category, even par
15:12rhickeybut that fits with make-it-right-then-make-it-fast
15:12chouserdeftype/protocol is not entirely in that category
15:12rhickeyLauJensen: yeah, a bit too early for me to talk about it
15:13LauJensenOk
15:13rhickeychouser: no, definitely not, they are important for abstraction, and that was a deficit area
15:13rhickeychouser: ^^ that's agreeing
15:13chouser:-) yes.
15:14headiusmake-it-fast is an endless life-sucker
15:14rhickeythere are so many interesting areas for Clojure. Using deftype+protocols should be an important next step
15:15drewrI'm looking forward to deftype/proto being canonized in clojure's core; I feel like I can't get a good head model going
15:15rhickeyheadius: micro-optimization, yes, much of this is macro
15:16rhickeydrewr: protocols are substantially the way I used interfaces in Clojure's core JAva stuff, the mapping will be very transparent
15:16danleiquick question: I read that add-classpath will be removed in 1.1, what is the preferred way to change the cp dynamically now?
15:17danlei(repl use only, I'm aware that add-classpath shouldn't have been used in "real" code)
15:18chouserwith protocols in place, the two areas I'd still love to see are weaknesses that come with the JVM and lack of compile-time correctness checking.
15:18hiredmandanlei: try out http://gist.github.com/255766
15:18rhickeydanlei: I'm hoping for a contribution that provides repl/interactive dynamic classpath using java.system.class.loader
15:18rhickeyhiredman: I find that bewildering
15:19danleithanks hiredman & rich
15:19foguschouser: weaknesses? like lack of fixnum?
15:19hiredmanyeah, I should put a newer version with nicer macros
15:20hiredmanit's more or less http://gist.github.com/251980
15:20hiredmangenerated via asm and stuffed in a jar for your classloading pleasure
15:20chouserfogus: I suppose, though what hurts me more often are startup time and deployment complexity (classpaths, lein resorting to python for installation, etc.)
15:21foguschouser: what I mean by that is weaknesses in that category. fixnum, tco, etc...
15:21foguschouser: ahhh, nevermnd I see
15:21fliebelHow do I set *warn-on-reflection* and friends? Just using def returns all sorts of errors.
15:21chouserI suppose a different jvm could potentially solve all those problems for a wider variety of languages.
15:21the-kennyfliebel: set!
15:22chouser...but I'm more interested in cinc, to solve all those problem and many others, if only for Clojure.
15:23chouserI would simply love for target platform requirements to (almost) never be a reason to not use Clojure.
15:23fliebelthe-kenny: thanks
15:23chouserneed to write a bit of logic in your auto-configuring browser proxy rules? Good thing Clojure compiles to javascript...
15:24chouserneed to customize an app that is scritable only via lua? Clojure seqs and immutable collections are still handy there.
15:25fogusOh I see a lot of value in cinc... and compile-time correctness checking.
15:25fliebelchouser: clojure = js? what is cinc?
15:26foguscinc -- allowing people to complain about lack of tco across multiple platforms!
15:27rhickeyfogus: yes, spread the blame :)
15:27fogus;)
15:28notostracaso you can get clojure to compile to JS now? using what, GWT or something?
15:28fogusI had an interesting question on my blog that I have not had time to think about... basically, the question was "what does :pre :post buy us above `(assert)`?"
15:28the-kennynotostraca: There are some small libraries.
15:29the-kennyMacros in clojure make translating clojure to * very easy
15:29cemerickfogus: idioms are good :-)
15:29notostracai would like to see clojure-> haXe myself
15:29fogusfliebel: http://blog.n01se.net/?p=41 cinc
15:30foguscemerick: ?
15:30rhickeyfogus: also documentation, and perhaps amenable to automatic use (in test generation etc)
15:30cemerickfogus: :pre and :post provide standard hooks for 99.5% of all assert usage
15:30ska2342I keep asking myself whether Clojure will still be a Java-library, too after CINC is complete.
15:31rhickeyska2342: what do you mean by that?
15:31cemerickinsofar as asserts define the "contract" of a fn, providing them in predefined slots is a good thing
15:32ska2342rhickey: people keep talking about how easy it is to call Java from Clojure, but the other way round (without using Compiler and Clojure-source-strings) is very interesting, too.
15:32chouserusing assert instead of :pre is usually pretty straightforward, if you had to do it. Using assert instead of :post is a pain.
15:32rhickeyska2342: that will be just as easy - that's why protocols have a mapping to interfaces
15:33fliebelthe-kenny: how does that set! thing work? (set! *warn-on-reflection* true) gives me an exception.
15:33ska2342rhickey: what about IDE support, will they need to have some Java _sources_ hanging around or are they doing everything via introspection?
15:33fogusall of that RE :pre :post sounds like a reasonable response. Is there anything that :pre :post provide (besides test gen, etc...) that assert cannot?
15:33notostracai second fliebel's question
15:34the-kennyfogus: It's used exactly like this
15:34the-kenny(in the repl)
15:35rhickeyfogus: potentially pre and post conditions could come from somewhere other than where the body does
15:36ska2342as a sidenote: I really like that line "Clojure is a library, too", sounds even better in German :-)
15:36rhickeyska2342: the IDEs are working with Clojure source already
15:37fliebelthe-kenny: (set! *warn-on-reflection* true) is what's on the java-interop page, but that gives me a java.lang.IllegalStateException
15:38ska2342rhickey: I have a feeling that it would be good to maintain that feature. But then, what I do know... I do fully trust you on this.
15:39rhickeyska2342: there will be no reduction in interop either way
15:39ska2342rhickey: cool
15:39fogusrhickey: "somewhere other than where the body does" which is exactly what my post is meant to show... even if I couldn't elucidate it that clearly. Thanks
15:40joshua-choiI'm trying to figure out the new syntax for implementing protocols directly inside a deftype
15:40joshua-choiuser=> (defprotocol A (a [x y]))
15:40joshua-choiA
15:40joshua-choiuser=> (deftype B A (a [x y] [x y]))
15:40joshua-choijava.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol (NO_SOURCE_FILE:0)
15:40joshua-choiAm I doing something incorrectly?
15:40rhickeyjoshua-choi: you need a vector for fields
15:41rhickey(deftype B [] A ...
15:41joshua-choiI forgot about that
15:41joshua-choiBut it still doesn't work for me
15:41joshua-choi(deftype B [] A (a [x y] [x y]))
15:41joshua-choijava.lang.IllegalArgumentException: Can't define method not in interfaces: a (NO_SOURCE_FILE:3)
15:41rhickeyjoshua-choi: now you have one too many args
15:41joshua-choiIn deftype?
15:41rhickeyx becomes the target object and is not in the sig
15:41joshua-choiAh
15:41rhickeyin the deftype, yes
15:42rhickeyif you want to refer to it, use :as this
15:42KirinDaverhickey: So… have you written up a "When to use deftype and when not to?"
15:42rhickey(deftype B [] :as this A (a [y] [this y]))
15:43joshua-choiExcellent, thank you
15:43LauJensenrhickey: Out of curiosity: How much time do you find to code in Clojure these days, is it mostly Java?
15:44fanaticoAnyone have any experience access scala code from clojure?
15:45liebkerhickey: you mean, you code in Java, so we don't have to :)
15:45rhickeyliebke: both
15:46rhickeybut the former is more paradoxical
15:47liebke:)
15:48rhickeyClojure is now poised to wrest itself from Java
15:51LauJensencinc coming close to completion ?
15:51rhickeyLauJensen: cinc coming close to beginning
15:51LauJensenWell excuse me for waking up :)
15:54fogusfanatico; yes
15:54danlarkinIt's too bad there's no "h" we can add to the end of cinc. I would like it to be a word, that would be fun
15:54LauJensencurte :)
15:54LauJensencute :)
15:56fanaticofogus: great. I'm trying to use the knockoff markdown library. How would I access a singleton from clojure?
15:57rhickeyKirinDave: I haven't, I'm not sure there are many prohibitions at this point
15:58KirinDaverhickey: I guess I am still struggling to follow what problems you were trying to solve outside of an underlying method to implement some stuff in clojure that was currently in java.
15:59fogusfanatico: Do you mean a Scala object?
15:59fanaticofogus: yeah.
15:59rhickeyKirinDave: he problems I solved with Java - how to implement abstraction such as Clojure's ISeq, Associative, Collections, IRef etc
15:59rhickeythe problems
16:00fogusfanatico: what is happening when you try?
16:01rhickeyClojure depends on there being a high performance polymorphism substrate in the host, but didn't integrate it, instead used it directly in host lang
16:01hiredmanfor something on the surface appears be more like Java, Scala code seems to go through much more mangling durring compiling
16:02fanaticofogus: it can't find the class.
16:03fanaticoa Test object would be compiled into Test$.MODULES$, right?
16:04hiredmanfanatico: #scala might know
16:06fanaticohiredman: I'll ask. The scala->java bridge doesn't seem that well documented.
16:08cemerickit's damn scary, at least the last time I had my head in there
16:10gravitythe-kenny: The syntax moreso than the type system?
16:10the-kennygravity: Not sure.
16:10fogusafter a year and a half of writing scala i can say that the syntax.... uhhhh, grows on you
16:11the-kennygravity: I'm parentophile
16:11gravityheh
16:11hiredmanlike a fungus?
16:11fogus:p
16:11fliebelWhy does the reflection warning stop working when you're running from a jar? When I ran a script with the warnings turned on I was able to fix them, but lein won't let me put anything in a jar with that thing in it.
16:11fogusI've found scala's syntax to suffer from C++'s 20% problem
16:11hiredmanfliebel: the reflection warning happens at compile time
16:12hiredmannot runtime
16:12cemerickfogus: i.e. you need to make sure you stay away from the 20% that is incomprehensible?
16:12fogusfanatico: I can't find my notes! :( Help fail
16:13technomancycemerick: ... and everyone has their own 20% =)
16:13fliebelhiredman: but can't compile just ignore it? It not very nice to have to edit code when switching from jar to clj.
16:13samlhow can I execute external commands?
16:13hiredmanfliebel: what do you mean?
16:13cemericktechnomancy: right. I worry about that in clojure when I see discussions pro and con of pointfree vs. ->> and ->
16:13foguscemerick: Given that there are typically 5 ways to do anything in scala, people tend to adopt their favorite way which tends to not be "your" way
16:14fanaticoThe type system is insanely complex, but I haven't seen much production code that using the scarier parts. I wonder if it'll end up like C++, where there are a bunch of style guides that dictate which 60% of the language is usable, and they all disagree.
16:14fliebelhiredman: that it does not compile as long as that line is in there...
16:14hiredmanfliebel: clojure always compiles
16:14hiredmanclojure is never interpreted
16:14fliebelhiredman: huh?
16:14gravityPerl managed to get a set of best practices that are being widely used, and they use code analysis to enforce it. I could see Scala going that way.
16:14hiredmanah
16:14hiredmanI see
16:15fogusfanatico: my point exactly. ;)
16:15hiredmanI understand
16:15hiredmanfliebel: you can only use set! if a binding has been setup for that var
16:16hiredmanwhich the repl code does for *warn-on-reflection*
16:16fliebelah...
16:16hiredmanso loading it outside of the repl will fail
16:16hiredman(which compiling does)
16:16hiredmanaot compiling
16:17fanaticofogus: much nicer language than C++, but yeah, "multi-paradigm" is a scary description for a language.
16:17fliebelhiredman: ok, now I understand… are all those *something* repl-only?
16:17hiredmanfliebel: the bindings for them are setup by the repl code
16:17fogusI can't complain though... I've enjoyed working with Scala... it makes my work life bearable
16:17technomancyI noticed in duck-streams there's a :tag "java.lang.Boolean"
16:18technomancyapart from the java.lang being redundant, is that a mistake?
16:18technomancyI mean, strings don't get eval'd in that context, right?
16:18hiredmantechnomancy: they do, if I recall
16:18technomancyinteresting. what's the reasoning behind that?
16:19technomancyor is it just a historical quirk?
16:19hiredmanuseful historical quirk I think
16:19technomancyuseful?
16:20hiredmanyou could do stuff like #^"[Ljava.lang.Object;"
16:20hiredmanbefore there was support for #^objects
16:20hiredmanstill can do it for arbitrary array types
16:21hiredmanhmmm
16:21hiredmanjava/lang/Object actually
16:22technomancyoh, I didn't realize you could use that notation
16:22hiredmanso maybe that Boolean is a mistake?
16:22technomancyit looks so hideous I assumed it was garbage
16:22technomancyor garbled
16:22hiredmanthere are two representations for class names used in the jvm
16:22cemerickthat string :tag trick is super-useful for type-hinting in macros
16:23hiredmanjava/lang/Object and Ljava/lang/Object;
16:23hiredmana [ preifx means array of that type
16:26technomancyis tagging vars like *default-encoding* actually helpful?
16:27technomancyI thought it was mostly recommended for function args/return values
16:34q1mmm i have an ArraySeq. tips on pulling out one particular index value, say 5.
16:37neotykhiredman: thanks for pulling my changes
16:37hiredmanjust into a lien branch for now
16:37q1this seems to work, not sure it's the gbest way: (get (vec *ArraySequence*) 5)
16:37arohnerq1: by arrayseq, you mean a java array you've run (seq) on?
16:38q1arohner: a return value from (re-split)
16:38arohner,(doc nth)
16:38clojurebot"([coll index] [coll index not-found]); Returns the value at the index. get returns nil if index out of bounds, nth throws an exception unless not-found is supplied. nth also works for strings, Java arrays, regex Matchers and Lists, and, in O(n) time, for sequences."
16:38q1thanks
16:38q1Heh i'm pretty new. Still learning the core api.
16:38arohnernp
16:39neotykhiredman: thanks anyway, it is nice
16:40drewrjoshua-choi: is json.clj based on fnparse 2.2.4 or 3.beta?
16:54LauJensenDid a small blogpost showing off a little emacs/compojure/clojureql cocktail http://www.bestinclass.dk/index.php/2009/12/dynamic-interactive-webdevelopment/
17:13joshua-choidrewr: FnParse 2.2. 3.beta.2 is completely out of date; it was before I decided to split the library; don't touch it. :)
17:13joshua-choiI mean, 3.beta.0 and .1.
17:19drewrjoshua-choi: ok, thanks!
17:21neotykjoshua-choi: did you have a chance to look at http://github.com/joshua-choi/fnparse/issues/#issue/1
17:21joshua-choiAh, yes, sorry for not replying yet
17:21joshua-choiI'm going to do that today
17:22joshua-choiI'll let you know when I do so
17:22neotykjoshua-choi: awesome!
17:42durka42LauJensen: awesome video
17:45LauJensendurka42: thanks :)
17:54arohnerwhee! I crashed my JVM with an infinite loop:
17:54arohnerInvalid access of stack red zone 0x130648ce0 rip=0x12f185900
17:54arohner./start.sh: line 33: 20505 Bus error
18:32arohnerI have an add-watch causing an infinite loop. I assume that would happen if my watch function triggers a modification to the ref it's watching, but I don't think that's the case. Can anything else cause it?
18:33arohnermy watch function doesn't update the ref it's watching, but does update other refs.
18:49neotykhiredman: I get NPE in clojurebot.clj:22 clojurebot.clj:20 can you help?
18:51jweissbah, i can never remember how to convert :blah to "blah"
18:51jweiss,(str :blah)
18:51clojurebot":blah"
18:51jweissdoesn't work...
18:52tolstoy,(name :blah)
18:52clojurebot"blah"
18:53jweisstolstoy: great, thanks
18:53hiredmanneotyk: yes
18:54neotykhiredman: seems like props file is missing
18:54hiredmanyes
18:54hiredmanclojurebot doesn't come with the properties file
18:55neotykha, now it does with template with dummy values
18:55neotykbut lein is not adding resoures to classpath
18:55hiredmanright
18:55neotyki mean my fork does
18:55hiredmanwhat?
18:55neotykit has dummy prop file
18:56hiredmanlast I heard lein had a bug where it was not adding ./resources to the classpath
18:58liebke`AAAAA
18:59liebke`oops :)
18:59hiredman?
19:02neotykhiredman: it has to be something with lein uberjar, as if I start manually with src and resources in classpath i have next error
19:02hiredmanmaybe the uberjar sets the classpath internally
19:04neotykhiredman: I think it is dependent task of uberjar: compile that does it wrong
19:04hiredmanoh, when building the uberjar you get the exception?
19:05neotykwhen "lein uberjar"
19:05neotykbut at compilation phase
19:05hiredmanyou are going to have issues with aot'ing clojurebot to begin with
19:05hiredmanbecause clojure's compiler runs every thing as it compiles
19:05neotykwhat is aot'ing?
19:05hiredmanahead of time
19:05hiredmanahead of time compiling
19:06neotykso probably leiningen was not that good idea to start with
19:06neotykas part of it's build process is compilation
19:07hiredmanwell clojurebot can be alterd
19:07hiredmancompilation is overrated to begin with
19:07hiredmanlein needs a "just jar up the clojure src" target
19:08neotykagree
19:08technomancythat'll be default for the jar task in the next version
19:09the-kennyawesome :)
19:10hiredmanand /bin/sh right?
19:10hiredman:P
19:10technomancysure
19:16hiredmanneotyk: anyway, you don't actually need a clojurebot.clj to launch clojurebot, it's just how I do it
19:16hiredmanyou can also leave clojurebot.clj out of the src/
19:17neotykit is very useful for me, I'm also learning clojure at-the-same-time
19:17kylesmithpdk: ping
19:18kylesmithwavis: ping
19:18fanaticoIs there a way to get more debugging information from `import`?
19:18waviskylesmith:ack
19:18hiredmanneotyk: more or less what clojurebot was(is?) for me
19:18hiredmanfanatico: not really
19:18hiredmanwhat import does is actually very simple
19:19kylesmithwavis: sorry, I had to leave before. http://github.com/fakejennick/gp
19:19hiredmanusually in a namespace a symbol foo/bar will map to var #'foo/bar
19:20hiredman(import '(foo bar)) maps the symbol bar in the namespace to the class foo.bar
19:20fanaticohiredman: http://pastebin.ca/1725466
19:21waviskylesmith:thanks! can't look much at the moment, but I have to do some ga at some point in the near future so I will
19:21hiredmanfanatico: not going to fly
19:21neotykhiredman: bot got connected :D
19:21hiredmanyou had better put the class in a package
19:21hiredman:D
19:21kylesmithwavis: cool. let me know what you think.
19:22hiredman(import (HelloWorld)) is also not correct (but using classes that are not in packages is a bad idea)
19:22kylesmithwavis: I also have a wrapper for Jgap
19:22hiredmanshould be something like (import HelloWorld)
19:23waviskylesmith: didn't even know about jgap. cool!
19:23hiredman(import (HelloWorld)) imports no classes from the non-existant package HelloWorld
19:23hiredmanthe syntax is (import (PackageName ClassName1 ClassName2))
19:31fanaticohiredman: thanks. got it working.
19:39fanaticoscala interop works!
19:39fanaticouser=> (.toString (DefaultDiscounter/toXML (DefaultDiscounter/knockoff "_hello_ world")))
19:39fanatico"<p><em>hello</em> world</p>"
19:44jweissi could have sworn there is a shorthand for (not (nil? x)) somewhere
19:45jweissnot the easiest thing to find
19:45jweissor maybe i am imagining it? (not-nil? x)?
19:47chouserusually you'd just say x
20:00q1any tips on applying a case insensitive regex?
20:02danlarkin#"(?i)foo"
20:02q1ah ha! thank you.
20:02jkoppelWhat's the best way to write a macro foo such that (foo a) expands to (baz (bar ~a))?
20:03jkoppel(defmacro [a] `(baz (bar ~~a))) gives me errors, though I think something similar works in CL
20:05slashus2jkantz: Would (defmacro b [a] `(baz (bar ~'~a))) work?
20:06jkoppelYes!
20:06jkoppelThanks!
20:10neotykgood night
20:45jweissgiven a fn, is it possible to get how many args it takes?
20:47hiredman,(->> (fn []) class .getMethods (map #(.getName %)))
20:47clojurebot("invoke" "compare" "applyTo" "withMeta" "withMeta" "call" "applyToHelper" "throwArity" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "invoke" "run" "meta" "wait" "wait" "wait" "hashCode" "getClass" "equals" "toString" "notify" "notifyAll")
20:47hiredman,(->> (fn []) class .getDeclaredMethods (map #(.getName %)))
20:47clojurebot("invoke")
20:47hiredman,(->> (fn []) class .getDeclaredMethods first class .getMethods)
20:47clojurebot#<Method[] [Ljava.lang.reflect.Method;@6b0a6a>
20:47hiredman,(->> (fn []) class .getDeclaredMethods first class .getMethods (map #(.getName %)))
20:47clojurebot("invoke" "hashCode" "getModifiers" "equals" "toString" "getName" "isSynthetic" "getTypeParameters" "getDeclaringClass" "getAnnotation" "getDeclaredAnnotations" "getReturnType" "getParameterTypes" "toGenericString" "getGenericReturnType" "getGenericParameterTypes" "getExceptionTypes" "getGenericExceptionTypes" "isBridge" "isVarArgs" "getDefaultValue" "getParameterAnnotations" "isAnnotationPresent" "getAnnotations" "setAcc
20:48hiredman,(->> (fn []) class .getDeclaredMethods first .getTypeParameters)
20:48clojurebot#<TypeVariable[] [Ljava.lang.reflect.TypeVariable;@6a21b2>
20:48hiredman,(->> (fn []) class .getDeclaredMethods first .getTypeParameters count)
20:48clojurebot0
20:48hiredman,(->> (fn [x]) class .getDeclaredMethods first .getTypeParameters count)
20:48clojurebot0
20:48hiredman:|
20:48slashus2:-(
20:49hiredman,(->> (fn [x]) class .getDeclaredMethods (map #(.getParameterTypes %)))
20:49clojurebot(#<Class[] [Ljava.lang.Class;@8bca43>)
20:49hiredman,(->> (fn [x]) class .getDeclaredMethods (map #(count (.getParameterTypes %))))
20:49clojurebot(1)
20:49hiredman,(->> (fn [x]) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))
20:49clojurebot1
20:49hiredman,(->> (fn [x y z]) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))
20:49clojurebot3
20:49slashus2yea
20:50hiredmanjweiss: more or less
20:50slashus2would first work instead of (apply max)?
20:50hiredman,(->> (fn ([x]) ([x y z])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))
20:50clojurebot3
20:51hiredmanmax arity
20:51hiredman,(->> (fn ([x]) ([x y z])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply min))
20:51clojurebot1
20:51hiredmanmin arity
20:51slashus2I see
20:51hiredman,(->> (fn ([x]) ([x y z]) ([& m])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))
20:51clojurebotjava.lang.Exception: Can't have fixed arity function with more params than variadic function
20:51hiredman,(->> (fn ([x]) ([x y z]) ([a b c & m])) class .getDeclaredMethods (map #(count (.getParameterTypes %))) (apply max))
20:51clojurebot4
20:51hiredmannot quiet right
20:53arohneryou can also get the arglist from the var's metadata. Of course, that only works if the fn is def'd
21:00jweisshiredman: wow, that was a lot of work : ) thanks!
21:01hiredmanrestfns implement an extra method so you can check for that
21:01hiredman,(->> (fn [& x]) class .getDeclaredMethods (map #(.getName %)))
21:01clojurebot("getRequiredArity" "doInvoke")
21:01hiredmanhuh
21:01hiredman,(->> (fn [& x]) class .getRequiredArity))
21:01clojurebotjava.lang.IllegalArgumentException: No matching field found: getRequiredArity for class java.lang.Class
21:02hiredman,(->> (fn [& x]) .getRequiredArity))
21:02clojurebot0
21:02hiredman,(->> (fn [a b]) .getRequiredArity))
21:02clojurebotjava.lang.IllegalArgumentException: No matching field found: getRequiredArity for class sandbox$eval__4489$fn__4491
21:02hiredman:|
21:18arohnergah, I want :pre and :post on anonymous functions
21:20arohnercool, it works
21:20arohner((fn [x] {:pre [(even? x)]} (* x x) ) 3)
21:20arohner,((fn [x] {:pre [(even? x)]} (* x x) ) 3)
21:20clojurebotjava.lang.Exception: Assert failed: (even? x)
22:34quizme_hi
22:35quizme_can you have immutable objects in clojure ?
22:35quizme_i mean
22:35quizme_are user defined objects immutable in the same way lists are ?
22:36quizme_and if not, couldn't they be?
22:41quizme_i guess i mean struct maps
22:49chouserquizme_: struct maps are persistent (immutable) just like the other Clojure map types.
22:50quizme_i guess the reason i'm asking is that i'm just learning closure, and i'm coming from an oop background, so i'm trying to see if you can do everything in clojure that you can in oop in a concurrency-happy way.
22:52quizme_like basically simulate state variables with some kind of clojure map, then make dispatch methods that would operate on those struct maps in an analogous way to changing state.
22:53quizme_i have the feeling i'm saying a naughty word by saying "changing state"
22:53JonSmithin what context?
22:54JonSmithchanging state is ok
22:54gravityclojure has tools (refs, atoms, agents) to deal with state, and they can handle a struct map just fine if you want
22:55JonSmiththinking about it, changing state is the whole point of a big chunk of the language :-P
22:56arohnerquizme_: people build all kinds of useful programs in clojure. there are ways to accomplish everything you'd like. There's not always a direct translation from OOP, but the tools are there
22:58quizme_sorry. it's just hard to shake off 10 years of OOP dogma after reading half of a book on clojure.
22:58JonSmithdoes anyone have good 'high level' examples of generating (for example) HTML + CSS + Javascript (libraries tutorials etc.)
22:58arohnercompletely understandable
22:58JonSmithi know about scriptjure, compojure, clj-html, etc.
22:59JonSmithjust wondering if anyone has written a wrapper-like framework that abstracts all of that away yet
22:59JonSmithor if there is something in another language i could leach ideas from
23:00arohnerJonSmith: no, not yet
23:00quizme_JonSmith: openLaszlo exports to DHTML.
23:01JonSmithoh, this is interesting
23:03chouserJonSmith: maybe http://www.webtoolkit.eu/jwt ... I know some people have used it from Clojure
23:04JonSmithyeah, i will look through JWT and lazlo
23:05hiredmanswing really is horrid
23:06devlinsfhiredman: why?
23:06devlinsfI kinda like it
23:07mitchellhCan anyone recommend some clojure libs or open source apps to study to get more familiar with the language?
23:08hiredmandevlinsf: oh and I am just trying to beat it until it repaints right now
23:08devlinsfOh
23:08devlinsfmitchellh: What're you trying to do?
23:08devlinsfhiredman: Yeah, repaint can be a pain
23:09mitchellhdevlinsf: Anything, I just want to learn more about the "right way" to do things in clojure.
23:09mitchellhdevlinsf: I just learned the syntax and read the prag prog book last week
23:09mitchellhdevlinsf: just trying to get more experience
23:09devlinsfmitchellh: Pick a text file & parse it
23:09JonSmithI would suggest writing something
23:09devlinsfmitchellh: You know excel grunt work
23:09mitchellhheh
23:10JonSmithnah
23:10JonSmithdo like
23:10JonSmitha blog or a twitter client
23:10devlinsfhiredman: It sucks that you have to know AWT & Swing, I agree
23:10devlinsfhiredman: I paid that price a long time ago, so I'm used to it
23:11mitchellhI'm also trying to figure out the proper way clojure libs/apps are built and deployed as well, I'm new to Java other than in an educational environment
23:11devlinsfmitchellh: Oh, okay. What environment are you used to coding in?
23:12mitchellhMac with textmate or emacs
23:12JonSmithhttp://en.wikibooks.org/wiki/Clojure_Programming is an ok place to start
23:12devlinsfmitchellh: Okay, do you have slime?
23:12JonSmithhas a few examples (although some might be a bit old)
23:13mitchellhdevlinsf: I don't
23:13mitchellhJonSmith: thanks
23:13devlinsfmitchellh Ah, get that. It'll help you experiment at the REPL
23:13devlinsfmitchellh: That's the #1 key to learning
23:13mitchellhThanks, will do!
23:14defn can i use destructuring to take two sequences and turn it into a map?
23:15defnturn /them/ into a map
23:15arohnerdefn: no
23:15defni seem to remember you could
23:15devlinsfdefn: Use zipmap
23:16devlinsf,(zipmap [:a :b :c] [1 2 3])
23:16clojurebot{:c 3, :b 2, :a 1}
23:16defnah, rad
23:16defnthanks man
23:16devlinsfn/p
23:17chousermitchellh: I'd recommend reading the sources for clojure-contrib and clojure itself, to see how things are done. And projecteuler problems to build some familiarity with how to use Clojure to solve simple problems.
23:18mitchellhchouser: Thanks, that's a great idea
23:19defni have two directories of files. one directory of files will have all possible filenames, and another directory will have only some of those filenames. what's the most efficient way to discover which examples exist in both locations?
23:19devlinsfdefn: define efficient
23:20devlinsfdefn: least code or best performance?
23:20defnthe latter
23:20devlinsfAh.
23:20JonSmithcouldn't you make two sets
23:20defni was thinking about creating a map
23:20defnoh duh, a set makes more sense
23:20JonSmithand do an intersection
23:20JonSmith:-)
23:20defnyes!
23:20defnbrilliant!
23:20JonSmith!
23:20defnhehe, thanks
23:25defnnight all
23:32arohnersigh. why do ints and longs have to hash differently?
23:32arohnerespecially given Object.hashCode returns an int?
23:35fanaticochouser: is 1.1.0 pretty much frozen now?
23:35arohnerfanatico: yes
23:35arohnervery minor changes between now and 1.1 official
23:41interferonif i have a function, can i get its source?
23:41interferonsay, (something (fn [x] (+ x y)), and (defn something [f] (<source> f))
23:42devlinsfinterferon: Nope
23:42devlinsfinterferon: You could use a custom defn
23:46interferonthanks
23:46arohnerinterferon: you can get it from the var, but that won't work for anonymous functions
23:48arohnerand if you really wanted, you can get the bytecode for the function
23:48arohneri've considered writing that
23:51hiredman(let [y (.getBounds jc)]
23:51hiredman (-> scroll .getViewport
23:51hiredmanwhoops
23:51hiredman(let [y (.getBounds jc)]
23:51hiredman (-> scroll .getViewport
23:51hiredmansorry
23:52hiredmanhttp://paste.lisp.org/display/91148
23:52hiredmanthats the one
23:55fanaticoI've updated :pre and :post to print which condition failed, and what form caused the exception to be raised.
23:55fanaticopreviously: "Caused by: java.lang.Exception: Assert failed: (= % x)"
23:56fanaticonow: "Caused by: java.lang.AssertionError: Postcondition failed when (bad-fn 2): (= % x)"
23:56fanaticothoughts?
23:56devlinsffanatico: Awesome
23:56devlinsffanatico: I didn't like that I couldn't tell which failed
23:57fanaticodevlinsf: same here. I remember dismissing :pre and :post when they first were added for that exact reason.
23:58tomojcan anyone spot the problem with this ns declaration? https://gist.github.com/3cdad726f965d4793a07
23:59devlinsffanatico: I know it came up on the list
23:59tomojwhen I try to 'lein jar' I get "java.lang.IllegalStateException: bytes already refers to: #'clojure.contrib.http.agent/bytes in namespace: clojure.contrib.http.agent"
23:59devlinsffanatico: http://groups.google.com/group/clojure/browse_thread/thread/f20a8d42b2ae9093