2010-04-13
| 00:00 | jcowan | It's irritating that Java has only one matching function for all maps, except for IdentityMap which has to fake it. |
| 00:00 | hiredman | for a little while PHMs were not j.u.Maps |
| 00:00 | technomancy | seems like requiring a little (into [...]) for interop might be worth the price of correct equality semantics |
| 00:00 | hiredman | maybe slightly longer than a little while, it was long ago |
| 00:00 | technomancy | but I haven't thought that all the way through |
| 00:00 | tomoj | ,(-> {} (assoc 1 :foo) (assoc (long 1) :bar)) |
| 00:00 | clojurebot | {1 :bar, 1 :foo} |
| 00:00 | technomancy | that's backwards, but you know what I mean |
| 00:01 | hiredman | #scala was wreslting with this a year or so ago |
| 00:01 | technomancy | I 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:01 | technomancy | and then just this afternoon it bit me |
| 00:01 | jcowan | There are no correct equality semantics tout court, only correct for certain purposes. |
| 00:02 | technomancy | jcowan: maybe, but there are incorrect equality semantics. and (.equals 1 (long 1)) is one of them. =) |
| 00:03 | jcowan | I'm not even ready to swallow that. Sometimes you want comparisons with constant performance. |
| 00:03 | technomancy | identical? is constant |
| 00:04 | technomancy | heh, except that's not quite right |
| 00:04 | technomancy | ,(identical? 1 1) |
| 00:04 | clojurebot | true |
| 00:04 | technomancy | ,(identical? 10000 10000) |
| 00:04 | clojurebot | false |
| 00:05 | technomancy | is that something fixnums would help with? |
| 00:06 | jcowan | How out of date is the Web site? |
| 00:06 | dnolen | ,(identical? 127 127) |
| 00:06 | clojurebot | true |
| 00:06 | jcowan | (in terms of being inaccurate, not in terms of being incomplete) |
| 00:06 | dnolen | ,(identical? 128 128) |
| 00:06 | clojurebot | false |
| 00:07 | technomancy | interesting; elisp has identical integers even at very high values |
| 00:07 | hiredman | jcowan: what part of the website? |
| 00:07 | hiredman | it should be fairly accurate, maybe the docs follow the last release not git head |
| 00:08 | jcowan | In some projects the docs are so out of date they're totally irrelevant. |
| 00:08 | _ato | technomancy: doesn't elisp use tagged integers, so they're not seperate objects? |
| 00:08 | technomancy | _ato: that'd be my guess |
| 00:09 | dnolen | jcowan: 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:09 | technomancy | I wonder if that's part of why ClojureCLR is "ClojureCLR" and not "Clojure for the CLR". |
| 00:09 | _ato | that's why they're only 29 bits or whatever it is |
| 00:09 | jcowan | Exactly. |
| 00:10 | jcowan | And there are no bignums in elisp at all. |
| 00:10 | jcowan | Quoth the elisp reference manual: |
| 00:10 | jcowan | 536870913 ; Also the integer 1, due to overflow. |
| 00:11 | technomancy | that must be out of date; I can square that number and it works fine in elisp |
| 00:13 | jcowan | Possibly because you have a 64-bit build of emacs. |
| 00:14 | technomancy | a likely story |
| 00:14 | hiredman | knowning technomancy it seems almost a certainty |
| 00:14 | technomancy | for a while I had a threaded build |
| 00:15 | technomancy | that was a wild ride |
| 00:15 | technomancy | meaning: it didn't work that well |
| 00:15 | hiredman | now all code that depends on the overflow behavior is broken |
| 00:15 | technomancy | but it was exciting |
| 00:15 | technomancy | heh |
| 00:17 | technomancy | in case there was any doubt, John Rose is the man: http://blogs.sun.com/jrose/entry/fixnums_in_the_vm |
| 00:17 | sexpbot | fixnums in the VM - John Rose @ Sun |
| 00:17 | jcowan | Sure. |
| 00:18 | jcowan | Well, 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:18 | technomancy | actually if you really want a trip read this one: http://blogs.sun.com/jrose/entry/tailcalls_meet_invokedynamic |
| 00:18 | sexpbot | tailcalls meet invokedynamic - John Rose @ Sun |
| 00:19 | @jcowan | Okay, I'm an op. |
| 00:19 | hiredman | tail calls are exciting |
| 00:19 | hiredman | mmmm |
| 00:19 | hiredman | geez, but invokedynamic is cool too |
| 00:20 | technomancy | jcowan: do folks have to be present for you to bestow opship on them? |
| 00:20 | @jcowan | I have no idea. |
| 00:21 | technomancy | well if you can't promote rhickey you could try chouser |
| 00:22 | dnolen | does invokedynamic buy much for Clojure? I recall rhickey saying that it doesn't |
| 00:22 | @jcowan | Can I get some concurrence from other users, so I'm reasonably sure I should do that? |
| 00:22 | hiredman | dnolen: it won't ease any of the main pain points |
| 00:23 | @jcowan | It should provide more efficient reflection, though. |
| 00:24 | carkh | jcowan: yes chouser would be the one beside rhickey |
| 00:24 | hiredman | always two there are |
| 00:25 | technomancy | hiredman: suddenly it all makes sense |
| 00:25 | hiredman | clojurebot is c3po |
| 00:26 | dnolen | jcowan: yeah, but in Clojure you generally either don't care (using Clojure datastructures anyway), or you want the absolute fastest thing (primitive math) |
| 00:26 | dnolen | with deftype you don't even need to bother with type-hints at all. |
| 00:28 | dnolen | with deftype + map + vectors you can get ridiculously close to the speed of java mutable object + for loop + java mutable array |
| 00:32 | Licenser_ | morning |
| 00:33 | technomancy | whoa; scopes are scheduled for 1.2 now? http://www.assembla.com/spaces/clojure/tickets/2-scopes |
| 00:33 | sexpbot | #2 - Scopes (New) | Clojure | Assembla |
| 00:34 | hiredman | nice |
| 00:34 | hiredman | I'll believe it when I see it |
| 00:34 | Licenser_ | oh scopes? |
| 00:35 | hiredman | (when I see code) |
| 00:35 | Licenser_ | ^^ |
| 00:36 | technomancy | I guess that means it's going to be a while though |
| 00:37 | hiredman | my understanding is rhickey has a strategic reserve of code he releases over time |
| 00:37 | @jcowan | There. |
| 00:37 | Licenser_ | heh |
| 00:38 | @jcowan | I can't do offline people, at least not easily. |
| 00:38 | hiredman | and so ended the age of man |
| 00:38 | Licenser_ | hi jcowan chouser |
| 00:38 | tomoj | finally we can ban people who don't like parentheses, hurrah |
| 00:38 | Licenser_ | jcowan: that sounds so wrong |
| 00:38 | Licenser_ | uhh I love parentheses! |
| 00:38 | Licenser_ | but they could get a easyer to spell word for it :P |
| 00:39 | @jcowan | Anyhow, if something goes wrong with opness, message me at cowan@ccil.org. |
| 00:39 | tomoj | "parens"? "pars"? "p's"? |
| 00:39 | Licenser_ | p's is good |
| 00:39 | Licenser_ | I can spell that |
| 00:39 | maravillas | open banana, close banana |
| 00:39 | lancepantz | haha |
| 00:39 | lancepantz | i'm going to start referring to them like that |
| 00:40 | @jcowan | So what does the community think of Enclojure, and Thortech generally? Benefactors? Malefactors? Irrelevant? |
| 00:41 | Licenser_ | 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:41 | tomoj | to me personally, irrelevant |
| 00:42 | @jcowan | I am considering applying to work there. |
| 00:43 | Licenser_ | well it sounds as if you could work with clojure there which is kind of cool |
| 00:43 | @jcowan | Indeed. |
| 00:44 | @jcowan | That would be why I'm asking here about it. |
| 00:46 | Licenser_ | well it is better then applying somewhere to write java :P |
| 00:50 | @jcowan | No joke there. |
| 00:51 | @jcowan | I'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 | @jcowan | Anyhow, any proposals to update the topic before I go? |
| 00:51 | @jcowan | (for now, not for good) |
| 00:52 | Licenser_ | well try it worst case you get the job or don't :P |
| 00:52 | @jcowan | Sure. |
| 00:52 | @jcowan | Licenser_: What is it that "sounds so wrong", though? |
| 00:53 | technomancy | jcowan: for a two-year-old topic, it's aged surprisingly well |
| 00:54 | @jcowan | Okay, all good. |
| 01:13 | AntonyBlakey | Anyone here building webapps using Enclojure? |
| 01:14 | AntonyBlakey | Using maven, I should add. |
| 01:14 | Licenser_ | don't use the m-word ; |
| 01:14 | Licenser_ | ( |
| 01:14 | AntonyBlakey | I'm interested in what workflow people use i.e. jetty plugin vs. repl with run-jetty |
| 01:15 | AntonyBlakey | I don't touch maven XML anymore, it's all Clojure, so Maven is easy |
| 01:16 | lancepantz | i use a repl in dev, but build a war for production |
| 01:16 | lancepantz | don't use enclojure though fwiw |
| 01:16 | AntonyBlakey | Enclojure isn't the issue |
| 01:16 | AntonyBlakey | So you use compojure? |
| 01:17 | lancepantz | yep |
| 01:17 | AntonyBlakey | Do you genclass a servlet for the war, but se run-jetty in development REPL? |
| 01:17 | lancepantz | yeah, i have run-jetty in a different namespace |
| 01:17 | lancepantz | and launch that in dev |
| 01:18 | lancepantz | but don't use that namespace in the war |
| 01:18 | AntonyBlakey | Do you use maven and the jetty plugin at all? |
| 01:18 | lancepantz | no, i use ant :/ |
| 01:19 | AntonyBlakey | OK, thanks, that's useful info. |
| 01:19 | lancepantz | np |
| 01:28 | dnolen | for anyone else driven insane from converting to binary ops and type hinting expressions, http://gist.github.com/364328 |
| 01:28 | sexpbot | gist: 364328 - GitHub |
| 01:37 | hiredman | ,( -37 12) |
| 01:37 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 01:37 | hiredman | ,(- 37 12) |
| 01:37 | clojurebot | 25 |
| 01:43 | Licenser_ | question: what basic java classes are important and secure? |
| 01:44 | Licenser_ | dnolen: neat |
| 01:46 | hiredman | easier that patching the compiler |
| 01:46 | Licenser_ | hey hiredman when will clojurebot use clj-sandbox? :P |
| 01:47 | hiredman | *shrug* |
| 01:47 | Licenser_ | ^^ |
| 01:47 | hiredman | I'll put it in the todo |
| 01:49 | hiredman | http://gist.github.com/297122 |
| 01:49 | sexpbot | gist: 297122 - GitHub |
| 01:49 | hiredman | sexpbot: thanks! |
| 01:49 | dnolen | would 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:50 | somnium | we should make #clojure-think-tank, fill it with bots, and give them interesting questions to ponder |
| 01:50 | Licenser_ | wow I fail to understand hat o.O |
| 01:50 | hiredman | ,(doc clojure.walk/post-walk) |
| 01:50 | clojurebot | Titim gan éirí ort. |
| 01:50 | hiredman | ,(doc clojure.walk/postwalk) |
| 01:50 | clojurebot | "([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:51 | tomoj | lancepantz: grr |
| 01:51 | tomoj | I can't build jiraph |
| 01:51 | lancepantz | what's wrong? |
| 01:52 | tomoj | you're not on something like ubuntu by chance, are you? |
| 01:52 | tomoj | missing jni. |
| 01:52 | lancepantz | mac |
| 01:52 | tomoj | jni.h |
| 01:52 | tomoj | I think it's trying to compile tc maybe |
| 01:52 | lancepantz | most likeley |
| 01:52 | lancepantz | what os are you on? |
| 01:52 | tomoj | ubuntu karmic |
| 01:53 | tomoj | couldn't find anything in the repos that sounded relevant |
| 01:53 | hiredman | Licenser_: 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:54 | hiredman | not in the official clojure |
| 01:54 | _ato | tomoj: hmm I have /usr/lib/jvm/java-6-sun-1.6.0.15/include/jni.h |
| 01:54 | tomoj | me too |
| 01:54 | tomoj | but it is apparently not found |
| 01:54 | tomoj | not sure if I need to set some environment variable or what |
| 01:55 | tomoj | as soon as C is involved I have no clue what to do |
| 01:58 | lancepantz | i've had some issues with the tc libraries, but not jni.h before |
| 02:04 | lancepantz | tomoj: 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:09 | tomoj | now it's trying to call /bin/javac whic doesn't exist |
| 02:09 | tomoj | oi |
| 02:10 | tomoj | are there people who actually understand this stuff? |
| 02:12 | LeNsTR | /usr/bin/javac ? |
| 02:18 | vu3rdd | I 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:18 | vu3rdd | it reduces considerably when the number of jars in the classpath is less. |
| 02:21 | dnolen | http://gist.github.com/364328, hiredman: using post-walk now |
| 02:21 | sexpbot | Gist - GitHub |
| 02:21 | tomoj | LeNsTR: nope, /bin/javac |
| 02:21 | dnolen | (prim + float 4 5 (* 6 7) 8) expands |
| 02:21 | dnolen | I'm sure there's bugs, but this already will save me a lot of time. |
| 02:22 | dnolen | should probably improve to allow (prim float (+ 4 5 (* 6 7))) |
| 02:28 | dnolen | done, http://gist.github.com/364328 (prim float (+ 4 5 (* 6 7) 8))) works |
| 02:28 | sexpbot | gist: 364328 - GitHub |
| 02:39 | dnolen | ok, 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:02 | bozhidar | greetings, mates |
| 03:02 | bozhidar | is there anyone around here using clojure-mode in Emacs? |
| 03:02 | bozhidar | I'm having a strange issue with the font-locking |
| 03:03 | bozhidar | basically most of the core clojure functions are lacking a proper font face |
| 03:03 | bozhidar | although I see one defined in the source code of the mode |
| 03:03 | bozhidar | I'm using clojure-mode 1.6 from ELPA in Emacs 23.1 |
| 04:37 | sergey_miryanov | ,(array-map 1 2 3) |
| 04:37 | clojurebot | 3 |
| 04:37 | sergey_miryanov | ,(apply (array-map 1 2 3)) |
| 04:37 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$apply |
| 04:41 | bsteuber | ,(array-map :a 1 :b 2 :c 3) |
| 04:41 | clojurebot | {:a 1, :b 2, :c 3} |
| 04:53 | sergey_miryanov | bsteuber, thanks! |
| 04:56 | spariev | ,(apply array-map [:a 1 :b 2 :c 3]) |
| 04:56 | clojurebot | {:a 1, :b 2, :c 3} |
| 04:58 | sergey_miryanov | thanks :) |
| 05:31 | npoektop | hi! where is function (now)? |
| 05:31 | npoektop | can't find it |
| 05:33 | hoeck | ,(java.util.Date.) |
| 05:33 | clojurebot | #<Date Tue Apr 13 02:35:05 PDT 2010> |
| 05:34 | AWizzArd | ,(java.util.Date.) |
| 05:34 | clojurebot | #<Date Tue Apr 13 02:35:07 PDT 2010> |
| 05:34 | AWizzArd | k |
| 05:34 | AntonyBlakey | ,(System/currentTimeMillis) |
| 05:34 | clojurebot | 1271151329467 |
| 05:35 | hoeck | npoektop: my eyes can't resist to the urge reading your nick as "projector" :) |
| 05:38 | npoektop | hoeck, this is known only to initiates) |
| 05:41 | hoeck | and then its so disturbing typing pr<tab> and wondering why it won't complete |
| 05:44 | licoresse | :) |
| 07:13 | caljunior | Wow, 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:14 | Licenser_ | oha |
| 07:14 | caljunior | and the hit counter works fine. |
| 07:15 | caljunior | I feel special now. :-) |
| 07:15 | Licenser_ | perhaps it was reset? |
| 07:17 | Licenser_ | now it are 189 |
| 07:18 | caljunior | I refreshed up to 185 to check if it worked. |
| 07:19 | spariev | http://www-formal.stanford.edu/jmc/ - 971 hits since 1995 October 17th |
| 07:20 | spariev | I thought John McCarthy home page is much more popular |
| 07:22 | caljunior | Shouldn't we send him a thank you postcard at least? |
| 07:31 | spariev | maybe there is should be a Lisp Inventor Appreciation Day :) |
| 07:31 | triyo | you can bake him a cake for his bday |
| 07:31 | rfg | A parens cake would be cool. |
| 07:32 | rfg | For certain values of cool. |
| 07:32 | esj | or a self eating cake |
| 07:33 | triyo | esj: hehe nice one |
| 07:33 | spariev | great idea ) I'll certainly ask gf a parens cake for my birthday |
| 07:33 | triyo | esj: very inline with lisp philosophy |
| 07:33 | esj | :) |
| 07:34 | rfg | triyo: it would maybe be more like a self making cake. |
| 07:35 | rfg | Made from other cakes. |
| 07:38 | rfg | The cake is a lie. |
| 08:35 | cemerick | wasn't the 'slim' versions of contrib supposed to include the necessarily-compiled *Writers for pprint? |
| 08:35 | cemerick | weren't* |
| 08:41 | AWizzArd | cemerick: 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:42 | cemerick | AWizzArd: 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:43 | cemerick | I 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:43 | AWizzArd | cemerick: 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:43 | AWizzArd | ah oki |
| 08:44 | cemerick | No, if the interface is included in the deftype/record declaration, that should be enough. |
| 08:44 | AWizzArd | right, because this worked for me |
| 08:45 | AWizzArd | So, 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:45 | AWizzArd | We really need Rich to make deftypes by default serializable :) |
| 08:45 | cemerick | No macro can impact the implementation of OOS. |
| 08:45 | AWizzArd | at least not currently, as deftypes have no reflection |
| 08:46 | cemerick | Classes are closed, and cannot be redefined (modulo stuff like jrebel (sp?)). |
| 08:46 | AWizzArd | ok, very possible that it won’t work |
| 08:46 | AWizzArd | but maybe rhickey will give is j.io.S for deftypes |
| 08:46 | AWizzArd | is => us |
| 08:47 | AWizzArd | or defmaptype or however the current deftype will be renamed |
| 08:47 | cemerick | defrecord is the frontrunner last I knew. |
| 08:48 | cemerick | Sadly, 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:49 | cemerick | Between the RestFn signature change from 1.1, and the contrib reorg, it's nearly impossible to reuse any 1.1-era artifacts. |
| 08:49 | AWizzArd | yes, okay, so defrecord will most likely implement clojure.lang.IPersistentMap |
| 08:50 | AWizzArd | cemerick: à propos dependencies from source.. so far I am using still rhickeys gist about cells.clj |
| 08:51 | AWizzArd | And I (load-file it) |
| 08:51 | rhickey | cemerick: RestFn sig change? |
| 08:51 | cemerick | AWizzArd: which gist is this? |
| 08:52 | zakwilson | I'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:52 | cemerick | rhickey: 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:53 | AWizzArd | cemerick: I think it was http://gist.github.com/306174 |
| 08:55 | AWizzArd | rhickey: would it make sense to let defrecord implement clojure.lang.IPersistentMap and java.io.Serializable by default? |
| 08:55 | rhickey | cemerick: I don't see it |
| 08:56 | rhickey | AWizzArd: it will implement IPersistentMap, that's the point of it |
| 08:56 | AWizzArd | yes, and does (on top of that) Serializable make also sense? |
| 08:57 | rhickey | cemerick: I am interested in improving binary compatibility between AOT compilations, but need to know specifically what is tripping people up |
| 08:57 | cemerick | rhickey: I'm looking for the commit sha now |
| 08:57 | rhickey | AWizzArd: possibly |
| 08:57 | AWizzArd | Would be very useful. |
| 08:58 | cemerick | rhickey: 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:58 | rhickey | cemerick: what is bytecode if not that? |
| 08:58 | hoeck | I guess the question is wether there will be any downsides of always implementing Serializable on types. |
| 08:59 | AWizzArd | Oh, 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:59 | cemerick | AWizzArd: right |
| 08:59 | AWizzArd | so, perhaps can those instances additionally serialize their (type (Foo nil)) ==> ::Foo? And then this info can be used for deserialization? |
| 09:00 | cemerick | AWizzArd: ObjectInputStream knows nothing about clojure type tags |
| 09:00 | AWizzArd | yes okay, and probably can’t be made so |
| 09:01 | cemerick | rhickey: 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:02 | cemerick | so, the ctor, not .invoke() |
| 09:02 | a_strange_guy | that't because Fns now have metadata |
| 09:03 | cemerick | a_strange_guy: yeah, I wasn't saying it wasn't a good or necessary change |
| 09:04 | AWizzArd | hoeck: maps, vectors and sets also always implement them. And as defrecord will be also a container/maplike thing it could make sense |
| 09:07 | a_strange_guy | Serializability only makes sense for AOT-Compiled deftypes |
| 09:07 | AWizzArd | Is there a "deftype?" function? (deftype? 10) ==> false (deftype Foo [a]) (deftype? (Foo 123)) ==> true |
| 09:07 | AWizzArd | a_strange_guy: because then the class name won’t change? |
| 09:08 | a_strange_guy | (instance? clojure.langIDynamicType obj) |
| 09:08 | a_strange_guy | yes |
| 09:09 | cemerick | a_strange_guy: yeah, that's essentially assumed, I think (at least for the use-cases I'm aware of) |
| 09:09 | a_strange_guy | the first thing that happens when desirializing is Class.forName() |
| 09:09 | rhickey | cemerick: ok, see that, thanks |
| 09:09 | cemerick | rhickey: I think it's 430dd4fa711d0008137d7a82d4b4cd27b6e2d6d1? |
| 09:09 | Raynes | cgrand: Thanks for the SO reply. We figured it out at the same time. :p |
| 09:09 | cemerick | rhickey: but anyway, I don't think there's much to do about it? |
| 09:09 | cemerick | that can be done about it* |
| 09:10 | a_strange_guy | AWizzArd: but you can always print a deftype, and read it in afterwards |
| 09:10 | rhickey | cemerick: not that, no |
| 09:10 | a_strange_guy | Serialization in a Lispy way xD |
| 09:11 | AWizzArd | yes |
| 09:11 | SynrG | who 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:12 | AWizzArd | a_strange_guy: I am currently doing this |
| 09:12 | SynrG | here's the jline patch, in case it helps anyone: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576814 |
| 09:15 | cemerick | rhickey: given the potential for changes like that, is cross-version binary compat for AOT-compiled libs really a feasible objective? |
| 09:16 | triyo | I 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:16 | rhickey | cemerick: that's a particularly bad one, as a refactoring under fns |
| 09:17 | cemerick | triyo: defrecord is the proposed new name for deftype; and yes, defstruct is obsolete :-) |
| 09:17 | npoektop | it there a way to coerce a list to set and check if this set is equal to some another? |
| 09:17 | a_strange_guy | triyo: yes, a deftype variation which should do everything defstruct did |
| 09:18 | triyo | oh so it is "deftype" ok thanks. |
| 09:18 | cemerick | rhickey: well, OK, but I can't imagine that that's the last one like that to come down the pike. |
| 09:18 | a_strange_guy | deftype will then be much more low level than it is now |
| 09:18 | rhickey | cemerick: me neither |
| 09:20 | npoektop | how to coerce a list to set? |
| 09:20 | cemerick | Right, so I think AOT compilation needs to be reserved for deployment-stage packaging, rather than the default for library distribution. |
| 09:20 | cemerick | ,(set (list 1 2 3 4)) |
| 09:20 | clojurebot | #{1 2 3 4} |
| 09:20 | npoektop | cemerick, thank you |
| 09:21 | cemerick | That's obviously a policy issue rather than a tech one, but one worth talking about IMO. |
| 09:21 | carkh | cemerick: i'm not sure on that, what if people outside clojure want to use your library ? |
| 09:21 | cemerick | carkh: you mean people using it from Java, via generated classes? |
| 09:22 | carkh | yes |
| 09:22 | cemerick | I would consider that a sort of deployment. :-) |
| 09:22 | carkh | hehe ok |
| 09:23 | cemerick | Where deployment == letting code outside the clojure ecosystem, whether that's to a customer or to a non-clojure downstream dependent. |
| 09:23 | sattvik | The 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:24 | cemerick | rhickey: 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:25 | rhickey | cemerick: CL's #+ and #- ? |
| 09:25 | cemerick | I'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:25 | cemerick | rhickey: or something similar, yes |
| 09:26 | cemerick | I remember the idea was batted around, but dropped for later. |
| 09:29 | AWizzArd | cemerick: why do you try to require duck-streams? (vs io) |
| 09:30 | cemerick | AWizzArd: io is duck-streams (plus other stuff), circa 1.2 |
| 09:31 | AWizzArd | yes, but does your code not expect to run on 1.2? |
| 09:31 | AWizzArd | You want it to run also on 1.1? |
| 09:32 | cemerick | AWizzArd: this is code in third-party libraries that I'm updating to be usable in either environment. |
| 09:33 | cemerick | We're actually still using 1.1 contrib, with some build of clojure from ~February. |
| 09:41 | spariev | where can I read more on the new 'scopes' feature ? |
| 09:42 | spariev | can't find anything at Assembla |
| 09:45 | spariev | except the http://www.assembla.com/spaces/clojure/tickets/2-scopes |
| 09:45 | sexpbot | #2 - Scopes (New) | Clojure | Assembla |
| 09:47 | Raynes | The 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:48 | Raynes | It should actually be useful rather than disrupting now. |
| 09:49 | AWizzArd | rhickey: are there plans to get the Cells code soon into Master? |
| 09:50 | rhickey | AWizzArd: I'm still sleeping on Cells, i.e. thinking about them |
| 09:50 | spariev | are cells and scopes the same ? |
| 09:52 | rhickey | hrm, SpringSource buys RabbitMQ |
| 09:58 | stuarthalloway | rhickey: do you have a suggested rename for Chas' << macro? |
| 09:59 | rhickey | stuarthalloway: where is that? |
| 09:59 | stuarthalloway | clojure.contrib.strint (string interpolation) |
| 10:00 | rhickey | I don't see that here: http://richhickey.github.com/clojure-contrib/index.html |
| 10:00 | sexpbot | clojure-contrib - Overview |
| 10:02 | cemerick | rhickey: stu was referring to this: http://github.com/richhickey/clojure-contrib/commit/b9db2805f9571d52d5f0bb0b726fee1ca70c821d |
| 10:02 | sexpbot | Commit b9db2805f9571d52d5f0bb0b726fee1ca70c821d to richhickey's clojure-contrib - GitHub |
| 10:02 | stuarthalloway | sorry, got bounced. back now |
| 10:02 | cemerick | whose sexpbot is plinging URL titles everywhere? |
| 10:03 | cemerick | sexpbot: who owns you? |
| 10:03 | Raynes | cemerick: I own him. |
| 10:04 | cemerick | stuarthalloway: I'm slowly settling on <~, through lack of alternative suggestions. |
| 10:05 | Raynes | I suspect that by the end of next year, we'll have every possible arrow-shaped function name combination possible. |
| 10:05 | stuarthalloway | cemerick: I am also fine with the name collision, unless << will be a name in core |
| 10:06 | cemerick | stuarthalloway: that's my presumption. |
| 10:06 | cemerick | Raynes: indeed |
| 10:07 | cemerick | I 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:07 | rhickey | stuarthalloway: I'm not sure I like it |
| 10:07 | Raynes | Are all github titles generally long and irrelevant with self-explanatory URLs? :o |
| 10:07 | stuarthalloway | rhickey: what is the "it" reference currently pointing to? |
| 10:08 | rhickey | << |
| 10:08 | stuarthalloway | the name or the lib at all/ |
| 10:08 | rhickey | the lib |
| 10:08 | stuarthalloway | sigh |
| 10:08 | rhickey | exceptions as control flow |
| 10:08 | rhickey | new meaning for {}s |
| 10:09 | stuarthalloway | the former bothers me, the latter not so much |
| 10:09 | stuarthalloway | we rubyists love some interpolation |
| 10:09 | stuarthalloway | and are accustomed to having a dsl baked into string literals |
| 10:10 | cemerick | rhickey: there's no alternative approach for doing what silent-read does AFAIK |
| 10:10 | cemerick | FWIW, I get more mail about strint (mostly "thanks for that") than anything else I've ever posted online. |
| 10:10 | stuarthalloway | cemerick: I wondered if we could narrow the exception being handled, but other than that... |
| 10:10 | cemerick | 'course, I'm not so popular anyway, so that's likely irrelevant. |
| 10:11 | rhickey | cemerick: really? you could track \{ \} \( \) |
| 10:12 | cemerick | rhickey: 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:13 | rhickey | then why catch it at all? |
| 10:13 | rhickey | is it not an error? |
| 10:15 | stuarthalloway | rhickey: that works for me |
| 10:15 | cemerick | rhickey: no, it's not an error. consider (<< "foo ~(not a form") |
| 10:15 | stuarthalloway | cemerick: why would you every do that? |
| 10:15 | stuarthalloway | s/every/ever |
| 10:16 | rhickey | cemerick: seems wrong to me, either ~ is escaping or it isn't |
| 10:16 | rhickey | not based on what follows |
| 10:16 | rhickey | or ~( is escaping, whatever |
| 10:17 | stuarthalloway | rhickey: the other issue, repurposing { and (, is interesting |
| 10:18 | rhickey | stuarthalloway: () isn't really repurposing |
| 10:18 | rhickey | still a call |
| 10:18 | rhickey | but {foo} is not a map |
| 10:18 | stuarthalloway | would you like (<< "Here is ~foo") ? |
| 10:19 | cemerick | stuarthalloway: *I* wouldn't, but I was attempting to be defensive. |
| 10:19 | rhickey | when does ~foo end? |
| 10:19 | cemerick | right, you need some kind of terminal |
| 10:19 | rhickey | ~(quote foo) |
| 10:19 | clojurebot | amespaces 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:19 | rhickey | kind of long |
| 10:20 | rhickey | and not quite correct |
| 10:20 | rhickey | ~(identity foo) works of course |
| 10:20 | clojurebot | Foo is not Baz. |
| 10:20 | rhickey | aargh clojurebot |
| 10:21 | stuarthalloway | there's another repurposing problem :-) |
| 10:21 | rhickey | so first issue, using unreadability as a determinant of an escape clause |
| 10:21 | stuarthalloway | "sorry, your feature request has been rejected because it conflicts witn an irc bot..." |
| 10:21 | rhickey | second issue, repurposing {} |
| 10:22 | rhickey | cemerick: do you get my point re: escaping? |
| 10:22 | cemerick | rhickey: any kind of ~(some-form single-value) is too long for simple value interpolation IMO |
| 10:22 | rhickey | cemerick: I understand |
| 10:22 | stuarthalloway | cemerick: with you on issue 2, but with rich on issue 1 |
| 10:23 | rhickey | in 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:24 | rhickey | ~foo~ ? |
| 10:24 | clojurebot | Pardon? |
| 10:24 | rhickey | aargh |
| 10:24 | LeNsTR | (-: |
| 10:24 | Raynes | At least my bot only speaks out of turn when someone mentions a non-github/paste url. :> |
| 10:25 | cemerick | rhickey: 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:25 | cemerick | escaping* |
| 10:26 | rhickey | cemerick: how does one take a string that might contain ~s and make it safe for << ? |
| 10:27 | rhickey | try reading after each ~? |
| 10:27 | rhickey | it doesn't work |
| 10:27 | cemerick | rhickey: oh, I thought you were just after avoiding the exception handling as control flow. |
| 10:28 | rhickey | cemerick: that was a sign of something wrong, this is what's wrong |
| 10:33 | zakwilson | Anybody 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:35 | bsteuber | zakwilson: 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:35 | bsteuber | *it's always fun |
| 10:35 | cemerick | rhickey: the simplest escape would likely be (<< "~{\\~}{dont-eval-this}") |
| 10:36 | cemerick | but bare ~s are just fine of course |
| 10:37 | stuarthalloway | zakwilson: do you want an applet, or just swing? |
| 10:37 | bsteuber | what's <<? any quick links available? |
| 10:37 | zakwilson | stuarthalloway: an applet. I have the basics of Swing working in a standalone application. |
| 10:37 | cemerick | bsteuber: it's in contrib, though likely not for long. See http://muckandbrass.com/web/x/AgBP |
| 10:38 | rhickey | cemerick: I don't understand ~{\\~} |
| 10:38 | zakwilson | bsteuber: That is, indeed entertaining, but there are some Clojure-specific issues with applets, like reflection prompting security warnings. |
| 10:38 | cemerick | rhickey: that hands \~ to the reader |
| 10:39 | bsteuber | cemerick: thx, sounds nice |
| 10:39 | zakwilson | Well, I guess that's not entirely Clojure-specific, but it's something that must be actively avoided with Clojure and not with Java. |
| 10:39 | cemerick | to be clear, the only time ~s have to be escaped are when they preceed balanced {'s or ('s |
| 10:39 | rhickey | no, when they precede { or ( |
| 10:39 | bsteuber | zakwilson: oh, I didn't know |
| 10:40 | rhickey | although { not likely to survive |
| 10:40 | cemerick | ah, right, I removed the checks for balancing braces and parens |
| 10:40 | rhickey | ~( is an escape for this thing, special, presumes ~ followed by a readable list form |
| 10:40 | clojurebot | 'Sea, mhuise. |
| 10:41 | AWizzArd | << is already used for Cells |
| 10:41 | rhickey | << not likely |
| 10:41 | AWizzArd | << and >> |
| 10:41 | cemerick | rhickey: well, some other balanced chars are needed for single values. |
| 10:41 | rhickey | ? |
| 10:42 | cemerick | if you're strongly against ~{some-value} |
| 10:42 | hoeck | ~/v/ ? |
| 10:42 | clojurebot | Excuse me? |
| 10:42 | bsteuber | so if string interpolation makes it into clojure, shouldn't it be given a reader macro? maybe `"foo ~" ? |
| 10:43 | rhickey | ~<foo> ? |
| 10:43 | clojurebot | Titim gan éirí ort. |
| 10:44 | hugod | ~@[foo] |
| 10:44 | clojurebot | I don't understand. |
| 10:45 | rhickey | are you expecting things other than literals and symbols in ~{} ? |
| 10:45 | cemerick | rhickey: no |
| 10:46 | cemerick | rhickey: just to clarify, your objection is the {} association with maps? |
| 10:46 | rhickey | yes |
| 10:46 | stuarthalloway | ~<problem solved!> |
| 10:46 | clojurebot | excusez-moi |
| 10:47 | rhickey | stuarthalloway: right, that's what I suggested, to silence :) |
| 10:47 | rhickey | except ~<problem solved> would not be legal |
| 10:47 | rhickey | if ~< triggers a scan for > and a read of one item in between |
| 10:48 | cemerick | hugod: I suspect the association with vectors would be a negative there, although I like the @ being involved to indicate a single value. |
| 10:48 | stuarthalloway | rhickey: 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:49 | cemerick | rhickey: I was pondering <>. They don't really mean anything. () is obviously familiar, and {} is familiar to everyone who as used ${}. |
| 10:49 | rhickey | but () does what it normally does, {} wouldn't |
| 10:50 | rhickey | has used ${} where? |
| 10:50 | stuarthalloway | part of the reason that I like {} is that we are talking about contrib, not clojure. this is where we try things |
| 10:50 | cemerick | ~() invokes the form inside, but there is an implied str call. The semantics are different inside the interpolated string, necessarily so. |
| 10:50 | clojurebot | You don't have to tell me twice. |
| 10:50 | cemerick | oy |
| 10:51 | rhickey | stuarthalloway: we are a few decisions away from reader support for this |
| 10:51 | cemerick | rhickey: you need to announce things like that :-P |
| 10:51 | stuarthalloway | zoinks! cool |
| 10:51 | cemerick | rhickey: if we're going for reader support, then I'd like to put full-on heredocs on the table. |
| 10:52 | AWizzArd | ~max people |
| 10:52 | clojurebot | max people is 274 |
| 10:52 | rhickey | cemerick: that's not a property of ~{}, it's a property of <<, which if it was called str<> or something would be more descriptive |
| 10:52 | AWizzArd | wow, again more :) |
| 10:52 | npoektop | is 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:53 | AWizzArd | npoektop: look at http://java.sun.com/javase/6/docs/api/java/util/concurrent/ArrayBlockingQueue.html |
| 10:53 | cemerick | rhickey: I'd suggest ~@some-value, and if trailing whitespace is an issue, then one would need to do ~(identity some-value)blah |
| 10:53 | rhickey | cemerick: 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:54 | rhickey | no one answered as to where ${} is standard |
| 10:54 | AWizzArd | "\~(is unescaped)" |
| 10:54 | cemerick | rhickey: shell scripting |
| 10:54 | rhickey | ugh |
| 10:54 | cemerick | yes, ugh, but incredibly common :-) |
| 10:54 | AWizzArd | rhickey: http://docs.codehaus.org/display/BOO/String+Interpolation also talks about ${} |
| 10:54 | sexpbot | String Interpolation - BOO - Codehaus |
| 10:54 | _fogus_ | rhickey: Ant |
| 10:54 | rhickey | cemerick: yes and full of other stuff we'll never do |
| 10:55 | npoektop | AWizzArd, ok, thank you |
| 10:55 | cemerick | rhickey: doubling the ~s seems reasonable to me |
| 10:55 | rhickey | cemerick: one problem with that is when you are in the middle os some large thing, difficult to match pairs of ~s |
| 10:55 | cemerick | rhickey: of course, my standards for a library I wrote for me are a lot lower than your standards for the clojure reader :-) |
| 10:56 | AWizzArd | cemerick: "~(escaped)" and "~~(not escaped)"? |
| 10:56 | cemerick | rhickey: why do you need to match pairs? |
| 10:56 | cemerick | AWizzArd: yeah |
| 10:56 | rhickey | cemerick: so you can tell what's inside and what's outside |
| 10:57 | rhickey | a~b~c~d~e~f |
| 10:57 | cemerick | rhickey: yeah, I'm not following. Aren't we talking about "~(will-be-invoked)" vs "~~(will-not-be-invoked)"? |
| 10:58 | rhickey | sorry, no, I thoght we were taking about ~foo~ single thing |
| 10:58 | cemerick | oh, no |
| 10:58 | rhickey | double ~~ for unescape are fine |
| 10:58 | cemerick | I quite hate ~foo~ |
| 10:59 | rhickey | so, ~<foo> then ? |
| 10:59 | stuarthalloway | rhickey: +1 on cemerick's vote for full heredocs |
| 10:59 | rhickey | aargh |
| 10:59 | cemerick | I actually suggested ~@foo for single values, and forcing a ~(identity foo) if you didn't have trailing whitespace. |
| 10:59 | rhickey | heredocs being the make your own delimiter thing? |
| 10:59 | cemerick | rhickey: ^^ |
| 10:59 | cgrand | why ~~ over \~ ? |
| 11:00 | cemerick | cgrand: it'd end up being \\~ |
| 11:00 | cgrand | not with reader support |
| 11:00 | cemerick | hrm, that's a point |
| 11:00 | rhickey | cgrand: agreed |
| 11:00 | cemerick | in that case, definitely \~ |
| 11:01 | rhickey | cemerick: I think you'll find more cases requiring identity than you'd like |
| 11:01 | rhickey | 2 of your 3 samples |
| 11:02 | cgrand | devil advocate: actually "\~" makes the reader throws an exception, so why not to reverse the role of \~ and ~. Hence no breaking change |
| 11:02 | cemerick | rhickey: 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:02 | rhickey | cemerick: how does it differ from {}? |
| 11:03 | rhickey | more angly? |
| 11:03 | cemerick | {}'s are narrower, and less obtrusive than <> |
| 11:03 | cemerick | {a} vs <a> |
| 11:04 | cemerick | And really, there is a *lot* of currency in {} for value substitution, despite one's position on shell scripting. :-) |
| 11:04 | rhickey | what if ~[a] workd as well as ~[a b c], the latter being effectively (str a b c) ? |
| 11:05 | rhickey | cemerick: but it comes with $ too, no? |
| 11:05 | cemerick | rhickey: aren't we squashing vector syntax there, just like {} would have? |
| 11:05 | ipostelnik | is anyone using lein with IntelliJ's TeamCity? |
| 11:05 | cemerick | well, we just use ~ instead of $. It's precarious, but just enough of a lineage. |
| 11:05 | rhickey | cemerick: but it is a vector of one or more things to be interpolated, vs {x} which is a broken map |
| 11:06 | rhickey | and supporting ~[a b c] I think will prove quite useful |
| 11:06 | cemerick | I agree. |
| 11:06 | cemerick | rhickey: how about ~@foo, which stops glomming the symbol at whitespace, or an optional terminating @? |
| 11:07 | rhickey | it's not a deref |
| 11:07 | cemerick | no, but as a value substitution, @ is a lot closer than {} or [] |
| 11:07 | rhickey | and ~@foo will actually work right now, no? |
| 11:08 | rhickey | ~(deref foo) |
| 11:08 | clojurebot | foo is is Short, Self Contained, Correct (Compilable), Example http://sscce.org/ |
| 11:08 | sexpbot | Execution Timed Out! |
| 11:08 | cemerick | rhickey: not in a string, no :-) |
| 11:09 | rhickey | I think ~() and ~[] are clean: ~(the-result-of-this call), ~[these things] |
| 11:10 | cemerick | and ~[1 2 3] yields "1 2 3" and not "[1 2 3]" or "(1 2 3)"? |
| 11:10 | rhickey | ~[1 2 3] => 123 |
| 11:10 | clojurebot | the world <reply>what the world needs is more higher order functions |
| 11:10 | rhickey | like str |
| 11:11 | cemerick | what would ~(interpolate \, (range 3)) return? |
| 11:12 | rhickey | what's interpolate? |
| 11:12 | cgrand | interpose I guess |
| 11:12 | cemerick | yeah, sorry, interpose. Interpolation on the brain this morning I guess. |
| 11:13 | rhickey | "clojure.lang.LazySeq@1c8e20a" |
| 11:14 | cemerick | so I figured. |
| 11:15 | @chouser | "My name is ~|name|" |
| 11:15 | rhickey | using ~@(a call) for splicing would have precedent |
| 11:15 | rhickey | could be given an interpretation for () and [] |
| 11:17 | cgrand | ~[1 2 3] vs ~@[1 2 3] |
| 11:17 | clojurebot | use vs require is (:use [lib :only [a b c]) or (:require [lib :as alias]) -- (:use lib) is only for playing around |
| 11:17 | rhickey | you could also just use ~(foo) and say no-arg functions need to be written ~(identity (rand)) |
| 11:18 | cemerick | ouch |
| 11:19 | rhickey | cgrand: one include spaces, the other not? |
| 11:20 | rhickey | chouser: || have the matching problem |
| 11:20 | rhickey | a|b|c|d|e |
| 11:20 | cgrand | rhickey: and if I want commas instead of spaces? |
| 11:20 | rhickey | cgrand: use interpose |
| 11:20 | cgrand | ok |
| 11:21 | rhickey | bigger issue for ~@(sequence-fn foo) |
| 11:21 | rhickey | must choose space or not |
| 11:22 | rhickey | should be not I think |
| 11:24 | @chouser | oh, "My name is ~|"C~|"houser"|.... yikes I guess that is a problem. |
| 11:24 | rhickey | I think ~[first " " last ", " title] is likely to be the most succinct thing ever |
| 11:24 | bsteuber | how about just saying ~ reads the next token using the clojure reader? this would allow for "Name: ~name, ..." as well as ~() and ~[] |
| 11:24 | rhickey | vs a bunch of separate escapes |
| 11:24 | cgrand | what about not special casing ~[]? if one symbol is not followed by a symbol terminator (whitespace + macro chars - #) then go with ~@[] |
| 11:24 | bsteuber | and even ~{} as soon as so. proposes a nice semantics for map |
| 11:24 | bsteuber | maps |
| 11:25 | rhickey | bsteuber: because the reader uses whitespace for termination |
| 11:25 | rhickey | cgrand: ? |
| 11:25 | bsteuber | rhickey: oh, so ()() is illegal clojure code? |
| 11:26 | rhickey | bsteuber: not what I said |
| 11:26 | AWizzArd | ) is also a terminator |
| 11:26 | bsteuber | but if whitespace, ), ] and } all are terminators we're fine, aren't we? |
| 11:27 | rhickey | bsteuber: no, since you can't read e.g. symbols or numbers without whitespace separation |
| 11:27 | rhickey | begging the question as to whether you want whitespace in the string or not |
| 11:28 | rhickey | and if so, how to get it |
| 11:28 | cgrand | rhickey: to simply say that in cases such as "My name is ~name." one has to write "My name is ~@[name]." |
| 11:28 | rhickey | cgrand: what is the prupose of @ there? |
| 11:28 | rhickey | purpose |
| 11:29 | rhickey | so people can print vectors as strings? |
| 11:30 | bsteuber | I'd say "Name: ~name ..." gives "Name: foo ...", so it includes the whitespace - use ~() or ~[] in the other case |
| 11:30 | AWizzArd | Will string interpolation be used for more than simple things? Typically I imagine people will just inline vars, no? Sometimes short code fragments. |
| 11:31 | cgrand | rhickey: the pupose of @ here is to not add a special case/meaning for ~[] |
| 11:32 | rhickey | cgrand: and will always have no spaces? |
| 11:32 | bsteuber | cgrand: good Idea |
| 11:32 | cgrand | yes always, ~@ would be apply str |
| 11:33 | rhickey | that makes the single item case more verbose than the original ~{x} |
| 11:33 | cgrand | by one char |
| 11:33 | bsteuber | so ~ := (str next-legal-clojure-token), ~@ := (apply str (seq next-token)) |
| 11:33 | bsteuber | that would be very logical |
| 11:34 | AWizzArd | Why again not (println "Hello ~name")? |
| 11:34 | rhickey | bsteuber: ~ can't mean next token, as explained above |
| 11:34 | AWizzArd | ~some-var-here |
| 11:34 | clojurebot | I don't understand. |
| 11:34 | cemerick | AWizzArd: what would (print "Hello ~name.") do? |
| 11:35 | cgrand | rhickey: are you planning to add support for interpolation in all strings? or interpolated-strings will get their own metachar? |
| 11:35 | rhickey | cgrand: I think you are saving ~[x] for nothing |
| 11:36 | rhickey | would rarely be used, and can do with ~(identity [x]) |
| 11:36 | bsteuber | rhickey: sorry, still didn't understand the terminate problem |
| 11:36 | bsteuber | /me feels stupid |
| 11:37 | AWizzArd | cemerick: (print (str "Hello " name)) |
| 11:37 | cemerick | AWizzArd: and the period? |
| 11:37 | rhickey | bsteuber: see cemerick 's last ^^ |
| 11:37 | AWizzArd | what period? |
| 11:38 | bsteuber | ~name. would be "undefined behaviour", I guees (best would be an exception) |
| 11:38 | clojurebot | namespaces 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:38 | cgrand | rhickey: true, and I'm pondering giving [] more "special powers" (eg :sep to specify separator) |
| 11:38 | bsteuber | or maybe not |
| 11:38 | rhickey | jeez clojurebot |
| 11:38 | bsteuber | if name. is a legal class |
| 11:39 | rhickey | ~@,[a b c] => 1,2,3 |
| 11:39 | clojurebot | whose job is<reply>that is ts00000s job |
| 11:40 | rhickey | would work for ~@,(seq-fn ...) too |
| 11:40 | cemerick | rhickey: that is getting into scary FORMAT territory, it seems |
| 11:40 | cgrand | but only for one char separator, I like a space after my comma |
| 11:40 | rhickey | cgrand: why only one? ~@, [a b c] |
| 11:41 | cemerick | rhickey: oh, no, please no. :-( |
| 11:41 | rhickey | the reader could do that |
| 11:41 | cgrand | ending at the [? |
| 11:41 | rhickey | cgrand: [ or ( |
| 11:42 | AWizzArd | should not the most common usecase be priority? |
| 11:43 | rhickey | #~"string with interpolation" ? |
| 11:43 | _fogus_ | rhickey: the best I've seen |
| 11:44 | bsteuber | yeah, #~ might be okay |
| 11:44 | AWizzArd | okay, and then inside? |
| 11:44 | cgrand | well, after ~ or ~@ I expect to read clojure code, so I tend to read ", " in "~@, [a b c]" as whitespace |
| 11:45 | rhickey | ~@|, |{a b c] |
| 11:45 | clojurebot | Alles klar |
| 11:46 | rhickey | more generally, ~@|sep|[a b c] |
| 11:46 | cemerick | This is an unfriendly rabbit hole. |
| 11:46 | rhickey | cemerick: how so? |
| 11:47 | cgrand | rhickey: if you are going this route why not ~@", "[a b c] (but I don't like this ~@somthing[foo] |
| 11:47 | cemerick | Lots of complexity is growing up to support relatively little functionality. |
| 11:47 | AntonyBlakey | A 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:47 | rhickey | it'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:47 | cemerick | 99.5% of people want string *interpolation*, not a weak templating language with obtuse syntax. |
| 11:47 | AWizzArd | (println #~"Hello ~name$, 1+1 = ~(+ 1 1)$") |
| 11:48 | rhickey | cgrand: did you notice vertical bars always? |
| 11:48 | rhickey | seeing the "s might look like end-of-string |
| 11:49 | AWizzArd | yes |
| 11:49 | AWizzArd | so that #~"abc~x$def" is possible, even wher (def x "10") and (def xdef "20") |
| 11:49 | cemerick | rhickey: 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:50 | cemerick | This is the direction of FORMAT, which I simply never want to bother with. |
| 11:51 | AWizzArd | maybe then a most simple interpolation that just allows putting clojure vars into the string is fine? |
| 11:51 | AWizzArd | That would cover, say, 95% of all cases? |
| 11:51 | AWizzArd | for the rest there is str and format |
| 11:51 | rhickey | cemerick: then you can use ~[first] ~[last] when everyone else is doing ~[first last] |
| 11:52 | rhickey | cemerick: it's not a big oat of semantics, just splicing |
| 11:52 | cemerick | rhickey: people won't just be doing ~[first last], they'll be doing ~@|blah|(some-call foo) |
| 11:52 | rhickey | not an oat nor a boat :) |
| 11:53 | cemerick | rhickey: 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:53 | rhickey | cemerick: and you'd rather they do ~(apply str (interpolate blah (some-call foo))) |
| 11:54 | rhickey | cemerick: I disagree, this is following syntax-quote, not format |
| 11:55 | rhickey | syntax-quote being *the* template model |
| 11:55 | cemerick | rhickey: 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:55 | bsteuber | so which example would break this naive approach? |
| 11:55 | bsteuber | ,(let [s "Name: ~name"] (read-string (subs s (inc (.indexOf s "~"))))) |
| 11:55 | clojurebot | name |
| 11:55 | AWizzArd | (println #~"Good morning [first-name] [last-name], todays date: [(date)]") |
| 11:55 | rhickey | bsteuber: please give up that line, thanks |
| 11:55 | AWizzArd | or {} instead of [] |
| 11:56 | cemerick | rhickey: as soon as you add custom delimiters, you're into format. |
| 11:56 | rhickey | cemerick: nah |
| 11:56 | bsteuber | rhickey: okay, sorry for getting on your nerves |
| 11:56 | AWizzArd | I think rhickeys idea with #~"" is helpful. |
| 11:57 | rhickey | cemerick: I find interpolated strings with successive ${this}${that}${the-other} quite ugly |
| 11:58 | Licenser | greetings my lispy friends |
| 11:58 | cemerick | rhickey: hrm, but ~@|blah|(some-call foo) is pretty? 0.0 |
| 11:58 | rhickey | and would greatly prefer ~[this that the-other] |
| 11:58 | cemerick | rhickey: I've no problem with that at all. |
| 11:59 | rhickey | cemerick: the most common cases, space or not, wouldn't require || |
| 11:59 | rhickey | but saying blah is unfair, as that is never the delimiter |
| 11:59 | cemerick | ok: ~@,(some-call foo) |
| 11:59 | rhickey | and would greatly prefer ~@|,|[this that the-other] |
| 11:59 | AWizzArd | so, 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:00 | hiredman | :( |
| 12:00 | cemerick | rhickey: again, I'd much rather see people let (apply str (interpose \, [this that other])), and drop it into the interpolated string. |
| 12:00 | Chousuke | what's the problem with implementing this as a macro? |
| 12:01 | cemerick | Chousuke: I already did, inclusion in the reader is on the table |
| 12:01 | rhickey | cemerick: then you don't need string interpolation, only str. |
| 12:02 | cemerick | rhickey: interpolation is dropping values into strings for UI purposes, mostly, not generating strings. |
| 12:02 | cemerick | in that context, str is far too verbose, and simple value substitution or fn invocation is totally sufficient |
| 12:02 | Chousuke | I guess as a reader macro it could be somewhat neater if you do things like "bar ~(foo "someotherstring")" |
| 12:03 | Chousuke | but that will confuse emacs greatly ;P |
| 12:03 | AWizzArd | people won’t use it for that purpose |
| 12:03 | AWizzArd | nothing with another pair of double quotes |
| 12:03 | rhickey | (str "My name is:" name) vs (<< "My name is:~{name}") - I don't see the big win |
| 12:03 | AWizzArd | only for simple things, otherwise everyone will use str or format |
| 12:03 | cemerick | rhickey: e.g. (<< "The total due of ~{total} is due on ~{due-date}.") |
| 12:04 | AWizzArd | (println #~"My name is: {name}") |
| 12:04 | cemerick | or, (<< "total due of ~(total-due customer-id) is due on ~(this-months-due-date)"), etc |
| 12:05 | AWizzArd | why do we need ~ when #~"" already tells Clojure that we have an interpolated string here? |
| 12:05 | rhickey | (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:06 | Licenser | many langauges use ' vs " so we kind of don't have this option since ' is already used |
| 12:06 | Licenser | how about `interpreted string` |
| 12:06 | AWizzArd | #~"The total due of {total} is due on {due-date}." |
| 12:06 | rhickey | AWizzArd: please stop this speculation without thinking it through, thanks |
| 12:06 | AntonyBlakey | Licenser: ` isn't available |
| 12:06 | Licenser | ´? |
| 12:07 | rhickey | cemerick: I guess I don't get what you mean by UI above |
| 12:07 | Licenser | but yea it looks too much like ` I guess |
| 12:07 | dnolen | rhickey: 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:08 | rhickey | dnolen: but being a macro, enacting the substitution programatically is substantially less than a true dynamic string template |
| 12:09 | cemerick | rhickey: constantly having to pound away at quotes to keep the strings happy gets *very* irritating, which is why str isn't sufficient. |
| 12:09 | rhickey | cemerick: you just trade {s for "s |
| 12:09 | cemerick | rhickey: by "UI", I mean that interpolation is almost always used in connection with generating messages for display in user interfaces. |
| 12:09 | rhickey | cemerick: same delimiter count |
| 12:10 | cemerick | rhickey: no, because I can rewrite the base message without bothering with quotes at all. |
| 12:10 | Licenser | I wrote a simpe code that replaced sexp's expressions in strings with the result of the evaluateion, might that help? |
| 12:11 | cemerick | Licenser: like this? ;-) http://muckandbrass.com/web/display/~cemerick/2009/12/04/String+Interpolation+in+Clojure |
| 12:11 | cemerick | rhickey: I mean, technically you're right about delimiters, functional equivalence, etc. But in practice, pushing around separate strings ends up being a hassle. |
| 12:11 | rhickey | cemerick: 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:12 | Licenser | cemerick: somewhat just more verbose and propably slower :P |
| 12:12 | rhickey | without editor highlighting support, the interpolated ones will be much harder to scan |
| 12:12 | rhickey | plus str is a function, a huge benefit |
| 12:12 | AWizzArd | hmm yes |
| 12:14 | cgrand | hmm, fun fact: "\(" and "\[" are not valid strings so "Name: \[name], Tags: \(interpose ", " tags)" can be an interpolated string :-) |
| 12:14 | Licenser | I 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:14 | cemerick | good point Licenser, I hadn't mentioned l18n yet :-) |
| 12:16 | rhickey | cemerick: so, let's talk. You've got your strings in a translatable file, how are you going to turn them into macro calls? |
| 12:16 | cgrand | cemerick: 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:17 | cemerick | heh |
| 12:17 | rhickey | technomancy: format also a function, ditto pprint |
| 12:17 | cemerick | cgrand: yes, it'd be a compile-time (or macro-expansion-time) selection of a language, for example |
| 12:18 | cemerick | e.g. (<< (find-l18n-msg "customer-total-due")), etc |
| 12:18 | cemerick | rhickey: ^^ |
| 12:18 | cemerick | that's not nice in a lot of ways, but all l18n strategies have roughly the same approach. |
| 12:18 | sattvik | Well, 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:19 | cemerick | sattvik: it's not my goal necessarily, I've not worked on l18n or i18n at all in this context. |
| 12:19 | rhickey | cemerick: where find-l18n-msg is itself a macro? so << does internal macroexpansion? |
| 12:19 | rhickey | you don't really want <<, you want something like format for this |
| 12:19 | cemerick | rhickey: 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:19 | Licenser | why not make << a function? |
| 12:20 | AWizzArd | Licenser: << is already used for Cells. |
| 12:20 | cemerick | rhickey: that was pseudocode, nothing I've implemented yet. |
| 12:20 | Licenser | AWizzArd: or whatever it is called |
| 12:20 | rhickey | cemerick: maybe in that uncolored paste-bin. but not in aquamacs |
| 12:21 | rhickey | not only better highlighted, but matching etc is in play |
| 12:21 | cemerick | rhickey: and in my colored enclojure :-) |
| 12:21 | cemerick | tons of spurious double-quotes are very distracting |
| 12:21 | Licenser | I think whatever does string 'evaluate' (I dare co all it that way) should not be a macro but a function |
| 12:22 | Licenser | if speed is an issue you can wrap it in a memorizer |
| 12:22 | rhickey | cemerick: that's just arbitrary, what about spurious {}s ? what about delimiter matching? |
| 12:22 | cgrand | cemerick: str is easier to read than << if you have syntax highlighting https://gist.github.com/833d196c298614d53492 |
| 12:22 | cemerick | rhickey: 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:22 | rhickey | cgrand: thaks |
| 12:22 | rhickey | thanks |
| 12:23 | Licenser | cgrand: if interpreted strings are a language feature they can be highlighted just as well :P |
| 12:23 | cgrand | of course tools can learn to colorier interpolated strings too |
| 12:23 | Licenser | ruby's evaluated strings are highlighted just fine |
| 12:24 | cgrand | s/colorier/colorize/ |
| 12:24 | Licenser | I guess the argument against evaluated strings is that clojure, as a lisp should have minimal syntax? |
| 12:25 | hiredman | more syntax to hilight :( |
| 12:25 | cemerick | rhickey: 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:25 | rhickey | cemerick: and all the ~{} isn't in the way of the message? |
| 12:25 | rhickey | this is just arbitrary |
| 12:25 | jfields | I miss string interpolation also, but I think it's an aesthetic issue, not a logic one. |
| 12:26 | jfields | while I prefer working with ruby's string interpolation, Rich's logic is sound. |
| 12:26 | cemerick | rhickey: comparatively, no. Again, I'm not going to say it's more efficient or functional than str. |
| 12:26 | cemerick | jfields: +1 |
| 12:26 | cgrand | Licenser: 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:27 | Licenser | I personally would go for a c.c or c.l function that does the stuff |
| 12:27 | Licenser | no language interna |
| 12:27 | rhickey | cgrand: also editor support of brace matching etc, will that work inside a string (even if highlighting works)? |
| 12:27 | Licenser | cgrand: yap it is just estetics |
| 12:27 | bsteuber | my 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:27 | jfields | when 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:28 | jfields | that 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:29 | clojurebot | "The average of 5 and 2 is 7" |
| 12:29 | cgrand | rhickey: I agree, as proposed it's a lot of added complexity to the reader and all the tools |
| 12:29 | cemerick | jfields: 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:29 | Fossi | Chousalmost |
| 12:29 | Fossi | chouser: almost |
| 12:29 | bsteuber | chouser: nice, the missing spaces really improve readability |
| 12:29 | AWizzArd | I don’t see a big difference in productivity. |
| 12:29 | rhickey | cemerick: vs something like str? Is that widely available? |
| 12:30 | Licenser | about str I don't like the ugy "." in the end :P |
| 12:30 | @chouser | Intersting, but the quotes end up feeling backwards of course. |
| 12:30 | cgrand | chouser: only in b&w |
| 12:30 | @chouser | cgrand: hm. |
| 12:30 | cemerick | rhickey: what's the special aspect of str vs. concatenation elsewhere? |
| 12:30 | Licenser | (let [str. (fn [& args] (str (apply str args) ".")) x 5 y 2] (str. "The average of "x" and "y" is "(/ (+ x y) 1))) |
| 12:31 | Licenser | ,(let [str. (fn [& args] (str (apply str args) ".")) x 5 y 2] (str. "The average of "x" and "y" is "(/ (+ x y) 1))) |
| 12:31 | clojurebot | java.lang.IllegalArgumentException: Unable to resolve classname: str |
| 12:31 | Licenser | heh not workling too sad |
| 12:31 | rhickey | cemerick: it calls str on its args |
| 12:31 | cgrand | chouser: http://paste.lisp.org/display/97726; vs https://gist.github.com/833d196c298614d53492 in b&w I prefer ~{}, in color str |
| 12:32 | Licenser | I think str and << put different priority |
| 12:32 | Licenser | str makes the variables stand out, << make the message as a whole the focus |
| 12:33 | @chouser | It'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:33 | bsteuber | so it turned out clojure already has string interpolation, just with the syntax "" XD |
| 12:34 | Raynes | What 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 | @chouser | I may have missed more the lack of string literals that can support unescaped double-quotes. But that's a different issue. |
| 12:34 | Raynes | One of them matches, and the other doesnt, but it's the same regex. |
| 12:34 | Licenser | chouser: 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:34 | Licenser | but I know your feeling |
| 12:34 | @chouser | Raynes: it's *not* the same regex. #"" has different escaping rules than "" |
| 12:35 | sattvik | I 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:35 | clojurebot | #"(?=.*bot(?!botters))^(\w+)" |
| 12:35 | rhickey | every 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 | @chouser | note that output has (\w+) |
| 12:35 | Licenser | that sayed I'd love a good lbirary :P |
| 12:36 | Licenser | rhickey: string interpolation can be a true function? |
| 12:36 | cemerick | rhickey: it's decidedly *not* superior :-) Just makes working with the common cases a little easier for many. |
| 12:36 | cemerick | That's why I never agitated for it to be in the reader. ;-) |
| 12:36 | @chouser | It's clear that a lot of people think they want it. :-) |
| 12:37 | cemerick | or, never agitated very strongly :-P |
| 12:37 | rhickey | chouser: yes, and I'm not trying to negate people's feelings, just understand them |
| 12:37 | jfields | rhickey: have you ever worked at length with a language that has interpolation? |
| 12:38 | @chouser | I wonder how much of it is the feeling of "nesting in" rather than "escaping out" |
| 12:38 | cemerick | python interpolation was a nice balance in particular, which would make a nice sister macro to << |
| 12:38 | cgrand | maybe we should try to find how to add more value to interpolated strings to justify them |
| 12:38 | rhickey | jfields: no, but I can't imagine ever preferring it much over format |
| 12:38 | jfields | much 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:38 | cgrand | eg to make them callables (#~"Name: ~%1" name) and/or (#~"Name: ~name" :name name) |
| 12:39 | rhickey | people that prefer interpolation over format just want to avoid passing the data as arguments? |
| 12:39 | @chouser | I'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:40 | rhickey | chouser: so, format does that |
| 12:40 | cgrand | rhickey: true, I focused on i18n |
| 12:40 | @chouser | of course the biggest weakness of format is the positional natured. |
| 12:40 | jfields | rhickey: yes, because it's easier to type "my name is jay and i work for company-x" |
| 12:40 | cemerick | right, it's the combination of insertion within a lexical context |
| 12:40 | @chouser | format doesn't support a map instead of seq, does it? |
| 12:40 | jfields | rhickey: vs "my name is name and I work for company-x", name, company-x |
| 12:40 | rhickey | chouser: no |
| 12:40 | jfields | and when you get used to interpolation you see it like what I typed, and you type it without thinking |
| 12:41 | rhickey | jfields: but no real, translatable program could be written that way, could it? |
| 12:41 | jfields | I'm actually not advocating at all |
| 12:41 | @chouser | of course the python named format is bad. "My name is %(name)s" |
| 12:41 | jfields | I prefer your attitude to purity, I'm just providing my point of view on it. |
| 12:41 | @chouser | that trailing "s" is a source of much trouble |
| 12:41 | rhickey | fair enough |
| 12:42 | rhickey | most large real programs end up with all their strings in a database, no? |
| 12:42 | Licenser | hmm I think the main issue is that we have not yet found a solution that solves 'all' issues |
| 12:42 | jfields | rhickey: definitely no |
| 12:42 | jfields | rhickey: I've been database free for 2 years. life is so much better |
| 12:43 | Licenser | interpreted strings should be A) simple B) readable c) work as/with pure functions d) fast of cause e) universal. Did I forgot anything? |
| 12:43 | rhickey | jfields: no international clients? No UI staff? |
| 12:43 | jfields | rhickey: correct. |
| 12:43 | rhickey | just coders for english clients |
| 12:44 | rhickey | so, when they want your app in a foreign lang you're screwed? |
| 12:44 | jfields | rhickey: 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:44 | rhickey | jfields: sorry, "real" was a bad choice |
| 12:45 | djpowell | this seems awfully complicated, i'm fine with str btw, or format for more complicated stuff |
| 12:45 | sattvik | ,(format "My name is %2$s. And I work for %1$s." "company-x" "Jay") |
| 12:45 | clojurebot | "My name is Jay. And I work for company-x." |
| 12:46 | @chouser | sattvik: well. Thanks for digging up that little detail. but ... ew. :-) |
| 12:46 | rhickey | sattvik: way to sell it! :) |
| 12:46 | djpowell | ,case |
| 12:46 | clojurebot | java.lang.Exception: Can't take value of a macro: #'clojure.contrib.fcase/case |
| 12:47 | jfields | rhickey: we use loads of Clojure. we have a few 3rd party simulators, some of our debugging tools, compliance logs, configuration, etc etc |
| 12:47 | jfields | most of those needs have maybe 2 dozen strings in them for messages, and never need to handle other languages |
| 12:47 | sattvik | chouser: Well.. It's not perfect. But it just shows that it has some flexibility. |
| 12:48 | rhickey | ok, 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:48 | rhickey | I don't like << |
| 12:49 | @chouser | ~[] is for uncalled symbol? |
| 12:49 | clojurebot | http://clojure.org/data_structures#toc10 |
| 12:49 | rhickey | chouser: ~[1 2 3] => 123 |
| 12:49 | rhickey | or, 1 2 3 |
| 12:49 | @chouser | oh! hm. |
| 12:49 | rhickey | so also, ~[foo] |
| 12:50 | @chouser | yeah, I think I like that. |
| 12:51 | rhickey | space question begs ~@ |
| 12:51 | @chouser | I see. |
| 12:51 | rhickey | could work on [] and ~@(calls-returning-seqs) |
| 12:52 | rhickey | finally (and distressing cemerick ), ~@|,|[1 2 3] => "1,2,3" |
| 12:52 | cemerick | rhickey: yeah, you're never going to get me on board with that :-P |
| 12:52 | rhickey | cemerick: and ~@? |
| 12:52 | cemerick | that's just out of scope for anything anyone would call string interpolation |
| 12:53 | rhickey | ~@(range 3) == ? |
| 12:53 | clojurebot | Titim gan éirí ort. |
| 12:53 | cemerick | rhickey: ~@[1 2 3] => "123"? |
| 12:53 | sattvik | If you want really flexible but really ugly, there are things like: |
| 12:53 | sattvik | ,(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:53 | clojurebot | "At 9:54:19 AM on Apr 13, 2010, there was a disturbance in the Force on planet 7." |
| 12:53 | @chouser | I assume ~@, [1 2 3] has already been rejected for "1, 2, 3" |
| 12:53 | rhickey | chouser: cgrand wanted comma+space |
| 12:53 | rhickey | I first said that |
| 12:53 | cemerick | chouser: yeah, you'd ostensibly be looking at ~@|, |[1 2 3] |
| 12:54 | a_strange_guy | so a single char doesn't need | ? |
| 12:55 | cemerick | rhickey: if my last msg @ you is true, then sure, I'm fine with ~@ |
| 12:55 | rhickey | cemerick: I think so, depends on the existence of ~@|sep| |
| 12:55 | @chouser | vs ~(str-join ", " [1 2 3]) |
| 12:55 | a_strange_guy | eg: ~@;[1 2 3] = "1,2,3" |
| 12:55 | a_strange_guy | sry ~@;[1 2 3] = "1;2;3" |
| 12:55 | Licenser | how about a general approach: (stringythingy <function> "<string with some kind of 'placeholder' that gets passed to function>") |
| 12:56 | cgrand | what 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:56 | Licenser | then you could call (stringythingy eval "1 + 1 = #{(+ 1 1)}'" |
| 12:56 | Licenser | or (stringythingy html-highlight "I can highlight code: #{(+ 1 1)}'") |
| 12:58 | @chouser | FWIW, 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 | @chouser | the fact is, cemerick's macro or one like it works pretty well with today's clojure |
| 12:59 | rhickey | cgrand: that's interesting |
| 12:59 | sattvik | cgrand: 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:00 | rhickey | chouser: we could go with cemerick's thing, using ~[] instead of ~{}, punt on multiple items in ~[] and ~@, with a different name |
| 13:00 | cgrand | sattvik: I forgot to prefix with #~ |
| 13:00 | sattvik | cgrand: Ah, ok. No problem. |
| 13:01 | cgrand | rhickey: (def << (partial apply str)) would then work |
| 13:02 | rhickey | cgrand: but not << |
| 13:02 | cgrand | the name? |
| 13:02 | cemerick | <~ was the alternative I was knocking around earlier |
| 13:02 | rhickey | could also do \() and \[] in ordinary strings, as not currently readable |
| 13:04 | rhickey | "My name is \[name] and I work for \(company-of name)" |
| 13:05 | cgrand | lpetit is going to be mad once he's back from vacation :-) |
| 13:05 | cemerick | rhickey: that'd be in the reader, on all strings? |
| 13:05 | rhickey | cgrand: but as a reader thing, yields what? splices in multiple forms? |
| 13:05 | rhickey | that can get very tricky |
| 13:06 | rhickey | cemerick: could be |
| 13:06 | cgrand | rhickey: currently I can't decide when to splice or not |
| 13:06 | cemerick | rhickey: your life gets a lot easier if you assume you're working with strings, period. |
| 13:06 | defn | i really like that... the "\[name] \(company-of name)", stuff from above |
| 13:06 | rhickey | are there multiple valid consumer fns for this? |
| 13:06 | cemerick | that's what people actually do, after all. |
| 13:11 | rhickey | cemerick: meaning you don't want the vector? |
| 13:12 | cemerick | rhickey: 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:12 | rhickey | cemerick: what do you mean more than one splicing approach? |
| 13:13 | cemerick | the ~@|sep| stuff |
| 13:13 | rhickey | something other than apply str? |
| 13:13 | cemerick | yes |
| 13:13 | rhickey | cemerick: well, using \ doesn't imply @ |
| 13:13 | rhickey | the way ~ does |
| 13:14 | cemerick | OK, so ~[] is always just (apply str ...)? |
| 13:14 | rhickey | cemerick: just str |
| 13:14 | cemerick | hrm, the vector syntax is throwing me now. So ~[1 2 3] => (str 1 2 3)? |
| 13:15 | @chouser | huh |
| 13:16 | @chouser | well, the point is that single-value inserts are the most common case, right? so "~[name]" is "Chouser" |
| 13:17 | rhickey | I'm not sure how much you would put off on the latter handler. This could just do string splitting |
| 13:18 | cemerick | I wouldn't mind that. ~@name is still appealing to me, but whatever. |
| 13:18 | rhickey | "a b \[1 2 3] \(four five) six" => ["a b " [1 2 3] " " (four five) " six"] |
| 13:19 | @chouser | I don't think I like something that looks like "..." returning a vector |
| 13:20 | @chouser | is it too weird to have "foo \[1]" expand to (interpolate "foo" 1) ? |
| 13:20 | rhickey | "a b \[1 2 3] \(four five) six" => ["a b " (str 1 2 3) " " (str (four five)) " six"] |
| 13:20 | @chouser | maybe with "interpolate" being unqualified so that you can exclude core's and provide your own?? :-/ |
| 13:20 | cgrand | rhickey: and then format could benefit from this reader support |
| 13:21 | rhickey | chouser: ick |
| 13:21 | @chouser | yeah, ok, I'm sorry. withdrawn. |
| 13:21 | cemerick | chouser: I was going to suggest a var available for binding to define an interpolate separator |
| 13:22 | rhickey | cgrand: not sure I see how format benefits |
| 13:22 | cgrand | why ["a b " (str 1 2 3) " " (str (four five)) " six"] rather ["a b " 1 2 3 " " (four five) " six"]? |
| 13:22 | rhickey | cgrand: could be, I'm just enumerating the possibilities |
| 13:23 | rhickey | either works with apply str |
| 13:23 | rhickey | if [1 2 3] flows though, as in the first example, I think that's a burden for downstream |
| 13:24 | rhickey | "a b \[1 2 3] \(four five) six" => ["a b " [1 2 3] " " (four five) " six"] |
| 13:24 | cgrand | (format++ "Date: \[a-date :fmt "YYYY-MM-dd"]") or (format++ "count: \[i :pad 4]") |
| 13:25 | rhickey | cgrand: that would want to see the vectors intact, no? |
| 13:26 | @chouser | cgrand: Those are interesting -- good argument for the reader staying out of the way (not wrapping in (str ...)) |
| 13:26 | cgrand | rhickey: yes, your latest expansion ["a b " [1 2 3] " " (four five) " six"] is the sanest |
| 13:26 | rhickey | cgrand: but means the simple case will have to ferret out vectors |
| 13:27 | rhickey | no longer apply str |
| 13:27 | cgrand | yep interpolate is no longer a 1-liner |
| 13:27 | @chouser | these will always alternate: string something string something ... |
| 13:28 | cgrand | chouser: it depends, how do you expand "\[foo]\[bar]": with an empty string in between or not? |
| 13:28 | rhickey | chouser: alernate, but not beginning/ending with either in particular |
| 13:29 | @chouser | I would strongly argue for consistency here. always start with a string, always alternate. |
| 13:29 | rhickey | cgrand: TRUE, SO NOT |
| 13:29 | @chouser | whoa |
| 13:29 | rhickey | cgrand: sorry, caps lock |
| 13:29 | @chouser | "\[foo]\[bar]" => ["" foo "" bar] |
| 13:29 | @chouser | that was scary |
| 13:29 | @chouser | :-) |
| 13:30 | rhickey | chouser: always end with a string too? |
| 13:31 | @chouser | Hm, perhaps. The point being (map (fn [[string other]] ...) (partiion 2 ...))) is stable |
| 13:32 | @chouser | that actually argues for a trailing [... "" nil], but anyway... |
| 13:33 | @chouser | hm... that's more of a general gut feeling. The specific cases I'm coming up with mostly don't apply. |
| 13:35 | @chouser | Is "\["foo"]" legal? |
| 13:36 | @chouser | And "\(str "foo")"? |
| 13:37 | cgrand | I would say yes |
| 13:41 | funkenblatt | ~botsnack |
| 13:41 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 13:41 | Raynes | Nobody ever gives my bot a snake. :( |
| 13:42 | Raynes | $botsnack |
| 13:42 | sexpbot | Raynes: Thanks! Om nom nom!! |
| 13:42 | funkenblatt | it's the dollar sign... i can't spare too many of those |
| 13:42 | Raynes | Fair enough. |
| 13:42 | cgrand | ,"$botsnack" |
| 13:42 | clojurebot | "$botsnack" |
| 13:42 | Raynes | Fail. |
| 13:43 | Raynes | :p |
| 13:43 | cgrand | ,'$botsnack |
| 13:43 | clojurebot | $botsnack |
| 13:43 | sexpbot | clojurebot: Thanks! Om nom nom!! |
| 13:43 | clojurebot | Hello, ukstudio_ |
| 13:43 | Raynes | You could do that the other way around as well. Let's not test that out. |
| 13:45 | cgrand | well, it may be better if bots ignore each other before someone makes them play pingpong... |
| 13:45 | Raynes | I'm not sure it would be possible to make them loop infinitely. |
| 13:46 | Raynes | Maybe once or twice as you demonstrated. |
| 13:46 | @chouser | it would be a sort of quine, wouldn't it? |
| 13:46 | Raynes | It would have to be. |
| 13:47 | cgrand | $(println ",(+ 2 2)") |
| 13:47 | sexpbot | ,(+ 2 2) |
| 13:47 | clojurebot | 4 |
| 13:47 | cgrand | yes a kind of quine |
| 13:47 | nteon | haha |
| 13:47 | Raynes | I mean, I can make sexpbot ignore clojurebot if it became a real problem. |
| 13:47 | a_strange_guy | $(symbol "~botsnack") |
| 13:47 | sexpbot | ~botsnack |
| 13:47 | clojurebot | thanks; that was delicious. (nom nom nom) |
| 13:48 | Raynes | I need to add per-user blacklisting anyway. |
| 13:49 | Raynes | cgrand: Clever. |
| 13:51 | Raynes | Sexpbot 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:51 | Raynes | It's effective most of the time anyway. |
| 13:51 | rhickey | so it might be good to set the expectation of \[item :opt-a 1 :opt-b 42], for all translators |
| 13:54 | cgrand | rhickey: ? |
| 13:55 | rhickey | cgrand: 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 | @chouser | simplest translator would take 0th item of each literal vector rather than (str ~@v) |
| 13:56 | rhickey | chouser: right |
| 13:56 | rhickey | ignores options |
| 13:57 | rhickey | I'm on the fence, as I had some succint use of ~[] as splicing op before, but I'm not the target market |
| 13:58 | rhickey | although fogus liked something, I'm not sure what |
| 13:58 | @chouser | interesting that ~[] is the general case. ~[(compute foo)] |
| 13:58 | rhickey | yes |
| 13:59 | @chouser | if you want undelimited splicing, ~(str a b c) isn't too bad |
| 13:59 | rhickey | right, but ~(vector a b c) undifferentiated :( |
| 14:00 | @chouser | hm? ~[[a b c]] ? |
| 14:00 | cgrand | I prefer (take-while (complement keyword?) v) to (nth v 0) |
| 14:00 | rhickey | not again |
| 14:00 | cgrand | "\[a b c d :sep \,]" |
| 14:01 | Raynes | cgrand: sexpbot should ignore clojurebot now. |
| 14:01 | rhickey | cgrand: ah, somewhat tricky |
| 14:02 | @chouser | $'$botsnack |
| 14:02 | sexpbot | Command not found. No entiendo lo que estás diciendo. |
| 14:02 | @chouser | $(prn '$botsnack) |
| 14:02 | sexpbot | DENIED! |
| 14:02 | funkenblatt | heh |
| 14:02 | rhickey | I think we're in a weird area here, since all these things will be evaluated |
| 14:02 | @chouser | $(println "$botsnack") |
| 14:02 | sexpbot | $botsnack |
| 14:03 | rhickey | e.g. what if b is a keyword? |
| 14:03 | @chouser | rhickey: only evaluated if the interpolator is a fn not a macro |
| 14:03 | Raynes | I imagine prn isn't whitelisted. Whatever isn't in the core api docs probably isn't whitelisted. |
| 14:03 | rhickey | bbl |
| 14:04 | cemerick | I feel badly about interpolation becoming the topic of the day. :-/ |
| 14:05 | danlarkin | "now you have two problems" |
| 14:05 | cgrand | I 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:09 | cemerick | interesting that clojure has 1.2.0-master-SNAPSHOT, whereas contrib has only 1.2.0-SNAPSHOT |
| 14:10 | cemerick | stuarthalloway: are you connected at all with the builds of contrib, or shall I talk to Mr. Sierra about that? |
| 14:11 | @chouser | cemerick: 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:11 | kylesmith | I just downloaded the latest clojure-contrib. Did duck-streams get renamed? |
| 14:11 | cemerick | kylesmith: c.c.io |
| 14:12 | cemerick | chouser: I think the branch naming convention was an odd thing to do, and probably due to a mostly-one-off event (new/master) |
| 14:12 | cemerick | or, I don't know of any other project that does that. |
| 14:12 | @chouser | well, that one was my fault. seemed like a good idea at the time. |
| 14:13 | danlarkin | the branch names in the identifier was so there could be multiple simultaneous builds of clojure on build.clojure.org |
| 14:14 | cemerick | danlarkin: Yeah, I understand the motivation, but insofar as people use those names as dependency coordinates, it leads to very strange effects. |
| 14:14 | danlarkin | and iirc stuart took the branch name out of the contrib identifier because he couldn't figure out how to get it in |
| 14:15 | danlarkin | cemerick: agree, it's still not perfect |
| 14:15 | cemerick | anyway: does anyone know why only the latest snapshot is available for contrib? |
| 14:16 | cemerick | our nexus will cache it anyway, but it seems odd that they're not being retained like they are for clojure. |
| 14:16 | danlarkin | I wonder if it's just a setting in hudson, I can check it out |
| 14:17 | technomancy | cemerick: Max # of builds to keep: 9 in hudson |
| 14:17 | technomancy | so that's weird |
| 14:17 | cemerick | technomancy: OK -- that doesn't seem to correspond with contrib or clojure's snapshots tho |
| 14:18 | cemerick | http://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:18 | sexpbot | Index of /snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/ |
| 14:18 | danlarkin | sexpbot: shut up |
| 14:19 | technomancy | cemerick: perhaps because it's not expanding SNAPSHOT into a date |
| 14:20 | cemerick | hrm, maybe. the metadata looks OK tho |
| 14:21 | Raynes | danlarkin: 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:21 | stuarthalloway | cemerick: talk to Sierra |
| 14:26 | esj | /me is a fan of sexpbot |
| 14:28 | sexpbot | esj: And sexpbot is a fan of you. |
| 14:29 | naeu | hi there, does anyone know of any reported errors with Section 2.6.2 of #joyofclojure? |
| 14:29 | naeu | I can't get the example to work |
| 14:30 | naeu | to be more descriptive, I don't see any errors at the repl and I don't see any pretty rectangles either |
| 14:31 | Raynes | chouser: Teh ping. |
| 14:41 | naeu | perhaps 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:42 | naeu | Raynes: can you see if it works for you? |
| 14:42 | Raynes | Sure. Hold on. |
| 14:42 | Raynes | It just gave me a itty bitty tiny little frame that has nothing in it. |
| 14:43 | naeu | same here |
| 14:43 | naeu | boo |
| 14:43 | naeu | what system do you run? |
| 14:43 | Raynes | Ubuntu Hardy. |
| 14:43 | naeu | ok |
| 14:43 | Raynes | (I know, I know. Ancient) |
| 14:43 | Raynes | ;) |
| 14:43 | naeu | :-) |
| 14:43 | naeu | still, it's different to mine and we see the same results |
| 14:44 | LauJensen | Evening all |
| 14:44 | Raynes | LauJensen: Evening, sir. |
| 14:44 | naeu | LauJensen: evening there |
| 14:44 | naeu | LauJensen: 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:44 | naeu | my current assumption is that there's something wrong with the way I'm using the Frame API |
| 14:46 | wlangstroth | sunny afternoon, here. watching the most awesome Clojure presentation ever (stu halloway's): http://vimeo.com/10896148 |
| 14:46 | sexpbot | Clojure - Stuart Halloway on Vimeo |
| 14:46 | LauJensen | naeu: What would you like it to do ? |
| 14:47 | Raynes | Nice sunny afternoon here as well. |
| 14:47 | naeu | LauJensen: this is a distilled snippet from the #joyofclojure. I'd just like to draw a box on the screen :-) |
| 14:47 | LauJensen | It does so here |
| 14:47 | naeu | LauJensen: what are you running? |
| 14:47 | LauJensen | Ubuntu |
| 14:47 | naeu | Hardy? |
| 14:47 | Raynes | LauJensen: A tiny empty box? |
| 14:47 | LauJensen | yea |
| 14:47 | Raynes | naeu: He misunderstood what you wanted. |
| 14:48 | Raynes | LauJensen: It's supposed to be pretty and rectangular. |
| 14:48 | naeu | LauJensen: hmm, no, I think it should draw a box in that box |
| 14:48 | Raynes | All of this talk about boxes is making me hungry. :( |
| 14:49 | naeu | haha |
| 14:49 | LauJensen | There goes the Alabama boy again :) |
| 14:49 | Raynes | :> |
| 14:49 | carkh | the frame is small, when you resize it the box disapears, you need to redraw on each redraw |
| 14:49 | naeu | I'm sitting in the beautiful city library in Amsterdam having just eaten some splendidly delicious pasta |
| 14:49 | naeu | carkh: oh interesting |
| 14:49 | carkh | or set the frame preferredsize before showing it |
| 14:50 | naeu | so i guess i should also set the size too |
| 14:52 | LauJensen | I haven't tried this exercise with AWT before as I always use Swing |
| 14:52 | naeu | bingo: (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:52 | naeu | carkh: thanks! |
| 14:53 | naeu | LauJensen: what are the pertinent differences between AWT and Swing? |
| 14:53 | LauJensen | Swing is more bloated and fancyfull :) |
| 14:54 | naeu | are there typical cases where AWT is better than Swing? |
| 14:54 | naeu | or is it Swing all the way? |
| 14:54 | LauJensen | I think AWT is just a little leaner than Swing, but both are awful |
| 14:54 | naeu | haha |
| 14:54 | Raynes | naeu: Isn't your name Sam Aaron? |
| 14:55 | naeu | Raynes: yep, it is |
| 14:55 | naeu | are you spying on me? |
| 14:55 | Raynes | naeu: Making sure I hadn't confused you with someone else. |
| 14:55 | naeu | are you here in the library too? |
| 14:55 | Raynes | Totally. |
| 14:55 | naeu | damn |
| 14:55 | naeu | swift work |
| 14:57 | LauJensen | naeu: 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:57 | naeu | haha |
| 14:59 | naeu | right, back to reading |
| 14:59 | naeu | chat later :-) |
| 15:09 | cemerick | guess I need to read some commit logs. byte now constrains its input! |
| 15:14 | cemerick | does anyone else get a "java.lang.IllegalArgumentException: Duplicate key: :main" when specifying (:gen-class :main false) in an ns decl? |
| 15:15 | LauJensen | Which version? |
| 15:15 | cemerick | HEAD (or most recent 1.2.0 snapshot) |
| 15:17 | LauJensen | When do you get the error? Evaluating it calling compile? |
| 15:18 | cemerick | LauJensen: during AOT compilation, yes |
| 15:19 | cemerick | it's due to the recent no-dupes-in-map-literals change, I think |
| 15:21 | cemerick | rhickey: I'm getting a "java.lang.IllegalArgumentException: Duplicate key: :main" when specifying (:gen-class :main false) in an ns decl |
| 15:42 | mcburton | anyone here used incanter's new "set-data", I'm trying to use it to dynamically update charts and there isn't any documentation.... |
| 15:42 | cemerick | oh man, so many defclass usages to rip out :-/ |
| 15:53 | liebke | mcburton: if you want either a dynamic scatter or xy plot, just use dynamic-scatter-plot or dynamic-xy-plot |
| 15:54 | mcburton | liebke: I'd like a scatter plot where I can add points to a series (as opposed to creating a new series) |
| 15:55 | liebke | mcburton: 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:57 | mcburton | liebke: 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:59 | liebke | mcburton: 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:00 | liebke | when the table is updated, the plot will refresh automatically |
| 16:02 | mcburton | liebke: this is probably a dumn question, but how can I create an empty data-table :} |
| 16:02 | mcburton | s/dumn/dumb |
| 16:02 | arohner | what is the java 6 option for adding a dir full of jars to the classpath? |
| 16:02 | arohner | java -cp lib/*.jar: or something? |
| 16:04 | cemerick | arohner: that should do it |
| 16:04 | liebke | mcburton: 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:05 | arohner | cemerick: I'm getting class not found for clojure.main, as if it's not on the classpath |
| 16:08 | arohner | aha. It wants java -cp lib/*:, not -cp lib/*.jar: |
| 16:13 | mcburton | liebke: awesome, I'm really close, but i'm still having difficulty with the scatter plot |
| 16:14 | mcburton | liebke: if I wanted to do (set-data some-scatter-plot ????) what would I put in ???? x and y? |
| 16:18 | wlangstroth | arohner: 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:19 | hiredman | * only works in newer version of java |
| 16:19 | arohner | wlangstroth: I'm pretty sure java 5 doesn't support that option, and clojure proper still officially supports 5 |
| 16:19 | hiredman | 1.6+ |
| 16:20 | wlangstroth | ah, I see |
| 16:23 | mcburton | liebke: or how can I get the data in a table, which I can update, into a scatter-plot? |
| 16:24 | mcburton | liebke: doesn't look like set-data will work on plots " addOrUpdate for class org.jfree.data.xy.XYSeries" |
| 16:24 | mcburton | ERR "No matching method found: addOrUpdate for class org.jfree.data.xy.XYSeries" |
| 16:29 | liebke | mcburton: 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:29 | liebke | mcburton: 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:31 | tomoj` | #<CompilerException java.lang.ClassFormatError: clojure.contrib.pprint.PrettyWriter (erroneous identifier) (pprint.clj:6)> |
| 16:31 | tomoj` | anyone seen that? |
| 16:34 | cemerick | is there any provision for defining dispatch precedence in protocol impls? |
| 16:35 | mcburton | liebke: how does this work on xy-plots (like scatterplot)? addorUpate is not implemented... |
| 16:35 | mcburton | liebke: err rather XYSeries (jfree) |
| 16:39 | mcburton | liebke: weird, its here in the docs for XYSeries, this might be a bug? |
| 16:42 | tomoj | seems to be a problem with the latest lein-swank |
| 16:43 | tomoj | or something the latest lein-swank depends on... hmm |
| 16:43 | liebke | mcburton: this could be cause by some recent changes I made, let me check it out |
| 16:46 | tomoj | err |
| 16:46 | tomoj | lein-swank is suddenly broken for me |
| 16:48 | liebke | mcburton: the problem is that set-data takes a two dimensional sequence [[1 2] [2 2] [3 5]], not a dataset. Try that. |
| 16:48 | tomoj | even in projects where lein-swank worked before! |
| 16:48 | tomoj | wtf? |
| 16:50 | mcburton | liebke: you rock! |
| 16:50 | liebke | I'll take that to mean you got it to work :-) |
| 16:50 | MrEvil | is there a function that will return the first value of a collection for which a predicate returns true? |
| 16:51 | MrEvil | like some but return the actual value instead of a boolean value |
| 16:52 | mcburton | liebke: now the question becomes, how do I update the data for multiple series? |
| 16:53 | liebke | mcburton: I haven't tested it, but set-data takes an optional series index argument |
| 16:53 | sattvik | MrEvil: You could try combining first and filter. |
| 16:53 | sattvik | ,(first (filter #(< 5 %) [3 4 5 6 7 8])) |
| 16:53 | clojurebot | 6 |
| 16:56 | MrEvil | I'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:56 | mcburton | liebke: seems to work on very rudimentary testing, i'll keep you posted |
| 16:57 | liebke | mcburton: thank, I'd appreciate it. I'll be back on later tonight |
| 17:02 | tomoj | aha, I'd installed some gcj stuff which broke lein-swank |
| 17:03 | hiredman | :( |
| 17:04 | hiredman | why would you install that? |
| 17:04 | jcromartie | how would I get the length of a Java array? |
| 17:04 | jcromartie | also, why are Java arrays so weird? |
| 17:04 | hiredman | ,(count (make-array Object 10)) |
| 17:04 | clojurebot | 10 |
| 17:05 | Raynes | $(alength (char-array 10)) |
| 17:05 | sexpbot | 10 |
| 17:15 | jfields | is (filter nil? seq) the best way to remove nils from a seq? |
| 17:15 | tomoj | hiredman: I was trying to make some other problem go away |
| 17:15 | tomoj | by randomly choosing packages to install :/ |
| 17:15 | clojurebot | namespaces 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:15 | jcromartie | jfields: that's the inverse |
| 17:16 | jcromartie | ,(remove nil? [2 nil 5 nil]) |
| 17:16 | clojurebot | (2 5) |
| 17:16 | jfields | right, so what is the preferred way to remove nils? |
| 17:16 | jfields | ah, gotcha, thanks |
| 17:32 | jcromartie | bleh, this data is tough to parse |
| 17:32 | jcromartie | it's a nasty CSV from an excel file that someone really abused |
| 17:33 | jcromartie | I think I need to write a parser to handle quoted fields |
| 17:34 | hiredman | grab a csv library |
| 17:35 | cemerick | most csv libraries suck; no support for quoted fields, quotes in quoted fields, linebreaks in fields, etc |
| 17:35 | cemerick | I've written a csv lib in every language I've used. :-( |
| 17:35 | hiredman | cemerick: that has definitely not been my experience |
| 17:35 | cemerick | hiredman: linky for your preferred java lib |
| 17:35 | cemerick | ? |
| 17:36 | hiredman | well my super prefered one has some stupid license nonsense |
| 17:36 | hiredman | :/ |
| 17:36 | cemerick | hiredman: nevertheless? |
| 17:38 | hiredman | supercsv |
| 17:38 | kotarak | jcromartie: try opencsv. Parsed every file excel and diverse SAP systems have thrown at me up to now... |
| 17:38 | hiredman | oh! |
| 17:38 | jcromartie | kotarak: thanks, good idea |
| 17:38 | hiredman | it looks like it is under the apache license now |
| 17:38 | jcromartie | it says it supports newlines in fields, which is critical here |
| 17:43 | jcromartie | perfect... |
| 17:43 | jcromartie | thanks guys |
| 17:49 | tomoj | can anyone give me a hint on what to do after `mvn install`ing in a clone of polyglot-maven? |
| 17:50 | tomoj | I didn't get a pmaven-cli/target/pmaven-*-bin.zip :( |
| 17:58 | rhickey | cemerick: I can't reproduce your :gen-class thing |
| 18:39 | maxhodak | does println DTRT when there's heavy concurrency? |
| 18:39 | maxhodak | or will you get c-style garbled output? |
| 18:40 | iruediger | can 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:46 | seths | maxhodak: I don't remember getting portions of a line |
| 18:46 | seths | but I remember lines printing out of order |
| 18:46 | seths | might consider using an agent |
| 18:47 | wlangstroth | iruediger: I think you're trying to write object-oriented code in Clojure |
| 18:54 | cemerick | iruediger: have you compiled the namespace that contains the gen-class form? |
| 18:55 | cemerick | iruediger: i.e. loading that form is not enough to generate the class. See http://clojure.org/compilation |
| 18:56 | technomancy | speaking of which, the web site still says "all features are supported at runtime"; is that a claim from the pre-AOT days? |
| 18:57 | cemerick | rhickey: I'll try to get a narrow testcase. Happens every time here, across multiple projects. Maybe it's a configuration issue. |
| 18:58 | cemerick | technomancy: on the compilation page? |
| 18:58 | iruediger | wlangstroth: I've never programmed in Lisp :( |
| 18:58 | technomancy | cemerick: no, on http://clojure.org at the splash page intro paragraph |
| 18:58 | iruediger | can you provide a short example of a more functional way to implement a table model? |
| 18:58 | carkh | iruediger: any reason why you're not using proxy ? |
| 18:59 | iruediger | cemerick: (compile) says it can't find a/tm.clj |
| 19:00 | hiredman | or reify for that matter |
| 19:00 | polypus | what is the most bleeding edge clojure snapshot called again? |
| 19:00 | wlangstroth | iruediger: it's easier than you might think. I'll see if I can write something short to show you what I mean. |
| 19:00 | iruediger | carkh: I need to add two new methods to the base class |
| 19:00 | carkh | this is being called from java ? |
| 19:01 | iruediger | no |
| 19:01 | iruediger | only clojure code |
| 19:01 | carkh | so i don't see why those methods should be inside your class |
| 19:02 | carkh | what are the 2 method names ? |
| 19:02 | lancepantz | anyone have a guess as to a release date for 1.2? |
| 19:02 | polypus | i'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:02 | hiredman | polypus: lose the master |
| 19:02 | iruediger | tm-addRow and tm-removeRow |
| 19:02 | polypus | hiredman: ty |
| 19:03 | carkh | iruediger: see the thing is that you're loosing the dynamic nature of clojure by working with gen-class |
| 19:04 | iruediger | As you can see I am noob :) |
| 19:04 | iruediger | but using gen-class does feel 'wrong' |
| 19:05 | carkh | usually 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:06 | carkh | the state you would create in a let ...like this : (let [state (ref {:cols ?...})] |
| 19:06 | carkh | then inside the let, you create your proxy |
| 19:07 | carkh | return both from your "factory" function by packaging these in a vector or some other data structure |
| 19:07 | funkenblatt | ,(doc cond) |
| 19:07 | clojurebot | "([& 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:07 | carkh | maybe just like this [state my-model] |
| 19:08 | iruediger | Thanks carkh, I'll give that a try |
| 19:08 | carkh | the call your simple clojure function add-row with the state as parameter |
| 19:08 | carkh | the->then |
| 19:09 | iruediger | just to get things straight, I should avoid gen-class when possible, right? |
| 19:09 | wlangstroth | iruediger: 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:09 | carkh | i guess gen-class has its uses, but in 2 years i never had top use it at all |
| 19:10 | iruediger | ok |
| 19:10 | iruediger | thanks guys |
| 19:10 | licoresse | wlangstroth: no, you should avoid it, it's there when you need to create classes, basically in clojure you create functions instead |
| 19:10 | licoresse | wlangstroth: -you should not avoid it- |
| 19:10 | carkh | proxy has some limitations, can't access super and such |
| 19:10 | carkh | then you need gen-class i guess |
| 19:11 | wlangstroth | licoresse: did you look at the code? |
| 19:11 | licoresse | yes |
| 19:11 | wlangstroth | licoresse: it's basically just object-oriented |
| 19:12 | licoresse | I wondered how you would do this in a functional way, carkh gives some hints |
| 19:12 | wlangstroth | licoresse: oh, I see |
| 19:12 | licoresse | I never touched the tablemodel myself |
| 19:12 | licoresse | (not from clojure) |
| 19:13 | carkh | what i explained here is a pattern you can use everywhere when working with swing |
| 19:14 | licoresse | wlangstroth: 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:15 | wlangstroth | licoresse: 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:15 | licoresse | decipher, if I could spell |
| 19:16 | licoresse | look at proxy instead |
| 19:16 | wlangstroth | licoresse: oh, I thought you were objecting to proxy |
| 19:16 | wlangstroth | licoresse: sorry, I must have misunderstood |
| 19:16 | licoresse | it has some limitation, like carkh mention |
| 19:17 | polypus | where on the web do i need to look to see the version strings for the latest clojure and clojure-contrib repos? |
| 19:18 | wlangstroth | right, but so does using a data structure like AbstractTableModel in a language that focuses on immutability |
| 19:18 | carkh | polypus: you could get your clojure and contrib from http://build.clojure.org/ |
| 19:18 | sexpbot | Dashboard [Hudson] |
| 19:20 | wlangstroth | oh, I meant "class", not "data structure" |
| 19:20 | timcharper | I'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:20 | polypus | carkh: 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:21 | timcharper | anyone using Congo Mongo have any idea where to get the release from? |
| 19:21 | carkh | polypus: oh i see, sorry i can't help with lein |
| 19:22 | licoresse | wlangstroth: http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html |
| 19:22 | sexpbot | Kotka : About Clojure… What else? |
| 19:22 | wlangstroth | licoresse: that code wasn't mine |
| 19:23 | polypus | anyone know if it is even possible to get the very latest 1.2.0 branch via leiningen? |
| 19:23 | wlangstroth | polypus: 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:23 | licoresse | polypus: master |
| 19:24 | licoresse | too late :) |
| 19:24 | licoresse | I have master on contrib as well |
| 19:24 | licoresse | 1.2.0-master-SNAPSHOT on contrib |
| 19:24 | polypus | licoresse: master on contrib will not get you the latest libs like string |
| 19:25 | licoresse | nto? |
| 19:25 | polypus | clojure.contrib.string |
| 19:25 | licoresse | ok... |
| 19:25 | polypus | so i guess i have to go [org.clojure/clojure "1.1.0-master-SNAPSHOT"] & |
| 19:25 | polypus | [org.clojure/clojure-contrib "1.2.0-SNAPSHOT"] |
| 19:26 | carkh | wlangstroth: looks like i found some old code of mine that uses AbstractTableModel, check this : http://gist.github.com/365234 |
| 19:26 | wlangstroth | licoresse: oh, "master" works now? It didn't before. |
| 19:26 | carkh | wlangstroth: though it's not nice code by any mean =/ |
| 19:27 | wlangstroth | carkh: it's what you would have to do to make that work, though. "nice" is relative. |
| 19:28 | licoresse | carkh: but it's not oo, it's just a big progn :) |
| 19:28 | MrEvil | Is 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:28 | carkh | i mean, today i would manage state differently |
| 19:28 | wlangstroth | carkh: you mean if you were still forced to use AbstractTableModel? |
| 19:29 | carkh | that pattern is good for most cases wher eyou need to subclass a swing object, not only abstracttablemodel |
| 19:30 | MrEvil | ah just found it: drop |
| 19:30 | licoresse | wlangstroth: you see, from the gist, that a proxy for AbstractTableModel is created |
| 19:31 | licoresse | that's basically what you do in you oo version |
| 19:31 | wlangstroth | licoresse: okay, are you just teasing now? carkh and I both recommended proxy to the guy above. |
| 19:32 | licoresse | and I agree! |
| 19:32 | carkh | haha damn i thought you were the one asking about that =P |
| 19:32 | carkh | it was iruediger instead =P |
| 19:32 | licoresse | am I mixing names? |
| 19:32 | licoresse | haha |
| 19:32 | wlangstroth | sigh |
| 19:33 | carkh | i don't know about you, but i certainly mixed a bit =P |
| 19:34 | wlangstroth | ah well. so carkh: you said you would handle it differently now, so don't leave us hanging - what would you do? |
| 19:34 | licoresse | why do I have to manually keep track of who I am talking to? I am using emacs goddammit |
| 19:34 | carkh | well the proxy thing is fine, but these days i return a map with the state and the proxied item |
| 19:34 | wlangstroth | licoresse: isn't there a meta key for that? M-x keep-track-of-everything-for-me |
| 19:35 | licoresse | not yet |
| 19:35 | The-Kenny | Someone should write this :) |
| 19:35 | licoresse | the whole irc concept needs more dynamism |
| 19:36 | wlangstroth | carkh: oh, right, you're not returning anything in the gist. I see. |
| 19:36 | The-Kenny | Btw. I get ":( matches hiredman" when I write :) |
| 19:36 | The-Kenny | Paren-Matching ftw :) |
| 19:37 | licoresse | I just get segfaults |
| 19:37 | licoresse | (in my head, that is) |
| 19:38 | licoresse | what is so interesting about clojure.contrib.string? |
| 19:38 | licoresse | ,clojure.contrib.string |
| 19:38 | clojurebot | java.lang.ClassNotFoundException: clojure.contrib.string |
| 19:40 | printf | Is there a trick to shorten long namespace names in the repl? |
| 19:40 | wlangstroth | there's :as |
| 19:40 | wlangstroth | is that what you mean? |
| 19:41 | carkh | ,(require 'clojure.contrib.string :as 'ccs) |
| 19:41 | clojurebot | java.io.FileNotFoundException: Could not locate clojure/contrib/string__init.class or clojure/contrib/string.clj on classpath: |
| 19:41 | carkh | bah |
| 19:42 | printf | doh, right..thanks :) |
| 19:47 | printf | ok, 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:47 | printf | looking for a way to temporarily shorten that namespace name, while in the repl |
| 19:52 | wlangstroth | oh, I see |
| 19:56 | wlangstroth | printf: huh. You got me. Maybe someone more experienced knows. |
| 19:58 | lancepantz | printf: are you looking for alias? |
| 19:59 | lancepantz | ,(doc alias) |
| 19:59 | clojurebot | "([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:59 | wlangstroth | pff |
| 19:59 | dnolen | printf: also (require '[some.long.namespace :as foo]) |
| 19:59 | printf | I shall give it the ol college try.. |
| 19:59 | wlangstroth | I was looking under ns-this-and-that |
| 19:59 | wlangstroth | *facepalm* |
| 20:21 | timcharper | is there an all? fn in clojure? |
| 20:21 | timcharper | ie: (reduce (fn [a b] (and a b)) '(true true false)) |
| 20:22 | hiredman | ,(dco every?) |
| 20:22 | clojurebot | java.lang.Exception: Unable to resolve symbol: dco in this context |
| 20:22 | hiredman | ,(doc every?) |
| 20:22 | clojurebot | "([pred coll]); Returns true if (pred x) is logical true for every x in coll, else false." |
| 20:22 | timcharper | wow, go documentation. thanks, was just about to say "duh, I found it" |
| 21:06 | timcharper | anybody else find themselves fighting emacs auto-indentation for (cond) statements? |
| 21:08 | polypus | timcharper: i never fight emacs, emacs is always right :) |
| 21:08 | timcharper | lol |
| 21:08 | timcharper | polypus: unfortunately, not everyone here uses emacs for clojure. one TextMate, one vim. |
| 21:08 | timcharper | but.. that aside, I really don't like how conds are indented with emacs |
| 21:09 | timcharper | :S |
| 21:10 | polypus | i try not to think about it. programming in other languages seems painful now that all my code formatting is automated |
| 21:11 | seths | timcharper: I don't remember about cond, but th formatting of methods defined in a deftype annoyed me |
| 21:11 | timcharper | do 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:11 | timcharper | on alternating lines, indendented the same |
| 21:11 | timcharper | IE: |
| 21:13 | timcharper | http://pastie.org/918570 |
| 21:13 | sexpbot | #918570 - Pastie |
| 21:13 | polypus | if the conditions or expressions are large then i go with two lines, else just one line for the pair generally |
| 21:13 | seths | polypus: same here |
| 21:14 | timcharper | am I doing something wrong? |
| 21:14 | seths | although it's tempting to add some extra indentation on the 2nd line |
| 21:14 | timcharper | isn't it confusing to have to count odd, even, odd, even to discern between condition and expression? |
| 21:14 | timcharper | seths: that's what I find myself doing (and my co-workers all do) |
| 21:15 | polypus | you could always go with commas between pairs |
| 21:15 | carkh | there's is a reason why common lisp has an extra pair of parenthesis on cond |
| 21:15 | timcharper | like that ? |
| 21:15 | timcharper | http://pastie.org/918570 |
| 21:15 | sexpbot | #918570 - Pastie |
| 21:15 | carkh | but yeah good idea the comma ! |
| 21:16 | timcharper | carkh: yeah, I know! I read that about clojure and was like, but I like the extra parenthesis! This is bad! |
| 21:16 | timcharper | (when I first learned about it, I should say) |
| 21:16 | carkh | ohwell that's a very minor annoyance=P |
| 21:17 | timcharper | it seems like it ought to be possible to transparently extend the cond macro to accept a series of vectors |
| 21:17 | seths | timcharper: sometimes I add a blank line between condition/expression pairs |
| 21:17 | seths | and maybe even some indentation: http://bitbucket.org/seths/pokerepl/src/88c651cbdb05/src/pokerepl.clj#cl-122 |
| 21:18 | timcharper | http://pastie.org/918570 |
| 21:18 | sexpbot | #918570 - Pastie |
| 21:18 | carkh | but that's the thing, you need to fight emacs to get this indentation |
| 21:18 | seths | carkh: agreed. I'm sure patches are welcome :-) |
| 21:19 | timcharper | carkh: I really like that syntax too. A patch for emacs to make it indent that way would be stellar |
| 21:20 | carkh | i don't think clojue-mode has a notion of "i'm in a cond form" or any other kind of form |
| 21:20 | timcharper | specifically, a patch for emacs clojure-mode |
| 21:20 | seths | timcharper: I like the comma approach, but I would append it to the expression |
| 21:20 | timcharper | carkh: it indents conditionally with defn and a few other things |
| 21:20 | carkh | that's a one line further thing |
| 21:21 | carkh | it does some fancy stuff more when pairaid with slime too |
| 21:21 | carkh | paired |
| 21:21 | timcharper | http://pastie.org/918575 |
| 21:21 | sexpbot | #918575 - Pastie |
| 21:22 | timcharper | the dash indicates where my cursor goes |
| 21:22 | timcharper | it appears to have contextual knowledge of what kind of sexp it's in |
| 21:22 | timcharper | are you saying the odd-even logic would be difficult ? |
| 21:23 | seths | carkh: paredit |
| 21:25 | timcharper | http://github.com/jochu/clojure-mode/blob/master/clojure-mode.el#L342 |
| 21:25 | timcharper | there's the magic |
| 21:26 | carkh | right, that's an ugly thing =P |
| 21:26 | seths | it's just emacs lisp -- someone page @technomancy :-) |
| 21:27 | timcharper | carkh: hah, code written in emacs-lisp has a 98% chance of being ugly. |
| 21:28 | timcharper | b |
| 21:28 | carkh | looks like there could be some backtracking-indent form that could be defined fo this |
| 21:31 | carkh | that is interesting : (put 'proxy 'clojure-backtracking-indent '(4 4 (2))) |
| 21:33 | carkh | but i'm making changes to it, and running the sexp, but it won't change in an existing clojure-mode buffer |
| 22:04 | Raynes | Hah. It ignores links with "paste" in the name, but pastie only has "past" in the name. What a load. -.- |
| 22:06 | hiredman | you can steal the pastebin regex from clojurebot |
| 22:06 | hiredman | it's in delicious.clj |
| 22:10 | Raynes | hiredman: Clever. Thanks. |
| 22:13 | Raynes | In 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:13 | Raynes | Including pastie. |
| 22:13 | Raynes | Which I just added. |
| 22:15 | Raynes | hiredman: That post function is probably the longest I've seen a function go without a newline. :o |
| 22:17 | seths | do either of sexpbot or clojurebot have a web interface? they seem like more fun than Lord of the REPLs |
| 22:18 | seths | http://lotrepls.appspot.com/ |
| 22:18 | sexpbot | Lord of the REPLs |
| 22:18 | hiredman | oh |
| 22:18 | hiredman | I didn't realize that was shelling out |
| 22:19 | Raynes | That's a nice idea, like lambdabot (only without the web interface, but still usable from the command-line). |
| 22:19 | seths | it's google app engine |
| 22:19 | Raynes | That's kind of difficult though, because both sexpbot and clojurebot use Pircbot. |
| 22:19 | hiredman | clojurebot has an http server |
| 22:20 | seths | ah, just curious. I used LotREPLs for a Clojure demonstration. Mostly since it was as far away from GNU/Emacs as I could get :-) |
| 22:20 | hiredman | clojurebot: show me some scala |
| 22:20 | seths | seths: for the GNU/Record I am a huge fan of The Editor, but didn't want to scare people new to Clojure |
| 22:20 | clojurebot | Scala often gets in the way when trying to write neat code -- seen in #scala |
| 22:20 | seths | lol |
| 22:21 | hiredman | ~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)} |
| 22:21 | Raynes | "Oh my God, he just opened up Emacs. I'm leaving." |
| 22:21 | clojurebot | Any = 1 |
| 22:23 | seths | Raynes: sad but true. In my slides I used the flame transition to burn Emacs and it was a huge hit. |
| 22:26 | hiredman | swank-clojure-project+clojure-test-mode is pretty slick |
| 22:27 | Raynes | hiredman: Why not just make Clojurebot give technomancy compliments automatically onJoin? :p |
| 22:27 | technomancy | heh |
| 22:28 | seths | Raynes: just have it emit Neal Stephenson quotes |
| 22:29 | hiredman | I gotten spam where the subject line was stephenson quotes |
| 22:29 | wlangstroth | hiredman: and I thought Google was creepy |
| 22:29 | wlangstroth | that's some focused advertising |
| 22:30 | technomancy | more of a gibson fan personally |
| 22:31 | technomancy | like I've said, youth is the only excuse a hacker can put forth for not having Neuromancer mostly memorized. |
| 22:32 | seths | s/Neuromancer/random Harlan Ellison/ ok? |
| 22:32 | hiredman | count zero is obviously superior |
| 22:32 | wlangstroth | can anyone tell me if there is any rhyme or reason to the practice of appending asterisks to the end of function names? |
| 22:32 | carkh | wlangstroth: functions you're not supposed to call from client code |
| 22:32 | technomancy | hiredman: 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:33 | hiredman | people look at you funny if you use unicode prime marks |
| 22:33 | wlangstroth | carkh OH - sweet mother of Clojure that was bothering me |
| 22:33 | technomancy | if it looks wrong, it probably is. =) |
| 22:33 | wlangstroth | okay, that makes sense, thanks |
| 22:34 | wlangstroth | technomancy: tell me about it |
| 22:45 | wlangstroth | okay, wait: I thought the minus appended to defn and def was the "non-public" indicator. What counts as "client code", here? |
| 22:45 | carkh | hum defn is private |
| 22:45 | carkh | err defn- |
| 22:45 | carkh | as in javaland private |
| 22:45 | wlangstroth | right |
| 22:46 | carkh | if you name your function my-function* |
| 22:46 | hiredman | erm |
| 22:46 | carkh | it is not private |
| 22:46 | hiredman | it's not the same has java private |
| 22:46 | carkh | right not quite the same but almost |
| 22:46 | wlangstroth | okay, but "shouldn't use in client code" is what's confusing me |
| 22:46 | carkh | don't be nitpicking again |
| 22:46 | carkh | let's say i have a macro with-foo .. |
| 22:47 | carkh | and inside the macro i use the supporting function with-foo* |
| 22:47 | carkh | when the macro get expanded in some other namespace, it will expand to with-foo* |
| 22:47 | carkh | so with-foo* cannot be private |
| 22:48 | carkh | so that's convention to say : you're not supposed to use with-foo* |
| 22:48 | wlangstroth | ... except in macros |
| 22:48 | wlangstroth | ? |
| 22:49 | carkh | the client code (your code) is supposed to call the library macro with-foo, instead of its supporting function with-foo* |
| 22:49 | wlangstroth | okay, perfectly clear now - thanks |
| 22:52 | wlangstroth | Just 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:52 | carkh | right, in the io library you have a slurp function, that calls its supporting function slurp* |
| 22:53 | carkh | but you're supposed to use slurp |
| 23:00 | wlangstroth | carkh: you would think so, but no. |
| 23:00 | carkh | ahwell i didn't check the code, anyways you get the idea |
| 23:02 | wlangstroth | carkh: definitely, thanks |
| 23:04 | wlangstroth | hiredman: 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:05 | hiredman | it's in the defn- macro |
| 23:06 | hiredman | what really is happening is :private true is being put in the var metadata |
| 23:10 | wlangstroth | pff - here I am looking for a "-" in the LispReader |
| 23:10 | wlangstroth | of course it's just a macro |
| 23:10 | wlangstroth | thanks, guys |
| 23:26 | technomancy | hugod: so slime-autodoc... was that moved out of slime into a contrib recently? |
| 23:26 | JonSmith | ok, 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:26 | technomancy | because I have that functionality in the elpa version of slime already without any extra files |
| 23:28 | mabes | JonSmith: http://groups.google.com/group/clojure/browse_thread/thread/e704414cf36ef2aa http://github.com/mmcgrana/clj-serializer |
| 23:28 | hugod | technomancy: slime-autodoc was moved to contrib a while back I thought - full support would include highlighting of the "current" arg |
| 23:28 | technomancy | oh, that's handy |
| 23:28 | technomancy | it's annoying to have a lot of separate files for elpa though. =\ |
| 23:28 | hugod | but that's not implemented |
| 23:29 | JonSmith | ooh thanks mabes |
| 23:29 | mabes | JonSmith: I've used the prior approach before but I have not used clj-serializer yet.. it seems pretty nice though |
| 23:30 | hugod | technomancy: slime-autodoc gets included by slime-fancy, so I just wanted something that "worked" |
| 23:31 | technomancy | that's frustrating; it's a lot easier to package stuff up if it's just a handful of files. =\ |
| 23:31 | technomancy | and it used to Just Work with the 20091016 version |
| 23:32 | technomancy | but we can't stay on the old version forever I guess |
| 23:33 | technomancy | man, the slime contribs are sloppy |
| 23:33 | technomancy | they don't have the proper requires in place |
| 23:34 | JonSmith | slime is always kind of a bear |
| 23:34 | JonSmith | even in CL where its more 'native' |
| 23:35 | technomancy | every couple months I contemplate a fresh rewrite. |
| 23:36 | JonSmith | yeah i don't blame you |
| 23:37 | technomancy | hugod: getting an "Evaluation Aborted" without an sldb buffer or backtrace on slime-hyperdoc-lookup |
| 23:38 | hugod | technomancy: there is some magic for the slime contrib requires |
| 23:38 | technomancy | hugod: mostly complaining because of the complaints on the mailing list I get about elpa not being "a regular emacs installation process" =) |
| 23:39 | hugod | technomancy: could you eval (setq debug-on-error t) and retry - should get you a stack trace |
| 23:39 | technomancy | hugod: yeah, no such luck |
| 23:40 | technomancy | that's only for elisp errors |
| 23:41 | hugod | technomancy: 'll merge it locally and test |
| 23:41 | JonSmith | oh 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:43 | technomancy | JonSmith: "installation instructions left as an exercise to the reader" |
| 23:43 | technomancy | and I don't mean clojure.lang.LispReader |
| 23:44 | technomancy | hugod: I wasn't actually merging, just trying origin/hyperdoc |
| 23:44 | technomancy | hugod: also: autodoc seems to work fine without the autodoc branch |
| 23:44 | technomancy | are there any specific edge cases I should be trying that the autodoc branch fixes? |
| 23:45 | hugod | technomancy: it was generally broken for me |
| 23:45 | technomancy | hmmm, odd. I'm using slime trunk now. |
| 23:46 | hugod | ok, I'll update my slime |
| 23:46 | technomancy | I mean, if it's broken for you I'd expect it to work in elpa but not in current trunk |
| 23:48 | JonSmith | technomancy: yeah, that's about right :-) |
| 23:48 | JonSmith | i liked ELPA clojure when i used it, for the record |
| 23:50 | JonSmith | thats a lot of buffers |
| 23:51 | hugod | well, emacs has been up for a while |
| 23:57 | hugod | technomancy: could you check (require 'swank.commands.contrib.swank-arglists) swank.commands.contrib.swank-arglists/autodoc* |