2010-12-03
| 01:41 | technomancy | mmm... aether allows you to customize conflict resolution in dependency graphs. |
| 01:55 | zmyrgel | hi, is there a way to track program execution line by line? |
| 01:55 | cemerick | technomancy: taking hints from ivy, I guess? |
| 01:57 | technomancy | cemerick: I suppose so. |
| 01:57 | cemerick | zmyrgel: you might find clojure.contrib.trace interesting. |
| 01:57 | technomancy | cemerick: I'm interested in fork-aware dependency resolution. using the group-id has issues. |
| 01:57 | technomancy | as I'm sure you're aware =) |
| 01:58 | zmyrgel | cemerick: I would be more interested debugger like approuch |
| 01:58 | cemerick | oh, so you're looking for a stepper |
| 01:58 | technomancy | my current crackpot theory is you'd need to maintain a mapping of version numbers to git shas so you can track the ancestry of any given version in a fork network to figure out which is newest. |
| 01:59 | technomancy | no idea if that's actually feasible, but it's probably worth some noodling |
| 01:59 | zmyrgel | cemerick: yeah, something like that |
| 01:59 | cemerick | zmyrgel: People have had good results with JSwat, Enclojure, and cdt |
| 02:00 | cemerick | technomancy: ah, that's what you mean by "fork-aware" |
| 02:00 | zmyrgel | my chess game tree just returns nil as result and I think it would be easier to see whats causing it if I can track the program execution step by step |
| 02:00 | cemerick | technomancy: yeah, that's a pretty crazy idea. Probably the root any potential solution, though. |
| 02:00 | technomancy | rich convinced me linear versions are an artifact of the days of SVN |
| 02:01 | cemerick | I'm not sure versioning has ever been linear. |
| 02:02 | technomancy | well... from a human perspective it's not, but from a tooling perspective, version strings are just sorted lexographically. |
| 02:02 | technomancy | well not literally lexographically |
| 02:02 | technomancy | but the segments are |
| 02:04 | cemerick | Sure. |
| 02:04 | technomancy | 1.1.0-master-SNAPSHOT < 1.1.0-new-SNAPSHOT, etc. |
| 02:04 | cemerick | My point was, I think wanting to be able to track releases coming out of a branch in SCM is a very recent phenomenon that exposes the issue. |
| 02:05 | cemerick | I'm not even sure that makes sense. |
| 02:05 | technomancy | right |
| 02:06 | technomancy | you might want to be able to choose strategies... always pick the newest vs prefer my fork vs prefer master branch, etc. |
| 02:06 | cemerick | I remember a brief attempt of mine to ditch all dep mgmt and just use git submodules. |
| 02:07 | cemerick | (for internal stuff, that is) |
| 02:07 | technomancy | eep |
| 02:07 | cemerick | didn't last long |
| 02:07 | cemerick | That was prior to my deciding to stop bothering with the question and just use mvn. |
| 02:08 | cemerick | There's a lot of craziness in the git model that makes the concept of tracking branch releases a little nuts. |
| 02:08 | cemerick | e.g. consider an impolite rebase |
| 02:09 | technomancy | I'm not a fan of git's implementation of submodules |
| 02:09 | cemerick | They're essentially useless. |
| 02:10 | cemerick | I think it's telling that they don't track refs, either. |
| 02:11 | technomancy | well I don't expect to come up with anything useful in the next six months; just letting it simmer. |
| 02:13 | technomancy | well most of what I've done so far is fairly obvious; just taking patterns that have worked in other contexts and adapting them... nonlinear versions haven't been done in any tool I'm aware of yet. |
| 02:14 | technomancy | of course, it's probably all been figured out by ocaml people years ago in a thesis somewhere... |
| 02:15 | p_l|home | hmm... I wasn't aware of the issue with submodules, but that can be redone quite easily, I think |
| 02:16 | p_l|home | git, internally, isn't actually a version control system but a content-addressable write-only-with-gc system |
| 02:18 | technomancy | in this case I think it's an example of theoretical purity interfering with pragmatism |
| 02:18 | technomancy | but anyway, I must head off; ciao |
| 02:18 | p_l|home | technomancy: more like "didn't bother" :) |
| 02:18 | p_l|home | content-addressible storage makes it easy to make a versioned filesystem with simple file commands (which is how Plan9 people do it, btw) |
| 02:20 | LauJensen | Morning all |
| 02:27 | Raynes | LauJensen: Morning. |
| 04:15 | bytecolor | trying to implement the first example from: http://clojure.org/libs?responseToken=0cbcb26df92c8eec7f95c8f1abeb68685 |
| 04:16 | bytecolor | I've put my_utils.clj in ~/.clojure/com/my_company/clojure/examples |
| 04:16 | bytecolor | echo $CLASSPATH => /home/bytecolor/.clojure |
| 04:18 | bytecolor | using this to print the classpath: http://pupeno.com/blog/printing-the-class-path-in-clojure/ |
| 04:18 | bytecolor | it does not show ~/.clojure though, and I can |
| 04:18 | bytecolor | *can't require the lib |
| 04:18 | bytecolor | does it have to be compiled to a .jar? |
| 04:25 | kjeldahl_ | bytecolor: Are you starting the REPL with the right parameters, and/or from the right location? How are you starting the REPL? |
| 04:26 | bytecolor | kjeldahl_: this in in my ~/bin/clj => java -cp ~/.clojure/*: clojure.main "$*" |
| 04:26 | bytecolor | I've just started playing with CLASSPATH, I found that example on the net somewhere |
| 04:28 | bytecolor | I have clojure.jar and clojure-contrib.jar in ~/.clojure and they both seem to work ok when I run cjl from any location |
| 04:28 | kjeldahl_ | bytecolor: I'm no expert either, but in my case the clj script is just an alias for clj-env-dir . |
| 04:29 | bytecolor | kjeldahl_: where is clj-env-dir? |
| 04:29 | kjeldahl_ | launchers/bash/clj-env-dir in clojure-contrib |
| 04:29 | bytecolor | hrm |
| 04:30 | kjeldahl_ | You're getting an error when you try to "require" the source code you've written from the examples? |
| 04:31 | Raynes | http://blog.raynes.me/?p=48 You'd probably be better off with cljr or cake rather than trying to get things running properly all by your lonesome. |
| 04:31 | bytecolor | yes, (require 'com.my-company.clojure.examples.my-utils) => FileNotFoundException |
| 04:32 | bytecolor | Raynes: I'll have a look. |
| 04:32 | kjeldahl_ | Agree. I mostly start a new project using leiningen with dependencies and stuff in place before I dive into the REPL. |
| 04:41 | zmyrgel | hi, I have trouble getting my gametree working |
| 04:42 | zmyrgel | I can build the gametree but when I try to evaluate the tree I get list of functions as a result instead of their result |
| 04:42 | zmyrgel | Here's relevant code: http://clojure.pastebin.com/f0PmDQ5f |
| 04:45 | Raynes | zmyrgel: Doesn't matter all that much, but in case you didn't know, there are some pastebins that directly support Clojure highlighting: gist.github.com, paste.pocoo.org, ideone.com, and I think even pastie.org does now. |
| 04:46 | zmyrgel | ok, I'll remember that once I need to paste more code |
| 04:47 | zmyrgel | any idea why my trampoline fuction won't work? |
| 04:49 | oelewapperke | I'm trying to learn a bit of clojure, so I'm trying to define a basic higher-order function like so "(defn m [n] (fn [x] (* x n))", however entering this in repl doesn't return (I've got to CTRL-C it) |
| 04:49 | oelewapperke | why ? |
| 04:49 | Raynes | oelewapperke: You missed a closing parenthesis. |
| 04:50 | Raynes | (defn m [n] (fn [x] (* x n))) |
| 04:50 | oelewapperke | I'm an idiot. Thanks |
| 04:50 | Raynes | You're welcome. :p |
| 04:51 | oelewapperke | what do you use as a clojure editor ? something that can help me with clogin parens etc |
| 04:51 | AWizzArd | Is there a way to change the namespace a thread runs in via eval? |
| 04:52 | Raynes | AWizzArd: Use binding to rebind *ns* |
| 04:52 | Raynes | I do that in clojail to run code in a sandbox namespace. |
| 04:52 | AWizzArd | I will try that. |
| 04:55 | Raynes | AWizzArd: (binding [*ns* (create-ns 'blah)] (refer 'clojure.core) (eval '(pr-str *ns*))) ; Example |
| 04:59 | bartj | can't I use a "for" while reading from a file with a "with-open" |
| 04:59 | bartj | here's the paste: http://pastie.org/1344017 |
| 05:00 | Raynes | bartj: for is lazy |
| 05:01 | AWizzArd | Raynes: yes, this binding trick seems to work. I will now try to redefine an existing function with that. |
| 05:01 | bartj | Raynes, and hence can't be used with a "with-open" ? |
| 05:01 | Raynes | bartj: Your for runs in with-open and creates a lazy-seq, but no work is actually done. The reader is closed after the scope of the with-open is over, so when you finally try to realize the sequence, the work can't be done because the stream is closed. |
| 05:02 | Raynes | bartj: A way around this would be to close the stream yourself *after* you've realized all that you need from the sequence, or do so in the scope of with-open. |
| 05:02 | bartj | catch-22? |
| 05:04 | bartj | Raynes, I tried having a close after the for...no error; but still can |
| 05:05 | bartj | *can't read the contents |
| 05:05 | Raynes | bartj: You'd have to open the stream manually and close it after your println. |
| 05:06 | Raynes | bartj: You can probably just wrap your for in a doall though. |
| 05:06 | Raynes | That will force the entire sequence to be realized. |
| 05:08 | bartj | Raynes, thanks! |
| 05:08 | Raynes | user=> (with-open [rdr (clojure.java.io/reader "blah")] (doall (for [line (line-seq rdr)] line))) -> ("ohai" "there") |
| 05:09 | Raynes | bartj: Sorry I didn't mention doall first rather than confusing you. I was trying to explain the reason it happened. :> |
| 05:09 | bartj | Raynes, I understand your explanation and thank you profusely for being so detailed |
| 05:10 | Raynes | bakkdoor|afk: Also, is that your actual code? If so, you realize you aren't really doing anything with that for, right? You could just call doall on the result of line-seq and be done with it. |
| 05:10 | Raynes | Er, bartj. |
| 05:10 | Raynes | Darn tab completion. :< |
| 05:11 | notsonerdysunny | Hello everybody .. can anybody help me with this .... http://groups.google.com/group/clojure/browse_thread/thread/9605dee93db81915# |
| 05:14 | bytecolor | thanks Raynes, I got cljr up and by dropping the example lib I mentioned in a path specified in the cljr script, it works |
| 05:14 | Raynes | bytecolor: Happy it helped. :> |
| 05:14 | octe | why does assoc-in work on vectors but not sequences? |
| 05:15 | Raynes | &([1 2 3] 1) |
| 05:15 | sexpbot | ⟹ 2 |
| 05:15 | Raynes | &('(1 2 3) 1) |
| 05:15 | sexpbot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.IFn |
| 05:16 | octe | &(assoc-in ["a" "b"] [0] "x") |
| 05:16 | sexpbot | ⟹ ["x" "b"] |
| 05:16 | Raynes | Vectors are like maps of numeric keys to values. |
| 05:16 | Raynes | Sequences aren't. |
| 05:16 | octe | &(assoc-in '("a" "b") [0] "x") |
| 05:16 | sexpbot | java.lang.ClassCastException: clojure.lang.PersistentList cannot be cast to clojure.lang.Associative |
| 05:16 | octe | &(nth '("a" "b") 0) |
| 05:16 | sexpbot | ⟹ "a" |
| 05:16 | octe | well that's annoying |
| 05:17 | Raynes | Doing ##(assoc-in ["a" "b"] [0] "x") is like doing ##(assoc-in {0 "a" 1 "b"} [0] "x") |
| 05:17 | sexpbot | (assoc-in ["a" "b"] [0] "x") ⟹ ["x" "b"] |
| 05:17 | sexpbot | (assoc-in {0 "a", 1 "b"} [0] "x") ⟹ {0 "x", 1 "b"} |
| 05:17 | p_l|home | Raynes: so vectors are different from arrays/matrices in clojure? (just lurking here for now, haven't touched clojure in years) |
| 05:18 | raek | if you want to "change" something in the middle of a list, you need to create new cons cells for every element before the middle |
| 05:19 | p_l|home | raek: no way for in-place modification of a cons cell? |
| 05:19 | raek | p_l|home: clojure's vectors are persistent and can share structure. they are distinct from java arrays, Vectors and ArrayLists |
| 05:19 | octe | since every way of morphin listish stuff returns sequences (like map, map-indexed) i'm gonna have to keep converting to vectors to be able to use assoc-in too i guess |
| 05:19 | raek | p_l|home: no, they are always immutable |
| 05:19 | p_l|home | hmm... just gathering some differences from CL, good to know |
| 05:25 | raek | octe: yes. calling vec on the lazy sequence returned by map will do the trick |
| 05:26 | raek | note that sequences aren |
| 05:26 | raek | 't really collections in the same as vectors |
| 05:27 | octe | well, no, since they're lazy and potentially infinite, etc |
| 05:27 | raek | they could be described as state-less iterators |
| 05:27 | octe | yeah |
| 05:27 | raek | the point is, don't worry about "creating a new collection" |
| 05:32 | Raynes | notsonerdysunny: I just replied to your group thread. |
| 05:32 | beerpages | Kostenlose mini Homepages für Umfragen, Videos und vielem mehr auf www.beerpages.de - Beispiel: http://www.beerpages.de/view/1P/Magst%20du%20%C3%84pfel%3F |
| 05:33 | Raynes | Looks like lpetit got to it before me. :< |
| 05:37 | oelewapperke | what is the difference between something like "fn" and "lambda" ? |
| 05:38 | Raynes | There isn't one. Just the name is different. |
| 05:38 | Raynes | A function created with fn is a lambda. |
| 05:45 | dirchh | Except it looks less intimidating ;) |
| 05:48 | oelewapperke | Raynes: and "lambda" just doesn't work in clojure ? strange |
| 05:48 | Raynes | oelewapperke: I imagine Rich decided to name it 'fn' because 'fn' is shorter than 'lambda'. |
| 05:50 | bartj | I like fn much better than lambda |
| 05:50 | bartj | the naming convention I mean |
| 05:56 | Lajla | Lambda is a pain to type. |
| 05:56 | Lajla | For something that common. |
| 05:56 | Lajla | I like #( ... ) even more. |
| 05:56 | Raynes | Agreed. |
| 05:56 | Lajla | Hell, I'd say that {x y & r ; body} would be kind of cool. |
| 05:57 | Lajla | Also, most languages that use lambda are kind of praetentious therein, because they aren't lambda abstractions at all. |
| 05:57 | Raynes | $he (\x y -> x + y) 2 2 |
| 05:57 | sexpbot | ⟹4 |
| 05:57 | Lajla | Hoaskall. |
| 05:57 | Lajla | &he (+) 2 2 |
| 05:57 | sexpbot | java.lang.Exception: Unable to resolve symbol: he in this context |
| 05:58 | Lajla | Bummer |
| 05:58 | Lajla | Ohhh |
| 05:58 | Lajla | $he (+) 2 2 |
| 05:58 | sexpbot | ⟹4 |
| 05:58 | Lajla | Raynes, does it also have Ocoaml? |
| 05:58 | Raynes | Unfortunately, no. |
| 05:58 | Raynes | It will if I can find a satisfiable sandbox for OCaml. |
| 05:59 | Lajla | Raynes, what else does it have? |
| 05:59 | Lajla | C? |
| 05:59 | Lajla | Python? |
| 05:59 | clojurebot | python is ugly |
| 05:59 | Lajla | Lazy K. |
| 05:59 | Raynes | Just Clojure and Haskell. |
| 05:59 | Lajla | Ohhh |
| 05:59 | Lajla | So he doesn't ignor eme on hat eh? |
| 05:59 | Lajla | Raynes, you should add brainfuck and Lazy K. |
| 06:00 | Raynes | I think it actually does brainfuck. |
| 06:00 | Raynes | Not sure if it still works. |
| 06:00 | Lajla | $bf . |
| 06:00 | sexpbot | {:ptr 0, :cells {}} |
| 06:00 | sexpbot | [0] |
| 06:00 | Lajla | Schweet |
| 06:00 | Raynes | Guess do. |
| 06:02 | Raynes | s/do/so/ |
| 06:02 | sexpbot | <Raynes> Guess so. |
| 06:08 | fliebel | I commonly hear it said that one big advantage of dynamic langs is that you can change things on the fly on a web server. But if and how is this done in practice? |
| 06:10 | p_l|home | fliebel: in case of CL, you usually compile the files with changes you want, then load them. Or type them from the REPL - you keep a REPL open for that |
| 06:10 | Raynes | fliebel: The same way you'd do it in a desktop application. You'd just reload code. |
| 06:11 | Raynes | You can require namespaces with a :reload option to reload those namespaces. |
| 06:11 | fliebel | So you need to have a repl connected to the actual project and ssh into that? |
| 06:11 | Raynes | Besides that, if you have an REPL running in that instance, you can modify things normally. |
| 06:12 | p_l|home | I'm not sure about atomicity of reloading in clojure or JVM, the trick with compiling first is done on Common Lisp to have the changes done atomically |
| 06:12 | Raynes | fliebel: That's an option. In sexpbot, I've got it set up so that I can shoot it reload commands from IRC rather than use an REPL. You can get pretty creative. |
| 06:13 | fliebel | Raynes: So say I have a nice ring app deployed in a servlet, how am I ever going to get a repl on that? |
| 06:14 | Raynes | fliebel: Whenever you start your server, start it from an REPL and bind the result to a name. You're pretty much completely in control at that point. |
| 06:15 | p_l|home | does clojure-swank allow to start a repl server from the code? If so, just make it start in initalization code of your app, then connect to it over SSH proxy |
| 06:15 | Raynes | p_l|home: Yes, I was just about to mention that. |
| 06:16 | Raynes | I used to do something similar in sexpbot pre my reload commands. |
| 06:23 | fliebel | Raynes: I was thinking, could I do something like nREPL over SSH? |
| 06:24 | Raynes | Probably. I'm not familiar with nREPL. |
| 06:24 | fliebel | cemerick: ping |
| 06:24 | raek | fliebel: I have used slime over ssh. very convenient. |
| 06:25 | fliebel | raek: I'm not using emacs |
| 06:25 | raek | ok |
| 06:26 | raek | I think lein repl also starts a repl on a socket nowadays |
| 06:26 | raek | how's nRepl going, btw? |
| 06:27 | raek | <3 |
| 06:28 | bsteuber | I don't get footnote 113 in JoC |
| 06:28 | fliebel | <3 |
| 06:29 | bsteuber | You might have noticed that we explicitely bound the Var gcd to the memoization of an |
| 06:29 | bsteuber | anonymous function. The reason for this is that we also need to cache the intermediate results (Norvig 1991) which |
| 06:29 | bsteuber | would not happen if we had instead memoized an existing gcd function |
| 06:29 | bsteuber | the code given doesn't seem to memoize the immediate results, though |
| 06:43 | zmyrgel | hi, I got my gametree a bit further but now it seems it won't complete the min-max |
| 06:43 | zmyrgel | I get list of list of numbers instead of number as a result |
| 06:43 | zmyrgel | Here's the code: http://pastie.org/1344187 |
| 06:45 | rrc7cz | why does (for [[x y z] [[1 2] [3 4]]] x) return (1 3) but (doseq [[x y z] [[1 2] [3 4]]] x) returns nil? |
| 06:45 | zmyrgel | it seems one mix and max iteration would be needed to complete it but I can't tell why it's not doing it already |
| 06:45 | Raynes | for collects it's results into a sequence, while doseq is for doing stuff with side-effects. |
| 06:46 | Raynes | You only want to use doseq when you don't care about return results and just need to do something like print something. |
| 06:47 | rrc7cz | Raynes: understood, I actually need doall in my case |
| 07:24 | rrc7cz | is there any reason to discourage rebinding like (let [foo 1 foo (+ foo 2)]? of course the example is bunk, but the idea of refining the symbol's value in multiple steps? |
| 07:27 | zmyrgel | if your doing it like that you might as well be doing java :) |
| 07:28 | rrc7cz | zmyrgel: but why? I mean I don't see how it's any better by just binding subsequent refinements to a different symbol |
| 07:28 | raek | I think it can be legitimate |
| 07:29 | Raynes | I'm not sure I really see the point. |
| 07:29 | Raynes | I'd enjoy seeing a legitimate usage for educational purposes. |
| 07:30 | rrc7cz | Raynes: so in my case: (let [members (@db name) aliases (foo) members (if members (merge members aliases) aliases) |
| 07:30 | zmyrgel | rrc7cz: would seem quite imperative if same symbol gets refined step by step |
| 07:31 | rrc7cz | Raynes: actually writing it out now I see the if isn't needed |
| 07:31 | zmyrgel | this based on the fugly let-forms found in my own code :) |
| 07:31 | rrc7cz | Raynes: but the idea is, load members, then merge in aliases, but it's still "members", I mean why rename it? |
| 07:32 | Raynes | I'd do it just so that I was perfectly clear. All of those 'members' could get confusing. Especially in a more complex example. |
| 07:32 | fliebel | I think every case where you'd do like that in a let should be handled by -> |
| 07:32 | fliebel | s/should/could/ |
| 07:32 | sexpbot | <fliebel> I think every case where you'd do like that in a let could be handled by -> |
| 07:33 | jgracin | Hi! Where is Clojure's "local-variable clearing" documented? |
| 07:33 | bobo_ | -> popped into my head directly when i saw that aswell |
| 07:33 | rrc7cz | fiebel: actually that's an interesting idea. I'm going to do that |
| 07:33 | rrc7cz | thanks guys |
| 07:33 | fliebel | Oh, this would be nice, a fastcgi impl for ring, so you can run perl, php, python, everything under nice moustache routing and all. |
| 07:42 | sholden_ | Hi everyone, trying to get started learning clojure. Just got lein installed, now I'm trying to decide what to use for an editor (under ubuntu). What's the most popular route? I know there are several but if one is a bit more popular in the community I'd like to go with that... |
| 07:43 | fliebel | I guess I must learn C first to understand FastCGI. Is a struct something like a hash-map? I haven't figured out if they use structs as a sortof JSON, or are converting them to some binary form. :( I would really love ring-fastcgi. |
| 07:44 | Raynes | The majority of Clojurians use Emacs with clojure-mode. However, there is some support in Eclipse via the Counterclockwise plugin. |
| 07:44 | Raynes | There is VimClojure for Vim. |
| 07:44 | raek | sholden_: if you are comfortable with emacs, I really recommend it |
| 07:44 | fliebel | .. what Raynes said |
| 07:44 | bobo_ | sholden_: emacs and the starterkit is pretty easy to setup |
| 07:44 | bobo_ | i think intellij's support got god the other day aswell? havent tried it myself |
| 07:46 | sholden_ | I've never used emacs... Is it worth it to bite the bullet and learn it at the same time as clojure? Or do you think I should just do one at a time? |
| 07:47 | bobo_ | sholden_: no, i would use what you already know |
| 07:48 | jarpiain | jgracin: http://groups.google.com/group/clojure/msg/9b4e268b85c20cd6 |
| 07:48 | bobo_ | netbeans,intellij and eclipse al have working support |
| 07:48 | sholden_ | OK. I couldnt get enclojure working but I have the counterclockwise rc installed. I'll stick with that for now. Thanks |
| 07:48 | bobo_ | or maybe netbeans doesnt anymore? havent tried it in ages |
| 07:49 | Raynes | A relatively bright individual with a few hours or so can get the hang of Emacs. It takes a while to reach ninja status. In any case, you should probably just use CCW or something similar for now, and get comfortable with Clojure and make sure you even like it. ;) |
| 07:50 | bobo_ | one thing at the time is always a good idea |
| 07:50 | sholden_ | Raynes: OK, I may play with it a bit. Honestly, in the past I saw people complain about emacs lisp and it being complicated with so many parens, but now that I'm coming around to clojure, what had happened was.... ;) |
| 07:51 | sholden_ | I think i'll try and get a few hello worlds off in eclipse then take a dive for a while |
| 07:51 | Raynes | Clojure doesn't have as many parens as elisp, and encourages good indentation for clarity. |
| 07:52 | jgracin | jarpiain: thanks! |
| 07:54 | sholden_ | Thanks for the help, back to reading! |
| 07:55 | bartj | err, is there a diff b/w "error" and "failure" in clojure.test ? |
| 07:58 | kjeldahl_ | How can I do something like: (map #(%) [1 2 3 4]) . I'm not looking for a "why" answer. ;-) |
| 07:59 | Raynes | &(map #(identity %) [1 2 3 4]) |
| 07:59 | sexpbot | ⟹ (1 2 3 4) |
| 08:00 | Raynes | &(map (fn [x] x) [1 2 3 4]) |
| 08:00 | sexpbot | ⟹ (1 2 3 4) |
| 08:00 | Raynes | Pick your poison. |
| 08:01 | kjeldahl_ | Excellent, thanks. |
| 08:07 | fliebel | Awesome! Implementing this for ring will get me there I believe: http://jfastcgi.svn.sourceforge.net/viewvc/jfastcgi/trunk/src/net/jr/fastcgi/impl/RequestAdapter.java?revision=21&view=markup |
| 08:23 | fliebel | If I want to implement an interface in Clojure with deftype or one of those, and use it in Java, will it generate *real* classes, or do I still need gen-class for that? |
| 08:24 | chouser | fliebel: deftype and defrecord create real classes |
| 08:25 | chouser | In order to expose a mechanism to create instances other than the default ctors, however, you'll need to either use Var stuff from the Java side, or gen-class to create some static methods. |
| 08:26 | fliebel | chouser: Look at the link above, only some methods. |
| 08:28 | fliebel | chouser: Would I use a record for that? |
| 08:29 | chouser | oh, fastcgi. we meet again. |
| 08:30 | fliebel | chouser: ? |
| 08:30 | chouser | I've known her for years. Her charms are alluring, but her betrayals cut deep. |
| 08:31 | chouser | defrecord or deftype should be fine |
| 08:32 | fliebel | chouser: Please elaborate, before she betrays me as well. |
| 08:32 | chouser | I think it's always been implementation issues. The concept, the protocol, and the performance are all fine. |
| 08:32 | fliebel | chouser: I haven't gone past the point of no return yet. |
| 08:33 | chouser | but specific implementations on either side seem to frequently have heisenbugs |
| 08:33 | chouser | the apache mod, the ruby lib, the python lib, etc. |
| 08:33 | fliebel | chouser: I will leave all implementation to jfastgci. But I would like to add a ring addapter. |
| 08:34 | chouser | I don't think I've tried it from Java yet |
| 08:34 | mduerksen | kjeldahl, raynes: (map identity [1 2 3 4]) will do, without the ugly # stuff |
| 08:34 | fliebel | chouser: As long as it runs some PHP for me, I'm fine with it. |
| 08:36 | kjeldahl_ | mduerksen: True, thanks. |
| 08:37 | chouser | fliebel: I think the last time I used it was with apache and python. In the end the performance was more consistently fast using the python via regular cgi than via fastcgi. |
| 08:38 | fliebel | chouser: Hrm... |
| 08:43 | chouser | I think it would respond quickly for a while, then "something" would go wrong and incoming connections would hang several seconds before continuing |
| 08:43 | chouser | but I also didn't have admin access to the apache process, so could fiddle with things on that end very well |
| 08:44 | fliebel | hrm |
| 08:58 | Thorn | hello |
| 09:00 | fliebel | Thorn: Hi |
| 09:00 | Thorn | I have a seq of booleans and I want to find if all of them are true. I do (reduce and foo) but get "Can't take value of a macro" |
| 09:00 | Thorn | what's the workaround? |
| 09:00 | fliebel | ever? |
| 09:00 | fliebel | *every? |
| 09:01 | Thorn | nice, thanks |
| 09:01 | fliebel | &(every? identity [true true true false]) |
| 09:01 | sexpbot | ⟹ false |
| 09:01 | Thorn | how long do you need to learn all of those? |
| 09:02 | raek | Thorn: this is a good start: http://clojuredocs.org/quickref/Clojure%20Core |
| 09:02 | fliebel | Thorn: I'm still learning. But according to my quiz I know 64% of all functions in core. |
| 09:02 | Thorn | lol |
| 09:03 | fliebel | Thorn: https://github.com/pepijndevos/clojure-quiz |
| 09:03 | neotyk | ,(every? true? [true false true]) |
| 09:03 | clojurebot | false |
| 09:03 | Thorn | I understand some pythonistas hate clojure exactly for this |
| 09:03 | fliebel | Thorn: For what? |
| 09:04 | chouser | a few hundred uncategorized functions in core? |
| 09:04 | fliebel | chouser: In that case I'm one of them. |
| 09:04 | Thorn | lots of functions like map/filter/every?/reduce/take/first/rest/etc |
| 09:05 | Thorn | (they've never seen common lisp obviously) |
| 09:06 | fliebel | Thorn: There are only a little over 500, adn I think you are officially allowed to call yourself a guru or master or pro or… if you know 200 of them ;) |
| 09:06 | neotyk | fliebel: you are called like that if you wrote 200 of them ;-) |
| 09:06 | Thorn | that's less than the number of common kanji characters so clojure must be easier than Japanese |
| 09:07 | Thorn | at least |
| 09:07 | fliebel | Of which half are macros that are composed of the other 100, and with 100 fns we're comming close to Python ;) |
| 09:07 | fliebel | Python has 67 I believe. |
| 09:07 | chouser | common lisp hyperspec lists 978. Clojure has 560. We're well on our way. :-/ |
| 09:08 | fliebel | Thorn: You can speak Japanese without knowing all of those as well ;) |
| 09:08 | neotyk | chouser: what is hyperspec? |
| 09:08 | chouser | neotyk: http://www.lispworks.com/documentation/HyperSpec/Front/ |
| 09:10 | Raynes | fliebel: And of those 500, some of them aren't functions. Your quiz includes stuff like *print-meta*. |
| 09:10 | chouser | which are good to know |
| 09:11 | fliebel | Raynes: I could do (filter fn?) on the lot… Not sure about it. |
| 09:11 | Raynes | fliebel: I think including all vars with documentation is great. |
| 09:11 | Raynes | I learned some new dynamic vars that I didn't know about before. |
| 09:12 | fliebel | Raynes: And you use those? |
| 09:12 | Raynes | No, but it's nice to know about them. :> |
| 09:13 | fliebel | If I need a random Java lib that's not on Maven, am I supposed to add it to Clojars? |
| 09:15 | fliebel | And how do I make something in Clojure that is a valid Enumeration<String>? will a seq or vector-of do? |
| 09:16 | kjeldahl_ | fliebel: Any reason you can not just copy into your ~/.m2 local maven repo? |
| 09:16 | fliebel | kjeldahl_: Because not everyone can access my ~/.m2? |
| 09:16 | kjeldahl_ | (I'm assuming a lot here, haven't tested myself, only limited experience from java on this) |
| 09:17 | kjeldahl_ | fliebel: I was thinking that "lein deps" would copy it into lib together with the rest of the stuff. |
| 09:17 | fliebel | kjeldahl_: Yes, but as soon as my project gets on the webs, others need it as well. |
| 09:19 | kjeldahl_ | fliebel: lein uberjar? |
| 09:20 | kjeldahl_ | fliebel: How are the rest of the dependencies deployed then? Fetched by maven automagically? If so, put the jar into the local repo on the deployment machines as well? |
| 09:20 | fliebel | kjeldahl_: Meh, I actually wanted to know if it's okay to put java stuff on clojars. |
| 09:21 | kjeldahl_ | fliebel: Can't help you there, if at all. :-) |
| 09:23 | Raynes | fliebel: Yes, it is. |
| 09:24 | Raynes | kjeldahl_: The whole point of dependency management is for people to be able to fetch the dependencies when they're hacking on your project. If he installs his dependency in a local maven repo, other people who want to work on his project wont be able to get it. If you're going to do that sort of thing, you might as well not use a dependency manager at all. |
| 09:25 | fliebel | Raynes: Cool |
| 09:25 | kjeldahl_ | Raynes: Got it now. Didn't get enough context to figure out he was looking for somewhere to stuff a jar for public distribution, not private. |
| 09:26 | kjeldahl_ | Raynes: But the Clojars hint is fairly obvious by now. |
| 09:32 | fliebel | Can I also use Cake to push to Clojars? |
| 09:33 | fliebel | there doesn't seem to be cake push |
| 09:33 | Raynes | fliebel: cake release |
| 09:34 | fliebel | It's not in cake help, or I'm overlooking it, or running an outdated cake |
| 09:34 | Raynes | cake release has been around for quite a while. |
| 09:35 | Raynes | Just doing 'cake release' builds a jar of your project and pushes it to clojars. |
| 09:35 | fliebel | Okay, thanks |
| 09:57 | bartj | is there a replace-ignore-case somewhere? |
| 10:00 | Raynes | bartj: .replace and clojure.string/replace both take regexes. You can make your regex ignore case. Don't as me how though. |
| 10:00 | Raynes | ask* |
| 10:00 | bartj | Raynes, yep, figured that out |
| 10:00 | bartj | Raynes, Perl regexes tend to spoil you with options |
| 10:13 | bartj | ,(replace "Б." #"б." "бульвар") |
| 10:13 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args (3) passed to: core$replace |
| 10:14 | bartj | firstly, I am using the correct string/replace in my code |
| 10:15 | bartj | am I doing something wrong in the replace function? |
| 10:15 | Raynes | &(clojure.string/replace "Б." #"б." "бульвар") |
| 10:15 | sexpbot | ⟹ "Б." |
| 10:16 | bartj | |
| 10:16 | bartj | my screen prints that, is there any utf-8 settings one needs to add to run Clojure? |
| 10:18 | tonyl | &(clojure.string/replace "бульвар" #"б." "Б.") |
| 10:18 | sexpbot | ⟹ "Б.львар" |
| 10:18 | tonyl | not as far as I know, my repl prints it fine |
| 10:27 | bhenry | is there something like map that isn't lazy? |
| 10:28 | raek | (doall (map ...)) |
| 10:29 | raek | or (doseq [x xs] ...) if you only care about the side-effetcs |
| 10:29 | raek | bartj: what IDE (if any) do you use? |
| 10:29 | bhenry | actually i just realized the laziness wasn't my problem. i was mapping over a vector that later gets called as a function of it's keys, so i'll do (vec (msp …)) thanks though. |
| 10:29 | bartj | raek, vim :) |
| 10:30 | raek | sorry, never used that with clojure :) |
| 10:30 | bartj | raek, the problem is not with the IDE |
| 10:31 | raek | vim only acts as a terminal? |
| 10:31 | bartj | raek, I am currently testing on the repl in a bash shell |
| 10:31 | raek | bartj: you can run the following to detect encoding issues: (seq "бульвар") |
| 10:32 | raek | if everyting works, you should get (\б \у \л \ь \в \а \р) |
| 10:32 | bartj | raek, I get this: (\1 \C \; \L \2 \0 \@) |
| 10:32 | Raynes | Yikes. |
| 10:32 | raek | oh, are you using line repl? |
| 10:33 | raek | *lein |
| 10:33 | bartj | yes only the Repl |
| 10:33 | raek | then install rlwrap in your OS |
| 10:33 | raek | leiningen uses jline if it is not available |
| 10:34 | raek | and jline does not have support for UTF-8 |
| 10:34 | mvid_ | is there a way to print the actual text from an array of strings? everything I try just gives me the string addresss |
| 10:34 | raek | (rlwrap cannot be distributed with leinigen due to the licenses) |
| 10:35 | raek | mvid_: (seq the-array) |
| 10:35 | mvid_ | i get output like this |
| 10:35 | mvid_ | (#<String[] [Ljava.lang.String;@2699146a> #<String[] [Ljava.lang.String;@c0b4ef2> #<String[] [Ljava.lang.String;@3a6bf80b> #<String[] [Ljava.lang.String;@669b824>) |
| 10:36 | bartj | I suspect the problem is jline |
| 10:36 | bartj | let me remove that! |
| 10:36 | bartj | mvid_, seq it! |
| 10:36 | kotarak | mvid_: (map seq the-array) |
| 10:36 | Raynes | &(map seq (repeat 3 (into-array String ["a" "b" "c"]))) |
| 10:36 | sexpbot | ⟹ (("a" "b" "c") ("a" "b" "c") ("a" "b" "c")) |
| 10:37 | raek | mvid_: looks like you have an array of arrays of strings |
| 10:37 | mvid_ | 0.) |
| 10:37 | mvid_ | o.) |
| 10:37 | mvid_ | maybe? |
| 10:37 | mvid_ | ill have to check |
| 10:37 | mvid_ | ah |
| 10:38 | mvid_ | yes |
| 10:38 | mvid_ | that was dumb... |
| 10:38 | bartj | raek, yeah, removing jline helped |
| 10:39 | raek | bartj: as I said, if you install rlwrap on your system, lein will use that instead. rlwrap does not have this problem. |
| 10:39 | bartj | raek, yes, I have; but how does lein come into the picture? |
| 10:39 | bartj | raek, I do a "sudo apt-get install rlwrap" |
| 10:43 | edw | Anyone here use Cascalog (apropos the BackType video)? I'm wondering how to get a query to return a sequence, not print to standard out. |
| 10:45 | bartj | Raynes, is the following a bug in replace? |
| 10:46 | bartj | &(clojure.string/replace "Б." #"б." "бульвар") |
| 10:46 | sexpbot | ⟹ "Б." |
| 10:46 | bartj | I expect the output to be бульвар |
| 10:46 | fliebel | What's up with design patters in Clojure? Just as valid as anywhere else, or OO legacy? |
| 10:46 | tonyl | &(clojure.string/replace "бульвар" #"б." "Б.") |
| 10:46 | sexpbot | ⟹ "Б.львар" |
| 10:47 | tonyl | the string goes first then the match then the replacement |
| 10:47 | drdo | fliebel: design patterns are sad things to reuse code by copy pasting |
| 10:47 | edw | fliebel: Flamebait? :) |
| 10:48 | fliebel | edw: What? Meh I have a book about them right here on my desk, just wondering if it will do me any good. |
| 10:48 | bartj | tonyl, the string is Б. and the match is б. |
| 10:48 | tonyl | what is the replacement |
| 10:48 | bartj | tonyl, and the replacement is the long word: бульвар |
| 10:48 | raek | bartj: I think lein will check if rlwrap is on the PATH and if so, use it |
| 10:49 | bartj | but strangely this works: |
| 10:49 | bartj | &(clojure.string/replace "A." #"(?i)a." "xyzpqr") |
| 10:49 | sexpbot | ⟹ "xyzpqr" |
| 10:49 | bartj | replace seems to despise russian strings? |
| 10:50 | raek | &(clojure.string/replace "Б." #"(?i)б." "бульвар") |
| 10:50 | sexpbot | ⟹ "Б." |
| 10:50 | edw | fliebel: I don't see the GoF book getting much use in a Lisp e.g. Clojure shop. |
| 10:50 | tonyl | but #"б." doesn't match in the "Б." string |
| 10:51 | tonyl | but i don't know russian chars |
| 10:51 | paulrosania | bartj: your arguments are out of order, you want (replace string pattern replacement), not (replace pattern replacement string) |
| 10:51 | fliebel | edw: I hav Head First Design Patters, but your point stands I guess. |
| 10:51 | bartj | they are the same; one is lower-case version of the other |
| 10:51 | raek | "By default, case-insensitive matching assumes that only characters in the US-ASCII charset are being matched. Unicode-aware case-insensitive matching can be enabled by specifying the UNICODE_CASE flag in conjunction with this flag." |
| 10:51 | p_l|home | fliebel: I believe the canonical quote about GoF pattern book and Lisp was "where Java programmer sees pattern, Lisp programmer sees unnecessary crufty redundance of code" |
| 10:51 | tonyl | I would make the regex case insensitive then |
| 10:51 | raek | http://download.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html |
| 10:51 | raek | &(clojure.string/replace "Б." #"(?iu)б." "бульвар") |
| 10:51 | sexpbot | ⟹ "бульвар" |
| 10:52 | raek | bartj: :-) |
| 10:52 | bartj | raek, oh my god |
| 10:53 | raek | I recommend checking out the unicode goodies of that page. for example, there are character classes for letters-of-any-script etc |
| 10:54 | edw | fliebel: In my experience, learning how to think in terms of list (sequence?) manipulation, using higher-order functions, is going to significantly improve your productivity. In other words, learn how to look at the world through mapping, reducing, etc. operations. |
| 10:55 | bartj | raek, thanks a ton! |
| 10:56 | miltondsilva | I'm trying to apply what I've learned in clojure to java/c.. but so far it seems that no matter what I do, java/c forces me to solve problems their way... is there something I'm mising? does somebody have tips on how to improve code quality in the C world by applying thing you learned in lisp/clojure? |
| 10:56 | bartj | miltondsilva, declaring all our variables as final would be the first step, IMO |
| 10:56 | tonyl | functions free of side effects. make composite functions |
| 10:57 | tonyl | that is what i don in imperative langs |
| 10:57 | lucian | miltondsilva: I mark functions as pure and have unit tests for that |
| 10:57 | lucian | it works very nicely in python |
| 10:57 | Raynes | &(letfn [(flip [f & args] (fn [& args] (apply f (reverse args))))] ((flip cons) '(b c) 'a)) |
| 10:57 | sexpbot | ⟹ (a b c) |
| 10:57 | Raynes | My favorite function ever. |
| 10:58 | miltondsilva | lucian: thanks never thought of that |
| 10:58 | miltondsilva | bartj: how do you then handle(change) them? |
| 10:58 | lucian | miltondsilva: copies, most likely |
| 10:58 | lucian | but probably implicit copies through function calls |
| 10:58 | lucian | am i guessing right? |
| 10:59 | rrc7cz | how can I bind swank-clojure to 0.0.0.0 when I boot w/the bin? I've tried: .lein/bin/swank-clojure 4005 "0.0.0.0" but it doesn't like it |
| 11:00 | lucian | miltondsilva: there's another nice technique in some imperative languages, generators |
| 11:00 | miltondsilva | hmm.. ok thanks, I'll go investigate now :) and make some tests |
| 11:00 | lucian | miltondsilva: I sometimes write the various steps in some data processing as separate coroutines |
| 11:01 | lucian | or generators, since i tend to use python |
| 11:01 | lucian | miltondsilva: and you get both speed (generators are lazy lists) and functional purity/composability |
| 11:01 | lucian | in an imperative language |
| 11:01 | lucian | of course, this won't work in java or c |
| 11:02 | raek | rrc7cz: lein swank 4005 0.0.0.0 seems to work for me |
| 11:03 | raek | ah, you were using a different binary |
| 11:04 | raek | a new leiningen feature? |
| 11:04 | rrc7cz | raek: yeah, I'm trying to boot swank w/out a project |
| 11:04 | rrc7cz | from Git readme: "If you just want a standalone swank server with no third-party libraries, you can just install swank-clojure using Leiningen. ~/.lein/bin/swank-clojure" |
| 11:08 | rrc7cz | from the src it looks like the port is pulled separately, which isn't a problem for me; I can set the port fine via "swank-clojure XXXX" but when I try to add a host ip it blows up, saying "no value supplied for key: 0.0.0.0" so I'm guessing it expects a k+v for a map, but I'll have to dig in deeper to see how it parses it |
| 12:04 | technomancy | will probably drop jline for Leiningen 2.0; rlwrap is a better solution in every way except for distribution =\ |
| 12:05 | raek | licenses, rigth? |
| 12:05 | technomancy | no, it's just that rlwrap is a C executable |
| 12:05 | technomancy | rather than a jar file |
| 12:06 | raek | oh |
| 12:06 | technomancy | it's silly that libreadline isn't linked to the JDK; they actually are license-compatible IIUC |
| 12:07 | technomancy | but sun obviously doesn't realize there's such a thing as a command-line |
| 12:09 | Raynes | cljandbox? Oh no, not competition. |
| 12:09 | Raynes | Oh, *whew*. It isn't a sandboxing library. |
| 12:09 | fliebel | "A collection of Clojure utilities" |
| 12:10 | raek | ah, that kind of sandbox... |
| 12:10 | cloture | hey all. I am familiar with the benefits of lisp, clojure, etc, but I was wondering if there are any "killer apps" for clojure? Any libraries which really show off clojure's advantages? |
| 12:11 | fliebel | cloture: Hm, what about Aleph and ClojureQL? |
| 12:12 | dnolen | rhickey: empty is pretty useful. What about empty-transient? |
| 12:12 | Raynes | I think ring is a nice example. |
| 12:13 | fliebel | Raynes: But ring is not unique to Clojure, Python and Ruby have similar concepts. |
| 12:13 | chouser | how hard would it be to have clojure load a .class file in such a way that it could reload a new version of it later, the way it does with deftype classes |
| 12:13 | cloture | fliebel: ClojureQL looks interesting. thanks for the suggestion |
| 12:15 | hiredman | chouser: can't you just re-use that mechanism |
| 12:15 | hiredman | DynamicClassloader |
| 12:21 | cloture | is there a preferred web library for clojure? is momentum towards webjure, compojure, or something else? |
| 12:21 | Raynes | cloture: Moustache and Compojure tend to be the most popular. |
| 12:21 | cloture | Raynes: thanks |
| 12:24 | chouser | hiredman: dunno. I guess I haven't tried. |
| 12:25 | sholden | cloture: I just started reading and learning clojure this morning, I'm kind of at the same stage :P |
| 12:25 | cloture | sholden gotta start somewhere |
| 12:25 | sholden | Im getting the hang of it, but I'm trying to decide what a good app would be to write in it that would flex it and show off a bit |
| 12:26 | cloture | yeah I know what you mean |
| 12:27 | sholden | at work we have a service that monitors updateable objects (could be 'fetch and cache url' or 'run script' etc) |
| 12:27 | sholden | and there may be about 1000 of them in the system at a time |
| 12:27 | sholden | updating 5-30 sec |
| 12:27 | sholden | might see if i can write a clojure version of that |
| 12:28 | hiredman | chouser: you may have to wall hack the var the compiler uses to hold the current classloader |
| 12:29 | hiredman | more maybe not |
| 12:29 | hiredman | looks like classCache is global |
| 12:30 | hiredman | er |
| 12:30 | hiredman | "static" |
| 12:37 | pedroteixeira | hi, can anyone confirm that the functions keys and vals produce sequences in correct pair order? |
| 12:37 | pedroteixeira | or one should not assume that. |
| 12:38 | pedroteixeira | ? |
| 12:38 | drewr | one should assume that |
| 12:38 | pedroteixeira | thanks, drewr. glad about that :) |
| 12:45 | fogus` | All: Is this a fair one-sentence summation? --> You can "mix in" partial implementations if you desire, but it only takes effect at the granularity of the protocol and not on a per-function basis. |
| 12:47 | fogus` | In other words, this: https://gist.github.com/727273 |
| 12:48 | @rhickey | fogus`: I don't se the mixin there |
| 12:48 | @rhickey | see |
| 12:49 | @rhickey | I would reserve the term mixin for uses of extend that build the map using pieces |
| 12:49 | fogus` | rhickey: Do you mean a map of str=>fn used by extend? |
| 12:49 | fogus` | oh, I see |
| 12:49 | @rhickey | and in that sense, you can build a full implementation from partial ones |
| 12:50 | fogus` | rhickey: So that's to say that implementations are "mixed" into the map which is then used once in extend? |
| 12:51 | @rhickey | right |
| 12:51 | fogus` | rhickey: OK, I can use that. What would you suggest as a better term in my original statement? |
| 12:52 | @rhickey | fogus`: one doesn't do mixins via multiple partial extensions? |
| 12:53 | @rhickey | or, extension is at the granularity of the entire protocol |
| 12:54 | fogus` | rhickey: Thanks! That sounds good. I will expand on the original theme to include some talk about Clojure mixins |
| 12:54 | dnolen | oh yeah, I guess empty-transient isn't so useful w/ only two data structures really supporting it. rhickey: have there been any takers on that, bringing transient support to the other data structures? |
| 12:55 | @rhickey | dnolen: all enhancements to transients will have to wait for pods |
| 12:55 | dnolen | rhickey: I see. |
| 13:46 | fliebel | What are the latest 2 parameters for Clojars? http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html |
| 13:50 | stuartsierra | Clojars doesn't support deployment via Maven, last I heard. |
| 13:50 | fliebel | Huh? So how do I get a jar on there? |
| 13:50 | Raynes | Clojars only supports ssh deployment, iirc. |
| 13:50 | stuartsierra | SCP |
| 13:50 | stuartsierra | see clojars.org home page |
| 13:51 | fliebel | They assume I can create a pom with leiningen, but I don't have one. can I at least have maven generate me one? |
| 13:51 | stuartsierra | no |
| 13:51 | stuartsierra | copy & modify from another project |
| 13:53 | Raynes | cemerick: You were right: syntaxhighlighter evolved is teh awesome: http://blog.raynes.me/?p=82 |
| 13:54 | Raynes | Too bad tinymce's visual mode completely borks it, because it 'cleans up' your HTML and removes whitespace. |
| 13:57 | cemerick | Raynes: really? wp.com must have fixed a version for what they use -- I can use the WYSIWYG editor with code in a post without a problem.. |
| 13:59 | Raynes | cemerick: In the visual editor? |
| 13:59 | Raynes | In tinymce, if you switch from HTML to visual, your code is completely mangled. |
| 13:59 | cemerick | not on wp.com *shrug8 |
| 14:00 | cemerick | s/8/* |
| 14:00 | sexpbot | <cemerick> not on wp.com *shrug* |
| 14:00 | cemerick | like I say, they may have deployed a patched version of mce |
| 14:00 | Raynes | Probably. |
| 14:00 | cemerick | In any case, my usual process is to drop code in in the HTML mode, tag it appropriately, and then write around it in the visual editor. |
| 14:00 | Raynes | cemerick: Of course, I haven't tried WPs visual editor. I was using scribefire. |
| 14:01 | Raynes | cemerick: WP's editor is the same as scribefires, but you're right in that they might have a patched version. |
| 14:01 | Raynes | Nonetheless, syntaxhighlighter evolved explicitly mentions this flaw, so I'm not sure. I'll try it in a second. |
| 14:01 | clojurebot | No entiendo |
| 14:03 | Raynes | cemerick: Yup, still mangles it. |
| 14:18 | chouser | Hi! Who wants to help me with maven? Some more? |
| 14:19 | Raynes | chouser: I want to help you with maven as much as I want to help the government find Julian Assange. |
| 14:19 | Raynes | Ba dum *ding* |
| 14:19 | cky | Raynes: Well played. |
| 14:19 | chouser | oh, I should say that I did get maven and antlr to play nicely together. The main problem was the antlr maven plugin used antlr 3.0.1, but we needed it to use 3.1.2, which ended up requiring a patch to the plugin itself. |
| 14:19 | cky | chouser: Isn't there a #maven channel for that sort of stuff? |
| 14:19 | chouser | cky: hm, good point. |
| 14:20 | cky | To me, the only relation Maven has to Clojure is the letter "e". |
| 14:21 | chouser | cky: well, I'm hoping to use clojure.java.io/resource, but your point is still valid |
| 14:24 | chouser | on the other hand, I've gotten infinitely more responses to my question here as I have in #maven |
| 14:25 | chouser | so, I'll go for it anyway. feel free to ignore me. |
| 14:25 | Raynes | People here actually like you and know you. |
| 14:25 | chouser | If I have a file like src/main/resources/com/mydomain/foo.txt, should I be able to get to it via (clojure.java.io/resource "com/mydomain/foo.txt") ? |
| 14:25 | brehaut | chouser: the #mavenites are going to respond to your question, but they are still waiting for the dependant questions to download |
| 14:26 | chouser | brehaut: tee hee |
| 14:26 | cky | :-) |
| 14:26 | stuartsierra | chouser: Yes, after a build. |
| 14:26 | chouser | ah! |
| 14:26 | chouser | seems obvious now that you say it |
| 14:26 | stuartsierra | the "process-resources" phase has to run first. |
| 14:27 | chouser | hm, still getting nil |
| 14:28 | chouser | could I have disabled it somehow in my pom? |
| 14:28 | stuartsierra | Do "find target -name foo.txt" and see where it shows up |
| 14:29 | stuartsierra | Wait... |
| 14:29 | stuartsierra | You may need to add a <resource> directory. |
| 14:29 | chouser | ah |
| 14:29 | chouser | I see a couple for clojure sources. hang on |
| 14:29 | stuartsierra | Under <build>, add <resources><resource>src/main/resources</resource></resources> |
| 14:30 | stuartsierra | I think if you have any resource dirs defined, it overrides the default src/main/resources |
| 14:30 | stuartsierra | sorry that's <resources><resource><directory>src/main/resources</directory></resource></resources> |
| 14:30 | chouser | heh, ok, I think I understand. hang on |
| 14:31 | chouser | bingo |
| 14:31 | stuartsierra | cowabunga |
| 14:31 | chouser | thanks bunches! |
| 14:31 | stuartsierra | 'welcome |
| 14:33 | chouser | is it kosher to make up new dirs in there? like src/main/web-content ...? |
| 14:33 | stuartsierra | yes |
| 14:34 | stuartsierra | Every <resource> will get copied into the JAR, without its base directory |
| 14:34 | chouser | but they get merged into the same virtual resource tree, so I'd still need a uniquely named subdir. may not be worth it. |
| 14:34 | chouser | ok |
| 14:34 | stuartsierra | e.g., src/main/web-content/foo.txt becomes " |
| 14:34 | stuartsierra | "/foo.txt" in the output JAR |
| 14:35 | chouser | right |
| 14:35 | chouser | thanks again, that would have taken me a long time to figure out on my own. |
| 14:36 | stuartsierra | np |
| 14:58 | kjeldahl | Does anybody have a "cake-swank" emacs function handy? I've tried doing a search and replace on my "lein-swank", but that doesn't seem sufficient... |
| 15:02 | kjeldahl | Probably related to cake having a different process model. |
| 15:08 | hchbaw_ | quile: |
| 15:10 | kjeldahl | Got it working. Had to modify the string-match parameter to recognize the cake output. |
| 15:12 | lpetit | Hello |
| 15:13 | mmullins | I'm having trouble with *agent* in clojure-1.3.0-alpha3. It seems to be nil when I expect it not to be. (send (agent 0) (fn [_] (println "*agent* = " *agent*))) gives *agent* = nil. I think in alpha1 and 1.2.0 this gave the agent as I expect. Am I not supposed to do that now? |
| 15:14 | lpetit | any ccw users in the place ? I need ideas for a feature I want to add ... |
| 15:14 | hiredman | mmullins: it's a known bug |
| 15:14 | mmullins | Ahhh ... ok. Thanks. |
| 15:15 | hiredman | because of the change that propagates bindings from the thread running the action, to the thread the action is run on |
| 15:15 | hiredman | on the thread the action is sent form *agent* is nil |
| 15:16 | mmullins | so is there a way to send the same agent another function from inside one it's doing until that's fixed? |
| 15:17 | hiredman | create your own binding of *agent* to the agent you are sending to |
| 15:17 | hiredman | (let [a (agent 0)] (binding [*agent* a] (send a some-action))) |
| 15:18 | mmullins | I'll try it. Thanks. |
| 15:30 | cloture | I seem to have a problem. I am using leiningen, which had been working fine. However, when I use the "deps" command, it now just sits hangs |
| 15:31 | cloture | anyone familiar with the issue?\ |
| 15:33 | cloture | hmm. when I remove one of the dependencies there is no problem |
| 15:54 | chouser | meh. ring is getting in my way, for perhaps the first time |
| 15:54 | hiredman | do share |
| 15:55 | chouser | trying to serve static content from resources instead of a file path |
| 15:55 | chouser | but all the wrap-file stuff assumes otherwise -- breaks in several places |
| 15:56 | hiredman | can wrap file take File objects? |
| 15:57 | hiredman | you should be able to generate file objects use the url from one of those getResource methods |
| 16:07 | technomancy | cloture: that was a known bug that surfaced in one of the release candidates; it should be fixed on the 1.4.0 release |
| 16:08 | cloture | technomancy: okay. thanks for the info |
| 16:12 | technomancy | cloture: that is to say, make sure you're running the latest; if it still happens please file a bug |
| 16:18 | chouser | hiredman: if you have actually seen working code like that, I'd be interested. My fumbling attempts to do it have all failed. |
| 16:36 | bmh | Is there a 'nice' looking way of writing a curried multimethod where the object used for dispatch is not in the first argument position? |
| 16:38 | technomancy | ,((comp second list) 1 2 3 4) |
| 16:38 | clojurebot | 2 |
| 16:39 | technomancy | ,((comp class second list) 1 2.0 :three "four") |
| 16:39 | clojurebot | java.lang.Double |
| 16:53 | cloture | anyone familiar with enlive? does a template have to exist before you use deftemplate? I keep getting a null pointer exception and I'm baffled as to why that is |
| 16:59 | dnolen | cloture: the html file the template uses does have to exist. |
| 16:59 | cloture | dnolen: okay, I'm a bit confused. enlive doesn't generate the html from the clojure code you supply? |
| 17:01 | cloture | dnolen: even when it exists I get an error |
| 17:01 | dnolen | cloture: the html file need to be in the class path |
| 17:03 | dnolen | cloture: enlive serializes the html file and processes it according to your template definition. |
| 17:03 | cloture | dnolen: okay |
| 17:03 | eaa | anyone ever experience problems with multimethod dispatch blocking threads? I am getting thread contention in clojure in MultiFn.java:106 when invoking a multimethod from within a pmap via incanter.stats which invokes a multimethod to convert its argument before invoking a Java method |
| 17:04 | cloture | thanks for the help |
| 17:04 | dnolen | cloture: have you looked at the enlive tutorial I wrote? |
| 17:20 | aria42 | I have a deftype and it implements IFn for various # of args of invoke. When I use partial on an instance of the type, I get an abstract method error when I execute on a defined invoke |
| 17:21 | aria42 | The issue is the use of apply in partial |
| 17:22 | hiredman | aria42: you need to implement the apply method |
| 17:22 | @rhickey | aria42: just implement applyTo |
| 17:22 | aria42 | Ah, thanks. |
| 17:23 | raek | dnolen: I saw in that tutorial a while go that you called (apply str ...) on the result from enlive. is that really necessary? |
| 17:24 | raek | I think the ring SPEC says that the body of the response may be a sequence of strings |
| 17:26 | raek | also, I enjoyed the tutorial :-) |
| 17:27 | dnolen | raek: it is. |
| 17:27 | dnolen | raek: thx! |
| 18:00 | kzar | When I slime-connect to Clojure it works fine except the slime-repl is not put into Clojure mode. Then if I load clojure-mode myself the repl breaks and I can no longer evaluate stuff. Any ideas? |
| 18:04 | kzar | Oh I found my answer, sorry |
| 18:04 | brehaut | i dont think you need to be sorry for solving your own problem |
| 18:06 | kzar | Heh I almost said 'sorry' for my eroneous apology, stack overflow Dave heh |
| 18:09 | brehaut | kzar: im not familiar enough with SO to understand your reference |
| 18:13 | kzar | brehaut: Well if you mess up some recursion, as I often do, you get a stack overflow error and I was joking that would happen to me as I kept apologising for apologising forever. Kind of a terrible joke but there you go heh |
| 18:14 | cky | *lol* @ brehaut, I have the same problem myself. |
| 18:14 | cky | That I read "stack overflow" as a reference to stackoverflow.com. |
| 18:18 | brehaut | i think it might be time to brew tea |
| 19:58 | jjido | ##(date) |
| 19:58 | sexpbot | java.lang.Exception: Unable to resolve symbol: date in this context |
| 20:02 | jjido | &(Date.) |
| 20:02 | sexpbot | java.lang.IllegalArgumentException: Unable to resolve classname: Date |
| 20:05 | jjido | &(java.util/Date.) |
| 20:05 | sexpbot | java.lang.ClassNotFoundException: java.util |
| 20:05 | jjido | &(java.util.Date.) |
| 20:05 | sexpbot | ⟹ #<Date Fri Dec 03 17:06:07 PST 2010> |
| 20:06 | jjido | thanks :D |
| 21:04 | talios | is it possible to return a type specific object array in clojure? ( other than the predefined boolean-array, char-array etc. etc. ). I want/need to return SomeFoo[] |
| 21:28 | hiredman | talios: have you read the docs on make-array? or into-array? |
| 21:29 | talios | aha! I hadn't spotted those two :) Cheers. I refactor the code to use a List<XXX> on the java side anyway. Tho I might revert that for now and favour (make-array) to keep the changes to a minimal in this spike. |
| 21:30 | talios | man - it's been way toooo long since I've actully done any clojure. |
| 21:52 | RazWelles | ping dmiller2718 -- Do you have any code examples for importing a .Net dll, and instantiating a class and using a method? I can't find any docs for ClojureCLR |
| 22:28 | talios | Hrm - I have a namespace with a defn'd function, and a deftype type. The type doesn't seem to be able to see the functions in the namespace surrounding it. Am I missing something simple? https://gist.github.com/8bf96274a6912aaea036 |
| 22:34 | hiredman | I think there is too much wrong with that to debug via irc, so I would suggest more reading of docs |
| 22:35 | hiredman | for one thing I don't think ^File [] does what you think |
| 22:36 | hiredman | I kind of doubt you've read up datatypes, since I would be surprised if you have a reason to use deftype over defrecord |
| 22:38 | talios | mmm, defrecord just seems to add all the keyword accessors, equals/hashcode etc. etc. which I didn't seem to need. |
| 22:42 | talios | ^File [] should have been ^File[] anyway - and seems to compile fine. |
| 22:43 | hiredman | right, but it doesn't do what you ant |
| 22:43 | hiredman | want |
| 22:43 | hiredman | so unless you understand what and why I suggest you stick with defrecord |
| 22:45 | talios | I require the ^File[] so that the interface is satisfied. Without it I get "Can't define method not in interfaces: discoverNamespacesIn" |
| 22:45 | hiredman | I suggest you run ^File[] through the reader and see what you get |
| 22:48 | dmiller2718 | RazWelles: Use (System.Reflection.Assembly/Load "...") for things in the GAC, (System.Reflection.Assembly/LoadFrom "..." for things in your directory. |
| 22:48 | RazWelles | dmiller2718, thanks so much! |
| 22:49 | talios | hrm - empty list. so how does one type list an array? |
| 22:49 | dmiller2718 | RazWelles: In the ClojureCLR source, look in Clojure/Clojure.Source/clojure/samples, both celsius.clj and the interop subdir. |
| 22:49 | RazWelles | oooh, sweet I'll go grab that from github :D |
| 22:50 | RazWelles | dmiller2718, also, thanks for continuing to work on ClojureCLR, I've been waiting for user binaries since the project first started :) |
| 22:50 | talios | oh nasty - ok. so clojure doesn't directly support array typehints - nasty. |
| 22:51 | dmiller2718 | RazWelles: thx. Feel free to contact directly with suggestions, etc. |
| 22:51 | talios | I suspect that'll leave me back with the original problem tho |
| 22:52 | RazWelles | dmiller2718, definitely will do :)! |
| 23:07 | talios | Right - so now back to my original problem, after cleaning up that mess of a deftype. |