2010-06-05
| 00:21 | lancepantz | does anyone know how you would go about creating an ant task that launches a repl? |
| 00:22 | lancepantz | i expect to be able to use the Java task, but jline.ConsoleRunner as my class with the clojure.main argument |
| 00:22 | lancepantz | i can get a repl task, but it just exits after showing the prompt |
| 00:23 | tomoj | is there a good reason we can't make protocols which 'extends' interfaces? |
| 00:23 | tomoj | maybe that doesn't make any sense |
| 00:25 | tomoj | I was thinking I wanted implementers of my protocol to be required to implement Seqable |
| 00:48 | defn | http://uwnews.org/article.asp?articleID=45255 |
| 00:48 | defn | woops |
| 01:37 | _brian2_ | noob question > trying to use contrib string utils, this doesn't work -> (require '[clojure.contrib.string :as s]) , java.io.FileNotFoundException |
| 02:20 | defn | noob mistake: leaving the channel before you get an answer |
| 03:27 | defn | i have a serialized structure that i want to allow people to query with JSON or something -- id like to create an API i suppose |
| 06:24 | bsteuber | I've got a weird issue while trying a non-ELPA swank setup |
| 06:24 | bsteuber | everything works without errors in |
| 06:24 | bsteuber | *inferior-lisp |
| 06:24 | bsteuber | * |
| 06:24 | bsteuber | argh |
| 06:24 | bsteuber | but still, I don't get a *slime-REPL* buffer |
| 06:24 | bsteuber | any ideas? |
| 06:59 | kensanata | Hi all. I'm a Clojure & Swing newbie and I have trouble writing a MouseListener for my app. Its mouseClicked method appears to not get called. What's wrong with my (proxy [JFrame MouseListener] (mouseClicked [e] (println e)))? My 37 line app is here: http://www.emacswiki.org/alex/2010-06-05_Clojure_Mouse_Listener |
| 07:05 | Chousuke | are you using slime or something? |
| 07:05 | Chousuke | the output might go to the *inferior-lisp* buffer |
| 07:06 | Chousuke | but hm, shouldn't you normally do listeners by using the .addListener method for frames etc? |
| 07:06 | _mst | kensanata: I think the only thing you're missing is that your MouseListener won't do anything until you register it with the jframe |
| 07:06 | Licenser | kensanata: for me it sounds odd to proxy a frame and a listener in one thing |
| 07:06 | _mst | yep, that :) |
| 07:07 | Licenser | <advertisement>look at clj-swing for how do do swing & clojure it has grown quite a bit now :) </advertisement note="It is open source so don't worry"> |
| 07:08 | kensanata | Hehe |
| 07:08 | Licenser | kensanata: you might actually enjoy clj-swing a lot :) I gladly support you with it to when I'm around since having someone use the library is the best way to get the edges off it |
| 07:09 | Chousuke | Licenser: don't attributes go into the opening tag? :P |
| 07:09 | Licenser | Chousuke: that is XML 2.0 :P |
| 07:09 | kensanata | Ok, I'll try using addListener. I got the idea from http://java.ociweb.com/mark/clojure/article.html#DesktopApps where they use an ActionListener. |
| 07:09 | _mst | reverse polish xml ;) |
| 07:10 | Licenser | also since when do I care for well working XML, I hate it just the same, next time I'll use clojure syntax [:advertisement {:note "It's open sourece"} "..."] |
| 07:10 | kensanata | Licenser: I'll take a look at clj-swing once I have the very basics. :) |
| 07:11 | Licenser | kensanata: cool just drop me a query here my PC is usually on even if I'm not and I'll get back to you. Also if you got some stuff done I'll gladly look over your stuff and see how to best encoperate it with clj-swing (since it is by far not done) |
| 07:12 | kensanata | Licenser: Hehe, just read your README on github. I had to get rid of Stuart Sierra's macro because it didn't work for what I needed and I didn't know how to adapt it. |
| 07:12 | Licenser | kensanata: well it was just a base, mine can do a bit more by now :P |
| 07:29 | nirly | how can I write a string as unicode data into a file? |
| 07:33 | Chousuke | I'm not sure what you mean with "unicode data", but http://java.sun.com/javase/6/docs/api/java/io/FileWriter.html should help |
| 07:35 | Chousuke | It seems you'll need to use an OutputStreamWriter directly if you want to specify the encoding though. |
| 07:36 | kensanata | Thank you to all that suggested the addFooListener. It turned out that I needed a MouseListener because addActionListener did not exist; and it turned out that I needed to implement the entire interface, ie. (proxy [MouseListener] [] (mouseClicked [e] (edit-grid e)) (mouseEntered [e]) (mouseExited [e]) (mousePressed [e]) (mouseReleased [e])) -- but now it works. :) |
| 07:50 | raek | strings in java (and thus in clojure) are sequences of unicode characters (not bytes) |
| 07:51 | raek | OutputStream and InputStream are abstract classes for writing and reading streams of bytes |
| 07:51 | raek | OutputStreamWriter and InputStreamWriter are abstract classes for writing and reading streams of characters |
| 07:52 | raek | when you open a file, you get a FileOutputStream |
| 07:53 | raek | (correction: *Writer are not abstract classes) |
| 07:54 | raek | the constructor of OutputStreamWriter takes an OutputStream and the name of the character encoding (character to byte mapping) |
| 07:55 | raek | if you want to be able to encode all unicode characters, you'll need to use an encoding in the UTF family |
| 07:56 | raek | UTF-8 is convenient, since it's backwards compatible with ASCII (that is, all bytes with a zero in the 8th bit are ASCII) |
| 07:57 | raek | ISO 8859-1 is less good, because it can only code the first 256 characters, unlike UTF-8 which can code more than 100000 characters |
| 07:59 | raek | hope this was useful... :) |
| 08:01 | Lajla | ,(car ''x) |
| 08:01 | clojurebot | java.lang.Exception: Unable to resolve symbol: car in this context |
| 08:02 | Lajla | ,(car (list 1 2 3)) |
| 08:02 | clojurebot | java.lang.Exception: Unable to resolve symbol: car in this context |
| 08:02 | Lajla | So, if I get this straight, clojure has no car and cdr? |
| 08:02 | Lajla | Ohhh, first. |
| 08:02 | Lajla | ,(first ''x) |
| 08:02 | clojurebot | quote |
| 08:02 | Lajla | Yeah |
| 08:03 | raek | :) |
| 08:03 | Lajla | WAs just checkin', bro. |
| 08:03 | Lajla | I think first, second, third et cetera are ugly names for car, cadr et cetera. |
| 08:04 | Lajla | I personally use ((string->accessor "caddddddddr") lst) |
| 08:05 | nirly | thanks raek, Chousuke |
| 08:06 | raek | (first (drop 8 lst)) |
| 08:06 | raek | pretty readable too, IMHO |
| 08:07 | Chousuke | "ugly" :P |
| 08:07 | Chousuke | at least they're descriptive |
| 08:07 | raek | or simply (nth lst 7) |
| 08:09 | raek | s/7/8/ |
| 08:09 | sexpbot | or simply (nth lst 8) |
| 08:16 | Lajla | Chousuke, I think caaddaadr like combinations are much more descriptive. |
| 08:16 | Lajla | At least, don't know about clojure, but in most lisps, 'fourth' is really just a composition of car, cdr, cdr, cdr. |
| 08:16 | Lajla | Ehh + cdr. |
| 08:16 | Licenser | yea but what if you don#t have a drivers licens and can't use car? |
| 08:17 | Lajla | And applying fourth to a three element list will result into a cdr-based error. |
| 08:17 | Chousuke | Lajla: I can |
| 08:17 | Lajla | Also, what if you apply cadddr to a binary tree that is not a list, but an even branched tree? |
| 08:17 | Chousuke | Lajla: I can't even read that |
| 08:18 | Chousuke | Lajla: the combinations of cdr and car are not descriptive in the least unless you've actually learned to read them |
| 08:18 | Lajla | Names like 'fourth' are only 'descriptive' for one of the most common conceptual uses of using car and cdr. |
| 08:18 | Licenser | I think it is good that clojure uses first, next, rest pposite to c[ad]+r |
| 08:18 | Lajla | Chousuke, well, they describe transparently the operation you perform. |
| 08:18 | Chousuke | whenever I see something like that I need to think what it means. |
| 08:18 | Licenser | Lajla: on lists yes on vectors no |
| 08:19 | Chousuke | whereas first and second are immediately obvious |
| 08:19 | raek | mustn't the cdr part of a cons be a sequence in clojure? |
| 08:19 | Licenser | nth too |
| 08:19 | raek | ,(cons :a :b) |
| 08:19 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Keyword |
| 08:19 | Lajla | Chousuke, well, maybe you think too much in 'ists' and not enough in 'right branching pairs that end on ()' |
| 08:19 | Chousuke | I don't understand that at all. |
| 08:19 | Chousuke | how does the structure of the list matter? |
| 08:19 | Chousuke | it's still a lsit |
| 08:19 | Chousuke | list |
| 08:20 | Lajla | Chousuke, well, lists are ad hoc in lisp. |
| 08:20 | Lajla | THey aren't primitives. |
| 08:20 | Lajla | THey're constructed from pairs and (). |
| 08:20 | Chousuke | yes, but they're still lists. |
| 08:20 | Lajla | Chousuke, they're lists the same way a struct in C that can be used to model a date is a 'date'. |
| 08:20 | Lajla | It's ad hoc. |
| 08:20 | Chousuke | the cdr/car thing is a vestigial leftover from the early days |
| 08:21 | Lajla | Well, first and second would work just as well. |
| 08:21 | Chousuke | it makes no sense unless you're actually already used to it. |
| 08:21 | Lajla | But car and cdr can be easily composed unto each other in a simple readable form. |
| 08:21 | raek | (get-in [[[:a :b] [:c :d]] [[:e :f] [:g :h]]] [0 1 0]) |
| 08:21 | raek | ,(get-in [[[:a :b] [:c :d]] [[:e :f] [:g :h]]] [0 1 0]) |
| 08:21 | clojurebot | :c |
| 08:21 | Licenser | Lajla: I don't agree, caaddaadr is not readable :P |
| 08:21 | Lajla | Well, it makes sense if you see lists for what they are, pairs composed unto each other. |
| 08:21 | Chousuke | that's the thing, I don't consider them readable at all :P |
| 08:21 | Lajla | All you then need to know is that car revers to the first element in a pair, and cdr to the second. |
| 08:22 | Lajla | Chousuke, well, I guess you see a list as 'an ordered collection of data' uppose to 'a nesting of pairs' |
| 08:22 | Licenser | caaddaadr looks like a klingon war cry to me |
| 08:22 | hoeck | Lajla: note that there is ffirst and fnext too in clojure ) |
| 08:22 | Licenser | Lajla: but aren't lists (at least in clojure) ordered collections of data? |
| 08:22 | Lajla | It looks like 'get the first of the first of the second of the second of the first of the first of the second element of a pair' for me. |
| 08:23 | Lajla | licenser, I think clojure does not implement lists as lisps traditionally do no, targeting the JVM and all. |
| 08:23 | Lajla | Traditionally in lisp, lists were just 'a binary tree' |
| 08:23 | Lajla | The one restriction is that the rightmost leave is '(). |
| 08:23 | Licenser | Lajla: point is, while I can imagine caaddaadr is quite effective for a versatile lisp programmer, forst, second, nth and friends make it easyer for the rest of the world |
| 08:24 | Licenser | what I like in clojure is that it lowers the entry level to a lisp dialect to a place where it is acutally woth to get used to all the oddness of prefix notation and lists |
| 08:24 | Lajla | (((a . b) . 3) . ( a . ( ( x . y) . (2 . () ) ) ) is a list. |
| 08:24 | Lajla | licenser, well I guess clojure puts more emphasis on the functional programming that scheme brought to lisp. |
| 08:25 | Lajla | while the defining feature of most lisps is still the interchangeability of code and data. |
| 08:25 | Lajla | And that your program IS such a binary tree. |
| 08:25 | Licenser | as far as I understood that works great in clojure too |
| 08:25 | Chousuke | I've rarely had a need for anything more complex than a caddr maybe |
| 08:25 | Licenser | you're justnot forced to write caaddaadr |
| 08:26 | Lajla | Well, I sometimes see myself using ((string->accessor "caaddaadr") ... ) in liue of ((compose car car cdr cdr car car cdr) ... ) because it's shorted. |
| 08:26 | Lajla | But I guess in clojure, one doesn't use homo-iconicity that much. |
| 08:26 | Chousuke | huh? |
| 08:26 | Lajla | The fact that source code is not static, but dynamic. |
| 08:26 | Chousuke | it's used all the time :P |
| 08:27 | Lajla | Chousuke, how? |
| 08:27 | Chousuke | um, in every macro? |
| 08:27 | Licenser | Lajla: you can easiely write a function that is shorter then string->accessor |
| 08:27 | Lajla | In homo-iconicity, you'll find yourself dissassembling and assembling your source code a lot with car and cdr. |
| 08:27 | Chousuke | nah |
| 08:27 | Lajla | licenser what do you eman? |
| 08:27 | Lajla | Chousuke, also, macros are static, not dynamic. |
| 08:27 | Licenser | Lajla: if you want string->accessor |
| 08:28 | Licenser | you can write it yourself |
| 08:28 | Lajla | They are performed at compile time. |
| 08:28 | Lajla | licenser, that function have written myself. |
| 08:28 | Licenser | ah |
| 08:28 | Licenser | Lajla: you can use a macro too |
| 08:28 | Lajla | It takes a string of the form c[ad]+r and produces an accessor. |
| 08:29 | Licenser | *nods* as saied you can do that in clojure too ;) |
| 08:29 | Licenser | just replace car with first and cdr with second |
| 08:29 | Chousuke | Lajla: when do you actually modify code at runtime in lisp? |
| 08:30 | Lajla | licenser, ah, there you're wrong. |
| 08:30 | Lajla | second is cadr. |
| 08:30 | Chousuke | Lajla: that's very rare |
| 08:30 | Licenser | ah well what is cdr then? |
| 08:30 | Lajla | Chousuke, no, that's lisp. |
| 08:30 | Lajla | licenser, cdr applies on pairs. |
| 08:30 | Chousuke | I have to disagree |
| 08:30 | Chousuke | I've never seen it |
| 08:30 | Lajla | It's rest, when done on lists, though. |
| 08:30 | Lajla | Chousuke, what do you think CLOS does all the time? |
| 08:31 | Lajla | It changes the state of objects by manipulating their code. |
| 08:31 | Licenser | well Lajla I still think yo can do the same in clojure I just don't understand what you do :P |
| 08:31 | Lajla | licenser, well a pair is not a list of two elements. |
| 08:31 | Lajla | A list of two elements is a pair (a . (b . () ) |
| 08:32 | Lajla | A list (a b c d) is (a . (b . (c . (d . () ) ) ) ), you know that, right? |
| 08:32 | Lajla | Car accesses the first element of a pair, cdr the second, not of a list. |
| 08:32 | Licenser | yes I can imagine that |
| 08:32 | Licenser | ah so cdr is rest (next) and car is first? |
| 08:33 | Lajla | Which of course means that cdr also accesses the conceptual 'rest' of a list. The main differences is that car and cdr are mainly operations on pairs, not on lists, lists are just composed of pairs. |
| 08:33 | Lajla | licenser, yeah, that's the general idea. |
| 08:33 | Chousuke | Lajla: I don't think mutating code is what makes lisp what it is. :P |
| 08:34 | Chousuke | Lajla: a CLOS-like system would be possible to create with immutable data as well |
| 08:34 | Lajla | Except that car and cdr are shorter, and cadadr like compositions can't easily be made from 'first' and 'rest' that are also that easy to read. |
| 08:34 | Lajla | Chousuke, well, why hasn't it then? |
| 08:34 | Lajla | CLOS is easily the most powerful object system around. |
| 08:34 | Chousuke | Lajla: because no-one actually wants objects :P |
| 08:34 | Lajla | Chousuke, you think it's a coincidence that lisps object system is that powerful? |
| 08:35 | Chousuke | they're all about encapsulating mutable state and that's not very clojurey |
| 08:35 | Lajla | Lisp was the first, and still the only significant homo-iconic language, and an instigator for many things that found their way into other languages that just follow from lisps homo-iconicity. |
| 08:35 | Licenser | so (map #(get {\a first \d next} %) (second (re-find #"^c([da]+)r" string-stuff))) something like that? |
| 08:35 | Chousuke | Bu Clojure is homoiconic too, being a lisp :/ |
| 08:35 | Lajla | Chousuke, yap, I can imagine that. But that's also while clojure is not that homo-iconic, your program is data and can manipulate itself. |
| 08:36 | Lajla | Chousuke, sure, but it favours a more functional style. |
| 08:36 | Lajla | Though, a limited form of homo-iconicity is the apply operator of course. |
| 08:36 | Lajla | but, how would you define the factorial function? |
| 08:36 | Chousuke | see, that's what I don't get. How is homoiconicity in clojure "limited" in any way? |
| 08:37 | Lajla | Chousuke, I never said it was. |
| 08:37 | Lajla | I mean, it's all possible, I'm just saying it was more designed towards a functional style. |
| 08:37 | Chousuke | That's true. |
| 08:37 | Chousuke | I guess I don't see what your point is, anymore :P |
| 08:38 | Lajla | Chousuke, but would you define the factorial the typical way with if or would you use (apply * (cons 1 (range 2 n))) |
| 08:38 | Chousuke | either would work? :/ |
| 08:38 | Lajla | Chousuke, sure, but that one is charactaristically lisp like, and a lot more performance efficient. |
| 08:47 | Borkdude | Is there something like this already in core/contrib? (defn update-map [m f & args] |
| 08:47 | Borkdude | (reduce #(apply update-in %1 (vector %2) f args) m (keys m))) |
| 08:47 | Borkdude | so you can do: (update-map {:a 1 :b 2} inc) => {:a 2 :b 3} ? |
| 08:49 | Borkdude | or: (update-map {:a 1 :b 2} + 2), {:a 3, :b 4} |
| 08:50 | Borkdude | or is this how you would use zipmap? |
| 08:50 | Licenser | hmm Borkdude I have a function that I think would allow that |
| 08:51 | Licenser | http://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox.clj#L14 look at that perhaps it helps you |
| 08:51 | Borkdude | (zipmap (keys m) (map inc (vals m))) would also work maybe |
| 08:53 | Borkdude | Licenser: tnx |
| 08:54 | Licenser | but it might not be what you want but it might help ;) |
| 08:54 | Borkdude | Licenser: can you give an example of how you would use it on a simple map? |
| 08:55 | Licenser | hmm http://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox.clj#L103 |
| 08:55 | Licenser | it replaces . in code with dot |
| 08:57 | Licenser | do you want this to be nested? |
| 08:58 | Borkdude | Licenser: actually what I was simply searching for was a map that worked on map values |
| 08:58 | Borkdude | non-recursive |
| 08:59 | Licenser | ah okay then just use map? |
| 08:59 | Borkdude | Licenser: you mean with zipmap? |
| 08:59 | Licenser | no map map |
| 08:59 | Licenser | or reduce, even easier |
| 09:01 | Licenser | (defn hash-map-map [f m] (reduce (fn [r [k v]] (assoc r k (f v))) {} m)) |
| 09:02 | Licenser | do you want it map like or update like? |
| 09:03 | Licenser | because map won't take + 2 |
| 09:03 | Borkdude | Licenser: that hashmap-map looks fine |
| 09:03 | Borkdude | and I could improve it to take some args |
| 09:04 | Licenser | (update-map {\a 1 \b 2 \c 3 \d 4} + 2) works with (defn update-map [m f & args] (reduce (fn [r [k v]] (assoc r k (apply f v args))) {} m)) |
| 09:05 | kotarak | (zipmap (keys m) (map #(apply f %1 args) (vals m))) |
| 09:05 | Borkdude | Licenser: that's ok enough. now let me check how that destructuring works |
| 09:06 | Licenser | ^^ |
| 09:07 | Borkdude | kotarak: I also thought of that one, maybe it also would be more efficient? |
| 09:08 | kotarak | Borkdude: dunno |
| 09:09 | kotarak | I would expect reduce to be faster due to InternalReduce. But maybe zipmap works similar internally? ... |
| 09:12 | Borkdude | ,(letfn [f [x [y z]] (+ x y z)] (f 1 [2 3])) |
| 09:12 | clojurebot | java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol |
| 09:14 | Borkdude | ,(letfn [(f [x [y z]] (+ x y z))] (f 1 [2 3])) |
| 09:14 | clojurebot | 6 |
| 09:15 | Borkdude | wouldn't it be an idea to leave outer parens out... it seems like overkill to me ;) |
| 09:15 | kotarak | Where? in letfn? |
| 09:17 | candera | Perhaps the issue is how one would bind more than one function at a time. |
| 09:18 | Borkdude | candera: it's triples, name args and body |
| 09:18 | candera | Body can be more than one expression, yes? |
| 09:19 | Borkdude | hmhm.. makes sense |
| 09:19 | candera | I mean, I'm with you: I thought the extra grouping looks weird. But Rich is smarter than I am. :) |
| 10:16 | lypanov | any interest in riak from clojure community? |
| 10:17 | lypanov | or translation: anyone know of any libraries? |
| 10:21 | Borkdude | Does dotrace support recursive functions |
| 10:23 | Borkdude | Or maybe Clojure 1.2 does some secret optimization with recursion? |
| 10:25 | Borkdude | This only shows one call of my function: http://gist.github.com/426665 |
| 10:27 | Borkdude | gtg... maybe later |
| 11:30 | arkh | anyone know off the top of their head how to take from a lazy sequence until you read nil ? |
| 11:33 | shoover | arkh: check out take-while. you can pass identity as the pred |
| 11:34 | arkh | shoover: excellent, thank you |
| 12:35 | replaca | lypanov: I know the sonian guys (like technomancy and tim dysinger) are using Riak extensively |
| 12:37 | lypanov | replaca: ah, awesome. will ping them to see what they're using whenever i get the time to transition to clojure. |
| 12:37 | lypanov | ( |
| 12:37 | lypanov | (stuck on ruby) |
| 13:24 | secleinteer | hi, are there any arch linux users here? i've been trying to set up clojure on arch, and i'm having issues with both the 'clojure' and 'clojure-git' PKGBUILDs in the AUR |
| 13:24 | secleinteer | i asked in #archlinux, but no one could help |
| 13:32 | Jevgeni | hi, is it possible not to print namespaces when using macroexpand? |
| 13:33 | bsteuber | Jevgeni: namespaces are already there after reading in the code |
| 13:34 | bsteuber | so the answer is: only by walking the code yourself |
| 13:34 | Jevgeni | bsteuber: what do you mean by walking the code myself? |
| 13:36 | bsteuber | (maybe the statement with read is wrong, though) |
| 13:36 | bsteuber | well |
| 13:36 | bsteuber | you could iterate over the code yourself and just read the name of each symbol |
| 13:36 | bsteuber | ,`defn |
| 13:36 | clojurebot | clojure.core/defn |
| 13:37 | bsteuber | ,(name `defn) |
| 13:37 | clojurebot | "defn" |
| 13:37 | Jevgeni | ok, just stripping the part after / |
| 13:37 | Jevgeni | ahha, I see, thanks |
| 13:42 | stuarthalloway | ,`~'defn |
| 13:42 | clojurebot | defn |
| 14:32 | secleinteer | hi, can anyone help me out, i can't get clojure to work |
| 14:32 | secleinteer | i'm getting "Could not find the main class: clojure.main. Program will exit." on a hello world |
| 14:33 | hamza | probably clojure.jar is not on your classpath |
| 14:33 | jdmmmmm | How are you attempting to invoke clojure? Could you paste the script in a pastie? |
| 14:34 | secleinteer | jdmmmmm: i'm running arch linux. i'm using the 'clojure' PKGBUILD from AUR. when i manually downloaded and installed clojure, it worked fine |
| 14:34 | secleinteer | i'll pastebin the bash script |
| 14:35 | secleinteer | nvm, it's available from the AUR: http://aur.archlinux.org/packages/clojure/clojure/clj |
| 14:36 | jdmmmmm | Does this mean the problem is gone or that you don't need a pastebin? |
| 14:38 | jdmmmmm | One idea is to just run the following and see if those env variables get set up properly: source /etc/profile |
| 14:40 | secleinteer | jdmmmmm: source /etc/profile did it, thanks a lot! |
| 14:40 | jdmmmmm | secleinteer: np |
| 14:44 | bartj | I am quite a code-style zealot but, I am finding following the Lisp code style mentioned here (http://mumble.net/~campbell/scheme/style.txt) extremely unclear |
| 14:44 | bartj | any pointers? |
| 14:45 | secleinteer | jdmmmmm: should i add "source /etc/profile" to ~/.bashrc to have it always run? |
| 14:48 | secleinteer | bartj: "Rationale: The parentheses grow lonely if their closing brackets are all kept separated and segregated." <-- are you sure this is supposed to be taken seriously :/ |
| 14:49 | jdmmmmm | secleinteer: No, whenever you start a shell "source /etc/profile" will be implicitly run. Wwhen files are added/modified in /etc/profile.d/, (which is what I assume happens in arch linux) you'll may to run that on currently open shell windows. A newly opened shell window should work fine. |
| 14:49 | secleinteer | jdmmmmm: it didn't work for me, that was the problem |
| 14:49 | secleinteer | i had to explicitly add 'source /etc/profile' to .bashrc |
| 14:49 | secleinteer | the files are indeed in /etc/profile.d/ |
| 14:51 | jdmmmmm | secleinteer: Maybe you need to log out and log back in? If that doesn't do the trick, then I think your linux config is broken. |
| 14:51 | secleinteer | jdmmmmm: i logged out and in already as well |
| 14:52 | secleinteer | it must be something to do with my config files |
| 14:52 | secleinteer | i just created a new user and it works fine under that user |
| 14:53 | jdmmmmm | secleinteer: I would post something on the arch linux forums explaining the problem. That behavior is counter to other distros I've worked with. That said, I've never used arch. |
| 14:53 | secleinteer | ok |
| 14:53 | bartj | secleinteer: I thought that was to be taken with a huge pinch of salt? :) |
| 14:53 | secleinteer | bartj: haha ok |
| 14:54 | jdmmmmm | secleinteer: I think this may explain the problem: http://bbs.archlinux.org/viewtopic.php?id=64364 |
| 14:56 | secleinteer | jdmmmmm: ok, thanks for the link |
| 14:57 | secleinteer | i've distrohopped a lot, and never cleaned out my config files, so there's probably a lot of crap built up |
| 14:57 | bartj | can anyone help me with indenting code on emacs (a complete emacs n00b here) |
| 14:58 | bartj | from the above link: Run `C-M-q'(indent-sexp) on any code to ensure that it is indented correctly |
| 14:58 | bartj | I mean Clojure code of course |
| 14:59 | bartj | when I press Control and Alt and q character as mentioned above, |
| 14:59 | bartj | I get C-M-q is undefined |
| 14:59 | bartj | what gives? |
| 14:59 | jdmmmmm | bartj: I use indent-region: C-M-\ |
| 15:00 | jdmmmmm | First, you can mark-whole-buffer: C-x h |
| 15:01 | jdmmmmm | Then, intent-region and everything in the buffer is indented. |
| 15:04 | bartj | jdmmmmm: when I do C-x h , I get a mark set ->possibly indicating that the buffer start position is recorded |
| 15:04 | bartj | how do I indicate that the buffer end position? |
| 15:04 | bartj | go to the close bracket and indicate it? if yes, how? |
| 15:05 | jdmmmmm | Do you have transient-mark-mode on? If you did you would see the whole buffer is "highlighted" |
| 15:07 | bartj | not sure...how to do I have it on? |
| 15:08 | jdmmmmm | Let's move to a private chat if possible. It's beyond the scope of clojure. |
| 15:09 | hsjunnesson | I have a hierarchical collection of java objects I want to turn into a map. Some of these java objects responds to .getChildren. I then want to extract a few values on each node in the tree such as the class of the object. |
| 15:10 | hsjunnesson | Can someone point me in the right direction here, I was looking at zippers, and I can create a zipper which maps to the java hierarchy fine but I don't really get how to recursively construct a new map from that. |
| 15:22 | lpetit | stuarthalloway: hello, do you know whether the second patch of cgrand in issue #358 has been applied to master ? I think not, but I may have overlooked my clojure commits inbo |
| 15:22 | lpetit | x |
| 15:23 | stuarthalloway | waiting Rich's review, should be applied by Monday |
| 15:23 | lpetit | stuarthalloway: ok, great thanks ! |
| 15:43 | neoashaman | Hi, I'm trying to learn clojure - but am having some trouble with leiningen. Given the minimal project.clj (that only introduces dependencies on clojure and clojure-contrib) I get a huge backtrace when trying to do 'lein deps' |
| 15:43 | neoashaman | See: http://gist.github.com/426936 |
| 15:44 | neoashaman | Anyone know what I'm doing wrong? |
| 15:46 | Raynes | That's weird. |
| 15:47 | neoashaman | Indeed |
| 15:48 | Raynes | Looks like it can't find the 1.1.0 jar. |
| 15:49 | neoashaman | Yep, but the repo it says it's looking in (http://build.clojure.org/releases) appears to contain it, which is why I'm confused |
| 15:49 | neoashaman | I've tried both the leiningen I can get from 'macports' and the standalone script, with the same results |
| 17:05 | cschreiner | neoashaman: sudo? |
| 17:18 | hiredman | http://www.infoq.com/presentations/Towards-a-Universal-VM <-- "just do waht rich says" |
| 17:59 | arkh | that's a cool video - is there anywhere Rich's JVM thoughts/wishes have been recorded? |
| 18:01 | arkh | one thing I've heard him say is he doesn't want them to change a thing (in the JVM) because "everything works" right now, but I'm sure there'd be some things to take advantage of with tail call optimization, other invokedynamic stuff, etc. |
| 18:02 | arkh | (Rich's statement about a desire for no change being somewhat tongue-in-cheek, then) |
| 18:08 | dsantiago | Here's an ancient email where he says Clojure will implement TCO when the JVM has it. http://osdir.com/ml/java.clojure.user/2008-08/msg00225.html |
| 18:17 | arkh | the choice quote hiredman pointed out re: Rich in the above url is at 00:43:00 (43 minutes) into the video ;-) |
| 18:21 | arkh | dsantiago: thanks |
| 18:21 | dsantiago | Sure. |
| 18:21 | dsantiago | Who knows if that's changed or anything. |
| 18:21 | dsantiago | The guy in that video says at one point that tail calls will probably make it into the JVM. |
| 18:24 | arkh | yeah, pretty cool. In fact, the whole idea of having the JVM truly accommodate non-Java languages (not just superficially) and the mechanics involved is a world I didn't know about before |
| 18:28 | hiredman | he's mentioned fixnums a few times |
| 18:29 | hiredman | a lot of benchmarks are numeric in nature, so most dynamic languages on the jvm would do better on benchmarks if they had fixnums |
| 18:31 | arkh | nice (fixnum) [ http://bit.ly/d62Lfl ] |
| 18:33 | hiredman | http://blogs.sun.com/jrose/entry/fixnums_in_the_vm |
| 18:39 | arkh | if a cpu runs 64-bit, is it still important for "headerless objects" to fit in a single machine word of 32bits? |
| 18:39 | arkh | sorry, nvm. The article gets to that ... |
| 18:52 | arkh | hiredman: thanks! great article |
| 19:08 | Lajla | TWEY |
| 19:08 | Twey | o/ |
| 19:08 | Lajla | TAAS, TAAS, TAAS OLET MUN MAAILMASESSA. |
| 19:09 | Lajla | Sulla on vain haskel, lisp on minun, itse on minun. |
| 19:10 | Twey | No, I claim them all. |
| 19:10 | Twey | :) |
| 19:11 | Lajla | Twey, to be honest, I'm less enthusiastic about closure than I originally was. |
| 19:12 | Lajla | A lot of things are strange to me in the end, such as that (set "abcde |
| 19:12 | Lajla | ") |
| 19:12 | Lajla | returns a set of five characters. |
| 19:12 | tetron | makes sense to me ;-) |
| 19:12 | Lajla | Also, licenser here actually didn't know what the difference between second and cdr was. =( |
| 19:13 | Lajla | They think in 'lists' here, not in 'binary trees of cons cells'. |
| 19:16 | tetron | I haven't gotten very far with clojure, but one key realization I had was that it isn't a intended to be a pure language, it is a pragmatic language, which means among other things you tend to use the java standard librray a lot for bread-and-butter operatinons like string manipulation |
| 19:17 | _brian2_ | Hi, I'm trying to use print-dup to write a lazy sequence of clojure types (clojure.lang.PersistentArrayMap) , but seems to fail http://www.clojure.pastebin.com/YgM9xVfr |
| 19:19 | _brian2_ | Lajla : could you explain t a beginner why that makes a difference? |
| 19:20 | Lajla | _brian2_, well, (second x) is identical to (car (cdr x)) |
| 19:20 | Lajla | That's all. |
| 19:20 | Lajla | cdr accesses the second item of a pair. |
| 19:20 | Lajla | A pair is different from a list of two elements. |
| 19:20 | Lajla | A list (a b) is (a . (b . ())) |
| 19:22 | _brian2_ | I take it thats more how lisp people think? |
| 19:22 | Lajla | _brian2_, I thought so, until today. |
| 19:22 | Lajla | _brian2_, clojure seems to treat a list a 'just an ordered colletion of elements' |
| 19:23 | Lajla | I personally use things like cadadr, short for (car (cdr (car (cdr ... |
| 19:23 | Lajla | THey use second, or third. |
| 19:23 | Lajla | I realize today that they think in reverse, they think 'I have to get the fourth element of the list, hmm, let's think, that would be the car of the cdr of the cdr of the cdr' |
| 19:24 | Lajla | I'm more 'I have to get the car of the cdr of the cdr of the cdr of the pair, hmm, that would be uuhhmm, the fourth element of the list.' |
| 19:24 | tetron | well, clojure treats lists as a particular type of sequence, most things operate on sequences instead of lists |
| 19:24 | raek | the sequence library, which is a big part of clojure, assumes car=first and cdr=rest |
| 19:25 | raek | of what I have seen, the binary tree usage is simply not very common |
| 19:25 | raek | in clojure, that is |
| 19:25 | hoeck | ,(nnext [1 2 3]) |
| 19:25 | clojurebot | (3) |
| 19:25 | Lajla | raek, yap, but in Scheme it is. |
| 19:25 | Lajla | I find myself using (cddaar x) a lot. |
| 19:26 | Lajla | So deep does it go at times that I've written a string->accessor function so that I can (string->accessor "cddaadddaaddadadaar") to get |
| 19:26 | Lajla | the right composition |
| 19:26 | Raynes | I think cdr is 'next', not rest. |
| 19:26 | Raynes | I think that's what The Joy of Clojure told me, anyway. |
| 19:27 | raek | hrm, yes. that's probably more accurate. |
| 19:28 | raek | in clojure, there's more data structures to choose from |
| 19:28 | tetron | Lajla: using constructions like (cddaadddaaddadadaar x) seems unmaintainable |
| 19:28 | Lajla | raek, quite true, so to adress all this, naturally, I'm designing my own langauge. |
| 19:28 | raek | so one could use vectors of size 2 as pairs |
| 19:28 | Lajla | tetron, well, that one is extremely deep. |
| 19:28 | Lajla | But readable. |
| 19:28 | Lajla | Just pay attention to the d's and the a's. |
| 19:28 | Lajla | a is first, d is second. |
| 19:28 | tetron | also clojure has destructuring which is relatively clearer |
| 19:29 | Lajla | of pairs, that is. |
| 19:29 | ceptorial | is anyone using viper mode with emacs? i have (setq viper-mode t) in my init.el but anytime i start the repl or do debugging it switches back to emacs mode. does anyone know how to permanently turn on viper mode across all buffers? |
| 19:29 | Lajla | raek, well, the idea is that lisp syntax itself is made up of pairs and '() |
| 19:29 | _brian2_ | Any congomongo users out there who can tell me how to save a collection to a file and read into a clojure program? |
| 19:30 | hiredman | clojure doesn't have (exposed) pairs |
| 19:30 | hiredman | e.g. cons doesn't return a pair |
| 19:30 | Lajla | hiredman, well, I guess. |
| 19:30 | Lajla | same in haskell. |
| 19:31 | Lajla | This is one of the reasons I decided not to switch to clojure, despite it being promising at first. |
| 19:31 | Lajla | But encorporate the good parts into my own design. |
| 19:31 | hiredman | Lajla: so why are you here? |
| 19:31 | Lajla | hiredman, well A: helping people. B: checking if twey didn't follow me. C: off topic. D: talking finnish. E: autojoin, actually, it was THAT promising. |
| 19:32 | Lajla | hiredman, I have actually amassed some clojure knowledge while I tried to learn it. |
| 19:32 | hiredman | helping people? |
| 19:33 | Twey | Lajla: cdr is called ‘rest’ |
| 19:33 | Lajla | hiredman, sure, when people join and ask some things that even I know. |
| 19:33 | Lajla | Twey, next actually. |
| 19:33 | hiredman | all I see is evidence of D |
| 19:33 | _brian2_ | hiredman : I think it might be good to have people with different points of view |
| 19:33 | Lajla | But there are no pairs, they only work on lists. |
| 19:33 | hiredman | it's fine, it's just annoying to have someone going on and on about caddadaddaadr |
| 19:34 | Twey | Lajla: What's the difference between ‘rest’ and ‘next’, then? |
| 19:34 | Lajla | hiredman, well, I did already explain the difference between cdr and second to some-one, that's a real pitfall to people trying to work with linked lists, many don't realize at first that a pair is different from a list of two elements. |
| 19:34 | Twey | Lack of car/cdr creeps me out a bit, too :þ |
| 19:34 | Lajla | Twey, that rest doesn't exist, I think. |
| 19:34 | Lajla | Or let me see |
| 19:34 | hiredman | ,(doc rest) |
| 19:34 | clojurebot | "([coll]); Returns a possibly empty seq of the items after the first. Calls seq on its argument." |
| 19:34 | Lajla | ,(rest '( 1 2 3)) |
| 19:34 | clojurebot | (2 3) |
| 19:34 | Lajla | Ahh, okay, alias. |
| 19:34 | Twey | Ooh, bot. |
| 19:34 | Lajla | I learnt it with next |
| 19:34 | hiredman | no |
| 19:34 | Lajla | Yeah, but. |
| 19:34 | Twey | ,(doc next) |
| 19:34 | clojurebot | "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." |
| 19:34 | tetron | ,(doc next) |
| 19:34 | clojurebot | "([coll]); Returns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil." |
| 19:34 | hiredman | next is not the same as rest |
| 19:34 | Twey | Somewhat different |
| 19:34 | Lajla | Yeah, I see. |
| 19:35 | Lajla | next is truly cdr, except that pairs don't exist. |
| 19:35 | Twey | ,(next '(1)) |
| 19:35 | clojurebot | nil |
| 19:35 | Twey | ,(rest '(1)) |
| 19:35 | clojurebot | () |
| 19:35 | Lajla | Or ehh |
| 19:35 | Lajla | rest is cdr. |
| 19:35 | Twey | They can both be said to be cdr |
| 19:35 | raek | I think the motivation for rest/next is lazy sequences |
| 19:35 | Lajla | nil is different from () |
| 19:35 | Twey | Because () isn't nil, yeah |
| 19:35 | Lajla | Twey, nil is null. |
| 19:35 | Lajla | void |
| 19:35 | Lajla | A thing I took over to my own design, I like it. |
| 19:36 | hiredman | before rich made seqs lazier than they used to be, there used to be no such thing as an empty seq |
| 19:36 | raek | rest yields something that might not have decided if it's gonna be nil or not |
| 19:36 | hiredman | there were seqs with things in them, and there was nil |
| 19:36 | raek | calling seq on it forces it to make up its mind |
| 19:37 | raek | (next sequence) is equal to (seq (rest sequence)) |
| 19:38 | Twey | ,(seq (rest '(1))) |
| 19:38 | clojurebot | nil |
| 19:38 | Twey | Interesting |
| 19:38 | Twey | So you consider () to be a sort of future? |
| 19:38 | hiredman | no |
| 19:38 | hiredman | but it might not be |
| 19:39 | hiredman | if you have X and X is a lazyseq |
| 19:39 | raek | first and rest operate on various implementations |
| 19:39 | raek | conses is one of them |
| 19:40 | hiredman | ,(cons 1 2) ;in, say, scheme, this would return (1 . 2) |
| 19:40 | clojurebot | java.lang.IllegalArgumentException: Don't know how to create ISeq from: java.lang.Integer |
| 19:40 | tetron | well there is a difference between () [] {} and nil, which isn't the case in classic lisp since you only have () as a first class type |
| 19:40 | Twey | Hmmm |
| 19:40 | Twey | Lajla: |
| 19:40 | hiredman | tetron: classic lisp? |
| 19:40 | Twey | ,(cons 1 (cons 2 nil)) |
| 19:40 | clojurebot | (1 2) |
| 19:41 | raek | ,(lazy-seq (if (zero? (rand-int 2)) nil (list :foo))) |
| 19:41 | tetron | I'm thinking common lisp |
| 19:41 | clojurebot | (:foo) |
| 19:41 | raek | (lazy-seq (if (zero? (rand-int 2)) nil (list :foo))) |
| 19:41 | raek | ,(lazy-seq (if (zero? (rand-int 2)) nil (list :foo))) |
| 19:41 | clojurebot | (:foo) |
| 19:41 | hiredman | tetron: lisp has been a plurality for a long time, and many lisps treat these things differently |
| 19:42 | hiredman | infact it was a huge debate in the process of standardizing cl |
| 19:42 | Lajla | Twey, this is what I also think is annoying about haskell,t hat cons only works on lists. |
| 19:42 | tetron | hiredman: fair enough :-) my experience is limited to common lisp, elisp and a bit of scheme |
| 19:42 | Lajla | I don't like 'restrictions'. |
| 19:42 | Twey | Lajla: That's… not really an accurate description |
| 19:43 | hiredman | Twey: that works because in many cases nil is still treated as a empty seq |
| 19:43 | Twey | ,(cons 1 (cons 2 ())) |
| 19:43 | clojurebot | (1 2) |
| 19:43 | Twey | hiredman: I see |
| 19:43 | hiredman | ,(into nil '(1 2 3)) |
| 19:43 | clojurebot | (3 2 1) |
| 19:43 | Twey | Lajla: Consing doesn't only work on lists. Consing *is* lists. |
| 19:43 | hiredman | ,(into #{} '(1 2 3)) |
| 19:43 | clojurebot | #{1 2 3} |
| 19:43 | Lajla | Twey, explain? |
| 19:43 | Twey | (and it wouldn't make sense to have it work on anything else) |
| 19:43 | Twey | Lajla: Well, maybe in #haskell |
| 19:43 | Lajla | Twey, that's the point |
| 19:44 | Lajla | 'makes no sense'. |
| 19:44 | Lajla | I want to make up my own sense. |
| 19:44 | hiredman | in haskell I believe the implementation of cons is the way it is because of the type system |
| 19:44 | Lajla | Where people see 'addition', I see a shifting of bits, it's all about interpretation. |
| 19:45 | hiredman | the type of cons cells says they have two slots, a slot that holds a thing of a type X and a thing of a type List (or cons cell) |
| 19:45 | hiredman | so the only thing you can cons onto is a list/cons cell |
| 19:45 | Twey | Lajla: It's all about specification. ;) |
| 19:46 | Twey | hiredman: It's not really to do with typing… more to do with data-types. |
| 19:46 | Lajla | Twey, I disagree, a processor stores natural numbers and has some operations on them, that's it. |
| 19:46 | hiredman | Twey: I don't know much haskell, but from what I have seen I would say there is no real difference |
| 19:46 | hiredman | datatypes are constructed from types |
| 19:47 | Lajla | However, you can also interpreted 2^32 - 1 as -1, if ytou like. |
| 19:47 | Twey | Lajla: Sure, but if you're limiting yourself to the capabilities of the processor, you're missing out and should go back to ‘coding’ by bashing wires together. :þ |
| 19:48 | Lajla | Twey, I'm talking about C style langauges right now. |
| 19:48 | dnolen | (cons 'a {:foo 'bar}) |
| 19:48 | Lajla | C is ugly, C-- is awesome. |
| 19:48 | dnolen | ,(cons 'a {:foo 'bar}) |
| 19:48 | clojurebot | (a [:foo bar]) |
| 19:48 | hiredman | ,(cons 'a (seq {:foo :bar})) |
| 19:48 | clojurebot | (a [:foo :bar]) |
| 19:48 | hiredman | ,(seq {:foo :bar}) |
| 19:48 | clojurebot | ([:foo :bar]) |
| 19:50 | Raynes | Lajla: Clojure isn't Common Lisp or Scheme, and I don't think it's necessary to assume that all Clojure programmers are also Scheme or Common Lisp programmers, and would know the difference between cdr, cre, cklgnerjergi or whatever other cryptic names those languages use. |
| 19:50 | Raynes | In Licenser's defense, that is. |
| 19:50 | Raynes | The only reason I know the difference is because I worked on a toy Lisp that programble was writing a while back. |
| 19:51 | programble | car and cdr make sense |
| 19:51 | programble | btw |
| 19:51 | programble | when explained as a linked list |
| 19:51 | hiredman | *shrug* |
| 19:52 | Lajla | Raynes, yeah, probably, I stand corrected |
| 19:52 | Lajla | Clojures lists are probably not 'linked' |
| 19:52 | hiredman | the names are from registers that machines people are using these days don't even have |
| 19:52 | hiredman | they are |
| 19:52 | hiredman | the nodes just aren't exposed for direct manipulation |
| 19:52 | hiredman | lists and seqs are not the same thing |
| 19:52 | programble | car is like linkedlistnode->data |
| 19:53 | programble | cdr is like linkedlistnode->next |
| 19:53 | hiredman | lists just happen to be their own seqs |
| 19:53 | Raynes | Car is what I drove home 30 minutes ago. |
| 19:53 | rfg | heh |
| 19:53 | hiredman | programble: I think everyone is familar with what linked lists are, and the needed operations to traverse them |
| 19:53 | programble | Raynes: it means something, an acronym |
| 19:53 | Twey | ‘My other car is a cdr’ |
| 19:53 | programble | something register |
| 19:54 | hiredman | right |
| 19:54 | Twey | http://en.wikipedia.org/wiki/CAR_and_CDR |
| 19:54 | hiredman | it's named after register in a machine no one uses |
| 19:54 | hiredman | clojurebot: lisp machine? |
| 19:54 | clojurebot | my lisp machine is the jvm |
| 19:54 | dnolen | ,(first (first {:foo 'bar})) |
| 19:54 | clojurebot | :foo |
| 19:54 | raek | (defn cons [a d] (fn [f] (f a b))) |
| 19:55 | raek | (def car [c] (c (fn [a d] a))) |
| 19:55 | raek | (def car [c] (c (fn [a d] d))) |
| 19:55 | raek | s/car/cdr/ |
| 19:55 | sexpbot | (def cdr [c] (c (fn [a d] d))) |
| 19:56 | programble | blurgh |
| 19:57 | raek | apparently, I cannot type. I'm aware of the typos. :) |
| 19:58 | hiredman | ~scala {((x: Any, y: Any) => (f: Function2[Any, Any, Any]) => f(x, y))(1, 2)((x: Any, y: Any) => x)} |
| 19:58 | clojurebot | Any = 1 |
| 19:59 | dnolen | foldr and foldr considered harmful: http://research.sun.com/projects/plrg/Publications/ICFPAugust2009Steele.pdf, the days of cons are over. hello conc. |
| 19:59 | raek | scala, I really should look more into that language soon |
| 19:59 | dnolen | foldl and foldr i mean |
| 20:01 | hiredman | raek: why? |
| 20:01 | raek | ah, I see. this is related to why there is no 'preduce' in clojure |
| 20:01 | raek | curiosity, mostly |
| 20:01 | chouser | but clojure vectors are trees, not unlike Steele's structures there |
| 20:02 | hiredman | http://github.com/richhickey/clojure/commits/par |
| 20:02 | raek | ah, misinterpreted |
| 20:02 | chouser | so they could support efficient parallel operations. |
| 20:02 | raek | every reduce step is dependent on the previous |
| 20:02 | chouser | regular reduce on a seq, yes. |
| 20:03 | raek | even though + is associative, reduce cannot assume it |
| 20:03 | hiredman | raek: it can, it will just be up to the programmer to make sure they use associative functions |
| 20:04 | chouser | hm... subvec gives efficient access to slices of vectors. I wonder if it's overhead is low enough to build parallel ops on top of. |
| 21:01 | ceptorial | hey chouser, did you ever have any luck getting jvi to work with the enclojure repl? |
| 21:02 | chouser | Yes, but that was ages ago -- a very different version of enclojure. |
| 21:03 | ceptorial | i see.. any thoughts on how to get it working today? |
| 21:05 | chouser | no, I haven't looked at it recently. |
| 21:06 | chouser | let me know if you make any progress on it though. |
| 21:06 | ceptorial | alright, thx. did you move to emacs? |
| 21:06 | chouser | I need to find some sane way to extend my editor using Clojure. |
| 21:06 | chouser | nope, vim for me. |
| 21:08 | ceptorial | got it... vimclojure/nailgun? |
| 21:09 | chouser | ScreenRepl.vim |
| 21:15 | chouser | http://agriffis.n01se.net/skel.hg/index.cgi/file/fe1c0bdb217b/vim/plugin/ScreenRepl.vim |
| 21:17 | ceptorial | how does debugging work? |
| 21:20 | chouser | printlns and repl experiments are usually quite sufficient. I've tried to use jswat a couple times to step around. |
| 21:23 | ceptorial | i've found it more challenging to figure out where to put println's in clojure vs. imperative language.. |
| 21:25 | dnolen | nice nonblocking telnet chat server in 11 lines of Clojure, http://github.com/texodus/saturnine |
| 21:26 | dnolen | ceptorial: you put there pretty much in the same places I find |
| 21:26 | dnolen | s/there/them |
| 21:27 | hiredman | (doto foo println) |
| 21:27 | ceptorial | but does that return foo or nil |
| 21:27 | dnolen | ,(println (println "foo")) |
| 21:28 | clojurebot | foo nil |
| 21:28 | hiredman | it returns foo |
| 21:28 | hiredman | ,(doto :foo println) |
| 21:28 | clojurebot | :foo |
| 21:28 | clojurebot | :foo |
| 21:28 | ceptorial | oh nice |
| 21:28 | ceptorial | ok cool |
| 21:28 | hiredman | ,(doc doto) |
| 21:28 | clojurebot | "([x & forms]); Evaluates x then calls all of the methods and functions with the value of x supplied at the from of the given arguments. The forms are evaluated in order. Returns x. (doto (new java.util.HashMap) (.put \"a\" 1) (.put \"b\" 2))" |
| 21:28 | ceptorial | right |
| 21:28 | ceptorial | cool |
| 21:29 | dnolen | ,(do (println "foo") 5) |
| 21:29 | clojurebot | 5 |
| 21:29 | clojurebot | foo |
| 21:29 | dnolen | ,(do (let [x 5] (println "foo") x)) |
| 21:29 | clojurebot | 5 |
| 21:29 | clojurebot | foo |
| 21:30 | ceptorial | got it |
| 23:53 | hiredman | http://www.cufflinks.com/silver-2gb-usb-flash-drive-cufflinks.html |
| 23:53 | hiredman | er, mischan |