2009-01-02
| 00:07 | Puzzler | How do I rebuild Clojure from source? |
| 00:07 | Puzzler | Do I need to download and install ant? |
| 00:08 | durka | you need ant yes |
| 00:08 | durka | or maven perhaps? |
| 00:08 | Puzzler | If I make a change to core.clj, do I need to rebuild for that to be seen? |
| 00:08 | durka | but i don't know maven |
| 00:08 | durka | i think so yes |
| 00:08 | durka | once you have ant, just run it in the clojure directory |
| 00:09 | Puzzler | Even though I've installed the Java JDK, that doesn't mean I already have ant on my machine, right? It's a separate install? |
| 00:10 | durka | easy to find out |
| 00:10 | Raynes | Ant is a separate install. |
| 00:10 | Raynes | ant.apache.com |
| 00:16 | Raynes | rhickey_: If you write a book about clojure, I want an autographed copy. :> |
| 00:42 | Raynes | http://www.pragprog.com/titles/shcloj/programming-clojure |
| 00:56 | chrisn | I might create some macro around io! so I can mark a function as being io related. |
| 00:57 | chrisn | Seems like metadata you could tell the compiler |
| 02:33 | knapr | is there a way to measure memory-use of a function? |
| 02:40 | Lau_of_DK | Good morning gents |
| 03:12 | Puzzler | I want to override map with my own definition; any idea why this line isn't working?: (ns mymap (:refer-clojure :exclude [map])) |
| 03:13 | Puzzler | When I then go define map, it still tells me I'm in conflict with core's map |
| 03:14 | dhaya | It seems to work for me. |
| 03:15 | dhaya | (I tried it in the repl) |
| 03:15 | Puzzler | I restarted my REPL, and it worked. Thanks. |
| 03:24 | Puzzler | What's the syntax for :require...:as? This doesn't seem to work: (ns permutations (:require utilcollections :as uc)) |
| 03:24 | Puzzler | Can't find an example in the docs. |
| 03:24 | dhaya | (:require [util.ns :as util]) |
| 03:26 | Puzzler | Thx |
| 03:29 | dhaya | the doc for require/use etc can be more helpful with some examples. |
| 03:33 | knapr | can i do somehow: (get-keyofval {0 :c 1 :g} :c) ? |
| 03:33 | knapr | is there a builtin i mean... |
| 03:33 | dhaya | Ah. I was searching for this: http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples |
| 03:34 | Lau_of_DK | knapr: You want the key which holds a given value? |
| 03:35 | knapr | yes |
| 03:35 | dhaya | knapr: There is map-invert, if thats useful? |
| 03:36 | knapr | in contrib? |
| 03:36 | dhaya | clojure.set |
| 03:43 | Lau_of_DK | user> (def abc {:a 5 :b 10}) |
| 03:43 | Lau_of_DK | #'user/abc |
| 03:43 | Lau_of_DK | user> (filter #(= (val %) 5) abc) |
| 03:43 | Lau_of_DK | ([:a 5]) |
| 03:43 | Lau_of_DK | |
| 03:44 | Lau_of_DK | Couldnt you just filter? |
| 03:45 | knapr | is it not possible to breka a for-comprehension? |
| 03:46 | dhaya | knapr: for takes a :while option. |
| 03:47 | dhaya | ,(for [i (range 1 10) :while (< i 5)] i) |
| 03:47 | clojurebot | (1 2 3 4) |
| 03:48 | knapr | is there when-not as option or something? |
| 03:49 | dhaya | there is :when and :while |
| 03:49 | knapr | can i somehow the eval the loop-step and then quit rather than quit before it is evaled? |
| 04:00 | Lau_of_DK | knapr: How about writing your own loop/recur? |
| 04:08 | Puzzler | Actually, since filter is lazy, just use first on the filter, and that essentially works as if it is "breaking" out of the loop? |
| 04:23 | Puzzler | Is there a way to :use a namespace in way that intentionally clobbers names that have already been imported from other namespaces (such as from clojure's core)? |
| 04:29 | cgrand | puzzler: :refer-clojure :exclude (see (doc ns)) |
| 04:30 | Puzzler | Right, but I want to clobber a whole bunch of functions from the core. So I was hoping there ways a way to do it automatically with a flag to :use, rather than having to explicitly list all the ones I'm excluding. |
| 05:19 | knapr | any plans on adding something like (doc-all hash-map), a doc-function that returns a list of all functions that operates ona specific function in core. |
| 05:51 | knapr | is there a way to measure memory-use of a function? |
| 05:53 | karmazilla | knapr: not easily. you can make a memory dump (jmap & such) and investigate what that particular IFn instance is holding on to with tools like Eclipse MAT |
| 05:56 | karmazilla | ... asuming you're using the Sun JVM |
| 06:18 | knapr | what is the idiomatic Clojure waywhen recursing to build up a new collection? loop+recur or lazy-cons? |
| 06:31 | Chousuke | Are you sure you're limited to those two options? :) |
| 06:32 | Chousuke | if you can use map or something that would be even better. |
| 06:49 | lisppaste8 | knapr pasted "monty hall, ugly, tips?" at http://paste.lisp.org/display/72949 |
| 06:49 | knapr | i made avery long and ugly implementation of a Monty Hall simulation |
| 06:49 | knapr | you know that counter-intuitive probability-example |
| 06:50 | knapr | http://en.wikipedia.org/wiki/Monty_Hall_problem |
| 06:50 | knapr | anyone could show me how to simplify it? |
| 06:51 | knapr | hmm actually i dont need hashmaps i could just rand numbers and check |
| 06:53 | Chousuke | I think (hashmap choice) is more idiomatic than (get hashmap choice) |
| 06:54 | knapr | ok |
| 06:54 | Chousuke | and rather than checking for "(if (nil? foo)) it's more idiomatic to either check for (if foo) or (if-not foo) |
| 06:54 | knapr | anyway i could obv simolify it a lot isee now |
| 06:55 | knapr | b not using hashmaps at all |
| 06:56 | Chousuke | also in (if foo bar nil) the nil is redundant, since it's the default :) |
| 07:25 | lisppaste8 | knapr annotated #72949 with "much nicer!" at http://paste.lisp.org/display/72949#1 |
| 07:25 | knapr | http://paste.lisp.org/display/72949#1 |
| 07:26 | knapr | there it is, much nicer and shorter |
| 08:24 | leafw | doesn't the doc string print when calling (doc fn-name) ? |
| 08:24 | Lau_of_DK | yes sir |
| 08:24 | leafw | I have: (defn area [r] "Computes area of a rectagle." (* (.width r) (.height r))) |
| 08:25 | leafw | but (doc area) prints user/area ([r]) nil nil |
| 08:25 | leafw | ? |
| 08:25 | Lau_of_DK | try (defn area "bla bla" [r] (code)) |
| 08:25 | leafw | I thought defn was a macro that automated the process of placing he documentation string. |
| 08:26 | leafw | ok! |
| 08:26 | leafw | thanks |
| 08:26 | leafw | but then, how come it doesn't fail? It just evaluates to itself and does nothing? |
| 08:26 | leafw | I mean the doc string |
| 08:27 | karmazilla | very true, sir. the string evaluates to itself and does nothing |
| 08:27 | leafw | great. |
| 09:00 | leafw | question about = vs. == : |
| 09:00 | leafw | (== Rectangle (.getClass r)) --> false |
| 09:00 | leafw | (= Rectangle (.getClass r)) --> true |
| 09:01 | leafw | I understand that '=' uses .equals() method |
| 09:01 | karmazilla | == is for numbers |
| 09:01 | leafw | whereas == is value comparison. Is that right? |
| 09:01 | leafw | well, what I want to compare is pointers: the Rectangle.class and the r.getClass() should be the same object. |
| 09:02 | leafw | the .equals() does a very deep comparison, all the way to ClassLoader. |
| 09:03 | karmazilla | identical? is what you're looking for |
| 09:03 | leafw | aha |
| 09:04 | leafw | thanks |
| 09:04 | leafw | indeed. |
| 09:04 | karmazilla | also, find-doc is made of awesome |
| 09:06 | leafw | clojure doc function printouts needs a "see also" section. |
| 09:06 | karmazilla | well, to a degree anyway :) |
| 09:06 | leafw | i.e. =, == and identical? are not logically refered to in the docs. Is there any other comparison that I should be aware of? |
| 09:08 | karmazilla | java.util.Arrays has some stuff for comparing arrays |
| 09:10 | leafw | thanks. |
| 09:12 | karmazilla | class (indeed any type) comparison/checks are pretty cheap, though |
| 09:16 | leafw | try doing a few million ... |
| 09:17 | karmazilla | under what time constraints? :) |
| 09:20 | leafw | milliseconds |
| 09:20 | leafw | I had to make a quadtree first ... |
| 09:20 | leafw | in any case, lunch time |
| 09:21 | karmazilla | that's a tough nut. But I still think it'll be all the other stuff that .equals() might do, that'll be the time sink. The checkcast and instanceof bytecodes compilers to pointer comparisons or something like that. |
| 09:46 | Lau_of_DK | Hey sohail |
| 09:53 | sohail | hey Lau_of_DK |
| 09:55 | Lau_of_DK | sohail: Its been a while since you ranted in here, what are you working on these days? |
| 09:57 | sohail | Lau_of_DK, little of this, little of that :-) |
| 09:59 | sohail | Lau_of_DK, how about you? |
| 10:01 | Lau_of_DK | Mostly ClojureQL these days |
| 10:26 | Chouser | clojurebot: reduction? |
| 10:26 | clojurebot | reduction is http://groups.google.com/group/clojure/msg/4f7e3ca1af3b8b18 |
| 10:33 | Chouser | clojurebot: trace? |
| 10:33 | clojurebot | Huh? |
| 10:34 | Chouser | clojurebot: trace is http://groups.google.com/group/clojure/msg/6fd1b352ac1a6744 |
| 10:34 | clojurebot | c'est bon! |
| 10:35 | sohail | Lau_of_DK, I'm so out of it I don't even know what that is |
| 10:35 | sohail | is that sql in clojure |
| 10:35 | Lau_of_DK | Yes sir, it is |
| 10:36 | sohail | have a link? |
| 10:36 | Lau_of_DK | http://github.com/Lau-of-DK/clojureql/tree/master |
| 10:36 | Lau_of_DK | We havent worked on the docs yet, so give us about 10 days, and we should be in RC |
| 10:37 | sohail | I see test-macs |
| 10:37 | sohail | cute :-) |
| 10:40 | stuarthalloway | Lau_of_DK: is the API stable now, but for docs? |
| 10:42 | Lau_of_DK | stuarthalloway: No I wouldnt say so. Queries work flawless but were still implementing commands and finalizing design |
| 10:43 | Lau_of_DK | sohail: Oops, forgot to take that out :) |
| 10:43 | stuarthalloway | Lau_of_DK: I am writing the SQL part of the book this weekend, I'll take a look at this and maybe add a short description |
| 10:44 | Lau_of_DK | stuarthalloway: Cool, I'll work faster tonight, and (apply spank kotarak) so he will do the same :) |
| 10:47 | Chouser | rhickey: is it possible that triggering of watchers is getting coalesced in some way that they didn't previously? |
| 10:54 | rhickey | Chouser:shouldn't be - there is a change check, no action sent if identical state, before there was a boolean indicator |
| 10:55 | Chouser | oh! ok, that would be different enough to explain what I'm seeing. |
| 10:56 | Chouser | I have an atomic counter of updates with pending watchers. I inc on update, dec when the watcher fires, so when the counter touches 0 I know all pending work is complete. |
| 10:58 | rhickey | so that breaks when work doesn't modify state? |
| 11:03 | Chouser | right |
| 11:03 | Chouser | I used to do subsequent send's only if there was a change, but dec my counter regardless. |
| 11:04 | abrooks | Chouser: It seems like watchers should only trigger on change. Don't you want a commutable decrement of a ref on work done? (i.e. don't use an atom). |
| 11:04 | Chouser | I can't avoid the extra inc's because I don't know until after the action if there will be a change. I suppose I can move the dec to the action, but that makes it no longer a pure function. |
| 11:06 | Chouser | abrooks: I'm using AtomicInteger not an atom, but either way doesn't really matter here. |
| 11:07 | stuarthalloway | how do I get paste.lisp.org to announce pastes here? Whenever I choose #clojure, it tells me I have entered the Captcha incorrectly. |
| 11:08 | stuarthalloway | and, why does this run out of heap space? http://paste.lisp.org/display/72958 |
| 11:08 | Chouser | The only purpose of the counter is to determine when all agent sends are complete, so it's bookkeeping not part of the algorithm itself. |
| 11:08 | Lau_of_DK | stuarthalloway: What do you enter in capchta? |
| 11:08 | abrooks | Chouser: I realize that. It's still part of the effect of the transaction, though. |
| 11:09 | Lau_of_DK | stuarthalloway: and do you use this url? http://paste.lisp.org/new/clojure |
| 11:09 | stuarthalloway | "Lisp" works fine if I do not select #clojure, but once I do that it fails |
| 11:09 | Chouser | abrooks: there is no transaction |
| 11:09 | Lau_of_DK | Try that link using all lowercase "lisp" |
| 11:09 | abrooks | Chouser: Oh, what are the watchers watching? |
| 11:10 | Chouser | stuarthalloway: cgrande explained that one to me. |
| 11:10 | stuarthalloway | Chouser: are you teasing me now? |
| 11:10 | Chouser | abrooks: the watchers are watching agents. This is for a projecteuluer puzzle I posted about: http://gist.github.com/gists/32494 |
| 11:11 | Chouser | stuarthalloway: heh. gimme a sec |
| 11:11 | abrooks | Chouser: I figured it was that. I don't know why I assumed you were watching refs (perhaps because I got all excited about general purpose watchers when they went in last night...). |
| 11:12 | Chouser | stuarthalloway: http://groups.google.com/group/clojure/browse_thread/thread/3edf6e82617e18e0/3cd0cb80a93aae4a?#3cd0cb80a93aae4a |
| 11:15 | rhickey | Chouser: gotta run right now, will think about your problem |
| 11:15 | Chouser | rhickey: ok, thanks. |
| 11:15 | stuarthalloway | Chouser: shouldn't we pull fibs from clojure.contrib.lazy-seqs? |
| 11:16 | stuarthalloway | I thought it was broken because it held the head (it is) |
| 11:16 | stuarthalloway | but you are suggesting that even if it didn't, the approach is still busted |
| 11:16 | stuarthalloway | r/pull/fix |
| 11:16 | Chouser | but the definition itself is so pretty... |
| 11:17 | stuarthalloway | but bad style |
| 11:18 | Chouser | apparently. |
| 11:18 | Chouser | same for powers-of-2 |
| 11:20 | stuarthalloway | Chouser: I am having trouble convincing myself that my fibs has the same issue: it overflows the heap, not the stack |
| 11:23 | Chouser | but the code is almost identical |
| 11:23 | stuarthalloway | Chouser: Yep, and I won't be happy until I understand the different outcome |
| 11:24 | Chouser | I guess I've never paid attention to which kind of memory I was running out of. |
| 11:27 | Chouser | stuarthalloway: perhaps the difference is the amount of memory each item in the seq requires? |
| 11:27 | Chouser | in both, the stack is getting very deep, with each frame pointing to a successive object in the seq being produced |
| 11:29 | Chouser | ...but with 'reductions' the items being pointed to are probably all Integers, while 'fibs' is getting into some very large BigIntegers, all of which are presumably stored on the heap? |
| 11:30 | stuarthalloway | Chouser: it actually runs out before getting to 100! |
| 11:32 | stuarthalloway | which means something combinatorially bad is happening |
| 11:33 | Chouser | (nth fibs 100000) works for me |
| 11:33 | stuarthalloway | using the one in contrib? |
| 11:33 | Chouser | yes |
| 11:34 | stuarthalloway | that one is broken in a different wya |
| 11:34 | Chouser | oh |
| 11:34 | stuarthalloway | it holds the whole collection |
| 11:34 | stuarthalloway | which is fine until it burns the whole heap |
| 11:34 | Chouser | oh! |
| 11:35 | Chouser | with the fn version, you're not getting the caching effect of seqs |
| 11:36 | stuarthalloway | This one seems friendly to both stack and heap: http://paste.lisp.org/display/72958#2 |
| 11:37 | stuarthalloway | works for n=1 million |
| 11:38 | stuarthalloway | Chouser: I was expecting to get the caching effect, but have parallel caches for the first and rest expr, but you're right, that ain't happening |
| 11:40 | Chouser | it's amazing how hard I have to work to understand the implications of 4 simple lines of code. |
| 11:42 | stuarthalloway | Likewise, and this is Not A Good Thing. We need some shortcuts for thinking about these. |
| 11:43 | Chouser | #2 in your paste looks very good. |
| 11:45 | stuarthalloway | I'll suggest it to Steve |
| 11:46 | Chouser | I wonder how much a more descriptive name for the inner function, or using 'let' to shift things around a bit would help one understand it. |
| 11:46 | Chouser | my guess would be "not very much". :-/ |
| 11:48 | stuarthalloway | Chouser: It isn't the big integers. Here is a variant that gets no bigger than 1: http://paste.lisp.org/display/72958#3 |
| 11:53 | Chouser | lasts a long time |
| 11:59 | Chouser | java.lang.OutOfMemoryError: GC overhead limit exceeded |
| 11:59 | Chouser | is that heap? |
| 11:59 | stuarthalloway | never seen it, but would think so |
| 11:59 | stuarthalloway | my error was a simple "out of heap space" |
| 11:59 | RSchulz | You're getting so close to being out of memory that reclamation is taking too long. |
| 12:00 | stuarthalloway | I am trying to figure out big O for time and space |
| 12:00 | stuarthalloway | by running it, not by thinking :-) |
| 12:01 | RSchulz | I think that happens in part when there's a thread that can run without requiring allocation, which then eats into the CPU time available for the GC thread and the watchdog timer calls a halt to its (GC thead's) activity. |
| 12:03 | stuarthalloway | check out http://paste.lisp.org/display/72958#4 |
| 12:05 | stuarthalloway | so (bad) is pretty bad. The laziness keeps the recursion from being stack consuming, but boy does it use some heap! |
| 12:07 | stuarthalloway | so here is my attempt at a summary explanation: |
| 12:08 | stuarthalloway | Holding the head (as contrib currently does) is bad, because if you want to work with big numbers holding the head will cause you to consume the whole heap |
| 12:09 | stuarthalloway | straightforward conversion from collections to function calls is disastrous, because the sequence will get realized a huge number of times (e.g. http://paste.lisp.org/display/72958#4) |
| 12:10 | stuarthalloway | instead, you need to write the lazy collection as a function that "carries its cursor with it", e.g. http://paste.lisp.org/display/72958#2 |
| 12:16 | stuarthalloway | clearly I have scared you all away or bored you to death |
| 12:17 | Chouser | I wouldn't say that holding the head is always bad for seqs like this. |
| 12:17 | RSchulz | Can you rephrase that as a question? |
| 12:17 | stuarthalloway | Chouser: true, if you don't ever plan to go large |
| 12:17 | Chouser | but it is a design decision -- space vs. time. |
| 12:17 | Chouser | right |
| 12:17 | stuarthalloway | but (IMO) false for a general purpose library |
| 12:18 | stuarthalloway | callers should be able to choose realization/caching strategy, not have it inflicted on them by the API |
| 12:19 | Chouser | I agree for a general API. |
| 12:19 | Chouser | It's easy for a user to say (def fibs (nice.lib/fibs)) if they want it cached. |
| 12:20 | Chouser | hm, though that doesn't allow the building function to take advantage of the cache. |
| 12:20 | stuarthalloway | the building function only needs the last two items for a cache |
| 12:21 | stuarthalloway | which is what I meant by "carries its cursor with it" |
| 12:21 | stuarthalloway | ...for fibs, anyway |
| 12:22 | Chouser | right, good point. |
| 12:23 | Lau_of_DK | You guys havent worked out an optimal fib-seq yet? |
| 12:25 | stuarthalloway | (defensively). I am a biz app developer, not a mathematician. :-) |
| 12:26 | Lau_of_DK | (condescendingly) Of course, I completely understand |
| 12:27 | stuarthalloway | but I will vote for http://paste.lisp.org/display/72958#2 until a mathematician shows up |
| 12:27 | Lau_of_DK | (that was a joke btw :-)) |
| 12:28 | Lau_of_DK | Doesnt look too impressive :) |
| 12:29 | stuarthalloway | good! I don't want to write anything so impressive that MarkV feels compelled to add comments :-) |
| 12:32 | Lau_of_DK | That was an internal remark of some sort wasnt it ? :) |
| 12:34 | leafw | Lau_of_DK: mailing list had an example recently. A guy looking for praising and attention. |
| 12:34 | Lau_of_DK | oh I see |
| 12:34 | leafw | clojure is fortunate to not have an add-more-fire benevolent dictator like openbsd does. |
| 12:35 | Lau_of_DK | What do you mean? We have The Chouser! |
| 12:35 | leafw | that's a minor devil :) |
| 12:35 | leafw | constructive one, even! |
| 12:36 | stuarthalloway | leafw: While I disagree with MarkV, I am not at all dismissive of his concerns |
| 12:37 | stuarthalloway | I see the solution in smaller functions and better names, not (in general) more comments |
| 12:38 | leafw | I agree. |
| 12:38 | RSchulz | I think a big problem with programming in general is how hard it is to understand code. It's often easier just to write something yourself rather than figure out someone else's code. |
| 12:38 | RSchulz | And I fear that dense languages like Clojure and other Lisps just make that phenomenon worse. |
| 12:38 | stuarthalloway | RSchulz: any code for which that is true is legacy code |
| 12:39 | RSchulz | Yes, but we still get a lot of people saying, in effect: "If you want to use this code, you should read it." And that is no way to produce reusable software. |
| 12:39 | Chouser | I think that reading code is a different skill from writing code. While they of course interact some, being good at one doesn't automatically mean you're good at the other. |
| 12:39 | leafw | RSchulz: so true. This comment about lack of knowlege transfer between generations of programmers stroke a cord: http://news.ycombinator.com/item?id=405188 |
| 12:40 | stuarthalloway | To be concrete, I find 90% of core.clj to be totally readable, and not needing of comments |
| 12:40 | Chouser | reading code is harder than one might expect, and reading comments is no substitute. |
| 12:40 | stuarthalloway | counterexample: destructure. I would like to see that rewritten or commented |
| 12:40 | leafw | stuart, the readability of core.clj is what brought me in in the first place. A language that can be read so directly must be doing something right. |
| 12:41 | Chouser | thus I think working and practicing at *reading* code is a worthwhile activity, at least as much as practicing writing code. |
| 12:41 | RSchulz | I also find that people tend to write production code as if it's a textbook algorithm, except all the support prose of a textbook is absent. That changes what good choice of names means, for just one example. |
| 12:41 | Lau_of_DK | I really hate reading code compared to writing it, takes just as long :) |
| 12:42 | leafw | Lau_of_DK: you may not have tried to implement many algorithms ... |
| 12:42 | leafw | Lau_of_DK: libraries of java is what makes clojure so appealing, don't forget that |
| 12:42 | Lau_of_DK | Sure, but thats not really the point |
| 12:42 | RSchulz | Authors (non-software authors) all know that they way to get good at writing is, in part, to do a lot of reading. |
| 12:43 | Chouser | RSchulz: yes, but reading code is hardly ever addressed as a useful skill of its own, to be pursued. |
| 12:43 | Lau_of_DK | Chouser: But what Im saying is, that its a seperate skill to me at least |
| 12:44 | RSchulz | True. I don't recall ever having an exam in college which said: Given this C code (this was a few decades ago), tell me what it computes and analyze its time and space complexity. |
| 12:44 | Chouser | Many (myself included) tend to find it annoying, unrewarding, difficult. I don't think this is entirely the fault of the writers. |
| 12:44 | Chouser | Lau_of_DK: that is also what I'm saying, plus that it's a desperately *useful* skill. |
| 12:45 | RSchulz | I wonder to what extent there's a subtle or latent NIH phenomenon in reading code. Technologists want to feel like an inventors, even when they're _re_inventing... |
| 12:46 | Chouser | I make no claims at all at being good at it, but hopefully recognizing that it's a useful skill will continue to help me persist longer at reading before giving up and writing. :-) |
| 12:47 | RSchulz | Did anyone read that Yegge blog referenced on the list yesterday? I particularly disagree with the "compression tolerance" bit. I think it's one of the biggest reasons code is hard to read. |
| 12:47 | Lau_of_DK | Hehe |
| 12:47 | Lau_of_DK | Mr. Schulz, NIH phenom ? |
| 12:47 | RSchulz | Not Invented Here. |
| 12:47 | Lau_of_DK | OIS |
| 12:47 | Lau_of_DK | (oh I see) |
| 12:47 | leafw | RSchulz: compressed code that is hard to read is either not compressed right or unnecessarily compressed. |
| 12:48 | RSchulz | Well, I know my coding style is not generally shared or liked, but I eschew the compression thing. My code is "light and fluffy." |
| 12:48 | leafw | RSchulz: but there is such thing as verbose code and succint code |
| 12:48 | RSchulz | I have to cut my line number counts about in half to compare them with others'. |
| 12:49 | leafw | I find myself thinking: does this line layout helpme understand this code one week from now? |
| 12:49 | RSchulz | Although I will admit, I find that now that I'm back to doing some Lisp (Clojure), that I'm doing that less and my Lisp / Clojure code is denser than my Java code. |
| 12:49 | stuarthalloway | I don't think these conversations ever get far without specific examples, so hats off to Mark for backing his point with rewritten code |
| 12:49 | leafw | one more, agreed. Idle talk ... this "Sunday" afternoon. |
| 12:50 | RSchulz | I will also give him credit for being adaptable in his position. I think he produced three distinct versions of his rewrite responding to feedback on the list. |
| 12:50 | Lau_of_DK | Can somebody produce a link to that discussion ? |
| 12:50 | RSchulz | http://groups.google.com/group/clojure/browse_thread/thread/48aacb9892a79bc4/a3ffff9b6a1206a6?lnk=gst&q=Making+Code+Readable#a3ffff9b6a1206a6 |
| 12:51 | RSchulz | Starts here: http://groups.google.com/group/clojure/browse_thread/thread/48aacb9892a79bc4/bc1497883699dab9 |
| 12:53 | RSchulz | stuarthalloway: What's the status of your dual Clojure / "conventional" project? Has it started? Ended? |
| 12:53 | stuarthalloway | RSchulz: not begun |
| 12:53 | RSchulz | Have you picked the job, yet? |
| 12:53 | stuarthalloway | no, at this point we are talking about doing a second book, focused on something specific in Clojure |
| 12:54 | stuarthalloway | and moving the case study there |
| 12:54 | RSchulz | No takers? |
| 12:54 | stuarthalloway | some takers, no good fits |
| 12:54 | RSchulz | Too bad. It sounded like a really good idea. |
| 12:54 | stuarthalloway | its a timing thing, still might happen |
| 12:54 | RSchulz | I hope it does. |
| 12:55 | leafw | what is this project about? |
| 12:55 | RSchulz | How's business? Is the economy hurting you? |
| 12:55 | Chouser | I do think the book has sufficient value without it. |
| 12:56 | Chouser | the multimethod chapter alone may be worth the cover price. :-) |
| 12:56 | Lau_of_DK | RSchulz: thanks for the links |
| 12:56 | RSchulz | Sure. |
| 12:57 | stuarthalloway | leafw: you tell me :-) http://blog.thinkrelevance.com/2008/10/20/participate-in-a-clojure-case-study |
| 12:57 | leafw | haven't found a part of the book I could trash in any way so far. On the contrary, I am finding the book a nice refreshing and detailing of all clojure I learned from the website. |
| 12:57 | stuarthalloway | Aw, shucks. :-) |
| 12:57 | stuarthalloway | RSchulz: if the business question was to me, no, not yet at leaste. |
| 12:58 | leafw | stuarthalloway: but what you say in the intro is true: the book is not for beginners. |
| 12:58 | RSchulz | Yes, to you, stu. That's good to hear. |
| 12:58 | stuarthalloway | leafw: I think some Lisp dialects could be for beginners, but not Clojure |
| 12:58 | RSchulz | I'm surprised by how many people show up looking at Clojure without any prior Lisp background. |
| 12:59 | stuarthalloway | RSchulz; I think lack of Java background would be almost as tough |
| 12:59 | RSchulz | Has anyone used DrScheme? Replicating that for Clojure would be fabulous, though a pile of work, it seems. |
| 12:59 | leafw | stuarthalloway: I am actually doing such thing currently. I have a non-trivial app built in java which I am, part for fun, part for learning, part searching for proper concurrency setup, translating into clojure. |
| 12:59 | RSchulz | I suppose. But you can do Clojure programming while ignoring the Java parts, at least for academic purposes (understanding FP, e.g.) |
| 13:00 | Lau_of_DK | stuarthalloway: The book youre on, is it purely code-oriented, or do you have interviews with relevant parties? |
| 13:01 | leafw | stuarthalloway: clojure expects one to know java quite well, and hate/love it. |
| 13:01 | Chouser | I have extremely little Java background, though enough other OOP that it's not gotten in my way too terribly |
| 13:01 | Chouser | ...not counting rants against classpath and java.io |
| 13:01 | RSchulz | Lau_of_DK: You should buy the book, at least the PDF. Then you can get the betas (right now). |
| 13:01 | stuarthalloway | Lau_of_DK: code |
| 13:01 | Lau_of_DK | RSchulz: What kinda percentages of the sale do you get ? |
| 13:01 | leafw | Chouser: don't forget the File path mess cross-platform. |
| 13:01 | walters | Chouser: hopefully classpath stuff will be fixed with the modules/modularity work in 7 |
| 13:01 | RSchulz | stuarthalloway: How much is my kickback? |
| 13:02 | stuarthalloway | you can also check out the sample code for free: http://github.com/stuarthalloway/programming-clojure/tree/master |
| 13:02 | Chousuke | Chouser: java.io is actually going to get replaced |
| 13:02 | Chousuke | Chouser: by java.nip |
| 13:02 | Chousuke | nio* |
| 13:02 | Lau_of_DK | Thansk |
| 13:02 | Lau_of_DK | Thanks |
| 13:02 | RSchulz | yeah, java.nip would be very rude! |
| 13:02 | stuarthalloway | and RSchulz gets 100% of revenue on people checking out the sample code :-) |
| 13:02 | RSchulz | Wow! Set for life!! |
| 13:03 | Lau_of_DK | hehe |
| 13:06 | Chousuke | I think I need a new router :/ |
| 13:07 | Chousuke | so far, most attempts to download files larger than 8MB have failed. |
| 13:07 | RSchulz | The tubes are clogged. |
| 13:07 | leafw | reminds me of the 500-mile email |
| 13:08 | Chousuke | RSchulz: the tubes have enough for 200kB/s... but it just stops. |
| 13:08 | RSchulz | Tubes further from you, that is. |
| 13:09 | RSchulz | I used to get 6Mbps, but when I moved, the best they could do for me is 3Mbps. |
| 13:09 | Chousuke | I think I'll just bypass the router for now and use a direct connection |
| 13:09 | RSchulz | Probably some bytes get turned sideways, causing the clog. |
| 13:10 | RSchulz | Anybody here involved with the DC Clojure study group? |
| 13:35 | pjb3 | RSchulz: I'm involved with the DC Clojure study group |
| 13:47 | Lau_of_DK | RSchulz: I have to say in that thread you link, MarkV hits on a most excellent topic, Clojure, its code and its docs are not suited for new-comers, imo |
| 13:53 | triddel1 | ok, simple question... given a vector ["a" "test"] how do I add a "\t" to the front of each value? I can't seem to get it with apply and str and keep the vector. |
| 13:53 | Lau_of_DK | user> (map #(str \t %) ["hi" "there"]) |
| 13:53 | Lau_of_DK | ("thi" "tthere") |
| 13:54 | triddel1 | thanks Lau! |
| 13:54 | Lau_of_DK | no probs |
| 13:56 | mchurch | Lau_of_DK: I would agree with that. Clojure is still the "bleeding edge" right now. |
| 13:57 | mchurch | It's a very cool language, but not the easiest to get into at present. |
| 13:57 | Lau_of_DK | mchurch: Yea, I know I spent some 3 - 4 months bleeding from the get go, always crying on Chousers shoulder, took a little break of 1 month or 2, came back, and everything (almost) made sense |
| 13:57 | mchurch | Lau_of_DK: Is Clojure your first Lisp? |
| 13:57 | Lau_of_DK | But the fact that the docs strings dont have examples are a stumbling block I think. I couldnt work out how to use condp from the doc-string, either that says alot about me, or the string (Im hoping the string) |
| 13:57 | Lau_of_DK | No, coming from SBCL |
| 13:59 | Puzzler | Good morning, all. You guys talking about the documentation thread? |
| 13:59 | Lau_of_DK | Puzzler: Yes |
| 14:00 | mchurch | Lau_of_DK |
| 14:00 | mchurch | Lau_of_DK: Where does one find the doc strings? |
| 14:00 | kotarak | (doc doc9 |
| 14:00 | clojurebot | Prints documentation for a var or special form given its name; arglists ([name]) |
| 14:00 | kotarak | (doc doc) |
| 14:00 | clojurebot | Prints documentation for a var or special form given its name; arglists ([name]) |
| 14:00 | mchurch | Cool. |
| 14:00 | Chouser | whoa |
| 14:00 | kotarak | Interesting parser. |
| 14:00 | mchurch | .(doc +) |
| 14:00 | mchurch | ,(doc +) |
| 14:00 | clojurebot | ------------------------- clojure.core/+ ([] [x] [x y] [x y & more]) Returns the sum of nums. (+) returns 0. |
| 14:00 | Puzzler | Yes, there's no one perfect answer for "the right amount of documentation". But I think it's worth recognizing that Lisp code is somewhat less "readable" than code in other languages. |
| 14:00 | kotarak | mchurch: just (doc +) |
| 14:00 | Puzzler | And I say this as someone who has been programming in Scheme and other Lisp-derived languages for 20 years. |
| 14:00 | Lau_of_DK | mchurch: from the your REPL, just type (doc condp) for instance |
| 14:01 | kotarak | without , and stuff |
| 14:01 | mchurch | Puzzler: I think Lisp code is denser, but as readable per amount of content |
| 14:01 | mchurch | kotarak: Yeah. I thought you needed a , to call the IRC Repl |
| 14:01 | mchurch | (+ 3 4) |
| 14:01 | clojurebot | *suffusion of yellow* |
| 14:01 | Chousuke | mchurch: you need, but (doc is special |
| 14:01 | mchurch | ,(+ 3 4) |
| 14:01 | clojurebot | 7 |
| 14:02 | Puzzler | mchurch: There are two main reasons I think Lisp code is less readable. |
| 14:02 | mchurch | What was *suffusion of yellow*? |
| 14:02 | mchurch | (+ 2 3) |
| 14:02 | clojurebot | *suffusion of yellow* |
| 14:02 | mchurch | (println "*suffusion of pink*") |
| 14:02 | Puzzler | 1. The density, which you bring up. |
| 14:03 | Puzzler | 2. But more importantly, all code has a certain visual sameness to it. In other languages, there's a lot of little visual things that distinguish loops from assignments from function calls from data. |
| 14:04 | mchurch | Puzzler: Ah, I didn't think about #2. You're right. |
| 14:04 | Lau_of_DK | The main difference is the FP in this case. Normally youre looking at consequtive statements, here you're looking at wrapped data. |
| 14:04 | Lau_of_DK | IMO :) |
| 14:05 | Puzzler | It's definitely "elegant". But you have to read much more carefully to extract meaning out of the code you are looking at. |
| 14:05 | mchurch | Lau_of_DK: But you can have FP without syntactic regularity, e.g. ML |
| 14:05 | Chouser | I often have to read lisp code from the inside out, to make sense of it. |
| 14:05 | Lau_of_DK | mchurch: Sure, but hows that relevant in a discussion about the approachability of clojure in its present state? |
| 14:06 | mchurch | Lau_of_DK: ML has more syntactic cues, in part because of non-regularity, but also because the static typing means that there are more operators |
| 14:06 | Puzzler | Lau_of_DK: The relevance depends on how much you care about attracting others to the language. |
| 14:06 | mchurch | Lau_of_DK: It says little about noob-friendliness at present, but it does indicate where the asymptote lies |
| 14:07 | Lau_of_DK | k |
| 14:07 | mchurch | Lau_of_DK: Then again, I'm not fully sure that Lisps aren't noob-friendly, only because I think Scheme is a great (and powerful) noob language. |
| 14:07 | Puzzler | i recognize the readability as a tradeoff, and have still chosen to work with Scheme languages for many years. But I am aware that noobs will have difficulty with this. |
| 14:08 | mchurch | Not to say that Scheme is only a "noob language". Don't want any flamewars. ;) |
| 14:08 | Puzzler | mchurch: True. When I tutor kids in programming, I always use PLT Scheme. It's a GREAT first language. But kids don't have any expectations about what a program should look like, and they are writing short programs. |
| 14:08 | Lau_of_DK | mchurch: It depends on where you start, when I picked up SBCL I felt very lost, and very hard pressed to find a community |
| 14:09 | mchurch | Puzzler: Yep. Large programs are hard in any language, because the difficulty is conceptual. |
| 14:09 | mchurch | Lau_of_DK: I found Practical Common Lisp to be of great help. Generally, I find languages easy to learn. It's outer-layer shit like make/build-system that are harder. |
| 14:09 | Chouser | Puzzler: would you consider Clojure for that context now? |
| 14:09 | Lau_of_DK | Yes, PCL was also the ice-breaker for me, in a big way |
| 14:09 | Puzzler | Actually, I think most newcomers to LISP/Clojure would benefit from playing around with PLT Scheme and reading "How to Design Programs" at htdp.org. |
| 14:10 | Lau_of_DK | mchurch: also the SICP videos gave me alot to think about |
| 14:10 | mchurch | Lau_of_DK: Yeah, SICP is awesome. |
| 14:10 | Puzzler | Chouser: Good question. I think there are a lot of ways that PLT Scheme provides a superior teaching infrastructure, so I'm not going to be changing my teaching pattern any time soon. But I'm more likely to use Clojure for my own projects. |
| 14:10 | Lau_of_DK | Maybe we could have Rich do a 20 hours SICP-Clojure series... |
| 14:11 | Puzzler | Chouser: And Clojure will my give students a real-world power tool they can use after learning Scheme. It's a pretty easy transition, I think. |
| 14:11 | Chouser | enough people are learning Clojure as it is. I hope Rich continues to concentrate on developing the language. the rest of us can teach. |
| 14:11 | Lau_of_DK | Chouser: Good point |
| 14:13 | Chouser | Puzzler: I wonder if clojure's complexity surrounding mutable state which is a clear winner for real world programs would be innappropriate for learning. |
| 14:14 | Lau_of_DK | It would be fantastic if the kids could actually learn something useable |
| 14:14 | Lau_of_DK | I remember 10 years ago in "high school" here we were doing Assembler |
| 14:14 | Puzzler | Chouser: Actually, it's amazing how in a functional language, you can teach interesting projects for years without ever even needing any mutable state. |
| 14:15 | Puzzler | Chouser: But yes, if you want to cover mutable state, it's a bit more complicated in Clojure (although not tremendously so). The main complexity comes from the fact that there are several choices, each with various advantages and disadvantages. |
| 14:15 | Puzzler | For me, the big educational win with Clojure would be the persistent vector data structure. |
| 14:16 | Puzzler | My students have a lot of trouble transitioning to vectors after using lists for months. The programming style is completely different. |
| 14:16 | Puzzler | To be able to manipulate vectors using the same first/rest interface is HUGE. |
| 14:16 | Chouser | Puzzler: interesting. I'm only asked occasionaly, but for a while I've been recommending Python as a good starting language, and I'm still contemplating if Clojure would be an appropriate alternative. |
| 14:17 | Lau_of_DK | Seriously.... Python? |
| 14:17 | Nafai | Lau_of_DK: It's not perfect, but why not? |
| 14:17 | Lau_of_DK | Nafai: I dare not say |
| 14:18 | Lau_of_DK | It attracts... special people :) |
| 14:18 | Nafai | Must be special :) |
| 14:18 | Nafai | Though I admit I'm not enamored with it as I used to be |
| 14:18 | Puzzler | Yes, even though I teach kids PLT Scheme, if someone is asking me for a book that their kids can use to self-teach, I also point them towards Python. It's pretty accessible. |
| 14:18 | Nafai | Accessibility is a big thing, yes |
| 14:19 | Puzzler | Chouser: In theory, Clojure would be a fine for language for teaching, but there are so many little details about the environment (not the language proper) that make a difference to beginners. For example, error messages... |
| 14:20 | Chouser | heh |
| 14:20 | Nafai | Yeah. |
| 14:20 | Nafai | Sometimes the error messages are cryptic for those of us that are experienced Java / Lisp programmers :) |
| 14:21 | mchurch | I think Python's a good CS 1 language. |
| 14:22 | mchurch | Although, it's dynamically typed. ML would be cool, except build systems of compiled languages make large projects ugly, and not newb-friendly. |
| 14:22 | Puzzler | I mostly agree with Norvig's essay about "What Programming Language should I learn?" Basically, kids should learn whatever language they can find someone to mentor them in, because they'll learn far better from a teacher/mentor/friend than a book. |
| 14:22 | Chouser | my greatest fear in recommending Python is that it indoctrinates another generation into syntax and mutable locals, which will later have to be weaned off of both. |
| 14:23 | mchurch | Chouser: Why will they have to "be weaned off of" syntax? |
| 14:23 | mchurch | Chouser: Concurrency is definitely a major player in the future, but I don't see it as self-evident that all languages of the future will look like Lisps. |
| 14:24 | Lau_of_DK | Chouser: In which way are you enriched as a developer from learning Python ? To me is a wasteland of gigantic libs that do all the work for you and an ugly imperative syntax, which stimulates your brain as much as watching TV |
| 14:25 | Lau_of_DK | (and Im talking about Soaps and that type of TV) |
| 14:25 | Nafai | Lau_of_DK: You don't like libraries? |
| 14:25 | Lau_of_DK | I dont like Python is more like it |
| 14:26 | Puzzler | Lau_of_DK: I find it interesting that you're so anti-python. To me, Clojure and Python have much in common. I've been billing Clojure to friends as the "new, functional Python". |
| 14:26 | Lau_of_DK | haha |
| 14:26 | Nafai | Lau_of_DK: What are your prefered languages? |
| 14:26 | Lau_of_DK | Clojure |
| 14:26 | Nafai | Anything else? |
| 14:26 | Nafai | Do you program for a living? |
| 14:27 | Lau_of_DK | Not really, you could say that I manage developers |
| 14:27 | Lau_of_DK | I cant look at Python, seperate from the crowd it draws |
| 14:27 | Puzzler | To me, Python was the first language I tried with a rich set of data structures built right into the reader, and it was a real breath of fresh air. Clojure feels the same way, but it's chosen persistent data structures. |
| 14:28 | Nafai | Describe this crowd to me? |
| 14:28 | Chouser | python seems very nice to me for learning programing, compared to: C, C++, Pascal, Perl, Ruby, JavaScript, Visual Basic, Java, C# |
| 14:28 | Lau_of_DK | I have never heard so much meaningless religious garbage than I have from that crowd. Totally incapable of juding any scenario in an intelligent manner |
| 14:28 | Chouser | Lau_of_DK: what would you recommend? |
| 14:28 | Nafai | I'm curious as to the perception as I used to be a big fan of Python |
| 14:28 | Chouser | mchurch: macros are huge to me. |
| 14:28 | Lau_of_DK | Chouser: For a beginners language? |
| 14:29 | Chouser | Lau_of_DK: yes |
| 14:29 | mchurch | Chouser: Interesting. I can't say I disagree with you. |
| 14:29 | Lau_of_DK | I'd say it depends on the person at little bit, but quickly steer into SBCL for 1 month, then head to Clojure |
| 14:31 | mchurch | Chouser: Because I can see why you'd want to introduce that concept early on. Even for a dev in a language that rarely uses macros, the concept of code reuse and program generation underlies much of why FP is the pwn sauce... and macros are the highest and most general form of that. |
| 14:31 | mchurch | Puzzler: I think this was one of the things that impressed me about Python when I moved to it from Java. |
| 14:31 | Lau_of_DK | There comes a point where is valuable to know the underlying dynamics of a system, but for something which stimulates you as a person to wholesome thinking in regards to code, I think you need to look at a lisp of some type, first learnings the perils of mutability, then moving in the more sane direction |
| 14:32 | mchurch | My language trajectory was Basic -> C++ -> Java -> Python -> Ocaml -> Lisp(s)... a definite improvement at all links but the last, and a rough tie from Ocaml -> Lisp (although I'm better for having been exposed to both) |
| 14:32 | Lau_of_DK | My point in regards to Python is just, that it doesnt stimulate, its feels like Punch-card programming in some ways |
| 14:33 | Nafai | Lau_of_DK: What turns you off about the Python community? |
| 14:33 | Lau_of_DK | Any moron can do it, and thats fine, especially for morons, but if you want to develop out of that stage, you should start by hauling yourself in a more challenge direction |
| 14:33 | Nafai | Lau_of_DK: And, what other than Clojure is stimulating to you? |
| 14:34 | Lau_of_DK | Nafai: #1: I'll dig up a quote for you, someone posted it in here a while ago, and it was fantastic, Chouser to remember that quote? |
| 14:35 | Lau_of_DK | Nafai: #2: There's too much to mention to be quite frank, I make it a point to drive myself effectively almost every day |
| 14:35 | mchurch | Lau_of_DK: I think Python is a fine language, although I do like FP languages better. |
| 14:35 | Nafai | Lau_of_DK: You would hate to deal with Java programmers then :) |
| 14:35 | mchurch | Lau_of_DK: The difference between great languages and good ones is smaller than that between good ones and mediocre, and that's smaller than that between mediocre and bad. If Lisp is 10, Python's 8.5, Java's 6.5, and something like SAS would be a 0. |
| 14:37 | mchurch | Lau_of_DK: I love using FP languages, but I don't actually believe they make me 10x more productive. It's closer to 1.5-2x, but there are other huge benefits in using FP. |
| 14:38 | Lau_of_DK | I wasnt just talking about production-rate |
| 14:38 | Lau_of_DK | But I hear what you're saying and to some degree, I agree |
| 14:38 | Nafai | Lately, unfortunately, I'm most interested in languages I have not a high likelihood of using for work |
| 14:39 | Nafai | I just did Java for 3 years, and I'm lucky enough to be in a position where I use Python, which is a step up |
| 14:39 | Lau_of_DK | Sounds awful :( |
| 14:39 | Nafai | But I'd prefer to use Haskell or Clojure |
| 14:39 | Lau_of_DK | Can I help in any way? |
| 14:40 | Lau_of_DK | The point of this whole rant. The tools you use, the company you keep, should help you evolve as a programmer. There are enough slaves who just type in statement after statement. Clojure does this very well. Python... Does not opposite |
| 14:40 | Puzzler | Anyone know how the Netbeans Enclojure IDE is coming along? |
| 14:40 | Nafai | Lau_of_DK: I find that perspective interesting. |
| 14:41 | Nafai | I find that Python helps me more than when I was stuck in the Java world |
| 14:41 | Nafai | I'd love to continue the discussion, but I have an appointment, but I'll be back in a while |
| 14:42 | Lau_of_DK | The reason I started with Lisp way back when, was because I was heavily involved in C#. Then someone showed me lots of cool tricks in Python (on a forum), like Generator expressions and lambdas, and I was blown away, I couldnt approach that in C#. Then the next guy popped up, he implemented the same stuff in 5 different ways in Lisp, and then I was sold :) |
| 14:42 | Lau_of_DK | Alright Nafai :) |
| 14:43 | Puzzler | Getting back to the original thread about documentation, I have to say that I like languages that have some support for "literate programming". For example, Haskell has a mode where most lines are treated by default as comments, and only explicitly marked lines are treated as code. |
| 14:43 | Lau_of_DK | Puzzler: Good for writing books :) |
| 14:44 | Puzzler | Not every program needs to be "literate", but it's nice for a language to support that approach. |
| 14:44 | Puzzler | Lau_of_DK: absolutely |
| 14:47 | Puzzler | Python has "Leo" for literate programming. |
| 14:47 | Puzzler | I've used funnelweb a couple of times to write literate programs in languages without explicit support for intertwining big-picture design with code. |
| 14:49 | Lau_of_DK | Chouser: Do you remember that quote that came up a while ago, which we both thought was fantastic ? |
| 14:49 | Puzzler | I think there's still room for a lot of innovation on the documentation/literate programming front. But it's an issue that isn't on most people's radar. |
| 14:49 | Chouser | Lau_of_DK: about python? |
| 14:50 | Lau_of_DK | Yes, by extension. It was about people doing the mistake of viewing something which was higher than themselves from their current standpoint instead of elevating themselves |
| 14:50 | Puzzler | You talking about the Paul Graham "blub paradox" essay? |
| 14:50 | kotarak | That's BLOB. A programmer who knows BLOB (some programming language) looks down on other languages, which are less powerful. |
| 14:50 | grosours | Hi |
| 14:51 | kotarak | And he sees that BLOB is more powerful. |
| 14:51 | kotarak | But when he looks up to more powerful languages, he can only think in BLOB and hence doesn't understand the other languages. |
| 14:51 | Puzzler | Speaking of teaching programming, it's time for me to go teach. It's been interesting. See you guys around! |
| 14:52 | Chouser | Lau_of_DK: http://technomancy.us/27 |
| 14:52 | kotarak | So he thinks, what kind of crazy guys sees FOO programmers are.. |
| 14:55 | Lau_of_DK | Thanks Chouser, that was exactly it, and that is exactly the problem of some many Python-scripters. I have heard exponents of their faith call everyone around the Blub programmers, not realizing that they themselves had become the very same thing |
| 14:57 | Chouser | Lau_of_DK: I think you may be conflating the subset of the Python community you found with the Python language. |
| 14:57 | Lau_of_DK | conflating... okay back to the dictionary |
| 14:57 | Lau_of_DK | Ok, its applicable |
| 14:58 | Lau_of_DK | But CHouser, I admittet that earlier "I cannot comment on the language Python seperated from its community" |
| 14:58 | Chouser | ok |
| 14:58 | Chousuke | Lau_of_DK: you should fix that to say "a subset of its community" |
| 14:58 | Lau_of_DK | You know, if you look at cocaine, you can make a good argument for it, up until you perceive what it does to people in the long run. Python is similar, although I'd have to use crack to be accurate in my analogy :) |
| 14:59 | Chousuke | frankly, your complaint applies to many other languages too |
| 14:59 | Chouser | It seems inevitable to me that Clojure's userbase will grow, and that as it does the community will become more fractured. |
| 14:59 | Chousuke | not least to lisp & co. |
| 15:00 | Chousuke | there will be zealous nutjob followers in every language community after it has grown large enough. |
| 15:00 | Chousuke | and python certainly has a large community around it. |
| 15:01 | Chouser | even if the tone of the google group and irc are maintainted as open, respectful places (which may become very hard) there will be other corners of the community with underinformed fanboys that may unfortunately turn people off to the language. |
| 15:01 | Lau_of_DK | Im not being clear I think. The question is this: Is your language stimulating you to evolve yorself as a programmer? Thats the question of the night, as far as Im concerned |
| 15:01 | Chousuke | python is big enough that the python nutjobs may even outnumber the entire clojure community right now :P |
| 15:01 | Chouser | hopefully newcomers that run into those corners will be able to overlook that part of the community and find the gem of the language beyond. |
| 15:02 | Lau_of_DK | Chousuke: Thats certainly true |
| 15:02 | Lau_of_DK | Im done pouring out my heart now, thanks for turning in. Tomorrow night: C++ |
| 15:04 | kotarak | Chousuke: I'm always in favour of quality over quantity. ;) |
| 15:04 | Lau_of_DK | kotarak: Unless we're talking coins |
| 15:05 | kotarak | Lau_of_DK: for some suitable definitions of "quality" and "quantity" ;) |
| 15:05 | Lau_of_DK | k, Im out |
| 15:05 | Chousuke | kotarak: even rational adopters go through a phase where they think their new toy is the best of them all. |
| 15:23 | mchurch | Question: What is the build system (e.g. ASDF for Common Lisp) for Clojure? |
| 15:26 | Chousuke | I don't think there are any "native" build systems |
| 15:26 | Chousuke | besides the ones inherited from java |
| 15:26 | Chouser | maybe lancet? |
| 15:27 | mchurch | How is Lancet? |
| 15:27 | Chouser | dunno, only read about it. |
| 15:27 | mchurch | I'm trying to "go multi-file" (actually, I'm up to 8 source files) with minimal pain |
| 15:28 | Chousuke | do you even need a build system? |
| 15:28 | Chousuke | other than something to run "(compile 'your.lib)" and maybe package it in a jar |
| 15:28 | mchurch | Chousuke: Not necessary, but ASDF is nicer than what I've built for clojure |
| 15:29 | mchurch | Where do I define the 'your.lib? |
| 15:29 | Chousuke | it's the namespace declaration in your library. |
| 15:29 | Chousuke | and it must be in classpath. |
| 15:29 | Chouser | mchurch: have you looked at the structure of clojure-contrib? it's a pretty good example of how to set up and use libs |
| 15:30 | Chousuke | mchurch: it's only needed for precompilation anyway. plain .clj files work as they are, too. |
| 15:30 | mchurch | Chouser: I haven't. I guess it'd be a good idea to look at that. |
| 15:30 | Chouser | it's even set up to use ant to build a .jar. Or so I hear. |
| 15:30 | Chousuke | yeah. |
| 15:50 | mchurch | The Java doc says that Thread.destroy and Thread.stop are deprecated. What is the proper way to kill a thread? |
| 15:52 | Chousuke | mchurch: as far as I know, there is no proper way to kill a thread. |
| 15:52 | Chousuke | mchurch: even clojurebot uses the improper way |
| 15:52 | durka | as far as i know the reason those are deprecated is the thread is killed immediately, which can cause memory leaks/undisposed resources/Bad Things (tm) |
| 15:53 | durka | if the thread is doing something repeatedly you could have it listen for an event |
| 15:53 | Chousuke | durka: yeah... that doesn't work for clojurebot though :/ |
| 15:53 | Chousuke | unless I write a clojure interpreter in clojure first. |
| 15:53 | rpg | back |
| 15:54 | Chouser | Thread.interrupt()? or is that something else? |
| 15:54 | walters | i think Thread.stop etc. are safe if you know the thread isn't operating on mutable state that you care about |
| 15:54 | Chousuke | Chouser: that just interrupts it if it's in an interruptible state. |
| 15:54 | Chousuke | Chouser: in a busy loop, the thread will just keep rolling. |
| 15:55 | walters | for something like clojurebot's eval method, assuming it's executing in a sandboxed environment, Thread.stop should be fine |
| 15:55 | stuarthalloway | walters: although it still could leak native resources, no? |
| 15:55 | Chousuke | yeah. |
| 15:55 | walters | stuarthalloway: all the finalize methods should still be called |
| 15:56 | walters | really the methods should be @Unsafe, not @Deprecated |
| 15:56 | Chousuke | well you can't open files... though you could allocate a huge array and go into a busy loop until you get killed. |
| 15:56 | durka | http://java.sun.com/j2se/1.4.2/docs/guide/misc/threadPrimitiveDeprecation.html |
| 15:57 | Chouser | "t should be noted that in all situations where a waiting thread doesn't respond to Thread.interrupt, it wouldn't respond to Thread.stop either." |
| 15:57 | Chousuke | Chouser: "responding" to thread.interrupt means that the interrupt flag will get set. |
| 15:57 | Chousuke | so interrupted() will return true. |
| 15:58 | Chousuke | unless the thread is blocking on something. |
| 15:58 | Chousuke | in which case an InterruptedException happens. |
| 15:58 | Chousuke | IIRC. |
| 15:58 | mchurch | Does Thread.interrupt free up the resources that killing the thread would free? |
| 15:59 | stuarthalloway | walters: I know of a guy who pronounces the word "depreciated" -- maybe he's right :-) |
| 15:59 | mchurch | I'm guessing it doesn't. Am I right? |
| 15:59 | walters | stuarthalloway: heh |
| 15:59 | mchurch | (This particular thread is not in a busy loop. It blocks.) |
| 15:59 | stuarthalloway | mchurch: what happens after interrupt is much more in your control |
| 16:00 | walters | mchurch: any finalize {} blocks are still called, and finalizers of now-unreferenced objects are called |
| 16:00 | stuarthalloway | walters: I need to think more about this "stop is safe in a sandbox |
| 16:01 | stuarthalloway | ... idea. That would be hard to reason about in mutable Java, but maybe Clojure's immutable nature makes a big difference here |
| 16:01 | stuarthalloway | sounds worthy of a blog post or article |
| 16:01 | Chousuke | well, clojurebot prevents infinite loops with thread.stop(), because it's the only way I can think of :P |
| 16:01 | mchurch | stuarthalloway: Maybe I should avoid Java threads altogether and work with Clojure agents? |
| 16:01 | walters | it comes down to reasoning about the state accessible to the sandbox |
| 16:02 | Chousuke | mchurch: can you interrupt agent actions? :/ |
| 16:02 | Chouser | mchurch: clojure agents use java threads. |
| 16:02 | mchurch | Chousuke: I don't know much about agents. |
| 16:02 | walters | it's not exactly a mutable Java/immutable Clojure distinction; e.g. if you didn't allow any library calls at all, arbitrary Java is just as fine as arbitrary Clojure |
| 16:02 | mchurch | Chousuke: About 30 minutes of reading, so I have a very very basic concept of how agents work. |
| 16:03 | stuarthalloway | mchurch: not if you need real interruption |
| 16:03 | stuarthalloway | walters: how much Java code have you seen making no library calls? :-) |
| 16:03 | stuarthalloway | on another subject: any votes on whether trampoline should be covered in the book? |
| 16:04 | stuarthalloway | it seems important until I try to come up with a good example |
| 16:05 | mchurch | stuarthalloway: Good call. |
| 16:05 | Chouser | I think stack overflow is managed by lazy-cons or recur in about 93% of cases, and by trampoline in another 5% beyond that. |
| 16:05 | Chousuke | I think it's important enough to at least deserve a mention. For people who need it, just so they don't accidentally use regular recursion and wonder why their stack blows up |
| 16:06 | mchurch | So, after an interrupt, any finalize blocks are called... and then the thread's resources are freed after this is finished? |
| 16:06 | stuarthalloway | Chouser: guess I need to learn the rule for dividing the 93/7 then... |
| 16:07 | stuarthalloway | I have yet to see a non-toy example |
| 16:08 | Chousuke | mchurch: interrupt doesn't really do much |
| 16:08 | Chousuke | mchurch: all it does is set a flag, and if the thread is blocking, causes an exception to happen in the thread. |
| 16:08 | Chousuke | ("unblocking" it in the process) |
| 16:09 | Chousuke | if you need to handle that, just catch the exception. |
| 16:11 | triddel1 | ok, I have function that I can call stand-alone but within another function it never seems to fire... although all the others around it do... this is driving me crazy... has anyone else seen this behavior? |
| 16:11 | stuarthalloway | triddel1: yes, when failing to realize a lazy collection |
| 16:12 | triddel1 | it's within a let tag (implicit do)... and other very similar functions fire |
| 16:13 | Chousuke | can you post an example situation where it does not work? |
| 16:13 | hiredman | triddel1: doing any agent sends? |
| 16:14 | triddel1 | I'll need to simplify it a bit for an example... no agent sends |
| 16:15 | RSchulz | pjb3: Sorry I missed you before. I have a buddy in Germantown, MD who's thinking of going to the next DC Clojure get-together. |
| 16:16 | pjb3 | Well, it's tomorrow |
| 16:16 | pjb3 | Come on down! |
| 16:16 | RSchulz | Yeah. He found the notice on clujurestudydc.wordpress.com |
| 16:17 | RSchulz | I'm on the opposite coast (where it seems there's little Clojure presence), so dropping by is a bit of a challenge. |
| 16:17 | RSchulz | I'm trying to convince him to go. He feels he needs to study, but I told him all his years of Lisp will make him more than qualified to participate. |
| 16:18 | pjb3 | Yeah, we're all just gonna together and work on various small problems, you don't need to be an expert to go |
| 16:19 | RSchulz | I know he got Stuart's book and has read some of it. He's been setting up his formerly Windows laptop with openSUSE the past couple of days. He's a hard-core Emacser, too. |
| 16:24 | Chouser | stuarthalloway: do you know how many copies of the book have been sold already? Are you at liberty to share? |
| 16:24 | stuarthalloway | stuarthalloway: yes, and no :-) |
| 16:24 | stuarthalloway | why do you ask |
| 16:24 | Chouser | just curious. Thanks for answering both questions. :-) |
| 16:24 | Lau_of_DK | stuarthalloway: If you cant give out the actualy number, could you subtract 10 from that number, and tell us the result? |
| 16:25 | stuarthalloway | if you were thinking "Wow, a bunch more people would buy the book, if I, Chouser, wrote a blog post about how cool the multimethods chapter is" I bet you are right |
| 16:25 | Chouser | haha! |
| 16:25 | stuarthalloway | Lao_of_DK: I could :-) |
| 16:25 | stuarthalloway | Chouser: the book seems to be doing well |
| 16:26 | stuarthalloway | it has sold more copies than my previous books did at a similar juncture |
| 16:26 | RSchulz | And for the impatient among us... The next beta will be ready.... When? |
| 16:26 | Chouser | I was actually thinking "seems like lots of people have mentioned they've read it, I wonder if that's true". I had no particular number in mind for "lots" |
| 16:26 | hiredman | you should put that on the dust jacket |
| 16:26 | Lau_of_DK | Chouser: There's also.. piracy :( |
| 16:27 | Lau_of_DK | Which really should be called theft, I dont know why it got another label |
| 16:27 | stuarthalloway | RSchulz: writing the functional chapter today |
| 16:27 | stuarthalloway | and the libraries chapter sat and sun |
| 16:27 | RSchulz | Excellent. That's the one I need the most, frankly. |
| 16:27 | stuarthalloway | early next week the book should be prose-complete |
| 16:27 | Chouser | I continue to doubt very much that piracy costs anybody much actual money, at least when compared to anti-piracy measures. |
| 16:28 | RSchulz | The think about this FP stuff, for me anyway, is that you have to _think_ so much about the problem. You can't (well, _I_ can't) just hack stuff out from a vague notion of what I intend to do. |
| 16:28 | Lau_of_DK | Its still stealing |
| 16:28 | RSchulz | Not that that's a bad thing, of course. |
| 16:28 | RSchulz | But in Java, I can sort code on autopilot. |
| 16:28 | RSchulz | Not that that's necessarily a good thing, of course. |
| 16:28 | Chouser | And I commend enterprises like pragprog both for providing electronic copies and for not hobbling them. |
| 16:28 | stuarthalloway | and then come the fixes: changes to how Java classes are created, adding atoms to the concurrency chapter, getting the PRNG to work for the Monte Carlo example, etc. |
| 16:28 | RSchulz | I haven't given my beta PDFs to anyone, but I did persuade at least one person I know of for sure to buy a copy. |
| 16:28 | Lau_of_DK | stuarthalloway: If you want to make it a bestseller, consider doing a whole chapter on ClojureQL called "CQL: The sequel, to SQL" .. :) |
| 16:29 | RSchulz | Hey! Write your own book, Lau! |
| 16:29 | stuarthalloway | Lau_of_DK: we are already talking about doing a whole 'nuther book |
| 16:29 | Lau_of_DK | Ok, I just thought it was a catchy title :) |
| 16:29 | stuarthalloway | how about CQL, on the cloud, on android :-) |
| 16:29 | RSchulz | That other "stewie" hates it when people say "a whole 'nuther..." And _he's_ a bad little boy! |
| 16:29 | Lau_of_DK | Cause you can pronounce it "Sequel the sequel to sequel" |
| 16:29 | Lau_of_DK | hehe |
| 16:30 | Lau_of_DK | "Practical Common Clojure" also works, very original |
| 16:30 | RSchulz | That won't be feasible until after Clojure fragments and has to be reunified. |
| 16:30 | RSchulz | Which will take at least three more years. |
| 16:31 | Lau_of_DK | RSchulz: Are you under the influence of any medication, euphorics or alcohol this evening ? |
| 16:31 | RSchulz | Not yet. |
| 16:31 | Lau_of_DK | k |
| 16:31 | Lau_of_DK | let me know... |
| 16:31 | stuarthalloway | me neither :-( |
| 16:31 | RSchulz | It's only 1:30 PM here. Not "evening..." |
| 16:31 | Lau_of_DK | "only" 1:30 |
| 16:31 | Lau_of_DK | ... |
| 16:31 | RSchulz | I just have a funky brain. |
| 16:32 | RSchulz | Damanged by decades of C, C++ and Java programming. |
| 16:32 | hiredman | Lau_of_DK: do you think clojureql's readme.txt could be fleshed out with some syntax examples? |
| 16:33 | Lau_of_DK | We've just added test.clj which kota is pumping with examples as we speak |
| 16:33 | Chouser | stuarthalloway: I'd bet you've sold more copies of your book than my blog as readers. |
| 16:34 | hiredman | when I click the watch button on github I get redirected to an empty page |
| 16:34 | Lau_of_DK | Chouser: Perhaps, but I've read most of your posts 3 - 4 times... |
| 16:34 | RSchulz | So what is ClojureQL's claim to fame? Why would I not just access my JDBC driver directly? Is there and about / FAQ document somewhere? |
| 16:34 | Lau_of_DK | RSchulz: because you dont want to write SQL, you want to keep it all in lisp |
| 16:34 | Chouser | Lau_of_DK: if I recommend the multimethods chapter there, will you buy the book? |
| 16:34 | stuarthalloway | Chouser: maybe, but the intersection of the sets is what matters :-) |
| 16:34 | Lau_of_DK | The JDBC does this "executeStatement "SELECT * FROM devs WHERE id > 5 or id < 10" |
| 16:35 | Lau_of_DK | we do (query * devs (or (> id 5) (< id 10))) where you can pull in variables from your enviroment |
| 16:35 | Chouser | lowercase alone is a win. :-) |
| 16:35 | Lau_of_DK | We work in ASTs where you can run set operations like Union, intersect and so on, greatly extending your way ot querying |
| 16:36 | Lau_of_DK | haha |
| 16:36 | RSchulz | OK. That's certainly cleaner. It's not that I'm particularly fond of SQL. Do you have a provision for handling different SQL dialects? Or is it something you plan? |
| 16:36 | RSchulz | Ah. That's nice. |
| 16:36 | Lau_of_DK | RSchulz: We feed JDBC with whatever driver you need, so it should handle that part of it |
| 16:37 | Lau_of_DK | If you mean in regards to syntax revisions, then we just shoot for the latest |
| 16:37 | Lau_of_DK | But youre welcome to contribute :) |
| 16:37 | RSchulz | And it converts things to Clojure native collections / sequences? |
| 16:37 | Lau_of_DK | Yea |
| 16:37 | Lau_of_DK | You work in native data-types when you work with your results |
| 16:37 | RSchulz | No, I meant MySQL vs. PostgresQL vs. Oracle, etc. |
| 16:37 | lisppaste8 | triddell pasted "untitled" at http://paste.lisp.org/display/72972 |
| 16:37 | Lau_of_DK | RSchulz: Thats in the hands of the driver, which you select yourself |
| 16:38 | RSchulz | I'm thinking of how Hibernate, say, (I know ClojureQL is not an ORM) insulates you from SQL dialect differences. |
| 16:39 | Lau_of_DK | To some extent I think JDBC does the same |
| 16:39 | triddel1 | ok, something on the above paste is making this function lazy...my other functions start with a "do" and then call "spit" before the for comprehension and they aren't lazy |
| 16:40 | RSchulz | Well, I've only really dabbled in relational databases. I started getting a little adept at MySQL at my last job, but that's been a while, and most of it has faded, now. |
| 16:40 | Chouser | triddel1: 'for' is lazy |
| 16:40 | hiredman | (doc do) |
| 16:40 | clojurebot | It's greek to me. |
| 16:41 | Chouser | triddel1: and I'd recommend avoiding the word 'map' for a local (or an arg in this case) since it's builtin |
| 16:41 | hiredman | erm |
| 16:41 | Lau_of_DK | RSchulz: If you have specific use-cases you want us to look at, youre are _most_ welcome to send me mails, and I'll strive to support your needs for our RC |
| 16:41 | Chouser | triddel1: try replacing "for" with "doseq" |
| 16:42 | triddel1 | Chouser: must have been something else forcing the for in my other functions |
| 16:42 | RSchulz | Oh, not really. I'm just indulging my idle curiosity. Although there are cases where a permanent storage tie-in with some other stuff I'm working on migh be interesting. Right now, I have a Grails app that handles that stuff. |
| 16:43 | Lau_of_DK | k |
| 16:44 | triddel1 | Chouser et al: thanks for the help... it's amazing how deep you can get into something and still be missing some of the basics |
| 16:45 | triddel1 | many of the basics I should say :-) |
| 16:46 | Chouser | np. I think that's especially the case with the kind of ad-hoc learning that comes with something as young as Clojure. |
| 16:46 | Chouser | I'm hopeful the book will help in this regard. |
| 16:48 | kotarak | for is misnamed. |
| 16:49 | Chouser | oh? |
| 16:49 | kotarak | most people think it's loop, which it is not. |
| 16:49 | hiredman | I think it's like rhickey said, there are only so many good names |
| 16:49 | stuarthalloway | 'comprehension' is a pretty long name, though |
| 16:50 | kotarak | I know. I don't claim to have a better one. |
| 16:50 | kotarak | But it is a common mistake. |
| 16:50 | Lau_of_DK | Could just call it 'walk', that would make all the sense in the world :) |
| 16:51 | Lau_of_DK | (walk [the dog] (println the)) |
| 16:51 | hiredman | clojurebot: for is see map |
| 16:51 | clojurebot | c'est bon! |
| 16:51 | Chouser | if 'doseq' is the imperative version, should the lazy version be called 'seq'? |
| 16:51 | Chousuke | that's taken though :/ |
| 16:53 | kotarak | I only know the mathematical notation for a list comprehension... I don't know how to name it better. for is still unfortunate. |
| 16:55 | shoover | stuarthalloway: re trampoline, how about a finite state machine on a long running process that jumps back and forth between different states? |
| 16:56 | stuarthalloway | shoover: sounds good, might require a fair amount of setup? In code, no problem. In prose, space limited :-) |
| 16:59 | shoover | agreed. the right example might say it better than any prose could. I'll think about it |
| 17:02 | rpg | Can anyone help me getting clojure to work with slime? I've almost got it, but clojure isn't finding the swank stuff... |
| 17:02 | Lau_of_DK | rpg, checkout bill clements blog, he has pretty clear instructions |
| 17:03 | rpg | Lau_of_DK: Actually, I'm working from Bill's .emacs snippets now. |
| 17:03 | abrooks | foreach is what some other languages (C#,D,PHP..) use for list comprehension. In those languages it's still looping, just comprehension specific looping. |
| 17:03 | Lau_of_DK | oh :) |
| 17:03 | Lau_of_DK | rpg: Try and post your question here then :) |
| 17:03 | rpg | each rover is at |
| 17:03 | rpg | maximum 1 location in the initial state, |
| 17:03 | rpg | gah! |
| 17:03 | rpg | cut and paste problem... |
| 17:04 | rpg | java.io.FileNotFoundException: Could not locate Clojure resource on classpath: swank/swank.clj |
| 17:04 | rpg | from within clojure can I look at the classpath to see what's wrong? |
| 17:05 | Lau_of_DK | (System/getProperty "java.class.path") from the REPL, will output the classpath |
| 17:08 | stuarthalloway | rpg, Lau: check out classloader-seq at http://github.com/stuarthalloway/programming-clojure/tree/master/examples/utils.clj |
| 17:11 | Lau_of_DK | Got it, thanks, nice file in general, utils.clj :) |
| 17:12 | rpg | Do .clj files go in the classpath, or do I put in the directory in which they reside? |
| 17:13 | stuarthalloway | rpg: they do go in the classpath |
| 17:13 | stuarthalloway | and who is "they"? :-) |
| 17:14 | rpg | stuarthalloway: I don't think English has an inanimate third person plural.... I'm stuck with "they" for clj files... |
| 17:15 | shoover | rpg: directories go on the classpath, not clj files |
| 17:15 | stuarthalloway | ah, sorry, misunderstood question, English must not be my first language. Listen to shoover :-) |
| 17:16 | shoover | also, if swank-clojure/swank/swank.clj contains a definition for namespace swank.swank, you'll need to put swank-clojure on the classpath, not swank-clojure/swank. I just ran into that myself |
| 17:17 | rpg | shoover: The swank-clojure distrib I have has swank-clojure/swank.clj and swank-clojure/swank/<a bunch of other .clj files>. So it doesn't seem to have the structure that you say it must have. |
| 17:18 | rpg | maybe it's time for a git pull... |
| 17:19 | rpg | shoover: that's it --- the swank-clojure distrib has moved the file now. |
| 17:20 | rpg | No. That's not it. STILL doesn't work. |
| 17:20 | rpg | Now it wants swank/core/core.clj, which doesn't exit. |
| 17:21 | rpg | core.clj is ADJACENT to core/, not in it. |
| 17:22 | jwinter | rpg: it's not in both places? |
| 17:22 | rpg | jwinter: No. |
| 17:23 | rpg | jwinter: symlinking core.clj into core/ worked, and now it's crashing because util.clj is adjacent to util/ instead of in it. |
| 17:26 | rpg | stuarthalloway: I'm trying to work with your book and a pinned version of clojure, but I'm wondring if that's a bad idea --- is the 20080916 clojure version compatible with swank/slime? |
| 17:26 | rpg | Now I'm getting this error: java.lang.Exception: Unsupported binding form: clojure.lang.PersistentList@f50439d |
| 17:26 | stuarthalloway | rpg: you will need to get a more recent Clojure than that, regardless of the editor you choose |
| 17:27 | stuarthalloway | the sample code on github (http://github.com/stuarthalloway/programming-clojure/tree/master) includes dependent jar files built from svn |
| 17:28 | rpg | stuarthalloway: the download link on Sourceforge is still to the one I have. |
| 17:28 | stuarthalloway | clojure has moved to Google Code (since the last beta of the book!) |
| 17:28 | rpg | Grrrrrr........................... So the sourceforge page is a big decoy. |
| 17:29 | stuarthalloway | yeah, we should ask Rich to tear it down |
| 17:29 | rpg | Why don't people take these things DOWN when they are bitrotted? |
| 17:29 | stuarthalloway | http://code.google.com/p/clojure/downloads/list |
| 17:29 | rpg | stuarthalloway: thanks! |
| 17:29 | stuarthalloway | sorry the book isn't up to date -- publishing every few weeks isn't fast enough |
| 17:29 | stuarthalloway | that should be the last churn on that front, anyway |
| 17:30 | rpg | stuarthalloway: so are you saying that the github stuff has a clojure build in it? Or that I should use the google code one, and then pull the sample code from github? |
| 17:30 | stuarthalloway | the former certainly works |
| 17:30 | stuarthalloway | and there are unit tests to prove it |
| 17:31 | Chouser | rhickey: for what it's worth, I got my code working with the new watchers (see with-watchers.clj): http://gist.github.com/32494 |
| 17:31 | stuarthalloway | you would need to set CLOJURE_HOME, CLOJURE_CONTRIB_HOME, and ANT_HOME to run the unit tests |
| 17:31 | stuarthalloway | but I can fix that, gimme a sec |
| 17:36 | stuarthalloway | rpg: I just pushed a commit that includes all dependent libs |
| 17:36 | stuarthalloway | If you are on *nix you should be able to execute runtests.sh to verify that the samples run for you locally |
| 17:37 | rpg | stuarthalloway: Thanks. But I should be able to run clojure and slime (swank) without your code, right? Figure I should do that first (it still doesn't work), before I go back to your book code. |
| 17:40 | rpg | OK, I'm sorry, but I'm back to not being able to find swank. Let me see if I can lisppaste something... |
| 17:42 | lisppaste8 | rpg pasted "trouble loading swank" at http://paste.lisp.org/display/72978 |
| 17:43 | stuarthalloway | rpg: probably. I am just using inferior-lisp-mode pointing to Clojure |
| 17:44 | rpg | I suppose I could test this outside slime, by just starting clojure at the command line.... |
| 17:44 | stuarthalloway | keeping up with breaking changes to slime/swank was distracting me |
| 17:45 | rpg | stuarthalloway: I take it you don't mean "late breaking" ;-) |
| 17:45 | rpg | Actually, I can't load the swank library from the command line, either. |
| 17:46 | lisppaste8 | rpg annotated #72978 with "what happens from the command-line" at http://paste.lisp.org/display/72978#1 |
| 17:46 | stuarthalloway | skip it and just make clojure your inferior-lisp |
| 17:47 | Chousuke | slime works fine for me :/ |
| 17:47 | shoover | rpg: load swank.swank |
| 17:47 | Chousuke | I haven't updated my version of slime in a while though |
| 17:47 | Chousuke | or the swank, I think |
| 17:47 | rpg | shoover: Thank you! |
| 17:47 | rpg | shoover: that worked. |
| 17:47 | rpg | Now, what I don't know is why swank itself didn't load The Right Thing. |
| 17:49 | shoover | rpg: you're welcome. the latter probably depends on what's going in swank-clojure.el, but that's all I've got for tonight. bye |
| 17:49 | rpg | Looks like swank-clojure-init in swank-clojure does (require 'swank.swank) Not sure why that's not working... |
| 17:51 | rpg | weird. I see swank-clojure-init, but I don't see anyone calling it. Maybe that's done automagically. |
| 17:52 | rpg | Oh, now I see. It's called as part of the slime-lisp-implementations. But it seems to want arguments... |
| 17:53 | stuarthalloway | is count still broken for large lazy sequences? |
| 17:54 | Chousuke | anyone know of a way to "track" emacs startup? I use viper.el and for some reason it open two windows (both with *scratch* in it)at startup :/ |
| 17:59 | rpg | stuarthalloway: when I tried git clone on that url (http://github.com/stuarthalloway/programming-clojure/tree/master), I got an error: warning: remote HEAD refers to nonexistent ref, unable to checkout. |
| 18:00 | stuarthalloway | rpg: git clone git://github.com/stuarthalloway/programming-clojure.git |
| 18:00 | stuarthalloway | that's a github thing: you click a link on the page to get the clone url |
| 18:00 | rpg | stuarthalloway: thanks! I had forgotten that about github. |
| 18:01 | rpg | stuarthalloway: finally getting it! |
| 18:02 | rpg | stuarthalloway: uh-oh. I got a very large number of patches, then error: Unable to find abfb8382b636233e1082ef7beaf9d850c7c6f262 under http://github.com/stuarthalloway/programming-clojure.git |
| 18:02 | rpg | Cannot obtain needed tree abfb8382b636233e1082ef7beaf9d850c7c6f262 |
| 18:02 | rpg | while processing commit bb0ce6438a8e39ad06616a62134db118f77f8855. |
| 18:02 | rpg | fatal: Fetch failed. |
| 18:02 | Chousuke | try cloning with the git url instead |
| 18:02 | Chousuke | not the http one |
| 18:03 | stuarthalloway | rpg: or if you don't care about using git yourself, just click the download link and download the code that way |
| 18:04 | Chousuke | Lau_of_DK: any reason you removed the clojure-auto.el stuff from jochu's clojure mode? |
| 18:04 | Chousuke | ah, you made them unnecessary. |
| 18:04 | rpg | Chousuke: Thanks. That did it. |
| 18:05 | Chousuke | or actually technomancy did, but anyway |
| 18:07 | rpg | Thank you all, very much. |
| 18:07 | grosours | hi every body |
| 18:08 | rpg | bye... |
| 18:09 | chrisn | fighting syntax |
| 18:09 | chrisn | I can't get to javax.swing.event.HyperlinkListener.EventType |
| 18:10 | chrisn | nested class |
| 18:10 | chrisn | I need to get at its public constants |
| 18:10 | chrisn | (import '(javax.swing.event HyperlinkListener)) |
| 18:10 | chrisn | something like that |
| 18:10 | chrisn | works fine |
| 18:10 | chrisn | but |
| 18:10 | chrisn | I can't get to its inner classes |
| 18:10 | chrisn | ? |
| 18:15 | Chousuke | chrisn: you need to use $ for inner classes instead of . |
| 18:15 | chrisn | HyperlinkListener$EventType/ACTIVATED |
| 18:15 | chrisn | doesn't work in the repl |
| 18:17 | chrisn | its because I misread |
| 18:17 | chrisn | nm |
| 18:18 | chrisn | HyperlinkEvent$EventType/ACTIVATED |
| 18:18 | chrisn | works fine |
| 18:21 | chrisn | problems like that are exactly why keywords a 1000 times a better solution |
| 18:22 | chrisn | :activated would have been hard to get wrong |
| 18:24 | Chousuke | okay now I broke my slime too :P |
| 18:24 | Lau_of_DK | Chousuke: Tehcnomancy improved the autoloading, not me |
| 18:24 | Chousuke | yeah, I noticed that. |
| 18:24 | Chousuke | meh, slime doesn't even give errors to me... just fails to start its repl. |
| 18:25 | Chousuke | I just get an inferior-lisp |
| 18:32 | Chousuke | well, at least downgrading is easy :P |
| 18:34 | chrisn | which are you downgrading? clojure, clojure-swank, or slime? |
| 18:35 | Chousuke | clj-swank and slime |
| 18:35 | Chousuke | I branched them before pulling |
| 18:35 | Chousuke | now I also managed to somehow crash emacs. |
| 18:46 | sooth | What is the easiest way to see what classpath is being passed to java by slime? |
| 18:47 | triddel1 | (System/getProperty "java.class.path") |
| 18:47 | hiredman | ,(System/getProperty "java.class.path") |
| 18:47 | clojurebot | java.security.AccessControlException: access denied (java.util.PropertyPermission java.class.path read) (NO_SOURCE_FILE:0) |
| 18:57 | stuarthalloway | check out classloader-seq at http://github.com/stuarthalloway/programming-clojure/tree/master/examples/utils.clj |
| 18:57 | stuarthalloway | how do I add that to the clojurebot> :-) |
| 18:57 | stuarthalloway | of course this requires that you can get classloader-seq itself onto the classpath |
| 18:58 | Chousuke | to the running clojurebot, I don't think you can |
| 18:58 | Chousuke | you'd need access to its main repl :) |
| 18:59 | Chousuke | which reminds me, I should work some more on my version of clojurebot. finally make it truly superior to the version running here :P |
| 19:00 | Chousuke | oh, hmm. or is this one v2 already? :o |
| 19:00 | Puzzler | stuarthalloway: I just read back the transcript from the past few hours, and I see that you were asking for opinions about whether to include trampoline in your book. |
| 19:00 | stuarthalloway | Puzzler: indeed |
| 19:01 | stuarthalloway | I keep picking trampoline examples and then finding better ways to do them in Clojure |
| 19:01 | Chousuke | hiredman: if you're going to move clojurebot to v2, make backups of the data files , please. I can't make any guarantees that the brain won't get clobbered :P |
| 19:01 | Puzzler | stuarthalloway: My vote is no. It's more important to cover the technique of simulating mutual recursion by storing the functions in a hashtable, and using a loop to pick the right function (see Hickey's finite state automaton example). |
| 19:02 | Puzzler | My reasoning is that this technique works for both local and global mutually recursive functions. But trampoline (currently) only works for global functions since there's no letrec, and no way to get local functions to refer to one another. |
| 19:03 | stuarthalloway | where's the example you mention? |
| 19:04 | Puzzler | stuarthalloway: http://list.cs.brown.edu/pipermail/plt-scheme/2007-November/021623.html |
| 19:05 | stuarthalloway | Puzzler: cool, thanks! |
| 19:05 | Puzzler | I posted a similar example to the group the other day, where I used a similar technique to be able to copy a Knuth algorithm as a straight translation (the Knuth pseudocode has a lot of goto jumping around, so being able to copy that into a functional language is a neat trick. |
| 19:06 | stuarthalloway | Puzzler: on the list or in the files section? |
| 19:06 | Puzzler | On the list. |
| 19:08 | Puzzler | stuarthalloway: It was in the "How to encapsulate local state..." thread. I gave the example primarily to make the case for mutable locals, but regardless, it's an interesting example of simulating mutual recursion. |
| 19:09 | stuarthalloway | puzzler: just found it, after sorting out that you are not always "puzzler" :-) |
| 19:09 | Puzzler | stuarthalloway: Ah yes, sorry about that. |
| 19:10 | stuarthalloway | so that example is impossible with trampoline, then? |
| 19:11 | stuarthalloway | I find myself wanting to demo trampoline (briefly), then show this alternative and point out that it is more general |
| 19:11 | Puzzler | I don't think so. To use trampoline, each "step" would need to be a global function. But you need them to be local so they can see the same local mutable variables. |
| 19:11 | stuarthalloway | so I am still looking for that elusive "make me care about trampoline" example |
| 19:12 | stuarthalloway | Puzzler: if you get a chance to look I'd be curious how you would implement the Hofstadter sequences I posted to the list earlier today |
| 19:13 | Puzzler | OK, I don't have time to look at it right now. But I'll look at it later. |
| 19:13 | Puzzler | stuarthalloway: I'm really excited about your book, by the way. |
| 19:15 | stuarthalloway | Puzzler: thanks! |
| 19:18 | Puzzler | stuarthalloway: By the way, the context of that state machine snippet was as a response to this paper: http://www.cs.brown.edu/~sk/Publications/Papers/Published/sk-automata-macros/paper.pdf |
| 19:19 | Puzzler | stuarthalloway: Shriram gave a number of talks about how one clever, elegant way to represent state machines was with each state as a function that knows how to accept an input and in turn call the function of the next state. And then how macros let you turn this into a little DSL that generate these things automatically. |
| 19:20 | Puzzler | stuarthalloway: Someone brought up that this would be hard to do in Clojure due to the lack of tail-call optimization, and so Rich Hickey showed how he would do it. That code snippet is from an older version of Clojure, so some of the function names have probably changed, but the principle remains the same. |
| 19:21 | lispelot | Puzzler: are you at brown now? or did shriram give talks elsewhere? |
| 19:21 | Puzzler | stuarthalloway: I think parsing might be fertile ground to look for a compelling trampoline example. |
| 19:22 | Puzzler | lispelot: No, but I'm an active member of the PLT Scheme community, so I pay attention to the talks and slides from those guys. |
| 19:23 | lispelot | ah, ok. |
| 19:25 | lispelot | Puzzler: he has a number of interesting ideas. i wasn't sure if you were here. |
| 19:26 | stuarthalloway | Puzzler: thanks for the link -- was having trouble tracking back to the paper |
| 19:26 | RSchulz | Puzzler: what do you think about a DrScheme-like program for Clojure. I've used it (DrScheme) only a bit, but I was wowed by it. |
| 19:26 | stuarthalloway | partially because I am mostly eating apple pie at the moment |
| 19:27 | Puzzler | RSchulz: I think DrScheme is a great IDE because it is easy and intuitive to use. Most IDEs are really overwhelming in their complexity. |
| 19:27 | Puzzler | RSchulz: It was written for educational purposes, but I find it useful for getting real work done. |
| 19:27 | RSchulz | My usual critique of IDEs is their "my way or the highway" approach. But I saw DrScheme as more of an educational tool than an IDE. |
| 19:29 | Puzzler | RSchulz: They've got some pretty neat stuff in there that makes it more than just an educational tool. For example, they have a very sophisticated macro debugger, unlike anything I've seen in any Lisp environment. |
| 19:29 | RSchulz | Presumably almost all of it would have a meaningful and useful Clojure counterpart. |
| 19:30 | RSchulz | Naturally, its Clojure counterpart would be a Swing application. |
| 19:31 | Puzzler | Puzzler: I was fantasizing today about whether it would be possible to make a Clojure "plugin" for DrScheme. I believe the editor is fairly customizable, butI don't think DrScheme has the capability to interact with Java in the way you'd need to get debugging and profiling. |
| 19:31 | Puzzler | I'm hoping the |
| 19:31 | Puzzler | Netbeans plugin will rock. |
| 19:32 | RSchulz | It's lookingn good. And Peter Wolf is working on an IDEA plug-in. He's only getting started, but since I use IDEA for my Java work, I'm rooting for him. |
| 19:32 | Puzzler | Anway, got to run for now... Good to chat with all of you. |
| 19:33 | RSchulz | Ciao! |