#clojure logs

2010-04-23

00:04livingstonslyphon: you get your code working?
00:22mmarczyklivingston: that's a really cool project you were describing earlier
00:22mmarczykcan't wait to see it :-)
00:23livingstonthanks
00:24livingstonwell it's a lot of open problems in AI combined, so there won't be a "done" for a long time, but the research will go on for a long while
00:25mmarczykI'm inclined to consider this a good side of the endeavour :-)
00:25livingston(we have postdoc slots open if you know of anyone looking)
00:26mmarczykwhere at?
00:26livingstonUC Denver - CCP (center for computational pharmacology)
00:27livingstonAnyone here ever worked with Jena? (or RDF anything for that matter)
01:34livingstonisn't equals: "content equals" and ==: "pointer equals" (or identity or whatever you want to call it)
01:35livingstondisregard that, wrong channel
02:29zkimDoes anybody have an opinion on whether it's better to return an empty list, or nil?
02:29zkimi.e. {:results nil} vs {:results ()}
02:29carkhhum let it return what it would normally return
02:30zkimcarkh: well if it was up to you, what would you do?
02:30carkhlooks like that's a choice i never have to do
02:31carkhmy guess is that you're doing something wrong if you're asking that question
02:31carkhwhat's the context ?
02:32zkimProcessBuilder stuff, basically I'm running a process and collecting the stdout and stderrs into a map:
02:32zkimfor example: la -aul
02:33carkhanyways when you're processing the result, being a list or nil doesn't change a thing
02:33zkimwould return {:out ("drwxr-xr-x+ 108 zkim staff 3672 Apr 23 00:32 .") :err ("")}
02:33zkimso I'm thinking of turning that empty err result into either an empty list, or nil
02:33carkhallright, and how are you getting that list ? (out)
02:33zkimreading it from the Process output stream
02:34carkhand it might return several lines ?
02:34zkimyeah, which I would turn into a list of strings
02:34carkhwhat function are you using to turn it into a list ?
02:34zkimString.split
02:35zkim(seq (.split (:out res) "\n"))
02:35carkh,(seq (.split "" "\n"))
02:35clojurebot("")
02:36zkimso that gives '("") on an empty string
02:37carkh,(clojure.contrib.string/partition #"\n" "")
02:37clojurebotjava.lang.ClassNotFoundException: clojure.contrib.string
02:38carkh,(require 'clojure.contrib.string)
02:38clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath:
02:38carkh,(require 'clojure.contrib.str-utils)
02:38clojurebotnil
02:38carkhah looks like clojurebot is not on latest +P
02:38zkimhehe yeah
02:39zkimguess I'm not either, getting classnotfound on c.c.string
02:39carkhme neither, and now the doc is not available =/
02:40carkhah got it, anyways same result
02:40carkhmaybe we want to filter empty strings
02:40zkimso that would give an empty seq, correct?
02:41zkim,(filter (fn [] false) ["hello" "world"])
02:41clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--11080$fn
02:41carkh(filter #(not (.isEmpty %)) (seq (.split "" "\n")))
02:41carkh,(filter #(not (.isEmpty %)) (seq (.split "" "\n")))
02:41clojurebot()
02:42zkimcool
02:42carkhlooks like en empty list is the natural way !
02:42zkimguess I'll go with empty list
02:42zkimthanks for the help carkh
02:42carkhanyways when you want to process it, you'll "seq" it
02:42carkhdo i have errors ? (seq errors)
02:42zkimyeah, that makes sense
02:43zkimNobody seems to be talking about nil handling in the community, but I'm pretty new to clojure, so maybe it's just a non issue
02:44carkhhum but it might be a bad idea to make a list out of your error output to begin with
02:44zkimfeels more clojureish, instead of a block of text with newlines
02:44carkhif you have some error output, you're interested in the full output as a block, not in individual lines
02:45mmarczykactually there is a pretty significant difference between () and nil
02:45mmarczykin that the former is true in Boolean contexts
02:46carkhyes there is, that's why you always want to seq what could be a list
02:46mmarczykalso, ({:foo :bar} :quux) returns nil
02:46zkimhmm
02:47zkimI guess I could see the use case for checking for :err output by doing a (if (:err res) (do-stuff))
02:47mmarczykoccasionally it might be useful to do, say, (if-let [val (my-map key)] ...)
02:48mmarczykyou can't do that when nil is a possible value, you'd have to use find instead
02:48carkhzkim: how about having a function that does that check ? it's good practice
02:48mmarczyk(or a default return value, if you can guarantee that it in turn will not be present in the map)
02:48zkimcarkh: yeah, good point
02:48mmarczykin this case, though, when you're holding sequences of errors (or whatever)
02:49carkh(defn result-has-errors? [result] (boolean (seq (:err res))))
02:49mmarczykand those sequences are strict anyway, since they were evaluated before being stuffed into the map
02:49zkimmmarczyk: wait, i think you just lost me, so the if-let would only work if the check was against an empty list?
02:49mmarczyk(finishing the last sentence) I'd use nil
02:50mmarczyk(answering that last question) yes
02:50mmarczyk(if-let [v nil] ...) always takes the false branch
02:50mmarczykregardless of whether the nil came from not finding a value in a map or finding a nil value
02:50carkh,(get {:foo :bar} :quux :not-found)
02:50clojurebot:not-found
02:50zkimah
02:51mmarczykcarkh: as I said, that's ok if you know for sure that :not-found is not a possible value :-)
02:51carkhwell you should know what's in your maps =P
02:51mmarczyktrue
02:52mmarczykI'd add to that that you should know why you're putting nils in your maps, if and when you do
02:52carkhif :not-found can be in it, just put something else
02:52mmarczyklike nil :-)
02:52carkhi think it's bad practice to use nil as a value
02:53zkimso a good rule of thumb is empty seq's the default, and nil's the exception?
02:53carkhi mean, i never have to put a nil in a map
02:54zkimcarkh: yeah, and I guess the thing that's bugging me is that I'm worried that an aversion to nil's a bad hold-over habit from java
02:54zkimactually, it's mainly a lack of info, nobody's talking about it and I'm not experienced enough with clojure to drawn my own conclusions
02:55carkhi think your problem comes from making a list out of something that shouldn't be one
02:55carkhand i actually would put a nil there
02:55carkheither you have an error or it is empty
02:56zkimempty as in nil
02:56carkhsee that's an implementation detail you shouldn't have to worry about outside your return value building function
02:56carkhdo it one way or the other
02:57mmarczykwell, for this particular case you could just do something like
02:57carkhbut close to that building function, have an has-error? predicate
02:57mmarczyk(zipmap [:in :out :err] (map line-seq [process-in process-out process-err]))
02:57zkim,(doc zipmap)
02:57clojurebot"([keys vals]); Returns a map with the keys mapped to the corresponding vals."
02:57mmarczykthat would give you empty seqs for values in the map and you'd call seq when dealing with them
02:58mmarczykor you could (remove empty? (map line-seq ...))
02:58mmarczykand I think there's a blank? function in clojure.contrib.string (used to be called c.c.str-utils)
02:59zkimyeah, so for now I think I'm going to go with the empty seq, since that seems to be what line-seq would return, and make a has-error? function to deal with checking for errors
02:59zkimthank you both for your help
03:00mmarczyk(if-let [errs (seq (:err your-map))] (had-errors ...) (no-errors ...)) is a possibility too
03:00zkim,(doc if-let)
03:00clojurebot"([bindings then] [bindings then else & oldform]); bindings => binding-form test If test is true, evaluates then with binding-form bound to the value of test, if not, yields else"
03:00mmarczyksince seq will force enough of your sequence to determine whether it is empty or not
03:00mmarczykreturning nil if it is
03:01mmarczyknote binding-form can use destructuring safely
03:01zkimman, I think if-let's above my pay grade right now
03:02mmarczykyou'll get used to it upon using it for the first time :-)
03:02zkimhehe
03:34cYmenI have a question about leiningen..sort of
03:34cYmenI want this http://clojars.org/overtone/vimclojure
03:34sexpbot"vimclojure | Clojars"
03:34cYmenbut I don't get what it has to do with leiningen I thought that was a build tool
03:35mikemif you add that to your dev-dependencies, it will be placed into your lib/ directory. then you don't have to add its location elsewhere on your system to the nailgun classpath
03:36mikemcYmen: ^ that's for you :)
03:37cYmenaha...so basically I'm changing the project to suite the editor...that seems wrong
03:37cYmenbut I don't want to bitch about things I don't half understand so sorry
03:37cYmenCan you instead tell me how to use it? :)
03:37mikemit's a development dependency, but you're right, if someone else who uses emacs runs `lein deps` they'll also pull down vimclojure
03:38mikemcYmen: I'll refer you to this blog post: http://www.deepbluelambda.org/programming/clojure/programming-clojure-with-vim
03:38sexpbot" Programming Clojure with Vim : Deep Blue Lambda"
03:41cYmenmikem: Thanks!
03:49zmilasexpbot
03:52Licenser_morning
03:57LauJensenMorning all
04:07Licenser_morning
04:14LauJensenmmmm coffee
04:17Licenser_mmm tea!
04:25LauJensenAre there any websites that ship some really excellent tea internationally?
04:28uberjarhttp://www.adagio.com/black/yunnan_gold.html
04:28sexpbot"Yunnan Gold Tea"
04:33LauJensenThanks - I'll give it a shot
05:03hircusuberjar: ooh, they have several smoky teas, not only Lapsang Souchong! thanks for the link (a bit dubious about their claim that Lapsang is the same as Russian Caravan though).
05:12Licenser_LauJensen: hmm hmm
05:13Licenser_LauJensen: I buy my tea at https://www.tee-direkt.com/
05:13sexpbot"Document Moved"
05:14Licenser_but I'm not sure if they ship internationally
05:15LauJensenI could probably find the same on a danish site then, since we're so close. I dont
05:16LauJensen know anything about tea, except almost everything I've tasted I disliked, except Silver Pearl Jasmin and something called 'London' which I drank while I was in London and extremely thirsty, so I might have been tricked by my senses :)
05:23Licenser_LauJensen: I right now drink Dragon Pearl, it's a very nice green tea with jasmin
05:37zmila... changed topic to clojure tea or tea clojure
05:44Licenser_Clojure, the Language, the Tea, the live.
05:46BorkdudeI prefer coffee, but when it comes to tea I like Minty Morocco, no I idea if something like it is available abroad: http://www.pickwick.nl/MintyMorocco.aspx
05:46sexpbot" Pickwick NL | Assortiment | Variatie | Minty Morocco"
05:46LauJensenBorkdude: I'm 99% a coffee guy, but I have a hunch that tea might be healtier and caffeine does yield addiction
05:47hircusLauJensen: teaism.com is quite good too -- they run some really interesting fusion tea rooms in Washington DC. Only place so far I've seen that sells French verbena
05:48BorkdudeLauJensen, I agree, I'm also aware of the addiction... time for my third cup of home brewn espresso now ;-)
05:48hircusscratch that. does not ship overseas
05:48LauJensenTraveling to the US might be a bit extreme for a cup of tea, but if its that good I'm open to it :)
05:48Chousuketea has caffeine too though.
05:48LauJensenChousuke: Not all teas, and not in a comparable measure as far as I understood
05:49Chousukehttp://coffeetea.about.com/library/blcaffeine.htm is what I found via quick googling
05:49sexpbot"Caffeine Content of Coffee, Tea, Chocolate"
05:50LauJensenwhite tea is a keeper :)
05:50ChousukeI usually drink black tea or coffee... all without any sugar or milk :P
05:50BorkdudeI try to avoid coffee after 7 PM
05:50LauJensenCow milk is poison anyway, far beyond caffeine :)
05:51Borkdudethen I drink tea instead
05:52BorkdudeLauJensen, you are from Denmark right?
05:52LauJensenyea
05:52Chousukewhen I was a teenager I used to put three teaspoons of sugar in a cup of coffee. :P Now the mere thought of drinking such stuff causes a gag reflex
05:53BorkdudeThere is a group from Denmark having kind of a hit here in the Netherlands, Alphabeat, it just came by on the radio hehe
05:54LauJensenAh ok - I dont follow contempory music, or music in general :)
05:54LauJensen(or soccer)
05:55esji figure, more foam in cup implies less coffee
05:57hircusLauJensen: don't follow soccer much either, and thankfully I've always lived in a city with a lousy local team :)
05:57LauJensen2) gen-class can add methods, proxy cannot
05:57Borkdudeesj, we call café latte koffie verkeerd (coffee wrong, literally) here
05:58LauJensenand modify constructors
05:58bsteuberLauJensen: ah, ok
05:58LauJensen~source proxy
05:58Chousukebsteuber: proxy methods just dispatch to clojure functions
05:58esjverkeerd is die verkeerde woord
05:58Chousukebsteuber: so that they can be dynamically updated
05:58esj;P
05:58LauJensenand I think re 1) that proxy returns fns, not a literal method - though I dont want to be asked about the difference :)
05:59Borkdude~source slurp
05:59Chousukeall proxies of a single class are instances of the same proxy class.
06:00Borkdudeunable to find...
06:00Chousukethey just have a different function map
06:00bsteuberChousuke: but gen-class methods can ba altered as well, can't they?
06:01bsteuber*be
06:01Chousukebsteuber: I think so yes. they dispatch to clojure functions too
06:02bsteuberah, guess I just confused topics - was reading 'bout proxy's differences with reify, not gen-class :)
06:02Chousukeso I guess I should say that the methods themselves don't change, they just call a clojure function that *can* change
06:03bsteubermhmm, that makes sense to me - thx to both of you :)
06:04LauJensenChousuke: Thats right, also how the dynamic capabilities were achieved
06:04esjis there simpler way to wrap a value as a function than (fn [x] value). I often do this in (update-in my-map [my-key] (fn[x] new-value).
06:04esji tried #(new-value) but it complains about arity
06:06Chousuke(constantly x)
06:07Borkdudeesj, you can leave out the x in [x]
06:07esjsuperb, thanks gents.
06:07Chousukeno, update-in requires a function of one argument
06:07Borkdudereally, ok..
06:07Chousukebut there's also assoc-in :)
06:08Borkdudeconstantly is a nice thing
06:08esjdoh
06:11LauJensen(btw, Ubuntu 10.04 beta is nice)
06:15bsteuberhow would I mutate fields in deftype? not that I hope I'll ever want to :)
06:26bsteubernevermind - should just read the docs :(
06:29cemerickwow, those new keyword args are sooooo nice.
06:31Borkdudecemerick, what are those?
06:31cemerick,*clojure-version*
06:31clojurebot{:interim true, :major 1, :minor 1, :incremental 0, :qualifier "master"}
06:32cemerickBorkdude: clojurebot's not using 1.2, but if you are, you can specify keyword args using: (fn [a b c & {:keys [d e f]}] [a b c d e f])
06:33bsteuberwhat's wrong here? (hope 3 lines are ok to paste directly..)
06:33bsteuber(deftype Bar [#^{:unsynchronized-mutable true} a b c])
06:33bsteuber(def bar (Bar. 1 2 3))
06:33bsteuber(set! (. bar a) 42)
06:33bsteuber=> No matching field found: a for class user.Bar
06:33cemerickand you can call that with (foo 1 2 3 :d 4 :e 5 :f 6)
06:33cemerickBorkdude: ^^
06:34Borkdudeah like in common lisp?
06:34cemericksimilar, yes
06:35bsteuberoh, overlooked it is only supposed to work in method bodies :)
06:35Borkdudethat's useful
06:35Borkdudegtg
06:44vu3rddLauJensen: did you try the Ubuntu 10.04 beta?
06:50AWizzArd~max people
06:50clojurebotmax people is 274
06:51zmila(filter #(not (lurking? %)) (max-people))
06:52AWizzArdor --> (remove lurking? (max-people))
06:54bsteubercould a deftype expert correct this? http://gist.github.com/376431
06:58cemerickbsteuber: just use (set! a 42)
06:58cemerickkiller error msg there though :-|
06:59bsteubercemerick: ah, thx
07:01bsteuberin general, unreadable error messages are clojure's weak spot IMO
07:01bsteuberhope CinC will help there, too
07:05Licenser_hmm is there a lost of core functions?
07:19cemerickbsteuber: of course, the deftype impl is fundamentally hosty, and I'd think not in scope for the CinC effort. But yes, I hope, too. :-)
07:19defn"OTOH, it makes no sense for a datatype that defines a collection like vector to have a default implementation of map, thus deftype is suitable for defining such programming constructs."
07:20defnthat line is a bit unclear in the deftype/record documentation
07:21bsteuberdefn: I interprete this as "you will want to roll your own map implementation, so we don't give you a default one"
07:21defnah okay thanks
07:21Licenser_hi defn
07:21defnLicenser_: heya buddy
07:21defnim actually just about to get some sleep
07:21defnwill talk to you later
07:21defn:)
07:21Licenser_tehn rest well
07:21defngnight
07:26bosieanyone in here who does NOT use vi/emacs for clojure development?
07:26cemericknetbeans + enclojure here
07:26bosieok
07:27bosietried IDEA and the clojure plugin?
07:27cemerickNo, not yet.
07:28cemerickWe use the netbeans RCP platform for one project, so that keeps us close to netbeans. I do plan on checking out the eclipse and intellij plugins at some point though.
07:28nurvThere is a plugin for eclipse too: http://code.google.com/p/counterclockwise/
07:28sexpbot" counterclockwise - Project Hosting on Google Code"
07:28bosiethe intellij plugin is kind of stale
07:28cemerickYeah, counterclockwise looks pretty slick these days.
07:29bosiehigh activity on counterclockwise
07:30cemerickbosie: you mean the pace of development?
07:30bosieyes
07:30bosiemaybe not pace but at least activity ;)
07:30cemerickI used eclipse for years. It'd be funny if I ended up migrating back there.
07:32bosieanything you dislike about enclojure
07:32nurvWell, for Java code Eclipse is ok.
07:37bosienurv: meaning it isn't for clojure?
07:39cemerickbosie: The code outline isn't so great, especially compared to the functionality I'm seeing in CC's screenshots.
07:39cemerickThe documentation popups with code completion are unreliable.
07:40cemerickAnd I could live with more code highlighting options.
07:40bosiesame problem i have with intellij
07:40cemerickBut in general, it's a solid plugin.
07:40cemerickThe fact that it has a separate embeddable repl server library is a huge win.
07:42nurvbosie: i didn't try clojure development on it i'll probably do at some point.
07:42nurvAlthough i really liked the Cusp plugin for Common lisp.
07:43bosiehmm
07:43cemerickheh, cusp was pretty slick
07:43bosieas long as i don't have to learn emacs ;)
07:43cemerickbosie: what are you using these days?
07:44bosieintellij idea
07:44nurvI use vim mostly, but there is nothing similar to slime
07:44bosiemainly because i use it for java development as well
07:44nurvso i fallback to eclipse + cups for CL.
07:44nurv*cusp
07:45cemerickbosie: yeah, it seems that eclipse and netbeans are both better off than intellij w.r.t. clojure support, at least from what I hear.
07:47bosiecemerick: and the gap seems to widen because the development of the clojure plugin for idea is sporadic
07:47kzarWhat's a good way to turn a list of strings into one string separated by spaces? (apply str string-list) works except it doesn't add the spaces
07:48cemerick,(apply str (interpose " " ["foo" "bar" "baz"]))
07:48clojurebot"foo bar baz"
07:49cemerickthere's also a join fn in contrib...
07:49cemerick,clojure.contrib.str-utils2/join
07:49clojurebot#<str_utils2$join__7835 clojure.contrib.str_utils2$join__7835@120da23>
07:49cemerick,(clojure.contrib.str-utils2/join " " ["foo" "bar" "baz"])
07:49clojurebot"foo bar baz"
07:50cemerickstr-utils2 has moved to c.c.string in 1.2 contrib though, FYI
07:50bosiecemerick: wouldnt apply/interpose iterate twice over the same list?
07:50cemerickkzar: ^^
07:50cemerickbosie: No. Interpose is lazy.
07:51bosieah right
07:51kzarsweet thanks everyone
07:53cemerickbosie: I don't know that intellij could ever keep up with the other IDEs -- the closed-source heritage means there'll always be a smaller community around it.
07:54bosiecemerick: yea
07:55cemerickI'd love to pay for a super-polished clojure environment. I've got $500 for whoever can make it happen.
07:55bosiecemerick: gimme the 500 bucks... and come back in two years ;)
07:55cemerickheh
07:56bosiecemerick: but yea, depending on your view of 'super polished', that might not happen soon (see the ruby communit)
07:58cemerickbosie: well, NB's ruby support is pretty amazing, given the nature of the language.
07:58cemerickBut yeah, I see your point.
07:58cemerickwe'll see if anyone rises to the challenge: http://twitter.com/cemerick/statuses/12697662057 :-)
07:58bosiecemerick: amazing isn't the word i would use though
07:59cemerickbosie: really? Given the curve-balls that ruby throws?
07:59cemerickJust writing the grammar for ruby would be a scary undertaking.
08:00bosiehehe yea but i don't care for the curve-balls
08:01bosieif i include a library that extends all classes with specific functions i would like to have them show up in the completion table
08:03bosiei doubt you can write grammar rules for that
08:03cemerickYeah, that requires a running environment for introspection.
08:04bosieor an understanding of ruby code
08:04cemerickwell, building up the understanding necessary to add those fns to the completion table that you added to the string class (or whatever) would require a running environment.
08:05cemerickif monkey-patching were declarative, that might not be the case
08:06bosiecemerick: hmmm why do i need a running environment? you can only add methods with a handful of methods
08:11cemerickbosie: Yeah, you could probably figure out the common cases. If ruby's anything like python though, you can add or replace methods via references to classes, so a static analysis won't catch everything if you're not doing something simple as string.mymethod = ....
08:12bosiecemerick: i gotta go, thanks for the talk
08:17zmilacemerick, what are criterion of "super-polished clj env"
08:18cemerickrhickey: FYI, real usage of kwargs has convinced me of it entirely. Don't know how I lived without it before. :-)
08:18rhickeycemerick: kwargs?
08:18cemerickzmila: I suppose I should formalize my wishlist somewhere. :-)
08:18cemerickrhickey: keyword rest args
08:19rhickeyah, great!
08:23borkdudedoes anyone here synchronize their .emacs file with git?
08:23rfgborkdude: I've committed mine to memory.
08:25fogusborkdude: Mine is 1-line. ;-)
08:27borkdudefogus, tell me the line ;)
08:28fogus(load-library "~/.emacs.d/init.el")
08:29fogus:p
08:29_atols: cannot access /home/ato/.emacs: No such file or directory
08:29_atoborkdude: but to answer your question, yes
08:30bsteuberborkdude: me, too
08:30_atomy whole home directory is a git checkout
08:30hircus_ato: even music files and videos?
08:30fogus_ato: I have a similar error ls: cannot access ~/.vimrc: No such file or directory ;)
08:31bsteubermy .gitignore is very restricted, though :)
08:31borkdudefogus: I was hoping for: (tool-bar-mode -1)
08:31SynrGfogus: how did your system get so broken?
08:31hircusI have several git repos for ~/bin and several other dirs but not the entire home dir
08:32_atohircus: nah, it's pretty selective, I keep notes, configuration, ~/bin in main home dir git. Some things have seperate repos, like emacs configuration
08:32fogusborkdude: I use Aquamacs
08:33rfgfogus: What version of Aquamacs do you use?
08:33_atoI use a wrapper script "hgit" which sets GIT_DIR so I don't accidentally commit stuff to my home directory git went I meant to commit to a project or something
08:34fogusrfg: 1.9
08:35fogusI'm not married to Emacs for all of my development though. I use it a lot, but for Java, Scala, and Python work I use other things
08:36chouser_ato: brilliant. I have all that except for the hgit script.
08:45_atooh and the other bit you need is: git config core.worktree /home/ato
08:46_atothen you can move the .git somewhere else
08:46_atoand the regular git command won't find it unless you explicitly set GIT_DIR at the path you moved it to
08:48LauJensenvu3rdd: Yea I'm on it now
08:48LauJensen(ubuntu 10.4 that is)
08:48vu3rddLauJensen: Ok
08:49vu3rddLauJensen: I thought you were on OSX
08:49LauJensenNo I cant stand the thing
08:49vu3rdd:)
08:49vu3rddhttp://www.flickr.com/photos/jonobacon/4543428023/sizes/l/
08:49sexpbot"Flickr Photo Download: screenshot"
08:49borkdudeLauJensen: I just installed Ubuntu 9.10 on this laptop, any good reasons to upgrade to 10.4 right now?
08:50LauJensenborkdude: No then you might as well wait until it goes out of Beta, but expect something like a 60 - 70% drop in boot time an finer social networking integration
08:51borkdudeIt looks like my webcam is turned on by default in Ubuntu, are they spying on me?
08:51LauJensenI dont know, are you good looking ? :)
08:51LauJensenI haven't experienced that behavior, though I have a built in web cam
08:52borkdudeme2
08:52vu3rddborkdude: what do you mean by turned on?
08:53borkdudethe led is burning, I think it doesn't do that in windows
08:53vu3rddok.
08:54vu3rddUsually when the driver is loaded, the led turns on. so perhaps that is what you are seeing
08:54vu3rddsudo lsmod | grep uvcvideo
08:55vu3rddyou can rmmod it if you are concerned
08:56borkdudevu3rdd: lsmod didn't return a line
08:56vu3rddok, may be your webcam is not uvc camera
09:12mmarczykLauJensen: www.whittard.co.uk have good leaf teas and ship them everywhere
09:12sexpbot"Whittard of Chelsea - Tea , Coffee , China , Teapots , Tea Sets"
09:31bendlasI need an informed opinion on servers before learning a specific one:
09:32bendlasI want to write a webservice with comet/long-polling
09:32bendlaswhich server would you recommend as a technical basis for that?
09:34bendlasw.r.t clojure support, although i don't mind writing some framework of my own
09:35bendlasmy first sample was jetty with blocking, which of course, is not very scalable
09:37AntonyBlakeybendlas: have you looked at Netty?
09:37AntonyBlakeyI've used it from Clojure
09:38bendlasi'm aware of it's existance, but i don't know how it compares to the alternatives
09:38bendlasis it any good?
09:38AntonyBlakeyIt seemed so to me.
09:38neotykbendlas: please check atmosphere project
09:40neotykit will run comet on all servers, and if server has native api for it or supports servlet 3.0 you'll get native performance
09:40neotykand we would appreciate a lot clojure support ;-)
09:40bendlasnice, i'll check it out
09:41patrkris_rhickey: just out of curiosity, are there any planned changes to the STM?
09:41bendlasthanks
09:43hamzadoes the agents and future objects use the same thread pool? or two seperate pools?
09:43cemerickneotyk: atmosphere looks interesting, thanks for the pointer
09:44cemerickhamza: same, IIRC
09:44patrkris_hamza: depends on whether you use send or send-off, I guess
09:44chouserfutures use the send-off pool
09:44patrkris_yes
09:44neotykcemerick: pleasure is mine, just spreading the word of project I contribute to
09:46hamzaohh kk, i was using send pool for some blocking actions and was wondering if futures gets blocked, then i am fine..
09:47bsteuberneotyk: for the less gifted ones among us, for what exactly can I use atmosphere?
09:49bsteuberis it some sort of high-level web application framework?
09:49neotykbsteuber: comet applications, broadcasting in http, pub-sub, long polling, and ajax push
09:49neotykthis is framework that provides one API to do comet
09:50neotykand allows you deploy to 'any' servlet container
09:50neotyk'any' as it makes sense to deploy to one that has comet api available
09:52neotykso if you would write comet app for jetty you would not be able to run on grizzly, tomcat, jboss, you name it, by using atmo you can, plus you get higher lever functionality like broadcasting
09:52neotykdoes that make sense?
09:53bsteuberneotyk: yes, at least enough to be motivated for further investigation
09:54neotykcool
09:54bsteuberbut it seems quite annotation-heavy - isn't that a problem with clojure?
09:54neotykyou have two ways to work with it: Jersey like and it is annotations, and api like
09:54borkdudeit turns out my webcam isn't supported in linux yet I guess: http://linuxlaptopwiki.net/wiki/ALi_Corp_M5602
09:54sexpbot"ALi Corp M5602 - LinuxLaptopWiki"
09:55borkdudenot that i want to use it, I just want to turn that damn led off
09:56neotykbsteuber: you know java people like annotations a lot
09:57neotykbut we have it used in akka, that is scala application
09:57bsteuberneotyk: ic, nice
09:57neotykI was thinking of integrating it as middlewere for compojure, but I lack Clojure foo
09:59bsteuberso atmosphere includes some javascript-generation like JWT, too?
09:59neotykbsteuber: mew release should have JQuery integration, but it is not forced on user
10:01bsteubermew?
10:01neotyks/mew/new/
10:01rhickeypatrkris_: I have ideas for STM - knobs for retries/timeouts etc per-transaciton, also some ideas around transaction timestamps
10:01bsteuberok
10:03patrkris_rhickey: anything you want to share that we can maybe do some prototyping with? we're doing a little benchmarking on the stm and trying to find out the effects of different changes.
10:03rhickeypatrkris_: no code yet
10:03patrkris_rhickey: ideas would be fine - we don't mind coding a little ourselves :)
10:04patrkris_rhickey: but if you don't have the time, that's ok - we have some papers we're looking through
10:05rhickeypatrkris_: what do you want that it doesn't do?
10:05bsteuberneotyk: JQuery looks nice
10:06patrkris_rhickey: nothing in particular. We're just looking at the STM litterature and seeing if we can find something we could try out on Clojure's STM. Just to see the effects in a few small benchmarks we have written. Nothing fancy.
10:07rhickeypatrkris_: one obvious area is contention-resolution, which is currently hardwired to oldest-transaction-wins
10:07patrkris_rhickey: cool, noted
10:14patrkris_rhickey: R. Mark Volkmann's page about Clojure's STM notes that you were inspired by the Robert Ennals article (noted at the section about blockAndBail). Where does he know this from? Did he just ask you, or is it described somewhere?
10:16rhickeypatrkris_: I just mentioned it at some point
10:25patrkris_rhickey: just one more question, and you'll have to excuse me, because I'm a little confused: does Clojure's STM exhibit obstruction freedom or does it not?
10:25rhickeynot
10:28npoektopHi! I have a question about compojure. From flash i do file["postData"] = "sid=..."; file.upload(urlRequest, "image", true); How to get that postData in compojure?
10:31AWizzArdnpoektop: the client (be it the browser (html&js) or flash or any other application with network access to your app) must send the data over http. There it can be encoded in the header or body. In Compojure each handler gets a request hashmap. In that you can find all data which the client sent
10:32npoektopAWizzArd, ok, i'll try. thank you
10:33hugodis there a function to return the namespace of a symbol?
10:40woobyi have some functions that take vectors as args
10:40dnolenhugod: namespace if it's a namespaced symbol, otherwise you may have to look at the metadata of the var.
10:40woobyand i'm dispatching based on whether one of the items is a keyword starting with a question mark
10:40dnolen,^#'defn
10:40clojurebot{:macro true, :ns #<Namespace clojure.core>, :name defn, :file "clojure/core.clj", :line 206, :doc "Same as (def name (fn [params* ] exprs*)) or (def\n name (fn ([params* ] exprs*)+)) with any doc-string or attrs added\n to the var metadata", :arglists ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?])}
10:40woobyis this the sort of thing that deftype and all the new stuff are looking to simplify?
10:41bsteuberwooby: no, deftype etc. are for performance mostly
10:41hugoddnolen: thanks, I forgot about metadata
10:42woobyalrighty, thanks bsteuber
10:43hugoddnolen: but that only works if you have a var...
10:43dnolenhugod: then namespace should work right?
10:44hugodon an arbitrary symbol?
10:45dnolenhugod: but where is the symbol coming from? sounds like your doing something fancy with macros?
10:45hugodoh, it does work
10:45hugoddnolen: from a string...
10:58ivenkysgents - simple question - what is the name of the ^ symbol ? (google-fu not working)
10:59dnolenivenkys: meta
10:59ivenkysi.e. the metadata symbol
11:00Chousukenote, it's deprecated
11:00ivenkysdnolen: thanks
11:00Chousukeinstead of ^foo you're now supposed to write (meta foo)
11:00ivenkysChousuke: meta symbol is deprecated ?
11:01dnolenivenkys: in 1.2.0 yes
11:01Chousukeyeah, it'll eventually be changed to do what #^ does now.
11:01chouseryes, it's eventually going to become the set-metadata symbol
11:02ivenkysChousuke: chouser: thanks
11:23lessthantristanok i have some code that looks something like this: http://gist.github.com/376581 (this is the most basic version i could write that still has the problem).
11:24lessthantristanbasically, if the recursive function finds something it doesn't like it'll throw an exception. if the exception is not a ParseException and a :catch-error element is present in the input, it will handle the error otherwise it throws it down to the stack which checks the same thing.
11:24lessthantristanThe problem is that the exception gets wrapped in RuntimeExceptions as it goes down the stack so the = class call stops working after the initial throw. anyone got any ideas on how to fix this?
11:34raekI think that when lazy seqs are evaluated, checked exceptions are caught and a runtime exception is thrown
11:35raekif the exception is not checked (i.e. inherits from Error or RuntimeException) it will pass through, I think
11:35lessthantristanhmm it might be something to try (in my real code i am using custom exceptions)
11:37chouserlessthantristan: you probably want to use the root exception rather than the one 'catch' hands you
11:37chouserin your = I mean
11:38chouserclojure.stacktrace/root-cause
11:40lessthantristanah ok i'll have a look at that too
11:41livingstonI'm not sure of the context (I joined in the middle of this conversation), but java Exceptions also have a getCause method that you can chain through
11:41lessthantristanbtw. i changed my exceptions to extend Error rather than exception and this makes the code run how i want
11:41livingstonit's good practice in java if you catch and re-throw to set the cause to the caught exception
11:42livingstonextending Java Error? i don't know about in Clojure, but in Java that's bad practice, you should extend the leaf types, like RuntimeException
11:44lessthantristansure. it's probably just as bad in clojure :). i'll have a look at chouser's idea. (btw, for context http://gist.github.com/376581 description in the comments)
11:44chouser,(try (seq (lazy-seq (throw (NoSuchMethodException. "foo")))) (catch Throwable e (printf "Caught %s, root %s\n" (class e) (class (clojure.stacktrace/root-cause e)))))
11:44clojurebotchouser: It's greek to me.
11:45chouseroh, it doesn't let you do try/catch
11:45livingstonagain this is from Java, but catching Throwable is a really bad idea
11:46livingstonThat will catch Errors, and Checked and Unchecked Exceptions, (catching Exception is just as bad, because that traps both checked and unchecked)
11:48lessthantristanso i guess if you're making your own exception classes you would extend something like RuntimeException then catch that (if you're interested in just catching all your custom exceptions)?
11:49livingstonexactly
11:50livingston_my stupid office blocks IRC because "only hackers use that" so I have a bad web client...
11:50lessthantristanchouser: that code runs in the repl. maybe clojurebot doesn't have clojure.stacktrace required?
11:51livingston_I don't know what i missed
11:51slyphonlivingston_: wow, that's piss poor
11:51slyphonlivingston_: actually, nothing :)
11:51mmarczyklivingston: isn't your office *supposed* to be a hackers' workplace? :-)
11:51livingston_but if you want to make your own exceptions you should extend Exception or RuntimeException
11:51chouserlessthantristan: clojurebot refuses to run code that includes 'try'
11:51lessthantristanah ok
11:52chouserI had forgotten
11:52livingston_mmarczyk: yes, kinda it's hard when there are only a few CS people in a sea of people that know nothing about computers
11:52lessthantristan:)
11:53livingston_re exceptions, it's also preferred to use the existing ones when they do fit (there are a lot of standard ones)
11:53mmarczykmay I suggest that you exploit your superior knowledge to subvert the IT policy to your advantage? ;-)
11:54livingston_mmarczyk: it is very draconian here - there are forms to be filed to use skype, because "why wouldn't you use our conference call lines?" (which aren't free by the way)
11:55livingston_mmarczyk: Monday's mission is get 6667 unblocked
11:55mmarczykoh, that's rather extreme :-(
11:55dakronelivingston_: tunnel through SSH?
11:56mmarczykhere's hoping you accomplish that
11:56livingston_dakrone: I can, I would need somewhere that would forward for me though, and I've never gotten around to setting that up
11:57mmarczyk,(= '(1 2 3) [1 2 3])
11:57clojurebottrue
11:57mmarczykis this really by design?
11:57chousermmarczyk: yes
11:57replacalivingston_: I keep a linux machine running at home so I can tunnel from anywhere I am - it's super-convenient
11:57chouser,(= '(1 2 3) (range 1 4))
11:57clojurebottrue
11:57mmarczykhm, thanks, good to know
11:57chouser(map class '(1 2 3) (range 1 4))
11:57chouser,(map class '(1 2 3) (range 1 4))
11:57clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$class
11:58chouser,(map class ['(1 2 3) (range 1 4)])
11:58clojurebot(clojure.lang.PersistentList clojure.lang.LazySeq)
11:58mmarczykI don't think I mind
11:58dakronelivingston_: I understand your situation, I have to tunnel IRC through SSH through SSL to get mine working
11:58replacalivingston_: also, I can use it a secure web proxy when I'm on open wireless
11:58mmarczykbut I do wonder about the rationale?
11:58livingston_replaca: yeah I might resort to that - how do you get a static address?
11:58tcrayfordis there a function to drop every other element of a seq?
11:58livingston_I haven't even set up home internet yet, I just moved
11:59mmarczyk(actually, I seem to be experiencing a moment of enlightenment whereby this starts to make sense)
11:59chousermmarczyk: clojure tries to avoid relying on concrete types as much as possible. You see that '(...) and (range ...) return different types?
11:59mmarczykyes
11:59mmarczyktrue
11:59chousermmarczyk: you usually don't care that they're different, even when using =
11:59mmarczykand then I seem to remember clojure.lang.Cons being used by the reader?
12:00mmarczykok, starts to make sense
12:00mmarczykthanks
12:00chousermmarczyk: so Clojure partitions collections into three groups for purposes of equality: lists, sets, and maps.
12:00chouser,(take-nth 2 (range 10))
12:00clojurebot(0 2 4 6 8)
12:00chousertcrayford: ^^^
12:00tcrayfordyeah, cheers
12:00tcrayfordwas doing something horrible with indexed
12:01mmarczyk,(= {0 0 1 1} [0 1])
12:01clojurebotfalse
12:01tcrayfordtests still pass, so its good, cheers
12:01chousermmarczyk: we go to lengths to explain this as best we can in Joy of Clojure.
12:01mmarczykyup, I'm reading through it
12:02mmarczykgreat reading so far, by the way
12:02tcrayfordis work on clojure-in-clojure starting after 1.2?
12:02chousermmarczyk: oh, great. early in chapter 4 then. :-)
12:02mmarczyk:-)
12:03chousertcrayford: 1.2 *is* work on clojure-in-clojure, to a certain extent.
12:03tcrayfordI guess so
12:04chouserI want to start poking at pieces of it as soon as this book's out of the way.
12:04tcrayfordheh
12:04tcrayfordthe book is much better this iteration
12:04slyphonok, can someone explain why ~foo# in a macro doesn't compile?
12:04tcrayfordcompared to the first one
12:04chousertcrayford: ah, good. glad to hear it.
12:04livingston_so java has the edu.univ.lab.package ... mostly standard naming convention
12:04hiredmanslyphon: # gensyms only work inside syntax-quote and ~ is unquote
12:04mmarczykslyphon: because gensyms created with # are only valid within the syntax-quote their created in
12:05livingston_is clojure kinda sticking to that? or is it just the wild-west for package names?
12:05chouserlivingston_: depends on who you talk to. I'd recommend sticking with Java conventions.
12:05mmarczyklivingston: most Clojure libs I use follow the packagename.core, packagename.foo convention for naming namespaces
12:06mmarczykoh well :-)
12:06livingston_chouser: that's what I figured, probably makes java interop a hair better too?
12:06mmarczykslyphon: so, have you figured out why your macro didn't work as originally written?
12:06chousermmarczyk: and if someone else also uses packagename, stride out into the street at high noon and have at it.
12:06chouser:-)
12:07slyphonmmarczyk: yeah, but it turns out our version didn't work as expected outside of that ns
12:07mmarczykchouser: hell yeah, the jerk should have known better ;-)
12:07livingston_mmarczyk: yeah but then who gets dibs on rdf or sql or whatever library standard names, etc..
12:07lessthantristanhah. with clj.stacktrace, the final exception becomes a java.lang.reflect.InvocationTargetException (e.g. my solution under http://gist.github.com/376581 below line 25). it doesn't matter if i keep using root-cause but i wonder where that's coming from
12:07mmarczykslyphon: how come?
12:08LauJensenmmarczyk: thanks! :)
12:08mmarczyklivingston: first come, first to fortify one's positions ;-)
12:08mmarczykLauJensen: sure thing :-)
12:09chouserbsteuber: yay! :-)
12:09mmarczykLauJensen: I find the "Orangajuli" (spelling?) Assam to be particularly good, if they still have that
12:09livingston_lessthantristan: just remember if you catch Exception you will get *all* of them even a lot of runtime ones you might not want to trap
12:09s450r1tis a very good book, nice sequel to "Programming Clojure"
12:09tcrayfordis the only difference between rest and next that next returns nil on empty seqs?
12:10tcrayford,(rest [])
12:10clojurebot()
12:10slyphonmmarczyk: ok, that seemed to work
12:10tcrayford,(next [])
12:10clojurebotnil
12:10slyphonmmarczyk: i thought i ran into trouble with it
12:10mmarczykum, apparently they don't, but http://www.whittard.co.uk/store/catalogue/Tea-P2000/India-TIND/Loose-Harmutty-Gold-Tips-105668.raa is close
12:10sexpbot"Tea &gt; India - Whittard Of Chelsea"
12:11mmarczykslyphon: so it works now? happy to hear that :-)
12:11livingston_tcrayford: yeah, I was trying to sort that out too, and what's preferred, i've been seeing different descriptions that have confused me
12:11slyphonmmarczyk: must have been stale repl state last night...or the beer...
12:11mmarczyk:-)
12:13slyphoni think i'm still not really sure what the syntax quoting is doing, i mean, in general. it seems like a lot of macros open with a `(), and then do escaping throughout, but there are others like your solution
12:13tcrayfordtechnomancy: I think there might be a bug with that xref patch I sent you
12:15mmarczykslyphon: oh bother, I just realised that that macro will fairly often *not* work
12:15slyphonoh?
12:15mmarczykbecause it assumes it's being passed a map literal for props-map
12:15slyphonah! yes!
12:15slyphonthat was it
12:15mmarczykso (update-bean *bs* some-var-holding-a-map)
12:15mmarczykwon't work
12:16mmarczykright, let's fix that
12:16slyphonwhy does that happen?
12:16technomancytcrayford: oh, good thing I've been too busy to apply it then. =)
12:16tcrayfordheh
12:16tcrayfordtechnomancy: I think it doesn't work on any project other than swank
12:16tcrayfordI THINK
12:16tcrayfordI could kinda use some testing though
12:17tcrayfordeither that or I've been compiling it wrong
12:17slyphonso `() is kind of like "make a form that looks like *this*" and ~blah substitutes the value held by blah into the form?
12:17tcrayfordyes
12:18slyphonok
12:18mmarczykslyphon, first see http://gist.github.com/376105
12:18mmarczykfor a proposed fix
12:18slyphonkk
12:18tcrayfordtechnomancy: when I try to compile it, (even after changes), it shows that all namespaces are already compiled
12:18slyphonmmarczyk: ahh, yeah
12:18mmarczyktechnomancy: Leiningen seems to be pulling two version each of ant and ant-launcher
12:18slyphonmakes sense
12:19mmarczykis this a known issue (or do I need to check my local maven repo or sth)
12:19mmarczyk?
12:19livingston_if that macro isn't taking constants in, you really should probably just be using a regular function - being a macro isn't buying you anything if there is nothing to pre-compute
12:19mmarczykslyphon: the macro receives its argument "as is"
12:19mmarczyklivingston: you can't use a regular function here
12:20slyphonright right, it's not getting "the value of"
12:20mmarczykbecause you need to expand into . forms
12:20livingston_slyphon: regarding macros in general the syntax quote is nothing special, it's short hand - you can write macros just fine without out. think about this:...
12:20mmarczykwhich need to include your custom-generated symbols
12:20mmarczykthe shape of which depends on the map you pass in to the macro
12:21technomancymmarczyk: there's probably a dev-dependency that is declaring unnecessary deps.
12:21tcrayfordtechnomancy: tell a lie, I hadn't compiled it properly
12:21slyphonlivingston_: yeah, i know it's the inverse of the 'form
12:21livingston_if you have the code (+ foo bar) that is just a list of three symbols if you want a macro to produce that code it's just: (list + foo bar)
12:21tcrayfordtechnomancy: just tested it on all of the clojure projects I use swank on, all of them work
12:21mmarczyktechnomancy: guess so, I'll investigate
12:21technomancymmarczyk: in fact, I think the swank plugin might do that.
12:21slyphonlivingston_: *nod*
12:21technomancymmarczyk: could you submit an issue or patch?
12:21mmarczykwill do
12:22technomancytcrayford: does your patch need AOT?
12:22technomancywe try to avoid it if possible?
12:22technomancyerr--possible.
12:22tcrayfordI don't think so, was just putting it as a dependancy for other stuff via lein jar
12:22slyphonargh
12:22mmarczykincidentally, why would the swank-clojure dev dep ever be possible
12:22slyphonmmarczyk: "Can't eval locals"
12:22livingston_slyphon: so just start with an example of the code you want to come out and then think about the what you need to cons together to produce that list/tree of symbols.
12:22tcrayfordI think I'm just being bad with terminology
12:23mmarczykI never remember remember about it and yet it always works :-)
12:23mmarczykslyphon: ouch, one more fix then
12:23mmarczykjust a sec
12:23slyphonsure
12:23slyphonhm
12:24tcrayfordtechnomancy: currently it seems to be bugging out on some symbols. It works fine with defn, but not with if
12:24technomancytcrayford: defn is a var, but if isn't
12:25technomancyit's a special form
12:25tcrayfordah
12:25technomancyso that's OK
12:25tcrayfordthat'd explain that one, seeing as I get stuff from vars
12:25technomancyyeah, trying to track down every use of a special form would be pretty hardcore, but we can do without it. =)
12:25tcrayfordheh
12:25mmarczykslyphon: could you test this new version?
12:25slyphonsure
12:26slyphonwhat's &env ?
12:27tcrayfordtechnomancy: it probably needs proper error messages. Currently it'll mess up if it can't find any references (you get a char-or-stringp error from emacs)
12:27mmarczyk&env is an implicit argument that macro functions receive
12:27mmarczykholds a map of locals
12:27slyphonahh
12:28mmarczykactually, I'll modify the code a little bit yet
12:28slyphonso (&env props-map) is kind of like (a-hash-map :key) ?
12:28tcrayfordtechnomancy: and it only works after each namespace is actually loaded (as far as I can see).
12:28mmarczykdone
12:28slyphonahhh
12:28slyphonright on
12:29mmarczykslyphon: exactly, and (get &env props-map) is immune to NPE
12:29slyphonso &env is a hash of local symbols-to-values
12:29slyphon:)
12:29mmarczykright, but will be nil if there are none
12:30mmarczykbasically this macro makes the assumption that props-map is either a map literal or a symbol naming either a local or a Var
12:30mmarczykand locals win over Vars, as they should
12:30slyphonwow
12:31mmarczykgreat, now I'll have an update-bean macro lying around
12:31mmarczykfor whenever I get the point of beans
12:31mmarczyk:-)
12:31slyphonthis was way more involved than i'd originally thought
12:32slyphonmmarczyk: beans are just java's way of adding an unnecessary layer of indirection around objects
12:32mmarczyksounds like fun :-)
12:32slyphonit's just the convention of getThatThing() setThatThing()
12:32slyphonto change the internal state of an object
12:33mmarczykright
12:33mmarczykhm, actually
12:33mmarczykperhaps this could be a function if we used reflection instead of .
12:33slyphonto be consistent with their total contempt for elegant syntax
12:33slyphonmmarczyk: well, the 'bean' function uses reflection
12:33mmarczykmakes perfect sense ;-)
12:33slyphonbut i didn't want to go there
12:34slyphon:)
12:35AWizzArdhttp://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html
12:35sexpbot"Messages not Models: Clojure vs JavaFX Script: only 5x slower!"
12:36livingston_AWizzArd: it says "after normalizing to so-and-so's machine speed" - that benchmark is pretty suspect
12:37livingston_same cpu? same os? same ... ?
12:38AWizzArdwell, you can try to check tak in java vs tak in clojure on your own machine
12:38Licenserhmm hmmm
12:38chouserall the code on that page is using boxed math
12:39slyphonwhat's the function that lets you assoc into a nested map?
12:39mmarczykassoc-in
12:39tcrayford,(doc assoc-in)
12:39clojurebot"([m [k & ks] v]); Associates a value in a nested associative structure, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created."
12:39slyphonmmarczyk: thanks
12:40slyphoni thought so, it wasn't in the cheatsheet though :)
12:43livingston_there was a change made to lein so you can put some dependencies not managed by maven in a directory and they would get on the classpath.. is there docs on that anywhere (I'm having trouble finding it)
12:44mmarczyklivingston: whatever you put in lib/ will be on the classpath
12:44mmarczykyou don't need a patch for that
12:44mmarczykwell, actually any jar you put in lib/
12:44livingston_yeah but lein clean will destroy it
12:45mmarczykhm, right
12:45mmarczykyou could work around that with a script to create some symlinks
12:45mmarczyknot very clean though
12:47joshua-choi,(doc deftype)
12:47clojurebot"([type-tag constructor-name docstring? attr-map?] [type-tag constructor-name docstring? attr-map? constructor] [type-tag constructor-name docstring? attr-map? constructor deconstructor]); Define a data type by a type tag (a namespace-qualified keyword) and a symbol naming the constructor function. Optionally, a constructor and a deconstructor function can be given as well, the defaults being clojure.core/identity and cloj
12:48AWizzArdhow can I use recur in an implementation of a protocol?
12:49AWizzArdI have a (defprotocol Takkable (tak [t])). Now I implement (tak [this] ... (recur (Tak. ...)))
12:49AWizzArdNow I get a: Mismatched argument count to recur, expected: 0 args, got: 1
12:50joshua-choiI remember reading somewhere that you don't pass on the first argument.
12:50AWizzArdwhere (deftype Tak [x y z] Takkable (tak [this] ...))
12:51AWizzArdThe first arg is supposed to be an instance of Tak
12:51AWizzArdnot deftype but defrecord
12:51AWizzArd(defrecord Tak [x y z] Takkable (tak [this] ...))
12:51AWizzArdAnd tak wants to recur, with an updated instance of (Tak. ...)
12:51joshua-choiAh yes, check defrecord's docs.
12:52joshua-choi"Note also that recur calls to the method head should *not* pass the target object, it will be supplied automatically and can not be substituted."
12:52AWizzArdYes.
12:53AWizzArdSo I must recur to the immutable instance with which the function started?
12:53AWizzArdI can not alter the "this" arg itself then?
12:53vu3rddtechnomancy: did you get a chance to look at the swank-clojure patch I sent you?
12:53ChousukeAWizzArd: you'll need another arity for that
12:54joshua-choiIs there a set of naming guidelines for Clojure?
12:54joshua-choiSpecifically, for factory functions and protocol methods
12:55Chousukeprotocol methods are named just like ordinary funcitons
12:55Chousukefunctions*
12:55Chousukefactory functions are either make-foo or create-foo I guess
12:55joshua-choiYeah, but what do you name them? "make-"? "create-"?
12:55joshua-choiYeah.
12:55joshua-choiclojure.core uses both.
12:55hiredmanfooify
12:55joshua-choiclojure.core also uses "vector", "vec", etc.
12:56Chousukeit depends on what you're constructing I suppose.
12:56AWizzArdmake- is closer to the Lisp family's history.
12:56joshua-choiAWizzArd: That's good to know.
12:57joshua-choiChousuke: Something called a "State". (make-state ...) (create-state ...) (state ...).
12:58joshua-choiAlso, what about protocol methods? If I make a "getter" method for an "answer", should I name the method (get-answer ...), (answer ...), or something else?
12:58rseniorhi all
12:58joshua-choirsenior: Hello hello
12:58rsenioris anyone persisting blobs with clojureql?
12:59arohnerdidn't someone make a macro that is defn, but it takes a map, to make it easier for macros calling defn?
12:59AWizzArdjoshua-choi: do you think you need a getter?
12:59Chousukejoshua-choi: is the answer a property of the object, or something that's actually computed?
12:59joshua-choiAWizzArd: Versus using a keyword directly on a record?
12:59AWizzArdyes
13:00joshua-choiProbably yes, because I have different types of records that implement this protocol.
13:00AWizzArdhttp://clojure.org/datatypes
13:00joshua-choiFor some types of those records, it's not a simple attribute.
13:01BorkdudeHas anyone got ClojureCLR working?
13:01Chousukethen maybe compute-answer or just answer
13:01Chousukeget doesn't really convey anything useful
13:01AWizzArdOn this site rhickey wrote: "It has always been an unfortunate characteristic of using classes for application domain information that it resulted in information being hidden behind class-specific micro-languages, e.g. even the seemingly harmless employeee.getName() is a custom interface to data."
13:01Licenserodd compairison
13:02joshua-choiAWizzArd: The problem is that some records need to return themselves with this method, while others return an attribute.
13:03joshua-choiChousuke: The problem with not using "get-" is that it can (and in my case does) conflict with using "answer" as a binding symbol in let forms.
13:03Chousukewhat is it an answer to, then?
13:03joshua-choiBut I'm not saying I have to; I'm asking if I should change it. :)
13:03technomancyvu3rdd: sorry, been pretty swamped recently. hopefully I can get back to swank next week.
13:03joshua-choiChousuke: Oh, some parsing thing. Ignore that it's called "answer"; it could be called anything.
13:04vu3rddtechnomancy: no problem.
13:05Chousukejoshua-choi: hmmh. in any case, it doesn't sound like a getter
13:05Chousukejoshua-choi: so maybe you can find a real function name for it
13:06AWizzArdjoshua-choi: is it for the hound? ;)
13:06Chousukeapply-parser or apply-rules or whatever your object actually represents
13:06joshua-choiAWizzArd: It's for both the Cat and Hound. Actually, it's for the common code between them.
13:06AWizzArdk
13:06AWizzArdChousuke: would those be methods of the Protocol?
13:07ChousukeAWizzArd: I don't see why not
13:07joshua-choiAWizzArd: I'm actually almost done...after I rewrite find, substitute, and substitute-1, I'm going to freeze the API and enter the beta stage.
13:07joshua-choiAfter that, just documentation.
13:07AWizzArdChousuke: good, just wanted to be sure.
13:07ChousukeAWizzArd: protocols are just a collection of functions
13:07AWizzArdja
13:07AWizzArdjoshua-choi: very good, I might become one of your beta testers
13:08joshua-choiI'll let you know
13:08AWizzArdjoshua-choi: do you know if the performance to fnparse 1.1 became better?
13:08joshua-choiI don't know for sure.
13:08AWizzArdWe'll see.
13:08joshua-choiI've never rigorously tested.
13:08joshua-choiI'm pretty sure though
13:08joshua-choiCat is a packrat parser.
13:08joshua-choiHound gets rid of a certain space leak that Parsec's introductory paper talked about.
13:09AWizzArdmhmm :)
13:09joshua-choiOther than being LL(1) by default, Hound is the same as FnParse 2.x.
13:09joshua-choiAnd a ton more error features.
13:09joshua-choiActually, the error handing may make Hound sometimes slower than FnParse 2 for short input strings...though I doubt it.
13:09vegaiok, I wanna get Leiningen to work for once. Can you guys help a bit?
13:10joshua-choivegai: What problem are you running into?
13:10etatevegai: whats the problem?>
13:10livingston_vegai: once? or continuously? ;)
13:11BorkdudeWho also the problem 'The extern alias 'MSC' was not specified in a /reference option' when trying to install ClojureCLR?
13:11BorkdudeI put MSC at the Aliases property at Microsoft.Scripting.Core
13:13joshua-choiChousuke: I guess I could try to find a better name for get-answer...no, I don't think there is one. I have plenty of other examples.
13:14joshua-choi(defprotocol AState (get-remainder [state]) (get-position [state]) (make-another-state [state input context]))
13:14joshua-choiI have two types of AStates, and get-remainder is nontrivial for one of them
13:14chouserif it's just doing a value lookup, you could consider implementing ILookupKeyword
13:15chouserer, ILookup, rather
13:15joshua-choichouser: get-remainder doesn't do a value lookup for one type of AState; it has to generate a sequence using drop and stuff.
13:15chouserok
13:15joshua-choiOtherwise, I would have just used :remainder or something.
13:16joshua-choiIs there a better way to name the method other than "get-remainder"?
13:17TakeVIs the CLI version of Clojure as up to date as the Java version?
13:18ChousukeI have never actually looked at it.
13:18joshua-choiWhat's the CLI version?
13:19slyphonjoshua-choi: winders
13:19slyphonjoshua-choi: .NET
13:19joshua-choiAh
13:19Borkdudewhy isn't that called the CLR version?
13:19TakeVEr, yeah, sorry, misremembered the name.
13:20TakeVWas thinking about doing an XNA game, and Clojure is awesome.
13:20BorkdudeTakeV: I'm just trying to get ClojureCLR to install in Visual Studio
13:20Borkdudebut I get a little stuck
13:20TakeVDifficult?
13:20Borkdudenow it can't find the namespace System.Dynamic
13:21BorkdudeTakeV: did you get it to work?
13:22TakeVBorkdude: I haven't tried, most of my work is with the JVM.
13:22Borkdudeit must be something stupid, I'll search some more
13:22joshua-choiIs the ClojureCLR under active development?
13:23woobyjoshua-choi, there's nu for objective-c lisp
13:23woobyit's cool
13:24BorkdudeI have no idea, but I tell everyone doing CLR to take a look at it ;-)
13:24joshua-choiwooby: I'll check that out, thanks.
13:24woobynp
13:24TakeVwooby: Does it work for the iPhone?
13:25livingston_I though Rich abandoned it? because he was sick of supporting two architectures, but maybe someone picked it up?
13:25woobyTakeV, last i checked
13:25TakeVExcellent. :)
13:25woobyi know there have been the recent shenanigans in that realm
13:25woobyso i'm not sure anymore
13:25vegaijoshua-choi, etate, livingston_: thanks. I'll try it one more time by myself first :)
13:26vegaithe last time I tried to build my own simple hello world on it, I got exceptions towards java.lang.String for some reason
13:26clojurebotwhat time is it?
13:27livingston_vegai: one "problem/feature" with lein is that it will leave jars behind in lib so if you have old clojure jars in there, and call lein deps it will leave them and you will get your jvm confused
13:27livingston_vegai: leain clean will flush that directory though
13:29joshua-choiWhy does clojurebot say weird things sometimes?
13:30vegailivingston_: ah, now I might see my first mistake
13:30vegaiin project.clj, I gave :main as a string
13:35replacaBorkdude: you need a version of .Net that supports the DLR extensions), I think this means .Net 4.0, but I'm not sure
13:36Licenserjoshua-choi: because he's nuts
13:37vegaiok...
13:38replacalivingston_afk: Rich did stop trying to support both the JVM and CLR early in the process of developing Clojure, the current CLR project is about a year old and led by someone else with Rich's encouragement. I don't know current activity/status. I think it may be waiting on CinC at this point
13:38vegaiso my project.clj is (defproject hello "0.0.0" :description "hello" :dependencies [[org.clojure/clojure "1.1.0"]] :main hello)
13:38vegaiand src/hello.clj is (ns hello) (defn -main [& args] (println args))
13:38joshua-choiLicenser: Who created it?
13:38vegailein deps work fine
13:38vegailein jar works fine
13:39Borkdudereplaca, on the page I read smth about VS2008
13:39Borkdude+SP1
13:39vegaiis it wrong to try to run the resulting jar simply by saying java -jar hello.jar?
13:39BorkdudeI guess that is .NET 3.5
13:39vegaibecause then I get Exception in thread "main" java.lang.NoClassDefFoundError: hello
13:40chouserjoshua-choi: hiredman wrote clojurebot. he has a bunch of responses to specific keywords, but uses a fuzzy matcher to look them up. he sometimes chimes in with an answer to something not addressed specifically to him.
13:40chouserclojurebot: time
13:40clojurebotwhat time \is it? is TIME TO GIT BUSY!
13:41joshua-choiclojurebot: time
13:41clojurebotmultimethods is what separates the boy from the man.
13:41Licenserwhat time is it?
13:41hiredman,(java.util.Date.)
13:41clojurebot#<Date Fri Apr 23 10:44:44 PDT 2010>
13:42Raynes$time
13:42sexpbotRaynes: The time is now 2010-04-23T17:48:32Z
13:42chouserheh. mul-time-thods
13:42joshua-choiThere's another bot?
13:42joshua-choisexpbot: time
13:44RaynesWhy do people always try that?
13:44Raynes:\
13:44Raynes$ <-- This is the prepend. The only prepend. Every single command uses this prepend. :p
13:44sexpbotCommand not found. No entiendo lo que estás diciendo.
13:44chouserRaynes: because that's how you address people on IRC.
13:44joshua-choiRaynes: I have no idea that sexpbot existed until two minutes ago. :)
13:45technomancyvegai: single-segment namespaces are unsupported
13:45Rayneschouser: Indeed, but it usually happens after they've seen somebody else use the prepend, which is weird.
13:45Raynes._.
13:45joshua-choiWhat does sexpbot do?
13:45technomancyvegai: see the skeleton created by "lein new hello" for a better example
13:45technomancy~single segment namespaces
13:45clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
13:45Raynesjoshua-choi: He spies on clojurebot. Keeps him in line.
13:45Raynes$dumpcmds
13:45sexpbothttp://gist.github.com/376874
13:45joshua-choi$addfortune
13:45sexpbotAn invisible fortune cookie?
13:45RaynesHe does all sorts of stuff. He's also in #clojure-casual and #(code) if anyone wants to play with him.
13:46technomancyclojurebot: single-segment namespaces (foo instead of foo.core) are unsupported. they may work in a few circumstances, but you shouldn't rely on them.
13:46clojurebotFoo is not Baz.
13:46technomancyclojurebot: single-segment namespaces are unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.
13:46clojurebotnamespaces are (more or less, Chouser) java packages. they look like foo.bar; and corresponde to a directory foo/ containg a file bar.clj in your classpath. the namespace declaration in bar.clj would like like (ns foo.bar). Do not try to use single segment namespaces. a single segment namespace is a namespace without a period in it
13:46chousertechnomancy: "is" not "are" :-/
13:46technomancyclojurebot: single-segment namespaces is unsupported. (foo instead of foo.core) they may work in a few circumstances, but you shouldn't rely on them.
13:46clojurebotOk.
13:46technomancyI thought he was clever like that
13:46technomancyoh well
13:47Rayneschouser: You shouldn't have used that one.
13:47Raynes:p
13:47chousereh?
13:48vegaitechnomancy: ah, thanks.
13:48joshua-choi$what
13:48sexpbotIt's AWWWW RIGHT!
13:48Rayneschouser: title* isn't mean to be used. $title is a verbose version of the normal title scraper.
13:49RaynesAnd the $part and $say commands are admin-only. :>
13:49chouserI don't know what that means, I'm just trying out the list of commands you posted for us. :-)
13:50RaynesMore dangerous and annoying commands like say, part, and join are limited to "admins", of sorts.
13:50RaynesA little privilege system.
13:51RaynesI need to update my verbose command list with explanations as to what they actually do.
13:51RaynesI've been focusing on making him useful rather than making him useful to other people. :p
13:52chouserrhickey: blame me
13:52rhickeydid they always?
13:52chouserThat may be as of chunked support
13:52rhickeyor just after chunks?
13:52chouseris there a better way? I wasn't sure an extra closure would be preferred.
13:53rhickeydunno
13:53Borkduderhickey: there was some discussion here about ClojureCLR - is it still under active development?
13:53rhickeyBorkdude: afaik, yes
13:55joshua-choiOn the datatypes page, it says, "You should always program to protocols or interfaces." Does this mean that using keywords on datatypes should be minimized in favor of using protocol methods?
13:55remleduffHi all, this is a fun one. I'm using a JNA library call javaCV, whenever an object of type "IplImage" gets printed by the repl, my whole repl crashes with an error that looks something like "Can't cast java.lang.Object to com.sun.jna.Structure". Obviously a bug in the library, but is there some way I can ask the repl to not print the value of the object, to not even look at the object. It's tedious remembering not to call any f
13:55Borkduderhickey: tnx
13:56remleduffI've tried something like (defmethod print-method cxcore$IplImage [x writer] (.write writer "Can't print Images")), but it prints that message and then crashes anyway
13:57rhickeyjoshua-choi: using keywords on datatypes is perfectly fine for: unencapsulated information, and trusted implementation code
13:58joshua-choirhickey: Thanks.
13:59chouserrhickey: is there any action you'd like me to take on doseq or for? propose an alternate solution? back out chunked seq support?
13:59rhickeychouser: no, just mentioning it, don't want to change them just before new release :)
13:59chouserok
14:07bsteuberanyone else using paredit on a slime repl? on my emacs, it behaves quite weird there (not in files) with [ oder {
14:08joshua-choirhickey: Quick followup question: should I inform the user whether attributes of a datatype are "unencapsulated" in the datatype's docstring?
14:08fogusDid someone say "just before the new release"? ;-)
14:08rhickeyjoshua-choi: if you are using defrecord, I don't see a need personally
14:09joshua-choiOkay.
14:09chouserfogus: heh
14:16chouserrhickey: is 'show' ugly by it's very existence, or is there something I could do to make it prettier?
14:39AWizzArdHi stuarthalloway
14:44technomancystuarthalloway: thanks for all your work moving forward with the release. glad to have another committer to help.
14:50jweissbsteuber: i use paredit on the repl
14:50jweissyeah, it doesn't work quite right for me either with [ and {
14:50jweissespecially barf/slurp
14:52bsteuberjweiss: ah, good to know I'm not the only one
14:53bsteuberso I'll file a report then - or maybe a request, as maybe repl-use is not one of the promised features
14:53jweissbsteuber: i am not sure what can be done about it, i would think if anyone knows the solution they're likely to be here in this channel
14:53jweissbsteuber: i don't think it behaves quite right for me in editing clojure files either
14:53bsteubermaybe the user> prompt confused it
14:54bsteuberjweiss: the newest version does behave nice in files for me
14:54jweissbsteuber: where did you get the latest, from elpa?
14:55bsteuberjweiss: http://mumble.net/~campbell/emacs/paredit-beta.el
14:55bsteuberthis is version 22, I think elpa has 21
14:56jweissbsteuber: ah i have version 20
14:57bsteuberic
14:58remleduffHow hard is it to get whoever maintains ELPA to update a package? Is anything you get through ELPA doomed to obsolescence?
14:58jweissbsteuber: i tried to install again thru elpa, still got ver 20
14:58bsteuberok, then I was wrong regarding 21
14:58jweissi'm kind of an emacs newbie, i have no idea
14:59jweissi know ver 22 says beta so it's probably ver 21 that should be in elpa
14:59jweissinterestingly, ver 20 is 3 years old
15:00jweisseven the 'beta' is almost a year old
15:01technomancyremleduff: in this case it's blocked on the paredit maintainer
15:01stuarthallowayhi technomancy, AWizzard. Sorry silent earlier, was on too many meetings at once
15:03AWizzArdrhickey: when I have a (defrecord Foo [x y z]) then I can have (defn foo [{:keys [x y z]}] [z y x]). But when I have a (defprotocol Foobar (foo [f])) and want to (defrecord Foo [x y z] Foobar (foo [{:keys [x y z]}] [z y x])) then ==> clojure.lang.PersistentArrayMap cannot be cast to clojure.lang.Symbol
15:03AWizzArdstuarthalloway: no problem ^^
15:04rhickeyAWizzArd: no destructuring in methods yet
15:04AWizzArdok
15:08AWizzArdAnyone has an idea if this can be done with defrecord? http://pastie.org/932033
15:09AWizzArdOr does this require a deftype for which the fields will be mutated, and then just (recur) is called?
15:11rhickeyAWizzArd: you must leave out 'this' on recur in methods, i.e. you can't recur to a different object
15:13mmarczykstuarthalloway: re: issue #270 on Assembla, I don't think def + fn works correctly, see http://pastie.org/932041
15:14AWizzArdrhickey: so could this better be done with deftype + mutable fields? Because then we could just (recur) and reuse the existing object.
15:14rhickeyAWizzArd: what are you trying to accomplish that the first version doesn't?
15:15chouserprimitives
15:15AWizzArdI thought this could get faster when method calls can happen directly, vs. an ordinary function
15:15AWizzArdhttp://hughw.blogspot.com/2009/01/clojure-vs-javafx-script-only-5x-slower.html
15:16chouserAWizzArd: but your defrecord version creates and retruns a new object each time, while your first one returns only an integer
15:17AWizzArdeventually both versions will return z, which is an int
15:17chouserAWizzArd: you might try definterface to declare a method that takes ints, then implement that in a defrecord or deftype.
15:18woobyhas anyone written a repl applet, or otherwise know if it's possible/done?
15:18AWizzArdchouser: could definterfaced methods use recur and still provide the first arg?
15:19chouserwooby: unsigned applets can't use a custom classloader needed to load dynamically-generated bytecode, so they can't do 'eval'
15:20woobyah
15:20chouserwooby: but you should be able to make a signed applet repl
15:20kylesmithI think I may be experiencing an infinite loop with swank-clojure. The problem seems to be occurring in/around the following lines: (("LockingTransaction.java" 263) ("LockingTransaction.java" 231) ("swank.clj" 29) ("swank.clj" 26))
15:20woobychouser, already started :)
15:20chouserwooby: there's bits of swing-repl code around you could use
15:20kylesmithIs this a known problem, or should I keep investigating?
15:21woobychouser, thanks i'll scrounge
15:22rhickeyAWizzArd: http://pastie.org/932058
15:24rhickeywhy pastie? no thread?
15:26rhickeyAWizzArd: note that removing the unchecked- doesn't hurt perf, please don't use unchecked unless you need truncation
15:26AWizzArdrhickey: oh great, this runs 3x faster. Now with the type declarations this is very much on par with JavaFX.
15:26AWizzArdgood, thanks for this hint
15:27remleduffCan you guys copy that to gist by any chance? pastie is blocked for me, "disease vector"
15:28jwr7I've been reading chouser's "Using binding to mock out even “direct linked” functions in Clojure" (http://blog.n01se.net/?p=134) and I started wondering — he says in Clojure 1.1 most clojure.core Vars are "linked directly" into code, which I assume means avoiding Var lookups,
15:28rhickeyremleduff: http://gist.github.com/377040
15:28jwr7can I do the same thing for some of my functions?
15:28jwr7I have code which makes lots of function calls to functions that will not change and spends lots of time looking up Vars
15:28jwr7(checked with YourKit profiler)
15:29AWizzArdremleduff: this version of rhickey allows faster functions calls. As tak() is mostly a benchmark for funcall speed this had a nice impact.
15:29AWizzArdInteresting to see that Clojure provides tools for doing optimizations if one really needs it.
15:31remleduffNice, I really like the way deftype and defrecord code "looks", now if only it was ^int instead of #^int everywhere ;)
15:31chouserjwr7: first, it's worth nothing that apparently profilers prevent Var from doing some of the performance tricks it does in real life. So it may *look* worse than it really is.
15:31AWizzArdremleduff: maybe soon Emacs users will have a visible/invisible switch for type hints (and possibly other stuff, such as hiding meta data, etc)
15:32jwr7chouser: even sampling profilers?
15:32jwr7(I use YourKit in sampling mode, which I assume does not redefine functions)
15:33chouserjwr7: as for doig direct linking yourself, there's no supported way to do that yet
15:33chouserbut if you namespace starts with "clojure" and you don't have :dynamic true in your var's metadata, you'll get direct linking. Abuse at your own risk. :-)
15:33livingstonmy research is taking me in a direction where I need to interface with very large back-end triple-stores for RDF and OWL etc. (like AllegroGraph)...
15:33jwr7chouser: ok. I've been using macros for some of the most critical stuff for now, but that seems like a hack, and I can't use them with map and the like.
15:34jwr7chouser: speaking of hacks :-)
15:34jwr7chouser: thanks, I'll try that out.
15:34chouserjwr7: you can also use local functions (via let or letfn) to get faster function lookups, at the cost of unfavorable code reorganization
15:34livingstonthe most direct way to talk to RDF back-ends through java/clojure seems to be Jena, but that's a holy mess. any one have any experience or have done anything with it?
15:35jwr7chouser: I thought of that and actually used it in some places.
15:35chouserlivingston: http://github.com/richhickey/rdfm
15:36arohnerI'm thinking of putting this in contrib. Does anyone see value in it? http://gist.github.com/377054
15:36chouserlivingston: I don't know that that's actually "maintained", but it might be interesting.
15:37hiredmanhttp://github.com/hiredman/clojure/blob/readerII/src/clj/clojure/reader.clj re: letfn
15:38hiredmanarohner: that is useful
15:38hiredmanmaybe in macro-utils
15:39arohnerhiredman: thanks. The process for contrib is the same as core? write a patch, file an assembla ticket?
15:39livingstonchouser: thanks - that has some utilities that are definitely of use
15:40jwr7I wish I had a (binding) that wouldn't be thread-local — that would propagate to other threads started by, say, pmap.
15:40livingstonalthough as far as I can tell that library is mostly for serializing and deserializing clojure data to/from an rdf store
15:40livingstonbut I can build on it to get more general reasoning...
15:40hiredmanarohner: I believe so, I think might want to bounce it off the mailing list before filing a ticket
15:42livingstonsince rdf uri's are namespace + resource this seems like they should just be mapped to clojure packages + symbols
15:43hiredmannamespaces
15:44livingstonI meant clojure namespaces - thank you
15:46livingstonone threat of such an approach is after running through a lot of data there will be a ton of symbols hanging out in the symbol table that are no longer needed - generating memory issues
15:47livingston(when I did this in common lisp, I didn't actually have a real problem from that, but I'm looking at dealing with orders of magnitude more data now)
15:49jwr7livingston: I hit a similar problem when doing genetic programming in CL: generated random constants were interned symbols and caused performance problems. Not even because of memory consumption, but because of namespace lookup times.
15:49hiredmaninterned java strings in utf-16
15:50livingstonjwr7: I never had a problem with that but I was using ACL and they make a very good compiler. you could also keep the symbols out of the symbol table too.
15:51AWizzArdhiredman: if i would like to display U+1D11E - how would I do this then?
15:52AWizzArdor some chinese chars, such as U+024B62
15:52jwr7livingston: I was using SBCL. Amusingly enough, mostly because ACL's compiler had a bug that my code triggered (and that was too difficult to report properly to Franz).
15:53livingstonhiredman: the thing is when working with this kind of stuff, it's *really* nice to be able to drop into the representation language while you are coding and just cons up some expressions using lisp and rdf (or whatever) so if it's all symbols it's nice and clean, instead of these string everywhere, like you get when manipulating things like sql (yuck).
15:53livingstonjwr7: that's a shame. they are very responsive about stuff like that, generally
15:55hiredmanAWizzArd: I dunno, google up some java unicode docs
15:55jwr7livingston: oh, they WERE responsive. Franz has the best support I've ever dealt with. It's just that if they can't reproduce a problem, it might sometimes be too much work for you to narrow it down and produce an example.
15:56livingstonjwr7: ah, that's a shame
15:57Chousukejwr7: I think you can simulate the non-thread-local binding by using alter-var-root
15:57hiredmanAWizzArd: you might checkout the javadoc on Character since it goes into more detail
15:57hiredmanChousuke: :(
15:57hiredmanjwr7: don't alter vars
15:57arohnerhow do you combine ~@ and foo#?
15:58Chousukedon't. use an explicit gensym
15:59remleduffCan someone help me understand how lazy-seq works? I'm feeling kind of silly but it's stumping me
15:59arohnerChousuke: how do I use that in a let?
16:00Chousuke(defmacro ... (let [foo (gensym)] `(let [~foo (somestuff)] ...)))
16:00mmarczykarohner: what would you want to use it for, anyway?
16:00mmarczyk~@ splices in a seq and foo# is a symbol, not a seq
16:00clojurebot'Sea, mhuise.
16:00Licensermeep
16:01Chousuke~@
16:01mmarczyksorry to disturb you, clojurebot
16:01clojurebot@ , {a b c]
16:01Chousukeuh
16:01Chousuke~@
16:01clojurebot@ is splicing unquote
16:01Chousuke~@
16:01clojurebot@ , {a b c]
16:01Chousukelooks like someone else got some garbage there too :)
16:03jwr7Chousuke, hiredman: just to explain — I don't want to alter vars, but I do have legitimate uses for (binding). And I just fell into a trap, because I thought I can switch any map to pmap and have it work, which is not the case.
16:03arohnerChousuke: thanks
16:04hiredman,(doc bound-fn)
16:04clojurebotIt's greek to me.
16:04hiredmanbah
16:04mmarczykjwr7: see bound-fn
16:04mmarczykand bound-fn*
16:05mmarczykactually the latter may be more useful when you've already go a regular function
16:05mmarczykand you want to transform it into one which captures bindings
16:05hiredmanright, since clojurebot is being run from a lein repl it has been bitten by the using the wrong version of clojure bug
16:05jwr7mmarczyk: ahh, cool, thanks!
16:05hiredmansince map is lazy you can have trouble with it and binding even without going multithreaded
16:05hiredmanbest not to use binding
16:07mmarczyk,(binding [inc dec] (map inc (range 3)))
16:07clojurebot(-1 0 1)
16:08remleduff,*print-limit*
16:08clojurebotjava.lang.Exception: Unable to resolve symbol: *print-limit* in this context
16:08mmarczyk,(binding [inc dec] (map #(inc %) (range 3)))
16:08clojurebot(1 2 3)
16:08mmarczykI mean
16:08chouser~stuartsierra has come to the conclusion that dynamic scope is a bug.
16:08remleduff,*print-lenth*
16:08clojurebotjava.lang.Exception: Unable to resolve symbol: *print-lenth* in this context
16:08clojurebotRoger.
16:09remleduff,*print-length*
16:09clojurebotnil
16:09hiredmanhaha
16:09remleduffMan, I cannot type
16:09mmarczykthere is certainly some merit to that opinion :-)
16:09hiredmanclojurebot: stuartsierra |has come| to the conclusion that dynamic scope is a bug.
16:09clojurebotYou don't have to tell me twice.
16:10hiredmanclojurebot: stuartsierra?
16:10clojurebotstuartsierra is awesome
16:10hiredmanclojurebot: stuartsierra?
16:10clojurebotstuartsierra is retiring
16:10hiredmanclojurebot: stuartsierra?
16:10clojurebotstuartsierra is retiring
16:10hiredmanbah
16:10chouserclojurebot: dynamic scope
16:10clojurebotstuartsierra has come to the conclusion that dynamic scope is a bug.
16:10StartsWithKin art of the interpreter there is a sentance that says dynamic scope is a bug :)
16:11hiredmanmakes sense to me
16:12livingstonin the right contexts it's hugely valuable, if you need to go through layers of some other api to get to something low that needs tweaked, binding makes sense to me
16:12hiredmanI think the main use should be the ability to simmulate multiple returns, not resource management
16:13hiredman(with-database ...) sort of stuff is horrible
16:14livingstonhiredman: why? the alternative is to have parameters to pass all over the place
16:14jwr7Oh, there is another use case. Say you walk a webapp tree and need to keep track of which uri-tokens are consumed and which remain (the URI path gets split into 'tokens'). Dynamic variables do half of the work for you.
16:14hiredmanlivingston: parameter passing? in functional programming? horrible!
16:14livingstonactually usually I would have the parameters anyway with defaults, and then things like (with-foo would over-ride the defaults
16:16livingstonit is when the parameter is some kind of state holding mess like these things are usually used for, then all kinds of state and parameters start leaking all over in your code
16:16hiredmanleaking?
16:17livingstonthe best examples are when you have your app, talking to some library that has something else you plugged into it under the hood. now you want to change that thing under the hood, you either need to rewrite the whole library to allow that (assuming it's even your library to rewrite) or you can reach down into the thing under the hood and tweak it
16:18mmarczykjwr7: or you could put an atom in a local and use a zipper to walk the tree with a function which accepts an atom arg
16:18hiredmanlivingston: I don't see how the one follows the other
16:19remleduff,(binding [*print-length* 3] [1 2 3 4 5 6 7 8])
16:19clojurebot[1 2 3 4 5 6 7 8]
16:19StartsWithKi don't know, i find it a mess to type (with-open [x bla] (with-out-str [y x] (fn-with-implicit-out-str)))
16:19mmarczyk,(binding [*print-length* 3] (print-str [1 2 3 4 5 6 7 8]))
16:19clojurebot"[1 2 3 ...]"
16:19StartsWithKwhen i could just pass out-str as first argument or in options map
16:19jwr7jwr7: amusingly enough, I actually use this technique with a zipped tree :-) I didn't think of your solution, I thought of passing more things around when walking the zipper. But I didn't want to manage popping things when moving up the tree myself — and a dynamic variable fit right in.
16:20hiredmanif you have an api, and the api has an init state function that returns a state cookie the only things that should be directly manipulating that state cookie are the other functions in that api
16:20remleduffmmarczyk: Thanks
16:21hiredmanso a change to the state cookie may require a refactor of parts of the api, but users of the api would not be effected, since the state cookie is "opaque" to them
16:21mmarczykjwr7: I'd rather use an atom for that :-)
16:21mmarczykin fact, I can imagine walking subtrees of a single tree in separate threads
16:22hiredmanhave I mentioned monads yet?
16:22mmarczykin which case maybe a ref
16:22mmarczykwould do best
16:22livingstonsometimes you can't refactor because your not calling it, for example
16:22livingstonor not controlling the thing that is doing the calling
16:22hiredmanlivingston: that sounds like a tangled mess
16:22mmarczykhiredman: no, but this conversation does make one think about them
16:23mmarczykit's a fact of life, though, that monadic style is very different from the usual present-day Clojure style
16:24jwr7FWIW, my zipper tree walking smells of monads, but I couldn't understand them well enough to actually use the ones in clojure-contrib.
16:26sattvikrhickey: /who
16:26mmarczykhi sattvik :-)
16:26livingstonhiredman: frequently it can be used to overcome something done bad, but there are many legitimate uses, look at specials / defspecial in common lisp
16:27hiredmanlivingston: I'd rather not look at common lisp
16:27sattvikmmarczyk: Hello.
16:28sattvikrhickey: Does it make sense for a Vec to be comparable against a non-IPersistentVector, such as a Sequential?
16:28Luyt,(doc *print-length*)
16:28clojurebot"; *print-length* controls how many items of each collection the printer will print. If it is bound to logical false, there is no limit. Otherwise, it must be bound to an integer indicating the maximum number of items of each collection to print. If a collection contains more items, the printer will print items up to the limit followed by '...' to represent the remaining items. The root binding is nil indicating no limit."
16:29rhickeysattvik: yes
16:30rhickeysattvik: collection equality is divided into sequentials, sets, and maps
16:32sattvikrhickey: OK, thank you. I will implement it that way. Although it will be somewhat different than vectors, then.
16:32sattvik,(compare [1 2] (range 1 2))
16:32clojurebotjava.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to clojure.lang.IPersistentVector
16:33rhickeysattvik: sorry, not comparable, just equality
16:33rhickeyVec should mimic vectors
16:34sattvikrhickey: Ah, OK. No problem. So, Vec should only be comparable against other IPersistentVectors, correct?
16:35rhickeysattvik: yes
16:36sattvikrhickey: Thank you.
16:36hiredmanrhickey: ooo
16:37mmarczykrhickey: wow :-)
16:37BorkdudeHmm, I have installed VS2008 SP1 now for sure, upgraded to .NET Framework 4.0 but still I keep getting this err msg
16:38BorkdudeThe Namespace Dynamic does not exist in the namespace System
16:38sattvikSo annotations are coming to Clojure? I did some simple-class level annotations on an Clojure/EJB library, but I never tried field or method annotations.
16:38Borkdudeand I do have references to the dlls described on the ClojureCLR page
16:39technomancyevery time I hear about annotations, it's for use with netty; what other kinds of things are they useful for?
16:40StartsWithKjpa, jax-rs..
16:40sattviktechnomancy: Most of the Java EE stuff uses annotations these days to replace XML.
16:40StartsWithKfor jpa you would also need inner classes
16:40livingstontechnomancy: in a language without real macros you can get some macro-like things out of them
16:40BorkdudeI have come across annotations in JUnit and GWT
16:40Borkdudethis week
16:40technomancyso for various three-letter acronyms then?
16:40technomancy=)
16:40rhickeylivingston: more like metadata than macros
16:41mattreplGuice is another
16:41Borkdudeso maybe for ClojureGWT ;-)
16:43hiredmanyou can put metadataish stuff on other stuff, and a processor can read the metadata and do codegen stuff
16:43livingstonrhickey: mostly yes, but I've seen some crazy things done with them in java, for example: in a system called UIMA you build plug-in modules for text processing, when UIMA calls your module you can query it for a bunch of parameters, and there is a lot of boilerplate for that...
16:44rhickeylivingston: that has to do with their interpretation by frameworks, the language facility is just metadata-like
16:44livingston.. so the thing I saw was something like @parameter String Foo or something, and it would manage all the boiler plate for requesting the foo paramater and getting it typed if it was there etc.
16:45BorkdudeHmm, this week someone gave me a JDO demo, it used a lot of annotations, it looked useful to me
16:45livingstonpersonally I think that seems like a bit of an abomination, and they seem to make most sense as metadata
16:47cemerickrhickey: the protocol docs are wrong in showing parens around overloaded method signatures.
16:47cemerickin assembla, that is
16:48rhickeythe assembla docs are over
16:48Borkdudebut the same thing could be done with metadata in clojure probably
16:49sattvikI am guessing that if Clojure did support annotations, that might help some of the EE crowd adopt it. It would make it easier to plug into an existing system.
16:49cemerickrhickey: sorry, didn't notice the header
16:49hiredmanBorkdude: it all ready sort of is, like with type hints, etc
16:49hiredmanthe main things annotation support is nice for are interop
16:50BorkdudeCan someone help me build ClojureCLR and get this annoying msg out of the way?
16:50rhickey(deftype #^{Deprecated true Retention RetentionPolicy/RUNTIME} Bar [])
16:50rhickey^^ works on my machine
16:50BorkdudeThe type or namespace name 'Dynamic' does not exist in the namespace 'System'
16:50livingstonI stand corrected, that code apparently mines the annotations to do the work that I thought just placing the annotation was doing (i thought they could behave like templates), but that's not the case at all
16:50remleduffrhickey: If you consider the annotation processing framework part of "annotations" it ends up being somewhat similar to a macro facility for java in some of the ways it's used, no?
16:51rhickeyremleduff: I personally would never equate the two
16:52remleduffI've got a few places where there is no concrete class definition, just an interface with some methods marked up with annotations, at compile time a class is generated based on that markup
16:52cemerickrhickey: is destructuring going to eventually be allowed in deftype/defrecord method arg vectors?
16:53rhickeycemerick: maybe
16:53rhickeyit's on an ever lengthening list
16:53stuarthallowayrhickey: java.util.Map for defrecord is DONE, with no Java changes :-)
16:54stuarthallowayhttps://www.assembla.com/spaces/clojure/tickets/313-add-java-util-map-support-to-defrecord
16:54stuarthallowayturns out there is enough clojure-in-clojure in defrecord to do it all as one-liners
17:01technomancyanyone who's contributed to swank-clojure but may not be on the mailing list should weigh in on this relicensing thread: http://groups.google.com/group/swank-clojure/browse_thread/thread/3ae8f2c2ad46bbc5
17:03remleduffstuarthalloway: Since you're using java interop calls (.count) in your ijavamap, should the IPersistentMap switch to doing it the same way? It seems odd to me that the implementations would be different, but I'm probably not understanding something.
17:04stuarthallowayremleduff: I am counting on this, while it looks like IPM is counting on other things
17:12kzarWhen I try and use the lower-case function in str-utils it says the function isn't public. What am I doing wrong?
17:19remleduff,(clojure.contrib.str-utils2/lower-case "ABC")
17:19clojurebot"abc"
17:20remleduffIs there a function somewhere in swank-clojure that will given a class-name, give you a list of possible imports for that class (found by searching your classpath)?
17:20kzarOh I got it working, I just did (.toLowerCase "Whatever") instead
17:31rhickeyannotation syntax: http://gist.github.com/377213
17:31rhickeymake sense?
17:34mefestorhickey: i like it :)
17:35mefestoim guessing exactly the same at the method definition level?
17:35sattvikrhickey: So it's just like the standard meta map, just with Class keys?
17:35sattvikrhickey: How about nested annotations?
17:36rhickeysattvik: theoretically supported, do you know of one in standard Java 6?
17:36mefestoi think jpa has nested annotations (named query?)
17:36remleduffHow do you mix annotations and type hints?
17:37sattvikrhickey: I know of some for EJBs... It will take a moment to look them up. I am not sure aboute Java SE.
17:37rhickeywill look like {BlahAnnotation {:anested (NestedAnnotation {:its property})}}
17:38rhickeyremleduff: just put both in the metadata
17:38rhickeyremleduff: {:tag String AnnotationType blah}
17:38carkh\o/ annotations !
17:39remleduffAre you respecting default property values too?
17:39rhickeyremleduff: yup
17:40remleduffNeat ;)
17:40mefestolooks like there are some nested annotations in the javax.xml.ws package. (ex. WebServiceRefs)
17:40carkhtoo bad i approached the jvm from clojure so i don't know anything about these.... are there annotations for methods as well ?
17:41remleduffcarkh: There are annotations on nearly everything: on types, methods, parameters
17:42carkhlooks like i'll spend the evebning reading about all that
17:42remleduffrhickey: Will the clojure or java compiler spit out a message now if you use a type's method marked Deprecated?
17:42rhickeyremleduff: no
17:44arohnerChousuke: I can't get your gensym trick from earlier to work: http://gist.github.com/377226
17:47rhickeyremleduff: thanks - nested looks like this: http://gist.github.com/377213
17:47rhickeysorry, sattvik - nested ^^
17:48Chousukearohner: um, only lists can be spliced
17:49arohnerChousuke: what do I have there?
17:49Borkduderhickey: what version of the DLR was used with the latest clojure-clr sources?
17:49Chousukearohner: a symbol
17:49remleduffWhat is (WebServiceRef {:name "fred"}), a function invocation?
17:49Chousukearohner: ~@foo makes no sense unless foo is a list or a vector
17:49rhickeyBorkdude: you'll have to ask the ClojureCLR folks
17:50rhickeyremleduff: a nested annotation
17:50Borkduderhickey: where are they hanging out usually
17:50Borkdude?
17:50arohnerChousuke: isn't foo a symbol that resolves to a list?
17:51rhickeyBorkdude: you could ask on ggroup
17:51Chousukearohner: no.
17:51Borkdudek
17:51remleduffJust looks a little inconsistent to me, why isn't it #^{(Deprecated true) (Retention RetentionPolicy/RUNTIME)} if they're going to use lists when nested?
17:52Chousukearohner: what you're doing there is generating a symbol first, binding it to the name foo, then generating code that binds the *generated* symbol to a list
17:53sattvikrhickey: Looks good. Although a map-like syntax may be slightly more natural for people coming from Java.
17:53arohnerChousuke: ok. So then how would I splice the generated symbol?
17:53Chousukearohner: but the list is not available to you when you're actually generating the code to make the list. (think about it) ... so you can't splice it in
17:53arohnerah
17:54remleduffrhickey: I don't think it makes a big difference though, I haven't seen nested annotations enough to worry about so consider that retracted. I like it a lot :)
17:54sattvikrhickey: An example of nested annotations in Java: @Resources ({@Resource(name="jdbc/AdventureDB" type=javax.sql.DataSource),
17:55Chousukearohner: what you can do is generate code that does something to the list; but you can't actually put the list in the generated code because that would be circular :P
17:55sattvikThough, in the end, exactly how it looks is rather trivial.
17:56arohnerChousuke: ok, thanks. I'll need to re-think this
17:56Chousukearohner: though your example isn't probably the clearest about this because the list is basically a constant
17:56arohnerone sec, I'll paste what I actually want
17:57Chousukearohner: if you can think of a macro as function of its parameters, producing clojure code, that will help
17:57Chousukewhat ` is doing is nothing more than building a list, with some templating support
17:57arohnerhttp://gist.github.com/377232
17:58licoresseflip flop
17:58Chousukeyou could do it entirely without using ` or ~ or ~@
17:59Chousukearohner: why do you want to evaluate the args like that?
17:59Chousukehmm
17:59arohnerChousuke: in case the input is a function call
17:59Chousukewhat input? the 'args'? hm.
18:00remleduffIs there any way to make this work? (map #(import %) [java.util.zip.ZipFile])
18:00Chousukewhat you want is probably not possible without eval
18:00Chousukeat least not the way you're trying to do it
18:01Chousukearohner: but the important mistake here is that you're trying to splice things that are part of the *generated code* into the generated code itself.
18:01Chousukeno, wait. you're trying to splice *results* of evaluating the generated code into the generated code.
18:03arohnerChousuke: seems like I need another eval step
18:03arohnerChousuke: is this a case for eval?
18:04Chousukenow you can do something like (defmacro foo [args] (let [a (if (fn-form? args) (eval args) args)] `(defn ~@args ...)))
18:04Chousukehonestly, probably not.
18:04Chousukeit will fail if you try to pass anything but a literal fn form
18:04Chousukehmhm
18:05Chousukewhat kind of code are you aspiring to write using this macro?
18:05Chousukealso, should be ~@a in the example
18:06arohner(defmacro defn-map
18:06arohner "generates a defn expression, but arguments are a map, to make it
18:06arohner easier on macro writers. Valid keys: name, doc-string, attr-map,
18:06arohner params, body. If params is nil, then body is a multi-arity
18:06arohner expression, ([params] body)+ "
18:06arohnerthis seems to work well with eval
18:06Chousukeshould be no need for eval for that
18:07Chousukeunless you want to accept non-literal maps as well
18:07Chousukewhich would be rather evil
18:08arohnerwell I also have
18:08arohner(defmacro decompose-defn-args
18:08arohner "interprets args the way defn would, returns a map that can be consumed by defn-map"
18:08arohnerso yes, I want to support non-literal maps
18:08Chousukehmmh :/
18:11ChousukeI really don't think that's a very good idea.
18:12Chousukeyou might just as well make it a function that constructs and evals a defn form then
18:12Chousukeno need for macros
18:14arohnerChousuke: why don't you think it's a good idea?
18:16Chousukearohner: I guess I just don't see what that is useful for
18:16arohnerChousuke: it makes it significantly easier to write macros that call defn, and want to support all the extra features of defn
18:17Chousukearohner: I can see explicitly naming each defn parameter being useful, but why must it work for non-literal maps?
18:17arohnerso I can do things like
18:18arohner(let [arg-map (update-in (destructure-args input-args) [:attr-map] merge ...)] (defn-map)
18:18arohnerI want to update-in whatever the user passed in
18:20Chousukehmh
18:21ChousukeI still don't see it. you can write a parser for defn args -> map and map -> defn-args and that would be very useful for macro writers, but there would be no need for eval or any "runtime" maps as far as I can tell
18:22fyuryuBorkdude: I managed to get ClojureCLR to compile under VS 2008 a month or two ago. Haven't looked at it since.
18:22cemerickholy crap, annotations?!?
18:23fyuryuBorkdude: I couldn't get it to compile under VS 2010, though. Don't remember what the error was
18:24Chousukearohner: I mean, if you write a (defn mydefn [argvec] ...) you can update the argvec in any way you want
18:24Chousukearohner: it's still just a vector
18:25arohnerChousuke: yes, but defn has to support doc-string? attr-map?
18:25arohnerI don't know which position is the attr-map unless I destructure first
18:25arohneror write a macro as long as defn
18:25Chousukedestructure?
18:26Chousukewell you can distill all the weird logic in defn into your defn-args -> map function
18:27Chousukeand when you are done manipulating the map, do the reverse and then just `(defn ~@(map-to-defn themap))
18:27Chousukethat way, there's no need for eval
18:28Chousukeyour map-to-defn just needs to produce a sequence that, when spliced in, result in a valid defn form.
18:29Chousukeresults*
18:29MadWombatHello
18:29arohner,(doc defn)
18:29arohnerChousuke: inspect the args, and figure out whether there is a doc string, and whether there is a metadata map
18:29clojurebot"([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]); Same as (def name (fn [params* ] exprs*)) or (def name (fn ([params* ] exprs*)+)) with any doc-string or attrs added to the var metadata"
18:30MadWombatI have a rather silly question. One of my files has been growing large, so I split it and used (:use [com.wombat.web util datastore]) to import the functions back into the main namespace. But now I get an error that the defun I defined in util is not available. Any obvious thing to check?
18:30Chousukearohner: right?
18:31mmarczykarohner: you could just lift the code from defn
18:31Chousukearohner: you need a parser of defn-args -> map and vice versa
18:31mmarczykleave the bindings vector in the huge let form intact
18:31Chousukearohner: but that's a one-time thing
18:31arohnerI already have the parser
18:31arohnerthat was easy :-)
18:31mmarczykbut instead of producing a def form, return a map of stuff extracted from "defn-like args"
18:31mmarczykmake that a function
18:32mmarczykuse in any macro which needs to provide similar functionality
18:32arohnerChousuke: mmarczyk : I think I understand. thanks
18:32arohnerChousuke: thanks for your help. I have to run
18:33mmarczykMadWombat: see if util depends on sth in datastore or the other way around
18:33Chousukeright, so now you have a function that you can use in any macro... (defmacro foo [& args] (let [parsed (parse args)] `(defn ~(:name parsed) ...)))
18:34mmarczykMadWombat: actually the other way around would be more likely given your description
18:42MadWombatmmarczyk: hmm... no, separately util and datastore compile fine
18:45livingstonwhat's the function to change the root value of a def (I know this is dangerous - I'm debugging in the repl)
18:45mmarczykMadWombat: does the error arise somewhere where use use or require the com.wombat.web namespace?
18:45mmarczyk^ where you use or require
18:46mmarczyklivingston: you mean a Var? use the .bindRoot method
18:46mmarczykor alter-var-root
18:46mmarczykwhich is like alter / swap! / send
18:46livingstonyeah, I guess so, whatever def produces which is a var, right? so yeah alter-var-root sounds good
18:47mmarczykif you're just going to type it at the repl, you can of course just use def again
18:48livingstongood point
18:51MadWombatmmarczyk: I think I made a mistake in the question, to make things clear, I have 3 namespaces all starting with com.wombat.web, main, util and datastore. When I use the util from main and try to call a function it is not recognized
18:52MadWombatmmarczyk: figured it out, I had all functions defined with (defn-, so once they moved away from the original namespace they went inaccessible. Thought it was something silly. Thanks for the help, funny, how you answer most of my clojure questions everywhere I post them :)
18:54mmarczykdo I? happy to help :-)
18:55mmarczykgood this one is sorted out
18:55slyphonmmarczyk: oh, i found another bug
18:55slyphon(this is hard)
18:55mmarczykslyphon: I was kind of thinking there might be one
18:55slyphon:)
18:55mmarczyklet's see if you've got the same one
18:55mmarczyk:-)
18:56slyphonwell, &env isn't defined in some contexts
18:56slyphonlike, when initially compiling
18:56mmarczykum
18:56slyphoni think
18:56slyphonlemme try
18:56mmarczykdo you have a not-working example?
18:56slyphonmake sure
18:56slyphonheh
18:56slyphonone sec
18:57mmarczykincidentally, I realised that an unmention part of the contract for the last version
18:57mmarczykis that if a map literal is passed in, then all the keys must be literal keywords or symbols
18:58slyphonhrm
18:58mmarczykif symbols, they'll be treated just like keywords, meaning their names will be used
18:58slyphonoh, heh
18:58slyphonwell
18:58mmarczykis this a problem?
18:58slyphoni'm kind of willing to risk that
18:58slyphon;)
18:58slyphonnah, shouldn't be
18:58slyphonCaused by: java.lang.RuntimeException: java.lang.Exception: Unable to resolve symbol: &env in this context (utils.clj:254)
18:58mmarczykgood :-)
18:58mmarczykhm, interesting
18:58mmarczykcould you paste the code which causes this somewhere?
18:58slyphonsure
18:59slyphonone sec
19:02Borkdudefyuryu: ah
19:02BorkdudeI'm still wrestling with it, but can't get it to work
19:02BorkdudeI'm almost giving up...
19:03BorkdudeVisual Studio is so annoying: it gives hints to add a using System.Dynamic; when I remove it, and when it has added it, says: I don't know where it is
19:05livingstonso if I have java code that gives me an Iterator, what's the easiest way to get it to be a seq in clojure? iterator-seq ??
19:05carkh,(doc iterator-seq)
19:05clojurebot"([iter]); Returns a seq on a java.util.Iterator. Note that most collections providing iterators implement Iterable and thus support seq directly."
19:06mmarczykdo I understand correctly that java.util.Iterator doesn't implement Iterable?
19:06livingstoncollections implement iterable
19:06mmarczykso an ArrayList is Iterable, whereas an Iterator isn't?
19:07mmarczykI find this somewhat contrary to my initial naive expectations :-)
19:10rhickeyfuller annotation syntax example: http://gist.github.com/377213
19:10livingstonmmarczyk: yes
19:11Borkdudehmm, I did (read-line) on the repl
19:12Borkdudehow do I end the input to it??
19:12mmarczykBorkdude: would that be the SLIME repl?
19:12Borkdudeyes
19:12mmarczykthen read & Co. won't work :-(
19:12mmarczykwith current swank-clojure
19:13Borkdudeit is reading
19:13Borkdudesupposedl
19:13Borkdudebut I don't know how to say: this is it
19:13chessguyis 'eval' pretty expensive to call in clojure?
19:14slyphonmmarczyk: http://github.com/slyphon/sly-utils
19:14slyphonprobably doesn't warrant a proper repository, but i mean, wth
19:14slyphonlein repl, (require '[com.slyphon.utils [update-bean :as ub]]) will cause the barfage
19:14slyphonmmarczyk: if you have an account, i'll add you as a contributor
19:16mmarczykI do, michalmarczyk
19:16slyphonmmarczyk: are you polish, perchance?
19:17mmarczykyes
19:17slyphonok, you're a "contributor"
19:17mmarczykright
19:17slyphonmy best friend from high school is polish, that's why i asked
19:17mmarczyk:-)
19:18livingstonslyphon: the vowel to consonant ratio didn't tip you off
19:18mmarczyklivingston: hm? should it?
19:19mmarczykslyphon: right, but do you have an actual breaking example?
19:19slyphonlivingston: hah
19:19livingstonmmarczyk: well that and the "czyk"
19:19slyphonoh
19:19slyphonmmarczyk: it won't even load that
19:20mmarczykslyphon: oh, ok; let me see then
19:20slyphonhttp://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj
19:20clojurebot() invokes the form inside, but there is an implied str call. The semantics are different inside the interpolated string, necessarily so.
19:20slyphonclojurebot: huh?
19:20clojurebotexcusez-moi
19:20slyphon:D
19:21mmarczykrhickey: so any metadata entry with a class for a key would be made accessible to Java code in the form of an annotation?
19:21mmarczykwherever possible, right?
19:21mmarczyklivingston: guess you're right :-)
19:21rhickeymmarczyk: the class has to derive from Annotation
19:21rhickeyi.e. be an annotation
19:21mmarczykrhickey: oh, ok
19:22slyphonmmarczyk: hey, you gonna be around for a bit?
19:23slyphonmmarczyk: food just got here
19:23mmarczykso a separate annotations collection in the metadata under a :annotations key wouldn't make much sense, because an Annotation derivee isn't likely to be used for any other purpose, so no need to wrap them
19:23mmarczykslyphon: probably
19:23slyphon:)
19:24slyphoncool, i'll bbiab
19:25Chousukeclojurebot: forget ()
19:25clojurebotforget latest is 1382
19:25Chousukeduh. :P
19:27scottjI've started writing a smalltalk style method finder where you give it an example of how you'd use the method (inputs and result) and it tells you what clojure functions or Java methods in the system fit the bill. Before I get too far though I wanted to check, has anyone written this already?
19:28Chousukepossibly for java, but probably not for clojure
19:29chessguya hoogle for clojure?
19:30dnolenscottj: no, that sounds pretty cool.
19:31mmarczykscottj: not that I know of, and I can tell you I'd definitely want to use it :-)
19:34mmarczykslyphon: I pushed a fix
19:34chessguyis 'eval' pretty expensive to call in clojure? e.g., i know it's discouraged in javascript. i'm just not sure if lisp is similar
19:35scottjchessguy: never seen hoogle, from its docs about type signatures, does it not support giving true as result and "goof" and "oo" and getting back .contains ? that's more specific than str -> str
19:35mmarczykslyphon: the problem was in that you're using Clojure 1.1 and &env was added more recently
19:36joshua-choiQuestion: how should I refer to a protocol in another namespace? Both org.me/AProtocol and org.me.Protocol are defined, but one is a map and one is a class (or interface?).
19:36mmarczykscottj: so would you actually go ahead and call each candidate method / fn to see if the result matches?
19:36scottjdnolen: I want to take the smalltalk method finder to the next level and have it come up with common combinations of functions/methods (tell you to use filter w/ a certain predicate)
19:37mmarczykchessguy: not that expensive in those places where it's actually appropriate to use it
19:37scottjmmarczyk: that's what I'm doing right now. I made a list of functions that are dangerous to do that with :)
19:38chessguymmarczyk, an appropriately vague answer for a vague question :)
19:38mmarczykchessguy: see http://stackoverflow.com/questions/2571401/why-exactly-is-eval-evil
19:38livingstonhow do I quote a static function in a java class so that I can apply it? this works (Triple/create a b c) but (apply Triple/create (list a b c)) doesn't
19:40rhickeyjoshua-choi: use org.me/AProtocol to refer to the protocol object
19:40_rata_hi
19:40rhickeyjoshua-choi: the interface is just for Java
19:40_rata_is there a quick starting guide for people that comes from other Lisp?
19:40sattviklivingston: Create an anonymous function #(. obj fn args)
19:41sattvik,(map #(. %1 charAt 0) ["hi" "there"])
19:41clojurebot(\h \t)
19:41sattvikEh, that's not a static function, but should work more or less the same.
19:41scottj_rata_: I think wikibook clojure programming used to have a table that detailed some diffs, and rhickey gave a clojure for lisp preso that's on clojure.blip.tv
19:42scottjI saw a big table that compared a lot of things in emacslisp, common lisp, scheme, and clojure. It was really big, did anyone bookmark that?
19:42livingstonthat's ugly/unfortunate, but ok
19:42livingstonscottj: http://hyperpolyglot.wikidot.com/lisp
19:43scottjlivingston: thanks
19:43dnolen_rata_: I assume you already looked over http://clojure.org/lisps
19:43livingstonI happend to have it open - i don't think it's totally great, but it'll give you a few quick pointers
19:43sattvik,(map #(. Integer parseInt %1) ["1" "2"])
19:43clojurebot(1 2)
19:43_rata_thank you all :)
19:43uberjarhttp://www.lisperati.com/clojure-spels/casting.html
19:44_rata_I have a lot to read now :)
19:44uberjarthats clojure's poigant guide
19:45mmarczykscottj: you could still do some initial filtering based on argument & result types
19:46scottjmmarczyk: for java methods yeah, for clojure functions though, other than obvious arity things?
19:47mmarczykyou could check if there's any type hints
19:47rhickeyinitial annotation support is up!
19:47rhickeybulk of the work is 50 lines of Clojure - http://github.com/richhickey/clojure/commit/fa899d22dceb531d9f5af833ac6af0d956e6bdc7
19:47mmarczykcool :-)
19:47mmarczykrhickey: is it possible to get at the type hints on a function's arguments?
19:48joshua-choirhickey: Thanks. However, you cannot refer to a type by org.me/Type. Is this by design?
19:49scottjother than looking at the source :)
19:49mmarczykoh, ok
19:49mmarczykI found out myself
19:49slyphonmmarczyk: hey, did you have a chance to take a look?
19:49mmarczyk(defn #^String foo [#^String s] (count s))
19:50mmarczyk(meta (first (first (:arglists (meta #'foo)))))
19:50mmarczykslyphon: yes, I committed a fix
19:50slyphonw00t!
19:50slyphonty
19:50rhickeyjoshua-choi: I don't understand. In order to use the protocol you need to refer to the protocol object, not the type
19:50scottjmmarczyk: cool
19:50mmarczykscottj: of course not that many things are hinted... but still
19:50slyphonmmarczyk: hah! nice
19:51slyphonthanks
19:51mmarczykslyphon: btw, I also thought about how this is fundamentally broken :-)
19:51joshua-choirhickey: Yes, sorry; never mind.
19:51slyphonhahah
19:51slyphonmmarczyk: oh yeah?
19:51mmarczykcool, no?
19:51mmarczykyeah
19:51rhickeyjoshua-choi: in any case ,no, foo.bar/baz is always a ns member or static member
19:51mmarczykbut just to make sure
19:52joshua-choirhickey: And datatypes are no longer members of namespaces, right?
19:52mmarczykwhat would be a simple bean I could work with...?
19:52mmarczykI mean is there something in java standard libs I could test this with?
19:52rhickeyjoshua-choi: datatypes are named types, and no longer create factory fns in a ns, right
19:53slyphonmmarczyk: hang on, i'll check in that class i was using
19:53joshua-choirhickey: Okay. It's a tad annoying, since I must now import constructors with import instead of require, but I can just create factory functions, so it's okay.
19:53mmarczykslyphon: ok, I'll run a little experiment of my own in the meantime
19:53slyphonkk
19:54rhickeyfull example of annotations http://gist.github.com/377213
19:55rhickeyjoshua-choi: right, a factory fn in your control lets you process args, have defaults etc
19:56mmarczykslyphon: right, so this will break in the following way
19:56mmarczyksay you want to have a Var named params holding some params to use with update-bean
19:57joshua-choirhickey: In any case, though, we should probably indicate in our datatypes' docstrings the intended way to create the datatype: by constructor or a factor method, right?
19:57mmarczykthen you compile a function which uses update-bean and give it the symbol params as the second argument
19:57scottj50 lines? what happened to one line for new features? you're slipping. Didn't someone say if you can write an annotation in one line you should be able to implement annotations in one line? </sarcasm>
19:57slyphonsymbol capture
19:57mmarczykthis will work just fine, BUT
19:57slyphon?
19:57mmarczykif you then go and redefine params to something else
19:57mmarczykyour function will never notice
19:57clojurebothttp://jackcoughonsoftware.blogspot.com/2009/05/teaching-functional-programming-to-kids.html
19:57slyphonoy
19:57mmarczykand the update-bean bit will use the previous value of params
19:58slyphonhmm
19:58slyphonso this probably needs to use gensyms?
19:58mmarczykobviously, since it's determined at macro expansion time
19:58mmarczykum, no, that won't do
19:58mmarczykactually, at this point, I'm inclined to say that this is a perfect use case for eval
19:59slyphonhah
19:59slyphonrhickey: http://github.com/slyphon/sly-utils/blob/master/src/com/slyphon/utils/update_bean.clj
19:59slyphonrhickey: if you have a moment
19:59mmarczykthough it'll still need to be a macro
19:59slyphonrhickey: this has presented a bit of a poser
19:59mmarczyksince there might be locals involved
20:00mmarczykhm, actually the fundamental question to ask ourselves is
20:00slyphonrhickey: the use case is to update a bean, generating the method names based off of keys of a hash passed in
20:00mmarczykwhether this is a problem :-)
20:00slyphonhah
20:00mmarczykor maybe reflection is fine after all
20:00mmarczykwith a nice bit of reflection-fu, this can be a proper function
20:00slyphonso it's going to change the value of a local variable behind the function's back?
20:01mmarczykhm? not sure I understand
20:01slyphonhah
20:01slyphonwell, i don't quite understand what would break
20:01mmarczykwell
20:01rhickeyslyphon: you've looked at bean, in core_proxy.clj?
20:01mmarczyknotice how, when given a symbol as the second arg, update-bean calls eval
20:01slyphonrhickey: yes, it scared me
20:01slyphoni thought bean was read-only
20:02mmarczykrhickey: doesn't bean return a read-only object?
20:02rhickeyyes, it's read only, but a very similar job
20:02slyphonrhickey: i don't quite know how to phrase this, but what is it about '.' that makes this so challenging?
20:04mmarczykrhickey: could bean be rewritten using reify, IPersistentMap and support assoc as a property-setting operation?
20:04mmarczykto be used like transients, i.e. in a highly localised fashion
20:07mmarczykslyphon: continuing about eval in update-bean, it only gets called once -- when the macro is expanded
20:07mmarczykthen that hypothetical update-bean-using function gets compiled with the result of the expansion becoming a part of its code
20:07slyphonohhhhh
20:07mmarczykthat is, with the map hard-wired inside it
20:07MadWombatwas defservice replaced by something else in compojure 0.4.0?
20:07mmarczykby value
20:08slyphonmmarczyk: that's bad
20:08slyphonmmarczyk: do you have a CL or Scheme background?
20:08mmarczykMadWombat: likely moved off to some other project, see http://formpluslogic.blogspot.com/2010/04/migrating-from-compojure-032-to-040-and_01.html
20:08mmarczykslyphon: Scheme
20:08slyphonahh
20:09mmarczykMadWombat: it doesn't mention defservice in particular, but perhaps the dependencies list will give you a hint
20:10slyphoni've been thinking about looking into scheme, i tried CL a few years ago, but it was really ....overwhelming
20:12mmarczykI like reading Lisp books :-)
20:13slyphonmmarczyk: is there a scheme book in particular you'd recommend?
20:13mmarczykwell, I taught myself to programme with SICP
20:13slyphonhah
20:13mmarczykand I honestly believe it's the very best technical book I ever read
20:14MadWombatmmarczyk: I guess it is up to jetty to provide a way to run compojure as a war
20:15mmarczykMadWombat: couldn't say with any certainty
20:15mmarczykI don't know much about Java Web deployment schemes
20:15mmarczyk(I suppose I'd like to change that)
20:16joshua-choiQuestion. A method called clojure.lang.RT.set is raising a "java.lang.IllegalArgumentException: Duplicate key: true", and I don't know why.
20:16mmarczykbut I'd probably look inside ring-servlet
20:16joshua-choiBut I do know it has something to do with the preconditions in a function.
20:16mmarczykslyphon: then there's EOPL and PAIP
20:16slyphonmmarczyk: i have an example of programmatically setting up a servlet container w/ jetty
20:16mmarczykPAIP is more a "reading list" item now, but the bits I've read so far are fantastic
20:17slyphonahh
20:17slyphonok, these are the clasics
20:17mmarczykso they are :-)
20:17mmarczykI rather think the status is well deserved :-)
20:17slyphonhah
20:17slyphonwell, i'll have a go then
20:18mmarczyk:-)
20:18slyphoni read ANSI Common Lisp and that free one online
20:19mmarczykslyphon: I'd like to get some initial picture of what the Java Web stack looks like
20:19mmarczykfor starters
20:19mmarczykright now I seem to be bumping into new acronymes all the time :-)
20:19slyphonmmarczyk: ah, well, you take what you think about "web serving" and you hit it with a hammer, then you take all those little shards and you make them into Classes and Frameworks seemingly at random
20:20mmarczykPractical Common Lisp, I guess?
20:20slyphonmmarczyk: that's the one
20:20nurvmmarczyk: Maybe you'll enjoy "Lisp in small pieces"
20:20slyphoni find clojure is much easier to digest
20:20slyphonand *WAY* more fun than scala
20:20mmarczyknurv: I think I would, I've skimmed it a couple of times and even the short bits I read were quite enlightening
20:21nurvmmarczyk: Very technical sometimes but it's worth it.
20:21mmarczykslyphon: totally with you on that :-)
20:21slyphon:)
20:21nurvSome discussions on different object systems and environments are pretty "aha!" moments.
20:23mmarczyknurv: well, that's definitely on my list
20:23mmarczykand pretty high up :-)
20:25nurvEOPL has a new edition, but i didn't read it.
20:25nurvAt least the source code works on PLT Scheme and new implementations.
20:25slyphonwoah
20:25mmarczykslyphon: my hopes of getting a clear picture of said Classes and Frameworks and how they fit together are already wrapped up in lots of duct tape after having fallen apart on a number of occasions
20:25slyphon:)
20:26slyphoni went from zero to deploying a couple of core pieces of the infrastructure of motionbox.com with jruby and jetty
20:26slyphonit takes a lot of reading and futzing, until you know what's safe to ignore
20:26mmarczyknurv: eopl3 is a bit different from 2
20:26slyphonb/c a lot of that javaee stuff is just over-complicated
20:26mmarczykthe most striking difference, to me
20:27mmarczykis that it's not self-contained
20:27mmarczykin that you have to get the define-datatype stuff
20:27mmarczykas well as a lexer/parser
20:27mmarczyksomewhere
20:27mmarczykand they don't help you with that at all :-)
20:27nurvUhm, i remember downloading the sources and running some chapters without requiring anything else.
20:27nurvMind you i've probably only tested the first ones.
20:28mmarczykhm, really?
20:28mmarczykwell maybe I've got it mixed up with something else then, it's been a while back
20:29scottjsounds like you have the right thing: http://www.cs.indiana.edu/eopl/MLblurb.html
20:29nurvThe only problem with EOPL is that the interpreters are quite inefficient for the sake of clarity.
20:29clojurebotClarity of mind means clarity of passion, too; this is why a great and clear mind loves ardently and sees distinctly what it loves. -- Pascal
20:29nurvHeh.
20:30nurvBut i suposse that's what LiSP and other books are for.
20:30mmarczykslyphon: (-> over-complicated (#(apply @(ns-resolve 'clojure-core 'inc) %)))
20:30slyphonhah
20:30nurvAnyway, good night, going bed.
20:30mmarczyknurv: there's a possible EOPL -> LiSP progression :-)
20:31mmarczyksee you!
20:31nurvmmarczyk: yes
20:31nurvThat's mostly what i did.
20:31nurvSICP -> EOPL -> LiSP.
20:31mmarczyknurv: well, I'm a bit past the middle of that road :-)
20:31mmarczyknurv: can't wait to join you at the end :-)
21:09remleduffIs loading ~/.clojure/user.clj a clojure.main thing or does every repl implementation have to source that itself (if it does)?
21:13hiredmanremleduff: I believe it's clojure.main
21:27slyphonuh, multimethods can have multiple arities, right?
21:28carkh(defmulti belh (fn [target & args] (:type target)))
21:28slyphonok, thought so
21:29carkh(defmethod belh :type1 [a-type-1 arg1 arg2] ...)
21:29mmarczykslyphon: I pushed a new branch
21:29slyphonmmarczyk: hah!
21:29mmarczykwith a proposed eval-based fix
21:29slyphonawesome
21:29hiredmanthey can have multiple arities, but your dispatch function needs to be able to handle every arity
21:30mmarczykthe previous version is still in there, commented out
21:30slyphonhow about your methods?
21:30slyphonmmarczyk: ok :)
21:30hiredmandoesn't matter
21:30slyphonok, cool
21:30mmarczykthe methods need to handle every arity which makes sense for the given dispatch value
21:31slyphonthat's what i thought, just wanted to make sure that was what the reality actually was
21:33mmarczykslyphon: oh bother, I think I'm getting a bit tired here
21:33mmarczykforgot to commit before pushing
21:33slyphonhah
21:33slyphoni have quite a few commit messages at work "doh! helps to add the file"
21:34slyphon(and i'm not the only one)
21:34mmarczyk:-)
21:34mmarczykdone now
21:34slyphonk
21:36mmarczykand if you have it return doto# instead of (eval doto#), you'll get a more digestible view of what would happen with eval than with macroexpand
21:38slyphonuh
21:38slyphonwhat's #_ ?
21:38slyphoncomment?
21:39remleduffYeah, completely hides the following form, as opposed to (comment) which returns nil
21:40hiredmanin both case the stuff commented out needs to be readable
21:40slyphoninteresting
21:41remleduffI've been using swank-clojure-project and am trying to switch to lein swank, but I don't seem to have any M-x slime-connect available (I do have slime-repl) installed. Any ideas?
21:41slyphonthat's kind of odd
21:42slyphonmmarczyk: wait, you're nesting `() ?
21:42slyphonthat's why the gensyms work in the inner form?
21:43mmarczykremleduff: can you check if M-x slime-connect becomes available after you launch a repl with swank-clojure-project?
21:43mmarczykslyphon: the autogensyms work at the same nesting level, I believe
21:43slyphonhrm, you're using k# on line 34
21:43remleduffmmarczyk: Yeah, a bunch of slime functions become available after swank-clojure-project
21:44slyphonremleduff: (require 'slime) ?
21:45remleduffslyphon: Yep, thanks
21:45mmarczykslyphon: just checked and so it is
21:46mmarczykhttp://pastie.org/932493
21:46mmarczyknote how the k# occurs within an unquoted form
21:47mmarczykit's still syntax-quoted, but just one level, while the . is at level 2
21:47slyphonwow
21:48slyphonok, i need to go "back to the woodshed" and study some of this stuff
21:48hiredmanyou don't need macros to use `
21:48hiredman,`x#
21:48clojurebotx__11270__auto__
21:48mmarczykit could be useful to test it :-)
21:48slyphonah, ok
21:48slyphon:)
21:49hiredman,(let [x '(1 2 3)] `(~@x))
21:49clojurebot(1 2 3)
21:49slyphonthe macro only affects when the parameters are evaluated?
21:50slyphonthat's the "macroness"?
21:50hiredmanright
21:50mmarczykor you could say
21:51mmarczyka macro function operates on the form to be compiled
21:51hiredman,(:macro (meta #'defn))
21:51clojurebottrue
21:51hiredman,(:macro (meta #'+))
21:51clojurebotnil
21:51hiredmanthat is the difference
21:51mmarczykas opposed to runtime parameter values operated upon by regular functions
21:52mmarczykso, a macro is a perfectly regular function, but it gets called when the code is compiled
21:52slyphonwhen i first started learning unix, someone told me "Everything is a file". It took me about 5 years until i *really* understood the implications of that
21:52slyphoni have a feeling this is something similar :)
21:52mmarczyk:-)
21:53slyphonmmarczyk: that makes sense
21:53slyphonand i kind of grok that, i think i just haven't had enough practice thinking about the code in that way
21:54slyphonthe "code is data, data is code" thing that drives people mad
21:54mmarczykhave you ever used Scheme?
21:55slyphonno, but i feel that i should
21:55mmarczyksyntax-rules macros are cool :-)
21:55slyphonhah
21:55mmarczykhttp://www.xs4all.nl/~hipster/lib/scheme/gauche/define-syntax-primer.txt
21:56mmarczykthere's nothing whatsoever strange about CL-style macros when you compare it with that :-)
21:56mmarczykon the surface, that is, semantically I kinda feel the reverse is true
21:57slyphon"I have noticed that it is easy to
21:57slyphonfind both trivial examples and extraordinarily complex examples, but
21:57slyphonthere seem to be no intermediate ones."
21:58slyphonsorry, i thought that'd be one line
21:58hiredmanmmarczyk: you could port syntax-rules to clojure
21:58slyphonbut that's very astute
21:59mmarczykhiredman: actually I was thinking of doing that
21:59slyphonmmarczyk: these differ from regular macros in what way?
22:00mmarczykslyphon: scroll down and have a look at some of the examples :-)
22:00mmarczykthere's a completely different syntax
22:00mmarczykthat's the superficial part
22:00mmarczykthen they are hygienic
22:00mmarczykmeaning that they prevent variable capture and the like
22:01greghsomewhere I saw a port of syntax-rules to CL
22:01hiredmanclojure does make it a pain to capture symbols
22:02greghit'd still probably need significant work to port it again to clojure
22:02mmarczykconsider (defmacro aif ([pred then] (aif pred then else)) ([pred then else] (list 'let ['it pred] (list 'if then else))))
22:02slyphonthere's an example of how to do it in the Programming Clojure book
22:02slyphon(symbol capture, that is)
22:02hiredman~'foo
22:02clojurebotHuh?
22:02hiredmanI mean, it's not that much of a pain
22:02hiredman,`~'foo
22:02clojurebotfoo
22:02mmarczykgregh: I might google around for it then
22:03mmarczykI was thinking of stealing ideas from PLT sources
22:03slyphonare there multiple schemes?
22:03hiredmanyes
22:03slyphonlike the plethora of CL implementations?
22:03mmarczykslyphon: loads
22:03hiredmanscheme is legion
22:03slyphonuh
22:03slyphonhiredman: hah!
22:03slyphonwhich one would you guys recommend?
22:03slyphonfor someone just learning
22:03hiredman*shrug* I prefer clojure
22:04mmarczykslyphon: more than one per Schemer
22:04mmarczyk:-)
22:04slyphonhah
22:04hiredmanI think someone was writing a scheme interpreter in clojure
22:04greghmmarczyk: http://www.ccs.neu.edu/home/dorai/mbe/mbe-lsp.html
22:04sexpbot"Scheme Macros for Common Lisp"
22:04mmarczykMIT Scheme makes it easy to go along with SICP and the classical mechanics book
22:04mmarczykStructure and Interpretation of Classical Mechanics
22:04hiredman~google clojure scheme
22:04clojurebotFirst, out of 22400 results is:
22:04clojurebotClojure Programming/Tutorials and Tips - Wikibooks, collection of ...
22:04clojurebothttp://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips
22:04hiredmanbah
22:05hiredman~google scheme in clojure
22:05clojurebotFirst, out of 23200 results is:
22:05clojurebotClojure Programming/Tutorials and Tips - Wikibooks, collection of ...
22:05mmarczykgregh: thanks a bunch!
22:05clojurebothttp://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips
22:05mmarczykI'll be taking a close look at that
22:05hiredmanttp://clojure.wikidot.com/scheme-interpreter-in-clojure is the real url
22:05hiredmanwith an h
22:06slyphonhah "Scheme 9 From Empty Space"
22:06mmarczykslyphon: there's a so-called "language level" -- a customised version of Scheme -- for EOPL in PLT Scheme
22:06mmarczykum, ouch
22:06mmarczykI mean Racket
22:06slyphonstill not as good as the "run plan 9 as a regular program" project "Plan 9 from Userspace"
22:07mmarczykI use Petite Chez Scheme for Project Euler
22:07mmarczykPLT for other stuff
22:09hiredmanseems like a port of syntax-rule to clojure should take advantage of clojure's destructuring
22:11hiredman(defsyntax-rule {(foo [first & rest]) (conj (vec rest) first)})
22:11hiredmanright needs a name
22:12hiredman(defsyntax-rule first->last {(foo [first & rest]) (conj (vec rest) first)})
22:13hiredman(first->last (list 1 2 3)) => (let [[first_12 & rest_85] (list 1 2 3)] (conj (vec rest_85) first_12))
22:13mmarczykapparently there's no licence on that code
22:13slyphonit's free!
22:15mmarczykah, LGPL actually
22:16slyphonoof
22:16slyphonCan't embed object in code, maybe print-dup not defined: atomikos MessageProducer proxy for HornetQRAMessageProducer->org.hornetq.core.client.impl.ClientProducerImpl@75896415
22:16slyphonweird
22:18hiredmanoooo
22:18hiredmanyou doing stuff with hornetq?
22:18slyphonyup
22:18slyphon*way* more stable than AMQ
22:19slyphonhah
22:19hiredmanclojurebot was sticking messages on the queue and my laptop was picking them up over openvpn
22:19slyphonnice
22:19hiredmanvery enterprise
22:20slyphonyeah, just gotta slap a web front-end on it and you can start charging for support
22:23_rata_what do I have to do to make swank-clojure works?
22:24_rata_I've followed the instructions here http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs
22:24sexpbot"Getting Started with Emacs | Clojure | Assembla"
22:24_rata_but it doesn't work yet
22:24_rata_it says: (progn (load "/usr/share/emacs/site-lisp/slime/swank-loader.lisp" :verbose t) (funcall ...
22:24_rata_in the first line of the REPL
22:24_rata_and then: java.lang.Exception: Unable to resolve symbol: progn in this context (NO_SOURCE_FILE:1)
22:25hiredmanhaha
22:25slyphonhttp://technomancy.us/126
22:25sexpbot"in which are found tricks of the trade concerning clojure authorship - Technomancy"
22:25slyphoni found that guide to be quite useful
22:25hiredman_rata_: what exactly are you doing
22:26hiredmanthat exception says you are trying to evaluate elisp as clojure
22:26_rata_first I did install package.el
22:26hiredmanwoa
22:26_rata_then I do M-x package-list-packages and install clojure-mode, slime, slime-repl and swank-clojure
22:26hiredmanwait
22:27hiredmanyou did (progn (load "/usr/share/emacs/site-lis... at a clojure repl?
22:27_rata_no
22:27_rata_that was what emacs did
22:27_rata_when I put M-x slime
22:28hiredman_rata_: pretty sure you don't want to install slime and slime-repl
22:28_rata_why?
22:28clojurebotwhy not?
22:28hiredmanswank-clojure or clojure-mode pull in the clojure parts of slime
22:29_rata_ahh ok
22:29hiredmanthe slime stuff listed in epl is most likely the common lisp slime stuff
22:29_rata_and how do I remove them?
22:29hiredmandarned if I know
22:29mmarczykactually I thought that elpa users are expected to install slime separately
22:30mmarczykbut I wouldn't really know, I'm using my own checkout
22:30_rata_do I need paredit?
22:30hiredmanyes
22:30_rata_ok
22:30hiredmanlast I heard clojure slime and upstream slime did not play well together
22:31mmarczyk_rata_: maybe not strictly need it, but you should definitely want it :-)
22:31mmarczykhiredman: in some ways
22:31mmarczykbut elpa is behind upstream
22:31hiredmanif you aren't already an emacs user I recommend you get the starter kit
22:31mmarczykpossibly partly for this reason
22:32mmarczykas a side note, SLIME HEAD works perfectly fine for me
22:32mmarczykI trust people who say that slime-autodoc doesn't work
22:32_rata_and do I need to set the inferior-lisp-program in .emacs?
22:32mmarczykand not load it, that's all
22:33_atoyou shouldn't normally need anything slime/swank related in .emacs when using swank-clojure
22:34mmarczykoh? where does elpa put its autoloads etc. then?
22:35hiredman~google emacs starter kit
22:35clojurebotFirst, out of 2680 results is:
22:35clojurebottechnomancy&#39;s emacs-starter-kit at master - GitHub
22:35clojurebothttp://github.com/technomancy/emacs-starter-kit
22:36hiredmanit's good stuff
22:36hiredmanthe only real problem is the starter kit is setup to make parens a faint gray
22:37_rata_I unistalled everything removing .emacs.d/elpa
22:37hiredman_rata_: get the starter-kit, it will make your life easier
22:37_atommarczyk: if I remember correctly elpa just activates everything that's installed (ie everything that's in ~/.emacs/elpa)
22:37_rata_but when I install swank-clojure again, it also installed slime and slime-repl :(
22:37hiredmanI believe it comes with clojure-mode at least, and maybe swank-clojure as well
22:37_atoerr ~/.emacs.d/elpa I mean
22:38mmarczyk_ato: I see, thanks
22:39mmarczykif that means pulling everything in at startup time... oh dear
22:39_atommarczyk: activate == install autoloads, not fully load everything
22:40mmarczykoh ok
22:44_rata_mmmm... I don't get it
22:44_rata_I removed my .emacs file and removed .emacs.d/elpa
22:45_rata_installed the starter-kit
22:45_rata_and now I have my emacs as it was the first day I installed it
22:45_rata_I don't even have the M-x package-list-packages
22:46_rata_thing
22:46hiredman_rata_: are you sure you installed starter-kit correctly?
22:47_rata_cd ~/.emacs.d && git clone http://github.com/technomancy/emacs-starter-kit.git
22:47_atoah
22:47hiredman:|
22:47_atoyou've got in a subdirectory then
22:47_rata_yes... that says the README
22:48_atodo: mv ~/.emacs.d/emacs-starter-kit ~ && rmdir ~/.emacs.d && mv ~/emacs-starter-kit ~/.emacs.d
22:48_rata_"Move the directory containing this file to ~/.emacs.d"
22:48_rata_ok
22:48hiredmanright, not ~/.emacs.d/
22:50_rata_well, it's working now :)
22:50_rata_there were a lot of errors/warnings while compiling though
22:50hiredmannow you just need autocomplete and rainbow parens
22:51hiredmanthats normal, don't worry about it
22:51_rata_ok
22:51_rata_hiredman: what's autocomplete and rainbow parens?
22:52_rata_that sounds interesting
22:52hiredmanhttp://www.emacswiki.org/emacs/AutoComplete
22:52sexpbot"EmacsWiki: Auto Complete"
22:53_rata_(now, I did M-x package-list-packages, selected clojure-mode and swank-clojure from the list, and again slime and slime-repl got installed)
22:53hiredman*shrug*
22:53hiredmanM-x slime
22:53_atoit's normal for slime and slime-repl to be installed
22:53_atoas dependencies
22:54_atoI have them at least anyway
22:54_rata_is autocomplete better than company?
22:54hiredmanhttp://dishevelled.net/elisp/rainbow-parens.el
22:54hiredmancompany?
22:55hiredmanI have nod idea
22:55_rata_ok
22:55slyphoni use autocomplete
22:55slyphonit's a'ight
22:56hiredmanthe company mode wiki page has some discussion of company vs. ac as does the ac wikipage
22:57_rata_what does rainbow-parens do?
22:58_rata_well, slime seems to be working now... how do I say to swank-clojure how to execute clojure? (it says clojure is not installed, but it is)
22:58_atorainbow-parens is designed to burn out your eyes ;-)
22:59slyphonhaha
22:59hiredmanhttp://tinypic.com/view.php?pic=2urqmgl&amp;s=6
23:00sexpbot"emacs rainbow-parens Pictures, emacs rainbow-parens Images, emacs rainbow-parens Photos, emacs rainbow-parens Videos - Image - TinyPic - Free Image Hosting, Photo Sharing &amp; Video Hosting"
23:00hiredmanit changes the color of parens based on nesting level
23:00hiredmanvery handy
23:01slyphonwow, mit-scheme takes a *long* time to compile
23:07mmarczykI prefer highlight-parentheses
23:07mmarczykbut guess it does the same ultimately
23:08slyphonwell, one is on-demand
23:11slyphonjeez
23:11slyphonthat's not meant to be a come-on
23:12_rata_hahahahahaha
23:13mmarczykslyphon: no precompiled package for your OS?
23:13slyphonwell
23:13slyphoni'm using macports
23:16mmarczykhttp://www.gnu.org/software/mit-scheme/
23:16sexpbot"MIT/GNU Scheme - GNU Project - Free Software Foundation (FSF)"
23:16mmarczykthey've got MacOS X binaries
23:16danlarkinthat really is annoying
23:17slyphonmmarczyk: well, i'll use that if ti goes from a first-degree to second-degree burn
23:18mmarczyk:-)
23:32_rata_mmmm.. there are some annoying things with the emacs starter kit... how do I get rid of that green line over the current line?
23:33hiredmanthat is most likely hl-line-mode
23:34_rata_hiredman: thanks :)
23:34slyphonoh, i always thought that was part of cedet
23:34slyphonoh, that's above each method decl
23:40slyphonwow
23:40slyphonthat took almost an hour
23:43_rata_how do I inform swank-clojure where do I have clojure installed?
23:44mmarczykhm, rainbow-paren has very clean sources apparently
23:45_rata_I couldn't make rainbow-parens work :(
23:45mmarczykdid it complain about not being able to find paredit or sth?
23:46RaynesEw @ hl-line-mode
23:46mmarczykif so, highlight-parentheses is self-contained, so you could use that instead
23:46mmarczykso as to avoid the hassle of fixing things and yet have highlighted parens...
23:46remleduffIf I quit emacs and choose to "kill the active connection and then exit", I can't M-x slime-connect after restarting emacs. Is that my fault for quitting the wrong way?
23:46mmarczykbut r-p's code is in fact so clean that I might be able to write a cool advice for it
23:46slyphonremleduff: that's odd
23:47remleduffIt says "connection refused"
23:47slyphonoh, you have to restart the clojure process
23:49RaynesIt looks like one of my dependencies is turning *warn-on-reflection* on, and I'm getting reflection warnings everywhere. Is there a way to force it to stay off?
23:49remleduffYeah, I was thinking the whole point of lein swank was that it would survive emacs restarts
23:50slyphonnah, it's more that you can specify the command-line args more easily (i found)
23:50slyphoncustomize them per-project
23:54_rata_mmarczyk: it doesn't say anything
23:54_rata_but the parens are the same as before when I do (require 'rainbow-parens)
23:56hiredman(rainbox-parens-mode 1)
23:57hiredmanrainbow
23:57hiredman(rainbow-paren-mode t) is what is in my hiredman.el
23:58_rata_:) thanks again
23:58slyphono/` Just a box of rain, or a ribbon for your hair... o/`