2008-10-13
| 00:00 | dnm | Chouser: How goes it? |
| 00:16 | cads | hehe |
| 00:17 | cads | stranger in a strange land will honest to goodness make you want to start your own religion |
| 00:17 | spacebat | I wonder if it predates the publication of Dianetics |
| 00:18 | cads | hehe, your _own_ religion |
| 00:24 | spacebat | last time I tried that I was so drunk |
| 00:25 | spacebat | one of the reasons I rarely drink to excess |
| 01:04 | danlarkin | So I'm a little confused about gen-class and writing constructors |
| 01:05 | Chouser | heh. yeah. |
| 01:05 | danlarkin | first off, I'm not sure what :init is for... is it like a python metaclass? |
| 01:07 | Chouser | no, :init names the clojure function that will be used as the constructor |
| 01:09 | danlarkin | OHhh okay. And then :constructors is for saying hey I want a constructor with this arity, and this arity, and this arity |
| 01:17 | danlarkin | erf, still lost... |
| 01:17 | danlarkin | I want to make a constructor for a class that inherits from JFrame |
| 01:19 | danlarkin | if I just give it an :init 'init, then (defn MyClass-init [this] ...) doesn't match |
| 01:21 | danlarkin | but I would expect it to? |
| 01:24 | danlarkin | or am I supposed to have MyClass-init take no args and then call the java super() function? but how can I call super() without an object to call it on? |
| 01:35 | Chouser | sorry, stepped away... |
| 01:38 | Chouser | init doesn't take a "this" arg |
| 01:39 | Chouser | my understanding is actually that :init gets called before the object is even created. |
| 01:39 | Chouser | you tell clojure which of the super class's constructors to call by defining a mapping in :constructors. |
| 01:43 | danlarkin | Hmm so how would I parallel a java example of adding things to a JFrame in the constructor? |
| 01:46 | lisppaste8 | Chouser pasted "example of gen-class and gen-interface" at http://paste.lisp.org/display/68406 |
| 01:46 | Chouser | that's my working example that I always go back to for reference. Maybe it'll help some. |
| 01:47 | Chouser | it doesn't look to me like there's any JFrame constructor that takes children. |
| 01:47 | Chouser | oh! you mean you'd derive a class from JFrame, and in your class' constructor, add things to itself? |
| 01:48 | danlarkin | mmhmm |
| 01:48 | Chouser | yeah, don't bother. :-) |
| 01:48 | Chouser | just make a JFrame and add things to it, no need for a subclass |
| 01:49 | Chouser | you can put all that in a defn, if you want to be able to call it from different places. |
| 01:54 | danlarkin | Chouser: tada!! |
| 01:54 | Chouser | ah, good. |
| 01:55 | danlarkin | Thanks a bunch for your help :-D |
| 01:55 | Chouser | np. gen-class is tricky. Did you end up needing it? |
| 01:56 | danlarkin | although I still don't quite get how :constructors works, but I'm gonna punt on that since I don't need it ATM. |
| 01:57 | danlarkin | well for this specific problem it turns out no, I don't. But as I build up more I may... |
| 01:58 | Chouser | ok, good enough. By far the best use of gen-class is no use at all. |
| 01:59 | Chouser | but to make any sense of it have to have the docs open and that example I posted. Between the two I can usually muddle through. |
| 02:02 | danlarkin | I was mostly using gen-class because I was translating a Java example, which is in the form of a class (obviously) and it didn't occur to me to simply instantiate a new JFrame and modify it :) |
| 02:03 | Chouser | The solution to every problem in Java is a new class, I think. |
| 02:03 | Chouser | Anyway, I'm off to bed. Have a pleasant whatever-it-is! |
| 02:05 | danlarkin | Thanks for the help again, goodnight |
| 02:05 | danlarkin | 2AM here :-o |
| 02:06 | Chouser | here too! I should not be up. |
| 02:07 | danlarkin | I've got off from work tomorrow, lucky me |
| 02:10 | Chouser | me too, but I've still got to get the kids to school. |
| 02:10 | Chouser | Ok, really going now. |
| 02:10 | danlarkin | night |
| 02:14 | dnm | Hrm. |
| 02:23 | danlarkin | dnm: eh? |
| 02:27 | dnm | Trying to get slime and Clojure working together. |
| 02:28 | danlarkin | what part isn't working? |
| 02:28 | danlarkin | and what environment are you on |
| 02:28 | dnm | Windows, Vista. |
| 02:29 | dnm | Emacs 22.3.1 |
| 02:31 | H4nsX | dnm: i've been successful with that, but have upgraded to emacs-23. what is the problem? |
| 02:33 | dnm | I think it's my local .emacs config. I'm troubleshooting now. |
| 02:34 | H4nsX | lisppaste8: url |
| 02:34 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 02:34 | lisppaste8 | H4ns pasted ".emacs excerpt" at http://paste.lisp.org/display/68409 |
| 02:36 | dnm | I know it's heresy and all, but my patience with [X]Emacs was finally exhausted a few years back. |
| 02:36 | dnm | I wish there were a nice IDEA plugin. ;] |
| 02:36 | dnm | H4nsX: Thanks. |
| 02:37 | H4nsX | dnm: i can understand the sentiment - i wish there was a nice native lisp development environment. |
| 02:37 | dnm | Is Cygwin running h:/clojure/clojure.sh for Swank? |
| 02:37 | H4nsX | dnm: yes - but that is just for the classpath setup. a .cmd will do fine |
| 02:37 | dnm | OK |
| 02:38 | H4nsX | (or the jar method described in the swank-clojure doc, but then you'll have to set up your classpath in your .emacs, which i find incinvenient) |
| 07:02 | cads | http://cadrlife.blogspot.com/2008/07/clone-wizards-of-time-and-space.html |
| 07:03 | cads | gosh I wanna be an Intergalactic voluntarily Bald Clone Wizard of Time and Space... |
| 07:03 | cads | especially if the womens are be lusting for them |
| 07:04 | cads | and most especially if I get to play with lisp while I'm at it |
| 09:14 | yawniek | hi! is there any orm in clojure yet? |
| 09:15 | H4ns | yawniek: clojure does not have an object system to begin with. |
| 09:17 | yawniek | hehe right. ok orm was the wrong term then. but a mechanism to persist data. like mnesia or so |
| 09:18 | H4ns | yawniek: i don't think that there is a native database in clojure beyond spit/slurp yet. and you can always use some java db connectivity solution or couchdb or something like that. |
| 09:19 | yawniek | ok. thanks |
| 11:05 | leafw | question: how can one call clojure code from a java program, transparently? Can perhaps clojure generate a set of .class files (i.e. forsaking dynamic editing and so on) |
| 11:06 | leafw | ideally, the clojure code would be in a jar with some static public methods (I guess that's what defn creates?) |
| 11:07 | tWip | ahead of time compilation is not currently available, as i understand it |
| 11:12 | dudleyf | leafw: You can use gen-and-save-class to generate .class files with stubs that call out to Clojure functions |
| 11:12 | dudleyf | (doc gen-class) |
| 11:13 | dudleyf | I think Rich is working on true AOT compilation right now, too |
| 12:06 | pjb3 | rhickey: So to do the proxy you are talking about for VelocityContext, is it something like this: (proxy VelocityContext [context] (get [key] (context (keyword key)))) |
| 12:06 | pjb3 | I'm doing it wrong somehow |
| 12:07 | pjb3 | but I'm trying to create a proxy for VelocityContext that makes the get method call keyword on the string before doing a lookup in the map |
| 12:07 | pjb3 | I haven't used clojure's proxy before |
| 12:08 | rhickey | pjb3: There is an interface called Context - that is what you want to proxy |
| 12:09 | rhickey | http://velocity.apache.org/engine/releases/velocity-1.5/apidocs/org/apache/velocity/context/Context.html |
| 12:10 | pjb3 | Ok, sound good, but I'm doing something wrong with the syntax of how I call proxy |
| 12:10 | pjb3 | (let [context {:foo 1}] (proxy Context [] (get [key] (context (keyword key))))) |
| 12:10 | pjb3 | Should that work? |
| 12:10 | rhickey | pjb3: mimic: http://clojure.org/jvm_hosted |
| 12:11 | rhickey | (proxy [Context] [] (containsKey [k] ... |
| 12:13 | leafw | dudleyf: thanks for the gen-class tip, seems like clojure has thought of everything |
| 12:17 | pjb3 | rhickey: Thanks, it worked! |
| 12:18 | rhickey | pjb3: great! |
| 12:54 | dnm | Boo: |
| 12:54 | dnm | http://common-lisp.net/cgi-bin/viewcvs.cgi/root.tar.gz?root=slime&view=tar |
| 12:54 | dnm | I'll have to pester someone to fix this. |
| 12:55 | dnm | Probably in #lisp. Sorry for the ranting. |
| 13:42 | blabber | hi everyone |
| 13:42 | blabber | :) |
| 13:42 | danlarkin | hello |
| 13:45 | blabber | can't wait for the book to be out in March from pragmatic programmers |
| 13:52 | rhickey | blabber: I imagine there'll be a beta pdf book before then |
| 13:56 | blabber | awesome |
| 13:57 | blabber | thanks rich |
| 13:57 | blabber | by the way - one line I liked about your intro video "Clojure allows you to code in lisp for a living!" |
| 13:57 | blabber | that was a million dollar sentence :P |
| 13:58 | blabber | man you're a life saver. |
| 13:59 | blabber | looking forward to the beta pdf.. |
| 14:07 | rhickey | fast enough to use as REPL |
| 14:08 | abrooks | rhickey: :) |
| 14:50 | blabber | could anyone suggest any good introductory book on concurrency and parallel programming. |
| 14:55 | karmazilla | blabber: Java Concurrency in Practice |
| 14:55 | blabber | karmazilla: I donot know, or want to know Java - is that a prerequisite? |
| 14:58 | blabber | preprequisite for the book |
| 15:00 | karmazilla | yeah, that would really be an advantage |
| 15:01 | karmazilla | I don't know any language-agnostic books on concurrency and parallelism |
| 15:01 | dudleyf | blabber: It is, but if you intend to do concurrent programming on the JVM, read it anyway |
| 15:02 | dudleyf | It's a good overview of the problems that arise with concurrency and shared mutable state |
| 15:02 | blabber | sure, will do. thanks. |
| 15:02 | blabber | dudleyf: oh really, that is interesting |
| 15:03 | blabber | dudleyf: that is exactly what I would like to get a stronger understanding off |
| 15:03 | karmazilla | in the first couple of chapters, he scares you into reading the rest of the book ;) |
| 15:04 | dudleyf | Or scares you into finding a language that encourages immutability ;-) |
| 15:04 | blabber | I feel before learning clojure, I need to understand the problems that it solves. I will be a happy man if I understand most of clojure.org/state. |
| 15:05 | blabber | Java is not a function language, isn't it difficult writing concurrent programs in Java even if it is for the JVM |
| 15:05 | rhickey | Java Concurrency in Practice is a terrific book, and a great argument for Clojure or something like it |
| 15:06 | dudleyf | Yes, and that book shows just how hard it is to get right |
| 15:08 | jgracin | rhickey: OT, I hope you don't mind me asking, but what is the relation between you and the company that you work for? Do you own that company? I see that at Lisp50, you represent yourself as independent consultant. |
| 15:08 | rhickey | jgracin: I really am an independent consultant. I work for myself, have an LLC |
| 15:10 | jgracin | rhickey: cool. |
| 15:21 | chmu | Is it possible to implement identical? in clojure |
| 15:22 | rhickey | chmu: in terms of what? |
| 15:23 | rhickey | i.e. identical? is a primitive notion |
| 15:23 | chmu | rhickey: I want to keep track of instances with identical? semantics |
| 15:24 | rhickey | chmu: Clojure has identical? |
| 15:24 | rhickey | I'm confused |
| 15:24 | chmu | rhickey: Yes, but I want to extract some unique identifer, ie "pointer" or reference value |
| 15:25 | rhickey | chmu: Java/JVM doesn't offer that |
| 15:25 | chmu | rhickey: The problem is to keep track of nodes visited in a graph |
| 15:26 | rhickey | the nodes themselves are references comparable with identical? |
| 15:27 | chmu | rhickey: Nodes are shared and can therefore include loops |
| 15:27 | chmu | rhickey: The graph can have loops |
| 15:28 | rhickey | chmu: you'll need to use something like IdentityHashMap, all of Clojure's data structures use equality |
| 15:29 | chmu | rhickey: The java-class IdentityHashMap then? |
| 15:29 | rhickey | chmu: yes |
| 15:30 | chmu | rhickey: Do you plan to implement something like this in clojure? |
| 15:32 | rhickey | chmu: I'm trying to get people to use equality semantics as much as possible, but I understand the use case - not sure what the right thing is - almost all non-evil scenarios boil down to what you are trying to do - duplicate detection |
| 15:32 | rhickey | chmu: but you can just put IDs in the nodes |
| 15:33 | rhickey | you can't get a physical loop with immutable data structures anyway |
| 15:36 | chmu | rhickey: I could have a unique ID in every node but to rely on creating nodes using some factory function increasing a gloabl counter seems a bit fragile too |
| 15:36 | rhickey | chmu: in what way? |
| 15:38 | rhickey | if you use refs to make a graph, you're fine too, as Clojure's refs have identity-based equals semantics, as should all mutable things |
| 15:38 | lisppaste8 | karmazilla pasted "immutable loop" at http://paste.lisp.org/display/68437 |
| 15:38 | chmu | rhickey: I don't like global data in general :-). Yes, refs could be an option |
| 15:39 | rhickey | karmazilla: try that in Clojure's data structures |
| 15:40 | karmazilla | I predict the outcome of that attempt won't be worth the effort |
| 15:41 | rhickey | you can create infinite looping sequences, but not physical loops |
| 15:41 | rhickey | chmu: you could close over a counter in your getID fn, need not be global |
| 15:41 | tomppa | In fact, are there any reasonable approaches to functional, cyclic graphs? |
| 15:41 | rapido | rhickey: with lazy evaluation you can get physical loops |
| 15:42 | rapido | in combination with recursive definitions |
| 15:42 | rapido | see: http://www.haskell.org/haskellwiki/Tying_the_Knot |
| 15:42 | chmu | rhickey: What do mean by "close over"? I'm a lisp/clojure-noob |
| 15:44 | rapido | but i believe you can't get physical loops with *strict* immutable structures |
| 15:45 | rapido | tomppa: you can encode cyclic graphs with a non-cyclic data structure |
| 15:45 | rapido | graph == [nodes] + [links-between-nodes] |
| 15:46 | lisppaste8 | rhickey pasted "get-id" at http://paste.lisp.org/display/68439 |
| 15:47 | rapido | i'd rather use cryptographic hashes of values to generate id's |
| 15:47 | tomppa | rapido: hmm, I'm feeling slow today; what about when I need to map them |
| 15:47 | rapido | a global counter is surely to become a bottleneck in a multi-core setup |
| 15:48 | rapido | tomppa: map them (graphs) to what? |
| 15:49 | chmu | rhickey: Thnx, of course, the magic world of closures :-) |
| 15:49 | rhickey | rapido: hashes of values doesn't distinguish node identity, unless it also includes the edges, in which case it won't terminate, unless you can track identity, which was the original question |
| 15:50 | tomppa | rapido: Let say I have a bunch of Nodes that have circular dependancies between themselves, like one Nodes position depends on other Nodes velocity etc. and I need to update those nodes as quickly as possible |
| 15:51 | rhickey | rapido: do you know anything specific about the concurrency limits of CAS? I've been told by experts you could pound on it until about 50 cores |
| 15:51 | rhickey | and of course, you're not going to be giving out ids continuously, so it's not a real concern here |
| 15:52 | tomppa | rapido: I could simulate pointer equality with UIDs but that's likely to be slow and/or complicated |
| 15:53 | rapido | tomppa: interesting problem - hmm |
| 15:53 | rapido | ok, let's encode the graph in a set of nodes and a set of links |
| 15:54 | tomppa | rapido: that's a fairly usual situation with games, and probably other simulation like scenarios |
| 15:55 | arohner | rhickey: did you see my resultset-seq bug & patch? |
| 15:55 | rhickey | rapido: already done, sample code here: http://groups.google.com/group/clojure/msg/df7b0f5673513b85 |
| 15:55 | rhickey | set of nodes, set of links, scales to 600 cores using Clojure's STM (which has one CAS, BTW) |
| 15:56 | tomppa | that's probably quite close to my domain, I'll have to check it, thanks :) |
| 15:57 | rapido | rhickey: ok, got it - looks cool |
| 15:58 | rapido | rhickey: what's clojure set implementation? |
| 15:58 | rapido | rhickey: i know a fast one based on treaps |
| 15:59 | rhickey | arohner: yes, working on AOT right now, kind of falls in the don't do that category for me, as it's plain maps can't have duplicate keys |
| 15:59 | rhickey | rapido: the same array-mapped hash tries as the maps |
| 16:00 | arohner | sure it's a bad idea, but the function explodes with an exception that is non-obvious |
| 16:00 | tomppa | oh, btw while I'm here there is a funny problem when running Clojure from Emacs/SLIME/Win, when opening a new JFrame the REPL seems to hang |
| 16:00 | rhickey | arohner: 'don't do that', not that I won't apply the patch :) |
| 16:00 | rapido | rhickey: the one based on treaps always yields the *same* data structure regardless of insertion order |
| 16:01 | rhickey | tomppa: is it Vista? |
| 16:01 | rapido | which means that a (non)equality check between two sets can be made much faster |
| 16:01 | tomppa | nope, good ole XP |
| 16:01 | rhickey | tomppa: you could paste |
| 16:01 | rapido | compare the hashes of two treaps: if they are unequal the treaps are unequal |
| 16:01 | rhickey | lisppaste8: url |
| 16:01 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 16:01 | tomppa | Inferioir lisp is still active though, so it's not probably a Clojure problem |
| 16:02 | blabber | good night people - nice to meet all of you. |
| 16:02 | rhickey | ah |
| 16:02 | rapido | with treaps you can have very fast union, difference and intersection |
| 16:03 | tomppa | when running Clojure from command line it just takes a second or to complete the new JFrame. SLIME seems to hang on it and will recover after fooling enough with the inferior-lisp buffer |
| 16:03 | rapido | and those algorithms can make trivially parallel |
| 16:03 | rapido | i got it from: http://www.cs.cmu.edu/afs/cs.cmu.edu/project/scandal/public/papers/treaps-spaa98.pdf |
| 16:05 | rapido | rhickey: have you considered treaps when you were searching for an efficient map implementation? |
| 16:07 | tomppa | Just out of curiousity: do people here usually use SLIME/Emacs? |
| 16:08 | tomppa | yep, I'm an emacs zealot |
| 16:08 | arohner | there are a good number of emacs/slime users, but I wouldn't call it even a majority of clojure users |
| 16:08 | rhickey | rapido: I think the treaps might be a nice alternative for the ordered sets, for which I'm using a RB tree right now |
| 16:09 | tomppa | It just occured to me that since it seems that clojure obviously talk the swank protocol, and there is this Eclipse/Swank thing called Cusp... It seems to me like most of the folks familiar with Java would have a passing knowledge of Eclipse |
| 16:12 | rapido | rhickey: and the treap's implementation of a set is easier to do than the RB tree implementation |
| 16:12 | rhickey | except RB tree is already done and I have other things to work on |
| 16:12 | rhickey | :) |
| 16:13 | rapido | rhickey: sure, your todo list must be huge |
| 16:14 | rapido | rhickey: i wonder what's your most pressing todo item? |
| 16:14 | rhickey | Ahead of time compilation right now |
| 16:15 | rapido | what will be the benefits of AOT compilation? |
| 16:16 | rapido | faster startup times? |
| 16:16 | danlarkin | jars |
| 16:16 | rapido | ah, jars.. of course |
| 16:18 | rapido | OAT compilation looks like a tricky subject in the face of macros, on-the-fly proxies, etc |
| 16:19 | rapido | i guess serializing the environment to a jar would do some of the magic.... |
| 16:20 | rapido | (save-env snap-shot-1.jar) |
| 16:20 | rapido | (load-env snap-shot-1.jar) |
| 16:20 | rapido | or something like that.. |
| 16:34 | rapido | which of you are using colloquy? <- sometimes it behaves erratic |
| 16:37 | rapido | may be clojure is going to be the next 100 year language :) |
| 16:38 | rapido | but if not, clojure's concepts will most certainly be the next 100 year concepts! |
| 16:39 | tomppa | It still seems to me that there is too much of the underlying JVM that I would need to know |
| 16:40 | tomppa | I have no problems learning the concepts of the underlying C machine but to spend time on a JVM is a different thing. That of course from the hobbyist/student perspective. |
| 16:40 | rapido | tomppa: just think of the JVM as a platform like sun-solaris or windoze |
| 16:42 | rapido | tomppa: and if you use a small set of standard JVM libraries.. |
| 16:43 | rapido | to leverage a convenient POSIX api |
| 16:43 | rapido | you don't need much knowledge of the JVM |
| 16:43 | tomppa | Well, I think it's much easier for languages like Python etc. but Clojure is fairly pure in its functionality and it just constrast a bit too much with the JVM libraries |
| 16:45 | tomppa | Having an ad hoc FFI is a great thing but will that also mean that there is not going to be that much clojurescy (thin) wrappers for (foreign) libraries |
| 16:46 | tomppa | so that you will end up reading (. foo abstractFactory) on every few lines, which, I think is not quite "clojurescy" |
| 16:47 | rapido | tomppa: i concur: clojure is to java libraries as java libraries are to native libraries (JNI). |
| 16:48 | rapido | tomppa: but you should encapsule java libs with clojure libs |
| 16:48 | rapido | and than you can use clojure all the way |
| 16:49 | rapido | and i believe clojure doesn't need to wrap many java libs to be useful |
| 16:49 | tomppa | but, like I said, it is harder for more functional or otherwise "alien" languages |
| 16:49 | rhickey | tomppa: idiomatic wrappers will be developed according to need, what's nice is that they are not necessary to leverage something right away. vs langs that have to wait for libs, sometimes indefinitely |
| 16:50 | tomppa | that's the ad hoc part, and I think it's very nice |
| 16:50 | rapido | and what's the alternative: re-implement all those useful and practical libraries |
| 16:50 | rapido | ? |
| 16:52 | rapido | it's all about momentum and gaining it by jumping on the biggest lump that is moving :) |
| 16:52 | tomppa | well, Java did also implement lots of useful and practical stuff |
| 16:53 | tomppa | I guess it's just about getting lump moving fast enough and in time :) |
| 16:53 | tomppa | re-implement, that is |
| 16:54 | kotarak | btw, what is the preferred way of writing macros? (list 'foo) or `(foo)? I would expect the latter, since it qualifies the symbols. Maybe (list `foo) (with backquote) is also feasible? |
| 16:55 | karmazilla | trouble is the standard libraries... there's lots of crappy code in the JRE that can't be changed for compatibility reasons |
| 16:55 | rapido | naturally, immutability and concurrency will force new implementations of previously mutable and sequential algorithms |
| 16:56 | rapido | only re-implement when there is a need (for concurrency and immutability) |
| 16:57 | rapido | ... getting more and more urgent in the multi-core world ..... |
| 16:59 | rapido | i believe clojure is 'slider' technology that can move us from the current situation to the desired situation, less painfully. |
| 17:02 | gnuvince_ | How painful does something need to get before the general mass begins moving? I have not been programming long enough to have witness the OO shift, but what did it take to move all those C and Pascal and whatnot programmers to C++ and Java and Smalltalk? |
| 17:05 | tomppa | I think you can forget the Smalltalk |
| 17:05 | tomppa | the furthest most people look is C# and Java |
| 17:05 | rapido | gnuvince_: i had *very* painful moments and most of them had to do with ... destruction of information |
| 17:05 | rapido | deleting files |
| 17:06 | rapido | the same file name - but different contents |
| 17:06 | rapido | the same class name - but different 'implementation' |
| 17:06 | danlarkin | the size of programs was getting too big for people to keep the whole context in their head, OO helped encapsulate things and made it easier for many people to work on a project at once. That was the big push, IMO. That and a huge, huge, huge marketing budget by sun |
| 17:06 | rapido | the same method name - but .... |
| 17:07 | rapido | i got stung by encapsulation *really* bad |
| 17:08 | karmazilla | sometimes OO is abstracting away the wrong details :p |
| 17:08 | rapido | a method that opens a database connection, creates a files and throws an exception |
| 17:08 | rapido | forgets to close the file and database connection |
| 17:08 | rapido | all beautifully encapsulated as a third party library |
| 17:09 | rapido | i don't mind abstractions |
| 17:09 | gnuvince_ | I hang in a French-speaking general programming language channel, and most people there seem either totally unaware that their tools are total crap for concurrent programming (most are C and C++ programmers) or just don't care and think that dealing with locks and deadlocks and race conditions is just part of programming and if you can't do it yourself correctly, you're just a bad programmer (they use the same argument for memory management) |
| 17:09 | rapido | but they shouldn't leak |
| 17:09 | danlarkin | rapido: you can't blame a buggy 3rd-party library on OO :-D |
| 17:09 | rhickey | kotarak: the simpler the better, but use syntax-quote to get name hygiene |
| 17:10 | kotarak | rhickey: I definitively prefer the `() form. |
| 17:10 | kotarak | (which is "syntax-quote" I suppose) |
| 17:11 | danlarkin | gnuvince_: people don't like to change. programmers, bankers, politicians, no one |
| 17:11 | tomppa | gnuvince_, funny. I would have thought that french were beaten enough with Ocaml ;) |
| 17:11 | karmazilla | danlarkin: to an extent you can... language is the framework wherein ideas are created and described. If the language is faulty/error prone, and the thinker human, then trouble is inevitable. Better languages decreases the probability of trouble. |
| 17:12 | rapido | gnuvince_: locks and race conditions are the worst bugs - even worse than memory allocation/deallocation bugs |
| 17:12 | gnuvince_ | tomppa: most of us are actually Quebecers, and I'm the only one singing the praises of functional programming. Probably the only one that knows any function language actually. |
| 17:13 | tomppa | gnuvince_, oh, sorry for the generalisation |
| 17:13 | rapido | gnuvince_: i challenge every programmer that thinks he got manual memory and locking correct for a none trivial application |
| 17:13 | gnuvince_ | rapido: preaching to the choir :) I just have a hard time getting the problem through to them. |
| 17:14 | gnuvince_ | tomppa: no problem, I actually know many French (from France) programmers who *do* swear by OCaml. OCaml is more popular than Haskell there. |
| 17:14 | rapido | gnuvince_: hey, i've got myself burned multiple times |
| 17:14 | rapido | ocaml is nice |
| 17:14 | danlarkin | karmazilla: agreed. but at the same time, one can write correct code in any paradigm |
| 17:14 | gnuvince_ | Basically, once I say the word "immutable", their brains shut down. |
| 17:15 | gnuvince_ | Basically, this destroys their entire view of programming: mutating values at specific memory addresses. |
| 17:15 | tomppa | rapido, ocaml is nice but it _looks_ crappy and has an s*tt* FFI. Among other things... |
| 17:15 | rhickey | gnuvince_: try that on them |
| 17:15 | gnuvince_ | Haskell is just more fun |
| 17:15 | gnuvince_ | rhickey: gonna read that now. |
| 17:16 | rapido | gnuvince_: haskell's got unsafePerformIO or something |
| 17:16 | gnuvince_ | rhickey: got any success on friends/colleagues? |
| 17:16 | gnuvince_ | rapido: yeah it does. |
| 17:16 | arohner | rhickey: it would be interesting if you had a "reading list" of stuff you've read and liked |
| 17:16 | rhickey | yes, definitely - that paper + Clojure |
| 17:17 | gnuvince_ | arohner: I quite liked Rich's "State vs Identity" article on the Clojure website. |
| 17:17 | rapido | this is one of my favorites: http://www.hpl.hp.com/techreports/2002/HPL-2002-32.html |
| 17:18 | karmazilla | I can't even get my collegues to read JCiP... maybe the book looks too big |
| 17:19 | rapido | and i like this obscure language that never got into the limelight: http://www.cs.ttu.edu/~dcooke/sequencel11-27-2006.pdf |
| 17:21 | rapido | and i really *really* feel this is very good research: http://deposit.ddb.de/cgi-bin/dokserv?idn=977115860&dok_var=d1&dok_ext=pdf&filename=977115860.pdf |
| 17:22 | tomppa | damn, my wife has killed the university net quota, takes ages to load the .pdfs |
| 17:22 | rapido | tomppa: lol! |
| 17:23 | tomppa | rapido: hey, the latest True Blood was up! |
| 17:24 | rapido | tomppa: priorities, priorities...... |
| 17:24 | tomppa | ... tell it to her |
| 17:26 | rapido | oh.... it's getting late here in the netherlands.. got to go ... later... |
| 17:27 | tomppa | night |
| 18:22 | arohner | rhickey: thanks. you've made me irritated at syntactic commas in all other languages. |
| 18:22 | arohner | :-) |
| 18:22 | rhickey | :) |
| 18:41 | chmu | has anyone experimented with monads in clojure to express imperative constructs a bit more concise? |
| 18:45 | chmu | I would like to avoid to pass and return state variables. perhaps is refs the way to go in clojure? |
| 19:02 | arohner | chmu: do you have an example? |
| 19:03 | chmu | arohner: I traverse a graph and have to keep at least two states. Visited nodes (a set) and a string pool offset table (hash table) |
| 19:04 | chmu | arohner: With "classical" functional style I would have to return these values from every function |
| 19:04 | arohner | without knowing your app, it sounds like vars, refs or agents could all work |
| 19:05 | chmu | arohner: vars are per thread and refs are global - right? |
| 19:06 | arohner | refs are global, yes. |
| 19:06 | arohner | Vars can have a "default" global value, and then thread local values |
| 19:07 | arohner | vars can also have stack behavior: |
| 19:07 | arohner | (def x 1) (binding [x 42] (a) (b)) (c) |
| 19:08 | arohner | inside (a) and (b), x will be 42, and will return to 1 when leaving the binding form |
| 19:08 | arohner | you can also use set! on the var |
| 19:09 | chmu | arohner: ok, could you pass vars created in a binding outside the context? |
| 19:10 | arohner | are you asking about passing the var object or the value? |
| 19:10 | chmu | arohner: The object. Is the (def x) the only way to create vars? |
| 19:11 | arohner | I believe so |
| 19:11 | chmu | arohner: I would like to create a var in the first function and then pass on |
| 19:11 | arohner | you can pass the var around, but (I think) the value will change depending where you are when you evaluate |
| 19:11 | chmu | arohner: ok, perhaps refs are better for my purpose then? |
| 19:12 | arohner | if you pass the value that the var points to around, that is always immutable |
| 19:13 | chmu | arohner: Is (with-local-vars) similar to (binding)? |
| 19:14 | arohner | I'm not sure, I've never used it |
| 19:15 | Chouser | huh, I hadn't looked at with-local-vars before. Both it and (binding) use Var/pushThreadBindings, so I guess they're substantially similar. |
| 19:16 | Chouser | chmu: you can create a ref in a func, pass it around letting other functions change it, and read it at any point including once you've returned back to the initial function. |
| 19:17 | Chouser | but now that I'm starting to understand with-local-vars, that may be what you want. |
| 19:18 | Chouser | it creates the var for you (unlike "binding" with requires the vars to be defined with def first) but then you can var-set and var-get to change and read the var within the same thread -- no STM or locking. |
| 19:20 | chmu | Chouser: Is it also possible to pass vars in (with-local-vars) to other functions? |
| 19:23 | Chouser | you can pass the var itself, yes |
| 19:24 | chmu | Chouser: Great stuff. Thnx :) |
| 19:25 | Chouser | no, thank you -- I didn't know these tricks with Var until trying to answer you questions. :-) |
| 19:26 | chmu | heh |
| 20:06 | rhickey_ | anyone looking to try rev 1068 must put ./gen in the classpath |
| 20:24 | gnuvince_ | rhickey_: do you have other papers about state that are a good read? |
| 20:28 | rhickey_ | gnuvince_: not offhand |
| 20:31 | gnuvince_ | ok, thanks. |
| 20:34 | Chouser | rhickey_: for AOTC you're producing class files directions instead of java source? |
| 20:35 | rhickey_ | Chouser: yes |
| 20:37 | blackdog | what's class files directions? |
| 20:37 | Chouser | sorry my typo. "class files directly" |
| 20:37 | rhickey_ | my reado |
| 20:38 | blackdog | ah ok |
| 20:38 | rhickey_ | yes, it ends up being a better first step - no debug info issues, no possible differences with current code emit |
| 20:38 | blackdog | oh no source, why did you change your mind rhickey_ ? |
| 20:39 | rhickey_ | I'm hoping there will be good acceptance of the classfiles by converters etc. |
| 20:39 | rhickey_ | generating source is always a future option |
| 20:43 | blackdog | removing the extra compilation step with javac must be a good thing |
| 20:43 | Chouser | hoping -- no testing yet, such as with android? |
| 20:43 | rhickey_ | Chouser: right android is one |
| 20:44 | rhickey_ | But I think Scala bytecode translates, and they don't gen Java afaik |
| 20:44 | rhickey_ | obfuscators would be another |
| 20:45 | rhickey_ | should be pretty obscure - non-javac bytecode + mangled names |
| 20:45 | rhickey_ | some constructs would be awkward going to Java source - no goto |
| 20:46 | Chouser | they have java decompilers, right? I wonder if they'd just punt on seeing a goto. |
| 20:48 | rhickey_ | javac generates gotos, it's just that Clojure code doesn't correspond to Java constructs |
| 20:48 | Chouser | oh, ok. |
| 20:49 | blackdog | so aot before lisp50 then rhickey_ :P |
| 20:50 | rhickey_ | blackdog: maybe |
| 20:50 | blackdog | cool, it was just a joke! |
| 20:50 | rhickey_ | I'm pretty close |
| 20:51 | blackdog | good platform for an announcement though |
| 20:55 | rhickey_ | I think I'll be busy justifying Clojure's existence there |
| 20:57 | blackdog | i think most open minded folks will realise it's the NBL ;) |
| 21:08 | scottj__ | In order to import files such as Order.java that's in C:\libraries\com\company\lib, all I should need is to start Clojure with java -cp C:/libraries;C:/src/clojure/clojure.jar clojure.lang.Repl and then type (import '(com.company.lib Order)) right? |
| 21:09 | blackdog | also add c:\libraries to your classpath |
| 21:09 | blackdog | duh |
| 21:09 | blackdog | missed it :) |
| 21:09 | rhickey_ | you'll need Order.class, not Order.java |
| 21:10 | scottj__ | ok, there's my problem. |
| 21:20 | dudleyf | rhickey_: Do you know of any actual implementations of FRP systems based on the paper you linked earlier? |
| 21:22 | rhickey_ | dudleyf: Clojure is the closest I know of, but doesn't use relations for state |
| 21:25 | rhickey_ | I hope to get in Datalog, adding a query model and declarative rules |
| 21:28 | Chouser | then just store your data in postgres, and you're all set. |
| 21:28 | rhickey_ | Chouser: postgres instead of datalog? |
| 21:29 | Chouser | postgres instead of in-memory relations (for state) |
| 21:29 | Chouser | largely a joke, though many "classic" web app designs come pretty close to that |
| 21:33 | dudleyf | Do you get Durability (as in ACID) with a datalog implementation, or is it all in-memory? |
| 21:34 | rhickey_ | dudleyf: in memory |
| 21:35 | rhickey_ | I don't think relational is a good model for in-memory data manipulation |
| 21:36 | rhickey_ | So I draw broader conclusions from the paper - the desirability of a data model and a declarative style |
| 21:37 | dudleyf | But if it doesn't survive a reboot or a crash, it's hard to depend on for business data |
| 21:39 | dudleyf | And that's really the only context I have for caring about a data model |
| 21:39 | rhickey_ | dudleyf: it's not a replacement for a DB, just a way to manipulate data within a program, vs ORM classes say |
| 21:46 | emacsen | I've heard that Clojure can't do continuations. Is that because of the JVM or a language choice? |
| 21:48 | rhickey_ | both |
| 21:48 | emacsen | Well, if you chose not to put them in, it didn't matter if the JVM supported them or not |
| 21:48 | emacsen | So, why not? |
| 21:48 | emacsen | You're a smart dude, so I'm curious as to why you don't think continuations are a good thing. |
| 21:50 | rhickey_ | well, I think continuations are complicated to implement, and difficult for developers to understand |
| 21:51 | emacsen | Okay. If that's your reason it's a fair one. I don't agree it's any more complicated than other parts of Lisp (which is full of stuff that's "hard to understand") but that's fair |
| 21:52 | rhickey_ | compare Clojure's lazy-cons to any implementation of generators on continuations |
| 21:52 | Chouser | Paul Graham implemented continuations in CL using macros. Someone could try that in Clojure. |
| 21:53 | rhickey_ | Chouser: those were not real continuations |
| 21:53 | rhickey_ | Clojure is really very simple, I've never seen any continuation code that was simple |
| 21:54 | emacsen | simple, no. I've seen some that's really powerful though. |
| 21:54 | emacsen | maybe it's possible with your data model to fake some of that. I don't know enough to say |
| 21:55 | rhickey_ | I understand the theoretical building-block notion, and therefor the fit for Scheme, but when you say, you can use them to implement exceptions, well, already have, generators, already have lazy seqs, threads, etc etc - I don't fid myself needing them |
| 21:55 | emacsen | I'm thinking of an example I saw a speaker talk on this weekend regarding a continuation-based regex parser |
| 21:55 | rhickey_ | find |
| 21:56 | emacsen | and the schemers and arkers (all 20 of them) like them for stateful web programming |
| 21:56 | emacsen | s/ark/arc |
| 21:57 | rhickey_ | I don't think true language continuations are useful for web stuff, rather pseudo continuations in the context of the web app - language continuations capture too much, or don't have enough control |
| 21:57 | emacsen | http://www.lisperati.com/arc/regex.html is what I was thinking of (ignore the pic) |
| 21:57 | emacsen | now, I'm thinking "how else could this be done" |
| 21:58 | emacsen | and I guess, maybe you could do something like have a new thread per match |
| 21:58 | emacsen | and then come back at the end, do them all at once |
| 21:59 | emacsen | so, you're probably right |
| 21:59 | emacsen | not strictly necessary |
| 22:01 | rhickey_ | I can't read arc code, but I noticed CPS and lazy-lists in the description - again, already have lazy-seqs |
| 22:03 | emacsen | He presented the code, but I can't reproduce it from memory. There's probably a way to do the same thing. |
| 22:04 | emacsen | So, let me radically change the subject |
| 22:04 | emacsen | Do you think you'll be in the mid-atlantic (DC) area any time in the next year? |
| 22:05 | rhickey_ | emacsen: I'm not saying you can't do cool things with them, but there's a cost/benefit relationship to weigh before adding something like that. So far, very few languages have chosen continuations as fundamentally necessary |
| 22:05 | rhickey_ | DC? no plans so far |
| 22:05 | emacsen | yeah. It's a language design choice, and I'm not a language designer. |
| 22:06 | emacsen | and you're probably right- lazy-cons can probably fit the bill most places |
| 22:06 | emacsen | There are two groups in the area dedicated to "fringe" languages, so was just curious |
| 22:07 | rhickey_ | do you have many members? |
| 22:07 | pjb3 | emacsen: which two are you referring to? |
| 22:08 | emacsen | pjb3, well, FringeDC and there's one in Reston, I'm looking for the name. Both groups are fairly small. The most people I've seen attend a meeting is 30some |
| 22:08 | pjb3 | emacsen: NovaLang? |
| 22:09 | emacsen | they're a gaming group I believe, Novalang |
| 22:09 | emacsen | oh, no |
| 22:10 | emacsen | there are two novalang groups... confusing. so maybe. :) |
| 22:10 | emacsen | I won't go all the way to reston for my girlfriend, so not going all the way there for a computer meeting :) |
| 22:10 | pjb3 | The one I'm talking about just finished up studying Erlang and is now contemplating the next language |
| 22:11 | emacsen | I have no idea how big/small they are. But yes, I hear they're big on Erlang |
| 22:11 | emacsen | are you a member? |
| 22:11 | pjb3 | I'm in Baltimore but in Bethesda a few days a week, so I go to those meetings when I can |
| 22:11 | emacsen | Why didn't you go to the FringeDC meeting Saturday? |
| 22:12 | emacsen | DC is a heck of a lot closer than Reston |
| 22:12 | pjb3 | I was at RubyDCamp in Reston |
| 22:12 | emacsen | (tell me if I'm off topic and I'll move the conversation) |
| 22:12 | emacsen | gotcha |
| 22:12 | pjb3 | Where does FringeDC meet? |
| 22:12 | emacsen | It keeps changing (this is something Conrad seems to like, but I don't. Last time we met at HacDC |
| 22:13 | emacsen | Meetings are also only every quarter, so it's hard to keep things going. I think he'd do better to have a meeting every month on a learning track, perhaps |