2009-12-31
| 00:01 | arohner | technomancy: lexical scope is implemented as a stack of maps in the compiler |
| 00:01 | arohner | it's in compiler.java |
| 00:02 | technomancy | yeah, I've got that in front of me... but it's 5000+ lines. =) |
| 00:02 | technomancy | if they're real clojure maps then they must be copied from the enclosing scope |
| 00:02 | technomancy | since otherwise the enclosing scope couldn't have local-clearing done due to immutability |
| 00:03 | arohner | check out registerLocal() |
| 00:03 | arohner | that will point you at enough variables to keep you busy |
| 00:03 | arohner | :-) |
| 00:03 | technomancy | heh |
| 00:03 | technomancy | thanks |
| 00:03 | arohner | yes, it's a real persistent map |
| 00:04 | technomancy | since functions compile to methods, function locals are just method locals that get nulled out after the function returns IIRC, but the enclosing scope is an IPersistentMap |
| 00:06 | arohner | LetExpr is also worth checking out |
| 00:07 | technomancy | soooo freaking spoiled by clojure |
| 00:07 | technomancy | my brain cannot hold a single method that's longer than a page |
| 00:08 | devlinsf | technomancy: a direct deref causes the error too (no surprise) |
| 00:08 | technomancy | actually, that has nothing to do with clojure, I couldn't do that before I learned clojure either. never mind. |
| 00:08 | technomancy | devlinsf: yeah, in Delay.java deref is implemented as just calling force |
| 00:09 | devlinsf | Yeah, I'm looking at the source too. Still, testing beat analysis every time :) |
| 00:09 | danlarkin | clojure makes me wary of namespaces that are much longer than a page :) |
| 00:09 | danlarkin | s/namespaces/files/ |
| 00:10 | devlinsf | technomancy: Hey, I just used a future instead |
| 00:10 | devlinsf | technomancy: worker properly |
| 00:11 | technomancy | huh. futures are also thin wrappers around fns, albeit with a little more JVM infrastructure pulled in. |
| 00:13 | devlinsf | checking out future-call.... |
| 00:13 | hugod | Adding a (println x) after (do-something x) makes things work too - is the argument being optimised away? |
| 00:15 | devlinsf | hugod: what about (println :foo) ? |
| 00:16 | hugod | devlinsf: that worked as well |
| 00:16 | devlinsf | Hmmm... futures are wrapped in an agent |
| 00:18 | technomancy | devlinsf: sort of... I think they actually just share a thread-pool with agents |
| 00:18 | devlinsf | Yeah, you're right |
| 00:20 | technomancy | well the main thing I'm learning here is that I'm not cut out to write a compiler |
| 00:20 | devlinsf | clojure.lang.Compiler? |
| 00:22 | devlinsf | It would be nice to have some of the static classes in their own package |
| 00:22 | devlinsf | easier to follow |
| 00:22 | devlinsf | at least, I think so |
| 00:23 | technomancy | but I don't know Java, so... |
| 00:24 | devlinsf | I understand why it's like that. It's not an easy inheritance system to get right |
| 00:25 | devlinsf | But the random blocks of dead code 50 lines long? |
| 00:25 | devlinsf | It'd be nice to clean those out |
| 00:26 | technomancy | well I'd assume they were commented out before the move to git |
| 00:26 | technomancy | back when finding stuff from your history was hard. =) |
| 00:27 | devlinsf | Yeah. Once 1.1 is official, then I'll bring it up |
| 00:29 | technomancy | wouldn't agonize over it too much since cinc will make it go away. |
| 00:34 | hugod | writing the delay body as a call to a local function closing over x works. adding a {:once true} hint to the local function breaks it.. |
| 00:35 | devlinsf | hugod: But writing a local fn and closing over delay does NOT |
| 00:36 | technomancy | hugod: what's :once? |
| 00:37 | hugod | no idea - its used in the delay macro delay |
| 00:48 | technomancy | line 3845 of Compiler.java |
| 00:48 | technomancy | if(fn.onceOnly) { fn.emitClearCloses(gen); } |
| 00:48 | technomancy | |
| 00:49 | technomancy | looks like :once is only used for lazy seqs and delays |
| 00:49 | technomancy | I wonder if lazy seqs would exhibit the same problem |
| 00:50 | technomancy | but I'm headed off for today; bye folks. |
| 00:50 | Mec_ | is there a simpler way to write: (. (SomeClass. initValue) method) |
| 00:52 | devlinsf | (-> initValue Someclass. .method) |
| 01:16 | defn | what's the difference between rest and next |
| 01:17 | defn | ,(doc rest) |
| 01:17 | defn | ,(doc next) |
| 01:18 | defn | nevermind |
| 01:19 | replaca_ | next supports nil punning |
| 01:19 | defn | ,(rest '()) => () |
| 01:19 | chouser | next forces an extra step of a lazy seq in order to return nil it's empty |
| 01:19 | defn | ,(next '()) => nil |
| 01:19 | defn | *nod* |
| 01:19 | replaca_ | yup, you got it |
| 01:19 | defn | ty |
| 02:10 | hiredman | ~ping |
| 02:10 | clojurebot | PONG! |
| 02:10 | chouser | yay |
| 02:12 | chouser | I think the problem is that, because the last expr in a try block produces the value that will be returned, it is compiled in a "return" context (a.k.a. tail position) |
| 02:13 | chouser | therefore the locals are cleared before calling the final function |
| 02:14 | chouser | but if that final call throws an exception, you end up in the catch clause with your locals cleared. |
| 02:16 | chouser | ,((let [x :foo] (#^{:once true} fn* [] (try (#(throw (Exception.))) (catch Exception e (println "x:" x)))))) |
| 02:16 | clojurebot | chouser: I don't understand. |
| 02:16 | chouser | :-( |
| 02:21 | chouser | emitClearLocals protects against this problem by using localsUsedInCatchFinally, but emitClearCloses (used only when :once is true) does not. |
| 02:30 | chouser | but the solution is so very far beyond me |
| 02:31 | chouser | I guess the simplest might be to skip clearing of closed-overs that are used in catch/finally clauses, but I don't think those are currently tracked. |
| 03:17 | LauJensen | Morning team |
| 03:17 | defn | 'lo Lau |
| 03:20 | defn | LauJensen: welcome to the monkey house |
| 03:20 | LauJensen | I sure like them monkeys :) |
| 03:21 | defn | i always carry a minimum of three monkeys |
| 03:21 | defn | ..just in case.. |
| 03:25 | defn | good evening cgrand |
| 03:29 | neotyk | morning |
| 03:29 | neotyk | can someone help with clojure-test-mode |
| 03:29 | neotyk | ? |
| 03:30 | defn | neotyk: what about it? |
| 03:30 | neotyk | well I don't have it :P |
| 03:31 | defn | what editor do you use? |
| 03:31 | neotyk | and when I do M-x package-install |
| 03:31 | neotyk | emacsitor |
| 03:31 | defn | what's emacsitor? |
| 03:31 | neotyk | emacs |
| 03:31 | defn | when you do M-x package-install?? |
| 03:32 | neotyk | now, in running session |
| 03:32 | neotyk | so after M-x package-install |
| 03:32 | neotyk | i say clojure-test-mode |
| 03:33 | neotyk | and get message that swank-clojure.el exists |
| 03:33 | neotyk | and no clojure-test-mode is installed |
| 03:33 | neotyk | :/ |
| 03:34 | neotyk | is elpa recomended for aquamacs? |
| 03:34 | neotyk | or should I focus on manual procedure |
| 03:37 | LauJensen | neotyk: It works I know that, but not if its recommended |
| 03:41 | cgrand | defn: good morning (or whatever time it is in your timezone) |
| 03:41 | neotyk | LauJensen: how do i get test mode? |
| 03:41 | LauJensen | neotyk: That I don't know - I'm very uncomfortable in OSX - I'm just saying that the ELPA install for Clojure-mode works fine |
| 03:41 | neotyk | clojure-mode is ok |
| 03:41 | neotyk | clojure-test-mode is fail |
| 05:39 | LauJensen | I've added a custom search to my site, which runs through hackernews, lambda-the-ultimate, clojure.org etc for whatever you search for - is that usable for anyone, or just bloat? http://www.bestinclass.dk/index.php/blog/hackersearch/ |
| 05:43 | LauJensen | I mean, there's one definite advange, if you search for "ikeda map" you actually get a Clojure implementation as the first hit - where else do you get that? :) |
| 05:51 | vy | LauJensen: 1337. |
| 05:51 | LauJensen | Exactly |
| 06:33 | fliebel | Good morning |
| 06:35 | fliebel | Is there any way I can use a delay/future/atom/whatever without the need to use @ every time? |
| 06:38 | fliebel | Or the other way around, use @ one a value if I'm not sure if it needs to be dereferenced or not. |
| 06:49 | somnium | fliebel: if youre not sure if its mutable then YDIW |
| 07:00 | fliebel | YDIW? what is that? |
| 07:00 | somnium | fliebel: you're doing it wrong ;) |
| 07:00 | fliebel | ah... |
| 07:01 | somnium | @foo expands to (deref foo), so you could write a fn that does that |
| 07:02 | fliebel | Well, the point is that if I put a delay in a map and along the way something does something to the data and puts it back, the rest of the application screws up thinking that it needs to @ it. |
| 07:02 | fliebel | Yea, right now I wrote my own macro with a try in it. |
| 07:04 | somnium | fliebel: if you access a delay with force why do you need deref? |
| 07:07 | fliebel | somnium: whoa! That is magic! force just returns any value, that will work! |
| 07:07 | somnium | fliebel: no... |
| 07:07 | fliebel | ? |
| 07:07 | somnium | fliebel: delay is about laziness, delaying evaluation |
| 07:08 | somnium | fliebel: atoms are about identity and state |
| 07:08 | fliebel | somnium: I know, I mean that (force 1) just works, while (deref 1) throws. |
| 07:09 | Chousuke | fliebel: check whether it implements IDeref |
| 07:10 | fliebel | If I write delay on the bottom of a -> macro, will that delay the whole ->? |
| 07:10 | Chousuke | hm, yes. |
| 07:12 | fliebel | cool |
| 07:12 | fliebel | I guess that would not work if -> where a function :) |
| 07:13 | fliebel | Chousuke: can you help me unravel another stacktrace? |
| 07:15 | fliebel | http://gist.github.com/266711 |
| 07:15 | fliebel | I hate those things… Wading through Java and Clojure internals to find your own function. |
| 07:16 | cemerick | fliebel: there's a lib somewhere in contrib that will filter out the noise, if you're so inclined |
| 07:16 | Chousuke | hm, wasn't it moved to clojure itself? |
| 07:17 | fliebel | cemerick: ah, godsend! |
| 07:17 | Chousuke | clojure.stacktrace, as of 1.1 |
| 07:18 | fliebel | How do I use it? Just require it somewhere? |
| 07:18 | Chousuke | yeah. |
| 07:19 | Chousuke | though unless you get the exception in a repl, you'll have to catch it and print the stacktrace in the catch block. |
| 07:20 | fliebel | Hmmm, so just wrap everything in a try? |
| 07:21 | Chousuke | or run stuff from the repl |
| 07:21 | Chousuke | since you can access the last exception as *e |
| 07:21 | fliebel | hmmm |
| 07:23 | Chousuke | anyway, in that case it seems the error is in the utterson.core/reader function |
| 07:24 | ska2342 | can someone please give me one example each for a "namespace-qualified" and a "package-qualified" symbol? Are they different in any way, except that one names Clojure-symbols and the other Java-classes? |
| 07:24 | Chousuke | ska2342: they're similar. |
| 07:25 | ska2342 | Chousuke: similar, yes, but exactly the same? Have you ever come across an example where the order of evaluation mattered? |
| 07:25 | Chousuke | order of evaluation? |
| 07:26 | ska2342 | Chousuke: according to http://clojure.org/evaluation the namespace-qualified symbols are resolved first. |
| 07:26 | Chousuke | I don't think it matters |
| 07:26 | Chousuke | you can never have a java class that would conflict with a clojure namespace. |
| 07:27 | ska2342 | Why? |
| 07:27 | Chousuke | without getting weird errors everywhere, that is |
| 07:28 | ska2342 | Hm. It's just that I'd like to *know* ;-) |
| 07:28 | Chousuke | the names should be unique. it'll just be a naming conflict. :/ |
| 07:30 | ska2342 | My problem here is "should be" vs. "are". Can't be vague when doing documentation. |
| 07:30 | Chousuke | I guess a package-qualified symbol is foo.bar.java.Class(/somefield) and a namespace-qualified is foo.bar/something |
| 07:31 | Chousuke | where foo.bar is a namespace, of course. |
| 07:31 | ska2342 | Yes, that is my understanding, too. In that case they just look the same. |
| 07:57 | fliebel | What are the advantages and intended uses of structmap? |
| 07:57 | Chousuke | saving memory if you have lots of maps with the same keys |
| 07:58 | cemerick | largely replaced by deftype |
| 07:59 | fliebel | deftype? *opens repl* |
| 07:59 | fliebel | Unable to resolve var: deftype :( |
| 08:00 | cemerick | fliebel: it's only in the 'new' branch |
| 08:00 | fliebel | I'm not on new... |
| 08:06 | fliebel | So far defstruct is only giving headaches… Key's not in the struct are not showing up. |
| 08:36 | fliebel | Hm, this is not the git channel, but does anyone know how to checkout master undoing merge I did? |
| 08:37 | fliebel | It just shows "Your branch is ahead of 'origin/master' by 4 commits" |
| 08:38 | balint | fliebel: do you want to completely discard the 4 latest commits? |
| 08:39 | fliebel | no… well I don't know, i'm new to git. I merged in a branch. which contained 4 commits I guess… but I want to.. uhm unmerge that. |
| 08:40 | fliebel | never mind… I'm just playing around, I don't desperately need it. |
| 08:40 | Chousuke | you can copy your current master to another branch |
| 08:40 | Chousuke | just do git co -b saved-master from the master branch |
| 08:41 | Chousuke | then git co master && git reset --hard origin/master |
| 08:41 | lpetit | memorize the version you want to take master back. Then edit .git/refs/heads/master and replace the version. That should do the trick, as far as I understand git |
| 08:41 | lpetit | after all, master is just a label on a particular commit |
| 08:42 | Chousuke | you shouldn't need to edit any files directly :) |
| 08:42 | balint | lpetit: that's a bit "low-level" :) |
| 08:42 | lpetit | I understand, but that's the beauty of the simplicity of git :) |
| 08:42 | fliebel | It's not important enough for that stuff… I wanted to add a file before the merge instead of after, just to see how merging works so that I'm prepared when I actaully need to merge things for real, now it just did a fast worward, which is not half the fun :( |
| 08:42 | balint | fliebel: you can check what version want to return to by: git show master@{4} |
| 08:43 | lpetit | It's no porcelaine, not even plumbing, it's digging :-) |
| 08:43 | Chousuke | balint: he wants to return to origin/master |
| 08:43 | Chousuke | which can be done with git reset --hard origin/master |
| 08:43 | lpetit | indeed, that's the way to go |
| 08:43 | balint | Chousuke: ah, yep, you are right |
| 08:43 | fliebel | brrr, scary… I'll try it :D |
| 08:44 | Chousuke | fliebel: save your commits in another branch first |
| 08:44 | balint | fliebel: just make sure you still have the changes on another branch (e.g the one you merged master with) git reset --hard deletes them for good |
| 08:44 | fliebel | Chousuke: everything important is in simplify... |
| 08:44 | Chousuke | you can actually do it by just writing "git branch saved" on your current master |
| 08:44 | lpetit | fliebel: as long as you won't run a "prune" command, your commits won't be lost. Just steganographied :-) |
| 08:45 | Chousuke | it takes about the blink of an eye so you lose nothing by saving things :P |
| 08:46 | fliebel | ah, it worked... |
| 08:46 | Chousuke | then you can always checkout the saved branch and take a look at it. |
| 08:46 | Chousuke | I usually don't touch master at all |
| 08:47 | lpetit | fliebel: git is like clojure. Persistent trees and the like. Never does a destructive update. And garbage collection (of commits that are not referenced from any label -aka branch name-) is triggered by you, so in the mean time, it's still possible to view "dangle" commits |
| 08:47 | Chousuke | I do all development on other branches and then just generate patches against master. or merge master and the dev branch and then push the dev branch as a new master :) |
| 08:47 | fliebel | hmmm |
| 08:48 | Chousuke | git it really interesting in that you can actually combine completely different repositories |
| 08:48 | fliebel | what does this imply> error: Entry 'src/utterson/plugin/tagspages.clj' not uptodate. Cannot merge. |
| 08:48 | Chousuke | you can just pull a branch from a random repository into a local one. |
| 08:48 | fliebel | Chousuke: So I can merge like.. jQuery into Utterson? :P |
| 08:49 | Chousuke | well, not merge. not very easily |
| 08:49 | Chousuke | but you could have them in separate local branches. |
| 08:49 | fliebel | that is fun... |
| 08:49 | Chousuke | it's not very useful most of the time though. |
| 08:50 | Chousuke | usually you'd like branches to be part of the same tree... |
| 08:50 | fliebel | Can I pull one file from a previous revision and put it in the current one? |
| 08:50 | fliebel | Say… 4 revisions ago... |
| 08:50 | Chousuke | well, that's not pulling |
| 08:50 | fliebel | check out, revert, whtever |
| 08:51 | Chousuke | I think git co HEAD~4 -- filename would do it |
| 08:51 | Chousuke | then you of course need to git add the changes |
| 08:51 | Chousuke | and commit them |
| 08:51 | rhickey | aargh - clojure-version still has trailing dash for release version |
| 08:52 | Chousuke | the index is another feature of git I like. |
| 08:52 | lpetit | hadn't it be corrected ? |
| 08:53 | Chousuke | it gives you more control over what you actually commit. :) |
| 08:53 | Chousuke | so I can bash on files without committing for a long time and then split out the changes into separate commits. helps keep things clean |
| 08:54 | fliebel | huh? cool... |
| 08:54 | Chousuke | fliebel: git add --patch |
| 08:54 | rhickey | lpetit: maybe when qualifier is missing, but other things are broken then |
| 08:54 | Chousuke | fliebel: though it's not very user friendly |
| 08:54 | fliebel | hm |
| 08:54 | Chousuke | fliebel: you can basically stage chunks of code instead of whole files |
| 08:54 | Chousuke | (staging = included in next commit) |
| 08:55 | fliebel | Chousuke: that must create a maze in your mind what belongs where and work with which code... |
| 08:55 | Chousuke | fliebel: well, sometimes. |
| 08:55 | Chousuke | fliebel: but sometimes it's also easy to see that you have made two unrelated changes in one file |
| 08:55 | Chousuke | combined with rebase that's also interesting :P |
| 08:56 | Chousuke | when I was mostly done with my reader I cleaned it up and that included rebasing it against a recent master, combining and splitting commits in the process :P |
| 08:57 | Chousuke | because I had some "random fixes" and "blah" commits in my local history |
| 08:58 | lpetit | rhickey: humm, I'm at work, but maybe I can take a quick look at that |
| 09:00 | rhickey | lpetit: thanks, but I'm on it |
| 09:00 | lpetit | ok |
| 09:07 | lpetit | rhickey: want to release 1.1.0 before the end of the year ? |
| 09:07 | rhickey | lpetit: before the end of the hour, I hope |
| 09:07 | lpetit | :) |
| 09:12 | lpetit | Was thinking (related to my reflexions on how to port an existing application to clojure) : doesn't we conflate two different things by creating new types via deftype, thus imposing 1/ a single implementation of datastructure for the type, and 2/ a single type for a datastructure ? |
| 09:13 | lpetit | For 2/, I mean maybe I want to create a personalized datastructure with high performance, so I use deftype for this purpose. But then, I can just plug one implementation of a protocol for the type. If I want the exact same datastructure definition for another type, I have to recreate this type from scratch. |
| 09:17 | lpetit | Currently, I see types that can be defined via deftype more like "technical types" aimed at allowing clojure core datastructures be written in clojure. But I "feel" it couldn't scale well for other use cases (more general business use cases). Something having to do with the protocols/types and multimethods impedance mismatch (sort of) |
| 09:19 | fliebel | ,(println "welcome back clojurebot, where have you been?") ;Is he really back? |
| 09:19 | clojurebot | welcome back clojurebot, where have you been? |
| 09:20 | lpetit | ,(clojure-version) |
| 09:20 | clojurebot | "1.1.0-alpha-SNAPSHOT" |
| 09:20 | lpetit | ,(doc deftype) |
| 09:20 | clojurebot | "([name [& fields] & [[& interfaces] & methods]]); Alpha - subject to change Dynamically generates compiled bytecode for an anonymous class with the given fields, and, optionally, interfaces and methods. The Name will be used to create a dynamic type tag keyword of the form :current.ns/Name. This tag will be returned from (type an-instance). A factory function of current.ns/Name will be defined, overloaded on 2 arities, t |
| 09:20 | lpetit | seems so |
| 09:22 | fliebel | Bleh…. If I require a ns in the ns declaration, how can the required ns use things from it's source? |
| 09:23 | lpetit | fliebel: huh ? |
| 09:23 | fliebel | haha, it's basically a circular dependency. I hit those over and over :( |
| 09:24 | lpetit | fliebel: time to refactor things then :-) |
| 09:25 | fliebel | yea… Is putting all the stuff needed by more than one in a third ns a good plan? |
| 09:26 | fliebel | I have a defstruct that I need in multiple places |
| 09:27 | rhickey | http://clojure.blogspot.com/2009/12/clojure-11-release.html |
| 09:27 | fliebel | Hurray! (?) |
| 09:28 | lpetit | fliebel: probably |
| 09:31 | lpetit | rhickey: splendid ! |
| 09:37 | lpetit | Am I totally wrong/off-topic with my above reflexions, or is it just not the right time frame for me to speak about that ? |
| 09:53 | cemerick | replaca: the new docs are looking pretty great, I hadn't looked at them lately |
| 10:03 | fliebel | How can this trigger a reflection warning? #(.contains #^String (or (:tags %) "") #^String (:body a)) |
| 10:05 | fliebel | Technically speaking contains takes a CharSequence, what do I do with that? It does work with a string... |
| 10:16 | fliebel | Meh, moving the #^String a bit worked… silly stuff. |
| 10:16 | lpetit | ,(#(.contains #^String (or (:tags %) "") #^String (:body {:body "c"})) {:tags "hello"}) |
| 10:16 | clojurebot | false |
| 10:17 | lpetit | ,(set! *warn-on-reflection* true) |
| 10:17 | clojurebot | java.lang.IllegalStateException: Can't change/establish root binding of: *warn-on-reflection* with set |
| 10:17 | lpetit | ,*warn-on-reflection* |
| 10:17 | clojurebot | false |
| 10:17 | chouser | 'or' loses type hints |
| 10:18 | lpetit | oh |
| 10:18 | chouser | apparently. |
| 10:18 | chouser | :-/ |
| 10:18 | chouser | I haven't had my tea yet -- can't think... is there any way for a macro to get at metadata put on its calling form? |
| 10:22 | devlinsf | rhickey: Congrats on getting 1.1 out the door! |
| 10:36 | defn | chouser: The return value of invoke() is the value of the call expression. If the function call form has metadata, it may be used by the compiler, but will not be part of the resulting value. |
| 10:40 | rhickey | devlinsf: thanks for your help, and everyone else's! |
| 10:40 | devlinsf | n/p |
| 10:40 | rhickey | chouser: not right now |
| 10:41 | BrianB04 | Morning all. |
| 10:42 | devlinsf | Oooh, just noticed something. |
| 10:42 | devlinsf | Should someone create a contrib 1.1 compatible branch? |
| 10:42 | lpetit | Bye all, cu next year ! |
| 11:25 | BrianB04 | I have a quick question: After building clojure + clojure-contrib, can they be moved, or do they hardcode the locations of each other anywhere during compiling? |
| 11:27 | Chousuke | BrianB04: you can move them |
| 11:28 | BrianB04 | Chousuke: Great, thanks much. I built them in ~/src, but I have a habit of clearing that out from time to time. |
| 11:29 | the-kenny | BrianB04: They're just normal .jars. You can do with them everything you can do with every other jar |
| 12:29 | rbe | hi |
| 12:35 | arohner | rbe: hi |
| 12:40 | gko | Hello: which swank-clojure should be used? jochu's or technomancy's? |
| 12:44 | ghotli | i'm using technomancy's on ubuntu 9.10 with emacs23 and it works just fine |
| 12:45 | gko | OK, I'll try the technomancy's swank-clojure/clojure-mode. |
| 12:46 | ghotli | i had a lot of trouble getting swank-clojure to work on 9.04 |
| 12:46 | ghotli | if that's what your using. |
| 12:46 | ghotli | i finally gave up and upgraded to 9.10 and it behaved. |
| 13:06 | gko | Yeah, I haven't used it for 4 months and thought I'll update the whole stuff... The jochu version have changed a lot since then.. |
| 13:14 | Raynes | Is there a generally agreed on blog post or something that details setting up Emacs with Slime for Clojure for new users? I've been set up forever, but I'm not sure what to tell my friend who want's to get into Clojure. :\ |
| 13:15 | Raynes | I mean, I suppose I could get him set up, but I'd rather not reiterate instructions for installing ELPA and such if possible. |
| 13:24 | aldebrn | Raynes, I was going to try this http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started#Emacs_.2F_Slime_.2F_Clojure_on_Ubuntu_-_Tutorial |
| 13:24 | aldebrn | But can't vouch for its accuracy/clarity |
| 13:24 | Raynes | Maybe I should just write my own post :| |
| 13:26 | Raynes | technomancy should write and maintain a tutorial for setting up Emacs for Clojure, and link to it from the clojure-mode or swank-clojure README. It would certainly end a lot of questions. |
| 13:26 | Raynes | Considering that if I write a tutorial, it wont include instructions for emacs-starter-kit because I don't use it, so I doubt it would have his approval. :p |
| 13:34 | defn | I love technomancy, but I disagree with starter kits at least in the sense that I don't think anyone ever really learns anything about emacs unless they configure it themselves. |
| 13:35 | mebaran151 | what's letrec in clojure? |
| 13:35 | gko | By the way, what's working version of swank-clojure with Clojure 1.1? HEAD of master? |
| 13:35 | defn | Raynes: that being said, I'd like to write an article on that |
| 13:35 | defn | just more general, no emphasis on the starter-kit |
| 13:35 | gko | In my previous version, there was a " |
| 13:35 | gko | swank-clojure-autoload.el" |
| 13:36 | defn | mebaran151: as of 2007 there wasnt one and you needed to use recur/loop |
| 13:37 | gko | but in the last version, none. So I checked out branch "clojure-1.1". This one runs OK, but I have to evaluate one expression before having the "Connected ..." (and clean buffer) message. If I then tries something like completion, I have a "Exception in thread "Read Loop Thread" java.lang.RuntimeException: clojure.lang.LispReader$ReaderException: java.lang.Exception: Invalid token: swank::". |
| 13:37 | gko | Argh. |
| 13:37 | mebaran151 | I can't recur loop: I want to write a recursive anonymous function that absorbs its environment |
| 13:38 | defn | gko: get elpa |
| 13:38 | mebaran151 | to get started with Clojure, I think the Netbeans setup with the plugin is actually the best way |
| 13:38 | defn | mebaran151: http://osdir.com/ml/java.clojure.user/2008-07/msg00319.html would something like that work for you? |
| 13:38 | mebaran151 | it *just works* |
| 13:39 | defn | gko: get elpa, then install swank-clojure clojure-mode slime and slime-repl |
| 13:39 | gko | defn: OK, I'll take a look. |
| 13:39 | mebaran151 | actually I think letfn will do it.... |
| 13:39 | gko | defn: is it the general Slime or a customized one ? I need it to work with Common Lisp too... |
| 13:39 | defn | mebaran151: yeah thats right |
| 13:40 | defn | letfn is letrec for funtctions only |
| 13:40 | mebaran151 | says it allows a function to refer to its and its closed bindings |
| 13:40 | defn | functions* |
| 13:40 | mebaran151 | *itself |
| 13:40 | mebaran151 | seems like you could always wrap a recursive definition in thunk though no? |
| 13:41 | defn | mebaran151: thunk? |
| 13:41 | defn | oh nvm |
| 13:41 | mebaran151 | as in a closure |
| 13:42 | defn | yeah that seems reasonable |
| 13:42 | mebaran151 | basically what I'm writing is a functional way to walk a neo4j namespace and build a nested hashmap one could use with clojure zippers |
| 13:42 | mebaran151 | for recursive relationships, I thunk them |
| 13:43 | mebaran151 | so you never infinite loop, but if you want to go back you can call the function and get the right subsection of the node-space |
| 13:43 | mebaran151 | I think I reinvented the trampoline... |
| 14:00 | cupertinochad | Can I ask a simple newbie question? |
| 14:01 | tolstoy | cupertinochad: People often do! |
| 14:01 | cupertinochad | How can I get the ASCII value of a character? |
| 14:01 | dandersen | There is _always_ a Russian writer in every channel I join. |
| 14:02 | tolstoy | Heh. |
| 14:06 | aking | cupertinochad: (int \a) |
| 14:06 | aking | ,(int \b) |
| 14:06 | clojurebot | 98 |
| 14:06 | cupertinochad | Many thanks! |
| 14:06 | aking | ,(int \B) |
| 14:06 | clojurebot | 66 |
| 14:07 | tolstoy | Any hints on how you might unit test a compojure based app? |
| 14:08 | tolstoy | Hm. Maybe the source code will help. |
| 14:16 | triddell | aldebrn: I wrote the tutorial you referenced earlier... it worked in Oct... not sure now... I will be trying is again on a new Ubuntu 9.10 setup soon though |
| 14:18 | mebaran151 | the easiest way to get a repl is to use the lein repl command heh |
| 14:18 | mebaran151 | just looking through the wikibook, it should probably reference lein |
| 14:45 | shr3kst3r | shouldn't "do" be in clojure.core documentation? |
| 14:45 | chouser | it's a special form |
| 14:46 | chouser | so like 'if', 'def', 'let', etc. it's over at http://clojure.org/special_forms |
| 14:46 | shr3kst3r | ah, cool, i was just wonder |
| 14:47 | shr3kst3r | i guess i got confused by "let" it is in both places |
| 14:50 | KirinDave | Is there a way in the args string of a defn to name it something else? |
| 14:50 | KirinDave | I'd like my signature to be [x y z] but for underlying reasons I want to use [& args] |
| 14:53 | KirinDave | cemerick: I liked your response to jfl on hackernews. |
| 14:54 | shr3kst3r | maybe something like defn f [& {:keys [x y]} args] |
| 14:55 | KirinDave | Ahh, I can actually set :arglists in the meta. |
| 14:56 | KirinDave | What's the right way to do that in 1.1? I'm confused over the #^ vs. ^ thing. |
| 14:56 | KirinDave | Is #^{} the right way moving forward? |
| 15:08 | chouser | KirinDave: ^ still has the old meaning for now. #^{} is correct |
| 15:22 | KirinDave | chouser: Got it. |
| 15:22 | KirinDave | shr3kst3r: I guess this is the right way: https://gist.github.com/91d213ba84940cf0fdfe |
| 15:23 | KirinDave | it's still less typing than redoing the arguments logic in the other function though |
| 15:25 | dabd | which version of clojure-contrib should be used with clojure-1.1.0 |
| 15:25 | chouser | dabd: for now 'master', I believe |
| 15:25 | dabd | chouser: thx |
| 15:54 | notostraca2 | can anyone tell me how to call a function on every value in a map for a certain key? |
| 15:54 | cemerick | KirinDave: Thanks. Comments like that are particularly pernicious. |
| 15:55 | notostraca2 | like if I have {:key1 "bob" :key2 "phil"} and I want to change all :key1 s to "sally" |
| 15:56 | notostraca2 | I can't seem to figure out clojure.walk |
| 16:00 | notostraca2 | I'm really kinda stuck here |
| 16:04 | notostraca2 | I keep getting the error |
| 16:04 | notostraca2 | nth not supported on this type: Symbol |
| 16:05 | notostraca2 | but I never call the function nth, so it must be in one of the library functions |
| 16:08 | chouser | cemerick: link? |
| 16:09 | chouser | notostraca2: a map will only have at most one value for a given key -- I don't think I understand what you want. |
| 16:09 | notostraca2 | i have a vector of structs |
| 16:09 | notostraca2 | and i need to go through that vector |
| 16:10 | chouser | ah, ok. |
| 16:10 | notostraca2 | and call (ref-set) on each :img |
| 16:10 | notostraca2 | (the value of each :img key) |
| 16:11 | chouser | ,(into [] (map #(update-in % [:a] inc) [{:a 1 :b 2} {:a 3 :b 4}])) |
| 16:11 | clojurebot | [{:a 2, :b 2} {:a 4, :b 4}] |
| 16:11 | chouser | notostraca2: something like that? |
| 16:12 | notostraca2 | I am new to clojure, so most of that looks like gibberish right now -- what is %? |
| 16:12 | chouser | hm, sorry. |
| 16:12 | chouser | ,(into [] (map (fn [v] (update-in v [:a] inc)) [{:a 1 :b 2} {:a 3 :b 4}])) |
| 16:12 | clojurebot | [{:a 2, :b 2} {:a 4, :b 4}] |
| 16:13 | cemerick | chouser: I think KirinDave was referring to this: http://news.ycombinator.com/item?id=1023270 |
| 16:13 | chouser | ,(into [] (map (fn [m] (assoc m :a (inc (get m :a)))) [{:a 1 :b 2} {:a 3 :b 4}])) |
| 16:13 | clojurebot | [{:a 2, :b 2} {:a 4, :b 4}] |
| 16:14 | chouser | notostraca2: those are all essentially the same |
| 16:15 | notostraca2 | chouser: how do I ask clojurebot what these functions mean? |
| 16:15 | notostraca2 | in particular into |
| 16:19 | KirinDave | cemerick: Pernicious but somewhat entertaining. |
| 16:20 | KirinDave | cemerick: The asshole college student segment is certainly on the rise at news.ycomb. If not in numbers, than at least in boldness. |
| 16:20 | KirinDave | cemerick: "My subjective view… Peace." |
| 16:20 | KirinDave | cemerick: Why didn't he just go whole hog and say, "You don't know me, muthafucka. Don't judge! *finger wag*" |
| 16:21 | arohner | ,(doc into) |
| 16:21 | clojurebot | "([to from]); Returns a new coll consisting of to-coll with all of the items of from-coll conjoined." |
| 16:21 | cemerick | KirinDave: I was really surprised at the reaction to the post in general. A lot of machismo, chest-beating junk. The girls and spiders thing was particularly striking. |
| 16:22 | KirinDave | cemerick: Yeah. |
| 16:22 | KirinDave | cemerick: Well unfortunately that's how a lot of americans, of which news.ycomb is particularly rich, view this sort of thing. |
| 16:23 | KirinDave | cemerick: There is really a paucity of education about functional programming or even practical concurrent programming in most CS programs in the US. It's sad because they were finally catching up but then this concurrent programming problem snuck up on them. |
| 16:25 | cemerick | I don't know if any geopolitical generalizations can be made, but the pendulum has definitely swung towards purely vocational training AFAICT. |
| 16:28 | KirinDave | cemerick: Since I am a product of more than 3 american universities I feel comfortable making that assertion. Justified? No. But comfortable? Hell yes. |
| 16:28 | KirinDave | cemerick: ;) |
| 16:28 | KirinDave | cemerick: But most people I know find the notion of functional programming to be something of a propellerhead sort of exercise. |
| 16:31 | cemerick | KirinDave: It's always been the case that the the majority have been "stuck" with the technologically-inferior options. PHP, VB, etc. |
| 16:31 | cemerick | I suppose that's bound to continue. |
| 16:33 | job_ | I've got a newbie question about namespaces; can anyone provide me some quick help? |
| 16:33 | cemerick | Happy new year, everyone. :-) |
| 16:35 | job_ | It's probably dead-simple. I'm just not familiar with how to "import" (using that loosely) a Clojure file to the REPL. |
| 16:37 | q2 | try (load-file) to straight upload text |
| 16:37 | q2 | otherwise (use) to import a library |
| 16:37 | q2 | or rather require / refer heh |
| 16:38 | job_ | so I've tried load-file, but after trying to refer to some of the symbols in the namespace I defined in the file, Java can't resolve the given symbol. |
| 16:39 | job_ | Ah! Nevermind, got it. Braindead mistake. |
| 16:39 | job_ | Thanks, |
| 17:03 | notostraca2 | chouser: I'm trying to figure out how to use what you showed me with ref-set |
| 17:03 | notostraca2 | so that i can change the refs inside the structs inside the vector |
| 17:05 | chouser | it's usually best to have refs at outer levels rather than inner ones. |
| 17:05 | notostraca2 | oh? |
| 17:05 | notostraca2 | i will try that |
| 17:06 | notostraca2 | so if my vector becomes a ref to a vector |
| 17:06 | notostraca2 | i wouldn't use into [] would I? |
| 17:06 | technomancy | chouser: thanks for that explanation on bug #232; very interesting stuff. |
| 17:06 | technomancy | re: locals clearing |
| 17:08 | chouser | notostraca2: the code I showed you would be the purely functional part. |
| 17:08 | chouser | if the code were in a fn names update-b or something, then you could appliy it to your ref-of-a-vector with (alter myref update-b) |
| 17:09 | notostraca2 | ah ok |
| 17:09 | chouser | which is what you want -- pure functions doing most of the work, better for thinking and testing. |
| 17:09 | notostraca2 | i'll try that, thanks |
| 17:09 | chouser | then small bits where you do some transactions and alters or whatever |
| 17:11 | chouser | technomancy: sure -- you showed the way, and I still can't see all the way to a solution. |
| 17:32 | Chousuke | hm |
| 17:35 | piccolino | What would that be? |
| 17:35 | hiredman | technomancy: we need scopes to land |
| 17:36 | technomancy | piccolino: all the I/O-related functions from contrib that I've found I use all the time |
| 17:36 | technomancy | want to open a discussion about standardizing them |
| 17:36 | piccolino | Ah, OK. |
| 17:36 | technomancy | I've found 90% of my contrib usage is for I/O functions |
| 17:36 | technomancy | hiredman: scopes? |
| 17:37 | piccolino | Yeah, or just make a standard library. |
| 17:37 | hiredman | clojurebot: scope? |
| 17:37 | clojurebot | scope is at http://paste.lisp.org/display/73838 |
| 17:37 | technomancy | piccolino: that's what I mean |
| 17:37 | hiredman | generic with-open sort of thing |
| 17:37 | piccolino | Oh, I meant a tighter relationship between core and contrib in general. |
| 17:38 | technomancy | piccolino: actually my secret ulterior motive is to abolish contrib. =) |
| 17:38 | hiredman | :D |
| 17:38 | piccolino | Awesome. Let's form a conspiracy. :) |
| 17:39 | technomancy | hiredman: looks handy. is that in the "new" branch? |
| 17:39 | hiredman | nope |
| 17:39 | hiredman | it's no where |
| 17:39 | technomancy | oh, heh |
| 17:40 | hiredman | I'd hate to have clojure.io just be a wrapper over java.io |
| 17:41 | hiredman | something like reader/writer but souped up into some kind of io dsl |
| 17:42 | technomancy | hiredman: so you'd rather iterate on an io lib to make it more idiomatic before getting it canonized? |
| 17:42 | chouser | I think you'd have to build it first (probably in contrib) so it could prove itself. |
| 17:43 | hiredman | good lord |
| 17:43 | chouser | you disagree? |
| 17:43 | hiredman | I think I'm thinking about a monad |
| 17:43 | chouser | heh |
| 17:43 | technomancy | mwahaha |
| 17:44 | hiredman | chouser: that's a good point |
| 17:44 | hiredman | duck-streams has gotten a lot of use |
| 17:45 | technomancy | hiredman: I could see how getting an io lib in now would make it harder to get a better one in place in the future |
| 17:45 | technomancy | needing to go through a deprecation phase makes things much more complicated |
| 17:45 | hiredman | clojure.nio |
| 17:45 | technomancy | but yeah, if we're just going by popular demand, duck streams is very proven |
| 17:45 | technomancy | hehe |
| 17:45 | hiredman | :P |
| 17:45 | Chousuke | :P |
| 17:46 | Chousuke | monads are fine. just, forcing non-functional things into the functional world using them is something you need to think twice about. |
| 17:47 | hiredman | mm |
| 17:47 | Chousuke | they're just another method of abstraction. |
| 17:48 | hiredman | I was thinking something that sort of collects all the io operations together, and analyzes them before settling on a reader or an inputstream |
| 17:48 | hiredman | but would be hard to make work everywhere |
| 17:49 | hiredman | arg |
| 17:49 | hiredman | we need scopes |
| 17:49 | technomancy | I wonder if we'll see an influx of interest in the next few weeks from people following their "1 new language a year" goals |
| 17:51 | Chousuke | clojure.org/todo is somewhat out of date btw |
| 17:51 | wdouglas | Haha quite the resolution |
| 17:51 | hiredman | maybe the reader pattern can be lifted even more, (io/lines [x FILE-STREAM-WHATEVER] do stuff here) |
| 17:51 | chouser | was that a yegge idea, or older than that? |
| 17:52 | chouser | 1 lang/year I mean |
| 17:52 | hiredman | you almost always need to call reader and with-open in conjuction anyway |
| 17:52 | Chousuke | I'm going to stick with clojure for at least one more year. :) |
| 17:54 | technomancy | chouser: it's from the Pragmatic Programmer (book) |
| 17:54 | chouser | oh, ok. |
| 17:54 | technomancy | I've heard the boot time for Clojure makes it untenable on those devices |
| 17:55 | technomancy | hiredman: yeah, that looks like a good move |
| 17:55 | technomancy | we've probably got a lot of time before 1.2 to figure it out. =) |
| 17:55 | Chousuke | that's one thing the jvm folks need to fix I guess. |
| 17:55 | chouser | nooo. I hope not |
| 17:56 | chouser | If 1.2 can beat our book deadlines, then we don't have to describe idiomatic use of defstruct, agent-errors, implicit head-holding... |
| 17:56 | Chousuke | so this time around will there be a 1.1.1? |
| 17:56 | chouser | doubt it |
| 17:57 | chouser | there was essentially no demand for bug fixes to 1.0 |
| 17:57 | Chousuke | I saw one bugfix in the 1.0 branch :& |
| 17:57 | Chousuke | but some kind of process for those bugfixes would be good to have. |
| 17:57 | chouser | technomancy: I wonder if a "native" android target for cinc could do any better than what's currently done. |
| 17:58 | hiredman | if I recall ruby's io was nice, you could either do the block thing or not |
| 17:58 | chouser | Chousuke: I think we have a process, or at least a sketch of one. But without demand for the results it would just be busywork. |
| 17:58 | technomancy | chouser: probably. I guess the current compiler assumes hotspot is going to do awesome things, but that's not necessarily true with dalvik. |
| 17:58 | chouser | heh |
| 17:58 | Chousuke | chouser: hm, I guess so |
| 17:58 | technomancy | the dalvik compiler is way smarter than javac, but lacks hotspot from what I hear |
| 17:59 | technomancy | is cinc the next logical step after 1.2? |
| 17:59 | hiredman | a dalvik code generation library would be nice |
| 17:59 | Chousuke | chouser: most folks using clojure in production seemed to be following master or have their own forks anyway |
| 17:59 | chouser | yeah |
| 17:59 | chouser | maybe cherry-picking their own bugfix patches. ...though if they do that, it would be nice to share back into a potential bugfix release. |
| 18:00 | Chousuke | I should make my reader good enough for cinc ;/ |
| 18:00 | Chousuke | right now it's not much better than the java reader. |
| 18:00 | Chousuke | and the bootstrapping is done via hacks mostly. |
| 18:01 | Chousuke | it was still fun to write though. |
| 18:01 | hiredman | FileLineSeq, a lazy seq that you can call close on when you are done |
| 18:02 | dandersen | Happy UTC+2 New Year. |
| 18:09 | hoeck | dandersen: hopefully another good year for clojure! |
| 18:09 | hiredman | lisppaste8: url? |
| 18:09 | lisppaste8 | To use the lisppaste bot, visit http://paste.lisp.org/new/clojure and enter your paste. |
| 18:10 | lisppaste8 | hiredman pasted "io/lines" at http://paste.lisp.org/display/92879 |
| 18:10 | Chousuke | seems like the donation drive went pretty well too |
| 18:14 | hiredman | I've started putting dummy symbols in some of my macro calls to make them read like english |
| 18:14 | hiredman | (react-on [Q to ::some-thing as X] ...) |
| 18:15 | hiredman | where whatever is in the 'to' and 'as' spot is ignored by the macro |
| 18:20 | zmyrgel | any ideas why slime repl seems to freeze when I try to eval anything in it |
| 18:20 | zmyrgel | slime repl seems to work ok with sbcl and clisp but not with clojure |
| 18:21 | technomancy | zmyrgel: how did you install it and how did you invoke it? |
| 18:22 | zmyrgel | manual installation from git repos and invoked it with M-- M-x slime clojure RET |
| 18:22 | technomancy | zmyrgel: there's been a change in slime from git that breaks clojure support. try installing via elpa as it recommends in the swank-clojure readme. |
| 18:26 | zmyrgel | ok, I'll try that and see how it works out |
| 18:30 | technomancy | I've got a clojure.io that takes just the functions I use from duck-streams (about 90% of it) and adds a handful of java-utils functions as well |
| 18:30 | technomancy | you think it's worth just taking all of duck-streams for compatibility's sake? |
| 18:30 | technomancy | the ones I don't use are: append-spit with-in-reader make-parents write-lines file-str read-lines to-byte-array pwd with-out-append-writer with-out-writer |
| 18:33 | chouser | I think it would be good to leave out read-lines |
| 18:34 | technomancy | file-str should be dropped in favour of java-utils/file as well, though possibly file would be enhanced to support ~ like file-str does |
| 18:35 | technomancy | chouser: you mean because of the "close it only when you've consumed the whole thing" issue? |
| 18:35 | technomancy | that does seem quite problematic |
| 18:35 | chouser | yeah, that's the wrong way to go about closing files. |
| 18:35 | chouser | we need scopes. :-) |
| 18:36 | hiredman | I have my horizons stuff |
| 18:37 | chouser | yeah, I think rhickey implemented his as well. There must be some reason it's not in. |
| 18:37 | technomancy | could probably use to-byte-array... even though it doesn't do I/O itself, it's quite useful in many I/O-related contexts |
| 18:38 | technomancy | why does duck-streams' *byte-array-type* have earmuffs? it can't be intended for rebinding use, can it? |
| 18:38 | hiredman | chouser: possibly he is planning something with streams |
| 18:39 | chouser | I think streams are dead. |
| 18:39 | hiredman | I thought there were just tabled |
| 18:39 | hiredman | maybe I was looking at something out of date |
| 18:41 | chouser | I think lazier + chunked seqs got most of what he wanted from streams, but without most of the drawbacks. |
| 18:44 | chouser | but I don't know what would be holding up scopes, so there's clearly something I don't know about. |
| 18:46 | replaca | chouser: what are scopes? |
| 18:50 | technomancy | ok, so I put in everything except make-parents write-lines file-str read-lines pwd |
| 18:50 | technomancy | and I added file, delete-file, and delete-file-recursively from java-utils |
| 18:50 | technomancy | use those all the time |
| 18:51 | technomancy | http://github.com/technomancy/clojure/blob/io/src/clj/clojure/io.clj |
| 18:51 | chouser | heh. useless link http://www.assembla.com/spaces/clojure/tickets/2-Scopes |
| 18:51 | technomancy | will send it to the mailing list later |
| 18:51 | technomancy | clojurebot: scopes? |
| 18:51 | clojurebot | Huh? |
| 18:51 | technomancy | clojurebot: scope? |
| 18:51 | clojurebot | scope is at http://paste.lisp.org/display/73838 |
| 18:52 | replaca | chouser: wow, that *is* a useless ticket! |
| 18:53 | chouser | ah, there it is. |
| 18:53 | replaca | chouser: ahh , the other link reminds me though. Thanks |
| 18:53 | chouser | and hiredman implemented it. |
| 18:55 | hiredman | except mine are cool because I called them "horizons" and the exception says you have a naked singularity if you try to use when-hrz outside of a horizon |
| 18:56 | replaca | technomancy: why are you dropping those funcs from clojure.io? I vote we keep them. I know some folks have issues with the behavior of read-lines and write-lines, though. |
| 18:57 | technomancy | replaca: pwd and make-parents just seem pretty useless |
| 18:57 | technomancy | and java-utils/file is better than duck-streams/file-str |
| 19:02 | technomancy | the earmuffs on *byte-array-type* are almost certainly a mistake, right? |
| 19:07 | technomancy | replaca: is there a specific one you feel attached to? |
| 19:09 | technomancy | you can't really say things are "getting dropped from clojure.io" anyway, considering it has only existed for about 15 minutes. =) |
| 19:16 | polypus | so what revision is clojure.io on these days? |
| 19:17 | technomancy | polypus: it only exists on the "io" branch on my fork of Clojure in github. I just created it today. there's nothing even vaguely official about it. |
| 19:17 | polypus | i know. just jestig :) |
| 19:18 | polypus | jesting |
| 19:25 | replaca | technomancy: (sorry, away for a minute) java-utils/file doesn't do ~ expansion (which is a thing to be encouraged in my book). I like both pwd and make-parents (though I'm not sure about the name of the latter). |
| 19:26 | replaca | technomancy: well, "dropped" in the sense of not being tranferred from duck-streams |
| 19:26 | the-kenny | Is there a way to refer to clojure 1.1.0 in leiningen? Looks like it isn't on build.clojure.org |
| 19:27 | replaca | of course both pwd and make-parents are simple wrappers around java stuff, but the underlying java is ugly compared to the wrapper |
| 19:27 | replaca | IMHO :-) |
| 19:30 | technomancy | replaca: I added ~ support to file when I moved it from java-utils |
| 19:31 | technomancy | replaca: pwd doesn't make a lot of sense considering there's no notion of a "working" directory on the JVM |
| 19:31 | technomancy | there's just "the directory you launched from" |
| 19:32 | replaca | well, there is the notion of "if I create a file "foo", what directory will it be in. |
| 19:32 | replaca | ?" |
| 19:35 | replaca | something like (.getAbsolutePath (File. ".")) might be a better implementation than what Stuart has. I don't know. |
| 19:36 | technomancy | well given that the very idea behind "working directory" varies based on platform, I am inclined towards making the user drop into Java for it or possibly moving pwd to java-utils. |
| 19:38 | technomancy | but I dunno; I've never used relative paths at all |
| 19:39 | replaca | technomancy: oh, I use 'em all the time. But I'm not stuck on it. |
| 19:40 | replaca | adding ~ to file and some sort of make-parents are the two things I'd be more worried about. (Though in the end I don't care to much if it's in clojure or contrib) |
| 19:41 | technomancy | how about this: (mkdir path "..") |
| 19:41 | technomancy | mkdir is much more general than make-parent |
| 19:48 | replaca | ,(doc mkdir) |
| 19:48 | clojurebot | No entiendo |
| 19:54 | replaca | technomancy: where is mkdir coming from? I don't see it in clojure (or are you proposing it as new?) |
| 19:55 | hiredman | so much nicer |
| 19:55 | replaca | hiredman: come on, just throw all of slime in there :-) |
| 19:55 | hiredman | yeah |
| 19:58 | replaca | technomancy: I think "mkdirs" would be a better name (a la java.io.File/mkdirs) since you want to make the whole chain. But it seems fine to me if it operates on strings |
| 19:59 | hiredman | :( |
| 20:03 | replaca | hiredman: ? |
| 20:04 | hiredman | strings |
| 20:05 | replaca | hiredman: you have a preference for java.io.File objects? |
| 20:06 | hiredman | I have a distaste for string manipulation |
| 20:06 | hiredman | for? of? |
| 20:07 | hiredman | http://www.thelastcitadel.com/lab/repl.ogv |
| 20:07 | replaca | mmm, ok. I don't have a strong opinion either way. (So long as we don't reimplement CL style pathnames!) |
| 20:08 | replaca | do I need to do something to my broswer to read that? Comes out all crazy! |
| 20:11 | technomancy | replaca: I was thinking it would take the same args as file |
| 20:13 | technomancy | it would operate on files or strings, like file |
| 20:17 | notostraca2 | is there a version of map that isn't lazy? |
| 20:22 | notostraca2 | any ideas? |
| 20:25 | chouser | you can wrap it in (doall ...) |
| 20:25 | chouser | or (vec ...) |
| 20:26 | chouser | or if you don't care about the results and just want side-effects, you can wrap it in (dorun ...) or use doseq instead. |
| 20:27 | notostraca2 | I tried doall and dorun with map |
| 20:27 | notostraca2 | and it seemed to have some other error, let me reproduce it |
| 20:28 | notostraca2 | yeah, NPE after some kind of problem in clojure.lang.LazySeq.sval |
| 20:41 | notostraca2 | this room seems to be less active than usual |
| 20:45 | chouser | the exception is almost certainly coming from your code. you could lisppaste the full stack trace. |
| 20:59 | notostraca2 | chouser: I've given up on using map on this vector, and I switched it to a bunch of separate defs that i call functions on separately |
| 20:59 | notostraca2 | not as good, but oh well |
| 20:59 | notostraca2 | at least it works |
| 21:16 | chrisdone | what's the interest from .NETers been like for Clojure on the CLR? |
| 21:24 | ztellman | Is the implementation of a FIFO queue at http://rosettacode.org/wiki/FIFO#Clojure thread-safe? |
| 21:24 | ztellman | it seems like two threads could get the same element |
| 21:25 | ztellman | but maybe I'm missing something? |
| 21:26 | chouser | doesn't look thread safe to me. |
| 21:26 | ztellman | would making the atom a ref and wrapping the whole thing in dosync make it thread-safe? |
| 21:27 | chouser | also not very memory-efficient -- every item put in the queue will be held forever. |
| 21:28 | chouser | ztellman: yes, that would be much better. |
| 21:29 | chouser | also better to use a clojure.lang.PersistentQueue instead of a vector |
| 21:30 | ztellman | I'm asking because I'm making a thread-pool, and it seems like the easiest way to do it is to create two views on an infinite seq of promises |
| 21:30 | ztellman | one for empty promises, and the other for promises which haven't been consumed yet |
| 21:30 | chouser | oh, dear. I suppose you could, but Java comes with good thread-pool classes. You could just use one of those. |
| 21:31 | ztellman | I'm constrained by needing to instantiate OpenGL contexts in my threads |
| 21:31 | ztellman | I guess I could just check every time whether a context is active in the thread, but that seems even weirder than making my own thread-pool |
| 21:31 | ztellman | neither option is all that great |
| 21:31 | chouser | in fact clojure wraps up a couple of them for agents, future, etc. |
| 21:32 | ztellman | are there any hooks into the thread creation for these pools? |
| 21:32 | chouser | hm... |
| 21:35 | chouser | looks like it -- you can pass in a ThreadFactory |
| 21:36 | chouser | http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executors.html |
| 21:37 | ztellman | oh, excellent |
| 21:38 | replaca | technomancy: (after some running around) yeah, that sounds good to me |
| 21:38 | ztellman | thanks chouser, I had pretty much resigned myself to doing this myself |
| 21:39 | chouser | ztellman: np. You know about 'proxy'? |
| 21:39 | ztellman | yeah, I've used it a few times |
| 21:39 | ztellman | thanks |
| 21:43 | chouser | ztellman: do you feel like correcting rosettacode? |
| 21:49 | ztellman | chouser: I can't just now, but I can do it later if no one else does |
| 21:50 | technomancy | ok, gonna send off this clojure.io proposal then |
| 21:51 | chouser | arg. I hate this kind of problem. |
| 21:51 | chouser | oh! |
| 21:54 | chouser | nope |
| 21:54 | chouser | grrr |
| 21:57 | chouser | (:use [net.cgrand.enlive-html :only [xml-resource select]]) |
| 21:57 | chouser | then later, (xml-resource ...) |
| 21:57 | chouser | But I get: Exception in thread "main" java.lang.Exception: Unable to resolve symbol: xml-resource in this context |
| 21:58 | chouser | how is that possible? |
| 22:00 | chouser | if xml-resource weren't in enlive-html, or enlive-html wasn't on the classpath, I'd get an error there in the ns form. |
| 22:00 | _mst | is that from the repl or slime? I've had surprising results from slime before when it hadn't picked up what namespace I was in |
| 22:01 | _mst | so the :use was going into one namespace but forms sent to slime got evaled in user/ |
| 22:02 | chouser | I don't touch slime. I'm loading this file using clojure.main -i foo.clj |
| 22:03 | _mst | hm, youch |
| 22:04 | chouser | oh my. adding (prn xml-resource) right after the (ns ...) works -- prints the fn. |
| 22:04 | defn | happy new year everyone |
| 22:04 | defn | to Clojure! |
| 22:05 | chouser | where are you -- in the atlantic somewhere? |
| 22:06 | defn | haha no, it's only 9:07pm here, not the new year. however, I am from Wisconsin-- we get started with the drinking early in the evening |
| 22:06 | chouser | hehe |
| 22:06 | defn | where are you from chouser? |
| 22:06 | chouser | Indiana |
| 22:06 | defn | ah, cool |
| 22:07 | defn | so you can probably attest to some of the pain of no one caring about computer science in your area, then? |
| 22:08 | defn | I'm in Madison, WI -- The University of Wisconsin has a decent CS program, but few of them could give a hoot about Clojure. They all want to learn Java to get jobs. |
| 22:08 | chouser | ah. |
| 22:08 | defn | "them" being the people I went to school with |
| 22:10 | chouser | yeah, I went to Taylor -- the CS department there is strong, but definitely more oriented toward getting work done than theoretical work. |
| 22:10 | chouser | but Clojure's pretty practical. I should find out if they want me to go tell them something about it. |
| 22:10 | defn | yeah i was just going to say -- i dont want to make it sound like applications aren't important |
| 22:11 | defn | but i feel like clojure has more of a balance of the two than many are comfortable with |
| 22:12 | defn | i was talking with my friend last night whom I forced to watch Rich's lecture "Are we there yet?" -- and we were talking about communication between two people and the flow of it -- sort of a tangent of the conversation we started with |
| 22:13 | hiredman | if anything clojure is more pratical because it brings more power |
| 22:13 | defn | there was this moment where we were talking about free association, and just for fun we started trading words back and forth, trying deliberately to make sure that each word was unrelated to the previous person's word |
| 22:14 | _mst | chouser: any chance you're somehow switching namespaces between your (prn ...) and the code that fails? |
| 22:14 | defn | those pieces were unrelated, and yet they were part of that "river" we called a conversation |
| 22:14 | defn | it was very interesting to talk about rich's lecture in relationship to that scenario. very true stuff. |
| 22:15 | chouser | I just sprinkled those prn's around the file. The error changed. 8-| |
| 22:16 | defn | Does anyone know if there is something like a (render "filename.html") form in compojure |
| 22:17 | _mst | I'll be interested to know what it ends up being anyway :) I always enjoy bugs that make you question your own sanity... |
| 22:17 | defn | _mst: have you read coders at work? |
| 22:17 | _mst | yep, sure have |
| 22:18 | _mst | excellent book :) |
| 22:18 | defn | some fantastic bug stories in there |
| 22:18 | defn | yeah i loved it |
| 22:18 | defn | who was your favorite? |
| 22:18 | _mst | terribly edited, but excellent book :) |
| 22:18 | _mst | hm, I think I enjoyed Joe Armstrong's the most, actually |
| 22:18 | defn | yeah i enjoyed that as well |
| 22:19 | defn | i really liked reading simon peyton jones |
| 22:19 | _mst | I don't have my copy at hand to remind myself why, but I remember being struck with how sane he was |
| 22:19 | _mst | yeah, his was good too. And Knuth's of course--I suspected putting that one last was a trick to get people to read the others first :) |
| 22:20 | defn | yeah, some of the guys in there reek of ... i dont know ... it's like you could smell why you didn't like them |
| 22:20 | defn | _mst: haha yes, but I read his first anyway :) |
| 22:20 | defn | jwz came off as kind of a jerk |
| 22:21 | chouser | phantom error. it's gone. |
| 22:21 | chouser | :-( |
| 22:21 | defn | most of his employers seemed to think he was arrogant |
| 22:21 | _mst | eugh :) |
| 22:21 | defn | so im not alone there? |
| 22:22 | chouser | I put the code back the way it was, and I'm still getting the new error. (A nice, reasonable error about bad xml data) |
| 22:22 | defn | when they asked him what he's been up to it was like "i dont really code much" |
| 22:22 | defn | it's like...what?! |
| 22:23 | defn | have you seen simon peyton jones with (forgetting his name...the erlang guy) |
| 22:24 | defn | there's a video of them discussing the different approaches in a very cordial manner |
| 22:24 | defn | oh duh -- joe armstrong |
| 22:24 | defn | http://www.infoq.com/interviews/armstrong-peyton-jones-erlang-haskell |
| 22:24 | _mst | that's the one :) I don't think I've seen it |
| 22:24 | _mst | ah, thanks |