2009-01-30
| 00:02 | lisppaste8 | hiredman annotated #74521 with "generic zipper based s-exp transform" at http://paste.lisp.org/display/74521#2 |
| 00:38 | durka42 | http://blog.headius.com/2009/01/my-favorite-hotspot-jvm-flags.html |
| 00:41 | cooldude127 | hiredman: what's with you and the point-free style lately? |
| 00:44 | hiredman | cooldude127: it is fun |
| 00:44 | cooldude127 | lol |
| 00:44 | hiredman | and that transform function is very useful anyway |
| 00:45 | cooldude127 | hiredman: yeah looks like it |
| 00:58 | ayrnieu | very irritating, and not actually an attempt to reinvent OOP: http://gist.github.com/54950 |
| 01:32 | Cark | ayrnieu what's irritating ? |
| 01:36 | ayrnieu | cark - it's very brittle. a straightforward counter-tester immediately failed; while dealing with this I found that I could have an identical 'go' and 'omfgseriously', and only the latter would seem to work; (recur st) seems like it ought to work, but doesn't. And I keep saying "work" and "doesn't work" because I couldn't locate so many failures. |
| 01:37 | Cark | maybe you need better error reporting |
| 01:37 | Cark | when working with agents, most errors are hidden |
| 01:37 | ayrnieu | I still don't know why this works but very similar earlier editions would support (! counter-tester :go) ... no failures, @counter-tester responds, but ... wait for it ... (? counter :status) shows no change. |
| 01:39 | ayrnieu | although I'm happy that counter-tester responds to :please-stop even while it is sleeping or telling itself to :forever |
| 01:41 | Cark | that not your trouble but, why do you need the ? function ? |
| 01:42 | Cark | can't you just read the current state with @ ? |
| 01:42 | ayrnieu | I can in these examples, yes. |
| 01:42 | Cark | is it because you want it encapsulated behind a function call ? |
| 01:43 | ayrnieu | I want something to match the Erlang pattern where process A sends its Pid with a message to process B, so that B can reply to A. |
| 01:43 | ayrnieu | rather, the more specific pattern where A sits and waits for B's reply. |
| 01:44 | Cark | yep i see |
| 01:44 | Cark | anyways for your problem i'd sprinkle a good dose of println statements all over the place to see what's hapenning |
| 01:44 | Cark | concurrency is hard =/ |
| 01:46 | ayrnieu | it's easier with enough architecture. |
| 01:46 | ayrnieu | for instance, how can I kill counter-tester without asking it so politely? :-) |
| 01:47 | Cark | i don't think there's anything in clojure to do that |
| 01:47 | ayrnieu | how can a monitoring process know when I do that? |
| 01:47 | ayrnieu | right. |
| 01:48 | Cark | well you're inventing new constructs there ... if you could find a way to access the underlying thread object ... |
| 01:49 | Cark | or maybe you should start the thread yourself for complete control |
| 02:27 | karmazilla | Trying to run a clj class (compiled, gen-class'ed) I get an exception that the something__init.class could not be located |
| 02:33 | karmazilla | nm |
| 02:37 | lisppaste8 | ayrnieu annotated #74340 with "WFM. What are you doing?" at http://paste.lisp.org/display/74340#1 |
| 03:24 | zakwilson | Has anybody made a simple Swing REPL that I could add on to an app for debugging? |
| 03:31 | ayrnieu | you can add clojure.contrib.server-socket:create-repl-server to an app for debugging. |
| 03:33 | ayrnieu | MikeM has a swing repl: http://groups.google.com/group/clojure/browse_thread/thread/64dd96887f23b08c/9b49c17330715693 |
| 03:33 | ayrnieu | look here for related files: http://groups.google.com/group/clojure/files |
| 03:35 | ayrnieu | oh, and there's this: http://github.com/Chouser/textjure/blob/4e1ad10474b134214ca959068879647430b9de38/srepl.clj |
| 03:47 | zakwilson | Thanks, ayrnieu. |
| 04:03 | AWizzArd | Moin moin |
| 04:26 | lisppaste8 | ayrnieu pasted "mysterious ClassNotFoundException" at http://paste.lisp.org/display/74563 |
| 04:27 | ayrnieu | ... can anyone explain that? This is for cl-format, which (among other things) is a pretty-printer for clojure, from CL. http://github.com/tomfaulhaber/cl-format/tree/master |
| 04:31 | ayrnieu | ah, I see. It should be building a class for ColumnWriter, and is not. I thought the problem was that it didn't put the .clj in the .jar |
| 04:47 | AWizzArd | ayrnieu: the ColumnWriter is a class yes? Why do you want to use it? |
| 04:48 | AWizzArd | shouldn't you instead (import it)? |
| 04:48 | ayrnieu | I don't, I just want cl-format to work. Its build.xml assumes that the class has already been compiled. |
| 06:13 | hoeck | wow, I just got the -> macro |
| 06:23 | opqdonut | you mean the -> type? |
| 06:23 | opqdonut | or a lambda expression \x -> |
| 06:24 | opqdonut | woops wrong channel |
| 06:24 | opqdonut | thought i was in #haskell, nvm |
| 06:27 | hoeck | opqdonut: i wish i could understand that too :) |
| 06:30 | lenst | ,(macroexpand '(-> 1 (+ 2))) |
| 06:30 | clojurebot | (+ 1 2) |
| 06:36 | zakwilson | I'm getting java.lang.NoClassDefFoundError: clojure/proxy/java/lang/Object$ActionListener when I try to compile a file that proxies ActionListener. I think I've seen this and solved it before, but I don't remember how. |
| 06:48 | leafw | supose I have three variables, and I want to check that none of them is -1. What is an idiomatic way to do so? |
| 06:49 | achim_p | zakwilson: apart from proxy, compilation works for you? |
| 06:50 | achim_p | leafw: i'd do it that way: (not-any? #{-1} [x y z]) |
| 06:50 | leafw | hum, but if you had to do that a couple thousand times ... |
| 06:50 | leafw | doesn't look proper, even if idiomatic. Thanks in any case. |
| 06:52 | leafw | it does read, though, so clear :) |
| 06:52 | leafw | it's a pleasure to program again. I think I know too much java, and what ugliness java is going to under that short, nice, clear sentence. |
| 06:59 | achim_p | leafw: it's not especially slow. a chain of if-nots is faster, of course |
| 07:03 | achim_p | does anybody know of a smooth way of automatizing builds of mixed java/clojure projects? |
| 07:03 | achim_p | worst case scenario: an alternating dependecy chain java <- clojure <- java <- ... - can ant (or some other tool) be scripted to deal with this? i don't know ant at all |
| 07:11 | leafw | achim_p: then learn a bit of ant. The "simple" way to deal with circular dependencies is to call javac on all packages at once, letting java deal with them. |
| 07:12 | achim_p | leafw: yeah, but javac doesn't know how to handle .clj files |
| 07:14 | leafw | achim_p: true. Then you may need to do incremental compilations. |
| 07:14 | achim_p | leafw: is there any tool/framework that supports it? |
| 07:15 | achim_p | i'm looking at the java compiler api, but that doesn't seem to do dependency resolution at all (at first glance) |
| 07:16 | Lau_of_DK | cgrand: Did you fix that bug in core yesterday? |
| 07:22 | leafw | achim_p: I am not aware of any, but I don't use IDEs. Perhaps eclipse or netbeans let you do it. |
| 07:22 | leafw | particularly the eclipse compiler, I've seen it do much smarter things than javac |
| 07:24 | achim_p | leafw: thanks! i'll have a look. maybe it can be used standalone |
| 07:24 | Lau_of_DK | ,(let [s1 [1 2] s2 [1 2]] (identical? (rest s1) (rest s2))) |
| 07:24 | clojurebot | false |
| 07:26 | Holcxjo | My understanding was that identical? is true in very few situations -- why would you want the two to be identical? |
| 07:27 | Lau_of_DK | The question is (identical? 2 2) |
| 07:27 | AWizzArd | yes |
| 07:27 | AWizzArd | All instances of primitive datatypes are Singletons. |
| 07:27 | Holcxjo | but (rest [1 2]) isn't 2, is it? |
| 07:27 | AWizzArd | But in theory you should not rely on that. |
| 07:28 | AWizzArd | Holcxjo: correct |
| 07:28 | AWizzArd | The rest is the vector that contains the 2. |
| 07:29 | Lau_of_DK | ,(rest [1 2]) |
| 07:29 | clojurebot | (2) |
| 07:29 | Holcxjo | I guess with a smart enough system one could hope for (let [s1 [1 2], s2 [1 2]] (identical? s1 s2)) to be true. |
| 07:29 | Holcxjo | But I wouldn't count on it |
| 07:29 | Lau_of_DK | Holcxjo: The problem is, that this bug causes 'partition-by', which Rich himself wrote, to crash |
| 07:30 | Holcxjo | let alone for something to be derived from them to be identical... |
| 07:30 | AWizzArd | Holcxjo: well, it would be possible for the compiler to make them identical. |
| 07:31 | AWizzArd | The problem is that this code runs on the JVM which was designed for a language that has side effects (Java). |
| 07:31 | AWizzArd | And in that case it would not be clear if you would actually want those objects to be the same. |
| 07:32 | Holcxjo | AWizzArd: But these are Clojure object which are immutable -- surely it is safe to make them identical? |
| 07:32 | AWizzArd | In principle yes, but Rich would have to work for that to work. |
| 07:32 | Holcxjo | AWizzArd: Again, I appreciate that the Clojure will probably not do this optimisation; not really worth it |
| 07:33 | AWizzArd | The JVM might not provide tools so that this behaviour could be implemented in one evening. |
| 07:34 | Lau_of_DK | I've seen Rich commit about ~8000 lines in a week, so.. its possible |
| 07:34 | AWizzArd | Although I think that the javac looks for string literals in source files and makes sure that each occurence of "hallo" references the same object in memory. |
| 07:34 | AWizzArd | Lau_of_DK: right *g* |
| 07:34 | AWizzArd | I'm not sure though if Rich is actually a real person. Possible that he is in reality an advanced Clojure program... |
| 07:34 | Lau_of_DK | But AWizzArd I think this is a change that has already been implemented, and then removed |
| 07:35 | Lau_of_DK | ,(doc partition-by) |
| 07:35 | clojurebot | java.lang.Exception: Unable to resolve var: partition-by in this context |
| 07:35 | Lau_of_DK | (doc partition-by) |
| 07:35 | clojurebot | No entiendo |
| 07:35 | cgrand | Lau_of_DK: it wasn't a bug in core, rich never made any guarantee about identical? |
| 07:35 | Lau_of_DK | (doc contrib/partition-by) |
| 07:35 | clojurebot | Excuse me? |
| 07:35 | Lau_of_DK | cgrand: But he made partition-by which now dies, so that makes it a bug right? |
| 07:36 | cgrand | a bug in partition-by |
| 07:36 | Lau_of_DK | Thats a matter of definition - But I can agree that its not a bug since there are no guarantees |
| 07:37 | cgrand | identical? must really be used with extra cautiousness |
| 07:38 | AWizzArd | hmm, where does partition-by crash? |
| 07:38 | AWizzArd | Lau_of_DK: do you have a test case for me? |
| 07:39 | Lau_of_DK | (partition-by #(> % 5) [1 2 3 4 5 6 7 8 9 10]) |
| 07:39 | cgrand | AWizzard: (partition-by identity [1 2]) in contrib < r423 |
| 07:41 | cgrand | but (partition-by identity '(1 2)) worked fine, most people must have been using partition-by on lazy seqs so were not experiencing this bug |
| 07:48 | Holcxjo | clojurebot latest? |
| 07:51 | cgrand | Lau_of_DK: making the promise that (let [v [1 2]] (identical? (seq v) (seq v))) and (let [v [1 2]] (identical? (rest v) (rest v))) etc. return true would be fasible but would consume a lot of memory once the seq is realized (one seq object per item in the vector) |
| 07:51 | Lau_of_DK | Thats true |
| 07:52 | Lau_of_DK | I dont really need it, I just thought it needed to be discussed, for the current situation I'll work my way around it |
| 07:53 | cgrand | the current situation being your use of partition-by? |
| 07:54 | Lau_of_DK | Yes |
| 07:54 | cgrand | you don't want to update your copy of contrib? |
| 07:55 | Lau_of_DK | If its fixed in contrib, updating is not a problem |
| 07:56 | cgrand | I fixed it yesterday when you reported the bug |
| 07:56 | Lau_of_DK | Good man - Thanks alot |
| 08:06 | Lau_of_DK | You can pass the contents of a file to your function as a stream, using FileInputStream. What are my options if I want a plain string, to be passed as a stream ? |
| 08:10 | cgrand | (-> s (.getBytes "UTF-8") ByteArrayInputStream.) ; you can't use a Reader? |
| 08:13 | Lau_of_DK | Im not sure - Im Java illiterate |
| 08:13 | leafw | Lau_of_DK: StringReader http://java.sun.com/j2se/1.5.0/docs/api/java/io/StringReader.html |
| 08:15 | Lau_of_DK | That looks like the ticket |
| 08:15 | Lau_of_DK | Thanks |
| 08:15 | cgrand | if you want to deal with characters use Reader/Writer, Streams are for bytes |
| 08:16 | Lau_of_DK | I need something that line-seq will swallow, ideally a BufferedReader of some sort |
| 08:18 | Lau_of_DK | StringReader -> BufferedReader works like a charm |
| 08:22 | Raynes | Lau_of_DK: Does DK stand for Donkey Kong? |
| 08:24 | AWizzArd | or could it be Denmark? |
| 08:25 | Holcxjo | Denmark is quite likely -- ip address is from Aalborg, DK |
| 08:27 | Raynes | It should stand for donkey kong. |
| 08:27 | Raynes | :< |
| 08:28 | Lau_of_DK | Raynes: Its short for Denmark |
| 08:28 | Raynes | That sucks. |
| 08:29 | Holcxjo | Raynes: Denmark is quite nice actually |
| 08:30 | Raynes | I don't care. He shouldn't have DK in his name unless it stands for Donkey Kong. |
| 08:30 | Raynes | It's just not right. |
| 08:31 | Holcxjo | The spaniards might argue that you should not have "es" in your name unless you are from Spain. :-) |
| 08:33 | Lau_of_DK | Holcxjo: Its been a while since Denmark was 'nice' :) |
| 08:33 | Raynes | Lau_of_DK: Is there any Donkey Kong in Denmark? |
| 08:33 | Lau_of_DK | Raynes... Do you want a recommendation for another channel that might be more your style of chatting? |
| 08:34 | Raynes | I'm just joking around. I didn't know off topic chatting was not allowed here, and I didn't realize I was bother anyone. |
| 08:35 | Raynes | bothering* |
| 08:35 | Lau_of_DK | Dont worry about it - Normally Rich is pretty strict about off-topic chat. In this case, I just felt like it was a bit pointless :) |
| 08:36 | Raynes | Might I suggest making a channel specifically for off-topic chat. Even #Haskell has it's #Haskell-Blah off topic counterpart. |
| 08:40 | Lau_of_DK | Raynes: Its been discussed, and its been decided due to the low volume we currently have, that its best not to seperate the two. |
| 08:40 | Lau_of_DK | I agree with that actually, its great for newcomers to come in here and get the latest news straight from Rich |
| 08:40 | Lau_of_DK | He's pretty active |
| 08:42 | Raynes | What logic is that? Have a channel set aside just for those who don't want to talk about Clojure, how could that possibly effect the volume of this channel? If people want to talk about Clojure, they will know where to go. |
| 08:42 | Raynes | You'll have to explain what you mean better, because it just isn't sinking in for me. |
| 08:44 | Raynes | Unless you want more off topic chatter going on in here, and less people who actually talk. If that's the case then I suppose I'm wrong. |
| 08:44 | Raynes | Well anyways, I'm going to shut up with the off-topicness before someone cracks the whip. |
| 08:46 | lisppaste8 | red_fish pasted "untitled" at http://paste.lisp.org/display/74571 |
| 08:47 | lisppaste8 | red_fish pasted "Object in clojure like javascript" at http://paste.lisp.org/display/74572 |
| 09:39 | cooldude127 | can anyone explain why taking the value of a macro is simply not allowed? |
| 09:39 | keithb | What is the best language construct to use when I want to perform a side effect n times? loop seems a little awkward because I have to explicitly state an exit condition with if. |
| 09:39 | cooldude127 | what's different than taking the value of a function? |
| 09:40 | cooldude127 | keithb: while? maybe a for with a dorun around it? |
| 09:45 | durka42 | doseq? |
| 09:46 | rhickey | keithb: dotimes |
| 09:46 | rhickey | (doc dotimes) |
| 09:46 | clojurebot | bindings => name n Repeatedly executes body (presumably for side-effects) with name bound to integers from 0 through n-1.; arglists ([bindings & body]) |
| 09:48 | keithb | Thanks, everyone. Rich, dotimes is exactly what I was looking for. |
| 09:54 | rhickey | library page shaping up: http://clojure.org/libraries |
| 10:05 | durka42 | i think clojure.org/libraries needs a TOC at the top |
| 10:05 | durka42 | i bet it could be auto-generated |
| 10:12 | red_fish | What do you think about encapsulation in clojure by objects (hashmap)? http://www.crockford.com/javascript/private.html |
| 10:13 | red_fish | http://paste.lisp.org/display/74572 |
| 10:13 | leafw | red_fish: isn't that a bean? |
| 10:13 | leafw | ,(doc bean) |
| 10:13 | clojurebot | "([x]); Takes a Java object and returns a read-only implementation of the map abstraction based upon its JavaBean properties." |
| 10:14 | red_fish | leafw: I don't know |
| 10:16 | leafw | ,(let [b (bean "that")] (:bytes b)) |
| 10:16 | clojurebot | #<byte[] [B@7bd86d> |
| 10:16 | cooldude127 | no not a bean in the sense of clojure, but it behaves an awful lot like a java bean |
| 10:16 | red_fish | it's a javascript tecnique |
| 10:16 | red_fish | for private e public methods |
| 10:17 | leafw | yeah I see that the pastebin example is quite different. But that style is like building an object oriented system ... which you can do with defstruct |
| 10:17 | red_fish | that's the point |
| 10:17 | cooldude127 | in clojure, if you have a setter, you're doing it wrong |
| 10:17 | red_fish | how can I implement encapsulation with defstruct? |
| 10:18 | leafw | red_fish: consider that perhaps you don't need encapsulation, because clojure objects are all immutable. |
| 10:18 | cooldude127 | red_fish: what exactly do you need encapsulation for? |
| 10:18 | leafw | red_fish: only if you include java objects in them, with their imperative model baked in, you may want to protect them. |
| 10:18 | red_fish | cooldude127: to master complexity of big programs |
| 10:19 | cooldude127 | red_fish: i'm not sure i understand. in clojure, i don't think encapsulation makes sense |
| 10:19 | red_fish | In computer science encapsulation and information hiding makes sense |
| 10:20 | red_fish | functional decomposition doesn't scale to program of 10M sloc |
| 10:20 | cooldude127 | we have data, and we have functions that operate on that data. but since everything is immutable, why do we need to hide anything? |
| 10:20 | red_fish | hide details |
| 10:20 | red_fish | conventional interfaces |
| 10:20 | red_fish | blackbox |
| 10:21 | red_fish | I would like to prove the OO is a particular case o functional paradigm |
| 10:21 | cooldude127 | red_fish: you can achieve a black box by just creating a set of functions that operate on your data, and only using those functions to manipulate them |
| 10:21 | red_fish | how can I enforce that? |
| 10:21 | cooldude127 | encapsulation isn't necessary if you behave yourself |
| 10:22 | cooldude127 | red_fish: why should you have to? |
| 10:22 | red_fish | Just curiosity |
| 10:22 | Chousuke | enforced encapsulation is pointless if you ask me. |
| 10:23 | Chousuke | there's always a way around it |
| 10:23 | cooldude127 | it just doesn't make sense to me in a functional context |
| 10:24 | cooldude127 | when there is no danger of your details being messed with, who cares who sees them? |
| 10:26 | Chousuke | of course a compiler can "enforce" encapsulation by doing type checking and stuff, but in a dynamic language you just need to trust the user not to do stupid things. |
| 10:26 | cooldude127 | Chousuke: dynamic typing is all about trust |
| 10:27 | Chousuke | it's their fault anyway if they go and do things your library does not support. |
| 10:27 | leafw | red_fish: "functional decomposition doesn't scale to program of 10M sloc" -- check your premises. In my experience, only functional style with a very small mutable core enabled success in large projects with several developers. |
| 10:27 | red_fish | If I don't publish a public interface, your client could write their own functions and you cannot change the implementation details of your data |
| 10:28 | cooldude127 | red_fish: you should have already written your public interface |
| 10:28 | cooldude127 | your library is the public interface |
| 10:28 | red_fish | the functions or the data? |
| 10:29 | cooldude127 | if they mess with your structures without using your functions, they're asking for it |
| 10:29 | cooldude127 | red_fish: the functions are the interface |
| 10:29 | Chousuke | I have no experience of very large projects, but I have to say that I find functional interfaces much easier to cope with than something object-oriented, like the java standard library for example. |
| 10:29 | Chousuke | the java libraries have rather complex dependencies; if you have a functional interface, you can ignore all that. |
| 10:30 | cooldude127 | yeah |
| 10:30 | shoover`` | publish public functions, which accept and return data and internally control any side effects. clients can do what they want to the data, but they must call your functions to get side effects. verify the data yourself before making side effects |
| 10:30 | Chousuke | I guess it's closest to true encapsulation that you can get :/ |
| 10:31 | Chousuke | if you have a function that is known to work, you do not need to know *anything* about how it works, because it has no side-effects :) |
| 10:31 | red_fish | shoover``: you mean I have to you defn- and def-? |
| 10:32 | cooldude127 | yeah those would be advised if you don't want something to be public |
| 10:32 | red_fish | can you explain how would you implement separation of responsability in the snake example? |
| 10:33 | cooldude127 | not familiar with the snake example |
| 10:33 | red_fish | http://github.com/stuarthalloway/programming-clojure/blob/a3c829f5726c0ab1e565aff86a2e68eca8539a47/examples/snake.clj |
| 10:34 | red_fish | where is the public interface? |
| 10:34 | shoover`` | red_fish: yes, I've seen examples where state is maintained via refs and agents hidden behind functions. you can define the state with def- to make sure it doesn't leak out |
| 10:34 | red_fish | where are the implementationd details? |
| 10:35 | Chousuke | red_fish: the public interface is the "game" function |
| 10:35 | shoover`` | the clojure standard library is full of examples that hide implementation details. agents and refs themselves, for example. simple function interfaces that hide all kinds of details |
| 10:36 | Chousuke | red_fish: that's not so great an example though as it's not a library |
| 10:37 | red_fish | the snake entity (or object in java) is not encapsulated very well in my opinion |
| 10:37 | Chousuke | red_fish: but you can see how the code is divided to the functional parts, then the mutable parts, and then the UI part. |
| 10:37 | cooldude127 | red_fish: what's wrong with the snake? |
| 10:38 | Chousuke | it's a functional piece of data; it's not like you can modify it from the outside |
| 10:39 | red_fish | how can I identify the functions that modify the snake structure? |
| 10:39 | cooldude127 | red_fish: nothing modifies a snake |
| 10:39 | red_fish | ok |
| 10:39 | cooldude127 | red_fish: snakes and everything else are immutable |
| 10:39 | red_fish | that produce new snake? |
| 10:40 | Chousuke | red_fish: you can look for functions that take a snake as an argument. |
| 10:40 | red_fish | probably I should create a namespace only for snake |
| 10:40 | cooldude127 | red_fish: the ones that sound like it: turn, move, etc. |
| 10:40 | red_fish | that's the problem |
| 10:41 | red_fish | image 10M sloc |
| 10:41 | Chousuke | ah, well, that's just a naming problem. |
| 10:41 | Chousuke | you can name them snake-turn or something if you want. |
| 10:41 | red_fish | turn what? snake, car, plane... |
| 10:41 | cooldude127 | red_fish: ok, separate the namespaces |
| 10:41 | cooldude127 | that's hardly an encapsulation problem |
| 10:41 | Chousuke | or make a multimethod :) |
| 10:41 | cooldude127 | yeah that |
| 10:42 | red_fish | I wanna make a new game |
| 10:42 | Chousuke | with multimethods the actual work methods could be defined private too, I guess |
| 10:42 | red_fish | if I wanna make a new game and reuse the code of snake, I cannot |
| 10:42 | cooldude127 | red_fish: why not? |
| 10:43 | Chousuke | red_fish: if you have snakes like the snake in the game, sure you can. :) |
| 10:43 | Chousuke | your snakes could even have extra attributes, because the snake is just a map |
| 10:43 | red_fish | the contract between me and the person who wrote the snake stuff is not clear enough in my opinion |
| 10:43 | cooldude127 | red_fish: the snake example was not written to be a library |
| 10:43 | cooldude127 | it's a silly example for the book on how to write an app with a gui |
| 10:44 | red_fish | ok |
| 10:44 | red_fish | I will find a better example |
| 10:44 | red_fish | thx |
| 10:44 | Chousuke | any "contracts" are just documentation issues. :) |
| 10:44 | cooldude127 | a library should have a better contract |
| 10:44 | gnuvince | I gotta say guys, the Clojure community is growing pretty nicely. Nearly 120 users on the IRC channel, the Google group is pretty busy and I had an answer to a question on my blog within an hour. |
| 10:44 | cooldude127 | but that doesn't mean we need enforced encapsulation |
| 10:44 | cooldude127 | gnuvince: gotta love it |
| 10:44 | gnuvince | cooldude127: definitely |
| 10:45 | Chousuke | static type checking can be nice though; but you don't OO to get that. |
| 10:45 | cooldude127 | for instance haskell |
| 10:45 | Chousuke | yeah. that. |
| 10:45 | gnuvince | Haskell++ |
| 10:45 | gnuvince | :) |
| 10:45 | cooldude127 | i wish i could understand haskell well enough to have fun with it |
| 10:46 | Chousuke | or you could write OO with a functional style, anyway. |
| 10:46 | gnuvince | Didn't Rich talk about having something similar to Qi inside Clojure? |
| 10:46 | Chousuke | like the snake example kind of is. |
| 10:46 | Chousuke | the snake is an object, and the functions that take a snake are its methods :) |
| 10:47 | cooldude127 | yeah |
| 10:47 | gnuvince | http://clojure-log.n01se.net/date/2008-12-11.html#10:25 |
| 10:58 | AWizzArd | Although a static type system over Clojure would be a nice thing, it would also result in a different language. |
| 11:07 | gnuvince | AWizzArd: undoubtly. |
| 11:31 | zakwilson | Regarding the earlier discussion about encapsulation, I think you're most likely doing something wrong if a Clojure application gets to 10M loc. |
| 11:31 | Chousuke | heheh |
| 11:32 | red_fish | zakwilson: do you mean that big applications of 10M sloc are all wrong or only if they are written in clojure? |
| 11:32 | Chousuke | red_fish: I think he means that no application would be 10M loc in clojure |
| 11:33 | red_fish | OpenOffice is 10M sloc, if I read correctly http://en.wikipedia.org/wiki/Source_lines_of_code |
| 11:33 | Chousuke | well, OO.org is not written in clojure :) |
| 11:34 | red_fish | What's the difference? |
| 11:34 | zakwilson | OO is, I think written in C++ and a little Java. |
| 11:34 | red_fish | The language is not good for that task? |
| 11:35 | zakwilson | Clojure allows significantly more compression of code. |
| 11:35 | red_fish | 10 times? |
| 11:35 | red_fish | than would be 1M of sloc |
| 11:35 | gnuvince | red_fish: If you code in Clojure like you should, it will be extremely unlikely that you would ever reach 10M lines of code. |
| 11:35 | zakwilson | 10 times, or more. |
| 11:36 | kefka | What is the "best practices way" of exposing a Clojure function so it can be called from Java? |
| 11:36 | red_fish | Can I write a program in clojure of 100K of sloc or it's madness? |
| 11:36 | Chousuke | red_fish: sure you can. but by clojure standards, that is already a very large program :) |
| 11:36 | gnuvince | red_fish: sure; but what we mean is that Clojure has potential for more abstraction than Java, so you should end up with less boilerplate code. |
| 11:37 | zakwilson | Any repetative code can be abstracted away with a macro. |
| 11:37 | danm_ | this conversation seems to be putting the cart in front of the horse, anyway |
| 11:38 | danm_ | I think the best well known large lisp application is probably the one from ITA? |
| 11:38 | kefka | I assume there is a way to do this, right? How do you call a Clojure function from Java? |
| 11:38 | danm_ | and I believe they said the one app is around 500k loc |
| 11:38 | Chousuke | kefka: there's an example of that on the site I think |
| 11:38 | red_fish | can I write a new webbroweser in clojure? |
| 11:38 | Chousuke | of course. |
| 11:39 | cooldude127 | red_fish: if you're unsatisfied with current web browsers |
| 11:39 | danm_ | I'm unsatisfied with them, but I can't figure out why |
| 11:39 | danm_ | (haha) |
| 11:39 | kefka | Where? I'm under intense time pressure right now. |
| 11:39 | Chousuke | it's not a question of whether you can, but whether you should :) |
| 11:39 | kefka | Chousuke: Where is the example? |
| 11:39 | kefka | Chousuke: Is it in that proxy function in the Java Interop section? |
| 11:39 | zakwilson | CL doesn't have enforced encapsulation, unless you do it yourself with closures, and I don't think that's ever been cited as an issue by anybody who has used it for large applications. |
| 11:39 | red_fish | next word processor in clojure :-) |
| 11:40 | scottj | danm_: emacs has 1M loc |
| 11:40 | danm_ | scottj: there you go |
| 11:40 | zakwilson | And CL does nothing to discourage mutation. |
| 11:40 | danm_ | crazy |
| 11:40 | Chousuke | kefka: hm, no. |
| 11:40 | danm_ | scottj: how much of that is elisp? |
| 11:40 | Chousuke | kefka: let me see if I can find the example. |
| 11:40 | Chousuke | danm_: probably most of it. |
| 11:41 | Chousuke | but emacs is gigantic |
| 11:41 | scottj | danm_: there's over a million in lisp, much less than that in C |
| 11:41 | danm_ | emacs sure is gigantic |
| 11:41 | danm_ | emacs is like golf, easy to get started with, impossible to master |
| 11:42 | Chousuke | kefka: ah, it was in the wiki: http://en.wikibooks.org/wiki/Clojure_Programming/Tutorials_and_Tips#Invoking_Clojure_from_Java |
| 11:43 | Chousuke | kefka: that's one way; another way is to use gen-class to generate a java class. |
| 11:43 | Chousuke | or proxy, if you just need to subclass something/implement an interface. |
| 11:44 | zakwilson | In any case, if you want encapsulation and such, it wouldn't be that much work to build your own object system on top of structmaps. |
| 11:45 | zakwilson | I think Paul Graham's "On Lisp" has a design for one. |
| 11:45 | cooldude127 | zakwilson: but it just seems to make things more complicated for no gain |
| 11:45 | cooldude127 | especially in clojure |
| 11:46 | zakwilson | I agree, cooldude127. red_fish seems to want it though. |
| 11:46 | cooldude127 | yeah |
| 11:46 | cooldude127 | i'm trying to convince him he doesn't need it |
| 11:47 | Chousuke | I think property-oriented programming (as Yegge would call it, I think) fits clojure. that is, if you need an object, just use a map :) |
| 11:47 | cooldude127 | yeah |
| 11:47 | cooldude127 | i've been doing a lot of that |
| 11:48 | zakwilson | Yes, though property-oriented programming did include inheritance. It wouldn't be hard to do structmaps with inheritance and the name stored somewhere such that it could be used for method dispatch. |
| 11:49 | cooldude127 | zakwilson: inheritance is actually already there |
| 11:49 | Chousuke | or just normal maps I guess. |
| 11:49 | cooldude127 | look into hierarchies |
| 11:50 | zakwilson | Oh. |
| 11:51 | cooldude127 | zakwilson: they're kinda new |
| 11:53 | zakwilson | Wow... those do exactly what I thought was missing from Clojure's multimethods relative to CL... except for that before/after/around part. |
| 11:53 | cooldude127 | zakwilson: lol |
| 11:53 | zakwilson | I have very occasionally found around methods to be exceedingly useful. |
| 12:05 | dnolen | zakwilson: http://tinyurl.com/dd2ljx, I started a project to see how difficult it be to get basic inheritance, multiple inheritance, and default initial values all based on structs. Also I removed the need to manage tag hierarchies. You only need to use them in multimethod dispatch. |
| 12:06 | dnolen | zakwilson: doesn't wouldn't be too hard to implement before/after/around as long as you don't mind calling a macro instead of the built into multimethod constructs. they are very cool and useful. |
| 12:06 | dnolen | doesn't seem it would be too hard i mean. |
| 12:08 | zakwilson | dnolen: I think the problem with that is where before/after/around are most useful for adding functionality to a library or some such where the original author may not have anticipated the need. (what seems to have been branded as aspect-oriented programming more recently) |
| 12:10 | dnolen | zakwilson: true but it also allows the original to present a better API (that is not forcing users to call super). Sometimes a method really requires some sort of pre-and-post side effect (internal bookkeeping), before/after/around let's you logically keep those methods together. |
| 12:11 | hiredman | scope is coming |
| 12:12 | hiredman | http://paste.lisp.org/display/73838 |
| 12:13 | hiredman | ^- scope for :fails :succeeds and :exits |
| 12:14 | gnuvince | ,(isa? "" java.lang.String) |
| 12:14 | clojurebot | false |
| 12:14 | gnuvince | ,(isa? (class "") java.lang.String) |
| 12:14 | clojurebot | true |
| 12:16 | dnolen | hiredman, cool I saw that earlier, :enters of course would be nice. |
| 12:18 | shoover`` | whidden: I have a workaround for the hanging slime repl |
| 12:24 | lisppaste8 | shoover pasted "hack so slime repl doesn't hang" at http://paste.lisp.org/display/74588 |
| 12:24 | lisppaste8 | shoover annotated #74588 with "alternate fix, haven't tested on XP yet" at http://paste.lisp.org/display/74588#1 |
| 12:51 | whidden | shoover: just implementing it now. |
| 12:52 | whidden | shoover:yeah!! |
| 12:55 | whidden | Shoover: at least on my xp box it works, so it now you can say limiited testing on xp. |
| 12:55 | shoover`` | btw, which paste did you test? the .el or the .clj? |
| 12:55 | whidden | both |
| 12:55 | whidden | i switched the read ahead of the write |
| 12:55 | whidden | in the clj |
| 12:56 | whidden | and added the println call in the el |
| 12:56 | whidden | want me to back out one of the changes? |
| 12:56 | shoover`` | did you test them separately? as in, leave el alone, patch connection.clj |
| 12:57 | whidden | nope |
| 12:57 | whidden | i can quickly do that now, if you like. |
| 12:57 | shoover`` | please do (restart emacs, just to make sure). I've only tested the first patch. the second is a hunch |
| 12:58 | lisppaste8 | shoover annotated #74588 with "attribution for idea to switch order of stream creation" at http://paste.lisp.org/display/74588#2 |
| 12:59 | whidden | shoover: i backed out the connection.clj change and we have success. |
| 13:10 | shoover`` | those fixes both look pretty random, but here's what threw me: if you trace back through versions of Clojure, the hang comes into play when Ref.java stops calling UUID.randomUUID |
| 13:16 | whidden | shoover: i read the doc... i don't think the order in this case matters, but may in the future. |
| 13:33 | hiredman | clojurebot: monads? |
| 13:33 | clojurebot | monads is http://www.bolour.com/papers/monads-through-pictures.html |
| 13:33 | hiredman | clojurebot: monads is also http://okmij.org/ftp/Scheme/monad-in-Scheme.html |
| 13:33 | clojurebot | c'est bon! |
| 13:33 | gnuvince | http://www.lispcast.com/lisp1.html |
| 13:34 | cgrand | gnuvince: I found no way to comment on this blog: http://www.reddit.com/r/programming/comments/7tny8/the_beauty_of_lisp1/ |
| 13:35 | StartsWithK | any one here using apache ivy to track external dependenys for there clojure projects? |
| 13:52 | jbondeson | I love people: http://www.3ofcoins.net/2009/01/30/common-lisp-clojure-and-seriousness/ |
| 13:52 | jbondeson | (don't know if that was already posted) |
| 13:56 | Chousuke | my idea of a toy language is a bit different from his definition :/ |
| 13:57 | WizardofWestmarc | I think a lot of people's is |
| 13:57 | jbondeson | yeah, the whole "If it's not from a committee it's a toy" is hilarious |
| 13:57 | walters | i'm sure he collects canned food for a nuclear catastrophe too |
| 13:57 | WizardofWestmarc | I read that and went "Perl's a toy language? Really?" |
| 13:58 | WizardofWestmarc | I'm not a Perl fan but come on |
| 13:58 | jbondeson | I also love that anything on a VM is a toy |
| 13:58 | WizardofWestmarc | oh, and Python's a toy too! |
| 13:58 | Chousuke | Though I think if you dig deep enough, he has a point. |
| 13:58 | knapr | well id love a standalone clojure version. maybe i should writ eone. write iots own VM in asm |
| 13:59 | technomancy | the point is if you are good with adjectives, it's easy to be belittling. |
| 13:59 | WizardofWestmarc | by his definition that's still a toy |
| 13:59 | jbondeson | problem is it'd be sloooow |
| 13:59 | knapr | well clojure doesnt have a spec does it? |
| 13:59 | WizardofWestmarc | and yeah, trying to make something faster then the JVM and it's years of optimization research would be hard as hell |
| 13:59 | Chousuke | but he still makes it sound like these non-serious languages are somehow inferior. |
| 13:59 | gnuvince | By his definition, Common Lisp is not a serious language, because it depends upon C for its bootstrapping as far as I know |
| 13:59 | knapr | my point would be, who the hell cares? it gets shit done... |
| 14:00 | WizardofWestmarc | gnuvince: pretty sure CL bootstraps off of itself now |
| 14:00 | jbondeson | well, yes, I think that once clojure hit's 1.0 there may need to be a published standard. |
| 14:00 | jbondeson | hits even |
| 14:00 | WizardofWestmarc | it was just the first versions were written in C |
| 14:00 | gnuvince | WizardofWestmarc: not a single .c file in there? |
| 14:00 | Chousuke | WizardofWestmarc: SBCL does at least. |
| 14:00 | jbondeson | ummm... cl was around long before c. |
| 14:00 | Chousuke | it needs itself for compilation |
| 14:01 | WizardofWestmarc | it can compile off another CL last I knew, not just prior SBCLs |
| 14:01 | Chousuke | I guess |
| 14:01 | Chousuke | my macports installation just downloaded a binary version of SBCL to compile it :) |
| 14:01 | WizardofWestmarc | right, it certainly CAN use prior versions of itself |
| 14:01 | zakwilson | Common Lisp wasn't around before C, but earlier Lisps were. |
| 14:02 | WizardofWestmarc | it just doesn't have to be ONLY sbcl |
| 14:02 | gnuvince | Oh the famous "If rhickey get hit by a bus" argument |
| 14:02 | Chousuke | But I don't think Clojure needs a formal spec |
| 14:02 | Chousuke | just good documentation |
| 14:03 | knapr | what is it called when you attribute human attributes to dead things/machines? soemthing with -morphism... |
| 14:03 | gnuvince | antropomorphism? |
| 14:03 | vsthesquares | antropo |
| 14:03 | durka42 | anthropo |
| 14:03 | zakwilson | SBCL can be compiled with SBCL, CMUCL, OpenMCL or CLISP, according to its website. |
| 14:03 | durka42 | not too shabby |
| 14:04 | zakwilson | Though I think I once tried to compile it with CLISP and discovered that it's no longer supported. |
| 14:04 | knapr | yes http://en.wikipedia.org/wiki/Anthropomorphism |
| 14:05 | gnuvince | ,(mod -3 2) |
| 14:05 | clojurebot | 1 |
| 14:05 | jbondeson | Chousuke: I think a formal spec would be nice, it wouldn't prevent change, it would simply allow for porting to different VMs or specialized compilers |
| 14:05 | gnuvince | ,(div -3 2) |
| 14:05 | clojurebot | java.lang.Exception: Unable to resolve symbol: div in this context |
| 14:05 | gnuvince | hmmm |
| 14:05 | Chousuke | jbondeson: hmm. |
| 14:05 | zakwilson | But I think the idea that a language that's tied to a specific platform is a toy is silly. |
| 14:05 | technomancy | yeah, I'd be in favour of a formal spec once 1.0 has been out a while |
| 14:05 | gnuvince | If there's quot and rem, shouldn't there be div to complement mod? |
| 14:05 | technomancy | as long as it's an automated spec suite |
| 14:05 | Chousuke | jbondeson: well, good enough documentation could act as a spec :P |
| 14:05 | zakwilson | Java is tied to the JVM as well, and for all its faults, I don't think Java is exactly a toy. |
| 14:06 | Nafai | jbondeson: CL was first introduced in 1984, standardized in 1994. C was introduced in 1972. |
| 14:06 | Chousuke | jbondeson: just when you talk about a "formal" spec I keep thinking of the CL hyperspec |
| 14:06 | gnuvince | I like how Perl 6 are doing it: anything that passes the Perl 6 Test Suite is considered Perl 6 |
| 14:06 | Chousuke | which, while great, is not the easiest thing to read. |
| 14:06 | hiredman | if CL is a serious language, why the hell would you want to be serious? |
| 14:07 | technomancy | definitely not something like the hyperspec |
| 14:07 | jbondeson | Chousuke: It doesn't have to be monolithic, but it should outline the contracts that the low level clojure functionality provides |
| 14:07 | jbondeson | Nafai: yeah, i looked that up, I thought CL got started in the 70s |
| 14:07 | technomancy | Chousuke: the rubyspec project is self-verifying |
| 14:07 | zakwilson | I actually think implementation-defined is a Good Thing. Code is less ambiguous than human language. |
| 14:08 | zakwilson | It does it the way the official implementation does it, or it's wrong. |
| 14:08 | technomancy | zakwilson: that's why the spec needs to be code as well |
| 14:08 | hiredman | because CL is so popular and is used everywhere because it is so serious |
| 14:08 | hiredman | ... |
| 14:08 | gnuvince | zing |
| 14:08 | Chousuke | jbondeson: I think the host interaction could be problematic though. |
| 14:08 | hiredman | oh |
| 14:08 | hiredman | I think I forgot my sarcasm marker |
| 14:08 | hiredman | ? |
| 14:09 | zakwilson | CL does have a few more users than Clojure. |
| 14:09 | Chousuke | for now :) |
| 14:09 | hiredman | zakwilson: *snort* |
| 14:09 | technomancy | gotta take velocity into account |
| 14:09 | zakwilson | In any case, it seems absurd to call either a toy language. |
| 14:10 | hiredman | is a rock with more moss on it a better rock? |
| 14:10 | technomancy | zakwilson: are you kidding? It's a great way to be able to sidestep what would be an otherwise-serious challenge to the dominance of CL. it's brilliant; you don't have to give real objections. |
| 14:10 | jbondeson | Chousuke: that's exactly why you want a spec though. if the host machine can't uphold the contract is it actually a valid implementation of Clojure? |
| 14:11 | Chousuke | I wonder. |
| 14:11 | Chousuke | I mean, clojure leaves out a lot of basic stuff because the host provides it already. |
| 14:12 | technomancy | Chousuke: a spec would make it easier to keep Clojure and ClojureScript in sync |
| 14:12 | Chousuke | I suppose. |
| 14:12 | zakwilson | Cobol and Java are obviously among the best languages ever invented since more LOC exist in those than just about anything else ;) |
| 14:12 | Chousuke | if you wanted clojure to be reimplementable you'd have to specify higher level wrappers for the basic functionality. |
| 14:12 | technomancy | zakwilson: and elisp is obviously the best lisp ever. =) |
| 14:12 | jbondeson | Yeah, but how many of those java LOCs are generated! =P |
| 14:12 | hiredman | Duck Languages for Duck Types |
| 14:13 | zakwilson | Java: so easy, even your IDE can write it. |
| 14:14 | knapr | do you guys feel clojure is for the future? i mostly think it is really good now. and in the future something like haskell (or perhaps a cleaned up, less verbose, better type-inferenced scala) |
| 14:14 | gnuvince | knapr: "The best way to predict the future is to invent it" |
| 14:15 | hiredman | knapr: neither of those is a dynamic lisp functional lisp |
| 14:15 | gnuvince | I think Clojure has more promise as it's more "practical" right now than Haskell, but I wouldn't be surprised if the influence of Haskell was felt very widely in the future. |
| 14:15 | hiredman | which is what I crave |
| 14:15 | jbondeson | I've said it before, but haskell would need a big corporate sponser to take it to "professional" status. |
| 14:15 | hiredman | ~clojuritis |
| 14:15 | clojurebot | Excuse me? |
| 14:15 | hiredman | ~clojureitis |
| 14:15 | clojurebot | clojureitis is a condition in which it becomes impossible to program in other languages anymore |
| 14:15 | zakwilson | I think Clojure is the best general-purpose language for now and the near-future. I don't expect the JVM to be dominant forever, but whatever does end up being very useful in the future will probably be influenced by Clojure. |
| 14:16 | gnuvince | jbondeson: I think it would need more than that. Some people just don't get functional programming (immutable values, first class functions, etc.) |
| 14:16 | icey | For the folks who came to Clojure from Ruby & Python, do you feel that Clojure is *currently* more productive than those languages for day-to-day use? |
| 14:17 | technomancy | icey: it depends on the problem. definitely not for very simple things because of the JVM init time and the lack of a package manager. |
| 14:17 | zakwilson | icey: I've made occasional use of Ruby in the past, and I absolutely feel that Clojure is more productive for building applications. |
| 14:18 | zakwilson | Ruby, on the other hand is much better for small scripts, in large part due to startup time. |
| 14:18 | gnuvince | icey: I came from Python (but with some baggage from CL and Scheme) and *right now*, it's not, because I am not familiar at all with the Java library |
| 14:18 | technomancy | for things that are very unixy Ruby is still a better choice for me |
| 14:18 | gnuvince | as I learn it, I imagine that it'll become easier and faster and be in the same league as Python, definitely,. |
| 14:19 | zakwilson | CL was my language of choice before Clojure, and I do find Clojure more productive in general. Dealing with the Java library does occasionally make me want to tear out my hair. |
| 14:19 | icey | gnuvince: that's actually the source of my question. I'm a C# & Python guy today, and I keep running into the whole "I don't know Java" problem when working with Clojure. |
| 14:19 | jbondeson | gnuvince: Yes, but clojure still has that problem, and possibly moreso due to the lisp-y style. Though, I think any programmer worth his salt should be able to be up and running in a functional language withing a couple of days |
| 14:19 | icey | or rather, I don't know what's available in Java |
| 14:19 | hiredman | icey: google + javadoc = win |
| 14:19 | zakwilson | Fortunately, there are a LOT of tutorials out there for doing... just about anything in Java. |
| 14:19 | zakwilson | Some of them are even good. |
| 14:20 | gnuvince | jbondeson: at least Clojure doesn't separate IO code from pure code and have things like "monomorphism restriction" that could kill 3 newbs in one swift ;) |
| 14:20 | icey | hiredman: yeah, I need to be better about googling. I find myself reinventing things that probably already have really good libraries. |
| 14:20 | WizardofWestmarc | Java is some of the most documented coding infrastucture available, probably since it's used by everyone and their mother :P |
| 14:20 | zakwilson | On the subject of the Java libraries - does anyone else consider classes that exist solely to be arguments to the constructors of other classes to be an antipattern? |
| 14:20 | gnuvince | icey: I feel that the way to remedy this is to just take on a project and try to push your way through |
| 14:20 | jbondeson | gnuvince: hahaha, very true. The 'language' of clojure is much less, shall we say, academic |
| 14:20 | hiredman | zakwilson: it is the only way for java to have closures right now |
| 14:21 | zakwilson | hiredman: I'm not sure I get it. |
| 14:21 | gnuvince | jbondeson: I've found that pretty much all dynamically typed languages (save for Perl) usually have much simpler semantics than statically typed languages. |
| 14:21 | hiredman | zakwilson: you make an anon inner class |
| 14:23 | icey | gnuvince: you're probably right. I just need to find something non-trivial to make ;) |
| 14:23 | gnuvince | icey: good luck :) |
| 14:23 | zakwilson | hiredman: I'd probably have to write some non-trivial Java to really get it. Thanks for trying to explain. |
| 14:24 | hiredman | zakwilson: so java has this syntax for making an anonymous "class" sort of like (fn [] ) makes an anonymous function |
| 14:25 | hiredman | and the anonymous class inherits it's definition from some other class or interface |
| 14:25 | sohail | hiredman, the closure created by an anonymous class can only use final variables. Which is fine, given clojure's nature :-) |
| 14:25 | hiredman | sohail: *shrug* |
| 14:26 | zakwilson | Right, I've heard of that, and I can see how it would be useful. What I can't see is why it would be useful for a constructor to take a Foo, which is just a wrapper around three ints, instead of three ints. |
| 14:26 | jbondeson | this is when conversations get tangled, talking about closures and clojure |
| 14:26 | hiredman | I am just explaining why someone writing java may have a class that is only used as a parameter |
| 14:26 | zakwilson | When a Foo is NEVER used for anything else. |
| 14:26 | hiredman | *shrug* |
| 14:27 | zakwilson | So... you subclass it anonymously and then pass that to a Bar constructor, making the new Bar something like a closure? |
| 14:27 | hiredman | sort of, yes |
| 14:28 | zakwilson | I think I may still be missing something, but since I don't anticipate ever using Java, I don't think it matters too much. |
| 14:28 | hiredman | ugh, I just don't get it |
| 14:28 | zakwilson | I get Java well enough to call it from Clojure. That will do for the moment. |
| 14:29 | hiredman | CLJOS? |
| 14:29 | jbondeson | heh |
| 14:29 | zakwilson | Someone's trying to replicate CLOS in Clojure? |
| 14:29 | jbondeson | CLOS was powerful in CL |
| 14:29 | jbondeson | convoluted, but powerful |
| 14:29 | dnolen | zakwilson: hardly, it's an attempt add some OO features to structmaps |
| 14:30 | dnolen | I started it, it needs a LOT of work |
| 14:30 | zakwilson | The thing I miss is before/after/around. |
| 14:30 | jbondeson | :before, :after, and :around were great for stacking methods |
| 14:30 | technomancy | hiredman: I think the name's misleading |
| 14:30 | jbondeson | gah |
| 14:31 | zakwilson | I didn't actually use them very often, but when I did, any other solution would have required half a page of extra code. |
| 14:31 | hiredman | so the java object system, then another one? |
| 14:31 | jbondeson | after was perfect for implementing what people now call AOP |
| 14:32 | technomancy | hiredman: then a good one, hopefully. =) |
| 14:32 | dnolen | technomancy: agreed, it was joke, open to suggestions, clj-object? |
| 14:32 | zakwilson | jbondeson: I said the same thing a couple hours ago, |
| 14:32 | technomancy | dnolen: I'm a fan of names that are unique without using "clj" or clj-related puns... but they are harder to come up with. |
| 14:33 | hiredman | jbondeson: have you seen (scope ...) ? |
| 14:33 | dnolen | technomancy: yup. |
| 14:33 | LordOfTheNoobs | zakwilson: since, excepting basic types (integers, characters, etc), only objects can be created in java, in order to pass a first-order function with internally bound state you have to create an anonymous object containing the state with the function attached to its definition. Instead of an anonymous function with enclosed state, it is an anonymous object with class variables and an invoke method. ( or so I understand ) |
| 14:33 | technomancy | dnolen: I like to draw from mythology and history |
| 14:33 | technomancy | or non-clj-related wordplay |
| 14:36 | jbondeson | hiredman: i've never used it, but i assume scope is a form of binding macro? |
| 14:37 | hiredman | jbondeson: it lets you define actions that happen when you leave the scope |
| 14:38 | hiredman | I don't really know common lisp, but that sounds sort of like before/after |
| 14:39 | WizardofWestmarc | it does sound sorta similar to after if I'm understanding it (scope) correctly |
| 14:39 | zakwilson | It does, except that you can add a before/after/around method to an existing generic function without touching its source or any calls to it. |
| 14:40 | jbondeson | right, you can stack onto methods very easily |
| 14:43 | zakwilson | So you can do something like (defmethod dispatch-request (:around dispatch-table) (unless (banned? (get-ip)) (call-next-method))) |
| 14:44 | zakwilson | And I've done exactly that with Hunchentoot. |
| 14:44 | jbondeson | hiredman: where is scope defined? I can't find it in core or contrib. |
| 14:45 | hiredman | jbondeson: it us an up and coming feature |
| 14:45 | jbondeson | ah |
| 14:45 | hiredman | clojurebot: horizons? |
| 14:45 | clojurebot | horizons is http://gist.github.com/51721 |
| 14:45 | jbondeson | it sounded familiar |
| 14:45 | hiredman | I took a crack at it there |
| 14:45 | zakwilson | http://paste.lisp.org/display/73838 |
| 14:45 | jbondeson | that was what rich was discussing the naming about last week |
| 14:46 | hiredman | jbondeson: ugh, must has missed that |
| 14:46 | hiredman | he was talking about "named" scopes |
| 14:47 | hiredman | so you could attach to a scope by name, not just the one you happen to be in |
| 14:47 | jbondeson | huh |
| 14:48 | jbondeson | i'd have to see that in action. |
| 14:48 | gnuvince | Sometimes, I wish rhickey was more of a blogger; I'd love to hear about upcoming features that he's working on (e.g.: LFE) |
| 14:49 | WizardofWestmarc | The less time he spends blogging, the more time he can spend coding |
| 14:49 | hiredman_ | ugh |
| 14:49 | BigTom | LFE? |
| 14:49 | WizardofWestmarc | though I will say, watching his video presentations is really interesting. |
| 14:50 | hiredman_ | BigTom: left fold enumerator |
| 14:50 | WizardofWestmarc | hm, missed hearing about that one (LFE) |
| 14:51 | BigTom | hiredman_: thanks (I hope to know what that means soon :-/ ) |
| 14:54 | WizardofWestmarc | oh |
| 14:54 | WizardofWestmarc | it's part of the new streams stuff |
| 14:54 | WizardofWestmarc | *duh* |
| 15:00 | BigTom | Anyone used the new watchers with swing? |
| 15:00 | BigTom | My toy GUI broke :-( |
| 15:02 | hiredman | gui :( |
| 15:04 | BigTom | I'll try and pull the code out, I was using watchers to update the EDT and I can't get the new way to work |
| 15:06 | jbondeson | now now hiredman, some times guis are necessary! |
| 15:06 | hiredman | yeah, but I hate at them |
| 15:07 | jbondeson | heh |
| 15:07 | jbondeson | I'm a big Qt fan, never been a fan of other GUI toolkits. |
| 15:07 | technomancy | saves a lot of pain when you can't go modal |
| 15:08 | WizardofWestmarc | haha rryan |
| 15:09 | gnuvince | but I hate writing guis |
| 15:09 | gnuvince | boring boiler plate code |
| 15:13 | WizardofWestmarc | from the snippits I've seen looks like clojure can hide a lot of it (go go magic macros!) |
| 15:15 | jbondeson | the thing i hate the most about guis is that you're always solving the same problems over and over again, just with slight twists. |
| 15:15 | hiredman | textjure just needs to get to the point where it can embed images and rendered html snippets in the repl output |
| 15:16 | jbondeson | haha |
| 15:17 | hiredman | I would still use vim though, I think |
| 15:18 | jbondeson | emacs fo' life |
| 15:27 | BigTom | hm |
| 15:28 | BigTom | I'm getting a java.util.concurrent.RejectedExecutionException when I send an action to an Agent (with a watcher), anyone have any pointers? |
| 15:29 | kotarak | BigTom: maybe you can post some code to a pastebin? |
| 15:29 | kotarak | lisppaste8: url |
| 15:29 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 15:29 | BigTom | yeah, this won't be pretty... |
| 15:31 | lisppaste8 | BigTom pasted "untitled" at http://paste.lisp.org/display/74605 |
| 15:31 | BigTom | there you go |
| 15:33 | BigTom | It worked a while back, when I ran it up today the add-watch no longer worked (new Clojure), my attempts to replace it have succeeded |
| 15:35 | kotarak | Which one of two watcher blocks to I have to comment in? Both? |
| 15:36 | BigTom | The last one |
| 15:37 | kotarak | I just get tons of null pointer exceptions..... |
| 15:37 | BigTom | Hmm, it throws the RejectedExecutionException with or without the watchers |
| 15:39 | lisppaste8 | BigTom annotated #74605 with "untitled" at http://paste.lisp.org/display/74605#1 |
| 15:39 | kotarak | Not for me. The Swing window opens. But it seems I can do nothing. The a dialog pops up, that I lost.... |
| 15:40 | BigTom | How do I check me clojure version? |
| 15:40 | gnuvince | BigTom: svn info |
| 15:41 | kotarak | Huh? Is it add-watch or add-watcher? |
| 15:42 | kotarak | add-watch is highlighted. But add-watcher is in Clojure. Was it renamed? |
| 15:42 | BigTom | it was add-watch, now it is add-watcher |
| 15:42 | eleftherios | can one call any java library from clojure or there is some other way? |
| 15:42 | kotarak | Oh. Ok. Have to update the highlighting. |
| 15:44 | kotarak | eleftherios: (def thing (new java.thing.Class)) (.someMethod thing with-some args here)? http://clojure.org/java_interop, does this help? Or do you have a specific problem? |
| 15:44 | BigTom | I am on v1235 |
| 15:45 | kotarak | me too. |
| 15:45 | kotarak | In your second version, I get a wrong number of arguments for add-watcher. |
| 15:45 | BigTom | yeah, the arity changed too |
| 15:45 | BigTom | the args and their relationship changed |
| 15:46 | kotarak | Ok. So which version should I try? The first one you posted or the second one? |
| 15:46 | eleftherios | kotarak: no, I just couldn't find a FAQ about how one can use the Java libraries :-) Thanks |
| 15:46 | BigTom | I grabbed cells off the mailing list, that works |
| 15:46 | eleftherios | kotarak: no specific problem, just investigating if I should learn more :-) |
| 15:46 | kotarak | eleftherios: than the link should get you going. :) |
| 15:47 | BigTom | The second definitely used to work with the old watchers |
| 15:47 | BigTom | I wasn't sure if I had broken the other when investigating |
| 15:47 | kotarak | Can you post me the one which gives you the error? |
| 15:47 | eleftherios | kotarak: so in short (from what I gather from the link) one can call anything from the Java library? |
| 15:48 | eleftherios | with the dot notation |
| 15:48 | BigTom | eleftherios: pretty much |
| 15:49 | kotarak | eleftherios: Yes. java.Class/staticMember, (java.Class/staticMethod), (java.Class.) or (new java.Class) for constructor, (.method thing ...). |
| 15:49 | BigTom | ,(Math/sqrt 4) |
| 15:49 | clojurebot | 2.0 |
| 15:49 | eleftherios | so one could suggest clojure as a replacement to Java for a large project |
| 15:49 | kotarak | ,Math/PI |
| 15:49 | clojurebot | 3.141592653589793 |
| 15:49 | eyeris | Is the Clojure Google group moderated? |
| 15:49 | WizardofWestmarc | only for first posts afaik |
| 15:49 | kotarak | eyeris: the first post is checked by Rich |
| 15:50 | kotarak | yeah, WizardofWestmarc was faster. :) |
| 15:50 | eyeris | kotarak Thanks. I just wanted to make sure I didn't somehow screw it up :) |
| 15:50 | WizardofWestmarc | well I cheated and didn't type his name :P |
| 15:50 | kotarak | hehe |
| 15:50 | kotarak | That's why the first post often shows up twice. |
| 15:51 | WizardofWestmarc | ...I never thought of that |
| 15:51 | kotarak | The first hangs in the "Rich" loop and so many post it again. |
| 15:51 | kotarak | Then both get posted. |
| 15:51 | WizardofWestmarc | does the group say on the GG page that the first posts are moderated? |
| 15:51 | kotarak | No. |
| 15:51 | kotarak | At least I'm not aware of such a notice. |
| 15:52 | BigTom | kotarak: I am being dragged away, thanks for the assist, I'll work it out and get back to euler. |
| 15:53 | kotarak | BigTom: have fun! :) |
| 15:53 | BigTom | kotarak: cheers |
| 15:55 | Lau_of_DK | Hey hey good folk of Clojure |
| 15:59 | gnuvince | Hi Lau |
| 16:09 | cads | can anyone here recommend the enclojure plugin for netbeans? |
| 16:09 | cads | or is it at a point where I ought to take a hit and just learn emacs? |
| 16:11 | WizardofWestmarc | I tried it out of curiosity, had a lot of repl problems, but that was a while ago |
| 16:11 | WizardofWestmarc | of course I'm not a netbeans guy so... |
| 16:11 | kotarak | cads: you can also give Vim a try... |
| 16:12 | cads | emacs has been on my tolearn list forever and a day |
| 16:13 | cads | but the only time I have reason to is when I learn a new language, where having to learn emacs at the same time would be frustrating, and I end up using an IDE! |
| 16:13 | Lau_of_DK | cads, emacs is well worth it :) |
| 16:13 | kotarak | cads: it's an editor like any other.... The enclojure or the Eclipse plugin might become some viable alternative. |
| 16:13 | kotarak | I'm working on bringing Vim on par. :) |
| 16:13 | Lau_of_DK | kotarak: please... |
| 16:14 | Lau_of_DK | cads: Emacs is superior to all competetion in every regard. You are welcome to test out 10 editors and get back to me, and tell me that Im right. |
| 16:14 | cads | the macro facilities alone |
| 16:15 | cads | emacs has always radiated power at me |
| 16:15 | Chouser | I've given emacs a good solid try at least twice before, and come crawling back to vim each time. |
| 16:15 | leafw | macros in vim are trivial. Unfortunatey, vim REPL's are not so good; usually involve screen (like gorilla does) |
| 16:15 | leafw | same here. ViM forever. I don't have two special fingers to push control+this alt+that for trivial commands. |
| 16:16 | kotarak | leafw: gorilla does not need screen |
| 16:16 | leafw | kotarak: then the other. I always give up on REPLs in vim. |
| 16:16 | kotarak | leafw: with the newest generation in nailgun it should be at least as pleasant an experience as with SLIME. |
| 16:16 | kotarak | (reading all the SLIME post on the group...) |
| 16:17 | Chouser | next time I try emacs, I will not try to learn the "emacs way" do things as I have in the past. I will conform it to my will from the very beginning. |
| 16:17 | brianh | cads: as someone who used vi (many years ago) & now uses Eclipse, learning emacs has been a little... shall we say... painful |
| 16:17 | Lau_of_DK | Chouser: I think thats the whole point of Emacs |
| 16:17 | Lau_of_DK | Its bendable in every direction |
| 16:17 | kotarak | I tried eclim today. Eclipse + Vim. Seems to have some problems still.... |
| 16:17 | cads | brianh, is there an eclipse plugin for clojure? |
| 16:18 | kotarak | cads: clojure-dev |
| 16:18 | Chouser | kotarak: I've used jVi with netbeans -- it's not a terrible start. |
| 16:18 | cads | now, I'm usually against using an IDE altogether, especially on my dated hardware, as modern ides are so damn heavy |
| 16:18 | brianh | cads: haven't tried it myself though |
| 16:19 | cads | nice would be a clojure based IDE like what squeak does |
| 16:19 | cads | while managing to be pretty light and quick |
| 16:19 | kotarak | Chouser: netbeans has problems on my mac. The create project dialog doesn't fit on my screen because it's too wide!!!!!! Must be trouble with the german version I guess.... |
| 16:19 | brianh | why stop there. let's take it all the way to the metal! ;) |
| 16:20 | cads | brianh, was wondering about how hard that would be |
| 16:20 | cads | seems a lot of work is saved for the java compiler |
| 16:21 | brianh | cads: easy. just ask Chouser to do it! |
| 16:21 | cads | but I was wondering if clojure could be translated to common lisp, or c |
| 16:21 | cads | bet it wouldn't be anywhere near trivial |
| 16:22 | kotarak | that's the only true way of editing anyway: http://en.wikipedia.org/wiki/File:IBM_Port-A-Punch.jpg |
| 16:22 | Chouser | I bet it would be possible to AOT-compile Clojure to C++ source with one of those automaitic garbage collector libraries attached. |
| 16:22 | kotarak | boehm gc probably |
| 16:24 | cads | while we're at it we'd tack on the jvm so it could still do java stuff :D |
| 16:24 | brianh | kotarak: that picture just made me feel better about emacs. thx! |
| 16:25 | ayrnieu | just be sure to remap Caps Lock to Control. |
| 16:25 | brianh | ayrnieu: won't help me |
| 16:26 | lisppaste8 | hiredman annotated #74521 with "prefix partial application maker" at http://paste.lisp.org/display/74521#3 |
| 16:26 | cads | emacs feels like it would be very powerful once you learned a few things about organizing and discovering key shortcuts. Once you've put in the time to customize your own working set of commands I'm sure you fall in love with it |
| 16:26 | brianh | ayrnieu: i'm trying to use this: http://www.alphagrips.com/ |
| 16:28 | ayrnieu | cads, I fell in love with Emacs long after I'd learned all that stuff, after I'd learned for years. I was doing transcription with a lot of mark-up and manual complexity, and wrote an Emacs mode for this. |
| 16:28 | WizardofWestmarc | cads: emacs and vim are both like that IME. |
| 16:28 | WizardofWestmarc | though vim is more just learning enough of the shortcuts |
| 16:28 | hiredman | ugh |
| 16:28 | hiredman | mistpaste |
| 16:29 | ayrnieu | "Ohhhh, *this* is why people like Emacs!" For programming in already programmer-friendly languages, it isn't so impressive. |
| 16:29 | kotarak | vim vs. emacs is like hg vs. git: doesn't matter any is better the notepad/CVS |
| 16:29 | cads | haven't used vim enough, I'm sure they're both 'turing complete' in the sense that they both can achieve ostensibly the same things, but in emacs it feels like you're in a mini operating system, while vim seems a lot more minimalist |
| 16:29 | dnolen | cads: http://refcards.com/docs/gildeas/gnu-emacs/emacs-refcard-a4.pdf, and excellent reference card of emacs shortcuts that's well formatted that I used ot use. |
| 16:29 | cads | dnolen: thanks! I love cheatsheets |
| 16:29 | lisppaste8 | hiredman annotated #74521 with "prefix partial application maker for reals and working this time" at http://paste.lisp.org/display/74521#4 |
| 16:30 | kotarak | cads: vim is very consistent in the shortcuts: operator + motion. Always the same just different commands or motions... |
| 16:30 | dnolen | cads: np, lots of ugly ones out there, that one is the best IMO. |
| 16:32 | cads | kotarak: on thing i've wondered about is what does switching to the dvorak keyboard do to emacs or vim |
| 16:32 | hiredman | it makes you re-think your silly choices? |
| 16:32 | kotarak | cads: dunno :) Don't use dvorak. But I figure it is painfull..... I would probably remap all commands into the old positions |
| 16:32 | cads | I wonder if the workflow would be hurt badly, or whether you could use the old keys still |
| 16:33 | cads | hiredman, what does that code you pasted do? |
| 16:33 | ayrnieu | it doesn't do anything special. People who navigate in vim one-handed have made up special dvorak modes for it. I never did that and use vim on dvorak as-is. It's comfortable. |
| 16:34 | WizardofWestmarc | I could never use dvorak simply because I deal with other people's computers enough I wouldn't get the 100% benefit of it |
| 16:34 | ayrnieu | hljk become jpcv |
| 16:34 | WizardofWestmarc | and going back and forth between full on keyboard layouts? Ungh |
| 16:34 | hiredman | cads: it turns (f � h) into (comp f h) and (?f h) into (partial f h) |
| 16:34 | cp2 | yeah WizardofWestmarc |
| 16:34 | cp2 | it gets annoying for me |
| 16:34 | cp2 | switching between school and home |
| 16:35 | cooldude127 | hiredman: what does that second one look like? it's a square for me |
| 16:35 | hiredman | cooldude127: cirlce with a vertical line through it |
| 16:35 | cooldude127 | oh |
| 16:35 | hiredman | I just picked it off some symbol table in wikipedia |
| 16:35 | cooldude127 | lol |
| 16:36 | cads | hiredman: in the second case, (partial f h), we take a function f which may take more than one argument, and return a function which takes one fewer arguments, and represents f where the first argument has been fixed at h? |
| 16:36 | hiredman | yes |
| 16:36 | cads | can we curry functions? |
| 16:36 | cooldude127 | hiredman: my emacs doesn't show all the symbols right |
| 16:36 | hiredman | cooldude127: could be your font |
| 16:37 | hiredman | cads: that is more or less what partial does |
| 16:37 | hiredman | or uncurry |
| 16:37 | hiredman | or whatever |
| 16:37 | brianh | hiredman is going to turn clojure into apl here soon :) |
| 16:37 | kotarak | cads: there is partial - (partial + 2) - and there is #() - #(instance? % thing) |
| 16:37 | cooldude127 | i've used another font before, not sure why i don't have it. what are you using? |
| 16:38 | hiredman | uh, right now? I think putty is set for dejavu sans mono |
| 16:38 | cooldude127 | hiredman: oh |
| 16:38 | brianh | i think that was the one with all the strange symbols... |
| 16:38 | cooldude127 | brianh: i think you're right |
| 16:38 | hiredman | brianh: which is why I picked it |
| 16:39 | hiredman | the point of my paste is not so much the pl macro, but the transform function |
| 16:39 | hiredman | which is really cool. |
| 16:40 | brianh | hiredman: have you used it before? |
| 16:40 | hiredman | brianh: used what? |
| 16:41 | cooldude127 | apl i think |
| 16:41 | brianh | apl |
| 16:41 | hiredman | No |
| 16:41 | cads | could we have a function curry such that (f x y z) <=> ((((curry f) x) y) z)? That is, I'm sure we could curry a function so that it takes one argument and creates a function of one argument and so on till it returns a final value, but in other lisps (lisp-2s, I think), the syntax would not be so pretty |
| 16:42 | kotarak | cads: I dont think this is possible. How do you handle (defn foo ([x] ..) ([x y] ...))? |
| 16:42 | hiredman | ,(partial (partial (partial (fn [x y z] [z y z]) :a) :b) :c) |
| 16:42 | clojurebot | #<core$partial__3607$fn__3609 clojure.core$partial__3607$fn__3609@d8fb2b> |
| 16:42 | hiredman | oops |
| 16:42 | hiredman | one too many partials |
| 16:42 | hiredman | ,((partial (partial (fn [x y z] [z y z]) :a) :b) :c) |
| 16:42 | clojurebot | [:c :b :c] |
| 16:42 | hiredman | ,((partial (partial (fn [x y z] [x y z]) :a) :b) :c) |
| 16:42 | clojurebot | [:a :b :c] |
| 16:42 | hiredman | :P |
| 16:43 | hiredman | write now there is no way of querying function arity information from an IFn |
| 16:43 | hiredman | right |
| 16:43 | cads | hmm |
| 16:44 | cads | I bet we can still wrap it in a higher order function to get a function's curried form |
| 16:45 | ayrnieu | yeah, or the programmer can use partial application directly, more flexibly, and more readably with #(foo %1 a %2) |
| 16:45 | cads | something which would take care of how many arguments the function takes and essentially build up a partially applied function |
| 16:45 | hiredman | you would have to try the function, and if it throws an exception then use partial |
| 16:45 | hiredman | very tedious |
| 16:46 | hiredman | (doesn't mean I am not thinking about it) |
| 16:46 | ayrnieu | yes, the direct, flexible, and readable solution is very tedious if you're haskell-wanking for its own sake. |
| 16:46 | hiredman | ayrnieu: know I think what you are suggesting is fine |
| 16:47 | hiredman | writing the solution for what cads and I are talking about would be tedious |
| 16:48 | hiredman | try/catch ad infinitum |
| 16:48 | cads | haskell wankage aside, a function in working fully curried form is interesting exercise of the language |
| 16:49 | hiredman | cads: anyway, with my pl macro you can turn you function application into a partial application just by prefixing it's name with the right glyph |
| 16:50 | ayrnieu | no, an interesting exercise would be a memoize function, function combinator utilities, something to make easy hot-code loading, etc. |
| 16:50 | hiredman | ((?(?(fn [x y z] [x y z]) :a) :b) :c) |
| 16:50 | hiredman | ,(doc memoize) |
| 16:50 | clojurebot | "([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use." |
| 16:50 | cooldude127 | yeah i thought we had that |
| 16:50 | ayrnieu | function combinators, I have wanted in Clojure, and you can see the basic need for them in that the conj function exists. |
| 16:51 | hiredman | yeah |
| 16:51 | hiredman | K would be nice |
| 16:51 | ayrnieu | and since they're intentional and not automatic, you don't need any special fn-querying feature. |
| 16:52 | hiredman | but K is just sort of a reverse do I guess |
| 16:52 | ayrnieu | (defn flip ([f] #(f %2 %1)) ([f a]) #(f % a)) ([f a b] #(f b a))) |
| 16:54 | hiredman | damn |
| 16:54 | hiredman | do is a macro |
| 16:54 | ayrnieu | it's a special form, not a macro. |
| 16:55 | hiredman | ,((comp first list) :a :b) |
| 16:55 | clojurebot | :a |
| 16:57 | ayrnieu | (let [flibtwist (comb a b c -> b c a)] ...) <- write in a diagram of the odd little thing you want to do in this one case. |
| 16:57 | ayrnieu | oh, that's -rot |
| 16:59 | ayrnieu | which differs from #(%1 %3 %4 %2) in that it covers the lower-arity cases, as flip does above. |
| 17:16 | eyeris | I'm new to ant. Could someone explain to me why target -> java -> classpath -> pathelement puts clojure.jar inside braces as ${clojure.jar}? |
| 17:16 | eyeris | I imagine those are variables, but I don't see clojure.jar assigned anywhere in the build.xml file |
| 17:18 | ayrnieu | are you sure that <property name="clojure_jar" location="clojure.jar"/> isn't in the file? |
| 17:19 | eyeris | I'm positive. Although I am getting an error that clojure.lang.Compile isn't in the CP, so that makes sense :) |
| 17:19 | eyeris | I'm just trying to confirm that the <property> tag is what is missing |
| 17:20 | ayrnieu | are you talking about clojure-contrib/build.xml ? |
| 17:21 | eyeris | No, it's from clojureql's build.xml. I just solved ti. |
| 17:22 | kotarak | eyeris: put in clojure.jar=/path/to/your/clojure.jar in a file called local.properties. |
| 17:23 | eyeris | kotarak Yep :) |
| 17:24 | eyeris | kotarak The latest cql commit fails aot compile. |
| 17:24 | kotarak | eyeris: local.properties is ignored by git, so it is not trashed when you do an update |
| 17:24 | kotarak | Yes. I noted. |
| 17:24 | kotarak | Will push a fix. |
| 17:24 | kotarak | Stupid mistake. |
| 17:27 | kotarak | eyeris: Uh. No. My mistake again. The broken commit is not yet pushed. The current state compiles. :) |
| 17:32 | eyeris | I get java.lang.IllegalArgumentException: Wrong number of args passed to: core$defmulti (backend.clj:98) |
| 17:32 | kotarak | eyeris: your clone is not up-to-date. The defmulti syntax changed. A fix is in the repo. |
| 17:34 | eyeris | Strange. When I run "git log" I see "Bring defmulti up to date with new syntax" |
| 17:34 | eyeris | and "git pull" says "Already up-to-date." |
| 17:35 | kotarak | Hmmm... Maybe a wrong branch? |
| 17:35 | kotarak | Or "old" Clojure? |
| 17:35 | eyeris | I just re-cloned it and I get the same results. |
| 17:35 | eyeris | Perhaps old clojure. |
| 17:35 | eyeris | brb |
| 17:37 | arohner | hrm. clojure.main dies when there is an exception in --init, even if you ask for a repl |
| 17:37 | arohner | I'd like a repl regardless of the exception, so I can use the repl to figure out why it's dying |
| 17:38 | eyeris | That solved it. Silly mistake on my part. |
| 17:38 | cads | has anyone written a clojure tutorial that covers lispy programming subjects? Such as how one can use cons lists to represent trees, with a simple function to map over these trees and such? I understand that clojure abstracts over data structures and presents a large library of functions applicable to data structures that export a simple 3 function interface, are there any articles that talk about this? |
| 17:40 | hiredman | clojurebot: sicp? |
| 17:40 | clojurebot | sicp is http://web.mit.edu/alexmv/6.001/sicp.pdf |
| 17:40 | hiredman | clojurebot: sicp? |
| 17:40 | clojurebot | sicp is http://web.mit.edu/alexmv/6.001/sicp.pdf |
| 17:41 | hiredman | grrr |
| 17:41 | hiredman | cads: there is a wiki somewhere with stuff from the first chapter of sicp transliterated into clojure |
| 17:41 | cads | that sounds wonderful |
| 17:41 | hiredman | http://www.codepoetics.com/wiki/index.php?title=Topics:SICP_in_other_languages:Clojure:Chapter_1 |
| 17:42 | cads | I was contemplating whether I should try following along in sicp using clojure |
| 17:42 | cads | I'm excited about the clojure book coming out |
| 17:42 | ayrnieu | the Little Schemer, Learn Scheme in Fixnum Days, Practical Common Lisp, etc. Call out to these the way you would leverage Java libraries. |
| 17:43 | ayrnieu | the clojure book is pretty good. You can buy it on PDF and read the betas today. |
| 17:44 | dnolen | cads: sicp is fantastic, I recommend it. I got all the way the metacircular evaluator, cool stuff. that was 5 years ago. Nice to come back to a Lisp. |
| 17:44 | cads | The little schemer still stands out in my mind from when I read a sample chapter introducing lisp to me, and the first thing they did was define the halting function and show a proof of why it's uncomputable. |
| 17:45 | cads | It was so elegant |
| 17:46 | arohner | grr. I really wish git could output svn patch files |
| 17:46 | ayrnieu | ... and this was in the Little Schemer? This book? http://www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992 |
| 17:46 | arohner | I have a patch for clojure in my git working copy, and I can't attach it |
| 17:49 | cads | ayrnieu: I think it was, let me see if I can find it again |
| 17:50 | cads | what struck me was how useful it was to use lisp in figuring just as one would use math expressions to derive a formula |
| 17:51 | eyeris | kotarak With the newest clojure and newest cql I get this exception when running this query: http://pastebin.ca/1323161 (sql/query [ID T_FIRSTNAME T_LASTNAME] p9662 (< ID 2000)) |
| 17:52 | kotarak | Obviously I'm too stupid to use multimethods. :( |
| 17:53 | eyeris | It looks to me like line 343 changes the type to ::Execute |
| 17:54 | eyeris | I just don't know if that should be ::Select or not |
| 17:54 | kotarak | eyeris: I shouldn't work on software at this time of the day. |
| 17:55 | kotarak | eyeris: Will look into it tomorrow. I understand the problem. |
| 17:55 | eyeris | Okay |
| 17:55 | eyeris | Thanks |
| 17:55 | kotarak | I tried to be too clever. |
| 17:55 | kotarak | Never a good idea. |
| 17:56 | eyeris | "��Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." |
| 17:56 | eyeris | I love that quote :) |
| 17:57 | kotarak | Yes. That's true. |
| 17:57 | kotarak | :) |
| 17:57 | eyeris | Time to clock out. |
| 18:15 | technomancy | what kind of project? |
| 18:31 | AWizzArd | why does (take 0 (lazy-cat [(println 10)] [(println 20)])) print the 10? |
| 18:32 | AWizzArd | ,(take 0 (lazy-cat [(print 10)] [(print 20)])) |
| 18:32 | clojurebot | 10 |
| 18:33 | AWizzArd | is that a bug in my thinking, or in lazy-cats docstring or in lazy-cat? |
| 18:33 | hiredman | I believe this has come up |
| 18:34 | AWizzArd | ,(doc lazy-cat) |
| 18:34 | clojurebot | "([coll] [coll & colls]); Expands to code which yields a lazy sequence of the concatenation of the supplied colls. Each coll expr is not evaluated until it is needed." |
| 18:34 | hiredman | AWizzArd: http://w01fe.com/blog/2008/12/clojure-and-lazy-seqs/ |
| 18:36 | hiredman | AWizzArd: basically, you are running into the reason why nil punning has to go |
| 18:36 | AWizzArd | what is nil punning? |
| 18:36 | hiredman | (if someseq something somethingelse) |
| 18:37 | hiredman | the idea that a seq might be nil |
| 18:37 | AWizzArd | so, do you regard this behaviour of lazy-cat as correct or do you see it as a bug? |
| 18:38 | ayrnieu | I regard it as poorly documented, at least. |
| 18:38 | hiredman | AWizzArd: I think it something that is not correctable with the current behaviour of seqs |
| 18:38 | hiredman | ayrnieu: sure |
| 18:41 | AWizzArd | thanks for the info hiredman |
| 18:42 | hiredman | AWizzArd: it might be a good idea to ping the group, Chouser, or rhickey about adding something to the docstring |
| 18:44 | karmazilla | technomancy: a search engine for our maven repository |
| 18:44 | cads | Wow, clojure repl + rlwrap is comfy |
| 18:50 | karmazilla | technomancy: front-end and searching written in RoR, and indexer/crawler in Clojure |
| 18:51 | technomancy | cool |
| 18:52 | karmazilla | one day + two people = one search engine :) |
| 18:52 | cads | interesting to hear about ruby/clojure interop. Were you using jruby? |
| 18:53 | karmazilla | no.. the two were fairly disconnected and merely talking to the same database |
| 18:54 | karmazilla | they either end up total cowboy hacks, or devoid of features |
| 18:55 | technomancy | yee-haw, pardner. |
| 19:02 | ayrnieu | ,(let [completions '(foo bar baz)] [(interpose "\n" completions) (interleave completions (repeat "\n"))]) |
| 19:02 | clojurebot | [(foo "\n" bar "\n" baz) (foo "\n" bar "\n" baz "\n")] |
| 19:08 | hiredman | ,(doc completetions) |
| 19:08 | clojurebot | java.lang.Exception: Unable to resolve var: completetions in this context |
| 19:08 | hiredman | ,(doc completions) |
| 19:08 | clojurebot | java.lang.Exception: Unable to resolve var: completions in this context |
| 19:09 | hiredman | bah |
| 19:09 | hiredman | I must be going blind |
| 19:11 | ayrnieu | http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started , I just switched it to use (System/getenv "HOME") and interleave |
| 19:14 | cads | what are you guys doing/ |
| 19:15 | cads | ah, I just followed that guide to create my completions for rlwrap |
| 19:17 | cads | are there plans to create packaged clojure environments for the likes of debian or redhat? |
| 19:17 | Chousuke | maybe that should wait until 1.0 :) |
| 19:19 | cads | the getting started guide was really helpful, now i've got a fun little clj app with completions and history |
| 19:22 | Raynes | I just bought Programming Clojure. |
| 19:22 | Raynes | First programming book I've bought in a long time. |
| 19:22 | lisppaste8 | sa pasted "as" at http://paste.lisp.org/display/74624 |
| 19:23 | hiredman | huh |
| 19:23 | hiredman | must be a mischan? |
| 19:25 | ayrnieu | #chromium is plausible |
| 19:25 | hiredman | nah |
| 19:25 | hiredman | #chromium is for the browser right? |
| 19:25 | hiredman | this is google appengine |
| 19:26 | ayrnieu | #chromium is a python thing and a Google Chrome thing |
| 19:26 | hiredman | ok |
| 20:13 | technomancy | ~time |
| 20:13 | clojurebot | multimethods is what separates the boys from the men. |
| 20:13 | technomancy | nice |
| 20:39 | durka42 | why does clojure say "no such namespace Blah" when it means "static class member Blah/foo not found" |
| 20:53 | durka42 | bit twiddling in clojure seems like quite a jump across abstraction levels |
| 20:53 | durka42 | then again, i'm sure java has an enterprise xml-based api for what i'm doing, which is prying apart RGB colors |
| 20:59 | cads | hehe |
| 21:00 | cads | bleh, java |
| 21:01 | Chousuke | durka42: well, there is the Color class. :) |
| 21:01 | Chousuke | not quite XML though. |
| 21:01 | Chousuke | Apparently you can pass it an integer that encodes an RGB value though |
| 21:02 | durka42 | that is what i have |
| 21:02 | durka42 | apparently bit shifting is wicked slow |
| 21:02 | cads | I have this clojure file that requires two .class files to be present in the classpath, should I export CLASSPATH first to point to those class files, or what's the correct way? |
| 21:03 | Chousuke | durka42: well, you're probably doing it with boxed integers? |
| 21:03 | durka42 | most likely |
| 21:03 | durka42 | are there unchecked versions of bit-and and bit-shift-right? |
| 21:03 | durka42 | the integer was passed to me by a hopelessly complicated quicktime library |
| 21:04 | cads | bleh, specifically I'm trying to get this code working: http://groups.google.com/group/clojure/browse_frm/thread/ce795dd1fb646df1 |
| 21:04 | Chousuke | what do you need to get out of them? Color has .get{Red, Green, Blue} |
| 21:04 | durka42 | i mean, the javadoc says the parameters are ints, not Integers |
| 21:05 | durka42 | maybe autoboxed though, don't know much about that |
| 21:05 | durka42 | Chousuke: that would do it, but i don't see any reason why unless it's faster than bit-shift-right |
| 21:05 | durka42 | will test |
| 21:05 | Chousuke | durka42: you might want to tell clojure that the integer you get from the quicktime thingy is a native integer and not a boxed one. |
| 21:06 | durka42 | how would i do that? |
| 21:06 | Chousuke | I'm not quite sure, but I think it'd be something like (let [color (int (get-stuff-from-qt))] ...) |
| 21:07 | Chousuke | also enable reflection warnings. |
| 21:07 | durka42 | no, passed from QT to my proxy class |
| 21:08 | Chousuke | clojure still autoboxes all ints I think. |
| 21:08 | durka42 | so, when i have |
| 21:08 | durka42 | (proxy [RGBImageFilter] [] |
| 21:08 | durka42 | (filterRGB [x y rgb] |
| 21:09 | durka42 | is there a way to hint at clojure to not box rgb? |
| 21:09 | Chousuke | well, one way would be (let [rgb (int rgb)] ...) I think |
| 21:09 | durka42 | (doc int) |
| 21:09 | clojurebot | Coerce to int; arglists ([x]) |
| 21:10 | Chousuke | that's native int, not Integer :) |
| 21:11 | Chousuke | (doc *warn-on-reflection*) |
| 21:11 | clojurebot | When set to true, the compiler will emit warnings when reflection is needed to resolve Java method calls or field accesses. Defaults to false.; arglists |
| 21:11 | Chousuke | yay, it's running a new enough version. :p |
| 21:15 | durka42 | hmm, reflection in a tight loop |
| 21:15 | durka42 | that's not cool |
| 21:16 | durka42 | but only once |
| 21:16 | durka42 | apparently clojure caches the reflection lookup |
| 21:18 | durka42 | thanks Chousuke |
| 21:35 | cads | Chousuke, are you around? |
| 21:42 | cads | oh man |
| 21:42 | cads | I think I know what's wrong |
| 21:43 | cads | is year-old clojure code likely to still work with the latest trunk? |
| 21:43 | hiredman | nope |
| 21:44 | hiredman | doto change |
| 21:44 | hiredman | at least |
| 21:44 | cads | aye |
| 21:45 | cads | ah well, at least I learned a bit about java classpaths |
| 21:46 | cads | there must have been heavy restructuring, important sounding stuff like clojure.lang.Num is no longer named that |
| 21:46 | Chouser | became Numbers |
| 21:47 | Chouser | A year ago was only shortly after Clojure's initial release. A lot of breaking changes since then, though none terribly deep. |
| 21:48 | hiredman | I think a year ago was the first time I wondered by the old clojure website, and continued on to somewhere else |
| 21:48 | cads | :) |
| 21:51 | cads | I'd like to transliterate this to modern clojure: (defn num [x] (. clojure.lang.Num (from x))) |
| 21:51 | cads | Numbers has to from method, it seems |
| 21:51 | cads | s/to/no |
| 21:52 | hiredman | cads: modern clojure has a num fn you could look at |
| 21:57 | cads | hah, fixing that just gives me the next function that cannot be found :) |
| 21:58 | cads | aaaah well... I guess I'll play with some code of my own |
| 22:07 | persi | hey guys. I'm new to clojure. Is there a way to trace functions like CL TRACE? |
| 22:19 | hiredman | clojurebot: trace is (in contrib) http://github.com/kevinoneill/clojure-contrib/commit/43e4168fc8772225c7f749ffb363b0e2a8f7b84f |
| 22:19 | clojurebot | Alles klar |
| 22:28 | newb12345 | is there a way to disable stm in clojure? |
| 22:29 | newb12345 | i need slightly more guarantee of 'progress' (even though i'm willing to use the gc) |
| 22:30 | hiredman | huh? |
| 22:32 | newb12345 | is there a way to disable stm in clojure? |
| 22:32 | newb12345 | i want standard, lock based multithreading primitives |
| 22:32 | hiredman | I doubt, but you can just java locks |
| 22:32 | hiredman | just use |
| 22:32 | hiredman | but I am curious as to why |
| 22:32 | newb12345 | i don't want rollbacks |
| 22:33 | newb12345 | when code hits a certain point, I want to know that it's really hit there |
| 22:33 | hiredman | stm is used if you run a transaction |
| 22:33 | newb12345 | i have to explicitly start a transaction |
| 22:33 | newb12345 | to get stm? |
| 22:33 | newb12345 | otherwise it's not used? |
| 22:33 | hiredman | yes |
| 22:33 | hiredman | well |
| 22:33 | newb12345 | i am an idiotic newb |
| 22:34 | hiredman | unless you call other code that has stm internally |
| 22:34 | newb12345 | do many libraries have stm internally? |
| 22:34 | hiredman | hmmm |
| 22:35 | hiredman | newb12345: why do think stm will not work for you? |
| 22:35 | newb12345 | i'm at an university |
| 22:35 | newb12345 | and the very people around me |
| 22:35 | newb12345 | who are doing reresearch on stm |
| 22:35 | newb12345 | don't belivee in it |
| 22:35 | newb12345 | and do it mainly for hte papers |
| 22:35 | cads | I've read some stm naysaying papers too |
| 22:36 | hiredman | any of them do a paper on clojure? |
| 22:36 | ayrnieu | newb, use agents. Dispatches to agents are held until STM commits, and so are not rolled back. |
| 22:36 | cads | what strikes me is they have a lot to say about stm being too complex |
| 22:36 | cads | but they don't give any alternatives to mutual locks |
| 22:36 | newb12345 | i'm okay with deadlocking |
| 22:36 | newb12345 | i.e. i just write code taht doesn't deadlock |
| 22:37 | newb12345 | what I dislike about stm is that stuff may get randomly rolled back behind my back |
| 22:37 | hiredman | uh |
| 22:37 | hiredman | no? |
| 22:38 | hiredman | if it fails to commit it is rolled back and retried |
| 22:38 | newb12345 | yeah, this makes it hard to write real time apps |
| 22:39 | hiredman | ah |
| 22:39 | hiredman | well, transactions are supposed to be side effect free |
| 22:39 | hiredman | which most rt apps are not |
| 22:50 | newb12345 | are there good web frameworks for clojure |
| 22:50 | hiredman | there is compojure, webjure and ring |
| 22:50 | hiredman | and others? |
| 22:51 | hiredman | ring is the simplest |
| 22:51 | hiredman | clojurebot: ring |
| 22:51 | clojurebot | ring is http://github.com/mmcgrana/ring/tree/master |
| 22:51 | hiredman | clojurebot: compojure |
| 22:51 | clojurebot | compojure is http://github.com/weavejester/compojure/tree/master |
| 22:51 | hiredman | clojurebot: webjure |
| 22:51 | clojurebot | webjure is http://code.google.com/p/webjure/ |
| 23:05 | cp2 | can someone explain to me what % does/how it works? |
| 23:08 | mfredrickson | cp2: it is an implied argument in a function literal |
| 23:08 | mfredrickson | think of #(+ % %) as (fn [x] (+ x x)) |
| 23:09 | cp2 | yeah, i read that on the /reader page and didnt quite get it, but the anonymous functions section of the concepts article on wikibooks cleared it up |
| 23:09 | cp2 | and ye, makes sense now |
| 23:09 | mfredrickson | you can have multiple implied arguments: #(+ %1 %2) = (fn [x y] ) (+ x y)) |
| 23:09 | cp2 | ye i get it now |
| 23:10 | mfredrickson | I admit there are a few reader macros (I'm looking at you meta-data!) that I always am surprised by |
| 23:10 | cp2 | heh |
| 23:10 | cp2 | im just a bit confused in general |
| 23:10 | cp2 | functional programming isnt something im used to |
| 23:10 | cp2 | im learning...albeit slowly |
| 23:10 | mfredrickson | yup. Lisp can throw a lot at you at once |
| 23:11 | ayrnieu | is there already a (defn thru [f] (fn [s & args] (apply f s args) s)) ? ((thru print) "hello") => "hello" |
| 23:12 | mfredrickson | ,(doc partial) |
| 23:12 | clojurebot | "([f arg1] [f arg1 arg2] [f arg1 arg2 arg3] [f arg1 arg2 arg3 & more]); Takes a function f and fewer than the normal arguments to f, and returns a fn that takes a variable number of additional args. When called, the returned function calls f with args + additional args." |
| 23:13 | ayrnieu | that isn't what I want, if you meant it in answer. |
| 23:14 | mfredrickson | ayrnieu: i see. you need something for side-effects, yes? |
| 23:15 | mfredrickson | i didn't see that thru's function returned s |
| 23:15 | hiredman | |
| 23:15 | ayrnieu | I've shown you exactly what I want; I was just asking if it already exists. It's useful for side-effects on agents, yes. |
| 23:16 | ayrnieu | as in: (add-watcher broadcast-message :send (agent *out*) (thru report)) |
| 23:20 | Cark | nice one |
| 23:20 | Cark | (thru print "hello") would be event better |
| 23:21 | ayrnieu | well, report takes *out* (or a socket, etc.) as its first argument. |
| 23:23 | Cark | ah thus the exta parenthesis i see |
| 23:33 | cads | ,(source partial) |
| 23:33 | clojurebot | Source not found |
| 23:33 | cads | fap. |
| 23:43 | Cark | (defn thru [f & args] (fn [s & more-args] (apply f (concat args [s] more-args)) s)) |
| 23:43 | Cark | ? |
| 23:43 | Cark | it's getting ugly though |
| 23:44 | ayrnieu | http://gist.github.com/55435 is interesting. Sometimes I'll get 2 reports until I broadcast again -- when I get 8. This may not be a problem in a real system. |
| 23:47 | ayrnieu | you can remove the reset-to-nil line to see that the watchers don't trigger when you broadcast the same message. Again, a real system could stamp the messages. |