2010-05-14
| 00:39 | defn | aww ninjudd left before i could explain that all of the examples have results |
| 00:39 | defn | you just gotta click em |
| 00:39 | defn | arohner: haha |
| 00:39 | defn | the sum of digits 0 to n with a reduce => WARNING |
| 00:51 | defn | Is it rude to push jars to clojars without maintainer approval |
| 00:52 | technomancy | defn: only if you don't alter the groupid |
| 00:52 | defn | noted |
| 00:52 | defn | technomancy: where do i edit that bad boy? |
| 00:52 | defn | just change the defproject ... to foo.bar.project-name |
| 00:53 | Raynes | $mail ninjudd All of the examples have results. You just have to click them. |
| 00:53 | Raynes | Bug! |
| 00:53 | technomancy | yup |
| 00:56 | Raynes | Methinks the mail database got corrupted. |
| 00:58 | Raynes | Eh. Something looks broken in c.c.io. |
| 00:59 | Raynes | "java.lang.IllegalArgumentException: No matching method found: write for class java.io.BufferedWriter" |
| 00:59 | Raynes | "at clojure.contrib.io$spit__2167.invoke(io.clj:328)" |
| 01:02 | Raynes | Guess Stuart broke it. |
| 01:15 | Raynes | This makes little sense. |
| 01:15 | Raynes | spit works fine from the REPL, but not from sexpbot/clj-config. |
| 01:20 | technomancy | any more contrib forms that clojure-mode should be smarter about indenting? |
| 01:20 | technomancy | currently have dotrace, handle-case, and handle |
| 01:20 | technomancy | raek: sorry for ignoring your clojure-mode patch for so long. it got lost under a big pile of stuff |
| 01:21 | defn | clojure is 1.2.0-master-SNAPSHOT and contrib is 1.2.0-SNAPSHOT, yes |
| 01:22 | technomancy | t |
| 01:22 | technomancy | wait, I mean true |
| 01:22 | technomancy | dang elisp |
| 01:22 | defn | :) |
| 01:23 | Raynes | What a weird bug. |
| 01:24 | Raynes | Check this out: if you do (spit "omgfile" {:wtf "omg"}), it will throw "java.lang.IllegalArgumentException: No matching method found: write for class java.io.BufferedWriter" |
| 01:24 | Raynes | I didn't realize I wasn't str-ing it before, so that fixed it. |
| 01:24 | technomancy | try {:wtf "bbq"} |
| 01:24 | Raynes | Same thing! Weird! |
| 01:24 | defn | lol |
| 01:24 | Raynes | ;) |
| 01:25 | technomancy | {:rolf "copter"} maybe? |
| 01:25 | technomancy | :rofl |
| 01:25 | defn | {:loller "skates"} |
| 01:25 | defn | Raynes: is that weird? I didn't think you could just write a data structure out like that |
| 01:25 | technomancy | Raynes: check the mailing list; some of the semantics of io got changed to quit using PrintWriters and got reimplemented with protocols |
| 01:25 | Raynes | It worked before the last commit. |
| 01:26 | defn | Raynes: are you trying to serialize? |
| 01:26 | Raynes | I understand how it wouldn't work. |
| 01:26 | Raynes | But I don't understand why it threw such a useless error. |
| 01:26 | Raynes | It had me going for a whiler. |
| 01:26 | Raynes | while* |
| 01:26 | Raynes | defn: clj-config. It uses Clojure data structures for configuration files. |
| 01:27 | defn | dont you want something like (dorun (with-out-writer (java.io.File. "foo") (binding *print-dup* true] (prn {:foo "bar"}))) |
| 01:27 | defn | ) |
| 01:27 | Raynes | No, I don't. |
| 01:27 | defn | oh... |
| 01:27 | defn | well then nevermind then! |
| 01:27 | Raynes | $mail ninjudd All of the examples have results. You just have to click them. |
| 01:27 | sexpbot | Message saved. |
| 01:28 | Raynes | That's better. :D |
| 01:28 | defn | since you're from AL you should have said 'em instead of them |
| 01:28 | Raynes | I don't have much of an accent. :p |
| 01:28 | Raynes | LauJensen Jr. |
| 01:28 | defn | All them thar examples have results! Ya just gotta click 'em! |
| 01:28 | defn | Tarnashuns! |
| 01:29 | Raynes | Ya'll just gotta click 'em!* |
| 01:29 | Raynes | I hate "Ya'll", but what I hate worse is these illiterate hicks not bothering to put the apostrophe there. |
| 01:31 | Raynes | defn: Want a preview of the new tryclojure? :> |
| 01:31 | defn | sure |
| 01:31 | technomancy | just submitted updated slime, clojure-mode and clojure-test-modes to elpa |
| 01:31 | technomancy | hopefully they will be available soon |
| 01:31 | defn | technomancy: sweet |
| 01:31 | Raynes | defn: http://4.252.15.242:8801/ |
| 01:31 | defn | i run clojure-mode from a git repo anywho |
| 01:32 | defn | Raynes: is this on your 56k? |
| 01:32 | technomancy | defn: well now the folks who are too lazy to do that will benefit |
| 01:32 | Raynes | I'm working on some better stuff to do with the text-field (like probably get rid of it and make it look like an actual REPL.). |
| 01:32 | Raynes | Yes. |
| 01:32 | Raynes | Minus that last period in the parens there. :> |
| 01:32 | defn | Raynes: nice work buddy |
| 01:33 | Raynes | That's why I said preview. It's obviously going to be slow right now. :p |
| 01:33 | defn | Raynes: can i make one minor stylistic suggestion |
| 01:33 | Raynes | Sure. |
| 01:33 | defn | dont post anything that takes people to Reddit |
| 01:33 | Raynes | O_o? |
| 01:33 | defn | Reddit sucks. ycombinator is the only way to roll |
| 01:33 | Raynes | It's the Clojure reddit. :o |
| 01:34 | defn | yeah but it's still reddit |
| 01:34 | defn | reddit is filled with so much junk |
| 01:34 | technomancy | Raynes: can't enter anything here |
| 01:34 | Raynes | Patches welcome. :) |
| 01:34 | technomancy | oh, nm; just took a while |
| 01:34 | Raynes | Yeah, sorry. Slow webs. |
| 01:34 | Raynes | defn: I got the scrolling to work on my Chrome now too. JQuery made it work for some reason. |
| 01:34 | technomancy | Raynes: one request: can you make clojure.lang.PersistentQueues show as queue-fish? |
| 01:35 | technomancy | because that would really make my day |
| 01:35 | clojurebot | everyday is Rich Hickey Appreciation Day |
| 01:35 | Raynes | wut |
| 01:35 | technomancy | that too |
| 01:35 | technomancy | ,Q |
| 01:35 | clojurebot | <-nil-< |
| 01:35 | Raynes | I think there was an implicit joke there that I missed. |
| 01:35 | technomancy | ,clojure.lang.PersistentQueue/EMPTY |
| 01:35 | clojurebot | <-nil-< |
| 01:35 | technomancy | ,(conj (conj clojure.lang.PersistentQueue/EMPTY 12) 9) |
| 01:35 | clojurebot | <-(12 9)-< |
| 01:36 | Raynes | Thats interesting. |
| 01:36 | technomancy | behold, the legendary queue-fish |
| 01:37 | technomancy | it's a print-method hack that got added to clojurebot |
| 01:40 | TheBusby | for some reason that reminds me of William Tell's arrow |
| 01:42 | defn | ,(conj clojure.lang.PersistentQueue/EMPTY \\\\\\\\\\\\\) |
| 01:42 | clojurebot | EOF while reading |
| 01:43 | defn | ,(conj clojure.lang.PersistentQueue/EMPTY \\\\\\\\\\\\\/) |
| 01:43 | clojurebot | <-(\\ \\ \\ \\ \\ \\ \/)-< |
| 01:43 | defn | aww that's no good |
| 01:43 | defn | ,(conj clojure.lang.PersistentQueue/EMPTY "\\") |
| 01:43 | clojurebot | <-("\\")-< |
| 01:43 | defn | ,(conj clojure.lang.PersistentQueue/EMPTY [-_-]) |
| 01:43 | clojurebot | java.lang.Exception: Unable to resolve symbol: -_- in this context |
| 01:44 | defn | </spam> |
| 01:45 | technomancy | ,(conj clojure.lang.PersistentQueue/EMPTY '^_^) |
| 01:45 | clojurebot | Unmatched delimiter: ) |
| 01:45 | technomancy | ,(conj clojure.lang.PersistentQueue/EMPTY (symbol "^_^") ) |
| 01:45 | clojurebot | <-(^_^)-< |
| 01:46 | technomancy | ok, g'night |
| 02:17 | replaca | wow, folks are really fascinated with the fish :) |
| 02:17 | defn | it's novel, and it's late :) |
| 02:41 | jColeChanged | Hi, I'm just starting to learn clojure and ran into a bit of a bump. |
| 02:43 | zmila | JColeChanged - what's the problem? |
| 02:43 | tomoj | what's the bump shaped like? |
| 02:43 | jColeChanged | Its shaped like a tree I think. |
| 02:44 | jColeChanged | http://pastebin.org/234696 |
| 02:45 | jColeChanged | I'm trying to so recursion and finding myself getting a stackoverflow error. I tried switching it to use recur and got the same problem. |
| 02:45 | jColeChanged | Well, a different problem, but it still didn't run. |
| 02:46 | tomoj | side note: you probably want defn |
| 02:46 | tomoj | and we don't like underscores |
| 02:46 | tomoj | (defn knapsack-count [sack space] ... |
| 02:46 | zmila | here (knapsack_count (rest sack) space) - you don't change "space" |
| 02:49 | tomoj | the way you're trying to solve the problem is not easy to do in clojure, I think |
| 02:58 | LauJensen | Morning all |
| 02:58 | jColeChanged | I'll probably try solving it another way than. Just goofing around with project euler problems so its not really a big deal. |
| 02:59 | jColeChanged | Morning Laujensen. |
| 03:03 | LauJensen | jColeChanged: http://gist.github.com/400896 |
| 03:03 | LauJensen | Hows that work? |
| 03:07 | jColeChanged | That worked. |
| 03:07 | jColeChanged | Perfeclty. |
| 03:07 | jColeChanged | Thankyou LauJensen. |
| 03:08 | LauJensen | np :) |
| 03:08 | jColeChanged | BTW: You solved problem 31 on project euler. |
| 03:08 | LauJensen | No you did - I just fixed your code :) |
| 03:09 | jColeChanged | =) This channel seems a whole lot more friendly than most (from my limited experience). Glad I decided to learn clojure. |
| 03:10 | LauJensen | Yea its definitely a nice place to hang out |
| 03:10 | tomoj | won't that code still blow the stack? |
| 03:11 | tomoj | guess it doesn't matter if you're only looking for a specific answer |
| 03:11 | tomoj | need trampolines to solve it that way in general, I think? |
| 03:11 | LauJensen | No, it blew the stack because it didn't bail on empty |
| 03:11 | LauJensen | tomoj: Yes |
| 03:11 | LauJensen | But I don't know how to explain a trampoline solution in a newbie friendly way, perhaps you can help? |
| 03:12 | tomoj | I've never needed them yet :( |
| 03:12 | scottj | Is there a better way to get a string of x spaces than (apply str (take x (repeat \space)))? |
| 03:12 | LauJensen | $(doc trampoline) |
| 03:12 | sexpbot | result: -------------------------clojure.core/trampoline([f] [f & args]) trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if... http://gist.github.com/400904 |
| 03:12 | LauJensen | ,(doc trampoline) |
| 03:12 | clojurebot | "([f] [f & args]); trampoline can be used to convert algorithms requiring mutual recursion without stack consumption. Calls f with supplied args, if any. If f returns a fn, calls that fn with no arguments, and continues to repeat, until the return value is not a fn, then returns that non-fn value. Note that if you want to return a fn as a final value, you must wrap it in some data structure and unpack it after trampoline r |
| 03:12 | tomoj | ,(doc repeat) |
| 03:12 | clojurebot | "([x] [n x]); Returns a lazy (infinite!, or length n if supplied) sequence of xs." |
| 03:12 | tomoj | scottj: ^ |
| 03:13 | scottj | tomoj: ahh, thanks |
| 03:13 | tomoj | not quite as cool as ruby, but meh |
| 03:14 | tomoj | overloading * for sugar seems evil now to me anyway |
| 03:15 | LauJensen | I really like the 2**10 operator |
| 03:15 | LauJensen | 2**10 vs (Math/pow 2 10) |
| 03:16 | tomoj | how come I never see symbols with infix :? |
| 03:16 | tomoj | like 'foo:bar I mean |
| 03:16 | scottj | tomoj: what I think is tricky about that is that 2*" " seems as valid as " "*2 |
| 03:20 | scottj | I suspect because clojure programmers are used to associating : w/ keywords they don't think to use it as a separator in symbol names, and use packages to separate things groups - feels insufficient |
| 03:20 | scottj | s/packages/namespaces |
| 03:21 | tomoj | I wonder what rich was thinking when he explicitly allowed it |
| 03:21 | tomoj | "A symbol can contain one or more non-repeating ':'s." |
| 03:28 | scottj | LauJensen: if I were going to use Math/pow more than a couple times in a prog I'd define ** |
| 03:30 | lancepantz_ | does clojure-mode in emacs only highlight purple and blue out of the box? |
| 03:30 | tomoj | I'm just bugged by the fact that it only returns doubles |
| 03:31 | LauJensen | scottj: define it as a reader-macro and send it to Rich :) |
| 03:34 | scottj | lancepantz_: you mean does it only define two faces? it has faces for builtin, comment, func, keyword (annoyingly highlights some builtins and what clojure calls keywords), and string. not constant face |
| 03:38 | jColeChanged | Lauljensen: From what I can tell the only difference between next and rest is that rest returns an empty sequence and next returns nil when given a sequence with no items beyond the first. Are there any other differences that I'm missing which made next preferable to rest in the code you fixed or was it just your preference? |
| 03:39 | LauJensen | None at all. When next first was introduced, it was described as being more lazy than rest which was now eager. But when I wanted to explain that, I saw in the docs that it was no longer the case. So for this scenario rest is fine, if not better |
| 03:46 | LauJensen | jColeChanged: Oh, and by the way (< x 0) is (neg? x), (> x 0) is (pos? x) |
| 03:46 | tomoj | heh, interestingly it looks like for lists, rest actually just does the exact some thing as next, but then returns () if it gets nil back |
| 03:47 | jColeChanged | and (zero? x) as well right? |
| 03:47 | LauJensen | si |
| 04:21 | jColeChanged | Thanks again for the help. I'm heading to bed (its 1:20 AM). |
| 04:31 | unfo- | if i wanna do GUI stuff with clj i do it with java's swt/swing/etc libs right? |
| 04:32 | abrenk | unfo-: yes - there are a couple blog entries regarding clojure and swing |
| 04:32 | abrenk | unfo-: also there's a wrapper around miglayout in clojure-contrib |
| 04:33 | unfo- | abrenk, ty. I got interested in implementing something like this: http://rogeralsing.com/2008/12/07/genetic-programming-evolution-of-mona-lisa/ in clj :) |
| 04:33 | sexpbot | "Genetic Programming: Evolution of Mona Lisa « Roger Alsing Weblog" |
| 04:40 | LauJensen | unfo-: Looks like something that would be simple to paint on a JPanel |
| 04:43 | tomoj | there's also processing |
| 04:45 | unfo- | true true |
| 04:45 | unfo- | <3 processing with scala at least :) |
| 04:45 | unfo- | haven't checked it out with clj |
| 04:46 | LauJensen | Its trivial to plug into with Clojure |
| 04:46 | LauJensen | Slick2D is a little tricky, PulpCore is really tricky |
| 04:46 | LauJensen | JME is doable, but a little tricky and very tedious |
| 04:47 | LauJensen | JPanel is definitely the way to go for something like that |
| 04:47 | LauJensen | Takes 10 minutes to set up a panel with customized rendering |
| 04:50 | vIkSiT | hmm, btw - in your experience - how much of an overhead is clojure code compared to equivalent java or scala? |
| 04:50 | vIkSiT | I've been reading some blog posts today with all sorts of benchmarks |
| 04:51 | LauJensen | vIkSiT: judging from Wide Finder II its about -20% :) |
| 04:51 | Chousuke | for well-written, optimised code. |
| 04:51 | LauJensen | You see, in that particular benchmark, it beat both Java and Scala. But theres not a 1 answer fits all. If you want to be as fast as Java or Scala, you can definitely be that, but dynamically typed unhinted code will be slower |
| 04:51 | vIkSiT | LauJensen, ah hmm - would you have a link to some results? a google search thows a number of blog posts from '08 |
| 04:52 | LauJensen | So choose your battles. If you hav slow code, optimize it. If not, keep it elegant |
| 04:52 | vIkSiT | ah I see |
| 04:52 | LauJensen | http://wikis.sun.com/display/WideFinder/Results |
| 04:52 | sexpbot | "Results - Wide-Finder - wikis.sun.com" |
| 04:52 | LauJensen | Clojure did that in 8 minutes something |
| 04:52 | vIkSiT | for instance - this post is quite telling: http://groups.google.com/group/clojure/browse_thread/thread/73b1d41635d19dd8 |
| 04:52 | LauJensen | $google alex osbourne wide finder II |
| 04:52 | sexpbot | First out of 2640 results is: ongoing · What · Technology · Concurrency |
| 04:52 | sexpbot | http://www.tbray.org/ongoing/What/Technology/Concurrency/ |
| 04:53 | Chousuke | if you just write straightforward code it's anywhere between one point something to ten times slower than a java solution, depending on what you're doing :P |
| 04:53 | vIkSiT | hehe |
| 04:53 | LauJensen | or 100 times slower if it reflects |
| 04:53 | Chousuke | heh |
| 04:53 | vIkSiT | and would you know its efficiency vs common lisp? |
| 04:54 | LauJensen | But the point is. Clojure is 10x more concise and elegant than Java, and 9x more so than Scala. And if you want, you can make it just as fast. |
| 04:54 | Chousuke | vIkSiT: which implementation? :) |
| 04:54 | LauJensen | vIkSiT: I dont have any numbers, though I have seen a comparison, where optimized Clojure vs optimized CL showed Clojure to be about 5x faster |
| 04:54 | LauJensen | Than SBCL I think |
| 04:54 | vIkSiT | LauJensen, oh yes, I agree in terms of conciseness and elegance :) |
| 04:55 | vIkSiT | Chousuke, well, SBCL, or Franz for instance! |
| 04:55 | tomoj | 5x faster than sbcl... |
| 04:55 | Chousuke | again, it depends a lot on what you're doing |
| 04:55 | LauJensen | vIkSiT: But if you saw my post on Fluid Dynamics, you can see just how low-level you can go with Clojure. I did primitive math |
| 04:55 | tomoj | that is baffling |
| 04:55 | Chousuke | I wouldn't believe that 5x number :P |
| 04:55 | vIkSiT | LauJensen, ah yes I think I saw it a few days ago |
| 04:55 | LauJensen | tomoj: why? |
| 04:55 | Chousuke | SBCL is extremely fast if you write properly type-hinted code. |
| 04:55 | tomoj | sbcl compiles |
| 04:55 | Chousuke | it can beat C at times. |
| 04:56 | tomoj | to machine code I mean |
| 04:56 | Chousuke | for a similar algorithm |
| 04:56 | LauJensen | It was the Brians brain I did. My version was slow, lets say it took 1 minute for a certain number of iterations. The SBCL version then took 20 seconds, then Christophe made one that took 5 seconds - Same algorithm |
| 04:57 | vIkSiT | hmm |
| 04:57 | LauJensen | tomoj: but going directly to machine-code also means no hot-spot |
| 04:57 | Chousuke | but still, imperative programming is idiomatic in CL so most CL code won't really be comparable with clojure code, as the data structures and algorithms used are very different. |
| 04:57 | vIkSiT | Chousuke, what do you mean by your last statement btw? |
| 04:57 | vIkSiT | imperative programming is "idiomatic" in CL? |
| 04:57 | Chousuke | yes. |
| 04:57 | vIkSiT | as in? |
| 04:57 | LauJensen | True. But I think its a void concern. The question should be, can I make this fast _enough_ if I need to. And yes you can. End of performance story, lets now look at elegance and robustness :) |
| 04:58 | tomoj | yeah |
| 04:58 | Chousuke | vIkSiT: Well, if you try to write imperative code in clojure you'll end up with a mess |
| 04:58 | tomoj | I won't be touching sbcl anytime soon |
| 04:58 | Chousuke | vIkSiT: but CL is much more forgiving. |
| 04:59 | vIkSiT | ah |
| 04:59 | LauJensen | Chousuke: Yea, CL is the father who doesn't care - Rich cares! |
| 04:59 | vIkSiT | btw, I'm always a bit hazy about what exactly "idiomatic" refers to when used with lisps |
| 04:59 | Chousuke | LauJensen: I'd rather say that CL is not as opinionated |
| 04:59 | vIkSiT | does it imply using functional techniques vs imperative mishmash? |
| 04:59 | Chousuke | well functional style is idiomatic in CL too |
| 05:00 | LauJensen | vIkSiT: when something is idiomatic to a language, it means it adhears to what the language-designer intended - at least thats one definition |
| 05:00 | vIkSiT | ah I see |
| 05:00 | Chousuke | in my view CL supports both approaches equally well |
| 05:01 | LauJensen | Chousuke: wow, really? |
| 05:01 | tomoj | I don't want to give the designer authority over idioms |
| 05:01 | LauJensen | I didnt even know they had persistent immutable datastructures |
| 05:01 | LauJensen | tomoj: bad news is, he's already got it |
| 05:01 | tomoj | maybe de facto |
| 05:01 | Chousuke | LauJensen: well, they don't. but you don't need those for functional programming. |
| 05:01 | tomoj | if he says "don't do that" people will listen |
| 05:01 | tomoj | but we really have the power to create whatever idioms we want, under my understanding of the word |
| 05:01 | LauJensen | Chousuke: If its to have any practical application, then yes you do |
| 05:02 | Chousuke | LauJensen: nah |
| 05:02 | LauJensen | Chousuke: How then can your code be both effecient and geared for concurrency? |
| 05:02 | tomoj | I think of idioms as code style memes I guess |
| 05:02 | Chousuke | what has concurrency to do with this? |
| 05:02 | Chousuke | LauJensen: higher-order functions and such are useful even without immutable data structures |
| 05:02 | LauJensen | Chousuke: 'practical application' |
| 05:03 | Chousuke | concurrency isn't the only practical application of functional programming :P |
| 05:03 | LauJensen | Thats true, but even Richs definition of a functional language, is one which has a focus on immutable datastructures |
| 05:05 | Chousuke | I didn't mean to define CL as a functional language, but one that supports functional idioms |
| 05:05 | Chousuke | and those don't necessarily include working with immutable data structures |
| 05:06 | LauJensen | Chousuke: Im just trying to alert you to the fact, that CL doesnt not support functional paradigmes 'equally well' as Clojure. So that if you have to choose based on the criterium, choose Clojure |
| 05:06 | scottj | http://news.ycombinator.com/item?id=1016566 |
| 05:06 | sexpbot | "Hacker News | Palindromes (Clojure vs. Common Lisp)" |
| 05:07 | Chousuke | I didn't say it supports the paradigm equally to clojure. I said it supports imperative and functional programming equally well :) |
| 05:07 | Chousuke | no comparison to clojure in that statement. |
| 05:07 | LauJensen | aha - sorry I misread :) |
| 05:10 | Raynes | mmarczyk: ping |
| 05:12 | Licenser | http://blog.licenser.net/2010/05/14/stupid-db =) |
| 05:12 | sexpbot | "lice! : Stupid DB" |
| 05:14 | tomoj | link to github is wonky |
| 05:20 | Raynes | To whom it may concern: http://tryclj.licenser.net/ is awesome now. |
| 05:21 | LauJensen | Raynes: I love that you've done it, but does it have to be so ugly? |
| 05:21 | Raynes | Why, thank you. |
| 05:21 | LauJensen | http://tryruby.org/ |
| 05:21 | sexpbot | "try ruby! (in your browser)" |
| 05:21 | LauJensen | http://tryhaskell.org/ |
| 05:22 | LauJensen | And then look at yours - notice something a little off? :) |
| 05:22 | Raynes | It's my first web development project ever. I'm sorry if it's ugly. Licenser has a fork, and I suspect he'll make his pretty, then you can use his. |
| 05:22 | Chousuke | it should use the clojure colour scheme |
| 05:23 | tomoj | I'm surprised jquery-console doesn't support emacs keybindings |
| 05:23 | LauJensen | Raynes: Please dont pout, its nothing personal. Im just saying, slap on some nice css and a huge clojure.svg background image and you're all set :) |
| 05:23 | Raynes | I'm not pouting. I don't expect anyone to use it. |
| 05:23 | tomoj | or maybe that's not possible? |
| 05:23 | LauJensen | tomoj: but Conkeror does |
| 05:23 | tomoj | yeah, but not in the jquery-console |
| 05:23 | tomoj | (not even in quote-mode) |
| 05:23 | LauJensen | oh |
| 05:24 | Raynes | Just trust me, if I had any clue how to make it pretty, I certainly would. |
| 05:24 | Raynes | I'm definitely not a designer. |
| 05:24 | LauJensen | I think I'll make a little script which hits every bug tracker in the world, and files the bug "does not support emacs keybindings" - they really should be everywhere |
| 05:24 | tomoj | :D |
| 05:24 | LauJensen | Raynes: So just copy paste the other sites |
| 05:25 | Raynes | Eh. |
| 05:25 | Raynes | I'd rather not. |
| 05:25 | LauJensen | just link they CSS and use the same classes :) |
| 05:25 | Raynes | I'd rather it be ugly than just copy and paste someone else's work. Believe it or not, I worked my ass of on that site, ugly or not. |
| 05:25 | Raynes | :p |
| 05:26 | zmila | tryclojure is good. i'll use it when smth small need to be checked. in order to not start the whole Eclipse |
| 05:26 | Raynes | I needed the experience, and that's why Licenser made his fork. He can make his "official" if he wants, and put it on try-clojure.org. |
| 05:26 | LauJensen | Raynes: ok, here's my suggestion. Make the background white. Remove everything but the evaluation box, and but that in a div which has a background: transparent url(/something/with/a/nice/border.png) no-repeat top left. And thats it. Simple and beautiful |
| 05:27 | Raynes | Would be kind of lonely. |
| 05:27 | esj | second that - make it look like a goole page |
| 05:27 | esj | s/goole/google/ |
| 05:27 | sexpbot | second that - make it look like a google page |
| 05:30 | zmila | ,(assoc {} [3 #{1 2 3}] 100) |
| 05:30 | clojurebot | {[3 #{1 2 3}] 100} |
| 05:30 | zmila | tryclojure fails to eval "(assoc {} [3 #{1 2 3}] 100)" => ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IFn |
| 05:31 | Raynes | I already had plans to do something like that. With some added stuff below all that, like the other pages, with links and such. |
| 05:31 | Raynes | On the right, there is a message that says "This site is not finished" or something similar. |
| 05:31 | Raynes | Once it's gone, you can whine about ugliness all you want. :p |
| 05:32 | Raynes | zmila: Probably problems with URL encoding. I'll fix that later. I need a break. |
| 05:32 | tomoj | Raynes: good work! someday we will have a nice in-browser tutorial to wow people with |
| 05:37 | zmila | yes, Raynes. just simple "#{1}" fails, but only "#{}" is ok |
| 05:38 | Raynes | tomoj: Meh, not good enough. |
| 05:38 | tomoj | well, like you said, it's not done yet |
| 05:39 | zmila | i even don't need to open the page, just type the url ending with the expr :) |
| 05:40 | zmila | http://tryclj.licenser.net/magics?code=%28range%200%201000%29 |
| 05:40 | zmila | nice! |
| 05:40 | Raynes | Oh, cool. That's kind of an implicit API. |
| 05:40 | Raynes | :p |
| 05:41 | Raynes | Or an accidental API. |
| 05:42 | zmila | i can calculate with google just from firefox address bar |
| 05:42 | zmila | and now eval clojure |
| 05:55 | cgrand | Raynes: late pong |
| 05:55 | Raynes | Wasn't that like a day or two ago? >_> |
| 05:56 | Raynes | I think I was going to ask you why Moustache still requires clojure/contrib 1.1.0-master-SNAPSHOT |
| 05:56 | Raynes | Oops. |
| 05:57 | Raynes | ^ wrong channel. |
| 05:57 | Raynes | The oops was in the wrong channel, that is. |
| 06:10 | Raynes | zmila: That isn't my bug! :D |
| 06:10 | Raynes | zmila: That's a clj-sandbox bug. |
| 06:10 | Raynes | $eval #{1} |
| 06:10 | sexpbot | java.lang.Integer cannot be cast to clojure.lang.IFn |
| 06:10 | zmila | good :) |
| 06:11 | Raynes | Well, I guess that does make it my bug. :| |
| 06:11 | Raynes | But not a tryclojure bug. |
| 06:12 | tomoj | $eval #{+ 2 3} |
| 06:12 | sexpbot | java.lang.Integer cannot be cast to clojure.lang.IFn |
| 06:14 | tomoj | $eval #{'list list} |
| 06:14 | sexpbot | result: |
| 07:25 | tomoj | Licenser_: you around? |
| 07:25 | tomoj | Raynes: or you? |
| 07:26 | Raynes | I'm here. |
| 07:33 | tomoj | that was a premature ejaculation, sorry |
| 07:38 | tomoj | $eval *print-level* |
| 07:38 | sexpbot | DENIED! |
| 07:39 | tomoj | Raynes: ok, ready, I guess :/ |
| 07:40 | Raynes | ? |
| 07:40 | tomoj | thought I could do more but I'm giving up |
| 07:40 | tomoj | http://tryclj.licenser.net/magics?code=*print-level* |
| 07:41 | Raynes | Is there a question here or something? :o I'm confused. |
| 07:41 | tomoj | you work on clj-sandbox, right? |
| 07:41 | Raynes | Yeah. |
| 07:41 | tomoj | http://tryclj.licenser.net/magics?code=*print-length* |
| 07:42 | tomoj | *print-level* is no longer blacklisted (or is now whitelisted, whichever) on your tryclojure |
| 07:43 | Raynes | I haven't modified those in any way, so I guess it must be whitelisted in the default tester. |
| 07:43 | tomoj | ok, now it is again |
| 07:43 | tomoj | no, I did this |
| 07:43 | tomoj | want me to PM you or do you trust #clojure? :) |
| 07:44 | Raynes | Oh, wait, you broke it? |
| 07:44 | Raynes | See, you didn't say that. |
| 07:44 | Raynes | :p |
| 07:44 | Raynes | PM me. |
| 07:52 | tomoj | too bad it doesn't work on def |
| 07:56 | zmila | setting print-len is "Disabled for security purposes." |
| 07:56 | Raynes | tomoj: Licenser is working for that. |
| 07:56 | Raynes | zmila: Sure is. :p |
| 07:57 | zmila | but how about asking your magic api for (range 0 1000000000000000) ?-) |
| 07:57 | Raynes | Feelin' lucky? Punk? Go for it. |
| 07:57 | Raynes | :p |
| 07:58 | Raynes | HOLY SHIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIITimeout. |
| 07:58 | tomoj | oh, so even with *print-length* whitelisted, you're safe? |
| 07:59 | Raynes | tomoj: It actually isn't whitelisted. I don't know why it's going through. |
| 07:59 | Raynes | Maybe another bug. |
| 07:59 | tomoj | hrmm, I need to work harder :P |
| 07:59 | tomoj | yeah, the bug I just told you about in PM |
| 07:59 | Raynes | Oh yeah. |
| 08:00 | Raynes | Sorry, I've been awake for a while. |
| 08:00 | Raynes | :p |
| 08:00 | tomoj | oh, I think I can whitelist defn too |
| 08:00 | tomoj | but maybe when it expands to def, that'll be blocked even so? |
| 08:02 | tomoj | yep :( |
| 08:02 | Raynes | I think so. |
| 08:03 | tomoj | and since def is a special form there's nothing I can do about it, oh well |
| 08:14 | tomoj | http://tryclj.licenser.net/magics?code=(net.licenser.sandbox.box43527/tomoj) |
| 08:16 | tomoj | ok, I'm done, sorry :( |
| 09:00 | webar7 | can someone make #clojure run on python or parrot instead of java :P |
| 09:01 | Chousuke | yes, but will someone? I dunno :P |
| 09:02 | Hodapp | gnu lightning ftw |
| 09:02 | Hodapp | webar7: was that the sound of you volunteering to port it? |
| 09:05 | webar7 | I have such pain building/installing java on freebsd ... sigh |
| 09:06 | webar7 | Hodapp, ok ... as long as I know it's technically feasible :) |
| 09:06 | Chousuke | it'll probably become a lot easier as the java parts get rewritten in Clojure |
| 09:07 | Chousuke | but it's probably not going to happen tomorrow :) |
| 09:07 | eevar2 | webar7: there's no openjdk for freebsd? |
| 09:08 | Chousuke | Though as far as I understand the situation, when 1.2 is released clojure should have all the tools necessary to do it. |
| 09:09 | webar7 | Hodapp, I'm like Jim Carrey in that movie where when faced with 1000000 to 1 odds he says "I've got a chance!!" |
| 09:10 | Hodapp | hmmmm |
| 09:15 | SynrG | webar7: what, i can get clojure to work on OpenVMS but freebsd is a no go? i find that amusing :) |
| 09:15 | webar7 | haha |
| 09:16 | SynrG | http://www.freebsd.org/java/ says there are binaries ... |
| 09:16 | sexpbot | "FreeBSD Java™ Project" |
| 09:19 | webar7 | yeah ... they sort of work |
| 09:20 | eevar2 | SynrG: i assume it's as simple as port install openjdk6 |
| 09:20 | webar7 | it';s more that when I read you can do lisp type programming in clojure but then "do anything you can do in java" by calling out to the jvm I thought: "but I don't wanna do java" hahah |
| 09:21 | webar7 | but anyway it shore is cooool |
| 09:21 | SynrG | still waiting for clojure in clojure, hm? |
| 09:21 | webar7 | and it's gonna work on appengine :) |
| 09:22 | chouser | clojure-in-clojure will still let you do anything you can do in java |
| 09:23 | eevar2 | it will also still run on / depend on the jvm |
| 09:23 | chouser | right |
| 09:24 | chouser | it will make it easier to port to other hosts, but will not itself be a host. |
| 09:25 | defn | f |
| 09:25 | defn | clojure is three languages |
| 09:26 | webar7 | chouser, other hosts like other vms? |
| 09:26 | chouser | right |
| 09:27 | chouser | javascript, golang, parrot, etc. |
| 09:28 | defn | the environment of the hostess defines the freedom of her hosts |
| 09:28 | chouser | defn: which three? |
| 09:29 | defn | chouser: i was just thinking of the motivations for learning clojure |
| 09:29 | Hodapp | hm, I wonder if I could program Processing in Clojure |
| 09:29 | Hodapp | as it's basically just Java |
| 09:29 | Hodapp | but straight Java makes me want to cry sometimes |
| 09:29 | defn | you have your passionate "compelled" force of nerds, you have your "tickled by the idea" nerds, and you have the "we're in it for the white paper" nerds |
| 09:30 | Hodapp | white paper?! where? |
| 09:30 | defn | you also have the "hedging my bets" nerds who insist on learning haskell, erlang, scala, AND clojure |
| 09:31 | arkahn | I want a t-shirt that says "I'm in it for the whitepaper" |
| 09:31 | defn | hahahaha yes! |
| 09:31 | Hodapp | where do the "C++ is the only language you'll ever need, and it's beautiful" nerds fit in? |
| 09:31 | defn | "I went to grad school, and all I got is this lousy whitepaper." |
| 09:31 | chouser | Hodapp: http://data-sorcery.org/2009/08/30/processing-intro/ |
| 09:31 | sexpbot | "Creating Processing Visualizations with Clojure and Incanter « Data Sorcery with Clojure" |
| 09:31 | Hodapp | HELLZ YEAH |
| 09:33 | Hodapp | I'm on my netbook so it was easier to ask rhetorically in here than to switch windows and ask Google |
| 09:34 | chouser | netbook ftw? |
| 09:35 | defn | knowing what irc is, is half the battle |
| 09:36 | Hodapp | pdk: #zdoom is that way. |
| 09:37 | Hodapp | pdk: unless, of course, you're not that pdk. |
| 09:47 | neotyk | Hi |
| 09:47 | neotyk | to get clojure current clojure 1.2 what are version strings for lein? |
| 09:47 | neotyk | both clojure and contrib |
| 09:48 | tomoj | 1.2.0-master-SNAPSHOT for clojure |
| 09:48 | tomoj | 1.2.0-SNAPSHOT for contrib |
| 09:48 | jfields_ | anyone have a good idea on how to split this "34HD1209,ADSK,"-2,539","-83,203",25,0,0" into this ["34HD1209" "ADSK" "-2,539" "-83,203" "25" "0" "0"] |
| 09:48 | neotyk | tomoj: thanks |
| 09:50 | drewr | jfields_: you sure you don't mean ["34HD1209, ADSK" ...]? |
| 09:50 | tomoj | would be easier to understand if you escaped the inner quotes, I think |
| 09:51 | drewr | nm, missed a level of quoting there |
| 09:51 | drewr | anyway, you'd probably be best served by using a csv parsing lib |
| 09:51 | drewr | supercsv and opencsv are both pretty good |
| 09:52 | tomoj | http://github.com/davidsantiago/clojure-csv hmm |
| 09:52 | jfields_ | drewr: sorry, I guess that wasn't clear. The line '34HD1209,ADSK,"-2,539","-83,203",25,0,0' is in a file, and includes the inner quotes, but not the outer ones I added. |
| 09:53 | chouser | jfields_: re-seq |
| 09:55 | jfields_ | chouser: the commas within the quotes make a regex seem... complicated. |
| 09:55 | chouser | :-) yes |
| 09:56 | chouser | ,(map (fn [[_ a b]] (or a b)) (re-seq #"([^\",]+)|\"(.*?)\"" "34HD1209,ADSK,\"-2,539\",\"-83,203\",25,0,0")) |
| 09:56 | clojurebot | ("34HD1209" "ADSK" "-2,539" "-83,203" "25" "0" "0") |
| 09:57 | chouser | though a csv lib may be better |
| 09:57 | drewr | tomoj: I tried that lib a while back but it's not quite industrial enough for everyday work |
| 09:57 | jfields_ | chouser: hah. thanks. |
| 09:57 | tomoj | too bad |
| 09:58 | drewr | tomoj: doesn't handle the kinds of quoting issues one finds in the real world |
| 09:59 | arkahn | "data sorcery with chouser" - I'm copying that solution into my notes for future reference. In solving it, I had gotten as far as using re-seq and scratching the surface with some REs ; ) |
| 10:03 | _na_ka_na_ | hello |
| 10:03 | _na_ka_na_ | is there an easy way to get a random element out of a set |
| 10:04 | chouser | arkahn: regex knowledge is highly transferrable among modern languages and environments |
| 10:04 | _na_ka_na_ | one way could be (first (shuffle set)) ... but its overkill |
| 10:04 | chouser | (doc rand-nth) |
| 10:04 | clojurebot | Titim gan éirí ort. |
| 10:04 | tomoj | perhaps (rand-nth (seq #{..})) ? |
| 10:04 | _na_ka_na_ | hmm.. thx lemme chk |
| 10:04 | tomoj | ehh |
| 10:04 | chouser | clojurebot's running a rather old clojure |
| 10:05 | _na_ka_na_ | is it not in 1.1? |
| 10:05 | tomoj | sucks that you have to convert to something other than a set, and if it's seq you get linear time to walk to the nth, no? |
| 10:05 | _na_ka_na_ | or seq-utils 1.1? |
| 10:05 | chouser | tomoj: yeah |
| 10:05 | tomoj | and I guess converting a set to a vector isn't all that attractive either |
| 10:06 | chouser | nope, still O(n) |
| 10:06 | arkahn | chouser: thankfully I have regex experience from other languages, though just the regex stuff you wrote would have taken me a bit longer to think up. : ) Nicely done. |
| 10:06 | _na_ka_na_ | if there were a lazy shuffle .. then one could do (first (shuffle )) .. but the shuffle in seq-utils isn't lazy? |
| 10:07 | raek | (defn random-of [coll] (nth coll (rand-int (count coll)))) |
| 10:07 | raek | this is how I ended up solving it |
| 10:07 | _na_ka_na_ | this is O(n) .. |
| 10:08 | chouser | you really want a set here, for other reasons? rand-nth on a vector should be nearly O(1) |
| 10:08 | _na_ka_na_ | ya set is required as i want only distinct elems |
| 10:09 | chouser | ,(counted? (seq #{:a :b})) |
| 10:09 | clojurebot | false |
| 10:09 | chouser | meh |
| 10:10 | _na_ka_na_ | hmm.. |
| 10:14 | arkahn | does that mean that (count #{:a :b}) has to go through all n items to find the count or does it keep track as part of adds/removes in the data structure? |
| 10:15 | _na_ka_na_ | it has to traverse the whole set .. :/ |
| 10:16 | _na_ka_na_ | well w/o O(1) count, we can't even implement a lazy shuffle ?? |
| 10:16 | _na_ka_na_ | wait a min.. does lazy shuffle even make any sense? |
| 10:17 | chouser | ,(counted? #{:a :b}) |
| 10:17 | clojurebot | true |
| 10:17 | _na_ka_na_ | how? |
| 10:17 | clojurebot | with style and grace |
| 10:18 | chouser | arkahn: no, (count #{:a :b}) is O(1) because sets know their size. What I was checking was if the seq of a set also knows its size. It could, but apparently it doesn't. |
| 10:18 | arkahn | chouser: ok - thank you |
| 10:18 | _na_ka_na_ | hmm ok .. |
| 10:18 | chouser | ok, so rand-nth calls count on the collection (set in this case) directly. |
| 10:19 | chouser | I'm confusing myself. Ignore that. |
| 10:19 | _na_ka_na_ | can you please tell me where to find rand-nth |
| 10:20 | chouser | (rand-nth (seq a-set)) means rand-nth will count the seq, which because it's not counted will walk the whole thing. |
| 10:20 | chouser | _na_ka_na_: rand-nth is in 1.2-snapshot (git master). There's something similar (maybe rand-elt?) in contrib |
| 10:21 | _na_ka_na_ | hmm thx chouser |
| 10:22 | _na_ka_na_ | ,(source rand-elt) |
| 10:22 | clojurebot | java.lang.Exception: Unable to resolve symbol: source in this context |
| 10:22 | _na_ka_na_ | its thr .. but same as above (defn rand-elt |
| 10:22 | _na_ka_na_ | "Return a random element of this seq" |
| 10:23 | _na_ka_na_ | [s] |
| 10:23 | _na_ka_na_ | (nth s (rand-int (count s)))) |
| 10:26 | chouser | But even if set-seq were counted, nth on the seq would still have to walk, so technically O(n) |
| 10:26 | chouser | I can't see how to do any better than O(n) unless some clojure collection type directly supported rand-nth |
| 10:27 | chouser | PersistentSet could walk its internal tree choosing a random branch at each level and give you O(log32 n) |
| 10:28 | chouser | but ... you know what, that wouldn't be evenly distributed across the leaf nodes. |
| 10:29 | _na_ka_na_ | hmm .. i see what you're saying |
| 10:32 | chouser | you'd have to know the size of each branch to balance the upper choices, and I don't think sets or sorted-sets know that |
| 10:33 | neotyk | does de.kotka.lazymap work with clojure 1.2? |
| 10:33 | chouser | a finger tree could. you might be able to get set-like behavior out of a finger tree, and still get O(log2 n) random lookups |
| 10:36 | zakwilson_ | Is there a way to kill a future that's still computing? |
| 10:36 | zakwilson_ | Aside from (shutdown-agents) |
| 10:37 | chouser | future-cancel |
| 10:37 | zakwilson_ | Why didn't I notice that in the autocompletions? |
| 10:38 | tomoj | apparently future-cancel will not kill a process spawned with Runtime exec |
| 10:41 | tomoj | maybe with a finally it could |
| 10:47 | zakwilson_ | Anybody have experience with EC2? I have some compute-intensive Clojure code and I'm wondering how much faster it would run on a high-CPU XL instance than on my laptop. |
| 10:58 | zakwilson_ | Do futures have a timeout? |
| 10:59 | chouser | looks like you can have a timeout on the 'get' |
| 11:00 | zakwilson_ | I ran (def the-future (future (a-process-that-takes-hours))) and it stopped after a few minutes |
| 11:00 | zakwilson_ | future-done? says it's done, and its value is nil (should be true if it completed) |
| 11:03 | mikem | maybe (a-process-that-takes-hours) terminated early with a nil? |
| 11:05 | zakwilson_ | Can't happen. It could throw an exception, but not return nil. |
| 11:10 | patrkris | zakwilson_: and you're sure that it didn't throw an unhandled exception? |
| 11:10 | webar7 | anything can happen :) |
| 11:10 | zakwilson_ | patrkris: No. I'm sure it didn't return nil, but it may have thrown an unhandled exception. |
| 11:11 | patrkris | zakwilson_: you can probably inspect *e to see the last unhandled exception |
| 11:11 | patrkris | and use the stuff under clojure.stacktrace |
| 11:11 | Raynes | http://tryclj.licenser.net/ With the help of LauJensen, I/we've completely redesigned TryClojure. Note that there are a few bugs in clj-sandbox that make the repl a bit less useful than it will be eventually. You can't def* anything, and there seems to be a bug with sets containing integers that Licenser and I will work on later, but all in all, it works. |
| 11:12 | zakwilson_ | patrkris: I didn't know about *e. The last unhandled exception was an attempt to access an undefined variable at the REPL before the future was created. |
| 11:16 | patrkris | zakwilson_: ok, probably wasn't an unhandled exception then :) |
| 11:16 | patrkris | well it was, but not in your future |
| 11:18 | wahz | hi; what does "call to contains can't be resolved" refer to when using protocols and records in clojure 1.2? |
| 11:19 | stuartsierra | wahz: are you calling 'contains?' on a record object? |
| 11:20 | zakwilson_ | There are no unhandled exceptions in my future? Thank you, oh great psychic. Now I don't have to do any testing! |
| 11:20 | wahz | no, I don't call 'contains?' directly |
| 11:42 | stuartsierra | wahz: maybe something else is calling it, that would be my guess |
| 11:47 | wahz | I use a record field as a test in a 'cond'; could that be causing it perhaps? |
| 11:49 | stuartsierra | I don't think so... |
| 11:49 | wahz | okay, thanks |
| 12:30 | wahz | goodnight; and for anyone else in Australia, go to bed! :) |
| 13:02 | giacecco | hi all |
| 13:04 | giacecco | anyone wants to give me a hand with a strange ant script? |
| 13:07 | giacecco | anyone wants to give me a hand with a strange ant script? |
| 13:48 | jfields | is there something more simple than this: (Integer/parseInt (apply str (filter #(not= \, %) "2,000"))) |
| 13:50 | chouser | (remove #{\,} "2,000") |
| 13:50 | chouser | ,(remove #{\,} "2,000") |
| 13:50 | clojurebot | (\2 \0 \0 \0) |
| 13:50 | chouser | ,(.replace "2,000" "," "") |
| 13:50 | clojurebot | "2000" |
| 13:51 | chouser | ,(Integer/parseInt (.replace "2,000" "," "")) |
| 13:51 | clojurebot | 2000 |
| 13:51 | chouser | ,(Integer. (.replace "2,000" "," "")) |
| 13:51 | clojurebot | 2000 |
| 13:52 | jfields | chouser: thanks man. if it makes you feel better, I'm reading your book. so thanks for always answering my questions :) |
| 13:52 | chouser | heh. great! |
| 13:53 | chouser | some people read slashdot to break up monotany at work. I answer #clojure questions. |
| 13:57 | cemerick | hrm, I see the pause-after-script-is-done issue is still there |
| 13:58 | cemerick | related to non-daemon agent threads IIRC |
| 14:10 | naeu | how might i take a list and create a new list with each item passed through a function and put into an inner list: [1 2 3 4 5] -> [[2] [4] [6] [8] [10]] |
| 14:11 | chouser | those are vectors |
| 14:11 | chouser | ,(for [i [1 2 3 4 5]] [(* 2 i)]) |
| 14:11 | clojurebot | ([2] [4] [6] [8] [10]) |
| 14:14 | naeu | ah, i had forgotten about for |
| 14:14 | naeu | I've not managed to get comfortable with it in a functional context yet |
| 14:14 | naeu | chouser: thanks |
| 14:15 | chouser | the choice between map/filters and for (for me anyway) is based on a bunch of vague preferences and unrelated details |
| 14:16 | chouser | in this case, wanting to produce an inner vector pushed me towards for |
| 14:16 | tcrayford | you can use map I guess |
| 14:16 | chouser | ,(map #(vector (* 2 %)) [1 2 3 4 5]) |
| 14:16 | clojurebot | ([2] [4] [6] [8] [10]) |
| 14:16 | tcrayford | aye |
| 14:16 | tcrayford | I just like being able to switch preferences like that automatically where it makes sense |
| 14:17 | tcrayford | automatically threading stuff through ->>/-> (and unthreading) has been a nice thing for me |
| 14:17 | TimMc | I'd like to get started with Clojure + Compojure, but I can't find much about how to structure a project + build files. |
| 14:17 | chouser | tcrayford: yeah, those sound handy |
| 14:17 | chouser | ,(reduce #(conj %1 (vector (* 2 %2))) [] [1 2 3 4 5]) |
| 14:17 | clojurebot | [[2] [4] [6] [8] [10]] |
| 14:17 | tcrayford | TimMC: using lein? |
| 14:18 | TimMc | tcrayford: I see that lein exists, but I don't know what to do with it. |
| 14:18 | tcrayford | chouser: that paper on fold linked in the joy of clojure was so damn cool |
| 14:18 | tcrayford | TimMc: download it, install it |
| 14:18 | TimMc | tcrayford: Done. |
| 14:18 | tcrayford | then run `lein new` somewhere |
| 14:18 | tcrayford | with the name of the project |
| 14:19 | tcrayford | `lein new myfirstcompojure` or summat |
| 14:19 | tcrayford | chouser: I've been meaning to translate that paper into clojure and put it up on a blog, might do that soon |
| 14:19 | TimMc | OK, I'll explore that, thanks. |
| 14:20 | tcrayford | I have it |
| 14:20 | TimMc | Can I get that integrated with an IDE like Eclipse? |
| 14:20 | tcrayford | one sec |
| 14:20 | chouser | "A Tutorial on the Universality and Expressiveness of fold" by Graham Hutton ? |
| 14:20 | tcrayford | http://www.cs.nott.ac.uk/~gmh/fold.pdf |
| 14:20 | tcrayford | yeah that one |
| 14:21 | TimMc | I mean, if I want to write a Java app, I just fire up Eclipse or NetBeans and create a project, and *BAM* I'm ready to go. Anything like that? |
| 14:21 | tcrayford | TimMc: not at the moment iirc |
| 14:21 | tcrayford | not with lein anyway |
| 14:21 | tcrayford | you can do it with maven and any of the java ide's with a clojure plugin |
| 14:21 | tcrayford | but I don't know too much about that |
| 14:21 | TimMc | OK, so it's not just poor google-fu on my part. |
| 14:21 | chouser | tcrayford: I haven't read it. All references to scholarly works are because of Fogus. |
| 14:22 | tcrayford | chouser: its really nice |
| 14:22 | technomancy | tcrayford: actually you can have it spit out a pom, which then the IDEs can generally figure out |
| 14:22 | technomancy | (not that I've tried) |
| 14:22 | chouser | tcrayford: it does look interesting. I'd probably rather read your blog than the haskell in there though. :-) |
| 14:22 | tcrayford | technomancy: not that you would try :P |
| 14:22 | jfields | it's not possible to destructure when using %1, correct? |
| 14:22 | jfields | I need to stick with (fn) if I want to destructure, right? |
| 14:23 | tcrayford | chouser: the nice part is when he defines filter and map in terms of reduce |
| 14:23 | clojurebot | map is lazy |
| 14:23 | tcrayford | for me anyway |
| 14:23 | wooby | anyone getting a reader missing parens w/ clojure test mode recently? |
| 14:23 | tcrayford | are you using 1.2 |
| 14:23 | tcrayford | ? |
| 14:24 | chouser | clojurebot: yes, but in haskell everything is. |
| 14:24 | clojurebot | Huh? |
| 14:24 | tcrayford | you need to grab the latest source off of technomancy's github, otherwise it breaks |
| 14:24 | chouser | jfields: right, fn or let |
| 14:24 | jfields | chouser: thanks |
| 14:25 | jfields | I have a map and I want to apply a fn to every val and return the map. The best I could come up with was: (reduce (fn [map [k v]] (assoc map k (* 2 v))) {} {:a 1 :b 2}) |
| 14:25 | wooby | tcrayford, thanks |
| 14:26 | tcrayford | wooby: I got bit by that a couple of days back, because I had a forked test-mode with a red/green bar thing (that I've now gotten rid of) |
| 14:27 | chouser | ,(let [m {:a 1 :b 2}] (zipmap (keys m) (map inc (vals m)))) |
| 14:27 | clojurebot | {:b 3, :a 2} |
| 14:28 | chouser | ,(let [m {:a 1 :b 2}] (into {} (map (fn [[k v]] [k (inc v)]) m))) |
| 14:28 | clojurebot | {:a 2, :b 3} |
| 14:29 | wooby | tcrayford, ah yes i was tempted to try that thing also |
| 14:30 | tcrayford | wooby: it broke occasionally, and wasn't actually that useful, so its been dropped |
| 14:30 | technomancy | the clojure-test-mode fix has been submitted to elpa, just waiting for upload |
| 14:30 | tcrayford | does it still work with 1.0 & 1.1? |
| 14:32 | technomancy | tcrayford: no, you need clojure-test-mode 1.2 for clojure 1.0 support |
| 14:32 | tcrayford | but 1.1 is still fine? |
| 14:34 | technomancy | ja |
| 14:35 | tcrayford | no worries here then, I didn't really get into proper projects until 1.1 was the standard |
| 14:38 | TimMc | Feh, I still can't get lein to run properly. Self-install worked, but if I try to do anything else, it fails with a clojure/main not found error. :-( |
| 14:45 | TimMc | This looks promising, though: http://vimeo.com/8934942 |
| 14:45 | sexpbot | "Episode 8 - Projects on Vimeo" |
| 14:46 | TimMc | ("Full Disclojure") |
| 15:04 | tcrayford | also cake is already taken for some other language |
| 15:04 | ninjudd | pie? |
| 15:04 | technomancy | the cake is a lie. |
| 15:05 | tcrayford | the cake is spy! |
| 15:05 | tcrayford | (to be said in a Heavy [TF2] accent) |
| 15:05 | TimMc | technomancy: Boy, am I glad to see you! I'm getting "NoClassDefFoundError: clojure/main" whenever I try anything with lein other than self-install. |
| 15:05 | ninjudd | cake is build system that only works for windows and cygwin? that hardly counts |
| 15:06 | TimMc | This is a Win 7 64-bit system, via Cygwin. |
| 15:06 | ninjudd | http://sourceforge.net/apps/trac/cake-build |
| 15:06 | sexpbot | "Cake Build System" |
| 15:06 | technomancy | TimMc: I think there are some outstanding issues with cygwin support. not sure of the details myself. I have some patches I need to look at for that; it should improve for the 1.2 release. |
| 15:07 | technomancy | TimMc: you might try teropa's fork |
| 15:07 | TimMc | I'm stuck on Win 7 here at work -- recommendations for alternatives? |
| 15:08 | technomancy | you could try lein.bat too. it's more manual but better-tested. |
| 15:08 | tcrayford | vmware/linux? |
| 15:08 | TimMc | Urgh. |
| 15:08 | technomancy | robwolfe is my go-to man for Windows issues; too bad he's not online. |
| 15:09 | TimMc | Thanks for the help! |
| 15:10 | TimMc | We're exploring using Clojure for a web app, but getting a dev environment set up has been tricky. |
| 15:11 | tcrayford | I'd reccomend it if you do. I wrote a fairly substantial webapp in compojure and enjoyed it a lot |
| 15:12 | TimMc | Note: teropa's fork doesn't help |
| 15:12 | TimMc | Yeah, it *looks* fun, and I have fond memories of Scheme, but... bleh. |
| 15:12 | tcrayford | yeah, clojure's tooling support on windows is kinda lacking |
| 15:13 | tcrayford | you tried one of the ides properly yet? |
| 15:13 | cemerick | TimMc: If you're not liking lein, there's clojure-maven-plugin. Not so popular with some, but pretty darn solid IMO. |
| 15:13 | tcrayford | cemerick: didn't you have a blog post about using that and compojure somewhere? |
| 15:13 | TimMc | You know what would be a really *awesome* Getting Started guide? A .zip/.tgz with toll install instructions, a build file, and an eclipse workspace premade. :-P |
| 15:13 | TimMc | *tool |
| 15:14 | cemerick | tcrayford: yeah... muckandbrass.com/chas will lead you there |
| 15:14 | TimMc | cemerick: I think I like lein, it just doesn't like me. |
| 15:14 | tcrayford | cemerick: mostly this for TimMc's benefit |
| 15:15 | cemerick | TimMc: If you're already in eclipse, then maven would presumably be the easier path. |
| 15:15 | TimMc | True. |
| 15:15 | cemerick | I've not used the clojure plugin there yet though. |
| 15:15 | cemerick | ouch ;-) |
| 15:15 | tcrayford | eclipse's ccw is meant to be pretty good, has paredit and some other nice things |
| 15:16 | tcrayford | I need to pick an ide to work refactoring-mode into soon |
| 15:16 | cemerick | tcrayford: that's what I hear; I plan on giving it a run, as well as intellij's sometime shortly |
| 15:16 | TimMc | We're a Java shop, so Eclipse and Maven are embraced. |
| 15:16 | cemerick | although what I see re: e4 sounds pretty good, so that might prejudice things a little. |
| 15:17 | jfields | any idea what this means: Exception in thread "main" java.lang.AbstractMethodError: org.apache.log4j.helpers.FileWatchdog.doOnChange()V |
| 15:19 | tcrayford | that's just a java error no? |
| 15:19 | jfields | yeah, I'm trying to implement an abstract class, but when it gets to the Template Method (which is abstract) it throws that exception |
| 15:20 | jfields | (proxy [FileWatchdog] [path] |
| 15:20 | jfields | (doOnChange [] |
| 15:20 | jfields | (println "changed"))) |
| 15:21 | tcrayford | is the signature correct? |
| 15:21 | jfields | it's a no-arg method call, so as far as I can tell, yes. |
| 15:22 | tcrayford | I ain't got much then. |
| 15:24 | dakrone | is there a way to unroll a sequence without apply? I want something like (foo (unroll [1 2 3])) -> (foo 1 2 3) |
| 15:24 | tcrayford | why the dislike of apply? |
| 15:25 | kotarak | dakrone: (eval `(foo ~@[1 2 3])), *yuk* |
| 15:25 | dakrone | because I don't want it to actually be applied |
| 15:25 | dakrone | I need to unroll things for java interop inside a macro |
| 15:25 | tcrayford | kotarak: that's ugly :( |
| 15:25 | kotarak | ,(list `foo [1 2 3]) |
| 15:25 | clojurebot | (sandbox/foo [1 2 3]) |
| 15:25 | kotarak | ,(list* `foo [1 2 3]) |
| 15:25 | clojurebot | (sandbox/foo 1 2 3) |
| 15:26 | kotarak | dakrone: list* is what you want, then. |
| 15:26 | dakrone | kotarak: cool, thanks |
| 15:27 | kotarak | (defmacro to-string [& args] (list* '.toString args)) |
| 15:27 | kotarak | dakrone: similar to apply: (list* :a :b :c [:d :e :f]) |
| 15:28 | dakrone | kotarak: that does the trick for this, awesome! :) |
| 15:28 | kotarak | dakrone: glad it helps |
| 15:29 | kotarak | in fact apply does use list* internally: (apply f a b c d) => (.applyTo f (list* a b c d)) |
| 15:30 | dakrone | here's how I'm using it: http://gist.github.com/401546 |
| 15:33 | tcrayford | is reduce lazy? |
| 15:33 | stuartsierra | no |
| 15:33 | jfields | where's the pastie address? |
| 15:34 | stuartsierra | paste.lisp.org |
| 15:34 | tcrayford | cheers |
| 15:35 | jfields | does this work in 1.2?: http://paste.lisp.org/+24KV |
| 15:36 | jfields | it looks like calling an abstract method from the ctor fails in Clojure 1.1 |
| 15:36 | jfields | and I'd like to report it, but not if it's already fixed in 1.2. and I don't have a 1.2 easily available. |
| 15:36 | stuartsierra | I think that will always fail with 'proxy' |
| 15:36 | jfields | oh, it's by design, okay. what should I do instead? |
| 15:37 | stuartsierra | avoid it if possible |
| 15:37 | jfields | would love to, but it's a 3rd party lib. |
| 15:37 | stuartsierra | gen-class *might* work |
| 15:38 | stuartsierra | otherwise, you'll have to write a wrapper in Java |
| 15:39 | stuartsierra | That's an appalling design, by the way. |
| 15:39 | tcrayford | log4j :/ |
| 15:39 | stuartsierra | sheesh |
| 15:39 | tcrayford | jfields: does clojure.contrib.logging help at all? |
| 15:40 | kotarak | dakrone: http://paste.lisp.org/display/99248 |
| 15:40 | jfields | uhm, not sure, why would it? |
| 15:40 | tcrayford | it provides some wrappers around log4j |
| 15:40 | tcrayford | depends on what you're doing |
| 15:41 | stuartsierra | Apache Commons Logging might also help. |
| 15:42 | cemerick | I'm seeing some odd behaviour with interfaces generated with deftype...i.e. (instance? Foo instance) failing even though (class instance) returns Foo (or, something with the name Foo). This anomaly resolves itself if I re-eval the Foo defrecord and recreate the instance.... |
| 15:43 | dakrone | kotarak: you sir, are a gentleman and a scholar |
| 15:43 | dakrone | and you are also really good at making me feel dumb :) |
| 15:43 | kotarak | dakrone: don't feel dump! |
| 15:43 | kotarak | s/b/p |
| 15:43 | dakrone | should have thought of the thresh operator to begin with |
| 16:05 | lancepantz | do lein plugins have to be dev-dependencies? |
| 16:05 | lancepantz | if i make a plugin a regular dependency, will it be transitive? |
| 16:06 | kotarak | But than everyone will get your dependency. Whether they use lein or not. Not the correct use, I think. |
| 16:13 | lancepantz | goo point kotarak |
| 16:14 | lancepantz | *good |
| 16:18 | kotarak | ,1d6 |
| 16:18 | clojurebot | Invalid number: 1d6 |
| 16:18 | kotarak | clojurebot: 1d6 |
| 16:18 | chouser | 1d6 |
| 16:18 | clojurebot | 6 |
| 16:18 | clojurebot | It's greek to me. |
| 16:18 | kotarak | 2d6 |
| 16:18 | clojurebot | 5 |
| 16:18 | kotarak | 6d6 |
| 16:18 | clojurebot | 19 |
| 16:18 | hiredman | 1d2+20 |
| 16:18 | clojurebot | 22 |
| 16:20 | kotarak | ,1.5e6 |
| 16:20 | clojurebot | 1500000.0 |
| 16:21 | kotarak | ,4e0.5 |
| 16:21 | clojurebot | Invalid number: 4e0.5 |
| 16:21 | kotarak | ,1.e6 |
| 16:21 | clojurebot | 1000000.0 |
| 16:25 | kotarak | ,.5 |
| 16:25 | clojurebot | java.lang.Exception: Unable to resolve symbol: .5 in this context |
| 16:27 | ninjudd | kotarak: should lein dev dependencies be transitive across multiple dev dependencies? |
| 16:27 | kotarak | ninjudd: dunno, I don't use lein |
| 16:28 | ninjudd | ha! |
| 16:28 | ninjudd | good man |
| 16:28 | kotarak | ha? |
| 16:28 | kotarak | o.O |
| 16:28 | ninjudd | sometimes i wish i didn't use it |
| 16:29 | kotarak | ninjudd: then - well - don't use it |
| 16:33 | ninjudd | kotarak: do i have to write groovy to use clojuresque? |
| 16:34 | lancepantz | kotarak: this is my first time looking at clojuresque, it looks really cool |
| 16:34 | kotarak | ninjudd: well, you can pretend that it's some arbitrary dsl. For 90% of the projects that's enough. |
| 16:35 | tcrayford | reduce is pretty neat: http://bit.ly/dh2hmm |
| 16:35 | sexpbot | "tcrayford" |
| 16:36 | ninjudd | kotarak: i doubt i'm in the 90% |
| 16:36 | kotarak | ninjudd: just a sec |
| 16:37 | ninjudd | which is why it is so hard to do what i want in lein |
| 16:38 | kotarak | dang. the "usual" paste bin has hiccup. :/ |
| 16:40 | ninjudd | technomancy: are lein dev dependencies transitive across multiple dev dependencies? |
| 16:41 | ninjudd | technomancy: so if B has a dev dep on C and A has a dev dep on B, will A get C in lib/dev? |
| 16:41 | technomancy | ninjudd: no, dev dependencies are not transitive |
| 16:42 | ninjudd | technomancy: seems to me they should be |
| 16:42 | ninjudd | technomancy: otherwise, how can someone make a lein plugin that depends on another lein plugin? |
| 16:43 | technomancy | no, if I use Emacs/swank to develop clojure-http-client, that doesn't mean everyone who uses clojure-http-client should also be forced to download it |
| 16:43 | ninjudd | that's not what i'm saying |
| 16:43 | ninjudd | i'm working on a lein plugin for compiling protocol buffers |
| 16:44 | kotarak | ninjudd: http://pastebin.org/237085 a half-way complicated build script, which defines some subprojects and a custom runNailgun task |
| 16:44 | kotarak | ninjudd: for such custom stuff, you'll have to know a little groovy, but that's a matter of an afternoon |
| 16:45 | ninjudd | how can i get a dev dep for my plugin to be available to someone using my plugin? |
| 16:45 | ninjudd | technomancy: do i have to make it both a dev dep and a regular dep? |
| 16:45 | technomancy | oh, I see. if A has a regular dependency on B and C has a dev dependency on B, C will pull in A on "lein deps" |
| 16:45 | technomancy | because the regular dependency *is* transitive |
| 16:46 | ninjudd | so if i have a dev dep on A, it will pull in B too |
| 16:46 | ninjudd | ok, so in my case i just need to make the library both a dev and regular dep |
| 16:46 | ninjudd | kotarak: cool, i'll take a look |
| 16:48 | stribb | hi there, can someone tell me why all the line numbers in my errors are 0? |
| 16:48 | ataggart | stribb: because the code was entered in at the repl? |
| 16:49 | stribb | no, first arg: java -cp clojure.jar clojure.main ~/clojure/sudoku.clj |
| 16:49 | ataggart | ah, no idea then. |
| 16:49 | lancepantz | stribb: put a pastie up |
| 16:50 | ninjudd | technomancy: problem is that it really is only a dev-dependency, not a regular dependency |
| 16:50 | stribb | lancepantz: of the code or the commandline session? |
| 16:50 | lancepantz | code |
| 16:50 | lancepantz | go ahead and put your trace as well |
| 16:50 | ninjudd | technomancy: so people who aren't doing development will get the dep anyway |
| 16:51 | stribb | http://pastebin.org/237090 # code |
| 16:52 | stribb | http://pastebin.org/237091 # terninal session |
| 16:53 | stribb | (using the stable 1.1 release) |
| 16:55 | kotarak | stribb: http://pastebin.org/237094 |
| 16:56 | stribb | kotarak: so that makes a big array of items then applies to hash-map? cute |
| 16:56 | stribb | but .. the code isn't really my problem right now, it's how to develop it :| |
| 16:56 | kotarak | stribb: well, that was your code. |
| 16:57 | kotarak | stribb: your flatten-pairs is better written as reduce. And your error stems from the missing apply. |
| 16:57 | stribb | ok :) |
| 16:58 | stribb | however, without the hint about which line the bug is on, I'm going to be coding in the dark a little |
| 17:00 | ataggart | that's what makes working in the repl so handy |
| 17:00 | kotarak | stribb: I can only sketch my dev style: I work only in properly set up projects. I edit code in a file and send it from the editor to a clojure server running in the background. Then I do testing from a Repl in my editor. Then the line numbers are always set up correctly. I use Vim with VimClojure. Emacs + SLIME does similar things, and I think enclojure and ccw work similar for the big IDEs. |
| 17:02 | stribb | yeah, I spent a while both on Linux and on the mac here trying to get a slime setup working |
| 17:02 | tcrayford | kotarak: confirm that the big IDE's all have repls |
| 17:02 | tcrayford | stribb: where's the problem? |
| 17:02 | stribb | somewhat stymied by the abundance of erroneous docs |
| 17:03 | kotarak | tcrayford: the problem is called "SLIME" ;) |
| 17:03 | tcrayford | I like SLIME |
| 17:03 | kotarak | tcrayford: but it seems tricky to set up correctly. |
| 17:03 | tcrayford | its not that hard |
| 17:03 | tcrayford | you follow the instructions on lein's readme |
| 17:03 | tcrayford | and use the emacs package manager |
| 17:03 | stribb | it might be easy to set up correctly, but it's hard to debug once it's set up wrong |
| 17:04 | stribb | maybe by using aquamacs I'm going off-piste a bit |
| 17:04 | tcrayford | stribb: what problems are you having? |
| 17:04 | tomoj | I've had more trouble on the mac |
| 17:04 | tomoj | in ubuntu it always works flawlessl/y |
| 17:04 | stribb | keeps waiting to establish a connection |
| 17:04 | tcrayford | are you just running M-x slime? |
| 17:05 | tomoj | gnu emacs for mac seems to work alright, but not great |
| 17:05 | tcrayford | tomoj: there's a fork out there somewhere with fullscreen support |
| 17:05 | tcrayford | tomoj: on github |
| 17:05 | tcrayford | using the cocoa emacs stuff |
| 17:05 | stribb | tcrayford: yes I was |
| 17:06 | tcrayford | stribb: I get that as well |
| 17:06 | tcrayford | just checked |
| 17:06 | tcrayford | I use lein for everything these days though |
| 17:06 | tomoj | cool, I just meant the clojure-mode/slime install process always seems to not work quite right on the mac |
| 17:06 | stribb | it says: java.io.FileNotFoundException: Could not locate swank/swank__init.class or swank/swank.clj on classpath: (NO_SOURCE_FILE:0) |
| 17:06 | stribb | on the inferior-lisp buffer |
| 17:06 | tomoj | that's not an emacs setup problem |
| 17:07 | tomoj | you need lein-swank in your dev-dependencies |
| 17:07 | stribb | spent some tme grepping the net trying to find the file but couldn't |
| 17:07 | tcrayford | tomoj: he's not using lein (I don't think) |
| 17:07 | stribb | I'm not currently using lein |
| 17:07 | tcrayford | I'd reccomend it |
| 17:07 | tcrayford | it removes a lot of pain |
| 17:08 | stribb | I have no aversion to it but I don't yet know what it's about |
| 17:08 | tcrayford | before lein I didn't even use clojure (because of how painful it was) |
| 17:08 | tomoj | what are you using? |
| 17:08 | tomoj | maven? |
| 17:08 | clojurebot | clojure-maven-plugin is http://github.com/talios/clojure-maven-plugin |
| 17:08 | tcrayford | he's just using slime from emacs |
| 17:08 | tomoj | oh... |
| 17:08 | tcrayford | which is sorta deprecated now iirc |
| 17:09 | tomoj | so you need to find a lein-swank jar and copy it in manually |
| 17:09 | tcrayford | nope |
| 17:09 | tcrayford | he needs the swank-clojure jar |
| 17:09 | tcrayford | (which he needs lein to get, yay!) |
| 17:09 | stribb | okay, assuming I can get somewhat comfortable with Clojure, I'd like a comfortabe dev environment to use with emacs |
| 17:09 | tomoj | oh, heh |
| 17:09 | tcrayford | stribb: install lein then |
| 17:09 | stribb | is lein a popular way? |
| 17:09 | stribb | ok |
| 17:10 | tcrayford | yeah |
| 17:10 | tcrayford | something like 90% of the clojure projects on github use lein |
| 17:10 | tcrayford | just make sure you read the wiki article about getting lein setup with slime/swank |
| 17:10 | tomoj | I don't see swank-clojure on clojars |
| 17:10 | stribb | splendid |
| 17:11 | tomoj | oh, there it is |
| 17:11 | tomoj | http://clojars.org/repo/swank-clojure/swank-clojure/1.2.0-SNAPSHOT/swank-clojure-1.2.0-20100502.112537-13.jar |
| 17:11 | stribb | and is there a stable lein? lein 1.1.0 is good? |
| 17:11 | tcrayford | yeah should be fine |
| 17:12 | tcrayford | it has its own updating system (`lein update`) that should help |
| 17:12 | stribb | sorry, I shouldn't need so much hand-holding :( |
| 17:12 | tcrayford | stribb: are you on windows or unix? |
| 17:12 | stribb | no, os x: I couldn't bring myself to call it unix |
| 17:12 | tcrayford | that'll do |
| 17:12 | tcrayford | lein is somewhat icky on windows right now (from what I've heard) |
| 17:12 | tcrayford | see http://www.assembla.com/wiki/show/clojure/Getting_Started_with_Emacs |
| 17:12 | sexpbot | "Getting Started with Emacs | Clojure | Assembla" |
| 17:13 | stribb | thanks |
| 17:13 | tcrayford | but you probably want proper slime right? |
| 17:13 | stribb | ideally |
| 17:13 | tcrayford | with all the nice ide-like features and such |
| 17:13 | tcrayford | right |
| 17:13 | tcrayford | so install lein |
| 17:14 | tomoj | no need to customize inferior-lisp-program when using lein-swank |
| 17:14 | tcrayford | yeah |
| 17:14 | tcrayford | you just run `lein swank` inside a project directory and everything works |
| 17:15 | tcrayford | you have to follow the hacking instructions on lein as well, otherwise you can't use swank |
| 17:18 | stribb | and is the dev version of lein able to work with a stable clojure? |
| 17:18 | tcrayford | yes |
| 17:18 | tcrayford | or a new clojure, or whatever you want |
| 17:18 | stribb | good stuff |
| 17:18 | tcrayford | (I'm using, and happy with 1.2) |
| 17:30 | stribb | bah, |
| 17:30 | stribb | Exception in thread "main" java.lang.IllegalAccessError: flatten is not public (classpath.clj:1) |
| 17:30 | stribb | so I guess lein dev isn't compatible with clojure 1.1 after all |
| 17:31 | tcrayford | is there any reason you want to be using 1.1? |
| 17:31 | stribb | tcrayford: I happen to like stable versions |
| 17:31 | tcrayford | fair nuff |
| 17:32 | stribb | if the git head is stable enough, fine |
| 17:32 | kotarak | tcrayford: 1.2 broke several times pretty hard |
| 17:32 | tcrayford | I have an older version of lein that I use with 1.1, works fine |
| 17:33 | stribb | meh, in for a penny, in for a pound |
| 17:41 | alexyk | ninjudd: so I realized when I tried to convert a defn to defmacro like you suggested yesterday, I have to replace each let [x...] with let [x# ...], along with x's usage, to avoid symbol capture errors, correct? |
| 17:41 | ninjudd | alexyk: yes, that's right |
| 17:42 | alexyk | ninjudd: painful for large defn |
| 17:42 | alexyk | I ended up just doing a functional param to do the guts, even though it's a bit slower with parameter passing |
| 17:43 | ninjudd | alexyk: if you need those let values in the guts though, you have to do symbol capture |
| 17:43 | ninjudd | alexyk: that's probably better. |
| 17:43 | alexyk | ninjudd: using ~'x syntax? |
| 17:43 | alexyk | if I were to do a macro |
| 17:44 | ninjudd | alexyk: right, in the lets, but not where you are using them |
| 17:44 | ninjudd | or you may need it both places... |
| 17:45 | ninjudd | yeah, you do |
| 17:45 | alexyk | ninjudd: so would I say, (let [~'x (make-x)] ... x) ? |
| 17:45 | ninjudd | alexyk: no, i was wrong. it would have to be (let [~'x (make-x)] ... ~'x) |
| 17:45 | alexyk | argh, even uglier |
| 17:46 | ninjudd | that is only if the guts need those let values |
| 17:55 | zakwilson | It appears in my testing that using keywords as map keys is slower than using strings. Why is that? |
| 18:00 | ataggart | microbenchmarks are fun |
| 18:01 | stribb | tcrayford: thanks. It's still not working but I'm tired and I'll get back to it fresh tomorrow |
| 18:01 | stribb | cheerio |
| 18:03 | Drakeson | Do you happen to know why clojure-mode does not enable font-lock-mode by default in recent emacs (24.0.50.1) ? |
| 18:11 | defn | man i wish i could have made it to the pragprog clojure thingamajig |
| 18:11 | defn | all these tweets are making me jealous |
| 18:14 | ataggart | a co-worker I introduced to clojure went |
| 18:14 | ataggart | I'm stuck in the office |
| 18:22 | tcrayford | defn: agreed |
| 19:24 | technomancy | can you compile a binding form that rebinds a var that hasn't been required yet? |
| 19:24 | technomancy | might have to eval there... ugh |
| 20:10 | riddochc | I'm curious... the lancet run-once logic at the end of chapter 6 of programming clojure rules out using any of clojure's built-in concurrency techniques... but it was written pre-futures. |
| 20:11 | riddochc | Anybody revisited lancet lately to rethink the run-once logic? |
| 20:16 | raek | hrm, clojure.lang.Cons is not a list? |
| 20:16 | raek | ,(list? (read-string "'foo")) |
| 20:16 | clojurebot | false |
| 20:16 | scgilardi | you may want seq? |
| 20:17 | raek | ,(class (read-string "'foo")) |
| 20:17 | clojurebot | clojure.lang.Cons |
| 20:17 | raek | I'm trying to reuse the clojure reader |
| 20:17 | raek | for a toy language of mine |
| 20:18 | scgilardi | for detecting "form like things", seq? is the right predicate. |
| 20:18 | raek | ah... |
| 20:19 | raek | the doc of list? is pretty clear... |
| 20:19 | raek | "Returns true if x implements IPersistentList" |
| 20:19 | technomancy | raek: the list? predicate is not really much use. |
| 20:19 | technomancy | you might prefer the seq? predicate |
| 20:19 | technomancy | oh, wups |
| 20:19 | technomancy | yeah, what he said |
| 20:20 | scgilardi | :) |
| 20:20 | raek | my goal is to make a homoiconic stack-based toy language |
| 20:21 | raek | that eventually will be compiled into JVM byte code |
| 20:21 | hiredman | raek: and you get why 'foo is a list to the reader? |
| 20:21 | hiredman | or a seq as the case may ne |
| 20:21 | hiredman | be |
| 20:21 | raek | 'foo -> (quote foo) ? |
| 20:22 | hiredman | right |
| 20:22 | raek | the ' is only syntactic sugar, right? |
| 20:22 | hiredman | right |
| 20:22 | raek | so, I will make a language that is defined in terms of clojure data structures |
| 20:25 | riddochc | Hm. Perhaps lancet isn't really used outside of being a book example, on account of leiningen. |
| 20:26 | lancepantz | riddochc: lancet is pretty dead, aside from the implementation within in lein |
| 20:26 | tomoj | are vectors and maps not "form-like things"? |
| 20:26 | tomoj | ,(seq? '[foo]) |
| 20:26 | clojurebot | false |
| 20:27 | hiredman | tomoj: if you want to be inclusive of "things that don't print in parens" use coll? |
| 20:27 | tomoj | hmm |
| 20:27 | tomoj | then you get more than I want, but maybe that's ok |
| 20:27 | hiredman | no, coll? is IPersistentCollection |
| 20:27 | hiredman | not Collection |
| 20:28 | tomoj | not all IPersistentCollections have literal reader syntax, though, right? |
| 20:28 | hiredman | I believe there are three that don't |
| 20:29 | hiredman | sorted map/set and queue |
| 20:30 | tomoj | ,(eval (-> (clojure.lang.PersistentQueue/EMPTY) (conj '+) (conj 1) (conj 2))) |
| 20:30 | clojurebot | DENIED |
| 20:30 | tomoj | d'oh |
| 20:30 | tomoj | well, it doesn't work |
| 20:30 | tomoj | I guess I'd really want to check specifically for lists, vectors, sets, and maps |
| 20:31 | arohner | what was the name of the fn to reset the methods on a multimethod? |
| 20:32 | tomoj | sorted-sets and sorted-maps self-eval just fine |
| 20:33 | tomoj | actually, they eval to unsorted versions it seems |
| 20:35 | tomoj | Conses eval like PersistentLists |
| 20:37 | tomoj | why is it that you can't use with-meta on a Var? I mean, I know it's because they're not IObjs, but is there a reason for this? |
| 20:38 | technomancy | tomoj: maybe because you can't dup a var? |
| 20:38 | technomancy | since they're not anonymous |
| 20:39 | tomoj | ah, that's why we need reset-meta! and friends I guess |
| 20:39 | technomancy | try vary-meta maybe? |
| 20:39 | tomoj | vary-meta requires IObj too |
| 20:39 | tomoj | (it just calls with-meta) |
| 20:39 | technomancy | alter-meta! is what I meant |
| 20:40 | tomoj | unfortunately clj-sandbox blacklists it |
| 20:40 | tomoj | s/un// |
| 20:40 | sexpbot | fortately clj-sandbox blacklists it |
| 20:57 | maravillas | that looks like a bug with sexpbot |
| 20:57 | tomoj | what does |
| 20:58 | maravillas | removed both "un"s from unfortunately |
| 20:58 | maravillas | even though you didn't add a g flag |
| 20:58 | tomoj | yeah :/ |
| 20:58 | tomoj | imo any output at all there is a bug |
| 20:58 | maravillas | heh |
| 21:00 | tomoj | s/h.h// |
| 21:00 | tomoj | wonder if it only takes literal strings, not regexes? |
| 21:00 | maravillas | hm |
| 21:01 | tomoj | s/w.*f/foo/ |
| 21:01 | sexpbot | hm |
| 21:01 | tomoj | oops |
| 21:01 | tomoj | s/o.*p/foo/ |
| 21:01 | sexpbot | foos |
| 21:01 | tomoj | oh, neat |
| 21:01 | maravillas | http://github.com/Raynes/sexpbot/blob/master/src/sexpbot/plugins/sed.clj i'm assuming |
| 21:04 | lancepantz | anyone use the zenburn theme for emacs? |
| 21:05 | slyphon | i used to |
| 21:05 | slyphon | forget what i'm using now |
| 21:05 | mmarczyk | I do |
| 21:06 | mmarczyk | I remember technomancy posted a zenburn-coloured snippet in the widefinder days, plus zenburn is included with the Emacs Starter Kit, so perhaps he does also :-) |
| 21:06 | lancepantz | does it look like this: http://i.imgur.com/AjtAU.png |
| 21:07 | mmarczyk | nope |
| 21:07 | mmarczyk | http://p.hagelb.org/wide_finder.clj.html |
| 21:07 | sexpbot | "wide_finder.clj" |
| 21:07 | mmarczyk | ^-- that's what it looks like |
| 21:08 | lancepantz | yeah, i didn't think i had it right |
| 21:08 | lancepantz | i'm using his starter kit, do you know how to enable it? |
| 21:08 | mmarczyk | (require 'zenburn) (zenburn), I guess |
| 21:09 | technomancy | lancepantz: M-x zb in the starter kit, but if you invoke it after invoking other color themes it won't look right |
| 21:09 | technomancy | I always do it on a fresh instance. |
| 21:09 | mmarczyk | technomancy: might that mean you use different themes on different occasions? |
| 21:10 | technomancy | mmarczyk: I don't use a color theme when I'm going to be connecting to an instance from emacs -nw, since they usually don't look decent in a terminal |
| 21:10 | mmarczyk | technomancy: incidentally, I am overawed after reading your latest blog entry |
| 21:10 | technomancy | heh, overawed? that wasn't the intention. =) |
| 21:11 | mmarczyk | I keep it open and treat it as a TODO list :-) |
| 21:12 | slyphon | speaking of blog entries, i dunno if everyone had seen this but me, but this had me cracking up earlier today: http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html |
| 21:12 | sexpbot | "One Div Zero: A Brief, Incomplete, and Mostly Wrong History of Programming Languages" |
| 21:12 | mmarczyk | slyphon: yeah! that's cool :-D |
| 21:12 | slyphon | oh man, i was dyin |
| 21:13 | slyphon | i think the python one was my favorite |
| 21:13 | slyphon | "Dutch programmer Guido van Rossum travels to Argentina for a mysterious operation. He returns with a large cranial scar, invents Python, is declared Dictator for Life by legions of followers, and announces to the world that "There Is Only One Way to Do It." Poland becomes nervous." |
| 21:13 | tomoj | putting all the stuff you'd normally put in a wm in something external sounds interesting -- could we do it in clojure? |
| 21:13 | tomoj | need X11 bindings I guess? |
| 21:14 | tomoj | s/stuff/config/ |
| 21:14 | sexpbot | need X11 bindings I guess? |
| 21:14 | tomoj | grr |
| 21:14 | mmarczyk | slyphon: yup, that's a good one :-) |
| 21:14 | technomancy | tomoj: there's an X java library, but it's pretty ancient |
| 21:14 | tomoj | yeah, I tried to find something once before and gave up |
| 21:15 | tomoj | maybe you could have a thin server using a sane X library that clojure talks to? |
| 21:15 | slyphon | tomoj: you're scaring me, what are you considering? |
| 21:15 | mmarczyk | technomancy: out of curiosity, do you find it possible to do stuff for a couple of hours straight at your coding desk...? or do you take breaks often? |
| 21:15 | tomoj | I just would like very much to replace my xmonad config file with clojure |
| 21:15 | lancepantz | technomancy: can you think of why M-x zb would not be matched on my machine? |
| 21:16 | technomancy | mmarczyk: pee breaks mostly. =) but yeah, I sit down for a couple hours a day on average. |
| 21:16 | lancepantz | i tried from terminal, explicitly passing init.el and from aquamacs |
| 21:16 | mmarczyk | technomancy: that's so outlandish I'm dying to try it ;-) |
| 21:18 | technomancy | lancepantz: my bad; that's a personal alias. M-x color-theme-zenburn |
| 21:19 | lancepantz | technomancy: got it, thank you |
| 21:20 | tomoj | slyphon: :P |
| 21:24 | slyphon | argh |
| 21:24 | slyphon | i really hate some rubyists |
| 21:24 | riddochc | slyphon: which rubyists? |
| 21:24 | slyphon | too much focus on "elegance" and "designer eyewear" and not enough focus on "robustness" or "correctness" or even "defensive programming" |
| 21:25 | slyphon | there are too many toys out there |
| 21:25 | riddochc | Ahhh. Evidently, new glasses don't necessarily result in better code. ;) |
| 21:26 | riddochc | I got new glasses last July, around the time I first heard about Clojure. They're not designer glasses, but they do. And I've come to quite enjoy Clojure. |
| 21:26 | tomoj | you want rubyists to publish less code? |
| 21:27 | slyphon | tomoj: there's a tendency in the ruby community to release projects that promise a lot, have a slickly designed project page, and really don't deliver the goods |
| 21:27 | slyphon | there's a real heavy "self-promotion" and "hype" vibe in a lot of the community |
| 21:28 | riddochc | I'd be satisfied if *every* programmer spent a little more time with thinking about what they're doing and testing and such. I think a large part of the problem is independent of language, myself. The industry would be a *very* different place if having good code were more important than being first. |
| 21:28 | slyphon | indeed |
| 21:29 | tomoj | ah, yeah, I see |
| 21:29 | slyphon | i mean, not anything against this lib |
| 21:29 | slyphon | http://outoftime.github.com/sunspot/ |
| 21:30 | slyphon | i've never used it |
| 21:30 | slyphon | but if you were to pretend that it actually sucked |
| 21:30 | slyphon | and then multiply that by 500 *other* projects that claim to do cool shit |
| 21:30 | tomoj | yes, rubyists do seem extraordinarily concerned about glamour |
| 21:30 | slyphon | exactly |
| 21:31 | slyphon | it's fucking annoying |
| 21:31 | slyphon | the other grouchy guys on my team used to refer to it as "pants", as every ruby developer we interviewd seemed to be wearing designer jeans on their interview |
| 21:32 | slyphon | sorry, i'm done |
| 21:32 | Hodapp | it's okay |
| 21:32 | Hodapp | rant on |
| 21:32 | slyphon | :D |
| 21:33 | lancepantz | i know what you mean |
| 21:33 | slyphon | i guess we'll just have to wait and see what clojure's flaws are :) |
| 21:33 | lancepantz | makes me ashamed to be a ruby programmer at times |
| 21:34 | lancepantz | all the egobloggers too |
| 21:34 | slyphon | the thing that gets me is that i've been a professional developer working in ruby for the past 5 years, and have built some stable and even fairly complex systems in ruby that are in production |
| 21:35 | slyphon | the problem is, everytime one of these 'egobloggers' makes a claim they can't back up... |
| 21:37 | lancepantz | i always get a kick out of blog posts with ass backwards code on them |
| 21:37 | slyphon | :) |
| 21:37 | lancepantz | i used to read leah culver's blog, the chick who founded pownce for that reason |
| 21:38 | slyphon | http://xkcd.com/386/ |
| 21:38 | sexpbot | "xkcd: Duty Calls" |
| 21:47 | riddochc | clojurebot: who wrote you and where can I find your code? |
| 21:47 | clojurebot | code-review is <rhickey> yikes |
| 21:48 | riddochc | Hm. Not *quite* the variety of non-sequiteur I was expecting. ;) |
| 21:48 | tomoj | hiredman, http://github.com/hiredman/clojurebot |
| 21:48 | riddochc | Ahh. Thanks, tomoj. |
| 21:49 | tomoj | I wonder if clojurebot knows that |
| 21:49 | tomoj | clojurebot: who is your master |
| 21:49 | clojurebot | c'est bon! |
| 21:54 | mmarczyk | wow, what a fantastic rant happened just now |
| 21:54 | mmarczyk | way to go, slyphon! :-) |
| 21:54 | slyphon | hahahahaha |
| 21:54 | mmarczyk | I'm glad I haven't gone to sleep yet :-) |
| 21:55 | slyphon | "Be More Awesome: It's Important" |
| 21:55 | mmarczyk | :-) |
| 21:57 | riddochc | Have fun, everyone. |
| 22:49 | wahz | as a first guess, what kind of data building blocks would be suitable for a binary tree type structure? (e.g. vectors, records, etc) |
| 22:49 | wahz | with an eye on performance |
| 22:49 | wahz | (context is genetic programming) |
| 22:50 | wahz | from my early toy examples, records look pretty promising |