2010-04-05
| 00:00 | Licenser | heh |
| 00:00 | _ato | so the first problem is how to figure out what the latest version is |
| 00:01 | Licenser | _ato: yes I can imagine that |
| 00:01 | _ato | Given the current Maven API probably actually the easiest way of doing that is to ask maven to download it (with a ranged version) and then see which version it downloaded. :-P |
| 00:01 | albino | haha, I thought mvn2 was a rewrite for the same reasons of mvn1 |
| 00:02 | _ato | it's actually available here: http://clojars.org/repo/compojure/compojure/maven-metadata.xmlded. :-P [14:01] |
| 00:02 | _ato | <albino> haha, I thought mvn2 was a rewrite for the same reasons of mvn1 |
| 00:02 | _ato | ERC> it's actually available here: |
| 00:02 | _ato | oops |
| 00:02 | Licenser | oi? |
| 00:03 | _ato | http://clojars.org/repo/compojure/compojure/maven-metadata.xml |
| 00:03 | technomancy | Licenser: so just because a feature is absent from leiningen doesn't mean I don't think it's good, just that I don't think it's something I would use right away. =) |
| 00:03 | Licenser | technomancy: hmm you wouldn't? |
| 00:04 | Licenser | actually which feature do you mean? |
| 00:05 | technomancy | I was thinking of rubygems-style "lein install $FOO" |
| 00:06 | technomancy | I wouldn't use it because I don't use any Clojure CLI tools |
| 00:06 | technomancy | and there just aren't that many because currently Clojure CLI integration is crap |
| 00:06 | technomancy | but if leiningen can write out shell wrappers then maybe people will create more of them |
| 00:06 | Licenser | *nods it is' |
| 00:06 | Licenser | ah I see what you mean |
| 00:12 | Licenser | hmm hmm |
| 00:15 | Licenser | _ato: you have set up clojars? |
| 00:19 | albino | someone should beat the maven developers to an implementation of maven3 with clojure |
| 00:19 | albino | drop it on their front door step |
| 00:20 | _ato | Licenser: yeah clojars is my neglected baby ;-) |
| 00:20 | Licenser | albino: I don't think it is hard to find people wiling to beat the maven developpers for any reason :P |
| 00:21 | Licenser | _ato: then perhaps you can tell me, is there a way to fetch a list of files? |
| 00:21 | chouser | Licenser: http://clojars.org/repo/ |
| 00:22 | Licenser | chouser: I found that :) I just hoped there is some kind (and I am ashamed to say that) xml file that lists the actual jars |
| 00:23 | _ato | Licenser: heh, well there's: rsync --list-only -a clojars.org::clojars |
| 00:23 | _ato | that's probably not what you had in mind though |
| 00:23 | Licenser | _alex: heh no not exactly |
| 00:24 | _ato | what are you looking to use it for? for searching? |
| 00:24 | Licenser | _ato: I hoped for something that allows - exactly |
| 00:24 | AntonyBlakey | alibino: I've just published a version of polyglot maven (which uses maven3) with a clojure front-end. There's no need to redo the backend |
| 00:24 | Licenser | and yes I know there is a web interface but it should be maven generic |
| 00:25 | Licenser | AntonyBlakey: i think I read your mail in the mailing list? |
| 00:25 | _ato | ah, yeah there's no general way to list a maven repo as far as I know |
| 00:25 | brian__ | noob question: (def f 1) , (def f (inc f)) , (prn f) , 2 f looks rather mutable to me, what am i missing? |
| 00:25 | _ato | it's unfortunate |
| 00:25 | AntonyBlakey | licenser: probably |
| 00:25 | Licenser | AntonyBlakey: ah |
| 00:26 | Licenser | sorry to say it :P it scared me ^^ |
| 00:26 | AntonyBlakey | mvn -f project.clj |
| 00:26 | AntonyBlakey | that's it |
| 00:27 | AntonyBlakey | if you want to use more of maven (plugins etc) then it's hardly more effort |
| 00:27 | Licenser | I don't look for running something with maven but for a way to easiely find the right jar and install it |
| 00:27 | Licenser | sadly I don't know maven :( |
| 00:28 | somnium | brian__: vars are mutable so that you can redefine things (functions) dynamically, but using def to do imperative things is generally considered a sin against god and country |
| 00:28 | AntonyBlakey | I believe one of the IDEs has a 'find me this jar' or even 'find me this class' which will search maven repositories |
| 00:29 | _ato | Eclipse appears to do it, I'm sure where its getting the list from though, it might be something the m2eclipse people are mainintaining |
| 00:29 | brian__ | ok, but what happened to f? it doesnt seem to have everlasting life, and im having existensial doubbts |
| 00:29 | Crowb4r | _ato: netbeans does it as well. |
| 00:29 | _ato | aah |
| 00:29 | _ato | apparently Nexus has some API for it |
| 00:30 | Licenser | _ato hmm but if it is not general to maven it does not really help I think |
| 00:30 | _ato | http://repository.sonatype.org/ |
| 00:30 | Licenser | I mean if it only works on 'some' repos it isn't too helpfull |
| 00:31 | _ato | I guess it hits that |
| 00:31 | Crowb4r | _ato: you wrote clojars? |
| 00:31 | _ato | Crowb4r: yes |
| 00:32 | Crowb4r | geesh, I feel like the lazy one around here. |
| 00:32 | Licenser | heh |
| 00:33 | Crowb4r | everyone active in here seems to have wrote something I use in clojure quite regularly. :p |
| 00:33 | Licenser | hmm question would be, I am sure we could make a clojars specific implemation that would work great but is that what we want? |
| 00:34 | _ato | well clojars + maven central would cover a good chunk of use-cases. If you're using another repository you'd have to add it to your config anyway |
| 00:34 | Licenser | hmm but general would be nicer :P |
| 00:35 | _ato | hmm, looks like you can just download their indexer and run it |
| 00:35 | _ato | I might give it a try |
| 00:35 | Crowb4r | Licenser: Well, clojars is kind of the unofficial repo for clojrue packages. I think that it would be up to )ato is that was the defacto repo for deps. |
| 00:36 | Crowb4r | _ato |
| 00:36 | Crowb4r | unless he is not paying for bandwidth. :p |
| 00:37 | Licenser | :P well a central repo for clojure libs would be great |
| 00:39 | _ato | bandwidth is currently not at all a problem and I don't expect it will be unless the Clojure community suddenly grew several orders of magnitude |
| 00:39 | _ato | and if it does grow that large then I'm sure there'd be plenty of companies willing to host it, so no big deal |
| 00:40 | _ato | http://www.sonatype.com/people/2009/06/nexus-indexer-api-part-1/ |
| 00:40 | herm1t | Is there an or-like form that treats empty strings as nil? (or "" "test") -> "test" |
| 00:40 | Crowb4r | Does clojure have really any companies backing it? |
| 00:40 | hiredman | there is a method on String |
| 00:41 | hiredman | ,(->> String .getMethods (map #(.getName %))) |
| 00:41 | clojurebot | ("hashCode" "compareTo" "compareTo" "indexOf" "indexOf" "indexOf" "indexOf" "equals" "toString" "length" "isEmpty" "charAt" "codePointAt" "codePointBefore" "codePointCount" "offsetByCodePoints" "getChars" "getBytes" "getBytes" "getBytes" "getBytes" "contentEquals" "contentEquals" "equalsIgnoreCase" "compareToIgnoreCase" "regionMatches" "regionMatches" "startsWith" "startsWith" "endsWith" "lastIndexOf" "lastIndexOf" "lastIn |
| 00:41 | Licenser | hmm hmm |
| 00:41 | Crowb4r | hermit isempty? |
| 00:42 | hiredman | ,(->> String .getMethods (map #(.getName %)) (filter #(.contains "mpty"))) |
| 00:42 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--7763$fn |
| 00:42 | hiredman | ,(->> String .getMethods (map #(.getName %)) (filter #(.contains % "mpty"))) |
| 00:42 | clojurebot | ("isEmpty") |
| 00:42 | Licenser | (empty? "") |
| 00:42 | Licenser | ,(empty? "") |
| 00:42 | clojurebot | true |
| 00:43 | hiredman | ,(seq "") |
| 00:43 | clojurebot | nil |
| 00:43 | Crowb4r | ,(empty |
| 00:43 | clojurebot | EOF while reading |
| 00:43 | _ato | ,(first (remove empty? ["" nil "" "test"])) |
| 00:43 | clojurebot | "test" |
| 00:43 | Crowb4r | oppd |
| 00:43 | Crowb4r | opps |
| 00:44 | Crowb4r | ,(empty? " ") |
| 00:44 | clojurebot | false |
| 00:44 | herm1t | I want to use it with or, though. I have a hash that has a key and if the value is empty I want to supply a different value. Otherwise I have to pull the value out of the map twice: once to test and once to use. |
| 00:44 | Licenser | so generally the only universal way would be walking the entire repo and parsing http as I see it? |
| 00:47 | Crowb4r | So, how many people here use clojure professionally? |
| 00:48 | _ato | ah ha... http://repo1.maven.org/maven2/.index/nexus-maven-repository-index.gz |
| 00:52 | Licenser | hmm I have the feeling their index is huge |
| 00:52 | _ato | 40 MB |
| 00:54 | Licenser | yea but that isn't a thing you can fetch often :P |
| 00:54 | Licenser | ah it indexes all classes |
| 00:55 | _ato | it seems to be what m2eclipse uses |
| 00:57 | Licenser | but seriousely every time someone querries for a jar |
| 00:57 | _ato | nono, it caches it |
| 00:57 | _ato | downloads it once |
| 00:58 | _ato | I might replace clojars' dodgie search with this actually if it works well |
| 00:58 | _ato | wish I'd looked into it earlier |
| 00:58 | Licenser | but it is outdated once something new is pushed isn't it? |
| 00:59 | _ato | yeah, presumably it updates every now and then |
| 01:00 | _ato | might be better to use a web service for that reason |
| 01:00 | Licenser | *nods* well being able to search clojure libraries would be a huge improvement I think |
| 01:01 | technomancy | Licenser: speaking of search, you know about jarvana.com? |
| 01:02 | Licenser | technomancy: nope |
| 01:02 | technomancy | it's just for maven central |
| 01:02 | technomancy | but it's pretty handy |
| 01:02 | Licenser | that is kind of nice |
| 01:03 | _ato | hmm nexus-maven-repository-index.gz for clojars is around 200 Kb. |
| 01:04 | Licenser | taht isn't that bad |
| 01:04 | bmason | jarvana looks nice, just wish it supported more repos |
| 01:28 | TakeV | So, Java arrays are faster than the default Clojure datastructures? |
| 01:28 | TakeV | data structures* |
| 01:29 | underdev | TakeV: I've heard Rich Hickey say that it depends... but generally, probably yes |
| 01:29 | underdev | depends on the usecase |
| 01:30 | TakeV | Is there a reason why? |
| 01:30 | TakeV | Unless you are using refs and you need the mutability, I guess... |
| 01:31 | underdev | i believe he said the reads were as good or better, the writes could be 4x slower |
| 01:34 | TakeV | Ah, that makes a lot of sense. |
| 01:37 | hiredman | java arrays are as close to directly manipulating memory as you get on the jvm, of course they are faster |
| 01:42 | TakeV | Hmm, so any game development should probably use the Java arrays. |
| 01:55 | underdev | so, a day in maven hell has really helped me understand and appreciate lein |
| 01:55 | underdev | project.clj isn't a configuration file, it's a file containing a defproject macro, rt? |
| 01:56 | underdev | the structure created by "lein new foo" is a maven convension |
| 01:58 | underdev | also helped me make sense of swank-clojure, and how it works, and why its so damn handy\ |
| 01:59 | underdev | very cool ecosystem you got there, technomancy |
| 02:07 | doseq | technomancy made leiningan? |
| 02:08 | doseq | Thanks! Although I wish it put things in a visible folder instead of some hidden .m2 thing. |
| 02:09 | TakeV | Is there a guide for using leiningan? Just put it in bin and do "lein compile"? |
| 02:09 | doseq | As a Mac user I feel so dirty when programs use the unix standard file system. |
| 02:09 | underdev | i think its jochu who made swank-clojure and technomancy who made lein |
| 02:10 | underdev | i don't know, i'm just seeing his name all over both |
| 02:10 | robink | underdev: Correct |
| 02:11 | robink | Although technomancy may now commit more to swank-clojure than jochu. |
| 02:13 | underdev | TakeV, lein i think suffers from a lack of docu. |
| 02:13 | underdev | i have a really good link though |
| 02:13 | Crowb4r | UFS!! AHHHHH |
| 02:15 | underdev | http://zef.me/2470/building-clojure-projects-with-leiningen |
| 02:15 | _ato | http://github.com/technomancy/leiningen/blob/master/INTRO.md |
| 02:16 | _ato | there's also Sean's screencast: http://vimeo.com/8934942 |
| 02:16 | underdev | jimminy crickets, where have you been all my life?!?! |
| 02:17 | TakeV | Thanks. |
| 02:17 | _ato | and the readme contains a reference of the various commands and config options: http://github.com/technomancy/leiningen/blob/master/README.md |
| 02:19 | underdev | you know what's great about me? my crappy attempts at helping seem to elicit worthwile help from others, if only out of frustration. |
| 02:21 | underdev | i try, but you can't fix stupid |
| 02:24 | TakeV | You need emacs to use Lein? :\ |
| 02:24 | _ato | TakeV: no |
| 02:24 | TakeV | Huh. |
| 02:25 | _ato | there's a lein plugin, lein swank for use with emacs, but you can use whatever editor you want |
| 02:25 | _ato | lein just has a command-line interface |
| 02:26 | underdev | no, but the swank-clojurey goodness plays well with lein |
| 02:26 | TakeV | Ah, alright. |
| 02:26 | underdev | and slime is amazing with swank-clojure |
| 02:27 | TakeV | Yeah, though I couldn't ever get slime and swank-clojure to work. |
| 02:27 | underdev | oic |
| 02:27 | TakeV | I'm that guy who can't get anything to work. :P |
| 02:28 | underdev | i'm that ram that thinks he can butt a whole in a dam |
| 02:29 | underdev | it took me a loooong time to figure out the emacs stuff |
| 02:29 | underdev | but soooo worth the effort |
| 02:29 | tomoj | for a normal clojure-only setup, it's supposed to be really easy now |
| 02:29 | tomoj | no need to even edit .emacs |
| 02:29 | TakeV | You'd think. >_> |
| 02:30 | tomoj | TakeV: are you using something that resembles linux? |
| 02:30 | doseq | I know this is dickish but I will *never* use Emacs. I refuse, in the name of progress. |
| 02:30 | tomoj | just curious |
| 02:30 | TakeV | tomoj: Ubuntu. |
| 02:30 | tomoj | strange |
| 02:31 | tomoj | should work flawlessly |
| 02:31 | underdev | 10 years of vim, i saw Lau's screencasts, and realized IM DOING IT WRONG |
| 02:31 | TakeV | Keeps saying that it can't find swank. |
| 02:31 | _ato | TakeV: do you have a file or directory ~/.clojure ? |
| 02:31 | tomoj | underdev: does lau do paredit wizardry in the screencasts, or what? |
| 02:32 | underdev | TakeV, yeah i'm on ubuntu. If care to, you might want to start by looking at the Emacs Starter Kit |
| 02:32 | underdev | it comes with elpa, and if you use the stuff in elpa together, it's pretty seemless |
| 02:32 | TakeV | _ato: Ah, no, I don't. I have clojure in ~/lib/clojure/clojure. |
| 02:32 | tomoj | you shouldn't have to put clojure anywhere |
| 02:33 | _ato | ok that's good |
| 02:33 | underdev | a few things... "i vill make a keyboard macro, and..." |
| 02:33 | _ato | last time I checked if you have something at ~/.clojure swank-clojure gets confused (for historical reasons it checks that) |
| 02:33 | somnium | vim doesnt have keyboard macros? |
| 02:33 | TakeV | Er, wait, I seem to have it... |
| 02:34 | underdev | vi is the one true editor. long live emacs. |
| 02:35 | TakeV | I like gedit. >_> |
| 02:35 | TakeV | Actually, I kind of like that Eclipse plugin. |
| 02:35 | underdev | tomoj: but the paredit stuff is so great it makes me cry... |
| 02:36 | tomoj | :) |
| 02:36 | underdev | anyway, good night guys. |
| 03:17 | LauJensen | Morning crew |
| 03:40 | doseq | Hi Lau :) |
| 03:41 | doseq | Thanks for the blog links, I really enjoyed reading them. |
| 03:44 | LauJensen | Great I'm glad to hear it :) |
| 03:48 | hamza | is it possible to remove a jar from clojars? |
| 03:58 | _ato | hamza: I can remove one manually if necessary (mistake or legal problems), although in general I prefer to keep older jars around as people may be using them |
| 03:59 | LauJensen | _ato: In that case you have a broken ClojureQL fork on there |
| 03:59 | LauJensen | Which is also the only one which came up when I searched for ClojureQL, where clojars.org/clojureql (ours) might have been more appropriately |
| 03:59 | LauJensen | I also sent you a mail regarding this, but it bounced back after 8 days or so |
| 04:00 | _ato | http://clojars.org/search?q=clojureql it appears now, I put in a temporary hack for them problem where jars with no description don't show up in the search results |
| 04:01 | _ato | org.clojars.snuxoll is the broken one? |
| 04:01 | LauJensen | I think so, it was a while since I tested |
| 04:17 | phlaem | hi, I'm new to clojure and I've got a problem running the loop example in: http://clojure.org/functional_programming#Functional%20Programming--Recursive%20Looping |
| 04:17 | phlaem | is there something I should have done before running the function? Because I am ending up in an endless loop |
| 04:19 | mikem | phlaem: if you just copied and pasted it from the website, it shouldn't do that. did you modify the code? check for typos? |
| 04:20 | phlaem | I have just copy/pasted yes and I used both the 1.1.0 binaries from the eclipse plugin binaries |
| 04:20 | phlaem | in both cases my repl is stuck and I don't get a result |
| 04:21 | Chousuke | there is an error in the example |
| 04:21 | Chousuke | the rest function calls should be calling next instead |
| 04:22 | tomoj | :( |
| 04:22 | mikem | Chousuke: ah, good catch! in code I write I use rest and check with empty? |
| 04:22 | Chousuke | use next |
| 04:22 | Chousuke | or check with (seq foo) |
| 04:22 | Chousuke | empty? is not very idiomatic |
| 04:22 | tomoj | why did (seq foo) become idiomatic? |
| 04:23 | Chousuke | because most clojure functions do it and because rhickey said so :P |
| 04:23 | zmila | because that was said by the Master |
| 04:23 | tomoj | ah |
| 04:23 | tomoj | :) |
| 04:23 | Chousuke | empty? itself is implemented as (not (seq x)) |
| 04:23 | tomoj | hah |
| 04:27 | phlaem | whats the rest function good for anyway, if it's not returning the tail of the list? |
| 04:28 | phlaem | but it's working now thx :) |
| 04:29 | mikem | phlaem: the difference between rest and next is what they return for lists with only one element; next returns nil, rest returns () |
| 04:30 | Chousuke | rest also returns () for () :) |
| 04:31 | Chousuke | which is why the example loops forever |
| 04:31 | LauJensen | Back to the bit-twiddling. An RGB value is made up of 3x8 bits. Lets say I have each of those 3 chunks in an integer value going from 0 - 255, how do I stuff those back into an 3x8 bit sequence? |
| 04:31 | _ato | partly it's historical (and that's probably the reason that example is wrong) |
| 04:31 | Chousuke | yeah |
| 04:31 | Chousuke | rest used to do what next does now |
| 04:31 | Chousuke | it was changed to enable full laziness |
| 04:32 | phlaem | "<Chousuke> rest also returns () for () :)" I think that's a flaw |
| 04:32 | somnium | the rest of nil is () too :) |
| 04:32 | phlaem | I would expect an exception in that case |
| 04:32 | mikem | LauJensen: you mean stuff them into one integer where bits 0-7 are R, 8-15 are G, etc? |
| 04:32 | Chousuke | phlaem: it's by design |
| 04:33 | Chousuke | phlaem: exceptions are icky |
| 04:33 | LauJensen | mikem: exactly |
| 04:33 | LauJensen | So that I can pass it to a java.awt.Color. constructor, which takes such an int |
| 04:33 | phlaem | yes but I would rather fail hard, than loop forever |
| 04:33 | Chousuke | phlaem: the loop is in your code, not in rest :) |
| 04:34 | Chousuke | phlaem: anyway, rest returns a sequence of elements representing the tail of the sequence. if there are no elements, the sequence is simply empty |
| 04:34 | phlaem | yes, but rest enables it :( |
| 04:34 | somnium | is the only reason so we can cons onto a thunk without disturbing it? |
| 04:34 | mikem | LauJensen: here's some code I have which does something similar (4 bytes into one int): http://gist.github.com/356162 |
| 04:34 | Chousuke | phlaem: yes, but if you couldn't call rest on an empty thing, you would have to write special code to handle empty things |
| 04:35 | LauJensen | mikem: Thanks - Looks complicated :) |
| 04:35 | phlaem | which I have to do in the base case anyway? |
| 04:35 | mikem | LauJensen: byte-quad is a list, like (byte0 byte1 byte2 byte3) |
| 04:35 | LauJensen | maybe I can turn it into a nice reducer |
| 04:35 | _ato | ,(let [r 1, g 90, b 180] (-> r, (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left b 16)))) |
| 04:35 | clojurebot | 11819521 |
| 04:35 | _ato | maybe somethin like that, might be backwards |
| 04:36 | LauJensen | ,(let [r 255, g 2550, b 255] (-> r, (bit-or (bit-shift-left g 8)), (bit-or |
| 04:36 | clojurebot | EOF while reading |
| 04:36 | Chousuke | phlaem: perhaps |
| 04:36 | phlaem | Chousuke, I guess in non-recursive cases you are right, that would bloat the code |
| 04:36 | LauJensen | ,(let [r 1, g 90, b 180] (-> r, (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left g 8)) (bit-or (bit-shift-left b 16)))) |
| 04:36 | clojurebot | 11819521 |
| 04:37 | Chousuke | I think most things in Clojure are designed to throw as few exceptions as possible anyway |
| 04:37 | LauJensen | ,(let [r 255, g 255, b 255] (-> r, (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left g 8)) (bit-or (bit-shift-left b 16)))) |
| 04:37 | clojurebot | 16777215 |
| 04:37 | LauJensen | _ato: That should yield -1 |
| 04:37 | Chousuke | calling first on an empty list is not an error either |
| 04:37 | _ato | LauJensen: eh? it's only 3 bytes though... an Integer is four bytes |
| 04:38 | _ato | ,0xffffff |
| 04:38 | clojurebot | 16777215 |
| 04:38 | LauJensen | ,(.getRGB (java.awt.Color/WHITE)) |
| 04:38 | clojurebot | -1 |
| 04:38 | Chousuke | LauJensen: it's probably padded with 0xFF for the last byte |
| 04:38 | _ato | ,(.getRGB (java.awt.Color/BLACK)) |
| 04:38 | clojurebot | -16777216 |
| 04:39 | LauJensen | True |
| 04:39 | LauJensen | (let [r 0, g 0, b 0] (-> r, (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left g 8)) (bit-or (bit-shift-left b 16)))) |
| 04:39 | LauJensen | ,(let [r 0, g 0, b 0] (-> r, (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left g 8)) (bit-or (bit-shift-left b 16)))) |
| 04:39 | clojurebot | 0 |
| 04:39 | tomoj | there's gotta be an easier way |
| 04:40 | _ato | ,(.getRGB (java.awt.Color. 0 0 0)) |
| 04:40 | clojurebot | -16777216 |
| 04:41 | LauJensen | ,(java.awt.Color. -16777216) |
| 04:41 | clojurebot | #<Color java.awt.Color[r=0,g=0,b=0]> |
| 04:41 | tomoj | why not just use the int,int,int constructor? |
| 04:41 | LauJensen | tomoj: I need to do some predicate testing, that'll be faster if I only have 1 int to test |
| 04:41 | LauJensen | Thanks a lot _ato and mikem though |
| 04:42 | tomoj | oh, this is the inner loop? |
| 04:42 | tomoj | drawing graphics or something? |
| 04:42 | mikem | LauJensen: i sure learned something :) |
| 04:42 | LauJensen | tomoj: Yea |
| 04:43 | LauJensen | mikem: Me too - Havent done this stuff in 15 years, about the time when I presented a demo at 'The Party' |
| 04:43 | _ato | ,(let [r 255, g 255, b 255] (-> (bit-or r -16777216), (bit-or (bit-shift-left g 8)), (bit-or (bit-shift-left b 16)))) |
| 04:43 | clojurebot | -1 |
| 04:43 | _ato | ^ if you need the padding |
| 04:44 | LauJensen | Thanks! |
| 04:46 | _ato | That's one of the few things that's much nicer when expressed in C: 0xff000000 | r | (g << 8) | (b << b) |
| 04:46 | _ato | err.. that last b should be a 16 obviously ;-) |
| 04:47 | _ato | the lack of unsigned integers is also rather annoying for that sort of thing |
| 04:49 | psykotic | LauJensen: wow, The Party, that takes me back. |
| 04:49 | psykotic | LauJensen: i think last time i was there was in 96, it might have been the same year. |
| 05:00 | doseq | Can anyone translate this to make it clearer: (doc seq) => Returns a seq on the collection. |
| 05:00 | doseq | What does that actually mean? |
| 05:02 | _ato | doseq: http://clojure.org/sequences |
| 05:03 | _ato | let me know if that also doesn't make any sense ;-) |
| 05:03 | doseq | I just want clarification on the grammar of "on the collection". |
| 05:04 | doseq | But thanks for the link... I don't really like the clojure.org docs. |
| 05:05 | tomoj | doseq: it means it's a seq which somehow gives the contents of the collection |
| 05:05 | _ato | a list is a seq it implements ISeq directly, so seq on a list returns the list |
| 05:05 | tomoj | so for example |
| 05:05 | tomoj | ,(seq {:foo 3 :bar 4}) |
| 05:05 | clojurebot | ([:foo 3] [:bar 4]) |
| 05:06 | _ato | ,(class (seq [1 2 3])) |
| 05:06 | clojurebot | clojure.lang.PersistentVector$ChunkedSeq |
| 05:06 | tomoj | that is a seq, it's "on" the map because it returns (sequentially) values from the map |
| 05:06 | doseq | Sorry to bitch guys, I'm just so fed up with lazily written documentation that means nothing. |
| 05:06 | doseq | *deep breath* |
| 05:06 | _ato | doseq: Have you got the Programming Clojure book? |
| 05:06 | tomoj | it's like you're attaching the sequential interface on top of the collection |
| 05:07 | _ato | if not, I higly recommend it |
| 05:07 | tomoj | since the seq just walks through the immutable content of the collection, I'd think |
| 05:08 | doseq | So in that case "on the collection" means "by consuming the contents of the arguments and returning a 1-dimensional list"... is that about right? |
| 05:09 | LauJensen | doseq: yea, like it says "on the collection" :) |
| 05:09 | doseq | lol, OBVIOUS :D |
| 05:10 | doseq | You guys have been around for ages... how is the documentation process run on the source code, is there room for someone to contribute by improving the language? |
| 05:10 | _ato | doseq: not really. It's more like an iterator, it doesn't create a list. |
| 05:11 | _ato | documentation patches are certainly welcome, you need to sign the contribtuors agreement though |
| 05:11 | _ato | see http://clojure.org/contributing |
| 05:12 | doseq | Yup, thanks. I've been considering it for a few days already I just thought I'd hang out first and make sure I'm not duplicating anyone else's job. |
| 05:13 | tomoj | I think that there is work being done on collaborative documentation which will become relevant |
| 05:13 | _ato | seq returns something that behaves like a cons-cell list, it's not necessarily an actual list |
| 05:15 | doseq | tomoj: something web-based you mean? Or the doc strings in the source itself. |
| 05:16 | tomoj | uh, perhaps web-based at some point |
| 05:17 | tomoj | the current web-based work I've seen is focused on collecting examples of uses from #clojure logs, I believe, but I think it could be easily made to also work with bits of explanatory documentation |
| 05:20 | doseq | I'm just really interested in doing something helpful documentation-wise because the experience for newcomers could be better. |
| 05:27 | psykotic | doseq: i feel you. the library documentation for clojure is awful. |
| 05:28 | psykotic | every function should have a few examples. they could also double as tests. |
| 05:30 | cemerick | psykotic: The documentation is generally pretty amazing, short of having examples. Have you seen the docs for other languages, even far more popular ones? |
| 05:31 | doseq | As an example, the sequences page casually explains seq in terms of the ISeq interface, without any sense that if you don't know seq, then you're certainly not going to know the ISeq interface. |
| 05:31 | psykotic | cemerick: Python is pretty much my bar for documentation. |
| 05:31 | doseq | I see this circularity all over the place. |
| 05:31 | cemerick | psykotic: I think clojure surpassed python's documentation quality long, long ago. |
| 05:31 | psykotic | you are smoking crack |
| 05:32 | cemerick | well argued. :-P |
| 05:32 | kzar | the last 2 times I went into #python I got flamed by about 5 idiots until my question got too hard for them and they all went silent |
| 05:32 | psykotic | kzar: what does that have to do with the official documentation? |
| 05:33 | kzar | not a lot, just an anecdote I thought I'd share |
| 05:33 | psykotic | ruby's is certainly much worse than clojure's but that's not much of a statement |
| 05:33 | psykotic | cemerick: look at the doc for reduce, for example. |
| 05:34 | cemerick | ,(doc reduce) |
| 05:34 | clojurebot | "([f coll] [f val coll]); f should be a function of 2 arguments. If val is not supplied, returns the result of applying f to the first 2 items in coll, then applying f to that result and the 3rd item, etc. If coll contains no items, f must accept no arguments as well, and reduce returns the result of calling f with no arguments. If coll has only 1 item, it is returned and f is not called. If val is supplied, returns the re |
| 05:34 | psykotic | block of text. you could convey the same thing better and much more concisely with a simple 'expression schematic' or an example. |
| 05:35 | psykotic | and reduce is among the better examples in that it's at least fairly complete, if not very well written |
| 05:35 | doseq | This is the same problem as wikipedia though. You go looking for a definition, and in the first paragraph it branches off into six other unfamiliar terms. |
| 05:35 | cemerick | psykotic: this isn't paint-by-numbers. You need (and should want) a rigorous definition of what is going on. The community can fill in with examples and recipes as things go along. |
| 05:36 | psykotic | you are an idiot |
| 05:36 | cemerick | I guess what I'm saying is, patches welcome. :-) |
| 05:36 | psykotic | but that's okay |
| 05:36 | cemerick | psykotic: this is a friendly channel. Keep it that way, please. |
| 05:37 | psykotic | then keep your passive-aggressive "this isn't paint by numbers" shit in check. |
| 05:38 | psykotic | i'm glad that someone with experience in technical writing in doseq is thinking of contributing. if i was a technical writer, i would do the same. |
| 05:38 | cemerick | psykotic: That wasn't meant as passive-aggressive in any way. I'm sorry if it seemed like it was. I'm happy to see the various documentation projects ramping up as well. |
| 05:39 | psykotic | so, here's what i'm contributing. |
| 05:39 | psykotic | i'm working on a program i call genie. it is a bit like hoogle for haskell except it is not based on types but actual values. |
| 05:40 | doseq | Ok cool, I'm excited about this. Clojure is such an amazing concept and promises to make life easier, but it's a tough thing to write about which makes dissemination a problem. |
| 05:40 | psykotic | if you give it the template (= (% (fn [x] (* x 2)) [1 2, 3]) [2 4 6]), it will return clojure.core/map |
| 05:40 | psykotic | and so on |
| 05:41 | psykotic | it uses a mix of white lists and black lists to handle pure/impure functions |
| 05:41 | psykotic | right now it works with everything in core and contrib |
| 05:41 | psykotic | it has some nice tricks you might not expect, e.g. it will automatically try permutations of the function call template, in case you didn't "guess" the right order of arguments for the function you're searching for |
| 05:42 | psykotic | so, for example, you could have written the above template as (= (% [1 2 3] (fn [x] (* x))) [2 4 6]) and it would have given the same result |
| 05:42 | doseq | psykotic: so does that mean you can supply it with some answers and finds the question? Or am I misunderstanding it. |
| 05:42 | psykotic | yes |
| 05:43 | doseq | Wow. |
| 05:43 | psykotic | it's actually very simple. it's basically just a matter of calling a list of candidates functions in turn, with exception wrappers, and checking the return values |
| 05:43 | psykotic | it works well in a language like clojure where most functions are side-effect-free. |
| 05:43 | doseq | Like a brute force thing. |
| 05:43 | psykotic | sure but we're talking about a few thousand candidates, it's no biggie. |
| 05:44 | doseq | Sounds cool. |
| 05:46 | psykotic | i think the original idea behind this kind of thing comes from the smalltalk world, but it's much less useful there, because everything is oo and hence based on side effects. |
| 05:53 | somnium | psykotic: that sounds awesome. It would be fun to be able to say something like (fns-for {"" nil 42 nil "foobar" 'foo} n) and have it glom together n fns that match those criteria. |
| 05:54 | somnium | psykotic: any chance of getting a peek at the source in the near future? |
| 05:56 | psykotic | i'm building it out to interface with my quickcheck-style contracts system, so it's in a state of disarray right now, but sure |
| 05:56 | psykotic | it isn't anything difficult though. most of the value is in the idea, not the implementation. |
| 05:57 | somnium | sure, its come up before, how to make a try_ruby for clojure. no one ever suggested brute forcing pure functions before afaicr |
| 06:02 | ska2342 | Hi. If -> is the threading operator, is there already an established name for ->>? |
| 06:02 | somnium | Ive been wanting to make something for fixed arity fns too, so (fn** foo [x y] (* x y)) gets a tag like [:number :number :number], and if you call (foo 42) it inlines `(fn [x#] (* x# 42)). |
| 06:03 | somnium | It would be fun to experiment with that and an inference system |
| 06:31 | kzar | I haven't played with Clojure for a while but I'm going to give it another go. I remember before getting Emacs to work with it was a bit of a pain and there where a few different ways to do it. Which is the best / easiest way to do it at the moment? |
| 06:31 | psykotic | kzar: it should be pretty painless if you install swank-clojure with ELPA. |
| 06:32 | psykotic | it's pretty much turn-key these days. |
| 06:32 | psykotic | i use the adjective "pretty" advisedly, as i think there are still some issues with older versions of emacs. |
| 06:33 | kzar | psykotic: Hmm that ELPA thing looks interesting, haven't heard of that before thanks |
| 06:33 | kzar | psykotic: I'm using Emacs 23.1.1 so I should be alright I guess |
| 06:33 | psykotic | yeah, it's pretty neat, unfortunately it still doesn't have a whole lot of packages. their package submission process is pretty old school :) |
| 06:33 | psykotic | yup, it works great with 23 |
| 06:35 | kzar | psykotic: Sweet I like how ELPA installs, just eval a s-exp :D |
| 06:36 | psykotic | yeah, if a bit unsafe :) |
| 06:37 | psykotic | (it evals code over the network) |
| 06:39 | kzar | psykotic: I'll trade being a bit unsafe for a week of my life not spent headbutting my computer |
| 06:39 | psykotic | a trade-off well made |
| 06:40 | psykotic | there's another thing called auto-install which install directly from emacswiki pages :) |
| 06:40 | psykotic | it has the courtesy of showing you a diff by default when it upgrades, so you at least have a chance of catching someone who inserted malicious code :) |
| 06:41 | psykotic | the nice thing is that it's much more open in where it sources its packages from. elpa's achilles heel is really its 19th century package submission process. you have to _email_ the elpa maintainer every time you want to upload a new package version. |
| 06:41 | psykotic | he might as well require delivery by carrier pigeon at that point. |
| 06:42 | kzar | pyskotic: A slight irony in the one easy package installer being hard to install into |
| 06:42 | psykotic | but i hear that's changing. |
| 06:44 | kzar | psykotic: So I've installed clojure-mode and swank-clojure with ELPA. Is it still best to get one of those bundles that includes Clojure and a clj bash script to launch it all? |
| 06:45 | psykotic | kzar: i believe you can just try to start swank and it will download the latest for you. yes, magic. |
| 06:47 | kzar | psykotic: Hmm I usually launched it with (slime) to get to the repl but that's still loads SBCL, do you mean I should do it like that? |
| 06:49 | psykotic | i haven't tried installing it alongside sbcl. when you install slime fresh, it should do the clojure install, etc, the first time you do a (slime). |
| 06:50 | kzar | psykotic: Ah OK I'll figure it out I'm sure |
| 06:50 | Gertm | kzar: I did the same as you yesterday. You need to remove your .slime directory if you have any, and leave all the references to your old slime out of your emacs config |
| 06:51 | psykotic | yeah, i'm looking at the source, it seems it wants to be "the" slime", rather than coexist. |
| 06:52 | Gertm | I moved my emacs config to another name, rm -rf ~/.emacs.d/elpa, rm -rf ~/.slime, elpa install, then install swank-clojure through elpa |
| 06:52 | Gertm | then it works :) |
| 06:53 | Gertm | hmm I just noticed I've got the habit of writing '-rf' instead of '-r'.. could be problematic in the future :o |
| 06:55 | psykotic | it's always fun when you insert a space and write ~/ .emacs.d/elpa instead :) |
| 06:55 | Gertm | heh |
| 06:55 | kzar | Gertm: psykotic: Sweet OK, I'll brb because I've got to restart emacs |
| 06:56 | Gertm | oo rcirc, share you config will you :) |
| 06:56 | Gertm | your* |
| 06:58 | dm3 | how do you serve-file with compojure 0.4.0? |
| 07:05 | kzar | Hmm so since I did that (package-install 'clojure-mode) and (package-install 'swank-clojure) both fail saying "Package x not available for installation" :/ |
| 07:06 | kzar | My IRC settings in my .emacs http://paste.lisp.org/display/97342 |
| 07:06 | Gertm | thanks! |
| 07:07 | kzar | Gertm: They aren't perfect but they connect to two servers, a few channels. Setup spell checking and auth with Nickserv all from typing M-x irc |
| 07:07 | Gertm | so I see :) |
| 07:07 | Gertm | it's nice and small |
| 07:08 | kzar | so if the ELPA thing fails you what's the next best option? |
| 07:08 | Gertm | did you do 'M-x package-list-packages' ? |
| 07:09 | Gertm | then enter that buffer and search for 'swank-clojure', press 'i' on it's line to mark it for installation |
| 07:09 | Gertm | then hit 'x' to actually install |
| 07:09 | Gertm | after that you should be able to do M-x slime |
| 07:12 | kzar | Gertm: OK brb let me try this again |
| 07:13 | avar | I finally got swank-clojure / slime working with my .emacs without using the ELPA sillyness |
| 07:33 | kzar | So I found an old #clojure log which gave me a hint, the problem was that an old version of slime was installed site wide. I removed that and this time it prompted me and installed Clojure. |
| 07:33 | Gertm | aha :) |
| 07:34 | Gertm | it's always a bit of a search |
| 07:34 | kzar | Now M-x slime launches clojure but it's slime is constantly trying to connect, the prompt is fucked and said "java.lang.NullPointerException" a lot |
| 07:34 | Gertm | I never installed lisp stuff through my package manager, neither will I with clojure |
| 07:34 | Gertm | hmm |
| 07:34 | Gertm | that's strange |
| 07:35 | kzar | Gertm: Well this box has been running for like 5 + years now and I've upgraded stuff as I've gone and as I've learnt |
| 07:35 | kzar | Gertm: I knew no Lisp when I did the Debian install for it so I probably did apt-get install slime at some point |
| 07:36 | kzar | (hmm maybe not 5 years, I'm not sure how many but quite a long time anyway heh) |
| 07:41 | kzar | Gertm: Where does ELPA put the Clojure it grabs? |
| 07:43 | Gertm | kzar: I'm not sure, ~/.emacs.d/elpa/ or ~/.swank-clojure/ |
| 07:43 | Gertm | I think |
| 07:43 | Gertm | (I've only installed clojure and stuff yesterday, so I'm by no means an expert) |
| 07:45 | kzar | Gertm: Yea you're right ~/.swank-clojure has it |
| 07:46 | kzar | brb again |
| 08:09 | patrkris | does anyone here know what to do to get Swing to work from within a VimClojure REPL? I've ensured that the laf.jar is included in the nailgun server's classpath, but still doesn't work when I do (def frame (JFrame. "Test")) |
| 08:09 | patrkris | i get a nullpointerexception |
| 08:09 | bobo_ | do you set it as visible? |
| 08:10 | patrkris | no |
| 08:10 | patrkris | it works fine if I do it from a leiningen REPL |
| 08:10 | bobo_ | ah |
| 08:17 | kzar | Gertm: phew I got it working |
| 08:19 | kzar | Again trawling the inter-webs helped, I had an old version of GNU Java installed (a few actually heh), so I got rid of them all and got sun-java6-jdk + sun-java6-jre installed instead and it works |
| 08:21 | kzar | so to be fair on ELPA it would have just worked really nicely if it wasn't for the old stuff I had lying around on my system |
| 08:33 | LauJensen | :q! emacs M-x slime (doto (JFrame.) .show) |
| 09:06 | G0SUB | ,(re-seq (re-pattern "\bbar\b") "foo bar baz") |
| 09:06 | clojurebot | nil |
| 09:06 | G0SUB | ,(re-seq #"\bbar\b" "foo bar baz") |
| 09:06 | clojurebot | ("bar") |
| 09:06 | G0SUB | weird! |
| 09:10 | _ato | not so weird |
| 09:10 | _ato | ,(re-seq (re-pattern "\\bbar\\b") "foo bar baz") |
| 09:10 | clojurebot | ("bar") |
| 09:12 | _ato | ,(first "\bbar\b") |
| 09:12 | clojurebot | \backspace |
| 09:15 | chouser | ,(re-pattern "\\bbar\\b") |
| 09:15 | clojurebot | #"\bbar\b" |
| 09:15 | chouser | ,(re-pattern "\bbar\b") |
| 09:15 | clojurebot | #"bar" |
| 09:16 | chouser | hm, it'd be nice if #"" didn't print unprintables like that. |
| 09:16 | chouser | my fault, I'm afraid. :-/ |
| 09:18 | _ato | what would it print instead? |
| 09:19 | _ato | if it printed #"\bbar\b" that would be very misleading ;-) |
| 09:19 | _ato | same with question marks or most other symbols |
| 09:20 | _ato | spaces maybe |
| 09:21 | chouser | #"\010bar\010" |
| 09:21 | Fossi | i like the utf blocks ;D |
| 09:22 | _ato | ah.. of course |
| 09:22 | chouser | or maybe #"\x08bar\x08" |
| 09:22 | _ato | yeah, hex is nicer |
| 09:23 | chouser | and extends to the unicode \u0000 more coherently |
| 09:23 | G0SUB | makes sense. thanks. |
| 09:24 | G0SUB | \\b it is, then. |
| 09:24 | chouser | G0SUB: why are you using re-pattern? |
| 09:24 | chouser | #"" is much nicer for regex than "" |
| 09:24 | _ato | G0SUB might be composing strings to make a regex? |
| 09:25 | chouser | yeah, sometimes an unforunte necessity. |
| 09:25 | chouser | unfortunate |
| 09:25 | chouser | though sometimes you can get away with composing regex literals |
| 09:27 | chouser | ,(re-pattern (str #"\b" (java.util.regex.Pattern/quote "bar") #"\b")) |
| 09:27 | clojurebot | #"\b\Qbar\E\b" |
| 09:28 | _ato | nice |
| 09:29 | chouser | only works if each #"" fragment is itself a complete and vaild regex though, so not always usable. |
| 09:29 | chouser | can't use #"(" and later #")" for example |
| 09:31 | chouser | huh. java regex has a Printable group, but no matching predicate in Character |
| 09:35 | G0SUB | _ato, you got it right :) |
| 09:35 | _ato | the Printable group is ASCII only |
| 09:35 | _ato | might be why it's not in character |
| 09:51 | licoresse | Is there a metadata to use to mark a (def ...) as private? |
| 09:52 | stuartsierra | yes |
| 09:52 | stuartsierra | (def #^{:private true} foo ...) |
| 09:52 | licoresse | So. do I get an exception if it is called outside the namespace it is defined? |
| 09:53 | Fossi | why would you? |
| 09:53 | licoresse | oh yes |
| 09:53 | licoresse | an error from slime |
| 09:53 | licoresse | Fossi: why make it private? |
| 09:54 | Fossi | don't know |
| 09:54 | Fossi | i use def- and such a whole lot |
| 09:54 | Fossi | don't know what they do though |
| 09:58 | maravillas | is there any sort of consensus on how to organize functions across a library's namespaces? by which i mean...i'd heard some talk of putting the public api in core and supporting functions in other namespaces, but that doesn't seem to be very common |
| 09:59 | maravillas | and i have a couple public functions that my private functions reference, so i'd need to do something like defining them outside of core, and referencing those defs in core itself |
| 09:59 | underdev | maravillas: sounds sane to me |
| 09:59 | Chousuke | You can just define private functions in the same namespace, it doesn't really matter |
| 10:00 | Chousuke | but optimally all functions in a single namespace should have the same "theme" |
| 10:01 | maravillas | yeah, i'm just wondering if a convention has emerged. separating them makes it quite a bit easier to see the public api just by scanning core, but i'm left with that wart of redefining some functions |
| 10:01 | underdev | maravillas: as a consumer i would really like that |
| 10:02 | chouser | I tend to organize namespaces based on dependencies -- if some functions depend on 3rd party libs that others to do not, they get their own namespace. |
| 10:02 | underdev | maravillas: and as a dev i'm adopting it. |
| 10:04 | maravillas | hm...ok, thanks guys |
| 10:05 | underdev | it would be great than to use qualified names to indicate you were calling the library api in the core api, or at least :as it |
| 10:05 | underdev | from a consumers point of view |
| 10:05 | underdev | good stuff maravillas |
| 10:06 | maravillas | yeah, that's probably a good call |
| 10:07 | underdev | and it would really clean up the testing |
| 10:07 | licoresse | using map in doall to do sideeffects, is this kosher? |
| 10:08 | licoresse | it does not feel that way |
| 10:08 | Chousuke | prefer doseq |
| 10:09 | licoresse | ok |
| 10:09 | underdev | oh, but the support lib ns wouldn't be included when a person use'd the core |
| 10:09 | underdev | i don't think |
| 10:09 | underdev | so you would have to doc that you would need both |
| 10:10 | underdev | i think |
| 10:10 | chouser | if ns C requires B and B requires A, then when C is loaded, A will be also |
| 10:11 | underdev | oic, never ran into it, but in a screencast (somewhat older) it mentioned that would NOT happen |
| 10:11 | chouser | however, if C 'use's B and B 'use's A, the Vars from A become available in B but not (without qualification) in C |
| 10:11 | underdev | oic, yeah, i get it |
| 10:12 | underdev | but the core *would* be access the lib, just not ns hosting the core |
| 10:12 | underdev | which is probably what you want anyway |
| 10:13 | underdev | thanks chouser |
| 10:13 | chouser | sure. |
| 10:14 | chouser | fwiw, I don't much care for libs using the 'core' naming scheme. I suppose they're just copying clojure.core, but I sorta wish "core" always meant "cloujure.core" |
| 10:17 | underdev | i am just appreciating the seperation of concerns, not a naming convention. but i see what you mean. If i say "core" in the context of tcl, i mean the commands included with the runtime, aside from any additional libs |
| 10:17 | underdev | it obfuscate that would be a bad thing |
| 10:20 | doseq | Do we call collection items "items", or elements? |
| 10:21 | chouser | doseq: I think either is fine |
| 10:21 | doseq | I think I'll prefer items. |
| 10:32 | Raynes | I just read the first log file in defn's logs. Fri Feb 01 2008, in which chouser was a solid newbie. How creepy is that? |
| 10:33 | cemerick | those early logs are good readin' :-) |
| 10:33 | chouser | complete newbie. "how do I run code?" right? |
| 10:33 | somnium | when was clojure first released? |
| 10:33 | stuartsierra | somnium: First public release was in Fall 2007 |
| 10:34 | chouser | Raynes: his logs are a copy of my logs. and of course my logs start when I first showed up here. |
| 10:34 | chouser | if anyone has any older logs, I'd be happy to integrate them. |
| 10:34 | Raynes | chouser: Indeed. It was the "how do I run code?" |
| 10:35 | cemerick | chouser: when did you move to a lower case 'C'? |
| 10:35 | chouser | cemerick: oh, relatively recently, in the vague and unltimately vane hope it would help differentiate me from Chousuke |
| 10:35 | chouser | vain |
| 10:36 | cemerick | huh...and I thought you just didn't sleep. |
| 10:36 | cemerick | ;-) |
| 10:36 | ska2342 | somnium: I think one can consider http://sourceforge.net/mailarchive/forum.php?thread_name=7E06A48B-2A93-4FBD-ADA5-7C23D0F7B16D%40richhickey.com&forum_name=foil-users to be the first public announcement :-) |
| 10:36 | chouser | cemerick: :-) |
| 10:36 | cemerick | Man, 2/7/2008! :-P |
| 10:37 | cemerick | It's funny how I waft over to that page every now and then. |
| 10:39 | chouser | it's intruiging to me long I was using clojure while still complaining about the syntax |
| 10:39 | stuartsierra | The first thing every Lisp user does is complain about the syntax. It's a rite of passage. |
| 10:39 | hiredman | pffft |
| 10:40 | hiredman | the syntax is beautiful |
| 10:40 | somnium | is there any benefit to the syntax other than macros? (compared to say, ML or Haskell) |
| 10:41 | bsteuber | somnium: uniform = less to learn, I think |
| 10:42 | bsteuber | I always got confused in haskell when I'm allowed to insert linebreaks or not |
| 10:42 | underdev | f* yeah |
| 10:42 | underdev | everything else is noise now |
| 10:44 | Raynes | hiredman: Did you use a different nick before 2009-07-30? |
| 10:44 | Raynes | I can't seem to find your first appearance, unless this is actually it and you already knew Clojure when you joined the channel. |
| 10:45 | hiredman | I think maybe november 08 should be my first appearance |
| 10:46 | chouser | http://clojure-log.n01se.net/date/2008-11-11.html " is this coljure swag, or libertarian swag?" |
| 10:46 | hiredman | right |
| 10:50 | doseq | The syntax makes more sense if you read a copy of the Lisp 1.5 Programmer's Manual. |
| 10:51 | doseq | The 1.0 manual is good too but the 1.5 one is written to be more accessible. |
| 10:51 | fogus | doseq: How so? |
| 10:51 | doseq | fogus: how does it make more sense? |
| 10:53 | doseq | Thanks for your blog, btw, I enjoyed reading some of it the other day. |
| 10:53 | fogus | doseq: Yes. Sorry I came to the conversation late, so I might have missed a point earlier |
| 10:54 | doseq | Someone was just saying that it's common to question S-expression syntax. |
| 10:55 | ska2342 | doseq: nah, it's about lispers complaining about Clojures syntax at first. I've been through that, too what with all those curlies and such... |
| 10:55 | doseq | Oh, gotcha. |
| 10:55 | doseq | Still, it's a good book to read :) |
| 10:56 | Raynes | Morning, rhickey. |
| 10:56 | rhickey | so if maps throw exceptions on duplicate keys, should sets as well? |
| 10:56 | rhickey | Raynes: hi |
| 10:57 | doseq | I've been going on a nostalgia binge lately, reading all the original papers by the creators of various things. The UNIX stuff is pretty fascinating in relation to Clojure... they were so big on interactive environments but that kinda got lost somewhere. |
| 10:58 | Raynes | Sets can be useful to filter duplicates. |
| 10:59 | doseq | rhickey: what would be the benefit of the exception? |
| 10:59 | hiredman | why can't this just be simple |
| 10:59 | hiredman | :( |
| 11:00 | ska2342 | rhickey: stupid question first: when exactly do maps throw? |
| 11:00 | rhickey | doseq: people considered supplying the same key again in a map init to be a mistake they wanted caught, just trying to see if they feel the same way about set members |
| 11:00 | fogus | rhickey: yes. |
| 11:00 | rhickey | ska2342: they throw on my machine, at the moment |
| 11:00 | doseq | rhickey: thx. |
| 11:00 | doseq | hiredman: simple or easy, choose one :D |
| 11:02 | ska2342 | ,{:a 1 :b 2 :a 3} |
| 11:02 | clojurebot | {:a 1, :b 2, :a 3} |
| 11:02 | Raynes | ,(->> "abcddefffgeeheff" (into #{}) (apply str)) |
| 11:02 | clojurebot | "abcdefgh" |
| 11:02 | doseq | Does anyone know what the rationale is behind the ([x] [x form] [x form & more]) style of example syntax in the doc strings? Just wondering if those conventions are used elsewhere. |
| 11:02 | rhickey | Raynes: we're not talking about into here, in either case |
| 11:02 | hiredman | doseq: those are arg lists, not examples |
| 11:03 | doseq | hiredman: right, well notional examples. |
| 11:03 | Raynes | rhickey: I was confused about what you meant. I see. |
| 11:03 | rhickey | Raynes: more about #{:a :b :c :b} |
| 11:04 | doseq | rhickey: I don't think it should throw an exception for keys if it doesn't for any other type. |
| 11:04 | ska2342 | rhickey: if it's only about the read-syntax-form I'd go for consistency. Otherwise you'll have to answer the question, why sets don't throw when maps do about once a week ;) |
| 11:05 | rhickey | not just about reader syntax, also hash-set |
| 11:06 | chouser | yeah, sets should do the same as map keys. I think the less frequent complaints about dups in sets are roughly proportial to their frequency of use. |
| 11:07 | ska2342 | anyway: consistency. I'm not sure what I'd expect from an apply hash-set ..., though. |
| 11:08 | chouser | that's a good point -- maybe they should provide uniqueness instead of throwing |
| 11:08 | chouser | bah, gotta go. |
| 11:09 | fogus | I would say that if maps throw on dup keys then so should sets. The really useful exception would be when people use contains? as .contains. IllegalAssumptionException |
| 11:10 | ska2342 | applying hash-set to a seq feels like a solution to removing duplicates. But that is probably Perl-influenced thinking and using distinct is the better, more idiomatic way. |
| 11:17 | ska2342 | hng, got sidetracked by reading the source of distinct. Can anyone explain why that doesn't stack-overflow when it is calling the step function explicitly recursively? |
| 11:17 | fogus | I guess I see it as a difference between wanting a set, or simply wanting a seq without duplicates. I like the clear distinction (no pun) |
| 11:17 | S11001001 | well, a seq without duplicates where order doesn't matter is a set :) |
| 11:18 | rhickey | there is the set fn |
| 11:18 | rhickey | aargh, could someone please fix test so it doesn't always report exceptions at test_clojure.clj:77 ? |
| 11:19 | hiredman | ska2342: I imagine the step function returns a lazy-seq |
| 11:20 | ska2342 | hiredman: it does. |
| 11:20 | hiredman | so there you go |
| 11:20 | fogus | rhickey: Do you have this sentence always available in your clipboard? ;-) test_clojure.clj:77 seems to be a persistence source of headache for you. |
| 11:21 | ska2342 | hiredman: why? Do I have to reread the lazy stuff to see how it avoids blowing the stack? |
| 11:21 | hiredman | ska2342: lazy-seqs sort of flip the stack out sideways |
| 11:22 | ska2342 | hiredman: sort of ... what?? ;-) what shall I read? LazySeq.java? |
| 11:23 | hiredman | so normally in recursion without tco the stack grows down with each recursive call |
| 11:24 | hiredman | in a lazy-seq those recursive calls are strung out as a datastructure |
| 11:25 | hiredman | next gives you the next "recursive" call |
| 11:25 | rhickey | ok, explicit this, dupe checking on set and map keys up |
| 11:27 | ska2342 | hiredman: I'm trying to make sense of LazySeq.java and it's calls to seq and sval at the moment. Maybe I'll see the light later |
| 11:31 | Ankou | hi, I already asked that some time ago but nobody could help me, maybe this time there's somebody who knows the answer: The error messages of compiling clojure by using (compile) or (load) or C-c C-l/C-c C-k in slime are rarely helpful, there's almost never a line number or something like that. I don't know if it is exactly the same but it is very similiar if I use leiningen to compile it or run the file just with the command line use of clojure. |
| 11:31 | Ankou | However, in enclojure there are pretty exact error messages an I would like to know how to get them with emacs too. As far as I know enclojure uses Ant to build the clojure source but I have no Idea how that could help getting better error messages. Any Ideas? |
| 11:31 | somnium | ska2342: maybe another way to say it is lazyseq wraps the recursive call in a thunk that gets returned immediately, so the stack never grows. |
| 11:33 | ska2342 | I think the point in distinct is that the step function, which is called recursively, lives outside the lazy-seq so that a new lazy-seq is created on every call. Sth like that? |
| 11:37 | somnium | ska2342: yeah, in pseudo-clojure first call returns a thunk that holds {:first first-distinct-item :rest (fn [] (distinct xs...)) } |
| 11:40 | licoresse | code-coverage tools for clojure, anyone? |
| 11:43 | cemerick | that's going to be a tough one |
| 11:44 | maravillas | not sure how much help it is, but this was mentioned some time ago (here in #clojure, I believe): http://p.hagelb.org/thomas.html |
| 11:45 | licoresse | Lex Spoon had something in Smalltalk which I think was a cool concept; tag function access in the metadata, all functions with no access have a count of 0 |
| 11:45 | licoresse | maravillas: looking |
| 11:45 | licoresse | hehe |
| 11:45 | cemerick | We should be able to use existing line-level code coverage tools in Java. Just a matter of hooking the pieces together, but that's the deeper end of the pool. |
| 11:46 | licoresse | the same principle almost |
| 11:54 | ska2342 | can someone elaborate on the fundamental difference between comp and -> |
| 11:55 | hiredman | comp is a function, -> is a macro |
| 11:56 | ska2342 | E.g. I have a fn which walks the ns-publics of clojure.core, tries to deref the second of each and tests for fn?. I can write that with -> or comp just as well and don't know which is better |
| 11:57 | somnium | also (-> x f g) => (g (f x)), ((comp f g) x) => (f (g x)) |
| 11:57 | Raynes | $walton -> |
| 11:57 | sexpbot | Raynes: http://getclojure.org:8080/examples/-> |
| 11:57 | Raynes | defn: That stuff is extremely useful. I <3 you. |
| 11:58 | cemerick | many people find -> easier to read, especially when there's java interop going on as well |
| 12:01 | ska2342 | hm, while trying to create a version for clojurebot I'm beginning to get a feeling for the diffs. -> with anon functions is rather tricky if possible at all (in my case) |
| 12:02 | cemerick | yeah, -> and anon fns don't mix |
| 12:02 | Raynes | ,(-> 1 (#(+ 2 %))) |
| 12:02 | clojurebot | 3 |
| 12:03 | cemerick | yeah, I wouldn't call that mixing well :-) |
| 12:03 | somnium | some people even like (-> 1 ((partial + 2))) :p |
| 12:03 | Raynes | I do it quite a bit, actually. Not enough that I'd call it a problem. |
| 12:03 | Raynes | Only for simple things. |
| 12:04 | ska2342 | Being a long timer lisper I have to admit that I have problems seing any comfort in -> at all, but since it is widespread I have to adopt ;-) |
| 12:04 | Raynes | It's more comfortable than )))))))))))))))))))0 |
| 12:05 | Raynes | Minus that last zero there. :> |
| 12:05 | ska2342 | Raynes: I happen to disagree, but nevermind |
| 12:05 | ipostelnik | usually, I use -> to avoid creating anon functions in the first place |
| 12:05 | Raynes | Well, fair enough. If that's your thing. |
| 12:05 | ipostelnik | ,(-> 1 (+ 2)) |
| 12:05 | clojurebot | 3 |
| 12:06 | ska2342 | BTW (I asked this earlier) is there a common name for ->>? |
| 12:06 | TakeV | ,(doc ->) |
| 12:06 | clojurebot | "([x] [x form] [x form & more]); Threads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc." |
| 12:06 | ipostelnik | I prefer to think of it is a pipeline operator |
| 12:08 | ipostelnik | as in "shell pipeline" |
| 12:08 | ska2342 | ipostelnik: -> is threading and ->> is pipeline for you?? Or did I misunderstand? |
| 12:12 | ipostelnik | ska2342, no I think of both of them as pipeline, just different order of arguments |
| 12:13 | ipostelnik | ska2342, I rarely use ->>, when I have control over the method signature I generally design toward usability with -> |
| 12:14 | ska2342 | ipostelnik: I don't use either of them, but for documentation purposes I'm looking for the *name* of ->>. -> is the "threading operator", but ->>? |
| 12:14 | cemerick | It depends on what your fns' arguments are. If there's a sequence involved, you generally want it to be last, so it can work with ->> |
| 12:15 | ipostelnik | -> and ->> are both threading operators, the only difference is insertion point |
| 12:16 | ska2342 | "tail threading op" (compare to tail recursion)? |
| 12:44 | doseq | I still don't get what ([x] [x form] [x form & more]) is actually saying. |
| 12:45 | joshua-choi | doseq: It's exactly like ([x & forms]), only it was separated into three probably just for optimization. |
| 12:45 | doseq | Oh, so that space is an OR? |
| 12:45 | stuartsierra | yes |
| 12:46 | doseq | So the space character means two different things. |
| 12:47 | ska2342 | doseq: you can call that function with either one argument (x), or x and another form, or x and more forms. Each possible arglist is displayed as a vector just like in arity-overloaded dfns |
| 12:48 | doseq | Ok so in order to read it you need to know what an arity-overloaded dfns looks like? I question that choice :) |
| 12:49 | doseq | But thanks for the explanation, that helps. |
| 12:50 | ipostelnik | arity = number of args |
| 12:50 | ipostelnik | a function can have different signatures based on the number of args |
| 12:51 | doseq | Am I right in reading it as: "(-> x) or (-> x form) or (-> x form [form ...])" |
| 12:54 | ipostelnik | yes |
| 12:55 | div | ,(-> 1 (* 2) (+ 3) (* 2)) |
| 12:55 | clojurebot | 10 |
| 12:55 | fogus | doseq: It might be simpler just to think of it as (-> x [form...]) |
| 12:55 | doseq | Indeed. |
| 12:57 | doseq | Oh, so those things are actually generated automatically from the source code? That makes more sense. Initially I thought maybe someone had written them that way. |
| 12:59 | ska2342 | doseq: some of them are generated, some are written in the functions metadata, IIRC |
| 13:00 | doseq | I'm writing all this up as part of a "Clojure for absolute beginners" type of thing. |
| 13:12 | doseq | In this arg list, I can see that the ? means that something is optional, but how about the * and +? |
| 13:12 | doseq | ([name doc-string? attr-map? [params*] body] [name doc-string? attr-map? ([params*] body) + attr-map?]) |
| 13:18 | thickey | doseq: I think the * means "one or more" and the + means "the previous form can be repeated" |
| 13:18 | doseq | Thanks Tom. |
| 13:19 | Fossi | i'd guess from regexs + is one or more, * is none or more |
| 13:19 | doseq | That makes sense. |
| 13:19 | ska2342 | params* in context of defn is obviously none or more :) |
| 13:20 | thickey | yep |
| 13:38 | slyphon | anyone ever have a problem with inconsistent behavior between 'lein swank' and 'slime-connect' ? |
| 13:38 | slyphon | it seems like sometimes emacs gets into this state where it can't connect, but telnet can connect |
| 13:40 | underdev | slyphon: use it all the time, never had that problem |
| 13:40 | slyphon | hrm |
| 13:40 | slyphon | poop |
| 13:40 | slyphon | there too many possible things that could be wrong :/ |
| 13:40 | underdev | slyphon: depending on the usecase, you can use swank-clojure-project |
| 13:40 | underdev | does that fail too? |
| 13:41 | slyphon | no, but i have a bunch of environment and java properties i need to set |
| 13:41 | underdev | oic |
| 13:41 | slyphon | yeah, i'll probably just try reinstalling emacs i guess |
| 13:41 | slyphon | could be the particular port i'm using |
| 13:41 | underdev | OS? |
| 13:41 | clojurebot | most horrible thing is http://tinyurl.com/b65o8e |
| 13:41 | slyphon | OS-X |
| 13:42 | slyphon | but installed emacs w/ macports |
| 13:42 | underdev | gotcha |
| 13:42 | underdev | slyphon: are you using elpa? |
| 13:42 | slyphon | yeah |
| 13:43 | underdev | when people are pulling from HEAD from here and thar, stuff seems to break more |
| 13:43 | underdev | okay |
| 13:44 | slyphon | yes! |
| 13:45 | slyphon | poor name choice |
| 13:45 | slyphon | or poor behavior |
| 13:45 | underdev | my fault, but didn't realize wtf i've been doing wrong... :) |
| 13:46 | underdev | IT'S IN THERE! ITS RIGHT THERE!!! |
| 13:46 | slyphon | hahahahahah |
| 13:51 | slyphon | too bad elpa cant install cedet |
| 13:51 | slyphon | d |
| 13:53 | tomoj | ,(contains? [1 2 3] 0) |
| 13:53 | clojurebot | true |
| 13:54 | fogus | fogusbot> IllegalAssumptionException! |
| 13:56 | SynrG | ,(contains? [1 2 3] 3) |
| 13:56 | clojurebot | false |
| 13:56 | SynrG | fun :) |
| 13:56 | dakrone | it's annoying that contains only works on maps |
| 13:58 | tomoj | it works on other things too.. |
| 13:58 | dakrone | alright, thinks with k/v pairs |
| 13:58 | dakrone | *things |
| 13:59 | chouser | maps, sets and vectors -- everything Associative |
| 13:59 | SynrG | ,(some (fn [x] (= x 0)) [1 2 3]) |
| 13:59 | clojurebot | nil |
| 13:59 | fogus | dakrone: It works on vectors too. But the result is not what you're assuming it should be. |
| 13:59 | chouser | ,(some #{0 3} [1 2 3]) |
| 13:59 | clojurebot | 3 |
| 13:59 | chouser | ,(contains? #{:a :b :c} :b) |
| 13:59 | clojurebot | true |
| 14:00 | dakrone | yea, the whole point is that it's misleading for people who think it's going to do something else |
| 14:00 | LauJensen | ,(contains? [1 2 3 3] 3) |
| 14:00 | clojurebot | true |
| 14:00 | hiredman | strings too |
| 14:00 | fogus | dakrone: I think most here are sympathetic to what you're saying |
| 14:00 | dakrone | ,(contains? [1 2] 2) |
| 14:00 | clojurebot | false |
| 14:00 | dakrone | is the big gotcha |
| 14:01 | dakrone | fogus: yea, I shouldn't complain unless I'm suggesting a solution anyway :) |
| 14:01 | chouser | suggested solution: rename 'contains?' to 'has-key?' |
| 14:01 | slyphon | yes |
| 14:02 | slyphon | chouser++ |
| 14:02 | bsteuber | or contains-key? |
| 14:02 | slyphon | bsteuber: that's *way* more typing! |
| 14:02 | chouser | that suggestion isn't perfect, but I do think it's better than status-quo. |
| 14:02 | LauJensen | "kontains?" :) |
| 14:02 | chouser | because the statis is *not* quo. |
| 14:03 | fdaoud | ,([1 2 3] 2) |
| 14:03 | slyphon | chouser: really? punning in latin? |
| 14:03 | clojurebot | 3 |
| 14:03 | slyphon | chouser: have you no shame? |
| 14:03 | chouser | slyphon: just quoting |
| 14:03 | slyphon | :) |
| 14:03 | dakrone | chouser: I agree also |
| 14:03 | fogus | ,(let [contains-but-not-the-way-that-you-think? contains?] (contains-but-not-the-way-that-you-think? [1 2 3] 0) |
| 14:03 | clojurebot | EOF while reading |
| 14:04 | slyphon | contains-dwim! |
| 14:04 | fogus | You get the point. (parens-fail) |
| 14:04 | chouser | http://www.youtube.com/watch?v=apEZpYnN_1g -- Dr Horrible's Sing Along Blog |
| 14:04 | fdaoud | ,(doc contains?) |
| 14:04 | clojurebot | "([coll key]); Returns true if key is present in the given collection, otherwise returns false. Note that for numerically indexed collections like vectors and Java arrays, this tests if the numeric key is within the range of indexes. 'contains?' operates constant or logarithmic time; it will not perform a linear search for a value. See also 'some'." |
| 14:05 | fdaoud | can't say it's not doc'ed. |
| 14:05 | fdaoud | ,(doc some) |
| 14:05 | clojurebot | "([pred coll]); Returns the first logical true value of (pred x) for any x in coll, else nil. One common idiom is to use a set as pred, for example this will return :fred if :fred is in the sequence, otherwise nil: (some #{:fred} coll)" |
| 14:08 | underdev | what isn't mentioned is that when used with a numerically indexed colllection, it will return false when using a non-numeric keys. Clojures been very happy to just break when i've made similarly stupid mistakes. |
| 14:09 | underdev | not complaining, 100% my bad, but docu doesn't make that obvious |
| 14:10 | tomoj | it will not perform a linear search for a value |
| 14:14 | brian__ | noob question -> user=> (def counter (let [count (ref 0)] #(dosync (alter count inc)))) ; user=> (counter) |
| 14:14 | brian__ | 1 |
| 14:14 | brian__ | @count |
| 14:14 | brian__ | java.lang.ClassCastException |
| 14:14 | dakrone | brian__: you are declaring count as local only to the counter function |
| 14:15 | brian__ | ok |
| 14:15 | brian__ | thx |
| 14:15 | chouser | your local 'count' is out of scope by the time you are back at the repl |
| 14:15 | dakrone | no problem, good luck |
| 14:15 | chouser | so you're trying to deref the builtin fn named 'count', hence the ClassCastException |
| 14:15 | brian__ | yep |
| 14:15 | brian__ | thx |
| 14:25 | LauJensen | Whats good about it cemerick ? |
| 14:26 | cemerick | Mostly a good pile of refinements. Better sexpr navigation (though I'm not too keen on the default keybindings), code outlines are more reliable, some irritating bugs are gone. It ostensibly has much-improved debugging support as well, which I've not had a chance to try out. |
| 14:27 | doseq | has-key? sounds cool. or key-in? |
| 14:27 | LauJensen | Sounds cool |
| 14:28 | LauJensen | cemerick: This is probably a very noobish question, but when you're editing, are you clicking and using error keys, or something similar to C-n C-p M-v etc |
| 14:28 | stuartsierra | fogus: sounds painful |
| 14:29 | fogus | stuartsierra: I'm glad that I didn't have to explain that (oh so subtle) joke. ;-) |
| 14:29 | stuartsierra | fogus: good :) |
| 14:32 | doseq | Night all. |
| 14:38 | rlb | I just started looking at lein the other day. Would it be reasonable to think that, its approach could increase the potential security risks to a machine or account (via clojars) a bit? |
| 14:38 | rlb | s/that,/that/ |
| 14:40 | rlb | I'm mostly just wondering about the vetting/trust associated with any items in clojars that can be pulled down indirectly (as compared to say debian packages, or grabbing the upstream source). Of course no doubt lein is more convenient. |
| 14:45 | chouser | rlb: anyone can upload anything to clojars, I believe. |
| 14:46 | chouser | So I guess when you have lein fetch deps for you, you're trusting every person that has uploaded items into the tree of deps you're fetching. I don't think any of those are generally signed. |
| 14:47 | chouser | That does indeed sound higher risk than the signed packages you generally get from debian, though I don't actually know how carefully they control those signing keys. |
| 14:49 | cemerick | LauJensen: "error keys"? |
| 14:49 | chouser | "arrow keys" I think |
| 14:50 | LauJensen | cemerick: Arrows! :) |
| 14:51 | fogus | rhickey: Do you have a link to the paper we spoke about in VA for the Haskell paper describing the benefits of a coarse-grained STM approach? |
| 14:53 | cemerick | LauJensen: I don't touch the mouse very often, no. I do use sexpr navigation a fair bit, but probably less than I could. |
| 14:53 | cemerick | I don't know what C-n, C-p, or M-v do, tho. |
| 14:54 | LauJensen | forward, backward, line above, next view (page down) etc |
| 14:55 | The-Kenny | I use M-v and C-v a lot |
| 14:56 | cemerick | No, I use mac-standard shortcuts for that. |
| 14:56 | cemerick | Cmd- left, right, up, down, Option- for moving by "words", shift with either to select. |
| 15:00 | rlb | chouser: debian tries to be pretty careful, though you're still dealing with ~1000 maintainers. Also as you move from unstable -> testing -> stable, the risk should tend to decrease, and at a bare minimum, the debian maintainer that uploaded a given package actually grabbed the source and built it themselves. |
| 15:01 | chouser | rlb: right. so either way you're trusting a somewhat nebulous cross-section of procedures, software, and people. That said, I would expect clojars to be a bit more "wild west" than debian. |
| 15:01 | rlb | I wonder if lein makes it easy to tell it to "only use the jars in this dir" or similar. Then if you wanted to you could provide them yourself as it complains. |
| 15:01 | chouser | I have no idea about other maven repos |
| 15:05 | rlb | chouser: ok, so it sounds like clojars really doesn't have a security model - it's entirely dependent on any given project to verify the providers of each dependency (direct and indirect) that it lists. |
| 15:07 | rlb | If there's not one, I'd definitely like a "don't automatically grab anything" mode. Then when you wanted to, you could use that and fulfill the deps manually. |
| 15:07 | cemerick | central has some kind of keying requirement these days, though I'm not sure what practical impact that has. |
| 15:07 | brian__ | noob question - is it possible to read/write a clojure data structure to disk? |
| 15:07 | brian__ | outsde of a database/ |
| 15:08 | cemerick | brian__: prn and read will get you by if you're only using clojure data structures |
| 15:08 | cemerick | beyond that, there's the undocumented-on-purpose print-dup |
| 15:08 | brian__ | ? |
| 15:09 | brian__ | why is it undocumented/ |
| 15:09 | rlb | In any case, it sounds like in the limiting case, clojars (and maven if it works the same way) could have the potential to be a bit too much like running random binaries off the net for me. Thanks for the help. |
| 15:09 | cemerick | because it's very much subject to future change. |
| 15:09 | brian__ | ok |
| 15:10 | rlb | Though I'll probably poke at it a bit more... |
| 15:12 | cemerick | rlb: this seems relevant: http://www.sonatype.com/people/2010/01/nexus-oss-ecosystem/ |
| 15:21 | rlb | cemerick: thanks |
| 15:27 | div | how would i go about checking if an integer is a perfect square ? |
| 15:27 | div | e.g. 9 is a perfect square, but 8 isn't |
| 15:28 | div | if i (sqrt 8) i get a double, is there a predicate or something that checks if something is an integer |
| 15:29 | chouser | since doubles are inaccurate, I'd round to the nearest int, do int multiplication, then see if you're back where you started. |
| 15:29 | chouser | maybe there's a better way, but it seems like that should be accurate at least. |
| 15:30 | rys | just check if the fractional part is zero? |
| 15:31 | ztellman | (= (Math/floor num) num) |
| 15:32 | div | yea, thx |
| 15:32 | div | that will do it, i was expecting some kind of instanceof based predicate |
| 15:32 | div | so looking in the wrong direction :) |
| 15:33 | chouser | ,(zero? (rem (Math/sqrt 10000000000000001) 1)) |
| 15:33 | clojurebot | java.lang.ExceptionInInitializerError |
| 15:33 | chouser | eh. That's 'true' for me. |
| 15:34 | chouser | ,(let [n 10000000000000001, i (Math/round (Math/sqrt n))] (= (* i i) n)) |
| 15:34 | clojurebot | java.lang.ExceptionInInitializerError |
| 15:34 | chouser | and that's false |
| 15:38 | div | hm |
| 15:38 | div | overflow error ? |
| 15:39 | Fare | anyone wants to speak for the Boston Lisp Meeting? |
| 15:39 | Fare | in June, July, August? |
| 15:40 | wthidden | Given some map M, with key K, what is wrong with: (get M K (throw (Throwable. (str "Key not found.")))) ? |
| 15:41 | chouser | wthidden: "get" is a function, so all args are evaluated before it's called. |
| 15:41 | wthidden | Argh.... how sensible... thanks. |
| 15:42 | chouser | is it possible for M to have nil or false values? |
| 15:42 | wthidden | no |
| 15:42 | chouser | ok, then I'd suggest (or (M K) (throw ...)) |
| 15:43 | chouser | 'or' is a macro and won't evalutated expressions after if gets a "true" one |
| 15:43 | wthidden | ah simple and elegant, thanks chouser. |
| 15:44 | wthidden | for some reason i had it in my head get was a macro. |
| 15:45 | wthidden | i should have swallowed what little ego I had/have an hour ago and asked for help. |
| 15:46 | Fare | or making stupid remarks. |
| 15:47 | wthidden | i wish i was as smart as Fare |
| 15:48 | wthidden | and it would be really cool if someone spoke about clojure again at the Boston Lisp meeting. |
| 15:51 | Fare | it would. |
| 15:51 | Fare | come on big boys - clojure has lots of cool stuff happening to it. Surely there must be a clojure hacker around Boston to give a talk this year? |
| 15:56 | LauJensen | Fare, are you paying travel expenses? |
| 15:56 | Fare | Unhappily, this year's budget is 0. |
| 15:56 | Fare | so, no. |
| 15:57 | Fare | but I'm offering you beer. |
| 15:57 | LauJensen | Hmm, so I'll have to weight a beer against about 2000 USD worth of plane tickets.. hmmm :) |
| 15:57 | Crowbar7 | It must be a hell of a beer. :p |
| 15:58 | stuartsierra | You could get me for the cost of train fare from NYC ;) |
| 15:58 | LauJensen | If I did have business in the US I would be happy to hop aboard, but unfortunately I dont |
| 15:58 | div | maybe it's a beer subscription |
| 15:58 | underdev | the bad news: it's coors light. The good news: it's 6 metric tonnes of it. |
| 16:00 | LauJensen | Fare: Dont miss stuarts offer, he gives good presentations as seen on Vimeo :) |
| 16:04 | Fare | stuartsierra, I'll try to raise the fare. It's still like $200. |
| 16:04 | stuartsierra | check dates first: when is this? |
| 16:04 | Fare | since you come from afar, it's pretty much whenever you want, starting in June |
| 16:04 | LauJensen | stuartsierra: remember, since I handled marketing, I'll be taking 20% - which means a little bit of walking for you :) |
| 16:05 | Fare | usually we meet on the last monday of the month, but you get to pick. |
| 16:05 | Fare | (I have speakers for April and May already) |
| 16:05 | underdev | there's a clojure meetup in pittsburgh this wednesday; we'ld be happy to get a speaker! |
| 16:10 | fdaoud | stuartsierra: is it looking good for your book to come out mid-May? |
| 16:13 | stuartsierra | fdaoud: Hang on, are you in Boston with Fare? |
| 16:13 | stuartsierra | Oh, the book. |
| 16:13 | stuartsierra | Dunno. We're in copy-editing, but Luke still has a chapter to finish. |
| 16:13 | fdaoud | stuartsierra: no, I'm in Montreal |
| 16:14 | fdaoud | stuartsierra: thanks, sounds good |
| 16:14 | tomoj | wait, you're writing a book too? |
| 16:14 | stuartsierra | tomoj: yes, with Luke Vanderhart, for Apress |
| 16:14 | fdaoud | http://apress.com/book/view/1430272317 |
| 16:15 | fdaoud | apress ebook prices are ridiculous. it's not normal that it's cheaper to get the paper book from Amazon (shipping included) |
| 16:16 | Crowbar7 | I did exactly that |
| 16:16 | Crowbar7 | it |
| 16:16 | Crowbar7 | it's on pre-order |
| 16:16 | fdaoud | ditto |
| 16:17 | fdaoud | 43% off the list price |
| 16:18 | Borkdude | In what way will the book be different from Clojure in Action, The Joy of Clojure, Programming Clojure? |
| 16:19 | Borkdude | Asked a question about it on SO: http://stackoverflow.com/questions/2578837/comparing-clojure-books |
| 16:19 | stuartsierra | Luke and I wrote it, so it will be different. |
| 16:19 | stuartsierra | But seriously, the goal is to make a more detailed language reference, like the Rhino book for Javascript |
| 16:20 | Borkdude | like a C# in a Nutshell kind of book? |
| 16:20 | stuartsierra | dunno, never read those |
| 16:25 | Borkdude | Hmm, from Germany free shipping: 30,66 EUR for the book |
| 16:25 | Borkdude | Amazon.de |
| 16:27 | fdaoud | wow, here in Canada it's the equivalent of 23.21 EUR |
| 16:27 | underdev | that's like what $177 us dollars? |
| 16:28 | fdaoud | $41.41 USD |
| 16:30 | fdaoud | ,(if [] "hi") |
| 16:30 | clojurebot | "hi" |
| 16:30 | fdaoud | ruby: if [] "hi" end => "hi" |
| 16:30 | fdaoud | groovy: if ([]) { "hi" } => null |
| 16:31 | tomoj | I see $34.99 USD at apress and $31.49 at amazon |
| 16:32 | bozhidar | I don't generally like Apress books |
| 16:32 | bozhidar | and I was planning on skipping this one |
| 16:32 | stuartsierra | that's ok, I don't mind :) |
| 16:32 | fdaoud | tomoj: you're not comparing the right thing, at apress it's for the ebook. paper book = $49.99 |
| 16:32 | bozhidar | but now that I know stuart is one of the authors |
| 16:32 | bozhidar | I'll definitely will buy it |
| 16:32 | bozhidar | :) |
| 16:32 | stuartsierra | Wow, thanks. |
| 16:33 | tomoj | fdaoud: ah I see |
| 16:33 | tomoj | I think my team will probably be getting your book |
| 16:33 | bozhidar | I think that books written by those that have contributed to the community have the highest value |
| 16:34 | fdaoud | tomoj: don't you agree $34.99 for an ebook is exagerrated price |
| 16:34 | tomoj | we're forcibly bringing clojure to a few people I think :) |
| 16:34 | tomoj | you mean $34.99 is too expensive? |
| 16:34 | tomoj | seems reasonable to me.. |
| 16:34 | LauJensen | cemerick: I've gone through your screencast now, and I'll admit, that was pretty slick |
| 16:35 | fdaoud | tomoj: too expensive for a PDF |
| 16:36 | tomoj | hmm, programming clojure is $21.00 |
| 16:36 | tomoj | it amazes me they make a profit at that price |
| 16:37 | bozhidar | tomoj: lower prices, higher volumes... |
| 16:37 | cemerick | LauJensen: tip of the iceberg :-) |
| 16:37 | bozhidar | since it's the only book about Clojure at the moment I guess it's still selling very good |
| 16:46 | div | LauJensen, which screencast ? |
| 16:47 | LauJensen | cemerick: got a link for div? |
| 16:47 | cemerick | div: http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer |
| 16:47 | div | thanks |
| 16:49 | bozhidar | mentioning maven reminded me something |
| 16:49 | bozhidar | is it normal in a lein build to see every download attempted from every repo configured? |
| 16:50 | bozhidar | Downloading: org/apache/maven/maven-ant-tasks/2.0.10/maven-ant-tasks-2.0.10.jar from clojure |
| 16:50 | bozhidar | Downloading: org/apache/maven/maven-ant-tasks/2.0.10/maven-ant-tasks-2.0.10.jar from clojure-snapshots |
| 16:50 | bozhidar | Downloading: org/apache/maven/maven-ant-tasks/2.0.10/maven-ant-tasks-2.0.10.jar from clojars |
| 16:50 | bozhidar | Downloading: org/apache/maven/maven-ant-tasks/2.0.10/maven-ant-tasks-2.0.10.jar from central |
| 16:50 | bozhidar | in maven this certainly did not happen... |
| 16:51 | stuartsierra | I think it does happen in Maven actually |
| 16:52 | bozhidar | stuartsierra: not if you're repos are up and containing the artifact |
| 16:53 | bozhidar | I get this in the build for every artifact, otherwise I probably would have dismissed it |
| 16:54 | bozhidar | the artifacts are downloaded and everything works fine never-the-less, but it still seems that something is off |
| 16:54 | bozhidar | maybe I've spent far too much time with maven :) |
| 16:54 | cemerick | maven certainly keeps track of where snapshot artifacts came from, which saves it from checking other repos |
| 16:55 | trptcolin | stuartsierra: do you know if there's a discount for buying both the alpha version of your book and also the hard copy when it comes out? |
| 16:55 | stuartsierra | no idea |
| 16:56 | trptcolin | k, thanks |
| 17:02 | LauJensen | Isn't lein calling maven directly ? |
| 17:07 | cemerick | LauJensen: it's using its dependency resolution. Beyond that, I know nothing. |
| 17:07 | danlarkin | lein uses the "backend" maven java classes |
| 17:09 | LauJensen | k, thanks |
| 18:16 | digash | What is the "idiomatic enum" in Clojure? |
| 18:16 | rhickey | digash: a keyword? |
| 18:18 | digash | ahh, keywords can be namespaced in Clojure, sorry still stuck in CL mindset |
| 18:26 | digash | one thing that is problematic with keywords as enums that compiler does not complain about typos |
| 18:49 | div | how would i go from (2 2 3 3 3 7) to ((2 2) (3 3 3) (7)) ? |
| 18:50 | div | it's okay to assume my list will be sorted |
| 18:50 | div | basically, i have a function that decomposes a number into its prime factors, but I need to know their exponents |
| 19:00 | tufflax | Why doesn't (.start (Thread. (fn [] (println "hello")))) print anything in emacs but (println "hello") does? :P |
| 19:00 | slyphon | anyone use the mock library? |
| 19:05 | div | tufflax, when you start a new thread it outputs to the *inferior-lisp* buffer |
| 19:05 | div | only the main repl thread outputs to the slime-repl buffer |
| 19:06 | tufflax | ok, can I change that so both of them output to the slime-repl buffer? |
| 19:06 | div | i'm sure you could, but I don't know how you would go about doing that. |
| 19:07 | div | I'm fairly new to messing around with clojure / emacs myself |
| 19:07 | tufflax | hm ok |
| 19:07 | tufflax | btw, I don't have any *inferior-lisp* buffer open, how can I open one to see the output? |
| 19:08 | tufflax | oh, i had one |
| 19:08 | div | if you do C-x C-b the inferior-lisp buffer is not ther ? |
| 19:08 | div | a right :) |
| 19:08 | tufflax | didn't show up in the manu though |
| 19:08 | tufflax | menu |
| 19:09 | div | http://www.mail-archive.com/clojure@googlegroups.com/msg23270.html |
| 19:09 | tufflax | ok, off to google... |
| 19:09 | tufflax | thank you |
| 19:09 | div | that may be a good starting point for redirecting output |
| 19:09 | tufflax | ok, will see |
| 19:12 | tufflax | ah, much better :D |
| 19:25 | defn | 'lo all |
| 19:26 | tufflax | hello |
| 21:29 | TakeV | If I have a hash, and one of the values is a struct, and I want to access one of the members of the struct, is there an easy way to do that? |
| 21:29 | chouser | (-> myhash :avalue :amember) |
| 21:30 | TakeV | Ah, thank you. |
| 21:30 | dnolen | ,(doc get-in) |
| 21:30 | clojurebot | "([m ks]); returns the value in a nested associative structure, where ks is a sequence of keys" |
| 21:30 | dnolen | works as well. |
| 22:48 | brandonw | without having to delve into maven too deeply, could anyone point me at a sample pom file for a java library? I am trying to put something up on clojars, but I want to make the pom file as accurate is possible, but it is hard without leiningen :) |
| 22:49 | brandonw | mostly i'm curious about the <repositories> and <dependencies> elements |
| 22:49 | brandonw | how they would be converted to java repos and java deps, and if that is even needed |
| 22:50 | cemerick | brandonw: clojure-contrib's pom is moderately simple: http://github.com/richhickey/clojure-contrib/blob/master/pom.xml |
| 22:51 | brandonw | awesome, thanks cemerick |
| 22:51 | cemerick | brandonw: clojure-maven-plugin is pure java and has a pile of dependencies, which might be helpful: http://github.com/talios/clojure-maven-plugin/blob/master/pom.xml |
| 22:53 | brandonw | okay, so if a java .jar has no deps other than java itself, then it doesn't need any repositories or deps specified, right? |
| 22:54 | brandonw | or more clearly: if there are no deps specified, then there is no reason to include repos because it seems like repos purpose to direct maven on where to look for deps |
| 22:56 | cemerick | right |
| 22:57 | cemerick | and, you don't need to declare repositories for central, or any repository that you can assume is declared in each user's local settings (this only applies to in-house stuff, and I'd go ahead and declare those internal repos anyway, or perhaps have them off in a parent pom) |
| 23:00 | brandonw | ah crap |
| 23:01 | brandonw | i accidentally published the jar to the root package name instead of my user namespace on clojars |
| 23:01 | brandonw | is it possible to delete a jar from your profile or something along those linse? |
| 23:02 | _ato | brandonw: bwapi-proxy? |
| 23:03 | brandonw | yes |
| 23:03 | brandonw | i had just e-mailed the author of the project that i was going to publish it on my user namespace, then i went ahead and didn't modify the pom, heh |
| 23:04 | _ato | I'll remove it |
| 23:04 | brandonw | awesome, thanks :) |
| 23:05 | cemerick | brandonw: your "user namespace"? |
| 23:05 | brandonw | user group |
| 23:05 | brandonw | whatever it is called, i can't remember i am a complete maven newbie :) |
| 23:05 | cemerick | are you referring to the project coordinates? |
| 23:05 | brandonw | the groupid i think it is called |
| 23:05 | cemerick | ok, right |
| 23:05 | brandonw | putting it in the scope of your user, instead of the root scope (where the project owner would typically publish it) |
| 23:06 | cemerick | not sure what you mean by scope either, but that's OK :-) |
| 23:07 | brandonw | less programming scope, more general definition of scope |
| 23:07 | cemerick | it's a little bit of an odd situation, as it's rare AFAIK for artifacts to be published by someone other than their maintainer |
| 23:09 | brandonw | yeah definitely |
| 23:09 | brandonw | well |
| 23:09 | brandonw | rare in very popular projects |
| 23:10 | brandonw | and also rare when the repo you are publishing is primarily for a language that the original project was not designed specifically for |
| 23:10 | brandonw | it seems to be fairly common to develop a clojure wrapper around a java library, and host the java library in a user groupid on clojars.org, just to give clojurians ease of access via leiningen |
| 23:11 | brandonw | or whatever maven-compatible build tool one uses |
| 23:12 | cemerick | well, that's OK as long as the java lib isn't available elsewhere in maven-land. (not that I know what's in clojars well at all) |
| 23:13 | brandonw | right |
| 23:15 | brandonw | are there a lot of public maven repos out there? i looked briefly, and all i saw was some people opining that that mvnrepository.com had too many hurdles to overcome in order to get something published to it |
| 23:16 | cemerick | yes, there are tons of 'em |
| 23:17 | cemerick | central is certainly the largest, followed by apache and codehaus probably. There's some way to host a maven repo out of github and google code projects as well, or so I hear. |
| 23:17 | carkh | is it possible to browse the available clojars ? |
| 23:18 | cemerick | carkh: clojars.org/repo |
| 23:18 | carkh | ah ok thanks |
| 23:18 | carkh | there maybe should be a link to this from the main page |
| 23:18 | cemerick | brandonw: getting things into central is becoming easier and easier, especially if you're signing your poms and artifacts. |
| 23:19 | brandonw | cemerick: interesting. the library i am uploading to clojars is not in a complete enough form to be used as a library at the moment, so i don't think the maintainer(s) would mind if i upload it to clojars, but they are hosted on google-code, so i wonder if they have any plans to utilize the mvn repo feature |
| 23:20 | brandonw | i should rephrase and say the version they are currently hosting on google code is not in an immediately usable library form |
| 23:21 | cemerick | brandonw: looks like the google code-as-maven-repo thing is a hack, but I've come across them fairly often: http://www.jroller.com/mrdon/entry/find_of_the_day_wagon |
| 23:22 | doseq | Does anyone know if contributor agreements can be faxed? |
| 23:23 | cemerick | doseq: I remember Rich required that I send mine snail-mail. |
| 23:23 | doseq | k, yeah I figured that was the case. Thanks. |
| 23:24 | doseq | What country are you in? |
| 23:24 | cemerick | US |
| 23:24 | doseq | Australia here :) |
| 23:24 | cemerick | So you should be all set by Thanksgiving! ;-) |
| 23:27 | doseq | I'll have to shell out for express delivery. |
| 23:29 | _ato | it took mine a month to arrive via regular snail mail (from Australia) |