2010-01-21
| 00:26 | defn | alexyk: why is macro a better nick |
| 00:26 | defn | alexyk: my nick is defn because my real life name is devin -- it's actually just a coincidence that clojure has defn |
| 00:27 | alexyk | defn: 'cause macro's beat defn's... ah ok :) |
| 01:26 | wooby | hello, i'm getting a strange exception (that i haven't seen in java) when importing quicktime libraries on OS X |
| 01:26 | wooby | http://paste.lisp.org/display/93677 |
| 01:27 | wooby | thanks in advance for any clues |
| 01:31 | redalastor | Is there a reason why dissoc-in doesn't exist or it was just forgotten? |
| 01:38 | redalastor | Ok, found it in contrib. Why isn't it in core? |
| 01:46 | hoeck | wooby: maybe you have to instantiate some QuickTime class before even importing other classes |
| 01:47 | wooby | hoeck: i'm testing that now, i think i have to register an exception handler or something... not sure exactly how that's supposed to work |
| 01:48 | hoeck | wooby: I think, java loads classes on the first usage whereas clojure loads them (and runs static initializers) on :importing them |
| 02:35 | LauJensen | Good morning team ! |
| 03:42 | TheBusby | this may sound like a bizarre question, but what exactly is "-main" for? |
| 03:43 | TheBusby | evidently it's not required to to compile to class files, and execution begins at the top of the file |
| 03:47 | Chousuke | -main is the function that corresponds to the main method of your class when gen-classing |
| 03:48 | Chousuke | It looks a bit magical I guess, but the "-" is just the default method prefix of gen-class. It can be overridden. |
| 03:53 | LauJensen | TheBusby: When you compile an executable jar, -main will execute when calling java -jar my.jar |
| 03:54 | TheBusby | I would expect it would be the enly thing executed though |
| 03:55 | TheBusby | if you simple do $java helloworld.class though, it'll execute any line preceding -main's definition as well though |
| 03:57 | LauJensen | though thats right, the jar execution relies on the manifest which points to a place to start, ie. -main |
| 03:59 | TheBusby | just not finding an easy way to have a single clj file execute as both a script and a compiled binary |
| 04:02 | TheBusby | thank you for the help though ;) |
| 04:11 | vu3rdd | ,(doc identity) |
| 04:11 | clojurebot | "([x]); Returns its argument." |
| 04:11 | vu3rdd | What exactly is the purpose of identity? |
| 04:13 | gregh | to return its argument :) |
| 04:13 | AWizzArd | vu3rdd: when a function foo takes a function F as an argument to transform its other args, then identity can be a nice default for F. |
| 04:14 | AWizzArd | or if foos default is not f and you don't want to transform the other args then pass identity in |
| 04:15 | AWizzArd | or if some program part created a vector of values, where some can be nil or false, then identity can help to get all non-nil and non-false values |
| 04:15 | AWizzArd | ,(filter identity [1 2 nil 3 4 5 false false nil nil nil 6 7 nil 8 9 false 10 false]) |
| 04:15 | clojurebot | (1 2 3 4 5 6 7 8 9 10) |
| 04:16 | vu3rdd | AWizzArd: thanks. I get it now. |
| 04:19 | esj | Salute, Parentherati. |
| 05:19 | angerman | I'm doing something like (let [acc (doseq [_ (range 10)] (ref [])) row-worker (fn [row] (dosync (doseq [i (range 10)] (alter (nth acc i) conj (nth row i))) |
| 05:19 | angerman | and the row-worker is then used to iterate over a resultset from a database. I'm having the very feeling, that what I did is pretty stupid |
| 05:21 | angerman | should I be using transients? |
| 05:23 | Chousuke | why are you not just building it functionally? |
| 05:24 | angerman | Chousuke: how? |
| 05:25 | angerman | hmmm wait a sec |
| 05:25 | Chousuke | ,(vec (for [i (range rows)] (reduce conj [] (range 5)))) |
| 05:25 | clojurebot | java.lang.Exception: Unable to resolve symbol: rows in this context |
| 05:25 | Chousuke | oops |
| 05:25 | Chousuke | ,(vec (for [i (range 3)] (reduce conj [] (range 5)))) |
| 05:25 | clojurebot | [[0 1 2 3 4] [0 1 2 3 4] [0 1 2 3 4]] |
| 05:26 | Chousuke | I don't see why you'd need a ref |
| 05:26 | Chousuke | you *can* use transients, but write it without them first |
| 05:27 | angerman | Hm. ok. can I reduce maps? |
| 05:27 | Chousuke | it's in many cases trivial to transform code using persistents to code that uses transients. |
| 05:27 | Chousuke | yeah |
| 05:27 | Chousuke | they appear as a seq of [key val] pairs |
| 05:28 | angerman | the databse is returning something like {:a val1 :b val2 c: val3} |
| 05:28 | Chousuke | to reduce |
| 05:28 | Chousuke | ,(seq {:a 'a :b 'b}) |
| 05:28 | clojurebot | ([:a a] [:b b]) |
| 05:28 | angerman | and the end result should look like {:a [val1 ...] :b [val2 ...] :c [val3 ...]) |
| 05:29 | Chousuke | hm |
| 05:29 | LauJensen | I'm parsing a huge dataset and for each row I need to reject values that arent of a certain type. There are about 23000 types which I accept. Which lookup/datatype is most efficient for determining if I accept or reject the value? |
| 05:30 | angerman | LauJensen: Hashmap? (wild guess) |
| 05:31 | LauJensen | I don't think the hashmap matches vector for speed |
| 05:31 | angerman | what are your types? numeric? |
| 05:31 | LauJensen | Strings, but can be coerced to numerical |
| 05:31 | Chousuke | ,(merge-with (fn [a b] (conj (if vector? a a [a]) b)) {:a 1 :b 2 :c 3} {:a 3 :b 5 :d 7}) |
| 05:31 | clojurebot | java.lang.Exception: Too many arguments to if |
| 05:32 | Chousuke | eh |
| 05:32 | Chousuke | ,(merge-with (fn [a b] (conj (if (vector? a) a [a]) b)) {:a 1 :b 2 :c 3} {:a 3 :b 5 :d 7}) |
| 05:32 | clojurebot | {:d 7, :a [1 3], :b [2 5], :c 3} |
| 05:32 | Chousuke | there's a caveat if your values are vectors though |
| 05:32 | angerman | Chousuke: ha, you beat me to it, thanks. |
| 05:32 | angerman | Chousuke: no, it's always :key -> double |
| 05:33 | angerman | I guess I could initialize a map with vectors |
| 05:33 | angerman | and skip the conditional check |
| 05:33 | angerman | LauJensen: that's why I asked. as for Strings, i think a hashmap is pretty good |
| 05:34 | angerman | and you'll have to compare each value at least once anyway. |
| 05:34 | LauJensen | I'm just thinking that hashmaps require me to double the amount of data, but these are just values, now they need a key as well. With a vector I can just dump the data and run through it |
| 05:35 | Chousuke | use a set. |
| 05:35 | Chousuke | everyone forgets about sets :) |
| 05:35 | angerman | (map (partial filter #(contains? keys %)) dataset) |
| 05:35 | LauJensen | ah yes ofc |
| 05:35 | LauJensen | a set is the way to go |
| 05:35 | angerman | how do I tell paredit to comment something out? |
| 05:36 | esj | ; ? |
| 05:36 | LauJensen | ; ! |
| 05:37 | angerman | when I hit ; it just moves the current line one line down |
| 05:37 | angerman | and inserts a ; where the curser was |
| 05:43 | LauJensen | Well, lets just say - There's a reason I don't use paredit |
| 05:43 | angerman | heh |
| 05:44 | LauJensen | if t is [[1 2] [3 4] [4 5]] and I want #{1 2 3 4 5} returned, is there an idiom for this |
| 05:44 | LauJensen | (reduce #(conj %1 (%2 0) (%2 1)) #{} t) |
| 05:47 | janjan | ,(into #{} (apply concat [[1 2] [3 4] [4 5]])) |
| 05:47 | clojurebot | #{1 2 3 4 5} |
| 05:47 | janjan | dunno if it is an idiom, but that's how I would say it |
| 05:48 | LauJensen | Its better anyway |
| 05:48 | LauJensen | Though reduce trumps apply in most cases |
| 05:48 | janjan | the into #{} can be just 'set' |
| 05:48 | janjan | i see now |
| 06:04 | LauJensen | Nice, thanks jan |
| 06:22 | janjan | ,(short-array [1 2 3]) |
| 06:22 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Short |
| 06:22 | janjan | How is creating short[]'s supposed to work? |
| 06:24 | the-kenny | janjan: (short-array)? |
| 06:24 | the-kenny | ,(doc short-array) |
| 06:24 | clojurebot | "([size-or-seq] [size init-val-or-seq]); Creates an array of shorts" |
| 06:25 | janjan | yea, but then java/clojure won't cast the numbers to shorts |
| 06:28 | LauJensen | ,(short-array 5 (map short (range 5))) |
| 06:28 | clojurebot | #<short[] [S@1b548a> |
| 06:29 | janjan | LauJensen: just found out the same thing when you wrote it. Too bad the manual cast is needed |
| 06:29 | LauJensen | sure sure :) |
| 06:30 | janjan | hmm, strange thing, that jvm. This works |
| 06:30 | janjan | ,(int-array (into-array [1 2 3])) |
| 06:30 | clojurebot | #<int[] [I@137aefa> |
| 06:30 | janjan | and this requires a manual cast |
| 06:30 | janjan | ,(short-array (into-array [1 2 3])) |
| 06:30 | clojurebot | java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Short |
| 06:31 | LauJensen | Not strange since Clojure seems to coerce numbers to Integers, so anything taking an Int will work, anything else will need a hint or cast |
| 06:31 | janjan | I say short-array already says I want a cast to shorts, just like (short 1) |
| 06:33 | LauJensen | So you're wondering why reflection doesnt take care of this for you ? |
| 06:37 | janjan | sort of |
| 06:37 | janjan | (short 1) casts the number to a short |
| 06:37 | janjan | so why shouldn't (short-array [1 2 3]) do the same? |
| 06:38 | janjan | It's not like the vm has to protect the programmer from unwanted truncation in this case, he's explicitly asking for truncation |
| 06:39 | LauJensen | Well you see, the thing is... I dont know |
| 06:40 | LauJensen | I would expect it to cast automatically as well |
| 06:40 | janjan | guess I (or someone) should file a bug report + patch :) |
| 06:40 | janjan | but not until after my class's deadline has passed |
| 07:00 | LauJensen | Is there really no group/group-by fn in core? |
| 07:01 | LauJensen | ~source group-by |
| 07:07 | Mec_ | Is there any sort of function similar to slurp for web urls? |
| 07:07 | LauJensen | yes, slurp* |
| 07:07 | Mec_ | Is that in contrib? |
| 07:08 | LauJensen | yes sir, along side all the other I/O tricks in duck-streams I believe |
| 07:08 | LauJensen | ~source slurp* |
| 07:09 | Mec_ | Excellent, thanks |
| 07:10 | LauJensen | np |
| 07:13 | lypanov | man i luuuuurve joy of clojure |
| 07:14 | Mec_ | what's the proper way to import contrib? its all very confusing |
| 07:17 | LauJensen | (use 'clojure.contrib.duck-streams) |
| 07:17 | LauJensen | Is one way - add :only slurp*) if thats all you want to import |
| 07:18 | Mec_ | ah i was trying duck_streams |
| 07:18 | LauJensen | Yes the - vs _ is one of the more annoying facets of the JVM |
| 07:21 | jcromartie | clojure makes me happy |
| 07:23 | LauJensen | Thats nice :) |
| 07:25 | jcromartie | just sayinh |
| 07:25 | jcromartie | also it's early and I am likely to ramble |
| 07:25 | jcromartie | I might be sleep-typing |
| 07:26 | LauJensen | Clojure ought to enforce a strict sleep schedule |
| 07:26 | LauJensen | Gotta jet |
| 07:27 | Mec_ | Are there any other IDEs for clojure? emacs is all sorts of painful on windows and netbeans is a bigger install than windows :x |
| 07:27 | jcromartie | hah hah, very true... |
| 07:28 | jcromartie | I really just use Emacs and a terminal on OS X. What distribution are you using to run it on Windows? |
| 07:28 | jcromartie | Aquamacs, with increasing frequency. |
| 07:28 | Mec_ | whatever is with clojurebox |
| 07:28 | jcromartie | hmm |
| 07:28 | Mec_ | but it doesnt work right |
| 07:28 | jcromartie | what is giving you trouble? |
| 07:30 | Mec_ | I suppose mostly I just need to redo some keybindings and I'm just putting it off. also meta-. sends me to the middle of a java file instead of source |
| 07:38 | jcromartie | huh |
| 07:38 | jcromartie | so are there any guidelines on when to use (:foo x) and when to use (x :foo) ? |
| 07:39 | jcromartie | I think it's likely to be a source of confusion for others reading my code if I use both. |
| 07:44 | Mec_ | Is there a slurp for binary data? just to output straight to a file, I dont need to do anything to it |
| 07:46 | esj | lau: is the clojureql on clojars your clojureql ? |
| 07:50 | Mec_ | (doc slurp*) |
| 07:50 | clojurebot | "clojure.contrib.duck-streams/slurp*;[[f]]; Like clojure.core/slurp but opens f with reader." |
| 07:50 | Mec_ | wups |
| 07:57 | AWizzArd | Which type hint is preferrable? APersistentMap vs IPersistentMap |
| 07:58 | rhickey | AWizzArd: always Ixxx vs Axxx, i.e. the interface |
| 07:58 | AWizzArd | ok good, thanks |
| 07:58 | rhickey | Axxxs are implementation details |
| 08:02 | AWizzArd | Can deftypes have a documentation string? |
| 08:07 | ohpauleez | AWizzArd: I believe so |
| 08:08 | jcromartie | ,(doc deftype) |
| 08:08 | clojurebot | "clojure.contrib.types/deftype;[[type-tag constructor-name docstring? attr-map?] [type-tag constructor-name docstring? attr-map? constructor] [type-tag constructor-name docstring? attr-map? constructor deconstructor]]; Define a data type by a type tag (a namespace-qualified keyword) and a symbol naming the constructor function. Optionally, a constructor and a deconstructor function can be given as well, the defaults being |
| 08:08 | jcromartie | yup |
| 08:08 | jcromartie | when in doubt, doc |
| 08:15 | AWizzArd | yes, I just have an older version, and my docstring doesn't contain "docstring" |
| 08:16 | AWizzArd | Is Master now pretty much the most up-to-date branch? |
| 08:20 | ohpauleez | AWizzArd: I believe so, my master is showing a 1.2 snapshot |
| 08:20 | ohpauleez | and is "newer" than new according to the version string |
| 08:22 | cemerick | the 'new' branch is defunct, last I knew |
| 08:27 | ohpauleez | that's what i figured, thank you for the confirmation cemerick |
| 08:34 | noidi | I remember seeing a way of creating wrapper-fn:s for methods... |
| 08:45 | chouser | noidi: you may be thinking of memfn, but it doesn't really buy you anything over #(.foo %1 %2) |
| 08:46 | rhickey | we should deprecate memfn |
| 08:47 | chouser | I noticed clojure.lang.Stream is still there |
| 08:48 | noidi | chouser, yeah, and in this case I wanted to pass arguments from a seq to a constructor, so it wouldn't have helped me anyway |
| 08:50 | noidi | and (apply #(Vector3f. %1 %2 %3) vecseq) isn't that bad |
| 08:51 | rhickey | https://www.assembla.com/spaces/clojure/tickets/247-Remove-clojure-lang-Stream-Streamable-and-all-uses |
| 08:54 | chouser | It's a shame we haven't thought of a way to let the compiler do that for us that still allows for hinting if needed. |
| 08:54 | chouser | Hmmm.. maybe ^{tags: int nil String} Vector3f. |
| 08:54 | chouser | er |
| 08:55 | chouser | ^{:tags int nil String} Vector3f. |
| 08:55 | chouser | ^[int nil String] Vector3f. |
| 08:56 | rhickey | that's interesting |
| 08:56 | rhickey | I wonder if sometimes people wouldn't want overloading to work, i.e. when mapping over heterogeneous types |
| 08:57 | rhickey | vs nailing it down with a hint |
| 08:57 | rhickey | no class name? |
| 08:58 | chouser | sure, just like regular unhinted dynamic calls now, right? |
| 08:58 | dabd | How should I name the following function http://paste.lisp.org/+20AC? 'match' or 'match?' If x is a collection it returns a string or nil, but if x is a string it returns a value. What are the Clojure conventions? |
| 08:58 | dabd | |
| 08:58 | chouser | rare but occasionally useful. |
| 08:58 | dabd | sorry I meant to say when x is a string returns a *boolean* value |
| 08:58 | rhickey | MyClass/itsMethod |
| 08:59 | chouser | dabd: usually a ? means only true or false (or maybe nil) is ever returned. |
| 08:59 | AWizzArd | jcromartie: the (doc deftype) you did showed the doc for _contribs_ deftype, not for clojure.core/deftype |
| 08:59 | jcromartie | oh, foo |
| 08:59 | jcromartie | what the heck? |
| 09:00 | chouser | rhickey: I don't understand. You're not suggesting MyClass/itsMethod sometimes refer to an instance method, are you? |
| 09:00 | dabd | chouser: thx |
| 09:00 | AWizzArd | When I do (doc deftype) in 1.2 it still does not mention how a docstring can be added. |
| 09:00 | rhickey | (map aMethod ...) requires finding the method in all visible classes. We don't trudge around through classes like that up to this point |
| 09:01 | rhickey | AClass/aMethod tells us it's a class member |
| 09:01 | rhickey | lookup will tell us it's a method |
| 09:01 | rhickey | not inconflict with AClass/aStatic, just using a class as a namespace, as Java does |
| 09:02 | chouser | you don't want (map .aMethod ...) to just generate a fn like (fn ([] (.aMethod)) ([a1] (.aMethod a1)) ([a1 a2] (.aMethod a1 a2)) ...) ? |
| 09:02 | chouser | then no trudging |
| 09:02 | rhickey | only conflict is Java allows overloading of fields/methods/instance/static |
| 09:03 | rhickey | chouser: that fn would use reflection, no? |
| 09:03 | rhickey | no known target type |
| 09:03 | chouser | yeah, maybe not ambigious to anything that knows the class well, but more ambiguous that Foo/bar is today for human readers |
| 09:04 | chouser | yes, reflection, unless they hint with ^[Foo], then you get (fn ... [^Foo a1, a2, a3] (.aMethod a1 a2 a3)) |
| 09:05 | rhickey | chouser: then people will always be supplying at least the first hint (hints target) |
| 09:05 | rhickey | and confucing I think to have vector of target and arg type hints combined |
| 09:06 | chouser | the target and args themselves are combined already |
| 09:06 | rhickey | (map String/toUpper ["a" "b" "c"]) (map #^[String] .toUpper ["a" "b" "c"]) |
| 09:06 | rhickey | chouser: not combined in the signature of the method, nor the docs |
| 09:07 | chouser | Hm. |
| 09:07 | chouser | String/.toUpper ? |
| 09:07 | chouser | heh |
| 09:08 | rhickey | I much prefer class as namespace, just need rules for (public) static trumps field trump method |
| 09:08 | chouser | ok |
| 09:10 | chouser | I guess Foo/mem without parens today can only mean a static field, which is not so likely to be confused with an instance member usage. |
| 09:11 | chouser | you're ok with #^[A B C] for hinting args? No way to hint the return value, but that shouldn't be needed if the args are fully hinted. |
| 09:12 | chouser | hm, and rarely useful in a HOF context anyway |
| 09:12 | rhickey | thinking about it, people would expect the same hint to work on .method calls, no? |
| 09:13 | chouser | #^[BigInteger] (.max #^BigInteger a b) ? goofy |
| 09:13 | chouser | #^[BigInteger] (BigInteger/max a b) ? |
| 09:13 | rhickey | what does that mean? |
| 09:14 | chouser | today you'd say (.max #^BigInteger a #^BigInteger b) |
| 09:16 | rhickey | (.BigInteger/max a b) |
| 09:16 | rhickey | BigInteger/max is not overloaded |
| 09:21 | chouser | hm! .BigInteger/max isn't bad |
| 09:22 | chouser | could use that for the un-paren as well. (map .BigInteger/max aseq bseq) |
| 09:22 | rhickey | yes |
| 09:23 | rhickey | and Classname. for ctor |
| 09:23 | AWizzArd | rhickey: is it possible to attach a docstring to deftypes, so that for example (deftype foo [a b c]), (doc foo) ==> prints the doc string |
| 09:23 | chouser | ah, right -- no target to hint there |
| 09:24 | rhickey | (map #^[String] BigInteger. ["1" "2"]) |
| 09:25 | chouser | perfect |
| 09:25 | cemerick | maybe I don't have the backstory, but how is that better than (map #(BigInteger. #^String %) ["1" "2"]) ? |
| 09:25 | chouser | just less ugly |
| 09:26 | chouser | and means that the common case looks like: |
| 09:26 | chouser | (map BigInteger. ["1" "2"]) |
| 09:26 | rhickey | that's reflective |
| 09:26 | rhickey | since single arg ctor is overloaded |
| 09:27 | chouser | instead of (map #(BigInteger. %) ["1" "2"]) |
| 09:27 | chouser | right |
| 09:27 | rhickey | I'm more interested in getting rid of reflection than more sugar |
| 09:28 | chouser | I go with whatever it takes to sell it to you. :-) |
| 09:28 | rhickey | well, in this case it's a demerit, as yet another way to easily write something slow |
| 09:29 | cemerick | lifting something like BigInteger. to a fn when it's not in function position is a little creepy on first blush |
| 09:29 | chouser | no slower than (map #(BigInteger. %) ["1" "2"]) |
| 09:29 | rhickey | cemerick: people definitely have that expectation, esp for instance methods, and rightly so |
| 09:29 | chouser | and just as natural to add a hint to the slow version |
| 09:29 | cemerick | really? |
| 09:30 | chouser | cemerick: yep, it comes up pretty often here |
| 09:30 | cemerick | e.g. (map .toString [1 2 3])? |
| 09:30 | rhickey | chouser: right, but another way, and one that remove the onus of thinking about the args |
| 09:30 | rhickey | absolutely |
| 09:30 | chouser | cemerick: exactly |
| 09:30 | AWizzArd | Will there be a way to describe complex types, such as "this is a vector of strings"? |
| 09:30 | rhickey | AWizzArd: no |
| 09:32 | cemerick | so (still getting my bearings) #^[String List] hints the args to the fn wrapping a named ctor or method following it? |
| 09:32 | stuartsierra | AWizzArd: you can add :doc metadata to the Var holding the type. |
| 09:32 | stuartsierra | e.g. (deftype #^{:doc "My type"} MyType [a b c]) |
| 09:33 | chouser | cemerick: that's the suggestion |
| 09:33 | dabd | I'm writing a mixed Java/Clojure application and I need to define some constants to be used on both sides. Would you rather define them as static string fields in a, say, Constants Java class or in a properties file? |
| 09:34 | chouser | cemerick: the goal (for me) being a mechanism that allows you to start with something that allows HOF use of a method, and yet has a way to "tack on" hints as needed |
| 09:34 | AWizzArd | stuartsierra: ok |
| 09:36 | stuartsierra | dabd: Won't make too much difference. Depends on whether you care about recompiling the .java file when the constants change. |
| 09:37 | rhickey | I guess this could just participate in *warn-on-reflection* |
| 09:37 | chouser | oh, I would hope so. |
| 09:41 | chouser | yeah. postpone this. |
| 09:41 | chouser | what do we need -- volatile? |
| 09:41 | cemerick | chouser: but methods aren't functions, and I think it muddies the waters for them to so transparently be interchangeable |
| 09:41 | rhickey | so, how about deftype and protocol-based compiler! |
| 09:42 | chouser | oh, right -- compiler doesn't need volatile |
| 09:42 | cemerick | rhickey: yeah, I figured that would be your #1 priority |
| 09:42 | rhickey | would be excellent a la carte project to test detype/protocols. |
| 09:42 | chouser | I started poking at a tool to convert Compiler$FooExpr trees to maps of vectors |
| 09:43 | AWizzArd | yes, that would be an energetic project |
| 09:43 | chouser | just a couple days ago. There's a bit more to do there, but that would help provide a basis for regression tests of a new compiler |
| 09:44 | dabd | stuartsierra: I will use Java code since I have the flexibility to define more complex constants (Arrays, etc) if I need to. |
| 09:46 | rhickey | at least we now have the (newnew) compiler we need to port |
| 09:46 | stuartsierra | rhickey: I thought newnew became reify |
| 09:47 | rhickey | stuartsierra: yes, just using the codename |
| 09:47 | chouser | rhickey: you'd want deftypes instead of plain maps for Expr objects? |
| 09:47 | rhickey | chouser: yes, and protocols for the interfaces |
| 09:48 | rhickey | deftypes mostly for the easy of inline protocol definition |
| 09:48 | chouser | hm. ok. |
| 09:48 | rhickey | why hm? |
| 09:49 | chouser | You want 'emit' inlined in the deftypes? I guess I was hoping for some lexical separation there. |
| 09:49 | rhickey | chouser: needn't be, but without deftype you have no choice |
| 09:50 | chouser | but I guess as long as I can extend my own emitJS or whatever, I don't need JVM bytecode to be lexically separated. |
| 09:50 | chouser | well, I had multimethods. But yes, I'm not arguing against deftype at all. |
| 09:50 | rhickey | a critical thing about deftype is you can't write code that depends on the type any more than it would on a map |
| 09:51 | rhickey | I anticipate emit will be split out. A big goal here is an intermediate AST coming out of analysis |
| 09:51 | chouser | right! users use the same syntax that 'extend' can hook. |
| 09:52 | rhickey | a deftype only defines fields/attributes, everything else is in the protocols |
| 09:52 | chouser | right, so I thought a conversion tool might help define that intermediate AST and allow porting of analysis and emit to happen independently, while being able to check for regression against the current version. |
| 09:53 | rhickey | It was a big part of deftype design that code consuming deftypes be no more rigid than that consuming maps |
| 09:53 | chouser | I guess I keep mentioning it because I'm hoping that if you think it's a waste of time you'll tell me. |
| 09:53 | rhickey | chouser: that may not be possible, to the extend we want to improve things in the new design |
| 09:54 | rhickey | e.g. no dynamic vars |
| 09:54 | rhickey | more host independence |
| 09:55 | chouser | well, this tool would run after the current analysis is complete, so could capture in persistent structs (deftype, whatever) the final value of dynamic vars. |
| 09:55 | chouser | I guess it does assume though that first pass of the ports don't actually change the semantics at all. |
| 09:56 | rhickey | yeah, and whe it does, then what? like regression tests that need to change when the behavior spec changes |
| 09:56 | rhickey | lemme start a wiki page for brainstorming on the compiler |
| 09:57 | chouser | if first pass changes semantics, then yes this tool would be of limited usefulness, esp if the new analysis is producing data that can't be computed from values produced by the old analysis. |
| 10:01 | rhickey | aarg I wish the assembla wiki did tab/shift-tab indent/outdent on lists |
| 10:01 | chouser | what web browser do you use? |
| 10:02 | chouser | eh, nm |
| 10:02 | rhickey | safari, but this embedded in Fluid, so opera engine I think |
| 10:03 | cemerick | assembla has a variety of UI issues, IMO |
| 10:03 | rhickey | seriously this is the number one thing I need - a decent web outliner |
| 10:04 | chouser | I use itsalltext plugin for firefox so I can edit web forms in my favorite text editor, but it doesn't work on rich-text fields like this |
| 10:04 | cemerick | rhickey: if you're willing to step outside assembla for wikis, I'm sure the atlassian guys would be happy to host a confluence instance for you. |
| 10:05 | cemerick | Their wiki editor is stellar. |
| 10:05 | rhickey | cemerick: I'm not sure confluence wiki is better |
| 10:05 | rhickey | cemerick: I disagree |
| 10:05 | cemerick | rhickey: compared to assemblas? |
| 10:05 | cemerick | it's the best I've ever used *shrug* |
| 10:05 | rhickey | I've used it and had many list problems |
| 10:06 | rhickey | wikispaces is excellent |
| 10:06 | rhickey | google docs does this aspect better |
| 10:06 | cemerick | v3.0 came with a brand-new wiki editor, perhaps you eval'ed 2.x |
| 10:06 | rhickey | cemerick: when was v3? |
| 10:06 | cemerick | I want to say September-ish? |
| 10:07 | rhickey | yes, definitely was before that |
| 10:07 | fogus | That sounds right |
| 10:07 | cemerick | Looks like June, 2009 |
| 10:08 | rhickey | well, if someone wants to research it... |
| 10:08 | cemerick | it's quite remarkable -- drag and drop of images into the editor, great fullscreen mode, nice table editing |
| 10:09 | stuartsierra | That's all we need, a 6th web site. |
| 10:09 | cemerick | rhickey: what, getting a instance set up, or a comparison of it to X? |
| 10:09 | rhickey | stuartsierra: 6th? |
| 10:09 | rhickey | I'd be totally happy if one free provider handled everything we need. I just don't see it |
| 10:09 | AWizzArd | Only some days ago I discovered Project Kenai. This is something like github, BitBucket or Google code. It offers Mercurial, git and subversion repositories, a wiki, issue tracking (BugZilla or even Jira!), a forum, and so on. It's a Sun Microsystems website. http://www.kenai.com/ |
| 10:09 | stuartsierra | 1) clojure.org, 2) g. groups, 3) github, 4) google code, 5) assembla |
| 10:10 | cemerick | well, 4 is defunct |
| 10:10 | stuartsierra | No, 4 is the only place to download pre-packaged binaries. |
| 10:10 | rhickey | stuartsierra: I guess the idea would be atlassian would replace assembla |
| 10:10 | AWizzArd | Atlassian works together with Kenai, by offering Jira. |
| 10:10 | rhickey | if github counted downloads I'd move them from google code to there |
| 10:11 | cemerick | rhickey: I have no idea what their github integration is like, FYI |
| 10:11 | rhickey | kenai always seems terribly slow when I looked at it |
| 10:11 | cemerick | I was only proposing them for confluence |
| 10:11 | AWizzArd | Kenai still is not very fast, true. |
| 10:12 | cemerick | kenai makes me sad every time I go there. Reminds me of sourceforge. |
| 10:12 | rhickey | yes |
| 10:12 | AWizzArd | Design is not the best, and there are faster sites, but it is more complete than anything else, and Jira alone makes it more interesting than the competition. |
| 10:12 | stuartsierra | What none of these services allow you to do is "frame" their services under your own domain. |
| 10:13 | AWizzArd | yes, not so nice.. only googles Blogger can do that |
| 10:13 | stuartsierra | Really, all things Clojure should be under clojure.org. |
| 10:13 | AWizzArd | yes, that would be best |
| 10:13 | stuartsierra | But the only way to do that now is to host everything yourself. I've been there, it's a burden. |
| 10:13 | AWizzArd | jira.clojure.org, blog.c.o, code.c.o, and so on |
| 10:14 | stuartsierra | Even hosting a public git repository is surprisingly hard, and it can't match github for end-user convenience. |
| 10:14 | rhickey | stuartsierra: what difference does "under" make? links that go to other domains don't matter much, do they? |
| 10:14 | AWizzArd | would be one+ week of work to get everything up |
| 10:14 | stuartsierra | rhickey: Yes, I think they do. It's a matter of branding. |
| 10:14 | rhickey | I guess unified menu |
| 10:15 | stuartsierra | And entry-points. |
| 10:15 | stuartsierra | If someone lands on the Google Code page, they think that's the "official" project page. Same for github or assembla. |
| 10:15 | stuartsierra | You can explain it to people over and over, but they'll still get it wrong. |
| 10:15 | stuartsierra | Heck, I can barely remember it. |
| 10:15 | AWizzArd | The blog could stay at google and just be available under blog.clojure.org |
| 10:15 | rhickey | well, github and assembla are providing a lot |
| 10:16 | rhickey | gc not so much |
| 10:16 | stuartsierra | Yes, they are. So it's hard to move away from them. |
| 10:16 | rhickey | ggroups, a ton |
| 10:16 | AWizzArd | Jira is free for open source, and many other Atlassian products as well |
| 10:16 | fogus | Atlassian has hosting services that could host most of the services under a common clojure.org hostname. Cost might be an issue |
| 10:16 | rhickey | AWizzArd: self-hosting is a huge deal |
| 10:17 | AWizzArd | yes, I know.. I am in the process of starting my Clojure DB project and go through exactly those issues right now |
| 10:17 | stuartsierra | I just wish the services offered a *.yourdomain.com hosting option. |
| 10:17 | rhickey | also, the github phenomenon shows it's not just the tool, but the sense of place |
| 10:17 | chouser | ggroups scares me. spam is managable right now, but it sounds like all spammers would have to do is try and they could crush us. |
| 10:17 | stuartsierra | Right, having a presence on github is important. Less so for Google Code, but still valuable. |
| 10:17 | rhickey | chouser: I;ve seen indications google is now trying to preemptively filter spam for ggroups rather than relying only on moderators |
| 10:18 | AWizzArd | github and bitbucket can always have the most recent versions of the code available |
| 10:18 | chouser | oh good. Maybe they'll fix it before the clever spammers decide to target us |
| 10:18 | AWizzArd | but it would be nicer if clojure.org would be the host of everything clojure related |
| 10:19 | stuartsierra | I don't think there's a better solution right now. I just wish there were. |
| 10:20 | rhickey | I don't see any solution being less than 3 parts - ggroups/github/assembla or their counterparts. Wikispaces could be folded in if one of them had a decent wiki and we could park domain. |
| 10:20 | AWizzArd | although.. does github allow to set your own cname? |
| 10:21 | cemerick | rhickey: I just shot an email off to atlassian. We'll see what they come up with. |
| 10:21 | liebke | AWizzArd: yes |
| 10:21 | rhickey | oh, and now build.clojure.org too |
| 10:22 | rhickey | hudson hosting a whole other can of worms |
| 10:22 | stuartsierra | yes |
| 10:22 | cemerick | rhickey: In the meantime, if you're so inclined, you can run a trial instance and see how it works for you: http://www.atlassian.com/studio/ |
| 10:22 | AWizzArd | Well, those Atlassian products are really damn good |
| 10:22 | stuartsierra | Found the old Sourceforge page, still points to Google Code as "current development" |
| 10:23 | cemerick | that really should just get folded |
| 10:26 | AWizzArd | :-) |
| 10:27 | AWizzArd | If we would setup everything ourselves then Jira, Confluence and other Apps would be free. Code could stay at github and just set the cname to something like code.clojure.org. |
| 10:27 | stuartsierra | AWizzArd: That's a lot of work. |
| 10:29 | cemerick | hosting a full stack like that would likely require a dedicated corporate sponsor, something beyond just a contribution of funds. |
| 10:30 | AWizzArd | 50 Euro per month for a dedicated Core i7 quad core system with 8gb ram and 2x750 gb HD (raid 1) |
| 10:30 | AWizzArd | goes with 100 mbit online |
| 10:31 | cemerick | the hardware is nothing. Who's going to manage it? |
| 10:31 | jkdufair | dreamhost.com has free hosting for non-profits, fwiw |
| 10:31 | cemerick | ugh |
| 10:32 | AWizzArd | I don't know if there will be so very much managing needed. |
| 10:32 | jkdufair | crappy? |
| 10:33 | cemerick | jkdufair: yes, but that's not the point -- until someone is willing/able to commit to being the clojure IT admin, this is all moot. |
| 10:33 | AWizzArd | With the repository still sitting at github+cname and the blog sitting at blogger+cname and probably the same for emails too it won't be soo much. |
| 10:36 | AWizzArd | if git, the blog and email won't be required, then I think jira and confluence could be installed and fine tuned within 3 days |
| 10:37 | chouser | installation is only the beginning of the pain. |
| 10:38 | chouser | every time they find a security bug in some piece of included PHP, you must upgrade immediately |
| 10:38 | AWizzArd | which part would be running with php? |
| 10:38 | cemerick | chouser: actually, the nice thing about the atlassian stack is it's java, so the security issues are functionally nil. |
| 10:38 | AWizzArd | right |
| 10:39 | chouser | hm, so you're saying there are better web app products out there than wordpress? |
| 10:39 | AWizzArd | Confluence is not so bad |
| 10:39 | cemerick | but that's besides the point -- self-hosting isn't really an option without a dedicated corporate "parent" |
| 10:39 | cemerick | chouser: well done, sir ;-) |
| 10:40 | chouser | heh |
| 10:41 | cemerick | I got owned so many times while running WP, I lost count. |
| 10:41 | chouser | didn't know any better. |
| 10:41 | chouser | what I really want to do is spend my time writing a *good* blogging platform. |
| 10:42 | cemerick | chouser: I moved my blog over to confluence last fall. I've got, like, 20 extra hours a week now. |
| 10:42 | chouser | sorry, too much sarcasm. will try to stop talking now. |
| 10:42 | AWizzArd | chouser: you can use Google Blogger and set the cname to your own domain. |
| 10:43 | AWizzArd | And well, if you have your own machine you can get Confluence for free: http://www.atlassian.com/software/confluence/ |
| 10:43 | AWizzArd | free for open source projects |
| 10:43 | cemerick | or $10 for < 10 users, IIRC |
| 10:45 | AWizzArd | cemerick: this is for commercial use |
| 10:45 | cemerick | yup |
| 10:45 | cemerick | it's the setup we have |
| 10:45 | AWizzArd | same here :-) |
| 10:45 | chouser | I'm not sure if I'm an open source project or not. |
| 10:45 | chouser | seems a bit unlikely, really. |
| 10:46 | AWizzArd | chouser: visit http://www.blogger.com/signup.g and setup your cname and have your professional blog under blog.example.com |
| 10:46 | chouser | we used blogger before. We didn't like it, though I don't remember why. |
| 10:48 | AWizzArd | Anyway, when github supports cname entries then it seems trivial to get http://git.clojure.org/ ready. |
| 10:50 | AWizzArd | and when we get a server then jira.clojure.org can be done within one day + a few days fine tuning, same for wiki.clojure.org |
| 10:50 | AWizzArd | And this does not seem to require very much administration |
| 10:50 | fogus | If atlassian turns out to be useable, then confluence does have a news feature that can be used for blogging |
| 10:52 | AWizzArd | the blog can go to http://blog.clojure.org/ today if rhickey sets this up in his domain account |
| 10:52 | AWizzArd | And people who visit http://clojure.blogspot.com/ will automatically be forwarded to blog.clojure.org |
| 10:55 | cemerick | fogus: that's what I use for my blog |
| 10:56 | cemerick | the biggest issue with JIRA studio will be the git/github integration -- that is, it doesn't exist (yet) |
| 10:56 | AWizzArd | Can you please say more about this? |
| 10:57 | cemerick | fisheye and crucible got git support about a month ago, and I'm sure studio/github integration is in the works |
| 10:57 | fogus | cemerick:Yeah, we use it on my project too. It's not fully-featured like most blog platforms, but it's good enough for the types of posts coming out of clojure.blogspot |
| 10:57 | cemerick | my biggest issue with confluence is the handling of drafts, but that's a minor issue overall |
| 10:57 | AWizzArd | Though blogspot is not bad. And Rich could move it today to clojure.org if he wishes. |
| 10:58 | defn | cool - autodoc has come to fruition |
| 10:59 | lypanov | fogus: fogus from joy of? |
| 10:59 | fogus | lypanov: One and the same. |
| 11:00 | lypanov | fogus: man, the book rocks. |
| 11:00 | defn | fogus -- your website is awesome |
| 11:03 | defn | the console mode is really cool |
| 11:03 | fogus | lypanov: Thanks! Although it would rock very much less-so without chouser |
| 11:04 | fogus | defn: That is a funny little thing. The code is available on the githubs if you want it. :-) |
| 11:04 | lypanov | fogus: already told chouser it rocked :D |
| 11:05 | lypanov | still had to tell you though |
| 11:05 | defn | fogus: i would enjoy that very much :) |
| 11:07 | fogus | defn: It runs only on Wordpress though |
| 11:07 | defn | fogus: cli2 is it? |
| 11:07 | fogus | yes |
| 11:07 | chouser | huh, never tried blog.fogus.me in console mode ...doesn't seem to do anything here. |
| 11:07 | defn | fogus: *shrug* -- i think it's cool as hell |
| 11:08 | chouser | ah! hehe |
| 11:08 | fogus | chouser: It's horribly out of date, so browser compatibility is sketchy |
| 11:08 | defn | chouser: it even makes you hit [space] for MORE in long listings |
| 11:09 | defn | although im hung on ls /dev right now |
| 11:09 | defn | I tried C-c already, heh |
| 11:09 | fogus | defn: which is why it's not my main mode. :-( There are .... some issues |
| 11:11 | defn | fogus: any word on when the next few chapters go up on MEAP? |
| 11:12 | LauJensen | fogus - Never seen that console page before, but I entered 'ls' and its been hanging ever since |
| 11:13 | defn | LauJensen: heh, same thing happened to me |
| 11:15 | jkdufair | wow. console mode is badass. written in clojure? |
| 11:15 | jkdufair | help |
| 11:15 | chouser | heh |
| 11:15 | jkdufair | help |
| 11:16 | fogus | :-( Oh well, it used to work properly. I should disable that link until I can get things fixed. |
| 11:16 | jkdufair | oh weird focus thing |
| 11:16 | jkdufair | sory |
| 11:16 | fogus | Nah not written in Clojure. Javascript mostly |
| 11:16 | defn | fogus: i think it's great regardless, it's worth leaving it up |
| 11:16 | defn | no one seemed to notice it but me anyway :) |
| 11:17 | defn | i think i personally broke your console mode |
| 11:17 | defn | i hit ls, ls, read the output, typed ls /dev, hung, then i type ls again, and it hangs again |
| 11:18 | fogus | defn: You can get back to the regular mode with startx |
| 11:18 | defn | lol yes, i figured that out earlier, i thought that was great |
| 11:18 | defn | also enjoyed `hello`'s output |
| 11:23 | angerman | Note: When using postgresql and big tables, do _not_ randomly query the tables, try to organize your querys by table. |
| 11:25 | angerman | painful lessen |
| 11:32 | jasapp_ | angerman: why? |
| 11:33 | angerman | jasapp_: querying two different tables in a random fashon will result in lots of random IO. |
| 11:34 | angerman | as the big tables are usually accompanied with larger indices, the indices cache seems to be cleared to make room for the index on the other table. |
| 11:35 | angerman | and if your having slow random IO (a SSD might help here a little) it's painful. |
| 11:35 | cemerick | angerman: surely that's a configuration/deployment issue |
| 11:35 | angerman | cemerick: sure it is, i never pretended it wasn't. |
| 11:36 | cemerick | angerman: ok, just checking :-) |
| 11:36 | cemerick | I know ø about postgres |
| 11:36 | angerman | cemerick: but there are natural contrains, which for me is right now my macbook |
| 11:36 | defn | polyglot can mean someone who knows more than one language, or programs which are valid in more than one language |
| 11:36 | defn | interesting |
| 11:37 | defn | i also didn't know 'pidgin' was a real word. |
| 11:38 | angerman | defn: what's your native language_ |
| 11:38 | angerman | pidgin used to be a word my english teacher used to tease us with. |
| 11:38 | defn | angerman: my native lang. is English. Am I writing that poorly? lol |
| 11:39 | angerman | defn: (blush) erm, no, was just checking givin' the pidgin line. |
| 11:39 | defn | Ah I see |
| 11:52 | lypanov | pidgins are teh best. |
| 11:53 | lypanov | angerman: not all people are language geeks :P |
| 11:54 | defn | i consider myself something of a language geek, but never had seen pidgin outside of the IM client |
| 11:54 | lypanov | hehe |
| 11:54 | lypanov | nat lang con lang or prog lang? |
| 11:54 | chouser | we are talking about the bird, right? |
| 11:55 | lypanov | chouser: no. |
| 11:55 | defn | nat/prog |
| 11:55 | defn | ive been studying a little chinese (mandarin) |
| 11:55 | defn | clojure for breakfast, java for dinner (for interop purposes only ;) |
| 11:56 | chouser | oh, like Pidgin English. |
| 11:56 | lypanov | aka, english. |
| 11:56 | lypanov | :)) |
| 11:56 | chouser | I hadn't picked up on the difference in spelling |
| 11:56 | defn | there are a few different takes on pidgin |
| 11:57 | chouser | I heard some Pidgin English as a kid and hadn't thought to look into spelling differences of the word. |
| 11:57 | defn | what is pidgin english? |
| 11:57 | chouser | yay I learned something today. |
| 11:57 | defn | like a simplified english? |
| 11:57 | defn | A pidgin is a simplified language. Pidgins usually develop because two groups of people need to talk to each other but do not speak the same language.[1][2] Pidgins are not usually as complicated as many other languages.[3] |
| 11:57 | fogus | i thought we were talking about the chat client. :-( |
| 11:58 | defn | fogus: you started this whole mess |
| 11:58 | defn | i looked up polyglot and then got to pidgin |
| 11:58 | defn | due to your repo name |
| 11:58 | lypanov | (and its *all* LauJensen's fault) |
| 11:58 | chouser | lypanov: ha |
| 11:58 | lypanov | well, and mr hickey for being smart and stuff. |
| 11:58 | cemerick | I can *never* remember that keys in an :or map are bare symbols. |
| 11:59 | defn | I can't quit seeing *splats* as globals |
| 11:59 | defn | that's not the correct terminology is it? |
| 12:00 | lypanov | deconblabla |
| 12:00 | chouser | they're as global as anything gets in clojure |
| 12:00 | chouser | I like *earmuffs* |
| 12:00 | defn | oh right |
| 12:00 | defn | what about (def OMG 4) |
| 12:00 | defn | is that equiv to ,*earmuffs*, |
| 12:01 | chouser | earmuffs usually indicate you're expected to using 'binding' on it |
| 12:02 | defn | so they behave differently, or is it just idiomatic? |
| 12:02 | chouser | just a naming convention |
| 12:02 | defn | ah ok |
| 12:03 | defn | chouser: any word on Ch.5->* for JoC? |
| 12:04 | chouser | defn: the next chapter is written but has a lot of editing in its future before it hits MEAP. |
| 12:05 | chouser | chapters 1-4 are getting shrunk to 3 chapters and may contain some new material, but that needs editing before MEAP too. |
| 12:07 | defn | chouser: want help editing? ;) |
| 12:07 | cemerick | I'll bet there's an interesting backstory as to why manning has two clojure books in process. |
| 12:08 | defn | the first one has a lot of negative comments |
| 12:09 | chouser | defn: thanks but Manning has someone they trust for that. :-) |
| 12:09 | technomancy | defn: it struck me as pretty sloppy at points. maybe just needs a good scrubbing by a knowledgeable technical editor |
| 12:10 | defn | technomancy: i hadnt heard about it until I saw JoC on ycombinator |
| 12:10 | fogus | cemerick: You're likely correct |
| 12:10 | defn | I read the reviews and the first chapter and wasn't impressed, but you might be right |
| 12:10 | cemerick | fogus: says one of the few people who probably knows ;-) |
| 12:11 | fogus | cemerick: If you're ever in the DC area I'll buy you a drink and tell you the story... ok, maybe a few drinks |
| 12:11 | defn | ok gents -- off I go. have fn. |
| 12:13 | ohpauleez | has there been any talk to do some sort of Clojure conference this year |
| 12:13 | ohpauleez | however small or independent it may be |
| 12:13 | technomancy | yeah, only we'd call it a conj instead of a conf |
| 12:13 | ohpauleez | haha |
| 12:13 | ohpauleez | zing |
| 12:13 | Ash | my other car is a cdr |
| 12:14 | ohpauleez | awesome |
| 12:14 | rhickey | https://www.assembla.com/wiki/show/clojure/Clojure_Compiler_in_Clojure |
| 12:14 | technomancy | seriously though, after ICFP we might try to put something together |
| 12:15 | ohpauleez | that sounds good to me, I'd be down for helping out or trying to solicit some funds for it |
| 12:18 | AWizzArd | rhickey: thanks for setting this up, it seems like interesting times are coming, again |
| 12:18 | ohpauleez | I'm totally pumped for cinc |
| 12:20 | chouser | me too! |
| 12:20 | chouser | perhaps irrationally so, but there it is. |
| 12:20 | dabd | I have some multimethods that update a map passed to them via an atom. Is there a functional way to do this? I was looking at the accumulators from clojure-conntrib but I don't understand if they can be used for this purpose. |
| 12:21 | chouser | dabd: can they not return an updated map? |
| 12:21 | rhickey | chouser: I don't want to call this cinc, as that is a more ambitious idea (replacing Java). This is a first step, replacing the compiler with one written in Clojure |
| 12:22 | LauJensen | lypanov: Please send me an email once you have a good grasp of Arch and are comfortable in your new shiny IDE, then I'll remove you from the /ignore list :D |
| 12:22 | rhickey | full cinc requires a lot of thinking about bootstrapping that I have not yet done |
| 12:22 | chouser | sure. still exciting to me. still not entirely sure why. :-) |
| 12:22 | rhickey | it is exciting, this alone will ease other targets, get more people involved in things that require compiler enhancements, broadedn the understanding of the compiler, enable tools etc |
| 12:23 | technomancy | it will get us out of this "nobody wants to work on a compiler that's going away" slump too, which is important. |
| 12:23 | LauJensen | rhickey: How is this connected with compiler speeds/optimizations? |
| 12:23 | rhickey | LauJensen: who said it was? |
| 12:24 | AWizzArd | When it is written in Clojure, will it be called Compilejure then? ;) |
| 12:24 | LauJensen | Nobody - But I have some hopes that the compiler will be speedier in the future, so Im just curious |
| 12:25 | Chousuke | LauJensen: probably through what technomancy said |
| 12:26 | ohpauleez | If people feel compelled, I'm sure they could take pieces of the work done in PyPy and attempt to move it cinc. The goals and architectures are different, but some ideas translate |
| 12:27 | rhickey | technomancy: was that really happening? I thought it was more of - nobody wants to write Java/nobody understands Rich's Java :) |
| 12:28 | technomancy | rhickey: maybe I've been using it as an excuse to cover up the fact that I'm not man enough to dive in and get my hands dirty. =) |
| 12:28 | LauJensen | rhickey: any approximation of how many hours you put into it? |
| 12:29 | AWizzArd | rhickey: true, and your experience will be extremly important for that transition. But it's the destiny of most software to undergo an evolution. |
| 12:30 | rhickey | AWizzArd: I have no problem with that |
| 12:35 | fogus | At the first DC clojure group there were many who were adamantly against cinc I was not able to pull the precise reasons out of them. |
| 12:36 | hiredman | huh |
| 12:36 | dabd | chouser: the caller of the multimethods needs to resulting updated map |
| 12:36 | fogus | ... besides "fragmentation" "big mistake" |
| 12:36 | ohpauleez | fogus: I'd like to hear them, I can't think of any |
| 12:36 | hiredman | fragmentation? |
| 12:36 | hiredman | like cinc as a fork? |
| 12:36 | rhickey | fogus: as if cinc was just about different target hosts? |
| 12:38 | fogus | rhickey: Granted, it was only a few who voiced those views, but yes, I gathered that they felt it was limited to targeting hosts |
| 12:38 | fogus | And I did a poor job of convincing them otherwise I suppose |
| 12:40 | dabd | chouser: http://paste.lisp.org/+20AN I'm passing not the atom explicitly but a closure that updates the map 'vals-fn'. Is there a better way to do this? |
| 12:40 | fogus | hiredman: yes. forking |
| 12:43 | rhickey | In many ways, the idea of cinc alone has already accomplished the biggest result possible. By working through the question "what facilities did I need to write Clojure, and to support its abstractions, and are they present in Clojure itself?", we are adding those features, and all future Clojure programs will benefit. |
| 12:45 | fogus | rhickey: The consensus among the detractors tended toward a view that introp and multiple platforms are XOR |
| 12:45 | rhickey | there are many steps short of fully bootstrapped cinc that are interesting and useful - the compiler written in Clojure itself, moving the abstractions to protocols, new data structures written in Clojure |
| 12:45 | rhickey | fogus: that is absolutely true, and as designed |
| 12:46 | rhickey | people presume that targeting multiple hosts implies full portability between hosts - that was never true nor an objective |
| 12:46 | LauJensen | rhickey: How much do you see going into a bootstrap at present? |
| 12:47 | fogus | rhickey: Understood. My only point is that it was viewed as a downside. Try as I might, I was unable to convince them otherwise. |
| 12:47 | rhickey | (rather, attempting full portability) |
| 12:47 | Chousuke | Once you have all the abstractions that Clojure needs to describe itself, it should become feasible to have a subset of "pure" Clojure that is usable and independent of any host interop, though. |
| 12:48 | rhickey | Chousuke: certainly, and a good sized one |
| 12:48 | hiredman | fib programs will be cross platform |
| 12:48 | hiredman | :P |
| 12:48 | rhickey | as a consultant targeting Java and .Net, it is really nice not to have to switch languages, even though you might switch frameworks |
| 12:49 | rhickey | just as you might switch frameworks in an all-Java shop |
| 12:49 | Chousuke | Exceptions are one thing that are still rather tied to the JVM, but you could use port error-kit to different hosts I guess :P |
| 12:49 | Chousuke | -use |
| 12:50 | rhickey | Most hosts have exceptions |
| 12:51 | Raynes | (()) |
| 12:51 | rhickey | hiredman: ah, fib |
| 13:06 | Raynes | Why is Clojure so awesome? |
| 13:07 | the-kenny | Because it's a lisp |
| 13:07 | the-kenny | :) |
| 13:08 | Raynes | Because rhickey is the creator. |
| 13:08 | Raynes | And he isn't a mindless Lisp purist. |
| 13:10 | LauJensen | Raynes: I think thats an oxymoron |
| 13:11 | Raynes | LauJensen: How would I go about forcefully deleting an unmatched parenthesis in paredit? :> |
| 13:11 | LauJensen | C-x q IIRC |
| 13:11 | LauJensen | But you might have to ask one of the guys who actually use it |
| 13:11 | LauJensen | I found it horribly annoying |
| 13:11 | Raynes | LauJensen: I can highlight + backspace to delete it, but that is annoying. |
| 13:12 | Raynes | It's C-q you were thinking of, but that doesn't work with deletions it seems. |
| 13:12 | Raynes | It's a little annoying at times, but it keeps me safe in the jungle at night. |
| 13:12 | the-kenny | Del works for me |
| 13:12 | the-kenny | e.g. backwards deleting |
| 13:13 | the-kenny | Maybe it's a bug here |
| 13:13 | the-kenny | but it's a useful bug |
| 13:13 | Raynes | the-kenny: Del completely disregards the parenthesis and goes behind it. |
| 13:13 | the-kenny | Raynes: Heh, then it's a bug on my system |
| 13:14 | Raynes | the-kenny: I want your bugs. :( |
| 13:15 | Chousuke | Raynes: you can use C-q to insert a matching parenthesis |
| 13:15 | Chousuke | then delete |
| 13:15 | stuartsierra | I use C-SPACE to select, then C-w to delete |
| 13:16 | Raynes | The most annoying thing about paredit IMO is the fact that if you need to wrap something in parens, you have to C-LEFT inside of empty parens, and it leaves a space at the beginning so you have to move forward once and then backspace. |
| 13:16 | Raynes | :( |
| 13:17 | technomancy | Raynes: C-u backspace |
| 13:17 | stuartsierra | Raynes: try M-( on the thing you want to wrap |
| 13:17 | the-kenny | Yes, M-( wraps things inside parens |
| 13:17 | the-kenny | If you want to wrap multiple sexps, put them in a region before M-( |
| 13:18 | stuartsierra | the-kenny: ooh, didn't know that trick |
| 13:18 | Raynes | I usually just barf, but M-( will get rid of the space problem. |
| 13:18 | Raynes | technomancy: Awesome. |
| 13:18 | Raynes | technomancy: What does C-u mean? |
| 13:18 | technomancy | actually if the region is active you don't need M-(, just ( will do it |
| 13:18 | technomancy | Raynes: "prefix arg" |
| 13:19 | the-kenny | technomancy: Oh, cool |
| 13:19 | technomancy | it's like alternate-fire in a 3D shooter. |
| 13:19 | Raynes | Neat. |
| 13:19 | stuartsierra | the-kenny: M-( on a region doesn't work for me |
| 13:19 | stuartsierra | but C-u 4 M-( wraps the next 4 exprs |
| 13:19 | technomancy | nice |
| 13:23 | angerman | can I somehow figure out what my java process is doing right now? |
| 13:24 | lypanov | oh. LauJensen hates me now *sad* |
| 13:24 | LauJensen | haha, ofc not |
| 13:25 | lypanov | actually its probably a good idea for me to disappear anyway till i've finished joy of and the various videos |
| 13:25 | AWizzArd | angerman: http://java.sun.com/javase/6/docs/api/java/lang/Thread.html may have something for you, or http://java.sun.com/javase/6/docs/api/java/lang/System.html |
| 13:25 | lypanov | LauJensen: ;) :D |
| 13:26 | angerman | AWizzArd: there must be something fishy going on though. jvisualvm just froze |
| 13:26 | LauJensen | Not on my account, this is the place to be for questions |
| 13:26 | lypanov | LauJensen: tbh. i'd forgotten how much time reading irc can take, so while i know its a joke, i will go poof for a week or two :) |
| 13:26 | LauJensen | Alright - Enjoy |
| 13:27 | LauJensen | Keep an eye on my blog if you like, I hope I get something up before too long |
| 13:28 | angerman | ok, something is _severly_ broken |
| 13:30 | angerman | Exception in thread "Attach Listener" java.lang.reflect.InvocationTargetException ... hmmm I seee |
| 13:40 | Raynes | angerman: You can ask it very nicely. |
| 13:40 | Raynes | :) |
| 13:40 | Raynes | lypanov: Have you bought me a copy of Joy yet? Let me know when you get around to it. ;) |
| 13:41 | lypanov | heh. |
| 13:41 | lypanov | go grab in action and we can swap every once in a while. |
| 13:41 | lypanov | in action in $10 today. |
| 13:41 | lypanov | ;) |
| 13:43 | LauJensen | One thing I don't understand about "Joy of Clojure", is how did Fogus ever let himself get talked into only having Chousers picture on the cover? |
| 13:44 | lypanov | LOL |
| 13:44 | the-kenny | haha |
| 13:44 | technomancy | hopefully when O'Reilly decides to publish a Clojure book it will have a Pirhanamoose on the cover: http://wondermark.com/495/ |
| 13:44 | the-kenny | We should tell clojurebot who is on the cover of joy of clojure :) |
| 13:45 | the-kenny | technomancy: If I remember right, the git book didn't have a octocat on its cover :( |
| 13:46 | astoddard | I am trying out clojure-1.1.0-par-SNAPSHOT.jar on java 1.6.0_18 do I need or should I use the jsr166y.jar that Rick Hickey put on github? |
| 13:46 | rhickey | astoddard: yes, you will need that |
| 13:49 | astoddard | rhickey: Thank you. On what machine spec did pvmap rock? (http://paste.lisp.org/display/84027). I am currently seeing pvmap slower than map on a 4 core machine. |
| 13:52 | the-kenny | Anyone who can buy Joy of Clojure (pdf version) for me? I can't use a credit card because I don't own one, and if I want to use Paypal, it forces me to use a credit card too. |
| 13:52 | rhickey | astoddard: quad-core mac pro |
| 13:53 | technomancy | anyone else getting null pointers when running JMX tests for contrib? |
| 13:54 | angerman | What am I doing wrong with the transients? http://gist.github.com/283066 |
| 13:54 | hiredman | wihtout looking: you are bashing them in place |
| 13:54 | hiredman | and I am wrong |
| 13:54 | angerman | hiredman: O_O |
| 13:55 | technomancy | shame; would have been a great tie-in to my latest blog post |
| 13:55 | astoddard | rhickey: Any reason to think pvmap would be slower today than six months ago? Maybe I just don't have the hardware to take advantage of it yet. (On that one benchmark of course). |
| 13:55 | hiredman | angerman: maybe you have a partial application or something lazy that isn't realized until it is used on another threa |
| 13:56 | ohpauleez | that's sort of what it looks like to me |
| 13:56 | ohpauleez | I have run into issues where I was trying to use transients where the recursion and calls were not sitting local |
| 13:56 | angerman | hiredman: Hm. |
| 13:56 | ohpauleez | and once I isolated down, it worked |
| 13:57 | angerman | the items generator is lazy... |
| 13:57 | technomancy | angerman: that's quite strange; I can't see any place where multiple threads even begin to come into play. |
| 13:58 | angerman | technomancy: me neither. |
| 13:58 | ohpauleez | angerman: it may or may not help: http://www.pauldee.org/euler1.clj |
| 13:58 | angerman | ok, let's see if it's swank that biting me |
| 13:58 | technomancy | angerman: I was going to say, possibly slime threads |
| 13:58 | technomancy | try in an rlwrap repl |
| 13:58 | ohpauleez | technomancy: is there any real advantage of rlwrap over Jline? |
| 13:59 | technomancy | ohpauleez: it provides all of readline |
| 13:59 | technomancy | jline only gives you like half of the bindings |
| 13:59 | ohpauleez | ahhh gotcha, thanks |
| 13:59 | angerman | wow. |
| 13:59 | Chousuke | you have some redundant partials there I think |
| 13:59 | angerman | ok. was slime |
| 13:59 | technomancy | angerman: but it shouldn't be forced at print time since you've got a doall there... |
| 14:00 | technomancy | oh, except perhaps the doall is only forcing the outer lazy seq? |
| 14:00 | technomancy | not sure |
| 14:00 | angerman | hmm 500ms vs. 300ms |
| 14:01 | Chousuke | (apply (p merge-with conj head) (items)) is equal to (apply merge-with conj head (items)) |
| 14:02 | angerman | Chousuke: thanks. I didn't know that |
| 14:02 | angerman | should I make the map transient too? |
| 14:04 | Chousuke | hmmh |
| 14:04 | Chousuke | do you have no way of merging the vectors before you add them to the map final map? |
| 14:05 | angerman | Chousuke: they come in as rows from the database. |
| 14:05 | angerman | it's like I want to select the columns of the resultset |
| 14:05 | rhickey | astoddard: still works here. You should wrap each of those in a (dotimes [_ 10] (time ...)), since one run might encounter a longer GC puase |
| 14:07 | angerman | Chousuke: do you see what I mean? |
| 14:07 | Chousuke | hmmh |
| 14:07 | Chousuke | yeah |
| 14:08 | Chousuke | you could make the map transient I guess but that'll complicate the code a fair bit :/ |
| 14:10 | Chousuke | Or maybe you could just write a merge-with that uses transients internally. |
| 14:10 | angerman | ~merge-with |
| 14:11 | angerman | ,~merge-with |
| 14:11 | clojurebot | java.lang.IllegalStateException: Var clojure.core/unquote is unbound. |
| 14:17 | angerman | hmm reduce doesn't work with transients |
| 14:17 | mjt0229 | Is the correct place for namespace metadata the following: (ns #^{author: me} mynamespace)? |
| 14:18 | chouser | angerman: sure it does |
| 14:18 | angerman | chouser: hmm. ok. *poke code( |
| 14:19 | chouser | ,(persistent! (reduce conj! (transient [:a :b]) (range 5))) |
| 14:19 | clojurebot | [:a :b 0 1 2 3 4] |
| 14:19 | mjt0229 | ah, yes, that seems to bet he case. |
| 14:23 | stuartsierra | ~reader macros |
| 14:25 | Chousuke | mjt0229: yes, though it's :author :P |
| 14:25 | astoddard | rhichey: you are quite right. It was a oneoff GC or other JVM issue. It works fine for me too with the dotimes. |
| 14:25 | astoddard | Thanks for the help. |
| 14:26 | mjt0229 | Chousuke: Yeah, I found it in the clojure source. I was checking because I noticed that in the clojure eclipse plugin, if you run a file that has metadata in the namespace, it doesn't start the repl in that namespace. |
| 14:34 | zakwilson_ | I just set up a new machine and I'm having trouble with Clojure on Slime. Function calls typed at the REPL aren't being evaluated. |
| 14:35 | jkdufair | zakwilson_: what platform? |
| 14:35 | angerman | using transients doesn't seem to be a good idea on this. |
| 14:35 | zakwilson_ | jkdufair: Ubuntu 9.10 amd64, Gnu Emacs 23 |
| 14:36 | chouser | angerman: why's that? |
| 14:36 | zakwilson_ | And Clojure 1.1 |
| 14:36 | jkdufair | zakwilson_: ah ok. i found clojure box for win32 and am loving it. not aware of a linux equivalent currently |
| 14:36 | technomancy | zakwilson_: how'd you install? |
| 14:37 | angerman | chouser: I'm trying to merge lots of maps of the kind {:a <double> :b <double> .... :t <double>} into {:a [<double> ...] .... :t [<double> ...]} |
| 14:37 | technomancy | and how did you launch slime |
| 14:37 | zakwilson_ | technomancy: How'd I install what? |
| 14:37 | slyrus | zakwilson_: are you using the current SLIME head? that won't work |
| 14:37 | angerman | chouser: makeing the innter vectors transient speeds it up a little. |
| 14:38 | technomancy | zakwilson_: how did you install swank-clojure/slime? the best way is to use elpa as documented in http://github.com/technomancy/swank-clojure |
| 14:38 | slyrus | zakwilson_: or just checkout commit 3b3f604c396f0c5ceb8bc5a13fa41061bcc96184 or earlier |
| 14:38 | slyrus | (slime, that is) |
| 14:39 | jasapp_ | slyrus: of sbcl fame? |
| 14:40 | slyrus | sbcl is famous? |
| 14:40 | jasapp_ | of course |
| 14:41 | zakwilson_ | slyrus: I think the Slime version in the problem. I'll try downgrading. |
| 14:41 | slyrus | there's a discussion about the underlying cause of the problem on slime-devel |
| 14:41 | technomancy | zakwilson_: if you use the packages from elpa (http://tromey.com/elpa/install.html) it should work seamlessly |
| 14:42 | technomancy | no manual checkouts involved |
| 14:42 | stuartsierra | What would be a way to compare performance that's better than microbenchmarks? |
| 14:42 | slyrus | technomancy: which is to say that the ELPA/SLIME maintainers have decided not to roll slime forward to the current head until this problem is resolved? |
| 14:43 | zakwilson_ | technomancy: I'll give that a try |
| 14:44 | technomancy | slyrus: more or less. |
| 14:44 | technomancy | slyrus: been waiting for someone who's gung-ho about both Clojure and CL to make it happen; I just don't have the time to do it myself. |
| 14:46 | technomancy | I took over swank-clojure maintenance from the original author, but I am 90% unfamiliar with the server implementation; I've only been focusing on making it easier to install and launch |
| 14:48 | stuartsierra | technomancy: Have you had a chance to think about a Maven repo deployment for swank-clojure? |
| 14:48 | technomancy | stuartsierra: apart from clojars you mean? |
| 14:49 | stuartsierra | something synced to Maven central |
| 14:50 | technomancy | stuartsierra: I've been happy with clojars so far. I guess the benefit would be that people using clojure-maven-plugin wouldn't have to add another repository to their list? |
| 14:50 | stuartsierra | yes |
| 14:50 | technomancy | I've been put off by the sluggish response for getting things into central and the general air of bureaucracy, but if people are asking for it I could make it happen. |
| 14:50 | stuartsierra | The central repository has its flaws, no doubt, but it simplifies deployment for a lot of people. |
| 14:51 | stuartsierra | I'm asking. :) |
| 14:51 | technomancy | I guess it's like apt-get--packages there are always going to be hopelessly behind, but it does serve as a lowest-common-denominator. |
| 14:52 | stuartsierra | It doesn't have to be that bad, if you're willing to take the time to setup an rsync repository. Turnaround to central is just a couple of days then. |
| 14:52 | technomancy | I haven't had much time for swank recently, but I'll definitely put it on my list. |
| 14:52 | stuartsierra | That's why I wanted build.clojure.org to have a releases dir, so we can set up sync to central. |
| 14:53 | technomancy | oh that's right--they don't want to sync from a snapshot repo |
| 14:53 | technomancy | I guess that's a feature request for clojars then |
| 14:53 | technomancy | dammit; where's _ato when you need him. =\ |
| 14:53 | stuartsierra | I think clojars would need to distinguish actual "releases" from "I just threw this up" projects. |
| 14:54 | stuartsierra | We don't want another Rubygems. |
| 14:54 | technomancy | well rubygems didn't have prerelease versions implemented until like a year ago when I added them |
| 14:54 | technomancy | with mvn at least it has the -SNAPSHOT distinction |
| 14:54 | stuartsierra | true |
| 14:55 | technomancy | I'm not sure why a separate repository is needed when the version numbers contain all the info that's necessary. |
| 14:55 | stuartsierra | By the way, could one push Maven-built projects to Clojars? |
| 14:55 | technomancy | certainly |
| 14:55 | technomancy | you can push any jar that has a pom |
| 14:55 | stuartsierra | cool, I'll have to try that |
| 14:56 | technomancy | just scp pom.xml myjar.jar clojars@clojars.org: |
| 14:57 | stuartsierra | ok |
| 14:58 | stuartsierra | What if someone pushed a snapshot of something I wrote, e.g. http://clojars.org/clojure-hadoop |
| 14:58 | stuartsierra | Can I override that with my own release? |
| 14:59 | lypanov | zakwilson_: got it working already? |
| 14:59 | lypanov | if not, it was broken for me (and another guy)because i wasn't using technomancy's fork but instead the first hit on google. |
| 15:00 | somnium | stuartsierra: it seems _ato's attention is needed for resolving squatting (wherever he may be) |
| 15:01 | stuartsierra | I may just post as com.stuartsierra:clojure-hadoop, since I use that in my own repos. |
| 15:01 | zakwilson_ | lypanov: not yet. |
| 15:01 | zakwilson_ | I just got rid of my old slime, swank-clojure, clojure-mode and the like, then reinstalled with elpa. Now it can't find swank-clojure-autoload |
| 15:03 | zakwilson_ | I can't start Slime with SBCL either: Couldn't load "/home/zak/.emacs.d/elpa/slime-20091016/swank-loader.lisp": file does not exist. |
| 15:04 | technomancy | stuartsierra: yeah, unfortunately that requires manual resolution |
| 15:04 | technomancy | groupIds are first-come-first-serve |
| 15:05 | stuartsierra | ok |
| 15:05 | technomancy | zakwilson_: sounds like you still have some manual slime config left in your dotfiles |
| 15:06 | technomancy | you should be able to remove it, if not try moving it to after the point where package.el is loaded |
| 15:06 | technomancy | I'm not 100% sure how to get sbcl working with the elpa slime, sorry. |
| 15:07 | zakwilson_ | I moved the package.el load to the beginning. I'm removing all the manual configuration now. |
| 15:09 | zakwilson_ | Alright, my remaining question is, how do I tell it where clojure.jar is? |
| 15:10 | zakwilson_ | At least, I hope that's my only remaining question. I'll worry about SBCL later as I'm not actively working on anything CL. |
| 15:11 | chouser | cgrand: oh, I didn't realize you wanted a lazy seq |
| 15:12 | lypanov | zakwilson_: doesn't it magically download that? |
| 15:12 | cgrand | chouser: np it wasn't obvious |
| 15:12 | hiredman | http://twitter.com/s_m_conway/statuses/8038881221 |
| 15:12 | cgrand | chouser: my best atrocity (defn f [rs] (partition 2 (rest (mapcat (fn [[a b] [c d]] (when (not= b c) [b c])) (cons nil rs) (concat rs [nil]))))) |
| 15:14 | zakwilson_ | lypanov: it offers to install Clojure. I already have it installed. I'd rather just let it know where to find it, but I suppose I could let it do its thing. |
| 15:15 | technomancy | zakwilson_: you can either set the elisp swank-clojure-classpath var or symlink all the jars you want to use into ~/.swank-clojure |
| 15:17 | lypanov | man.. relearning to use a finger thats been in a cast for 2 months is tough... 2 hours free and its not touching a single key still. |
| 15:18 | Raynes | technomancy: Oddly enough, symlinking the jars never seemed to work correctly for me. I ended up copying all the jars. |
| 15:18 | zakwilson_ | technomancy: thanks. I'm letting it do its own install thing. |
| 15:18 | Raynes | Of course, it's irrelevant now, because I always use swank-clojure-project. |
| 15:19 | Raynes | zakwilson_: If you use swank-clojure-project, all of the jars in your lib/ directory will be slapped on the classpath. |
| 15:23 | Raynes | slyrus: Write it. |
| 15:23 | Raynes | :D |
| 15:25 | zakwilson_ | Raynes: I recently found that. Looks useful. Thanks. |
| 15:27 | technomancy | swank-clojure-project is almost certainly what you want unless you're just getting started and trying things out |
| 15:29 | technomancy | swank-clojure is always looking for contributors too. =) |
| 15:31 | chouser | cgrand: can I use clojure-contrib? |
| 15:31 | chouser | cgrand: can I check something into clojure-contrib and then use it? :-) |
| 15:31 | fogus | chouser: I did. But mine was ugly. :-( |
| 15:31 | stuartsierra | For Git: how do I add an alternate upstream remote repo and fetch its branches? |
| 15:32 | technomancy | git remote add my-remote git://[...]; git fetch my-remote |
| 15:32 | stuartsierra | That's what I thought, but I don't get any new branches (git branch -a) |
| 15:32 | fogus | chouser: (defn f [s] (let [fl (su/flatten s) fq (su/frequencies fl)] (partition 2 (filter #(> 2 (fq %)) fl)))) |
| 15:33 | technomancy | you can also use the github ruby gem where appropriate: if you're in contrib, "github track technomancy" will add my fork of contrib as a remote |
| 15:33 | stuartsierra | never mind |
| 15:33 | stuartsierra | I found the problem, bad URL |
| 15:34 | kmurph79 | what do the astericks do on something like: (def *nwords* ... |
| 15:34 | stuartsierra | nothing, just naming convention |
| 15:34 | kmurph79 | k |
| 15:34 | technomancy | kmurph79: it implies that the var is going to be rebound later |
| 15:34 | Chousuke | technomancy: only sometimes :P |
| 15:35 | technomancy | but technically it's like any other identifier |
| 15:35 | stuartsierra | I think that explanation gets overused. Mostly it just means "Global value" |
| 15:35 | Chousuke | *foo* is also used for unchanging constants |
| 15:35 | Chousuke | though if you adhere to the CL style I think those should be +foo+ |
| 15:37 | technomancy | why do you need a special notation for a top-level var then? |
| 15:37 | technomancy | just to distinguish it from locals? |
| 15:37 | stuartsierra | yeah |
| 15:37 | technomancy | not sure if I buy that |
| 15:38 | technomancy | I mean, if you've got trouble telling what's a local and what's not, you probably have more serious issues |
| 15:38 | technomancy | like function bodies that are too long |
| 15:38 | stuartsierra | The idea is top-level globals are "bad", so the naming convention is supposed to remind you to avoid it where possible. |
| 15:39 | technomancy | I don't understand what's bad about immutable top-level values |
| 15:39 | stuartsierra | In CL they weren't immutable ... |
| 15:39 | stuartsierra | It's true, it's less of an issue in Clojure. |
| 15:39 | Raynes | It's a non-issue in Clojure. |
| 15:40 | tcrayford | I stick asterisks around stuff that might be rebound in certain locations |
| 15:40 | technomancy | if it's longer than that, (excluding logging, arg lists, and exception handling) it requires justification |
| 15:40 | zakwilson_ | It's alive. Thanks, guys. |
| 15:41 | chouser | every def if a namespace-global probably-constant possibly-rebindable reference |
| 15:42 | chouser | so it seems silly to use *earmuffs* to mean global, constant, or rebindable. |
| 15:42 | tcrayford | aye |
| 15:42 | technomancy | chouser: there's a big difference between rebindable and intended-for-rebinding |
| 15:42 | chouser | I think it usually means that it's designed and expected to be rebound, as part of a configuration or something |
| 15:42 | chouser | yes |
| 15:42 | chouser | that's what earmuffs are for |
| 15:42 | tcrayford | take *out* for example |
| 15:43 | technomancy | naming is all about conveying intention |
| 15:43 | chouser | +'s aren't used because most things are mostly constant. I don't want filter to be named *filter* or +filter+ |
| 15:43 | technomancy | well you can't rebind filter anyway with direct binding; heh |
| 15:43 | chouser | so a not-meant-to-be-rebound constant should have a plain name, just like filter |
| 15:43 | chouser | hm |
| 15:43 | chouser | good point. :-P |
| 15:44 | tcrayford | another note about filter, why doesn't it have a doc string |
| 15:44 | chouser | it does again |
| 15:44 | zakwilson_ | Do I have to symlink clojure.jar, and swank-clojure to my projectroot/lib to use swank-clojure-project, or is there a way to give it a static location for those in .emacs? |
| 15:45 | technomancy | zakwilson_: I recommend using leiningen to handle your dependencies |
| 15:45 | technomancy | but if you only have a couple you could copy them to lib/ manually |
| 15:45 | technomancy | it just gets tedious after a while, and you definitely don't want to check them into your version control |
| 15:45 | technomancy | so if other people want to run your project, they have to hunt them down manually if you don't use a dependency manager. |
| 15:48 | technomancy | hehe |
| 15:48 | technomancy | try out leiningen; do "lein new myproject" to get started |
| 15:49 | zakwilson_ | It's been a while since I set up my Clojure environment on my last machine (stolen). It's probably a good thing to start over and get up to speed on the latest tools. |
| 15:53 | technomancy | hopefully we've made some progress forward since then. =) |
| 15:55 | zakwilson_ | I imagine so. It used to be annoying to build a standalone jar. |
| 15:56 | technomancy | "lein uberjar" now =) |
| 16:06 | alexyk_ | do we have a time slots for mindless shouts "clojure is great!" and "I love clojure!"? sometimes I just feel like a dog rolling in the grass when clojure works |
| 16:06 | Raynes | alexyk_: I do it all the time. |
| 16:06 | alexyk_ | Raynes: you keep to the grass patch over there |
| 16:07 | Raynes | :) |
| 16:09 | the-kenny | I praise clojure too, but in other channels. They laugh at me because I use java, but all of them love lisp. They didn't knew what to say when I told them about clojure :D |
| 16:10 | zakwilson_ | I will admit to an initial knee-jerk "ewww Java!" reaction when I first heard about Clojure |
| 16:10 | alexyk_ | lisp has no destructuring, right? maps are not first-class citizens, nor arrays? finally then can hand it back to Guy Steele and thank him for the good run. |
| 16:11 | alexyk_ | zakwilson_: I still hate Java though. Alas it's there... but we can use the libs. |
| 16:11 | sh10151 | I'm trying to install swank-clojure via ELPA and get some errors |
| 16:11 | zakwilson_ | CL has destructuring, but Clojure has a lot of forms that do it automagically |
| 16:11 | sh10151 | slime-repl.el:122:39:Error: No setf-method known for slime-connection-output-buffer |
| 16:11 | sh10151 | and then |
| 16:11 | sh10151 | swank-clojure.el:47:1:Error: Cannot open load file: slime |
| 16:11 | LauJensen | Odd: I have written a parser which chunks data in segments of 100 files then pmaps through the - There's 67k files in total and it blazed through the first 22k using up all the head -then cpu#1 went to 100% load while cpu#2 lingered at 30% - this stretched for about 5 minutes, then they swapped so cpu#2 is now 100% and cpu#1 is 30% |
| 16:11 | zakwilson_ | For example, CL's let doesn't destructure. Instead, you'd use destructuring-bind. |
| 16:11 | alexyk_ | zakwilson_: can lisp be taught to do the exact same destructuring as Clojure? say Allegro's? |
| 16:12 | alexyk_ | I can't imagine going without maps and vectors. |
| 16:12 | zakwilson_ | alexyk_: There are libraries that do things like that. metabang-bind is an example. |
| 16:12 | zakwilson_ | CL has hash tables and vectors, but not first-class syntax for them. You can add it with reader macros, and there's probably a library that does it. |
| 16:13 | alexyk_ | zakwilson_: since I'm a n00b in lispiness, I'd love to see some gurus make a CL emulating Clojure. Then I'll dig my good old Allegro license and try it! |
| 16:13 | zakwilson_ | CL hash tables and vectors are mutable though, so it's not exactly like Clojure. |
| 16:14 | alexyk_ | Clojure without Java, now that would be fun |
| 16:14 | zakwilson_ | Most of what's cool about Clojure can be done in CL, but it's not likely to be quite as polished. |
| 16:14 | alexyk_ | zakwilson_: well... my hunch is Clojure will overtake lisp in all respects in a few years anyways |
| 16:14 | alexyk_ | meaning non-clojure lisps |
| 16:15 | zakwilson_ | The only thing I've really been missing from CL is method combination. |
| 16:15 | LauJensen | zakwilson_: you mean comb? |
| 16:18 | zakwilson_ | He left before I could ask about that. What's comb? I don't see it in the API. |
| 16:20 | alexyk_ | ,(letfn [(f [x & [a b]] (print (str "x:" x ", a:" a ", b:" b)))] (f 1)) |
| 16:20 | clojurebot | x:1, a:, b: |
| 16:20 | alexyk_ | ah ok works |
| 16:23 | alexyk_ | clojurebot has that fearsomness which makes code goes week in the knees and work |
| 16:23 | arnihermann | has anyone experience with datalog in clojure? |
| 16:41 | Chousuke | hmm |
| 16:42 | Chousuke | wrote a plugin for lein for running examples easily |
| 16:47 | dabd | I tried (require '[clojure.contrib.str-utils2 :as s]) and then (s/uppercase "asdf") and got java.lang.Exception: No such var: s/uppercase (NO_SOURCE_FILE:9) What am I doing wrong? |
| 16:47 | chouser | s/upper-case |
| 16:48 | hiredman | ,(require '[clojure.contrib.str-utils2 :as s]) |
| 16:48 | clojurebot | nil |
| 16:48 | hiredman | ,(s/uppercase "asdf") |
| 16:48 | clojurebot | java.lang.Exception: No such var: s/uppercase |
| 16:48 | chouser | ,(s/upper-case "asdf") |
| 16:48 | clojurebot | "ASDF" |
| 16:49 | dabd | duh! thx |
| 16:49 | konr | is there any library to deal with finding sexps inside other sexps, like {:foo "bar" :baz [[[[[4]]]]]} inside [3 4 {:foo "bar" :baz [[[[[4]]]]]}]? |
| 16:50 | chouser | what do you mean by "finding"? |
| 16:50 | chouser | you want to know if something equal to your map exists somewhere inside? true/false? |
| 16:51 | technomancy | anyone else seeing contrib test failures for JMX? |
| 16:51 | technomancy | I'm getting it on some machines but not others and can't figure out the pattern. |
| 16:51 | alexyk_ | hmm -- so clojurebot now remembers imports/requires? |
| 16:51 | technomancy | fails on my ubuntu machine, but not on scgilardi's ubuntu VM |
| 16:52 | konr | chouser: yes |
| 16:54 | konr | chouser: actually I want something more flexible, like being able to use a function instead of a symbol to match, ie, {:size #(> % 3)} in {:foo {:size 1}} |
| 16:54 | chouser | (some #{needle} (tree-seq coll? seq haystack)) |
| 16:55 | arohner | chouser: I didn't know about tree-seq. That's really cool |
| 16:56 | Raynes | technomancy: Is there a way to make Leiningen include unrelated files in the jars it creates? Such as a LICENSE or README for instance? |
| 16:57 | konr | chouser: that's very interesting! |
| 16:57 | konr | chouser: thanks! |
| 16:57 | chouser | konr: so you should be able to drop your predicate in there in place of #{needle}, and find whatever you're looking for |
| 16:58 | chouser | or use 'filter' instead of 'some' to find all matches |
| 16:58 | technomancy | Raynes: I've thought about adding that, but there's no code for it yet |
| 16:58 | technomancy | would be an easy patch |
| 16:58 | konr | chouser: yes, and I thought I'd have to develop a whole library to deal with this! |
| 16:58 | Raynes | technomancy: Could be pretty important. |
| 17:00 | hiredman | uh |
| 17:00 | hiredman | what about ./resources/ |
| 17:00 | hiredman | last time I put a file in ./resources/ it ended up in the root of the jar |
| 17:01 | technomancy | hiredman: well it'd be better not to have to keep two copies of the readme around |
| 17:02 | hiredman | oh |
| 17:02 | hiredman | I see |
| 17:02 | hiredman | right |
| 17:06 | scottj | hiredman: are there docs on lein-gae? |
| 17:06 | hiredman | nope |
| 17:06 | scottj | what commands/features does it provide? |
| 17:07 | tcrayford | lein help |
| 17:07 | hiredman | scottj: I would checkout this fork http://github.com/the-kenny/lein-gae |
| 17:08 | the-kenny | huh |
| 17:08 | hiredman | my branch doesn't do much atm |
| 17:08 | hiredman | it has an appegine-setup command that creates some directories and does some rewriting of procject.clj |
| 17:09 | the-kenny | My branch doesn't do much more ;) But I have some plans for appengine-push and such things |
| 17:09 | hiredman | http://github.com/hiredman/appengine-helper might be a better choice |
| 17:09 | the-kenny | It's a bit annoying because it looks like you need the while appengine-sdk-directory |
| 17:09 | hiredman | not lein though, uses ant |
| 17:09 | hiredman | yes |
| 17:09 | the-kenny | s/while/whole/ |
| 17:09 | hiredman | appengine-helper uses a somewhat dated version of the sdk currently |
| 17:10 | scottj | I was looking at using http://github.com/zitterbewegung/blank-appengine-clj as the base for my project but it looks like it also uses an old sdk |
| 17:10 | hiredman | but it works and I have used it for two apps (that do very little) |
| 17:10 | hiredman | oh |
| 17:10 | hiredman | thats kind of nice |
| 17:10 | hiredman | wow |
| 17:11 | hiredman | the-kenny: steal that project.clj |
| 17:11 | the-kenny | hiredman: Because of the dependencies? |
| 17:11 | hiredman | that looks like the way to go |
| 17:11 | hiredman | the-kenny: yeah |
| 17:12 | hiredman | tracking down all the sdk's jars is :( |
| 17:12 | the-kenny | pushed it into my Inbox for Todos |
| 17:24 | alexyk_ | I want to stick a new value in update-in, regardless of what was there; like |
| 17:24 | alexyk_ | ,(update-in {} [1 2] (fn [_] 3)) |
| 17:24 | clojurebot | {1 {2 3}} |
| 17:24 | alexyk_ | is there anything shorter? |
| 17:24 | dnolen | assoc-in |
| 17:24 | alexyk_ | oh! |
| 17:25 | alexyk_ | clojure is small, but someone already wrote all the functions... |
| 17:37 | alexyk_ | can you mix, in map destructuring, :keys [list] and val-name different-key-name? |
| 17:37 | chouser | sure |
| 17:37 | konr | Is there a function like partition that uses a functions instead of a number to decide where to split? like (cut-where #(> 3 %) [1 2 3 4 1 2 3]) -> [[1 2 3] [4 1 2 3]] |
| 17:38 | alexyk_ | loovely |
| 17:38 | alexyk_ | ,(let [{a :argh :keys [b c]} {:argh 1 :b 2 :c 3}] [a b c]) |
| 17:38 | clojurebot | [1 2 3] |
| 17:40 | Chousuke | konr: split-with? |
| 17:41 | konr | Chousuke: Thanks! |
| 17:44 | arohner | I'm getting tired of writing (:require) lines of the format (:require [a.b.c :as c]). is it possible to write a macro that simplifies that? |
| 17:44 | jcromartie | does duck-streams work with basic auth baked into the URL? |
| 17:44 | jcromartie | like https://user:pass@example.com/ |
| 17:44 | alexyk_ | arohner: I'm tired of the whole use/require/import distinction |
| 17:44 | technomancy | arohner: there's been talk of revamping it |
| 17:45 | technomancy | see the "ns docstring needs work" thread from a few months ago |
| 17:45 | chouser | import needs to be separate, but use/require should become one thing |
| 17:45 | scottj | With lein-gae how do you launch your app locally for testing? how do you deploy to gae? |
| 17:45 | alexyk_ | chouser: because import is JVM thing? |
| 17:45 | hiredman | scottj: none of that is there |
| 17:46 | chouser | alexyk_: well, because it means something different. you import classes, you use/require namespaces. |
| 17:46 | Chousuke | arohner: sure you can write a macro |
| 17:46 | hiredman | I just broke ground on it, and then haven't finished it |
| 17:46 | Chousuke | arohner: you only need to write something that expands to the proper (ns ...) form :) |
| 17:46 | arohner | oh right, I can always write a macro that generates ns |
| 17:46 | arohner | I was original thinking, can I write a macro that fits inside ns, or does ns's macroexpansion run first |
| 17:46 | Chousuke | arohner: though it might break tools that expect ns :P |
| 17:46 | dabd | My Java code is passing a null value to a Clojure function however the null value fails the 'nil?' predicate. I am surprised since the documentation mentions that 'nil has the same value as Java null' |
| 17:46 | jcromartie | I'm guessing that java.net.URL is the bottleneck |
| 17:46 | arohner | Chousuke: that's why I don't use "smart" tools :-) |
| 17:47 | alexyk_ | if you guys fix ns the tools probably become obsoleted anyways... |
| 17:47 | chouser | arohner: have you looked at the definition of 'ns'? |
| 17:47 | Chousuke | arohner: you can also create a helper macro that expands to all the needed calls to require and use and use it in addition to ns, so you don't break tools too badly :p |
| 17:47 | chouser | arohner: I think you'd just have to (in-ns 'clojure.core), define a new fn or macro, and you could start using it in (ns ...) |
| 17:47 | scottj | hiredman: so you use ant for that stuff? |
| 17:48 | hiredman | scottj: I don't do appengine work regularly, what I have done has been using appengine-helper |
| 17:49 | hiredman | appengine-helper has some rough edges too, but it has a start-server target for the local server |
| 17:49 | arohner | chouser: that's the kind of answer I was hoping for! thanks |
| 17:50 | jcromartie | :use and :require are about the most boilerplate-y stuff I have come across yet in Clojure, compared to most other languages it's still not much to complain about :) |
| 17:52 | jcromartie | I feel like maybe they could go away entirely leaving only :use :as in the end. |
| 17:52 | technomancy | jcromartie: you should read the mailing list thread, lots of good ideas there |
| 17:55 | redalastor | How would you go about converting indexes (0 based) into Excel-like column labels (A to Z, then AA, AB, etc.)? |
| 17:57 | chouser | Raynes: all the good ones do! |
| 17:57 | jcromartie | redalastor: sounds like a simple enough job for the various sequence functions |
| 17:57 | jcromartie | $VISUAL |
| 17:57 | briansheehan | Hello, is there a difference between clojure.core/resolve and clojure.core/find-var? |
| 17:57 | chouser | Raynes: mutt, gmail (+ itsalltext), emacs email thingy (whatever its called) |
| 17:57 | Raynes | I use Thunderbird. |
| 17:57 | Raynes | :o |
| 17:57 | chouser | Raynes: I do too, sometimes. It does not count as a "good one" |
| 17:58 | jcromartie | briansheehan: find-var is only for vars, resolve/ns-resolve is for vars or classes |
| 17:58 | technomancy | Raynes: I write all my mail in Emacs via gnus |
| 17:58 | arohner | briansheehan: resolve uses *ns*, so it looks in the current ns by default |
| 17:58 | Raynes | I haven't figured out gnus yet. |
| 17:58 | chouser | gnus, that's it. I used that for a while. not bad at all |
| 17:58 | chouser | though no gmail |
| 17:58 | Raynes | Albeit, I haven't really tried either. |
| 17:58 | redalastor | jcromartie: I don't want to create a sequence of indexes, just turn a single index into letters. |
| 17:58 | technomancy | it's really nice for mailing lists and news-like stuff |
| 17:58 | Raynes | I've been using thunderbird for like 3 years noe. |
| 17:58 | briansheehan | Looks to me like resolve does everything that find-var can do though. |
| 17:58 | Raynes | now* |
| 17:59 | jcromartie | right, redalastor, I'm just saying a seq of indexes will probably come into play |
| 18:00 | arohner | briansheehan: resolve is a super-set of find-var, because it also looks up classes |
| 18:00 | arohner | and the signatures are different because you'd have to bind *ns* if you want to look in other namespaces |
| 18:00 | arohner | which is kind of strange |
| 18:01 | janjan | I was wondering, why do we need alength and why doesn't (.length (int-array 3)) work? |
| 18:01 | janjan | some kind of restriction on java reflection? |
| 18:02 | arohner | janjan: (.foo bar) means call bar.foo() in java |
| 18:02 | chouser | java arrasys don't have an instance method named 'length' |
| 18:02 | redalastor | janjan: length is a property on arrays, not a method. |
| 18:03 | janjan | I thought I had used .something for properties before, but apparently I thought wrong |
| 18:03 | chouser | a property? |
| 18:03 | janjan | field |
| 18:03 | Chousuke | I think array.length is something weird, actually. |
| 18:03 | chouser | you can do field lookups with (.fieldname obj), so I don't think it's that |
| 18:03 | Chousuke | since if it were a field, (.length array) would work :/ |
| 18:03 | chouser | right |
| 18:03 | arohner | right, it can't be a normal field, or you could do [1,2,3].length = 5 |
| 18:04 | Chousuke | I guess it's like int.class or whatever |
| 18:04 | chouser | compiler sugar? huh. |
| 18:04 | chouser | I really know very little java |
| 18:05 | hiredman | yes |
| 18:05 | hiredman | there is, I think, an opcode for arraylength |
| 18:07 | hiredman | clojurebot: bytecode? |
| 18:07 | clojurebot | http://homepages.inf.ed.ac.uk/kwxm/JVM/codeByNo.html |
| 18:07 | hiredman | I should just teach clojurebot the bytecode |
| 18:08 | janjan | http://homepages.inf.ed.ac.uk/kwxm/JVM/codeByNo.html |
| 18:08 | janjan | meant http://java.sun.com/docs/books/jvms/second_edition/html/Instructions2.doc.html#arraylength |
| 18:09 | hiredman | clojurebot: arraylength is 0xBE (190) |
| 18:09 | clojurebot | Alles klar |
| 18:09 | hiredman | clojurebot: 190? |
| 18:09 | hiredman | that is not cool |
| 18:09 | hiredman | clojurebot: arraylength? |
| 18:09 | clojurebot | arraylength is 0xBE (190) |
| 18:09 | janjan | :) |
| 18:10 | janjan | never too late to learn something new, I guess |
| 18:10 | hiredman | clojurebot: 190? |
| 18:10 | clojurebot | excusez-moi |
| 18:10 | hiredman | yay for typo's swallowing exceptions |
| 18:11 | hiredman | clojurebot: 190? |
| 18:11 | clojurebot | It's greek to me. |
| 18:11 | hiredman | clojurebot: 0xBE |
| 18:11 | clojurebot | Excuse me? |
| 18:11 | hiredman | bah |
| 18:11 | janjan | clojurebot: arraylength? |
| 18:11 | clojurebot | arraylength is 0xBE (190) |
| 18:11 | janjan | clojurebot: invokevirtual? |
| 18:11 | clojurebot | Gabh mo leithscéal? |
| 18:11 | briansheehan | arohner: you can give resolve a namespace qualified symbol if you want something outside the current ns |
| 18:13 | arohner | briansheehan: ah, right |
| 18:13 | briansheehan | On the subject of rebinding *ns*, according to clojure.org that's a no-no, can anyone illuminate for me? |
| 18:13 | briansheehan | That's funny, clojurebot is speaking Gaelic! |
| 18:14 | devlinsf | briansheehan: I imaging that might ruin hygenic variable capture |
| 18:14 | ohpauleez | briansheehan: You manipulate the namespace using the ns macro |
| 18:14 | ohpauleez | and you shouldn't manipulate it directly |
| 18:14 | janjan | clojurebot: Gabh mo leithscéal? |
| 18:14 | clojurebot | not a problem, the average bid for it on getacoder is $821.00 |
| 18:14 | hiredman | ohpauleez: you shouldn't use the ns macro for manipulating namespaces |
| 18:14 | hiredman | the ns macro is for creating namespaces |
| 18:15 | hiredman | for switching namespaces use in-ns |
| 18:15 | ohpauleez | hiredman speaks the truth |
| 18:17 | zakwilson_ | So I see there's Postal for sending mail. What if I want to write an SMTP server? Is there a nice library for that? |
| 18:20 | zakwilson_ | To be specific, I want something that will receive mail and provide hooks for deciding if an address is valid, and what to do with the data. |
| 18:21 | scottj | hiredman: the readme for appengine-helper has a commandline ant -build ... is that a typo or am I misunderstanding it, my ant doesn't have a -build arg |
| 18:21 | zakwilson_ | Is Apache James what I want? |
| 18:22 | briansheehan | hiredman: just being pedantic, both the docs for both ns & in-ns say : "Sets *ns* to the namespace named by the symbol, creating it if needed", sounds like you could use either of them to switch namespaces |
| 18:23 | hiredman | scottj: sorry, should be buildfile |
| 18:24 | piccolino | mattrepl, how funny, I was just studying how your cassandra bindings allow you to make a function named "get." |
| 18:25 | jcromartie | an I add methods to a proxy'ed object after the fact? |
| 18:26 | hiredman | briansheehan: ns has more machinery under the hood, most of which makes the assumption that it is working with a pristine namespace |
| 18:26 | hiredman | ,(doc update-proxy) |
| 18:26 | clojurebot | "([proxy mappings]); Takes a proxy instance and a map of strings (which must correspond to methods of the proxy superclass/superinterfaces) to fns (which must take arguments matching the corresponding method, plus an additional (explicit) first arg corresponding to this, and updates (via assoc) the proxy's fn map. nil can be passed instead of a fn, in which case the corresponding method will revert to the default behavior |
| 18:29 | jcromartie | thanks hiredman |
| 18:29 | jcromartie | and clojurebot |
| 18:34 | jcromartie | I don't see anything in the interop page about implementing a constructor from a proxy |
| 18:37 | jcromartie | is that possible? |
| 18:37 | hiredman | nope |
| 18:39 | jcromartie | I guess it's not really necessary with closures |
| 18:45 | Raynes | What would be a good name for a clojure-based email client? |
| 18:46 | Raynes | MailCljiant is too hackish. |
| 18:54 | slyrus | good lord... what is all this stuff maven wants to download and why do i want it? |
| 18:59 | callapm | ditch maven. stick with rake or ant |
| 18:59 | slyrus | callapm: believe me, i have no interest in running maven. just trying to build incanter. |
| 18:59 | technomancy | Raynes: didn't you hear about the new rule? you're not allowed to have a J in the name of your clojure programs. |
| 19:00 | callapm | slyrus: woops gotcha. i hear ya. |
| 19:00 | hiredman | if you put a J in your clojure program names, your nick will be stricken from the logs |
| 19:00 | Raynes | technomancy: Doesn't matter. There was no good way of fusing Clojure and 'Mail'. I just named it Snail. |
| 19:01 | technomancy | hiredman: I'm enforcing it in the next version of "lein new" |
| 19:01 | hiredman | pop up a swing window |
| 19:01 | hiredman | "you apear to be starting a project with J in the name, please no puns" |
| 19:05 | briansheehan | Jail works for me though. |
| 19:05 | clojurebot | for is not a loop |
| 19:10 | mattrepl | piccolino: sorry, was afk |
| 19:10 | piccolino | Oh, no problem. |
| 19:11 | piccolino | I didn't have anything more to say. |
| 19:11 | piccolino | But the timing was pretty funny, I pulled up the source on github and saw you pop into the channel on the side of my screen within 5 seconds. |
| 19:11 | mattrepl | =) |
| 19:14 | Raynes | clojurebot: Is for a loop? |
| 19:14 | clojurebot | egal is http://home.pipeline.com/~hbaker1/ObjectIdentity.html |
| 19:29 | beutdeuce | how would i call the java Queue constructor from clojure? |
| 19:30 | hiredman | Queue is an interface |
| 19:30 | hiredman | it has no constructor |
| 19:30 | beutdeuce | well, the linkedlist for that matter |
| 19:31 | beutdeuce | LinkedList<Integer> for example |
| 19:31 | hiredman | well, you can forget generics |
| 19:31 | hiredman | they don't exist |
| 19:31 | beutdeuce | oh |
| 19:31 | beutdeuce | hm |
| 19:31 | hiredman | generics are a compiler construct |
| 19:31 | hiredman | the byte code just deals with objects |
| 19:32 | hiredman | so in clojure you don't have to care about generics |
| 19:32 | hiredman | ,(import '(java.util ArrayList)) |
| 19:32 | clojurebot | java.util.ArrayList |
| 19:32 | hiredman | ,(ArrayList.) |
| 19:32 | clojurebot | #<ArrayList []> |
| 19:33 | hiredman | dunno why you would use a LinkedList when you can use clojure's lists |
| 19:33 | beutdeuce | how would i do something like the following in java: Queue<Integer> q = new LinkedList<Integer>();? |
| 19:33 | beutdeuce | i wouldn't |
| 19:33 | hiredman | you wouldn't |
| 19:33 | beutdeuce | practically i wouldn't, i just want to know hwo |
| 19:34 | hiredman | no, you wouldn't |
| 19:34 | hiredman | Queue<Integer> q is declaring the variable q to have the type Queue<Integer> |
| 19:34 | hiredman | clojure is a dynamic language so you don't do that sort of thing |
| 19:35 | beutdeuce | so there are no interfaces in clojure? |
| 19:35 | hiredman | there are interfaces |
| 19:35 | hiredman | you just don't type everything |
| 19:35 | hiredman | there is no need |
| 19:35 | beutdeuce | k |
| 19:36 | hiredman | ,(import '(java.util LinkedList)) |
| 19:36 | clojurebot | java.util.LinkedList |
| 19:36 | hiredman | ,(let [q (LinkedList.)]) |
| 19:36 | clojurebot | nil |
| 19:36 | hiredman | but generally you would not do that |
| 19:37 | hiredman | ,(let [q ()]) |
| 19:37 | beutdeuce | yes, i knoew |
| 19:37 | clojurebot | nil |
| 19:37 | hiredman | since clojure has list literals |
| 19:37 | beutdeuce | thnx |
| 19:37 | rikthevik | so here's a question for ya |
| 19:37 | rikthevik | lots of times i find what i passed into a function isn't what i meant to pass in. forgetting to @ refs happens all the time |
| 19:38 | rikthevik | are type hints the way to catch improper parameter types? |
| 19:38 | rikthevik | or preconditions |
| 19:38 | qbg | Preconditions would be the way to go |
| 19:38 | rikthevik | also, how can i verify that an argument is the type of struct-map i think it is |
| 19:39 | hiredman | you can check to see if it has the right keys |
| 19:39 | hiredman | or use a type tag |
| 19:39 | rikthevik | ah, that's not a bad idea |
| 19:40 | beutdeuce | are clojure sets automatically sorted? |
| 19:40 | beutdeuce | nvm, they are not |
| 19:40 | chouser_ | sorted-sets are :-) |
| 19:40 | beutdeuce | mhm, thats cool |
| 19:43 | beutdeuce | do sorted-maps sort by whichever elements are Comparable? |
| 19:44 | hiredman | ,(sorted-set :a 1) |
| 19:44 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number |
| 19:45 | beutdeuce | ,(sorted-map :a 1) |
| 19:45 | clojurebot | {:a 1} |
| 19:45 | hiredman | ,(sorted-map :a 1 2 :b) |
| 19:45 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number |
| 19:46 | beutdeuce | ,(sorted-map :a 1 2 :b) |
| 19:46 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number |
| 19:46 | beutdeuce | lol |
| 19:46 | beutdeuce | weird |
| 19:46 | hiredman | no |
| 19:46 | tcrayford | not weird |
| 19:46 | hiredman | ,(.compare 1 :a) |
| 19:46 | clojurebot | java.lang.IllegalArgumentException: No matching method found: compare for class java.lang.Integer |
| 19:46 | tcrayford | things have to be comparable to sort them |
| 19:46 | hiredman | bah |
| 19:46 | beutdeuce | oh |
| 19:46 | chouser | ,(compare 1 :a) |
| 19:46 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Number |
| 19:47 | hiredman | ,(.compareTo 1 :a) |
| 19:47 | clojurebot | java.lang.ClassCastException: clojure.lang.Keyword cannot be cast to java.lang.Integer |
| 19:47 | beutdeuce | ,(sorted-map :a 2 :b 3) |
| 19:47 | clojurebot | {:a 2, :b 3} |
| 19:47 | beutdeuce | ,(sorted-map :a "1" :b "10") |
| 19:47 | clojurebot | {:a "1", :b "10"} |
| 19:48 | hiredman | ,{:a 1 2 :b} |
| 19:48 | clojurebot | {:a 1, 2 :b} |
| 19:48 | ctdean | Isn't there a load-file function that will load a clojure file at some arbitrary path? |
| 19:49 | hiredman | ,(doc load-file) |
| 19:49 | clojurebot | "([name]); Sequentially read and evaluate the set of forms contained in the file." |
| 19:49 | ctdean | yep, there it is |
| 19:49 | beutdeuce | is clojure's reduce like Haskells foldr or foldl? |
| 19:49 | ctdean | must have some messed up env |
| 19:49 | ctdean | Thanks |
| 19:50 | hiredman | beutdeuce: foldl I believe |
| 19:51 | beutdeuce | k |
| 19:51 | hiredman | I tell a lie, it must be foldr |
| 19:51 | hiredman | nope |
| 19:51 | hiredman | foldl |
| 19:52 | hiredman | <-- not a haskeller |
| 19:52 | hiredman | clojurebot: reduce? |
| 19:52 | clojurebot | Pardon? |
| 19:52 | hiredman | clojurebot: foldl |
| 19:52 | clojurebot | excusez-moi |
| 19:52 | hiredman | clojurebot: foldr |
| 19:52 | clojurebot | No entiendo |
| 19:52 | beutdeuce | lol |
| 19:52 | hiredman | http://www.zvon.org/other/haskell/Outputprelude/foldl_f.html <-- this is reduce |
| 19:53 | beutdeuce | k, does clojure have a foldr? |
| 19:53 | hiredman | nope |
| 19:53 | beutdeuce | k |
| 19:53 | hiredman | clojure is not lazy evaluated |
| 19:53 | beutdeuce | oh, ok |
| 19:53 | beutdeuce | i had a feeling it is |
| 19:54 | hiredman | it is not |
| 19:54 | beutdeuce | there are lazy implementations though of certain functions |
| 19:54 | hiredman | clojure has lazy sequences, but those are the only lazy things |
| 19:54 | hiredman | beutdeuce: yes, functions that consume and produce lazy sequences |
| 20:14 | Raynes | You access a Java field the same way you access a static method, right? |
| 20:14 | rhickey | Raynes: static field? |
| 20:14 | Raynes | Yes. |
| 20:15 | rhickey | AClass/aStaticField |
| 20:15 | rhickey | no parens |
| 20:15 | Raynes | Thought so. Thanks. |
| 20:15 | rhickey | Math/PI |
| 20:16 | rhickey | ,Math/PI |
| 20:16 | clojurebot | 3.141592653589793 |
| 20:19 | tcrayford | man clojure contrib api docs are really hard to reach via google/moving around the clojure website |
| 20:19 | tcrayford | (actually, its ok via google, just very hard to get to from clojure.org) |
| 20:24 | rhickey | http://clojure.org/ , then User contribs in upper right |
| 20:26 | tcrayford | perhaps thats slightly poorly labelled? |
| 20:26 | rhickey | could be |
| 20:27 | tcrayford | maybe "library api" or something like that |
| 20:28 | rhickey | hmm, it's not the main library api |
| 20:28 | tcrayford | tis true |
| 20:28 | tcrayford | maybe just "Contrib API" |
| 20:29 | rhickey | what about Contrib library? |
| 20:30 | tcrayford | better |
| 20:30 | tcrayford | I think |
| 20:31 | rhickey | done |
| 20:31 | tcrayford | nice then |
| 20:52 | alexyk | I create maps like {1 3, 2 2, 3 2, 4 1, 5 3, 6 4, 7 7} and they also print in sorted key order; coincidence? |
| 20:53 | tcrayford | should use sorted-map |
| 20:53 | alexyk | ,(let [m {0 2, 1 3, 2 2, 3 2, 4 1, 5 3, 6 4, 7 7}] (assoc m 0 2)) |
| 20:53 | clojurebot | {0 2, 1 3, 2 2, 3 2, 4 1, 5 3, 6 4, 7 7} |
| 20:53 | chouser | alexyk: coincidence. |
| 20:53 | dabd | consing to a vector returns a list, how do I add an item as the first element a of a vector and still get one? |
| 20:54 | chouser | dabd: vectors can't "grow" on the left side, though of course you could copy a new value plus all the elements from the old one into a new one. |
| 20:55 | chouser | alexyk: small literal maps are usually PersistentArrayMaps, which stay in the order yoy put them. but as they get larger they may change concrete type. |
| 20:56 | alexyk | ah |
| 20:56 | alexyk | if I create a sorted-map, does it in all other respects behave like a regular map? |
| 20:56 | alexyk | syntactically |
| 20:57 | dabd | chouser: so to concatenate to vectors you need to do something like (into [] (concat vec1 vec2)) ? |
| 20:57 | alexyk | i.e. looks up its own keys, etc |
| 20:57 | dabd | two vectors |
| 20:57 | alexyk | destructures |
| 20:57 | chouser | dabd: yes, though if you intend to do that a lot you might consider using a list |
| 20:58 | chouser | alexyk: yep |
| 20:58 | alexyk | nice |
| 20:59 | chouser | have to be more careful about key types than you do with hash-maps |
| 21:01 | chouser | btw, we cover all this in detail in the upcoming chapter |
| 21:03 | alexyk | ok here's a trickier one. I create a map with (sorted-map) and then add things to it with (assoc-in sm [a b] v). When taking (vec sm), I'll get things like ["user" {1 2, 2 0, 3 5}]. Does sortedness of sm spread down to {1 2, 2 0, 3 5}? |
| 21:03 | alexyk | a is string, b and v are ints |
| 21:04 | alexyk | if not, what's the way to create the inner map in sorted order, given that it's never done explicitly -- auto-vivified in assoc-in? |
| 21:07 | chouser | the sortedness will not spread. |
| 21:08 | devlinsf | alexyk: I think you'd need to write your own version of assoc-in |
| 21:09 | alexyk | alas |
| 21:09 | alexyk | devlinsf: i.e. an assoc-in which makes the leaves sorted-map's, right? |
| 21:09 | devlinsf | Yeah |
| 21:10 | devlinsf | alexyk: Hmmm... this could be a really good exercise in HOFs.... |
| 21:10 | devlinsf | must write about this later... |
| 21:11 | alexyk | devlinsf: I'm all ears :) |
| 21:11 | devlinsf | Gimme a sec to play at the REPL.... |
| 21:11 | alexyk | kk |
| 21:13 | chouser | I don't see where in the source of assoc-in new hash-maps are created. |
| 21:15 | chouser | oh! it's in assoc |
| 21:15 | chouser | ,(assoc nil :a 1) |
| 21:15 | clojurebot | {:a 1} |
| 21:15 | chouser | ,(class (assoc nil :a 1)) |
| 21:15 | clojurebot | clojure.lang.PersistentArrayMap |
| 21:17 | devlinsf | Yeah |
| 21:17 | devlinsf | chouser: Threw me off too |
| 21:18 | chouser | oh no! and direct binding prevents an easy hack to work around it. |
| 21:19 | jcromartie | I'm playing with proxy again, and I am not sure how to do this... I want to pass the proxy itself to one of its methods |
| 21:19 | chouser | you just need a third arg to the 'get' in there |
| 21:19 | chouser | jcromartie: in the body of a proxy form you can use the word this to refer to itself |
| 21:19 | jcromartie | ah, this |
| 21:20 | devlinsf | chouser: |
| 21:20 | devlinsf | chouser: yep |
| 21:20 | JonSmith | do you have to quote the this? |
| 21:20 | chouser | JonSmith: nope |
| 21:21 | chouser | ,(proxy [Object] [] (toString [] (str "This hashCode is: " (.hashCode this)))) |
| 21:21 | clojurebot | java.lang.IllegalStateException: Var null/null is unbound. |
| 21:26 | devlinsf | chouser, alexyk: http://gist.github.com/283450 |
| 21:26 | devlinsf | Various versions of assoc-in |
| 21:27 | alexyk | beautiful |
| 21:27 | alexyk | there's 20 millions records waiting to fly through then right away |
| 21:28 | chouser | note that assoc-in-by calls f for every level, whather it's needed or not |
| 21:28 | chouser | whether |
| 21:28 | devlinsf | get is eager? |
| 21:28 | chouser | get is a function |
| 21:28 | devlinsf | I guess it has to be... |
| 21:28 | chouser | all args get evaluated before its called |
| 21:28 | devlinsf | Well, okay. Details. Nothing an if-guard won't fix |
| 21:29 | chouser | it would probably be sufficient to provide a base object |
| 21:29 | alexyk | so (sorted-map) will also be called every time? |
| 21:29 | chouser | (get m k default-map) |
| 21:30 | devlinsf | I'm thinking more (let [local-k (get m k)] (if k k (f))) |
| 21:30 | devlinsf | At least for assoc-in-by |
| 21:30 | chouser | devlinsf: that might not do what you expect if a map has a 'nil' value |
| 21:31 | devlinsf | Hmmm... right |
| 21:31 | alexyk | is there an empty sorted-map object or only (sorted-map) call ? |
| 21:31 | alexyk | I'd settle for assoc-in-2 first :) |
| 21:31 | devlinsf | (if (contains ...) (get ...) f) |
| 21:31 | chouser | (def m (sorted-map)) ; <- there it is! |
| 21:31 | devlinsf | That'll work |
| 21:31 | chouser | devlinsf: yes, though that means it does each lookup twice. :-P |
| 21:32 | alexyk | chouser: but m will have to be packaged with assoc-in-2 right? |
| 21:32 | chouser | well, you don't really want it hard-coded. later you'll be wanting to use sorted-map-by with your own comparator |
| 21:32 | alexyk | so we're talking a special namespace for those |
| 21:32 | devlinsf | chouser: I'm gonna get this ... |
| 21:32 | chouser | devlinsf: :-) |
| 21:33 | alexyk | chouser: but is assoc-in-2 is called in a loop, and it defines m all the time... ah wait, you mean extra parameter, caller will def it? |
| 21:37 | devlinsf | chouser: There's no get-entry fn or method |
| 21:37 | devlinsf | My best answer is to go back to the let version, and add a contains check if required |
| 21:37 | chouser | devlinsf: 'find' |
| 21:38 | devlinsf | find? |
| 21:38 | devlinsf | hmmm. |
| 21:38 | devlinsf | Ah! |
| 21:38 | devlinsf | Hmmm |
| 21:39 | chouser | you don't like a constant? |
| 21:39 | devlinsf | me? |
| 21:39 | clojurebot | your name is clojurebot |
| 21:39 | chouser | (assoc-in-by m (sorted-map) [1 2 3] :val) |
| 21:40 | devlinsf | Ah |
| 21:40 | devlinsf | A constant might be better |
| 21:40 | devlinsf | I see what you mean now |
| 21:41 | devlinsf | Yes, definitely |
| 21:44 | devlinsf | chouser: renamed associn-by to assoc-in-as |
| 21:54 | alexyk | devlinsf: lovely! -as is a bit confusing. is there a short -default suffix? |
| 21:55 | alexyk | assoc-in-with? |
| 21:55 | clojurebot | http://clojure-log.n01se.net/date/2008-11-21.html#13:04 |
| 21:55 | devlinsf | Hmmm... I don't see why not |
| 21:56 | devlinsf | alexyk: Done |
| 21:57 | alexyk | cool! |
| 21:57 | devlinsf | Hmmm... how often does this problem occur? |
| 21:58 | devlinsf | Anyone? |
| 21:59 | chouser | wanting something other than a hash-map for assoc-in? |
| 21:59 | devlinsf | chouser: Yeah |
| 21:59 | chouser | This is the first I've heard someone ask for it. |
| 21:59 | Raynes | What is that emacs mode that highlights the paren you're cursor is on, and the paren that matches it? |
| 21:59 | Raynes | your* |
| 21:59 | Raynes | /spellfail |
| 22:00 | devlinsf | chouser: Hmmm... okay |
| 22:00 | devlinsf | The gist will be there, and if it comes up again it should help |
| 22:00 | devlinsf | Should need to go no further |
| 22:01 | chouser | well, it seems a reasonable feature to have |
| 22:01 | chouser | and it would actually fit right into 'assoc-in', it doesn't need a new fn |
| 22:01 | devlinsf | Not quite |
| 22:01 | clojurebot | make a note of http://scienceblogs.com/goodmath/2006/11/the_c_is_efficient_language_fa.php it is yet another article about picking c or c++ for performance being naive |
| 22:01 | alexyk | devlinsf: chouser: they don't ask 'cause they don't deal with the twitter graph analysis. you'd be tired to sort it for every view. |
| 22:02 | devlinsf | chouser: What if a map is a key |
| 22:03 | chouser | devlinsf: assoc-in only take 3 args, yours takes 4 |
| 22:03 | devlinsf | chouser: Oh, right Mistook the [k & ks] as variadic |
| 22:06 | alexyk | then we'll need the sistyer update-in-with and stick it into core! |
| 22:06 | alexyk | sister |
| 22:07 | alexyk | or c.c.vivify or something |
| 22:08 | devlinsf | alexyk: Update-in is trickier |
| 22:09 | devlinsf | I'll throw the idea on the main list, feel free to add your thought alexyk |
| 22:09 | alexyk | sure |
| 22:59 | dabd | is there a reason for Clojure changing types of data structures? e.g. two vectors returns a list instead of a vector |
| 22:59 | dabd | concat |
| 23:00 | hiredman | ,(doc concat) |
| 23:00 | clojurebot | "([] [x] [x y] [x y & zs]); Returns a lazy seq representing the concatenation of the elements in the supplied colls." |
| 23:02 | devlinsf | dabd: It has to do with lazynes |
| 23:02 | dabd | ok. and a seq is a logical list |
| 23:02 | devlinsf | Also, it produces a more predicable api |
| 23:03 | dabd | how do you concatenate two vectors without producing "intermediate" lists? |
| 23:04 | devlinsf | You mean vectors in, vectors out? |
| 23:04 | dabd | yes |
| 23:04 | hiredman | ,(into [] [1 2 3 4] [5 6 7 8]) |
| 23:04 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: core$into |
| 23:04 | devlinsf | (into [] (concat ...)) |
| 23:04 | devlinsf | Maybe reduce could do the job |
| 23:05 | hiredman | oh |
| 23:05 | hiredman | duh |
| 23:05 | dabd | but that produces a lazy seq before creating the final vector |
| 23:05 | hiredman | ,(into [1 2 3 4] [5 6 7 8]) |
| 23:05 | clojurebot | [1 2 3 4 5 6 7 8] |
| 23:05 | devlinsf | ,(reduce #(conj [1 2 3] %) [4 5 6]) |
| 23:05 | clojurebot | java.lang.IllegalArgumentException: Wrong number of args passed to: sandbox$eval--4937$fn |
| 23:05 | devlinsf | Right, duh |
| 23:05 | dabd | how to do it without laziness? |
| 23:06 | hiredman | ,(into [1 2 3 4] [5 6 7 8]) |
| 23:06 | clojurebot | [1 2 3 4 5 6 7 8] |
| 23:08 | dabd | hiredman: that was what I meant. thx |
| 23:17 | hiredman | http://www.lambdassociates.org/blog/klambda.htm hohoho |