#clojure logs

2010-04-13

00:00jcowanIt's irritating that Java has only one matching function for all maps, except for IdentityMap which has to fake it.
00:00hiredmanfor a little while PHMs were not j.u.Maps
00:00technomancyseems like requiring a little (into [...]) for interop might be worth the price of correct equality semantics
00:00hiredmanmaybe slightly longer than a little while, it was long ago
00:00technomancybut I haven't thought that all the way through
00:00tomoj,(-> {} (assoc 1 :foo) (assoc (long 1) :bar))
00:00clojurebot{1 :bar, 1 :foo}
00:00technomancythat's backwards, but you know what I mean
00:01hiredman#scala was wreslting with this a year or so ago
00:01technomancyI just read a blog post about that over the weekend thinking to myself, "yeah, that's crazy, but it never comes up in practice"
00:01technomancyand then just this afternoon it bit me
00:01jcowanThere are no correct equality semantics tout court, only correct for certain purposes.
00:02technomancyjcowan: maybe, but there are incorrect equality semantics. and (.equals 1 (long 1)) is one of them. =)
00:03jcowanI'm not even ready to swallow that. Sometimes you want comparisons with constant performance.
00:03technomancyidentical? is constant
00:04technomancyheh, except that's not quite right
00:04technomancy,(identical? 1 1)
00:04clojurebottrue
00:04technomancy,(identical? 10000 10000)
00:04clojurebotfalse
00:05technomancyis that something fixnums would help with?
00:06jcowanHow out of date is the Web site?
00:06dnolen,(identical? 127 127)
00:06clojurebottrue
00:06jcowan(in terms of being inaccurate, not in terms of being incomplete)
00:06dnolen,(identical? 128 128)
00:06clojurebotfalse
00:07technomancyinteresting; elisp has identical integers even at very high values
00:07hiredmanjcowan: what part of the website?
00:07hiredmanit should be fairly accurate, maybe the docs follow the last release not git head
00:08jcowanIn some projects the docs are so out of date they're totally irrelevant.
00:08_atotechnomancy: doesn't elisp use tagged integers, so they're not seperate objects?
00:08technomancy_ato: that'd be my guess
00:09dnolenjcowan: site is up-to-date with 1.1.0. But all the fun stuff is in master and it's very usable. 1.2.0 takes things to a whole other level IMO.
00:09technomancyI wonder if that's part of why ClojureCLR is "ClojureCLR" and not "Clojure for the CLR".
00:09_atothat's why they're only 29 bits or whatever it is
00:09jcowanExactly.
00:10jcowanAnd there are no bignums in elisp at all.
00:10jcowanQuoth the elisp reference manual:
00:10jcowan 536870913 ; Also the integer 1, due to overflow.
00:11technomancythat must be out of date; I can square that number and it works fine in elisp
00:13jcowanPossibly because you have a 64-bit build of emacs.
00:14technomancya likely story
00:14hiredmanknowning technomancy it seems almost a certainty
00:14technomancyfor a while I had a threaded build
00:15technomancythat was a wild ride
00:15technomancymeaning: it didn't work that well
00:15hiredmannow all code that depends on the overflow behavior is broken
00:15technomancybut it was exciting
00:15technomancyheh
00:17technomancyin case there was any doubt, John Rose is the man: http://blogs.sun.com/jrose/entry/fixnums_in_the_vm
00:17sexpbotfixnums in the VM - John Rose @ Sun
00:17jcowanSure.
00:18jcowanWell, of course, a Lisp that wraps numbers with general arithmetic functions is broken (if there must be a limit, you can reasonably overflow to floats or throw an error).
00:18technomancyactually if you really want a trip read this one: http://blogs.sun.com/jrose/entry/tailcalls_meet_invokedynamic
00:18sexpbottailcalls meet invokedynamic - John Rose @ Sun
00:19@jcowanOkay, I'm an op.
00:19hiredmantail calls are exciting
00:19hiredmanmmmm
00:19hiredmangeez, but invokedynamic is cool too
00:20technomancyjcowan: do folks have to be present for you to bestow opship on them?
00:20@jcowanI have no idea.
00:21technomancywell if you can't promote rhickey you could try chouser
00:22dnolendoes invokedynamic buy much for Clojure? I recall rhickey saying that it doesn't
00:22@jcowanCan I get some concurrence from other users, so I'm reasonably sure I should do that?
00:22hiredmandnolen: it won't ease any of the main pain points
00:23@jcowanIt should provide more efficient reflection, though.
00:24carkhjcowan: yes chouser would be the one beside rhickey
00:24hiredmanalways two there are
00:25technomancyhiredman: suddenly it all makes sense
00:25hiredmanclojurebot is c3po
00:26dnolenjcowan: yeah, but in Clojure you generally either don't care (using Clojure datastructures anyway), or you want the absolute fastest thing (primitive math)
00:26dnolenwith deftype you don't even need to bother with type-hints at all.
00:28dnolenwith deftype + map + vectors you can get ridiculously close to the speed of java mutable object + for loop + java mutable array
00:32Licenser_morning
00:33technomancywhoa; scopes are scheduled for 1.2 now? http://www.assembla.com/spaces/clojure/tickets/2-scopes
00:33sexpbot#2 - Scopes (New) | Clojure | Assembla
00:34hiredmannice
00:34hiredmanI'll believe it when I see it
00:34Licenser_oh scopes?
00:35hiredman(when I see code)
00:35Licenser_^^
00:36technomancyI guess that means it's going to be a while though
00:37hiredmanmy understanding is rhickey has a strategic reserve of code he releases over time
00:37@jcowanThere.
00:37Licenser_heh
00:38@jcowanI can't do offline people, at least not easily.
00:38hiredmanand so ended the age of man
00:38Licenser_hi jcowan chouser
00:38tomojfinally we can ban people who don't like parentheses, hurrah
00:38Licenser_jcowan: that sounds so wrong
00:38Licenser_uhh I love parentheses!
00:38Licenser_but they could get a easyer to spell word for it :P
00:39@jcowanAnyhow, if something goes wrong with opness, message me at cowan@ccil.org.
00:39tomoj"parens"? "pars"? "p's"?
00:39Licenser_p's is good
00:39Licenser_I can spell that
00:39maravillasopen banana, close banana
00:39lancepantzhaha
00:39lancepantzi'm going to start referring to them like that
00:40@jcowanSo what does the community think of Enclojure, and Thortech generally? Benefactors? Malefactors? Irrelevant?
00:41Licenser_jcowan: enclojure is't at it's best yet I think there is still a way to go but it already is quite cool :)
00:41tomojto me personally, irrelevant
00:42@jcowanI am considering applying to work there.
00:43Licenser_well it sounds as if you could work with clojure there which is kind of cool
00:43@jcowanIndeed.
00:44@jcowanThat would be why I'm asking here about it.
00:46Licenser_well it is better then applying somewhere to write java :P
00:50@jcowanNo joke there.
00:51@jcowanI'm really really tired of having to program in J-ugh because I've always (well, for too long) had to program in J-ugh
00:51@jcowanAnyhow, any proposals to update the topic before I go?
00:51@jcowan(for now, not for good)
00:52Licenser_well try it worst case you get the job or don't :P
00:52@jcowanSure.
00:52@jcowanLicenser_: What is it that "sounds so wrong", though?
00:53technomancyjcowan: for a two-year-old topic, it's aged surprisingly well
00:54@jcowanOkay, all good.
01:13AntonyBlakeyAnyone here building webapps using Enclojure?
01:14AntonyBlakeyUsing maven, I should add.
01:14Licenser_don't use the m-word ;
01:14Licenser_(
01:14AntonyBlakeyI'm interested in what workflow people use i.e. jetty plugin vs. repl with run-jetty
01:15AntonyBlakeyI don't touch maven XML anymore, it's all Clojure, so Maven is easy
01:16lancepantzi use a repl in dev, but build a war for production
01:16lancepantzdon't use enclojure though fwiw
01:16AntonyBlakeyEnclojure isn't the issue
01:16AntonyBlakeySo you use compojure?
01:17lancepantzyep
01:17AntonyBlakeyDo you genclass a servlet for the war, but se run-jetty in development REPL?
01:17lancepantzyeah, i have run-jetty in a different namespace
01:17lancepantzand launch that in dev
01:18lancepantzbut don't use that namespace in the war
01:18AntonyBlakeyDo you use maven and the jetty plugin at all?
01:18lancepantzno, i use ant :/
01:19AntonyBlakeyOK, thanks, that's useful info.
01:19lancepantznp
01:28dnolenfor anyone else driven insane from converting to binary ops and type hinting expressions, http://gist.github.com/364328
01:28sexpbotgist: 364328 - GitHub
01:37hiredman,( -37 12)
01:37clojurebotjava.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn
01:37hiredman,(- 37 12)
01:37clojurebot25
01:43Licenser_question: what basic java classes are important and secure?
01:44Licenser_dnolen: neat
01:46hiredmaneasier that patching the compiler
01:46Licenser_hey hiredman when will clojurebot use clj-sandbox? :P
01:47hiredman*shrug*
01:47Licenser_^^
01:47hiredmanI'll put it in the todo
01:49hiredmanhttp://gist.github.com/297122
01:49sexpbotgist: 297122 - GitHub
01:49hiredmansexpbot: thanks!
01:49dnolenwould be cooler to make my above macro a code walker (using zippers or something) that would look for *, +, <, /, >, =, etc so you wouldn't have to declare prim more than once. You generally want ops to be all of the same kind.
01:50somniumwe should make #clojure-think-tank, fill it with bots, and give them interesting questions to ponder
01:50Licenser_wow I fail to understand hat o.O
01:50hiredman,(doc clojure.walk/post-walk)
01:50clojurebotTitim gan éirí ort.
01:50hiredman,(doc clojure.walk/postwalk)
01:50clojurebot"([f form]); Performs a depth-first, post-order traversal of form. Calls f on each sub-form, uses f's return value in place of the original. Recognizes all Clojure data structures except sorted-map-by. Consumes seqs as with doall."
01:51tomojlancepantz: grr
01:51tomojI can't build jiraph
01:51lancepantzwhat's wrong?
01:52tomojyou're not on something like ubuntu by chance, are you?
01:52tomojmissing jni.
01:52lancepantzmac
01:52tomojjni.h
01:52tomojI think it's trying to compile tc maybe
01:52lancepantzmost likeley
01:52lancepantzwhat os are you on?
01:52tomojubuntu karmic
01:53tomojcouldn't find anything in the repos that sounded relevant
01:53hiredmanLicenser_: the #^{:primitive true} on the expession causes it to be compiled to dadd (double add) instruction instead of a call to clojure.lang.Numbers/add
01:54hiredmannot in the official clojure
01:54_atotomoj: hmm I have /usr/lib/jvm/java-6-sun-1.6.0.15/include/jni.h
01:54tomojme too
01:54tomojbut it is apparently not found
01:54tomojnot sure if I need to set some environment variable or what
01:55tomojas soon as C is involved I have no clue what to do
01:58lancepantzi've had some issues with the tc libraries, but not jni.h before
02:04lancepantztomoj: i get screwed up with the C part too, i'll ask the guy that wrote it for you when he's in tomorrow
02:09tomojnow it's trying to call /bin/javac whic doesn't exist
02:09tomojoi
02:10tomojare there people who actually understand this stuff?
02:12LeNsTR /usr/bin/javac ?
02:18vu3rddI am observing that when I startup slime (I have a huge set of jars in my default classpath), the CPU usage touches 100% for quite a lot of seconds.. does others also observe this?
02:18vu3rddit reduces considerably when the number of jars in the classpath is less.
02:21dnolenhttp://gist.github.com/364328, hiredman: using post-walk now
02:21sexpbotGist - GitHub
02:21tomojLeNsTR: nope, /bin/javac
02:21dnolen(prim + float 4 5 (* 6 7) 8) expands
02:21dnolenI'm sure there's bugs, but this already will save me a lot of time.
02:22dnolenshould probably improve to allow (prim float (+ 4 5 (* 6 7)))
02:28dnolendone, http://gist.github.com/364328 (prim float (+ 4 5 (* 6 7) 8))) works
02:28sexpbotgist: 364328 - GitHub
02:39dnolenok, reversed type and fn position, and now you can easily override the "current" type-hint, a lot of code is going to look a lot cleaner now.
03:02bozhidargreetings, mates
03:02bozhidaris there anyone around here using clojure-mode in Emacs?
03:02bozhidarI'm having a strange issue with the font-locking
03:03bozhidarbasically most of the core clojure functions are lacking a proper font face
03:03bozhidaralthough I see one defined in the source code of the mode
03:03bozhidarI'm using clojure-mode 1.6 from ELPA in Emacs 23.1
04:37sergey_miryanov,(array-map 1 2 3)
04:37clojurebot3
04:37sergey_miryanov,(apply (array-map 1 2 3))
04:37clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$apply
04:41bsteuber,(array-map :a 1 :b 2 :c 3)
04:41clojurebot{:a 1, :b 2, :c 3}
04:53sergey_miryanovbsteuber, thanks!
04:56spariev,(apply array-map [:a 1 :b 2 :c 3])
04:56clojurebot{:a 1, :b 2, :c 3}
04:58sergey_miryanovthanks :)
05:31npoektophi! where is function (now)?
05:31npoektopcan't find it
05:33hoeck,(java.util.Date.)
05:33clojurebot#<Date Tue Apr 13 02:35:05 PDT 2010>
05:34AWizzArd,(java.util.Date.)
05:34clojurebot#<Date Tue Apr 13 02:35:07 PDT 2010>
05:34AWizzArdk
05:34AntonyBlakey,(System/currentTimeMillis)
05:34clojurebot1271151329467
05:35hoecknpoektop: my eyes can't resist to the urge reading your nick as "projector" :)
05:38npoektophoeck, this is known only to initiates)
05:41hoeckand then its so disturbing typing pr<tab> and wondering why it won't complete
05:44licoresse:)
07:13caljuniorWow, just went to http://www-formal.stanford.edu/jmc/recursive.html to get McCarthy's classic 1960 paper. The counter was at just 183 hits since May 1998.
07:14Licenser_oha
07:14caljuniorand the hit counter works fine.
07:15caljuniorI feel special now. :-)
07:15Licenser_perhaps it was reset?
07:17Licenser_now it are 189
07:18caljuniorI refreshed up to 185 to check if it worked.
07:19sparievhttp://www-formal.stanford.edu/jmc/ - 971 hits since 1995 October 17th
07:20sparievI thought John McCarthy home page is much more popular
07:22caljuniorShouldn't we send him a thank you postcard at least?
07:31sparievmaybe there is should be a Lisp Inventor Appreciation Day :)
07:31triyoyou can bake him a cake for his bday
07:31rfgA parens cake would be cool.
07:32rfgFor certain values of cool.
07:32esjor a self eating cake
07:33triyoesj: hehe nice one
07:33sparievgreat idea ) I'll certainly ask gf a parens cake for my birthday
07:33triyoesj: very inline with lisp philosophy
07:33esj:)
07:34rfgtriyo: it would maybe be more like a self making cake.
07:35rfgMade from other cakes.
07:38rfgThe cake is a lie.
08:35cemerickwasn't the 'slim' versions of contrib supposed to include the necessarily-compiled *Writers for pprint?
08:35cemerickweren't*
08:41AWizzArdcemerick: when I have (deftype Foo [a b c] java.io.Serializable) then Foos can be serialized. But if I just have (deftype Foo [a b c]), can I then make instances of Foo serializable afterwards? With Protocols/extend maybe?
08:42cemerickAWizzArd: java.io.Serializable is only a marker interface -- it doesn't define any methods, so it's mostly useless w.r.t. protocols insofar as you want to interoperate with standard java serialization
08:43cemerickI mean, once the Foo class is generated, without Serializable, all instances of it will behave the same within ObjectOutputStream et al., regardless of what you do using protocols.
08:43AWizzArdcemerick: do you want to imply that doing (deftype Foo [a b c] java.io.Serializable) is not enough to allow (.writeObject oos (Foo 10 20 30))?
08:43AWizzArdah oki
08:44cemerickNo, if the interface is included in the deftype/record declaration, that should be enough.
08:44AWizzArdright, because this worked for me
08:45AWizzArdSo, if someone did not specifiy j.io.S for his deftype, then it can’t be made Serializable anymore afterwards, with some magic macro.
08:45AWizzArdWe really need Rich to make deftypes by default serializable :)
08:45cemerickNo macro can impact the implementation of OOS.
08:45AWizzArdat least not currently, as deftypes have no reflection
08:46cemerickClasses are closed, and cannot be redefined (modulo stuff like jrebel (sp?)).
08:46AWizzArdok, very possible that it won’t work
08:46AWizzArdbut maybe rhickey will give is j.io.S for deftypes
08:46AWizzArdis => us
08:47AWizzArdor defmaptype or however the current deftype will be renamed
08:47cemerickdefrecord is the frontrunner last I knew.
08:48cemerickSadly, I have to say that the only way to maintain a project of any size is to build all of one's dependencies from source, and maintain the artifacts yourself.
08:49cemerickBetween the RestFn signature change from 1.1, and the contrib reorg, it's nearly impossible to reuse any 1.1-era artifacts.
08:49AWizzArdyes, okay, so defrecord will most likely implement clojure.lang.IPersistentMap
08:50AWizzArdcemerick: à propos dependencies from source.. so far I am using still rhickeys gist about cells.clj
08:51AWizzArdAnd I (load-file it)
08:51rhickeycemerick: RestFn sig change?
08:51cemerickAWizzArd: which gist is this?
08:52zakwilsonI'm looking for a simple FTP library. There are, of course lots of FTP libraries in Javaland, but trying to find the most appropriate by examining each one is a lot harder than asking here, so I'm asking here.
08:52cemerickrhickey: yes, the signature for RestFn.invoke changed since 1.1. I think that was the class. Anyway, that made AOT-compiled 1.1-era libs unusable under 1.2-era clojure.
08:53AWizzArdcemerick: I think it was http://gist.github.com/306174
08:55AWizzArdrhickey: would it make sense to let defrecord implement clojure.lang.IPersistentMap and java.io.Serializable by default?
08:55rhickeycemerick: I don't see it
08:56rhickeyAWizzArd: it will implement IPersistentMap, that's the point of it
08:56AWizzArdyes, and does (on top of that) Serializable make also sense?
08:57rhickeycemerick: I am interested in improving binary compatibility between AOT compilations, but need to know specifically what is tripping people up
08:57cemerickrhickey: I'm looking for the commit sha now
08:57rhickeyAWizzArd: possibly
08:57AWizzArdWould be very useful.
08:58cemerickrhickey: hiredman was talking about how it'd be nice to have an ABI (which would ostensibly simplify things), but I'm not conversant on that level.
08:58rhickeycemerick: what is bytecode if not that?
08:58hoeckI guess the question is wether there will be any downsides of always implementing Serializable on types.
08:59AWizzArdOh, cemerick, about serializable defrecords again. Yesterday you said they would be useful only for short-term usage, because the class name changes. Did you mean by that what I suggested yesterday? (deftype Foo [a]), (class (Foo nil)) ==> Foo__1234 today but after JVM restart Foo__4321?
08:59cemerickAWizzArd: right
08:59AWizzArdso, perhaps can those instances additionally serialize their (type (Foo nil)) ==> ::Foo? And then this info can be used for deserialization?
09:00cemerickAWizzArd: ObjectInputStream knows nothing about clojure type tags
09:00AWizzArdyes okay, and probably can’t be made so
09:01cemerickrhickey: still hunting for the sha, but if you attempt to load something AOT-compiled under 1.1 under a 1.2 build, you get "Exception in thread "main" java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V"
09:02cemerickso, the ctor, not .invoke()
09:02a_strange_guythat't because Fns now have metadata
09:03cemericka_strange_guy: yeah, I wasn't saying it wasn't a good or necessary change
09:04AWizzArdhoeck: maps, vectors and sets also always implement them. And as defrecord will be also a container/maplike thing it could make sense
09:07a_strange_guySerializability only makes sense for AOT-Compiled deftypes
09:07AWizzArdIs there a "deftype?" function? (deftype? 10) ==> false (deftype Foo [a]) (deftype? (Foo 123)) ==> true
09:07AWizzArda_strange_guy: because then the class name won’t change?
09:08a_strange_guy(instance? clojure.langIDynamicType obj)
09:08a_strange_guyyes
09:09cemericka_strange_guy: yeah, that's essentially assumed, I think (at least for the use-cases I'm aware of)
09:09a_strange_guythe first thing that happens when desirializing is Class.forName()
09:09rhickeycemerick: ok, see that, thanks
09:09cemerickrhickey: I think it's 430dd4fa711d0008137d7a82d4b4cd27b6e2d6d1?
09:09Raynescgrand: Thanks for the SO reply. We figured it out at the same time. :p
09:09cemerickrhickey: but anyway, I don't think there's much to do about it?
09:09cemerickthat can be done about it*
09:10a_strange_guyAWizzArd: but you can always print a deftype, and read it in afterwards
09:10rhickeycemerick: not that, no
09:10a_strange_guySerialization in a Lispy way xD
09:11AWizzArdyes
09:11SynrGwho was it who helped me the other day by recommending rlwrap when i found jline was broken? thanks again a bunch. i really like it. also, the debian maintainer for jline found the bug and fixed it! (presumably he's sending the patch upstream)
09:12AWizzArda_strange_guy: I am currently doing this
09:12SynrGhere's the jline patch, in case it helps anyone: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576814
09:15cemerickrhickey: given the potential for changes like that, is cross-version binary compat for AOT-compiled libs really a feasible objective?
09:16triyoI know I'm catching on late here; whats the purpose of defrecord? Is it meant to be a veriation or replacement of defstruct? Any early docs?
09:16rhickeycemerick: that's a particularly bad one, as a refactoring under fns
09:17cemericktriyo: defrecord is the proposed new name for deftype; and yes, defstruct is obsolete :-)
09:17npoektopit there a way to coerce a list to set and check if this set is equal to some another?
09:17a_strange_guytriyo: yes, a deftype variation which should do everything defstruct did
09:18triyooh so it is "deftype" ok thanks.
09:18cemerickrhickey: well, OK, but I can't imagine that that's the last one like that to come down the pike.
09:18a_strange_guydeftype will then be much more low level than it is now
09:18rhickeycemerick: me neither
09:20npoektophow to coerce a list to set?
09:20cemerickRight, so I think AOT compilation needs to be reserved for deployment-stage packaging, rather than the default for library distribution.
09:20cemerick,(set (list 1 2 3 4))
09:20clojurebot#{1 2 3 4}
09:20npoektopcemerick, thank you
09:21cemerickThat's obviously a policy issue rather than a tech one, but one worth talking about IMO.
09:21carkhcemerick: i'm not sure on that, what if people outside clojure want to use your library ?
09:21cemerickcarkh: you mean people using it from Java, via generated classes?
09:22carkhyes
09:22cemerickI would consider that a sort of deployment. :-)
09:22carkhhehe ok
09:23cemerickWhere deployment == letting code outside the clojure ecosystem, whether that's to a customer or to a non-clojure downstream dependent.
09:23sattvikThe more I think about it, the more wary I am of making a lot of things Serializable by default. Making things Serializable can create a lot of problems, including opening potential security holes in programs.
09:24cemerickrhickey: in a related vein, I wonder if you have plans to revisit the conditional execution stuffs. e.g. +clojure-1.1 foo \n+clojure-1.2 bar, etc.
09:25rhickeycemerick: CL's #+ and #- ?
09:25cemerickI'm writing a lot of (try (require '[clojure.contrib.duck-streams :as io]) (catch Exception e (require '[clojure.contrib.io :as io]))) and the like these days
09:25cemerickrhickey: or something similar, yes
09:26cemerickI remember the idea was batted around, but dropped for later.
09:29AWizzArdcemerick: why do you try to require duck-streams? (vs io)
09:30cemerickAWizzArd: io is duck-streams (plus other stuff), circa 1.2
09:31AWizzArdyes, but does your code not expect to run on 1.2?
09:31AWizzArdYou want it to run also on 1.1?
09:32cemerickAWizzArd: this is code in third-party libraries that I'm updating to be usable in either environment.
09:33cemerickWe're actually still using 1.1 contrib, with some build of clojure from ~February.
09:41sparievwhere can I read more on the new 'scopes' feature ?
09:42sparievcan't find anything at Assembla
09:45sparievexcept the http://www.assembla.com/spaces/clojure/tickets/2-scopes
09:45sexpbot#2 - Scopes (New) | Clojure | Assembla
09:47RaynesThe title scraper ignores links with "paste" and "gist" in the URL now, and only grabs a maximum of 1 link per message, so it shouldn't spam. It's also much faster, as it reads the data lazily now.
09:48RaynesIt should actually be useful rather than disrupting now.
09:49AWizzArdrhickey: are there plans to get the Cells code soon into Master?
09:50rhickeyAWizzArd: I'm still sleeping on Cells, i.e. thinking about them
09:50sparievare cells and scopes the same ?
09:52rhickeyhrm, SpringSource buys RabbitMQ
09:58stuarthallowayrhickey: do you have a suggested rename for Chas' << macro?
09:59rhickeystuarthalloway: where is that?
09:59stuarthallowayclojure.contrib.strint (string interpolation)
10:00rhickeyI don't see that here: http://richhickey.github.com/clojure-contrib/index.html
10:00sexpbotclojure-contrib - Overview
10:02cemerickrhickey: stu was referring to this: http://github.com/richhickey/clojure-contrib/commit/b9db2805f9571d52d5f0bb0b726fee1ca70c821d
10:02sexpbotCommit b9db2805f9571d52d5f0bb0b726fee1ca70c821d to richhickey's clojure-contrib - GitHub
10:02stuarthallowaysorry, got bounced. back now
10:02cemerickwhose sexpbot is plinging URL titles everywhere?
10:03cemericksexpbot: who owns you?
10:03Raynescemerick: I own him.
10:04cemerickstuarthalloway: I'm slowly settling on <~, through lack of alternative suggestions.
10:05RaynesI suspect that by the end of next year, we'll have every possible arrow-shaped function name combination possible.
10:05stuarthallowaycemerick: I am also fine with the name collision, unless << will be a name in core
10:06cemerickstuarthalloway: that's my presumption.
10:06cemerickRaynes: indeed
10:07cemerickI think we'll need to have template namespaces (or some similar notion) relatively soon so that various teams can easily cope with symbol collisions.
10:07rhickeystuarthalloway: I'm not sure I like it
10:07RaynesAre all github titles generally long and irrelevant with self-explanatory URLs? :o
10:07stuarthallowayrhickey: what is the "it" reference currently pointing to?
10:08rhickey<<
10:08stuarthallowaythe name or the lib at all/
10:08rhickeythe lib
10:08stuarthallowaysigh
10:08rhickeyexceptions as control flow
10:08rhickeynew meaning for {}s
10:09stuarthallowaythe former bothers me, the latter not so much
10:09stuarthallowaywe rubyists love some interpolation
10:09stuarthallowayand are accustomed to having a dsl baked into string literals
10:10cemerickrhickey: there's no alternative approach for doing what silent-read does AFAIK
10:10cemerickFWIW, I get more mail about strint (mostly "thanks for that") than anything else I've ever posted online.
10:10stuarthallowaycemerick: I wondered if we could narrow the exception being handled, but other than that...
10:10cemerick'course, I'm not so popular anyway, so that's likely irrelevant.
10:11rhickeycemerick: really? you could track \{ \} \( \)
10:12cemerickrhickey: ugh -- dealing with those chars in quoted strings, etc. I'd prefer to let the reader get it right, and not reimpl its utility.
10:13rhickeythen why catch it at all?
10:13rhickeyis it not an error?
10:15stuarthallowayrhickey: that works for me
10:15cemerickrhickey: no, it's not an error. consider (<< "foo ~(not a form")
10:15stuarthallowaycemerick: why would you every do that?
10:15stuarthalloways/every/ever
10:16rhickeycemerick: seems wrong to me, either ~ is escaping or it isn't
10:16rhickeynot based on what follows
10:16rhickeyor ~( is escaping, whatever
10:17stuarthallowayrhickey: the other issue, repurposing { and (, is interesting
10:18rhickeystuarthalloway: () isn't really repurposing
10:18rhickeystill a call
10:18rhickeybut {foo} is not a map
10:18stuarthallowaywould you like (<< "Here is ~foo") ?
10:19cemerickstuarthalloway: *I* wouldn't, but I was attempting to be defensive.
10:19rhickeywhen does ~foo end?
10:19cemerickright, you need some kind of terminal
10:19rhickey~(quote foo)
10:19clojurebotamespaces 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
10:19rhickeykind of long
10:20rhickeyand not quite correct
10:20rhickey~(identity foo) works of course
10:20clojurebotFoo is not Baz.
10:20rhickeyaargh clojurebot
10:21stuarthallowaythere's another repurposing problem :-)
10:21rhickeyso first issue, using unreadability as a determinant of an escape clause
10:21stuarthalloway"sorry, your feature request has been rejected because it conflicts witn an irc bot..."
10:21rhickeysecond issue, repurposing {}
10:22rhickeycemerick: do you get my point re: escaping?
10:22cemerickrhickey: any kind of ~(some-form single-value) is too long for simple value interpolation IMO
10:22rhickeycemerick: I understand
10:22stuarthallowaycemerick: with you on issue 2, but with rich on issue 1
10:23rhickeyin normal reading, ~foo is delimited by following whitespace. It could eat only one space, thus when you need a space put two, but kind of subtle
10:24rhickey~foo~ ?
10:24clojurebotPardon?
10:24rhickeyaargh
10:24LeNsTR(-:
10:24RaynesAt least my bot only speaks out of turn when someone mentions a non-github/paste url. :>
10:25cemerickrhickey: Making the necessary change w.r.t. ~ escapign would complicate things quite a bit compared to what's there though, and for little practical benefit it seems.
10:25cemerickescaping*
10:26rhickeycemerick: how does one take a string that might contain ~s and make it safe for << ?
10:27rhickeytry reading after each ~?
10:27rhickeyit doesn't work
10:27cemerickrhickey: oh, I thought you were just after avoiding the exception handling as control flow.
10:28rhickeycemerick: that was a sign of something wrong, this is what's wrong
10:33zakwilsonAnybody have an open-source Clojure applet with a UI beyond just painting something in a frame I could have a look at as an example?
10:35bsteuberzakwilson: I always look at java snippets for this kind of stuff - it's always counting the number of vanishing lines by transforming this to clojure ;)
10:35bsteuber*it's always fun
10:35cemerickrhickey: the simplest escape would likely be (<< "~{\\~}{dont-eval-this}")
10:36cemerickbut bare ~s are just fine of course
10:37stuarthallowayzakwilson: do you want an applet, or just swing?
10:37bsteuberwhat's <<? any quick links available?
10:37zakwilsonstuarthalloway: an applet. I have the basics of Swing working in a standalone application.
10:37cemerickbsteuber: it's in contrib, though likely not for long. See http://muckandbrass.com/web/x/AgBP
10:38rhickeycemerick: I don't understand ~{\\~}
10:38zakwilsonbsteuber: That is, indeed entertaining, but there are some Clojure-specific issues with applets, like reflection prompting security warnings.
10:38cemerickrhickey: that hands \~ to the reader
10:39bsteubercemerick: thx, sounds nice
10:39zakwilsonWell, I guess that's not entirely Clojure-specific, but it's something that must be actively avoided with Clojure and not with Java.
10:39cemerickto be clear, the only time ~s have to be escaped are when they preceed balanced {'s or ('s
10:39rhickeyno, when they precede { or (
10:39bsteuberzakwilson: oh, I didn't know
10:40rhickeyalthough { not likely to survive
10:40cemerickah, right, I removed the checks for balancing braces and parens
10:40rhickey~( is an escape for this thing, special, presumes ~ followed by a readable list form
10:40clojurebot'Sea, mhuise.
10:41AWizzArd<< is already used for Cells
10:41rhickey<< not likely
10:41AWizzArd<< and >>
10:41cemerickrhickey: well, some other balanced chars are needed for single values.
10:41rhickey?
10:42cemerickif you're strongly against ~{some-value}
10:42hoeck~/v/ ?
10:42clojurebotExcuse me?
10:42bsteuberso if string interpolation makes it into clojure, shouldn't it be given a reader macro? maybe `"foo ~" ?
10:43rhickey~<foo> ?
10:43clojurebotTitim gan éirí ort.
10:44hugod~@[foo]
10:44clojurebotI don't understand.
10:45rhickeyare you expecting things other than literals and symbols in ~{} ?
10:45cemerickrhickey: no
10:46cemerickrhickey: just to clarify, your objection is the {} association with maps?
10:46rhickeyyes
10:46stuarthalloway~<problem solved!>
10:46clojurebotexcusez-moi
10:47rhickeystuarthalloway: right, that's what I suggested, to silence :)
10:47rhickeyexcept ~<problem solved> would not be legal
10:47rhickeyif ~< triggers a scan for > and a read of one item in between
10:48cemerickhugod: I suspect the association with vectors would be a negative there, although I like the @ being involved to indicate a single value.
10:48stuarthallowayrhickey: I was joking. I am still fine with {}
10:49_fogus_I was hoping we could reserve ~<blah> for the future inclusion of XML literals. :p
10:49cemerickrhickey: I was pondering <>. They don't really mean anything. () is obviously familiar, and {} is familiar to everyone who as used ${}.
10:49rhickeybut () does what it normally does, {} wouldn't
10:50rhickeyhas used ${} where?
10:50stuarthallowaypart of the reason that I like {} is that we are talking about contrib, not clojure. this is where we try things
10:50cemerick~() invokes the form inside, but there is an implied str call. The semantics are different inside the interpolated string, necessarily so.
10:50clojurebotYou don't have to tell me twice.
10:50cemerickoy
10:51rhickeystuarthalloway: we are a few decisions away from reader support for this
10:51cemerickrhickey: you need to announce things like that :-P
10:51stuarthallowayzoinks! cool
10:51cemerickrhickey: if we're going for reader support, then I'd like to put full-on heredocs on the table.
10:52AWizzArd~max people
10:52clojurebotmax people is 274
10:52rhickeycemerick: that's not a property of ~{}, it's a property of <<, which if it was called str<> or something would be more descriptive
10:52AWizzArdwow, again more :)
10:52npoektopis there a way to set a timeout for promise/deliver? I have a code with non-obvious using of these. I want to debug that code because it hangs sometimes
10:53AWizzArdnpoektop: look at http://java.sun.com/javase/6/docs/api/java/util/concurrent/ArrayBlockingQueue.html
10:53cemerickrhickey: I'd suggest ~@some-value, and if trailing whitespace is an issue, then one would need to do ~(identity some-value)blah
10:53rhickeycemerick: let's see if we can get this simpler thing right. Are we agreed that ~( is an escaped, and thus needs to be escaped somehow if not intended as such?
10:54rhickeyno one answered as to where ${} is standard
10:54AWizzArd"\~(is unescaped)"
10:54cemerickrhickey: shell scripting
10:54rhickeyugh
10:54cemerickyes, ugh, but incredibly common :-)
10:54AWizzArdrhickey: http://docs.codehaus.org/display/BOO/String+Interpolation also talks about ${}
10:54sexpbotString Interpolation - BOO - Codehaus
10:54_fogus_rhickey: Ant
10:54rhickeycemerick: yes and full of other stuff we'll never do
10:55npoektopAWizzArd, ok, thank you
10:55cemerickrhickey: doubling the ~s seems reasonable to me
10:55rhickeycemerick: one problem with that is when you are in the middle os some large thing, difficult to match pairs of ~s
10:55cemerickrhickey: of course, my standards for a library I wrote for me are a lot lower than your standards for the clojure reader :-)
10:56AWizzArdcemerick: "~(escaped)" and "~~(not escaped)"?
10:56cemerickrhickey: why do you need to match pairs?
10:56cemerickAWizzArd: yeah
10:56rhickeycemerick: so you can tell what's inside and what's outside
10:57rhickeya~b~c~d~e~f
10:57cemerickrhickey: yeah, I'm not following. Aren't we talking about "~(will-be-invoked)" vs "~~(will-not-be-invoked)"?
10:58rhickeysorry, no, I thoght we were taking about ~foo~ single thing
10:58cemerickoh, no
10:58rhickeydouble ~~ for unescape are fine
10:58cemerickI quite hate ~foo~
10:59rhickeyso, ~<foo> then ?
10:59stuarthallowayrhickey: +1 on cemerick's vote for full heredocs
10:59rhickeyaargh
10:59cemerickI actually suggested ~@foo for single values, and forcing a ~(identity foo) if you didn't have trailing whitespace.
10:59rhickeyheredocs being the make your own delimiter thing?
10:59cemerickrhickey: ^^
10:59cgrandwhy ~~ over \~ ?
11:00cemerickcgrand: it'd end up being \\~
11:00cgrandnot with reader support
11:00cemerickhrm, that's a point
11:00rhickeycgrand: agreed
11:00cemerickin that case, definitely \~
11:01rhickeycemerick: I think you'll find more cases requiring identity than you'd like
11:01rhickey2 of your 3 samples
11:02cgranddevil advocate: actually "\~" makes the reader throws an exception, so why not to reverse the role of \~ and ~. Hence no breaking change
11:02cemerickrhickey: yeah, I know. I'll live with ~<foo> if it comes down to that, but it's really unpleasant, visually. And takes up <>'s for simple value substitution.
11:02rhickeycemerick: how does it differ from {}?
11:03rhickeymore angly?
11:03cemerick{}'s are narrower, and less obtrusive than <>
11:03cemerick{a} vs <a>
11:04cemerickAnd really, there is a *lot* of currency in {} for value substitution, despite one's position on shell scripting. :-)
11:04rhickeywhat if ~[a] workd as well as ~[a b c], the latter being effectively (str a b c) ?
11:05rhickeycemerick: but it comes with $ too, no?
11:05cemerickrhickey: aren't we squashing vector syntax there, just like {} would have?
11:05ipostelnikis anyone using lein with IntelliJ's TeamCity?
11:05cemerickwell, we just use ~ instead of $. It's precarious, but just enough of a lineage.
11:05rhickeycemerick: but it is a vector of one or more things to be interpolated, vs {x} which is a broken map
11:06rhickeyand supporting ~[a b c] I think will prove quite useful
11:06cemerickI agree.
11:06cemerickrhickey: how about ~@foo, which stops glomming the symbol at whitespace, or an optional terminating @?
11:07rhickeyit's not a deref
11:07cemerickno, but as a value substitution, @ is a lot closer than {} or []
11:07rhickeyand ~@foo will actually work right now, no?
11:08rhickey~(deref foo)
11:08clojurebotfoo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/
11:08sexpbotExecution Timed Out!
11:08cemerickrhickey: not in a string, no :-)
11:09rhickeyI think ~() and ~[] are clean: ~(the-result-of-this call), ~[these things]
11:10cemerickand ~[1 2 3] yields "1 2 3" and not "[1 2 3]" or "(1 2 3)"?
11:10rhickey~[1 2 3] => 123
11:10clojurebotthe world <reply>what the world needs is more higher order functions
11:10rhickeylike str
11:11cemerickwhat would ~(interpolate \, (range 3)) return?
11:12rhickeywhat's interpolate?
11:12cgrandinterpose I guess
11:12cemerickyeah, sorry, interpose. Interpolation on the brain this morning I guess.
11:13rhickey"clojure.lang.LazySeq@1c8e20a"
11:14cemerickso I figured.
11:15@chouser"My name is ~|name|"
11:15rhickeyusing ~@(a call) for splicing would have precedent
11:15rhickeycould be given an interpretation for () and []
11:17cgrand~[1 2 3] vs ~@[1 2 3]
11:17clojurebotuse vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around
11:17rhickeyyou could also just use ~(foo) and say no-arg functions need to be written ~(identity (rand))
11:18cemerickouch
11:19rhickeycgrand: one include spaces, the other not?
11:20rhickeychouser: || have the matching problem
11:20rhickeya|b|c|d|e
11:20cgrandrhickey: and if I want commas instead of spaces?
11:20rhickeycgrand: use interpose
11:20cgrandok
11:21rhickeybigger issue for ~@(sequence-fn foo)
11:21rhickeymust choose space or not
11:22rhickeyshould be not I think
11:24@chouseroh, "My name is ~|"C~|"houser"|.... yikes I guess that is a problem.
11:24rhickeyI think ~[first " " last ", " title] is likely to be the most succinct thing ever
11:24bsteuberhow about just saying ~ reads the next token using the clojure reader? this would allow for "Name: ~name, ..." as well as ~() and ~[]
11:24rhickeyvs a bunch of separate escapes
11:24cgrandwhat about not special casing ~[]? if one symbol is not followed by a symbol terminator (whitespace + macro chars - #) then go with ~@[]
11:24bsteuberand even ~{} as soon as so. proposes a nice semantics for map
11:24bsteubermaps
11:25rhickeybsteuber: because the reader uses whitespace for termination
11:25rhickeycgrand: ?
11:25bsteuberrhickey: oh, so ()() is illegal clojure code?
11:26rhickeybsteuber: not what I said
11:26AWizzArd) is also a terminator
11:26bsteuberbut if whitespace, ), ] and } all are terminators we're fine, aren't we?
11:27rhickeybsteuber: no, since you can't read e.g. symbols or numbers without whitespace separation
11:27rhickeybegging the question as to whether you want whitespace in the string or not
11:28rhickeyand if so, how to get it
11:28cgrandrhickey: to simply say that in cases such as "My name is ~name." one has to write "My name is ~@[name]."
11:28rhickeycgrand: what is the prupose of @ there?
11:28rhickeypurpose
11:29rhickeyso people can print vectors as strings?
11:30bsteuberI'd say "Name: ~name ..." gives "Name: foo ...", so it includes the whitespace - use ~() or ~[] in the other case
11:30AWizzArdWill string interpolation be used for more than simple things? Typically I imagine people will just inline vars, no? Sometimes short code fragments.
11:31cgrandrhickey: the pupose of @ here is to not add a special case/meaning for ~[]
11:32rhickeycgrand: and will always have no spaces?
11:32bsteubercgrand: good Idea
11:32cgrandyes always, ~@ would be apply str
11:33rhickeythat makes the single item case more verbose than the original ~{x}
11:33cgrandby one char
11:33bsteuberso ~ := (str next-legal-clojure-token), ~@ := (apply str (seq next-token))
11:33bsteuberthat would be very logical
11:34AWizzArdWhy again not (println "Hello ~name")?
11:34rhickeybsteuber: ~ can't mean next token, as explained above
11:34AWizzArd~some-var-here
11:34clojurebotI don't understand.
11:34cemerickAWizzArd: what would (print "Hello ~name.") do?
11:35cgrandrhickey: are you planning to add support for interpolation in all strings? or interpolated-strings will get their own metachar?
11:35rhickeycgrand: I think you are saving ~[x] for nothing
11:36rhickeywould rarely be used, and can do with ~(identity [x])
11:36bsteuberrhickey: sorry, still didn't understand the terminate problem
11:36bsteuber/me feels stupid
11:37AWizzArdcemerick: (print (str "Hello " name))
11:37cemerickAWizzArd: and the period?
11:37rhickeybsteuber: see cemerick 's last ^^
11:37AWizzArdwhat period?
11:38bsteuber~name. would be "undefined behaviour", I guees (best would be an exception)
11:38clojurebotnamespaces 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
11:38cgrandrhickey: true, and I'm pondering giving [] more "special powers" (eg :sep to specify separator)
11:38bsteuberor maybe not
11:38rhickeyjeez clojurebot
11:38bsteuberif name. is a legal class
11:39rhickey~@,[a b c] => 1,2,3
11:39clojurebotwhose job is<reply>that is ts00000s job
11:40rhickeywould work for ~@,(seq-fn ...) too
11:40cemerickrhickey: that is getting into scary FORMAT territory, it seems
11:40cgrandbut only for one char separator, I like a space after my comma
11:40rhickeycgrand: why only one? ~@, [a b c]
11:41cemerickrhickey: oh, no, please no. :-(
11:41rhickeythe reader could do that
11:41cgrandending at the [?
11:41rhickeycgrand: [ or (
11:42AWizzArdshould not the most common usecase be priority?
11:43rhickey#~"string with interpolation" ?
11:43_fogus_rhickey: the best I've seen
11:44bsteuberyeah, #~ might be okay
11:44AWizzArdokay, and then inside?
11:44cgrandwell, after ~ or ~@ I expect to read clojure code, so I tend to read ", " in "~@, [a b c]" as whitespace
11:45rhickey~@|, |{a b c]
11:45clojurebotAlles klar
11:46rhickeymore generally, ~@|sep|[a b c]
11:46cemerickThis is an unfriendly rabbit hole.
11:46rhickeycemerick: how so?
11:47cgrandrhickey: if you are going this route why not ~@", "[a b c] (but I don't like this ~@somthing[foo]
11:47cemerickLots of complexity is growing up to support relatively little functionality.
11:47AntonyBlakeyA problem with using a simple interpose as syntax is that it has limited use - more often one would want the CL format style of 1, 2, and 3 i.e. it's not useful gramatically without getting a lot more complicated
11:47rhickeyit's an interpolation system. using unquote semantics, which include splicing. Ordinary splicing produces lists of independent items, str splicing needs to be told how to join
11:47cemerick99.5% of people want string *interpolation*, not a weak templating language with obtuse syntax.
11:47AWizzArd(println #~"Hello ~name$, 1+1 = ~(+ 1 1)$")
11:48rhickeycgrand: did you notice vertical bars always?
11:48rhickeyseeing the "s might look like end-of-string
11:49AWizzArdyes
11:49AWizzArdso that #~"abc~x$def" is possible, even wher (def x "10") and (def xdef "20")
11:49cemerickrhickey: The full boat of unquote semantics is undesirable here, because the end result (a string) has a much, much larger domain than forms that one can emit from macros.
11:50cemerickThis is the direction of FORMAT, which I simply never want to bother with.
11:51AWizzArdmaybe then a most simple interpolation that just allows putting clojure vars into the string is fine?
11:51AWizzArdThat would cover, say, 95% of all cases?
11:51AWizzArdfor the rest there is str and format
11:51rhickeycemerick: then you can use ~[first] ~[last] when everyone else is doing ~[first last]
11:52rhickeycemerick: it's not a big oat of semantics, just splicing
11:52cemerickrhickey: people won't just be doing ~[first last], they'll be doing ~@|blah|(some-call foo)
11:52rhickeynot an oat nor a boat :)
11:53cemerickrhickey: it's the nose under the tent. Next up with be st,nd,rd,th support, pluralization based on the prior interpolated value being > 1, etc etc.
11:53rhickeycemerick: and you'd rather they do ~(apply str (interpolate blah (some-call foo)))
11:54rhickeycemerick: I disagree, this is following syntax-quote, not format
11:55rhickeysyntax-quote being *the* template model
11:55cemerickrhickey: for complex values and such, I'd rather people set bindings for various components, and then drop them into an interpolated string that encapsulates the context where the components of the final string are emitted.
11:55bsteuberso which example would break this naive approach?
11:55bsteuber,(let [s "Name: ~name"] (read-string (subs s (inc (.indexOf s "~")))))
11:55clojurebotname
11:55AWizzArd(println #~"Good morning [first-name] [last-name], todays date: [(date)]")
11:55rhickeybsteuber: please give up that line, thanks
11:55AWizzArdor {} instead of []
11:56cemerickrhickey: as soon as you add custom delimiters, you're into format.
11:56rhickeycemerick: nah
11:56bsteuberrhickey: okay, sorry for getting on your nerves
11:56AWizzArdI think rhickeys idea with #~"" is helpful.
11:57rhickeycemerick: I find interpolated strings with successive ${this}${that}${the-other} quite ugly
11:58Licensergreetings my lispy friends
11:58cemerickrhickey: hrm, but ~@|blah|(some-call foo) is pretty? 0.0
11:58rhickeyand would greatly prefer ~[this that the-other]
11:58cemerickrhickey: I've no problem with that at all.
11:59rhickeycemerick: the most common cases, space or not, wouldn't require ||
11:59rhickeybut saying blah is unfair, as that is never the delimiter
11:59cemerickok: ~@,(some-call foo)
11:59rhickeyand would greatly prefer ~@|,|[this that the-other]
11:59AWizzArdso, what about #~ indicating S.I., and using {some-var} to print some-var, using {(+ 1 2)} to print 3 and ${(vector 10 20 30)} to print 10 20 30
12:00hiredman:(
12:00cemerickrhickey: again, I'd much rather see people let (apply str (interpose \, [this that other])), and drop it into the interpolated string.
12:00Chousukewhat's the problem with implementing this as a macro?
12:01cemerickChousuke: I already did, inclusion in the reader is on the table
12:01rhickeycemerick: then you don't need string interpolation, only str.
12:02cemerickrhickey: interpolation is dropping values into strings for UI purposes, mostly, not generating strings.
12:02cemerickin that context, str is far too verbose, and simple value substitution or fn invocation is totally sufficient
12:02ChousukeI guess as a reader macro it could be somewhat neater if you do things like "bar ~(foo "someotherstring")"
12:03Chousukebut that will confuse emacs greatly ;P
12:03AWizzArdpeople won’t use it for that purpose
12:03AWizzArdnothing with another pair of double quotes
12:03rhickey(str "My name is:" name) vs (<< "My name is:~{name}") - I don't see the big win
12:03AWizzArdonly for simple things, otherwise everyone will use str or format
12:03cemerickrhickey: e.g. (<< "The total due of ~{total} is due on ~{due-date}.")
12:04AWizzArd(println #~"My name is: {name}")
12:04cemerickor, (<< "total due of ~(total-due customer-id) is due on ~(this-months-due-date)"), etc
12:05AWizzArdwhy do we need ~ when #~"" already tells Clojure that we have an interpolated string here?
12:05rhickey(str "The total due of " total " is due on " due-date ".") looks good in my editor, which highlights the string and non-string bits
12:06Licensermany langauges use ' vs " so we kind of don't have this option since ' is already used
12:06Licenserhow about `interpreted string`
12:06AWizzArd#~"The total due of {total} is due on {due-date}."
12:06rhickeyAWizzArd: please stop this speculation without thinking it through, thanks
12:06AntonyBlakeyLicenser: ` isn't available
12:06Licenser´?
12:07rhickeycemerick: I guess I don't get what you mean by UI above
12:07Licenserbut yea it looks too much like ` I guess
12:07dnolenrhickey: sure, i think the argument is that you may have these strings to be interpolated stored somewhere common (not in inline with the rest of the code). Perhaps easily editable by people in control of copy. Would be useful in the context of internationalization as well, no?
12:08rhickeydnolen: but being a macro, enacting the substitution programatically is substantially less than a true dynamic string template
12:09cemerickrhickey: constantly having to pound away at quotes to keep the strings happy gets *very* irritating, which is why str isn't sufficient.
12:09rhickeycemerick: you just trade {s for "s
12:09cemerickrhickey: by "UI", I mean that interpolation is almost always used in connection with generating messages for display in user interfaces.
12:09rhickeycemerick: same delimiter count
12:10cemerickrhickey: no, because I can rewrite the base message without bothering with quotes at all.
12:10LicenserI wrote a simpe code that replaced sexp's expressions in strings with the result of the evaluateion, might that help?
12:11cemerickLicenser: like this? ;-) http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure
12:11cemerickrhickey: I mean, technically you're right about delimiters, functional equivalence, etc. But in practice, pushing around separate strings ends up being a hassle.
12:11rhickeycemerick: I don't get it - at the boundary of a substituted item you need a start and end delimiter. Once they are in place you can freely change what's between them. Its either " ... { ... } ... " or " ..." ... "...", 4 in each case
12:12Licensercemerick: somewhat just more verbose and propably slower :P
12:12rhickeywithout editor highlighting support, the interpolated ones will be much harder to scan
12:12rhickeyplus str is a function, a huge benefit
12:12AWizzArdhmm yes
12:14cgrandhmm, fun fact: "\(" and "\[" are not valid strings so "Name: \[name], Tags: \(interpose ", " tags)" can be an interpolated string :-)
12:14LicenserI think what cemerick is thinking about is that it is easyer to explain a translation monkey change "My name is ~{name}." to "Ich heisse ~{name}." then chaning (str "My name is " name ".") to (str "Ich heisse " name ".")
12:14cemerickgood point Licenser, I hadn't mentioned l18n yet :-)
12:16rhickeycemerick: so, let's talk. You've got your strings in a translatable file, how are you going to turn them into macro calls?
12:16cgrandcemerick: about i18n: if the reader expands interpolated strings to (str ...) you can't easily externalize them in for example a .properties file or even a separate clojure file
12:17cemerickheh
12:17rhickeytechnomancy: format also a function, ditto pprint
12:17cemerickcgrand: yes, it'd be a compile-time (or macro-expansion-time) selection of a language, for example
12:18cemericke.g. (<< (find-l18n-msg "customer-total-due")), etc
12:18cemerickrhickey: ^^
12:18cemerickthat's not nice in a lot of ways, but all l18n strategies have roughly the same approach.
12:18sattvikWell, if i18n is the goal, keep in mind that simple interpolation doesn't always work. Will interpolation be locale-aware, and what about languages that require values in different orders? You check out the javadoc for MessageFormat to see what kind of flexibility is needed.
12:19cemericksattvik: it's not my goal necessarily, I've not worked on l18n or i18n at all in this context.
12:19rhickeycemerick: where find-l18n-msg is itself a macro? so << does internal macroexpansion?
12:19rhickeyyou don't really want <<, you want something like format for this
12:19cemerickrhickey: a couple of interpolation examples: http://paste.lisp.org/display/97726; the << versions are easier to read, and the first is far easier to edit into the second
12:19Licenserwhy not make << a function?
12:20AWizzArdLicenser: << is already used for Cells.
12:20cemerickrhickey: that was pseudocode, nothing I've implemented yet.
12:20LicenserAWizzArd: or whatever it is called
12:20rhickeycemerick: maybe in that uncolored paste-bin. but not in aquamacs
12:21rhickeynot only better highlighted, but matching etc is in play
12:21cemerickrhickey: and in my colored enclojure :-)
12:21cemericktons of spurious double-quotes are very distracting
12:21LicenserI think whatever does string 'evaluate' (I dare co all it that way) should not be a macro but a function
12:22Licenserif speed is an issue you can wrap it in a memorizer
12:22rhickeycemerick: that's just arbitrary, what about spurious {}s ? what about delimiter matching?
12:22cgrandcemerick: str is easier to read than << if you have syntax highlighting https://gist.github.com/833d196c298614d53492
12:22cemerickrhickey: I wouldn't doubt it if you didn't find string interpolation useful, but I think it's safe to say you're in the minority on that one. :-)
12:22rhickeycgrand: thaks
12:22rhickeythanks
12:23Licensercgrand: if interpreted strings are a language feature they can be highlighted just as well :P
12:23cgrandof course tools can learn to colorier interpolated strings too
12:23Licenserruby's evaluated strings are highlighted just fine
12:24cgrands/colorier/colorize/
12:24LicenserI guess the argument against evaluated strings is that clojure, as a lisp should have minimal syntax?
12:25hiredmanmore syntax to hilight :(
12:25cemerickrhickey: I actually think the colorization of str forms detracts from the readability. The message itself is what's important there, not the values being interpolated.
12:25rhickeycemerick: and all the ~{} isn't in the way of the message?
12:25rhickeythis is just arbitrary
12:25jfieldsI miss string interpolation also, but I think it's an aesthetic issue, not a logic one.
12:26jfieldswhile I prefer working with ruby's string interpolation, Rich's logic is sound.
12:26cemerickrhickey: comparatively, no. Again, I'm not going to say it's more efficient or functional than str.
12:26cemerickjfields: +1
12:26cgrandLicenser: I agree but then if they are both properly highlighted what is the advantage of one over the other? it's just aesthetics/habits
12:27LicenserI personally would go for a c.c or c.l function that does the stuff
12:27Licenserno language interna
12:27rhickeycgrand: also editor support of brace matching etc, will that work inside a string (even if highlighting works)?
12:27Licensercgrand: yap it is just estetics
12:27bsteubermy general impression of this discussion is that anyone would do it differently, so IMO reader support shouldn't be done before some macro-level library is really widely used and the desired syntax clear
12:27jfieldswhen I write "hello #{name}" I can easily parse that and I know that the spaces are where I expect, when I write a (str ..) I often forget to put the extra spaces in the strings
12:28jfieldsthat said, I think it's really just a matter of getting used to what clojure provides you. I'm a fan of logic, and I see no need to make editors be smarter for highlighting.
12:29@chouser,(let [x 5 y 2] (str "The average of "x" and "y" is "(/ (+ x y) 1)))
12:29clojurebot"The average of 5 and 2 is 7"
12:29cgrandrhickey: I agree, as proposed it's a lot of added complexity to the reader and all the tools
12:29cemerickjfields: eh, I think the history of evaluated/interpolated strings and heredocs point to there being a substantive difference in productivity with them vs. simple concatenation, even if I can't adequately describe it here.
12:29FossiChousalmost
12:29Fossichouser: almost
12:29bsteuberchouser: nice, the missing spaces really improve readability
12:29AWizzArdI don’t see a big difference in productivity.
12:29rhickeycemerick: vs something like str? Is that widely available?
12:30Licenserabout str I don't like the ugy "." in the end :P
12:30@chouserIntersting, but the quotes end up feeling backwards of course.
12:30cgrandchouser: only in b&w
12:30@chousercgrand: hm.
12:30cemerickrhickey: what's the special aspect of str vs. concatenation elsewhere?
12:30Licenser(let [str. (fn [& args] (str (apply str args) ".")) x 5 y 2] (str. "The average of "x" and "y" is "(/ (+ x y) 1)))
12:31Licenser,(let [str. (fn [& args] (str (apply str args) ".")) x 5 y 2] (str. "The average of "x" and "y" is "(/ (+ x y) 1)))
12:31clojurebotjava.lang.IllegalArgumentException: Unable to resolve classname: str
12:31Licenserheh not workling too sad
12:31rhickeycemerick: it calls str on its args
12:31cgrandchouser: http://paste.lisp.org/display/97726; vs https://gist.github.com/833d196c298614d53492 in b&w I prefer ~{}, in color str
12:32LicenserI think str and << put different priority
12:32Licenserstr makes the variables stand out, << make the message as a whole the focus
12:33@chouserIt's a tough question. I have loved string interpolation in perl and ruby, and feel like I've missed it some in Clojure, but it's not clear what the technical differences are that cause the difference in feeling.
12:33bsteuberso it turned out clojure already has string interpolation, just with the syntax "" XD
12:34RaynesWhat is the difference between this: (re-find #"(?=.*bot(?!botters))^(\\w+)" "pircusername/botters/") and this: (re-find (re-pattern "(?=.*bot(?!botters))^(\\w+)") "blahcuser/botters/")?
12:34@chouserI may have missed more the lack of string literals that can support unescaped double-quotes. But that's a different issue.
12:34RaynesOne of them matches, and the other doesnt, but it's the same regex.
12:34Licenserchouser: I think it's a question of philosophy, perl and ruby strongly work with complex and suffisticated language/syntax features. Clojure works with minimal language/syntax features
12:34Licenserbut I know your feeling
12:34@chouserRaynes: it's *not* the same regex. #"" has different escaping rules than ""
12:35sattvikI have to agree with Licenser. While I appreciate some people would really like string interpolation, it screams Perl/shell-scripting to me. It's fine as an optional library, like contrib, but I would rather not create a reader macro out of it. It's just not Lispy. Whenever I have a complicated string to build, I just use format.
12:35@chouser,(re-pattern "(?=.*bot(?!botters))^(\\w+)")
12:35clojurebot#"(?=.*bot(?!botters))^(\w+)"
12:35rhickeyevery time we discuss string interpolation I end up in the same place, unconvinced of its superiority over true functions like str, format, and pprint
12:35@chousernote that output has (\w+)
12:35Licenserthat sayed I'd love a good lbirary :P
12:36Licenserrhickey: string interpolation can be a true function?
12:36cemerickrhickey: it's decidedly *not* superior :-) Just makes working with the common cases a little easier for many.
12:36cemerickThat's why I never agitated for it to be in the reader. ;-)
12:36@chouserIt's clear that a lot of people think they want it. :-)
12:37cemerickor, never agitated very strongly :-P
12:37rhickeychouser: yes, and I'm not trying to negate people's feelings, just understand them
12:37jfieldsrhickey: have you ever worked at length with a language that has interpolation?
12:38@chouserI wonder how much of it is the feeling of "nesting in" rather than "escaping out"
12:38cemerickpython interpolation was a nice balance in particular, which would make a nice sister macro to <<
12:38cgrandmaybe we should try to find how to add more value to interpolated strings to justify them
12:38rhickeyjfields: no, but I can't imagine ever preferring it much over format
12:38jfieldsmuch like stack-traces, you get to a point where when reading them you don't even see the interpolation. I think that's what people miss. and without the special syntax, it's hard to parse what's important and what's ignorable
12:38cgrand eg to make them callables (#~"Name: ~%1" name) and/or (#~"Name: ~name" :name name)
12:39rhickeypeople that prefer interpolation over format just want to avoid passing the data as arguments?
12:39@chouserI'm producing a single string, so I want a single pair of quotes, and want to *insert* values, not a bunch of strings stitched together. ..even if the end result is the same.
12:40rhickeychouser: so, format does that
12:40cgrandrhickey: true, I focused on i18n
12:40@chouserof course the biggest weakness of format is the positional natured.
12:40jfieldsrhickey: yes, because it's easier to type "my name is jay and i work for company-x"
12:40cemerickright, it's the combination of insertion within a lexical context
12:40@chouserformat doesn't support a map instead of seq, does it?
12:40jfieldsrhickey: vs "my name is name and I work for company-x", name, company-x
12:40rhickeychouser: no
12:40jfieldsand when you get used to interpolation you see it like what I typed, and you type it without thinking
12:41rhickeyjfields: but no real, translatable program could be written that way, could it?
12:41jfieldsI'm actually not advocating at all
12:41@chouserof course the python named format is bad. "My name is %(name)s"
12:41jfieldsI prefer your attitude to purity, I'm just providing my point of view on it.
12:41@chouserthat trailing "s" is a source of much trouble
12:41rhickeyfair enough
12:42rhickeymost large real programs end up with all their strings in a database, no?
12:42Licenserhmm I think the main issue is that we have not yet found a solution that solves 'all' issues
12:42jfieldsrhickey: definitely no
12:42jfieldsrhickey: I've been database free for 2 years. life is so much better
12:43Licenserinterpreted strings should be A) simple B) readable c) work as/with pure functions d) fast of cause e) universal. Did I forgot anything?
12:43rhickeyjfields: no international clients? No UI staff?
12:43jfieldsrhickey: correct.
12:43rhickeyjust coders for english clients
12:44rhickeyso, when they want your app in a foreign lang you're screwed?
12:44jfieldsrhickey: and few needs for messages, so I might not be the common case, but I wouldn't call what we do anything less than "real"
12:44rhickeyjfields: sorry, "real" was a bad choice
12:45djpowellthis seems awfully complicated, i'm fine with str btw, or format for more complicated stuff
12:45sattvik,(format "My name is %2$s. And I work for %1$s." "company-x" "Jay")
12:45clojurebot"My name is Jay. And I work for company-x."
12:46@chousersattvik: well. Thanks for digging up that little detail. but ... ew. :-)
12:46rhickeysattvik: way to sell it! :)
12:46djpowell,case
12:46clojurebotjava.lang.Exception: Can't take value of a macro: #'clojure.contrib.fcase/case
12:47jfieldsrhickey: we use loads of Clojure. we have a few 3rd party simulators, some of our debugging tools, compliance logs, configuration, etc etc
12:47jfieldsmost of those needs have maybe 2 dozen strings in them for messages, and never need to handle other languages
12:47sattvikchouser: Well.. It's not perfect. But it just shows that it has some flexibility.
12:48rhickeyok, so, let's say the people who want interpolation aren't wrong, but it's not ready for reader support. What can we do in a macro that's reader support compatible? I really like ~() and ~[], and think ~@ is interesting and a logical extension
12:48rhickeyI don't like <<
12:49@chouser~[] is for uncalled symbol?
12:49clojurebothttp://clojure.org/data_structures#toc10
12:49rhickeychouser: ~[1 2 3] => 123
12:49rhickeyor, 1 2 3
12:49@chouseroh! hm.
12:49rhickeyso also, ~[foo]
12:50@chouseryeah, I think I like that.
12:51rhickeyspace question begs ~@
12:51@chouserI see.
12:51rhickeycould work on [] and ~@(calls-returning-seqs)
12:52rhickeyfinally (and distressing cemerick ), ~@|,|[1 2 3] => "1,2,3"
12:52cemerickrhickey: yeah, you're never going to get me on board with that :-P
12:52rhickeycemerick: and ~@?
12:52cemerickthat's just out of scope for anything anyone would call string interpolation
12:53rhickey~@(range 3) == ?
12:53clojurebotTitim gan éirí ort.
12:53cemerickrhickey: ~@[1 2 3] => "123"?
12:53sattvikIf you want really flexible but really ugly, there are things like:
12:53sattvik,(java.text.MessageFormat/format "At {1,time} on {1,date}, there was {2} on planet {0,number,integer}." (to-array [7 (java.util.Date.) "a disturbance in the Force"]))
12:53clojurebot"At 9:54:19 AM on Apr 13, 2010, there was a disturbance in the Force on planet 7."
12:53@chouserI assume ~@, [1 2 3] has already been rejected for "1, 2, 3"
12:53rhickeychouser: cgrand wanted comma+space
12:53rhickeyI first said that
12:53cemerickchouser: yeah, you'd ostensibly be looking at ~@|, |[1 2 3]
12:54a_strange_guyso a single char doesn't need | ?
12:55cemerickrhickey: if my last msg @ you is true, then sure, I'm fine with ~@
12:55rhickeycemerick: I think so, depends on the existence of ~@|sep|
12:55@chouservs ~(str-join ", " [1 2 3])
12:55a_strange_guyeg: ~@;[1 2 3] = "1,2,3"
12:55a_strange_guysry ~@;[1 2 3] = "1;2;3"
12:55Licenserhow about a general approach: (stringythingy <function> "<string with some kind of 'placeholder' that gets passed to function>")
12:56cgrandwhat about having reader support that reads "My name is ~[name] and I work for ~[company]" as '["My name is " name " and I work for " company] and let a user macro (or fn since "hello ~[:foo]" would expand to ["hello " :foo]) gives the semantics?
12:56Licenserthen you could call (stringythingy eval "1 + 1 = #{(+ 1 1)}'"
12:56Licenseror (stringythingy html-highlight "I can highlight code: #{(+ 1 1)}'")
12:58@chouserFWIW, I continue to care more about the lack of string literals that can support unquoted double-quotes than reader support for any kind of interpolation.
12:59@chouserthe fact is, cemerick's macro or one like it works pretty well with today's clojure
12:59rhickeycgrand: that's interesting
12:59sattvikcgrand: If string interpolation ever gets reader support, I hope it doesn't get added to all strings. There is a reason why languages like perl differentiate between single and double quotes. I would hate for string interpolation to break existing programs.
13:00rhickeychouser: we could go with cemerick's thing, using ~[] instead of ~{}, punt on multiple items in ~[] and ~@, with a different name
13:00cgrandsattvik: I forgot to prefix with #~
13:00sattvikcgrand: Ah, ok. No problem.
13:01cgrandrhickey: (def << (partial apply str)) would then work
13:02rhickeycgrand: but not <<
13:02cgrandthe name?
13:02cemerick<~ was the alternative I was knocking around earlier
13:02rhickeycould also do \() and \[] in ordinary strings, as not currently readable
13:04rhickey"My name is \[name] and I work for \(company-of name)"
13:05cgrandlpetit is going to be mad once he's back from vacation :-)
13:05cemerickrhickey: that'd be in the reader, on all strings?
13:05rhickeycgrand: but as a reader thing, yields what? splices in multiple forms?
13:05rhickeythat can get very tricky
13:06rhickeycemerick: could be
13:06cgrandrhickey: currently I can't decide when to splice or not
13:06cemerickrhickey: your life gets a lot easier if you assume you're working with strings, period.
13:06defni really like that... the "\[name] \(company-of name)", stuff from above
13:06rhickeyare there multiple valid consumer fns for this?
13:06cemerickthat's what people actually do, after all.
13:11rhickeycemerick: meaning you don't want the vector?
13:12cemerickrhickey: Having the vector is fine, supporting more than one splicing approach leads to painful syntax and is a solution looking for a problem IMO.
13:12rhickeycemerick: what do you mean more than one splicing approach?
13:13cemerickthe ~@|sep| stuff
13:13rhickeysomething other than apply str?
13:13cemerickyes
13:13rhickeycemerick: well, using \ doesn't imply @
13:13rhickeythe way ~ does
13:14cemerickOK, so ~[] is always just (apply str ...)?
13:14rhickeycemerick: just str
13:14cemerickhrm, the vector syntax is throwing me now. So ~[1 2 3] => (str 1 2 3)?
13:15@chouserhuh
13:16@chouserwell, the point is that single-value inserts are the most common case, right? so "~[name]" is "Chouser"
13:17rhickeyI'm not sure how much you would put off on the latter handler. This could just do string splitting
13:18cemerickI wouldn't mind that. ~@name is still appealing to me, but whatever.
13:18rhickey"a b \[1 2 3] \(four five) six" => ["a b " [1 2 3] " " (four five) " six"]
13:19@chouserI don't think I like something that looks like "..." returning a vector
13:20@chouseris it too weird to have "foo \[1]" expand to (interpolate "foo" 1) ?
13:20rhickey"a b \[1 2 3] \(four five) six" => ["a b " (str 1 2 3) " " (str (four five)) " six"]
13:20@chousermaybe with "interpolate" being unqualified so that you can exclude core's and provide your own?? :-/
13:20cgrandrhickey: and then format could benefit from this reader support
13:21rhickeychouser: ick
13:21@chouseryeah, ok, I'm sorry. withdrawn.
13:21cemerickchouser: I was going to suggest a var available for binding to define an interpolate separator
13:22rhickeycgrand: not sure I see how format benefits
13:22cgrandwhy ["a b " (str 1 2 3) " " (str (four five)) " six"] rather ["a b " 1 2 3 " " (four five) " six"]?
13:22rhickeycgrand: could be, I'm just enumerating the possibilities
13:23rhickeyeither works with apply str
13:23rhickeyif [1 2 3] flows though, as in the first example, I think that's a burden for downstream
13:24rhickey"a b \[1 2 3] \(four five) six" => ["a b " [1 2 3] " " (four five) " six"]
13:24cgrand(format++ "Date: \[a-date :fmt "YYYY-MM-dd"]") or (format++ "count: \[i :pad 4]")
13:25rhickeycgrand: that would want to see the vectors intact, no?
13:26@chousercgrand: Those are interesting -- good argument for the reader staying out of the way (not wrapping in (str ...))
13:26cgrandrhickey: yes, your latest expansion ["a b " [1 2 3] " " (four five) " six"] is the sanest
13:26rhickeycgrand: but means the simple case will have to ferret out vectors
13:27rhickeyno longer apply str
13:27cgrandyep interpolate is no longer a 1-liner
13:27@chouserthese will always alternate: string something string something ...
13:28cgrandchouser: it depends, how do you expand "\[foo]\[bar]": with an empty string in between or not?
13:28rhickeychouser: alernate, but not beginning/ending with either in particular
13:29@chouserI would strongly argue for consistency here. always start with a string, always alternate.
13:29rhickeycgrand: TRUE, SO NOT
13:29@chouserwhoa
13:29rhickeycgrand: sorry, caps lock
13:29@chouser"\[foo]\[bar]" => ["" foo "" bar]
13:29@chouserthat was scary
13:29@chouser:-)
13:30rhickeychouser: always end with a string too?
13:31@chouserHm, perhaps. The point being (map (fn [[string other]] ...) (partiion 2 ...))) is stable
13:32@chouserthat actually argues for a trailing [... "" nil], but anyway...
13:33@chouserhm... that's more of a general gut feeling. The specific cases I'm coming up with mostly don't apply.
13:35@chouserIs "\["foo"]" legal?
13:36@chouserAnd "\(str "foo")"?
13:37cgrandI would say yes
13:41funkenblatt~botsnack
13:41clojurebotthanks; that was delicious. (nom nom nom)
13:41RaynesNobody ever gives my bot a snake. :(
13:42Raynes$botsnack
13:42sexpbotRaynes: Thanks! Om nom nom!!
13:42funkenblattit's the dollar sign... i can't spare too many of those
13:42RaynesFair enough.
13:42cgrand,"$botsnack"
13:42clojurebot"$botsnack"
13:42RaynesFail.
13:43Raynes:p
13:43cgrand,'$botsnack
13:43clojurebot$botsnack
13:43sexpbotclojurebot: Thanks! Om nom nom!!
13:43clojurebotHello, ukstudio_
13:43RaynesYou could do that the other way around as well. Let's not test that out.
13:45cgrandwell, it may be better if bots ignore each other before someone makes them play pingpong...
13:45RaynesI'm not sure it would be possible to make them loop infinitely.
13:46RaynesMaybe once or twice as you demonstrated.
13:46@chouserit would be a sort of quine, wouldn't it?
13:46RaynesIt would have to be.
13:47cgrand$(println ",(+ 2 2)")
13:47sexpbot,(+ 2 2)
13:47clojurebot4
13:47cgrandyes a kind of quine
13:47nteonhaha
13:47RaynesI mean, I can make sexpbot ignore clojurebot if it became a real problem.
13:47a_strange_guy$(symbol "~botsnack")
13:47sexpbot~botsnack
13:47clojurebotthanks; that was delicious. (nom nom nom)
13:48RaynesI need to add per-user blacklisting anyway.
13:49Raynescgrand: Clever.
13:51RaynesSexpbot already ignores people with bot in their username, nick, or host with the title scraper. That way it doesn't scrape titles from URLs that bots link.
13:51RaynesIt's effective most of the time anyway.
13:51rhickeyso it might be good to set the expectation of \[item :opt-a 1 :opt-b 42], for all translators
13:54cgrandrhickey: ?
13:55rhickeycgrand: it would be weird for some translators to splice in [a :b c] as a :b c while others treat it as one item (a) with option :b set to c
13:56@chousersimplest translator would take 0th item of each literal vector rather than (str ~@v)
13:56rhickeychouser: right
13:56rhickeyignores options
13:57rhickeyI'm on the fence, as I had some succint use of ~[] as splicing op before, but I'm not the target market
13:58rhickeyalthough fogus liked something, I'm not sure what
13:58@chouserinteresting that ~[] is the general case. ~[(compute foo)]
13:58rhickeyyes
13:59@chouserif you want undelimited splicing, ~(str a b c) isn't too bad
13:59rhickeyright, but ~(vector a b c) undifferentiated :(
14:00@chouserhm? ~[[a b c]] ?
14:00cgrandI prefer (take-while (complement keyword?) v) to (nth v 0)
14:00rhickeynot again
14:00cgrand"\[a b c d :sep \,]"
14:01Raynescgrand: sexpbot should ignore clojurebot now.
14:01rhickeycgrand: ah, somewhat tricky
14:02@chouser$'$botsnack
14:02sexpbotCommand not found. No entiendo lo que estás diciendo.
14:02@chouser$(prn '$botsnack)
14:02sexpbotDENIED!
14:02funkenblattheh
14:02rhickeyI think we're in a weird area here, since all these things will be evaluated
14:02@chouser$(println "$botsnack")
14:02sexpbot$botsnack
14:03rhickeye.g. what if b is a keyword?
14:03@chouserrhickey: only evaluated if the interpolator is a fn not a macro
14:03RaynesI imagine prn isn't whitelisted. Whatever isn't in the core api docs probably isn't whitelisted.
14:03rhickeybbl
14:04cemerickI feel badly about interpolation becoming the topic of the day. :-/
14:05danlarkin"now you have two problems"
14:05cgrandI don't think it's not worth setting expectations for translators: we doesn't have that kind of things for syntax-quote or plain literals
14:09cemerickinteresting that clojure has 1.2.0-master-SNAPSHOT, whereas contrib has only 1.2.0-SNAPSHOT
14:10cemerickstuarthalloway: are you connected at all with the builds of contrib, or shall I talk to Mr. Sierra about that?
14:11@chousercemerick: sierra mentioned recently that not using "-master" for contrib was his responsibility, but that he was hesitent to change it again. Or something like that.
14:11kylesmithI just downloaded the latest clojure-contrib. Did duck-streams get renamed?
14:11cemerickkylesmith: c.c.io
14:12cemerickchouser: I think the branch naming convention was an odd thing to do, and probably due to a mostly-one-off event (new/master)
14:12cemerickor, I don't know of any other project that does that.
14:12@chouserwell, that one was my fault. seemed like a good idea at the time.
14:13danlarkinthe branch names in the identifier was so there could be multiple simultaneous builds of clojure on build.clojure.org
14:14cemerickdanlarkin: Yeah, I understand the motivation, but insofar as people use those names as dependency coordinates, it leads to very strange effects.
14:14danlarkinand iirc stuart took the branch name out of the contrib identifier because he couldn't figure out how to get it in
14:15danlarkincemerick: agree, it's still not perfect
14:15cemerickanyway: does anyone know why only the latest snapshot is available for contrib?
14:16cemerickour nexus will cache it anyway, but it seems odd that they're not being retained like they are for clojure.
14:16danlarkinI wonder if it's just a setting in hudson, I can check it out
14:17technomancycemerick: Max # of builds to keep: 9 in hudson
14:17technomancyso that's weird
14:17cemericktechnomancy: OK -- that doesn't seem to correspond with contrib or clojure's snapshots tho
14:18cemerickhttp://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/ & http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/
14:18sexpbotIndex of /snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/
14:18danlarkinsexpbot: shut up
14:19technomancycemerick: perhaps because it's not expanding SNAPSHOT into a date
14:20cemerickhrm, maybe. the metadata looks OK tho
14:21Raynesdanlarkin: The only reason I've not disabled that is because a few people have said it would be useful. If anybody finds it disrupting, I'll happily turn it off.
14:21stuarthallowaycemerick: talk to Sierra
14:26esj /me is a fan of sexpbot
14:28sexpbotesj: And sexpbot is a fan of you.
14:29naeuhi there, does anyone know of any reported errors with Section 2.6.2 of #joyofclojure?
14:29naeuI can't get the example to work
14:30naeuto be more descriptive, I don't see any errors at the repl and I don't see any pretty rectangles either
14:31Rayneschouser: Teh ping.
14:41naeuperhaps I'm not doing something quite right, or there's something wrong with my setup, but from what I can understand of the #joyofclojure, the following line should pop up a window containing a coloured rectangle: (let [f (java.awt.Frame.) _ (.setVisible f true) gfx (.getGraphics f)] (.fillRect gfx 100 100 50 75))
14:42naeuRaynes: can you see if it works for you?
14:42RaynesSure. Hold on.
14:42RaynesIt just gave me a itty bitty tiny little frame that has nothing in it.
14:43naeusame here
14:43naeuboo
14:43naeuwhat system do you run?
14:43RaynesUbuntu Hardy.
14:43naeuok
14:43Raynes(I know, I know. Ancient)
14:43Raynes;)
14:43naeu:-)
14:43naeustill, it's different to mine and we see the same results
14:44LauJensenEvening all
14:44RaynesLauJensen: Evening, sir.
14:44naeuLauJensen: evening there
14:44naeuLauJensen: can you see anything obviously wrong with this: (let [f (java.awt.Frame.) _ (.setVisible f true) gfx (.getGraphics f)] (.fillRect gfx 100 100 50 75))
14:44naeumy current assumption is that there's something wrong with the way I'm using the Frame API
14:46wlangstrothsunny afternoon, here. watching the most awesome Clojure presentation ever (stu halloway's): http://vimeo.com/10896148
14:46sexpbotClojure - Stuart Halloway on Vimeo
14:46LauJensennaeu: What would you like it to do ?
14:47RaynesNice sunny afternoon here as well.
14:47naeuLauJensen: this is a distilled snippet from the #joyofclojure. I'd just like to draw a box on the screen :-)
14:47LauJensenIt does so here
14:47naeuLauJensen: what are you running?
14:47LauJensenUbuntu
14:47naeuHardy?
14:47RaynesLauJensen: A tiny empty box?
14:47LauJensenyea
14:47Raynesnaeu: He misunderstood what you wanted.
14:48RaynesLauJensen: It's supposed to be pretty and rectangular.
14:48naeuLauJensen: hmm, no, I think it should draw a box in that box
14:48RaynesAll of this talk about boxes is making me hungry. :(
14:49naeuhaha
14:49LauJensenThere goes the Alabama boy again :)
14:49Raynes:>
14:49carkhthe frame is small, when you resize it the box disapears, you need to redraw on each redraw
14:49naeuI'm sitting in the beautiful city library in Amsterdam having just eaten some splendidly delicious pasta
14:49naeucarkh: oh interesting
14:49carkhor set the frame preferredsize before showing it
14:50naeuso i guess i should also set the size too
14:52LauJensenI haven't tried this exercise with AWT before as I always use Swing
14:52naeubingo: (let [f (java.awt.Frame.) _ (.setVisible f true) _ (.setSize f (java.awt.Dimension. 300 300)) gfx (.getGraphics f)] (.fillRect gfx 100 100 50 75))
14:52naeucarkh: thanks!
14:53naeuLauJensen: what are the pertinent differences between AWT and Swing?
14:53LauJensenSwing is more bloated and fancyfull :)
14:54naeuare there typical cases where AWT is better than Swing?
14:54naeuor is it Swing all the way?
14:54LauJensenI think AWT is just a little leaner than Swing, but both are awful
14:54naeuhaha
14:54Raynesnaeu: Isn't your name Sam Aaron?
14:55naeuRaynes: yep, it is
14:55naeuare you spying on me?
14:55Raynesnaeu: Making sure I hadn't confused you with someone else.
14:55naeuare you here in the library too?
14:55RaynesTotally.
14:55naeudamn
14:55naeuswift work
14:57LauJensennaeu: I've had some fun with QtJambi before, you can build pretty and responsive UIs using that, but I greatly prefer web-uis. Somehow Java GUIs have managed to start out being slow and unresponsive 10 years ago, and even with the coming of duo-core, multi-core machines with 2+ gigabytes of RAM, they're still slow and unresponsive... I think there's some old FPS constant somewhere thats been forgotten about
14:57naeuhaha
14:59naeuright, back to reading
14:59naeuchat later :-)
15:09cemerickguess I need to read some commit logs. byte now constrains its input!
15:14cemerickdoes anyone else get a "java.lang.IllegalArgumentException: Duplicate key: :main" when specifying (:gen-class :main false) in an ns decl?
15:15LauJensenWhich version?
15:15cemerickHEAD (or most recent 1.2.0 snapshot)
15:17LauJensenWhen do you get the error? Evaluating it calling compile?
15:18cemerickLauJensen: during AOT compilation, yes
15:19cemerickit's due to the recent no-dupes-in-map-literals change, I think
15:21cemerickrhickey: I'm getting a "java.lang.IllegalArgumentException: Duplicate key: :main" when specifying (:gen-class :main false) in an ns decl
15:42mcburtonanyone here used incanter's new "set-data", I'm trying to use it to dynamically update charts and there isn't any documentation....
15:42cemerickoh man, so many defclass usages to rip out :-/
15:53liebkemcburton: if you want either a dynamic scatter or xy plot, just use dynamic-scatter-plot or dynamic-xy-plot
15:54mcburtonliebke: I'd like a scatter plot where I can add points to a series (as opposed to creating a new series)
15:55liebkemcburton: ah, okay. set-data writes over the entire dataset. JFreeChart also has an addOrUpdateData method, but I haven't exposed it yet, but I intend to
15:57mcburtonliebke: ah, yeah, that would be perfect, is there a way I can use set-data now to kinda fake it? ie: how do I use set-data to overwrite the data with a new dataset?
15:59liebkemcburton: check out the example in the doc-string for set-data, basically, you'll create an empty scatter-plot, and a data-table object, and use set-data to populate with your new data points
16:00liebkewhen the table is updated, the plot will refresh automatically
16:02mcburtonliebke: this is probably a dumn question, but how can I create an empty data-table :}
16:02mcburtons/dumn/dumb
16:02arohnerwhat is the java 6 option for adding a dir full of jars to the classpath?
16:02arohnerjava -cp lib/*.jar: or something?
16:04cemerickarohner: that should do it
16:04liebkemcburton: not a dumb question, I think you'll need at least one row in the data-table to start (initialize it with a dataset object with one row). I should create the option to create an empty one, but I haven't yet
16:05arohnercemerick: I'm getting class not found for clojure.main, as if it's not on the classpath
16:08arohneraha. It wants java -cp lib/*:, not -cp lib/*.jar:
16:13mcburtonliebke: awesome, I'm really close, but i'm still having difficulty with the scatter plot
16:14mcburtonliebke: if I wanted to do (set-data some-scatter-plot ????) what would I put in ???? x and y?
16:18wlangstrotharohner: interesting - that must be the reason for all the shell scripts that do a for loop through the jars. It seems much easier to use "lib/*", though
16:19hiredman* only works in newer version of java
16:19arohnerwlangstroth: I'm pretty sure java 5 doesn't support that option, and clojure proper still officially supports 5
16:19hiredman1.6+
16:20wlangstrothah, I see
16:23mcburtonliebke: or how can I get the data in a table, which I can update, into a scatter-plot?
16:24mcburtonliebke: doesn't look like set-data will work on plots " addOrUpdate for class org.jfree.data.xy.XYSeries"
16:24mcburtonERR "No matching method found: addOrUpdate for class org.jfree.data.xy.XYSeries"
16:29liebkemcburton: here's the source for the set-data method (for jfreechart objects): http://github.com/liebke/incanter/blob/master/modules/incanter-charts/src/incanter/charts.clj#L2326
16:29liebkemcburton: you just pass it a chart object and a regular dataset object (I was confusing the other version of the method for data-table objects).
16:31tomoj`#<CompilerException java.lang.ClassFormatError: clojure.contrib.pprint.PrettyWriter (erroneous identifier) (pprint.clj:6)>
16:31tomoj`anyone seen that?
16:34cemerickis there any provision for defining dispatch precedence in protocol impls?
16:35mcburtonliebke: how does this work on xy-plots (like scatterplot)? addorUpate is not implemented...
16:35mcburtonliebke: err rather XYSeries (jfree)
16:39mcburtonliebke: weird, its here in the docs for XYSeries, this might be a bug?
16:42tomojseems to be a problem with the latest lein-swank
16:43tomojor something the latest lein-swank depends on... hmm
16:43liebkemcburton: this could be cause by some recent changes I made, let me check it out
16:46tomojerr
16:46tomojlein-swank is suddenly broken for me
16:48liebkemcburton: the problem is that set-data takes a two dimensional sequence [[1 2] [2 2] [3 5]], not a dataset. Try that.
16:48tomojeven in projects where lein-swank worked before!
16:48tomojwtf?
16:50mcburtonliebke: you rock!
16:50liebkeI'll take that to mean you got it to work :-)
16:50MrEvilis there a function that will return the first value of a collection for which a predicate returns true?
16:51MrEvillike some but return the actual value instead of a boolean value
16:52mcburtonliebke: now the question becomes, how do I update the data for multiple series?
16:53liebkemcburton: I haven't tested it, but set-data takes an optional series index argument
16:53sattvikMrEvil: You could try combining first and filter.
16:53sattvik,(first (filter #(< 5 %) [3 4 5 6 7 8]))
16:53clojurebot6
16:56MrEvilI've got a little locate function that I use, but it comes up so often that I figured that there was something in the std lib that would do what I wanted.
16:56mcburtonliebke: seems to work on very rudimentary testing, i'll keep you posted
16:57liebkemcburton: thank, I'd appreciate it. I'll be back on later tonight
17:02tomojaha, I'd installed some gcj stuff which broke lein-swank
17:03hiredman:(
17:04hiredmanwhy would you install that?
17:04jcromartiehow would I get the length of a Java array?
17:04jcromartiealso, why are Java arrays so weird?
17:04hiredman,(count (make-array Object 10))
17:04clojurebot10
17:05Raynes$(alength (char-array 10))
17:05sexpbot10
17:15jfieldsis (filter nil? seq) the best way to remove nils from a seq?
17:15tomojhiredman: I was trying to make some other problem go away
17:15tomojby randomly choosing packages to install :/
17:15clojurebotnamespaces 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
17:15jcromartiejfields: that's the inverse
17:16jcromartie,(remove nil? [2 nil 5 nil])
17:16clojurebot(2 5)
17:16jfieldsright, so what is the preferred way to remove nils?
17:16jfieldsah, gotcha, thanks
17:32jcromartiebleh, this data is tough to parse
17:32jcromartieit's a nasty CSV from an excel file that someone really abused
17:33jcromartieI think I need to write a parser to handle quoted fields
17:34hiredmangrab a csv library
17:35cemerickmost csv libraries suck; no support for quoted fields, quotes in quoted fields, linebreaks in fields, etc
17:35cemerickI've written a csv lib in every language I've used. :-(
17:35hiredmancemerick: that has definitely not been my experience
17:35cemerickhiredman: linky for your preferred java lib
17:35cemerick?
17:36hiredmanwell my super prefered one has some stupid license nonsense
17:36hiredman:/
17:36cemerickhiredman: nevertheless?
17:38hiredmansupercsv
17:38kotarakjcromartie: try opencsv. Parsed every file excel and diverse SAP systems have thrown at me up to now...
17:38hiredmanoh!
17:38jcromartiekotarak: thanks, good idea
17:38hiredmanit looks like it is under the apache license now
17:38jcromartieit says it supports newlines in fields, which is critical here
17:43jcromartieperfect...
17:43jcromartiethanks guys
17:49tomojcan anyone give me a hint on what to do after `mvn install`ing in a clone of polyglot-maven?
17:50tomojI didn't get a pmaven-cli/target/pmaven-*-bin.zip :(
17:58rhickeycemerick: I can't reproduce your :gen-class thing
18:39maxhodakdoes println DTRT when there's heavy concurrency?
18:39maxhodakor will you get c-style garbled output?
18:40iruedigercan anyone please point me what's wrong with the following code: http://pastebin.com/eK3ALYYR ? I am trying to implement a table model, but keep getting ClassNotFoundException when I try to instantiate de class
18:46sethsmaxhodak: I don't remember getting portions of a line
18:46sethsbut I remember lines printing out of order
18:46sethsmight consider using an agent
18:47wlangstrothiruediger: I think you're trying to write object-oriented code in Clojure
18:54cemerickiruediger: have you compiled the namespace that contains the gen-class form?
18:55cemerickiruediger: i.e. loading that form is not enough to generate the class. See http://clojure.org/compilation
18:56technomancyspeaking of which, the web site still says "all features are supported at runtime"; is that a claim from the pre-AOT days?
18:57cemerickrhickey: I'll try to get a narrow testcase. Happens every time here, across multiple projects. Maybe it's a configuration issue.
18:58cemericktechnomancy: on the compilation page?
18:58iruedigerwlangstroth: I've never programmed in Lisp :(
18:58technomancycemerick: no, on http://clojure.org at the splash page intro paragraph
18:58iruedigercan you provide a short example of a more functional way to implement a table model?
18:58carkhiruediger: any reason why you're not using proxy ?
18:59iruedigercemerick: (compile) says it can't find a/tm.clj
19:00hiredmanor reify for that matter
19:00polypuswhat is the most bleeding edge clojure snapshot called again?
19:00wlangstrothiruediger: it's easier than you might think. I'll see if I can write something short to show you what I mean.
19:00iruedigercarkh: I need to add two new methods to the base class
19:00carkhthis is being called from java ?
19:01iruedigerno
19:01iruedigeronly clojure code
19:01carkhso i don't see why those methods should be inside your class
19:02carkhwhat are the 2 method names ?
19:02lancepantzanyone have a guess as to a release date for 1.2?
19:02polypusi'm trying to add clojure-contrib with the new libs like string to my lein dependencies but can't remember what the verion number is. 1.2.0-master-SNAPSHOT doesn't work
19:02hiredmanpolypus: lose the master
19:02iruedigertm-addRow and tm-removeRow
19:02polypushiredman: ty
19:03carkhiruediger: see the thing is that you're loosing the dynamic nature of clojure by working with gen-class
19:04iruedigerAs you can see I am noob :)
19:04iruedigerbut using gen-class does feel 'wrong'
19:05carkhusually you'd call a function that would return the proxied tablemodel and the state, then you could call other functions with that state as parameter
19:06carkhthe state you would create in a let ...like this : (let [state (ref {:cols ?...})]
19:06carkhthen inside the let, you create your proxy
19:07carkhreturn both from your "factory" function by packaging these in a vector or some other data structure
19:07funkenblatt,(doc cond)
19:07clojurebot"([& clauses]); Takes a set of test/expr pairs. It evaluates each test one at a time. If a test returns logical true, cond evaluates and returns the value of the corresponding expr and doesn't evaluate any of the other tests or exprs. (cond) returns nil."
19:07carkhmaybe just like this [state my-model]
19:08iruedigerThanks carkh, I'll give that a try
19:08carkhthe call your simple clojure function add-row with the state as parameter
19:08carkhthe->then
19:09iruedigerjust to get things straight, I should avoid gen-class when possible, right?
19:09wlangstrothiruediger: carkh's advice is more to the point - I didn't realize you were simply writing a wrapper around AbstractTableModel. proxy would be your weapon of choice, there
19:09carkhi guess gen-class has its uses, but in 2 years i never had top use it at all
19:10iruedigerok
19:10iruedigerthanks guys
19:10licoressewlangstroth: no, you should avoid it, it's there when you need to create classes, basically in clojure you create functions instead
19:10licoressewlangstroth: -you should not avoid it-
19:10carkhproxy has some limitations, can't access super and such
19:10carkhthen you need gen-class i guess
19:11wlangstrothlicoresse: did you look at the code?
19:11licoresseyes
19:11wlangstrothlicoresse: it's basically just object-oriented
19:12licoresseI wondered how you would do this in a functional way, carkh gives some hints
19:12wlangstrothlicoresse: oh, I see
19:12licoresseI never touched the tablemodel myself
19:12licoresse(not from clojure)
19:13carkhwhat i explained here is a pattern you can use everywhere when working with swing
19:14licoressewlangstroth: on closer reading, it's very hard to understand what it does, I do understand it, but I have do decifre a lot of stuff
19:15wlangstrothlicoresse: it's really just a wrapper on http://java.sun.com/javase/6/docs/api/javax/swing/table/AbstractTableModel.html , so I can't think of a specifically Clojuresque way to deal with that, other than just importing it and using the structure
19:15licoressedecipher, if I could spell
19:16licoresselook at proxy instead
19:16wlangstrothlicoresse: oh, I thought you were objecting to proxy
19:16wlangstrothlicoresse: sorry, I must have misunderstood
19:16licoresseit has some limitation, like carkh mention
19:17polypuswhere on the web do i need to look to see the version strings for the latest clojure and clojure-contrib repos?
19:18wlangstrothright, but so does using a data structure like AbstractTableModel in a language that focuses on immutability
19:18carkhpolypus: you could get your clojure and contrib from http://build.clojure.org/
19:18sexpbotDashboard [Hudson]
19:20wlangstrothoh, I meant "class", not "data structure"
19:20timcharperI'm trying to install congomongo 1.2, which is advertised to be released (http://github.com/somnium/congomongo), however searching for it on clojars.org reveals no such jar (http://clojars.org/search?q=congomongo)
19:20polypuscarkh: if i'm doing it via leiningen though i'd like to be able to add a couple lines like: [org.clojure/clojure "1.2.0-SNAPSHOT"] [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]. problem is i can't find what the versions are supposed to be anywhere
19:21timcharperanyone using Congo Mongo have any idea where to get the release from?
19:21carkhpolypus: oh i see, sorry i can't help with lein
19:22licoressewlangstroth: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html
19:22sexpbotKotka : About Clojure… What else?
19:22wlangstrothlicoresse: that code wasn't mine
19:23polypusanyone know if it is even possible to get the very latest 1.2.0 branch via leiningen?
19:23wlangstrothpolypus: it is. clojure is "1.2.0-master-SNAPSHOT", and clojure-contrib is how you have it (unless I have that backwards - let me check)
19:23licoressepolypus: master
19:24licoressetoo late :)
19:24licoresseI have master on contrib as well
19:24licoresse1.2.0-master-SNAPSHOT on contrib
19:24polypuslicoresse: master on contrib will not get you the latest libs like string
19:25licoressento?
19:25polypusclojure.contrib.string
19:25licoresseok...
19:25polypusso i guess i have to go [org.clojure/clojure "1.1.0-master-SNAPSHOT"] &
19:25polypus [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"]
19:26carkhwlangstroth: looks like i found some old code of mine that uses AbstractTableModel, check this : http://gist.github.com/365234
19:26wlangstrothlicoresse: oh, "master" works now? It didn't before.
19:26carkhwlangstroth: though it's not nice code by any mean =/
19:27wlangstrothcarkh: it's what you would have to do to make that work, though. "nice" is relative.
19:28licoressecarkh: but it's not oo, it's just a big progn :)
19:28MrEvilIs there a way in clojure to get from element N in a list to the end. Similar to the following in python: [1,2,3,4,5,6,7][2:] => [3, 4, 5, 6, 7]
19:28carkhi mean, today i would manage state differently
19:28wlangstrothcarkh: you mean if you were still forced to use AbstractTableModel?
19:29carkhthat pattern is good for most cases wher eyou need to subclass a swing object, not only abstracttablemodel
19:30MrEvilah just found it: drop
19:30licoressewlangstroth: you see, from the gist, that a proxy for AbstractTableModel is created
19:31licoressethat's basically what you do in you oo version
19:31wlangstrothlicoresse: okay, are you just teasing now? carkh and I both recommended proxy to the guy above.
19:32licoresseand I agree!
19:32carkhhaha damn i thought you were the one asking about that =P
19:32carkhit was iruediger instead =P
19:32licoresseam I mixing names?
19:32licoressehaha
19:32wlangstrothsigh
19:33carkhi don't know about you, but i certainly mixed a bit =P
19:34wlangstrothah well. so carkh: you said you would handle it differently now, so don't leave us hanging - what would you do?
19:34licoressewhy do I have to manually keep track of who I am talking to? I am using emacs goddammit
19:34carkhwell the proxy thing is fine, but these days i return a map with the state and the proxied item
19:34wlangstrothlicoresse: isn't there a meta key for that? M-x keep-track-of-everything-for-me
19:35licoressenot yet
19:35The-KennySomeone should write this :)
19:35licoressethe whole irc concept needs more dynamism
19:36wlangstrothcarkh: oh, right, you're not returning anything in the gist. I see.
19:36The-KennyBtw. I get ":( matches hiredman" when I write :)
19:36The-KennyParen-Matching ftw :)
19:37licoresseI just get segfaults
19:37licoresse(in my head, that is)
19:38licoressewhat is so interesting about clojure.contrib.string?
19:38licoresse,clojure.contrib.string
19:38clojurebotjava.lang.ClassNotFoundException: clojure.contrib.string
19:40printfIs there a trick to shorten long namespace names in the repl?
19:40wlangstroththere's :as
19:40wlangstrothis that what you mean?
19:41carkh,(require 'clojure.contrib.string :as 'ccs)
19:41clojurebotjava.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath:
19:41carkhbah
19:42printfdoh, right..thanks :)
19:47printfok, that's not exactly what I meant I guess…since my namespaces are kinda long (using netbeans/enclojure) they hog a lot of my horizontal repl space...
19:47printflooking for a way to temporarily shorten that namespace name, while in the repl
19:52wlangstrothoh, I see
19:56wlangstrothprintf: huh. You got me. Maybe someone more experienced knows.
19:58lancepantzprintf: are you looking for alias?
19:59lancepantz,(doc alias)
19:59clojurebot"([alias namespace-sym]); Add an alias in the current namespace to another namespace. Arguments are two symbols: the alias to be used, and the symbolic name of the target namespace. Use :as in the ns macro in preference to calling this directly."
19:59wlangstrothpff
19:59dnolenprintf: also (require '[some.long.namespace :as foo])
19:59printfI shall give it the ol college try..
19:59wlangstrothI was looking under ns-this-and-that
19:59wlangstroth*facepalm*
20:21timcharperis there an all? fn in clojure?
20:21timcharperie: (reduce (fn [a b] (and a b)) '(true true false))
20:22hiredman,(dco every?)
20:22clojurebotjava.lang.Exception: Unable to resolve symbol: dco in this context
20:22hiredman,(doc every?)
20:22clojurebot"([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false."
20:22timcharperwow, go documentation. thanks, was just about to say "duh, I found it"
21:06timcharperanybody else find themselves fighting emacs auto-indentation for (cond) statements?
21:08polypustimcharper: i never fight emacs, emacs is always right :)
21:08timcharperlol
21:08timcharperpolypus: unfortunately, not everyone here uses emacs for clojure. one TextMate, one vim.
21:08timcharperbut.. that aside, I really don't like how conds are indented with emacs
21:09timcharper:S
21:10polypusi try not to think about it. programming in other languages seems painful now that all my code formatting is automated
21:11sethstimcharper: I don't remember about cond, but th formatting of methods defined in a deftype annoyed me
21:11timcharperdo you find a problem with emacs indentation or cond? Either your condition and expr one line, or you do it on two lines each and have the condition and the expression
21:11timcharperon alternating lines, indendented the same
21:11timcharperIE:
21:13timcharperhttp://pastie.org/918570
21:13sexpbot#918570 - Pastie
21:13polypusif the conditions or expressions are large then i go with two lines, else just one line for the pair generally
21:13sethspolypus: same here
21:14timcharperam I doing something wrong?
21:14sethsalthough it's tempting to add some extra indentation on the 2nd line
21:14timcharperisn't it confusing to have to count odd, even, odd, even to discern between condition and expression?
21:14timcharperseths: that's what I find myself doing (and my co-workers all do)
21:15polypusyou could always go with commas between pairs
21:15carkhthere's is a reason why common lisp has an extra pair of parenthesis on cond
21:15timcharperlike that ?
21:15timcharperhttp://pastie.org/918570
21:15sexpbot#918570 - Pastie
21:15carkhbut yeah good idea the comma !
21:16timcharpercarkh: yeah, I know! I read that about clojure and was like, but I like the extra parenthesis! This is bad!
21:16timcharper(when I first learned about it, I should say)
21:16carkhohwell that's a very minor annoyance=P
21:17timcharperit seems like it ought to be possible to transparently extend the cond macro to accept a series of vectors
21:17sethstimcharper: sometimes I add a blank line between condition/expression pairs
21:17sethsand maybe even some indentation: http://bitbucket.org/seths/pokerepl/src/88c651cbdb05/src/pokerepl.clj#cl-122
21:18timcharperhttp://pastie.org/918570
21:18sexpbot#918570 - Pastie
21:18carkhbut that's the thing, you need to fight emacs to get this indentation
21:18sethscarkh: agreed. I'm sure patches are welcome :-)
21:19timcharpercarkh: I really like that syntax too. A patch for emacs to make it indent that way would be stellar
21:20carkhi don't think clojue-mode has a notion of "i'm in a cond form" or any other kind of form
21:20timcharperspecifically, a patch for emacs clojure-mode
21:20sethstimcharper: I like the comma approach, but I would append it to the expression
21:20timcharpercarkh: it indents conditionally with defn and a few other things
21:20carkhthat's a one line further thing
21:21carkhit does some fancy stuff more when pairaid with slime too
21:21carkhpaired
21:21timcharperhttp://pastie.org/918575
21:21sexpbot#918575 - Pastie
21:22timcharperthe dash indicates where my cursor goes
21:22timcharperit appears to have contextual knowledge of what kind of sexp it's in
21:22timcharperare you saying the odd-even logic would be difficult ?
21:23sethscarkh: paredit
21:25timcharperhttp://github.com/jochu/clojure-mode/blob/master/clojure-mode.el#L342
21:25timcharperthere's the magic
21:26carkhright, that's an ugly thing =P
21:26sethsit's just emacs lisp -- someone page @technomancy :-)
21:27timcharpercarkh: hah, code written in emacs-lisp has a 98% chance of being ugly.
21:28timcharperb
21:28carkhlooks like there could be some backtracking-indent form that could be defined fo this
21:31carkhthat is interesting : (put 'proxy 'clojure-backtracking-indent '(4 4 (2)))
21:33carkhbut i'm making changes to it, and running the sexp, but it won't change in an existing clojure-mode buffer
22:04RaynesHah. It ignores links with "paste" in the name, but pastie only has "past" in the name. What a load. -.-
22:06hiredmanyou can steal the pastebin regex from clojurebot
22:06hiredmanit's in delicious.clj
22:10Rayneshiredman: Clever. Thanks.
22:13RaynesIn my configuration file, I have a blacklist of words that, if one of them appears in a link, that link is ignored. "paste" is blacklisted, and so is github (github's titles are generally no more useful than the urls themselves), so I effectively achieve the same thing with just three words. :D
22:13RaynesIncluding pastie.
22:13RaynesWhich I just added.
22:15Rayneshiredman: That post function is probably the longest I've seen a function go without a newline. :o
22:17sethsdo either of sexpbot or clojurebot have a web interface? they seem like more fun than Lord of the REPLs
22:18sethshttp://lotrepls.appspot.com/
22:18sexpbotLord of the REPLs
22:18hiredmanoh
22:18hiredmanI didn't realize that was shelling out
22:19RaynesThat's a nice idea, like lambdabot (only without the web interface, but still usable from the command-line).
22:19sethsit's google app engine
22:19RaynesThat's kind of difficult though, because both sexpbot and clojurebot use Pircbot.
22:19hiredmanclojurebot has an http server
22:20sethsah, just curious. I used LotREPLs for a Clojure demonstration. Mostly since it was as far away from GNU/Emacs as I could get :-)
22:20hiredmanclojurebot: show me some scala
22:20sethsseths: for the GNU/Record I am a huge fan of The Editor, but didn't want to scare people new to Clojure
22:20clojurebotScala often gets in the way when trying to write neat code -- seen in #scala
22:20sethslol
22:21hiredman~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)}
22:21Raynes"Oh my God, he just opened up Emacs. I'm leaving."
22:21clojurebotAny = 1
22:23sethsRaynes: sad but true. In my slides I used the flame transition to burn Emacs and it was a huge hit.
22:26hiredmanswank-clojure-project+clojure-test-mode is pretty slick
22:27Rayneshiredman: Why not just make Clojurebot give technomancy compliments automatically onJoin? :p
22:27technomancyheh
22:28sethsRaynes: just have it emit Neal Stephenson quotes
22:29hiredmanI gotten spam where the subject line was stephenson quotes
22:29wlangstroth hiredman: and I thought Google was creepy
22:29wlangstroththat's some focused advertising
22:30technomancymore of a gibson fan personally
22:31technomancylike I've said, youth is the only excuse a hacker can put forth for not having Neuromancer mostly memorized.
22:32sethss/Neuromancer/random Harlan Ellison/ ok?
22:32hiredmancount zero is obviously superior
22:32wlangstrothcan anyone tell me if there is any rhyme or reason to the practice of appending asterisks to the end of function names?
22:32carkhwlangstroth: functions you're not supposed to call from client code
22:32technomancyhiredman: I'll have to revisit it... I think I was sick when I read it the first time, and it didn't stick in my brain all too well
22:33hiredmanpeople look at you funny if you use unicode prime marks
22:33wlangstrothcarkh OH - sweet mother of Clojure that was bothering me
22:33technomancyif it looks wrong, it probably is. =)
22:33wlangstrothokay, that makes sense, thanks
22:34wlangstrothtechnomancy: tell me about it
22:45wlangstrothokay, wait: I thought the minus appended to defn and def was the "non-public" indicator. What counts as "client code", here?
22:45carkhhum defn is private
22:45carkherr defn-
22:45carkhas in javaland private
22:45wlangstrothright
22:46carkhif you name your function my-function*
22:46hiredmanerm
22:46carkhit is not private
22:46hiredmanit's not the same has java private
22:46carkhright not quite the same but almost
22:46wlangstrothokay, but "shouldn't use in client code" is what's confusing me
22:46carkhdon't be nitpicking again
22:46carkhlet's say i have a macro with-foo ..
22:47carkhand inside the macro i use the supporting function with-foo*
22:47carkhwhen the macro get expanded in some other namespace, it will expand to with-foo*
22:47carkhso with-foo* cannot be private
22:48carkhso that's convention to say : you're not supposed to use with-foo*
22:48wlangstroth... except in macros
22:48wlangstroth?
22:49carkhthe client code (your code) is supposed to call the library macro with-foo, instead of its supporting function with-foo*
22:49wlangstrothokay, perfectly clear now - thanks
22:52wlangstrothJust making sure, because there's a slurp* in contrib - it only gets called by a method (but that method is in the library, so I suppose that's outside the "client code")
22:52carkhright, in the io library you have a slurp function, that calls its supporting function slurp*
22:53carkhbut you're supposed to use slurp
23:00wlangstrothcarkh: you would think so, but no.
23:00carkhahwell i didn't check the code, anyways you get the idea
23:02wlangstrothcarkh: definitely, thanks
23:04wlangstrothhiredman: can you point me to the code (even just generally) where the minus sign specifies a not-quite-private-in-Java function? I'm having difficulty finding it.
23:05hiredmanit's in the defn- macro
23:06hiredmanwhat really is happening is :private true is being put in the var metadata
23:10wlangstrothpff - here I am looking for a "-" in the LispReader
23:10wlangstrothof course it's just a macro
23:10wlangstroththanks, guys
23:26technomancyhugod: so slime-autodoc... was that moved out of slime into a contrib recently?
23:26JonSmithok, so quick question... lets say i wanted to serialize a clojure data piece into a database or send it across a network. Now, I realize that I could do a .toString, on most things and send it that way, but is there a way to send it as a binary? (Especially with functions, like the erlang to_binary function).
23:26technomancybecause I have that functionality in the elpa version of slime already without any extra files
23:28mabesJonSmith: http://groups.google.com/group/clojure/browse_thread/thread/e704414cf36ef2aa http://github.com/mmcgrana/clj-serializer
23:28hugodtechnomancy: slime-autodoc was moved to contrib a while back I thought - full support would include highlighting of the "current" arg
23:28technomancyoh, that's handy
23:28technomancyit's annoying to have a lot of separate files for elpa though. =\
23:28hugodbut that's not implemented
23:29JonSmithooh thanks mabes
23:29mabesJonSmith: I've used the prior approach before but I have not used clj-serializer yet.. it seems pretty nice though
23:30hugodtechnomancy: slime-autodoc gets included by slime-fancy, so I just wanted something that "worked"
23:31technomancythat's frustrating; it's a lot easier to package stuff up if it's just a handful of files. =\
23:31technomancyand it used to Just Work with the 20091016 version
23:32technomancybut we can't stay on the old version forever I guess
23:33technomancyman, the slime contribs are sloppy
23:33technomancythey don't have the proper requires in place
23:34JonSmithslime is always kind of a bear
23:34JonSmitheven in CL where its more 'native'
23:35technomancyevery couple months I contemplate a fresh rewrite.
23:36JonSmithyeah i don't blame you
23:37technomancyhugod: getting an "Evaluation Aborted" without an sldb buffer or backtrace on slime-hyperdoc-lookup
23:38hugodtechnomancy: there is some magic for the slime contrib requires
23:38technomancyhugod: mostly complaining because of the complaints on the mailing list I get about elpa not being "a regular emacs installation process" =)
23:39hugodtechnomancy: could you eval (setq debug-on-error t) and retry - should get you a stack trace
23:39technomancyhugod: yeah, no such luck
23:40technomancythat's only for elisp errors
23:41hugodtechnomancy: 'll merge it locally and test
23:41JonSmithoh man, you could make it a 'normal emacs installation process' by making the user search for a hidden .emacs file and write emacs lisp code
23:43technomancyJonSmith: "installation instructions left as an exercise to the reader"
23:43technomancyand I don't mean clojure.lang.LispReader
23:44technomancyhugod: I wasn't actually merging, just trying origin/hyperdoc
23:44technomancyhugod: also: autodoc seems to work fine without the autodoc branch
23:44technomancyare there any specific edge cases I should be trying that the autodoc branch fixes?
23:45hugodtechnomancy: it was generally broken for me
23:45technomancyhmmm, odd. I'm using slime trunk now.
23:46hugodok, I'll update my slime
23:46technomancyI mean, if it's broken for you I'd expect it to work in elpa but not in current trunk
23:48JonSmithtechnomancy: yeah, that's about right :-)
23:48JonSmithi liked ELPA clojure when i used it, for the record
23:50JonSmiththats a lot of buffers
23:51hugodwell, emacs has been up for a while
23:57hugodtechnomancy: could you check (require 'swank.commands.contrib.swank-arglists) swank.commands.contrib.swank-arglists/autodoc*