2010-03-25
| 00:00 | defn | brandonw: you may well be right, and your solution is fine |
| 00:00 | defn | im just curious |
| 00:00 | brandonw | yeah, it seems like the destructuring docs of let says that you can only destructure a vec on anything that supports nth |
| 00:01 | brandonw | so if you have a map as an input, you wouldn't be able to destructure it into a vec |
| 00:02 | brandonw | your best bet would be to destructure the specific value you want, and then wrap it in a vector in an additional binding |
| 00:02 | brandonw | ,(let [{i :foo} {:foo {:bar 1 :baz 2}} output-val [i]] i) |
| 00:02 | clojurebot | {:bar 1, :baz 2} |
| 00:02 | brandonw | hmm that didn't work |
| 00:03 | brandonw | oh right |
| 00:03 | brandonw | ,(let [{i :foo} {:foo {:bar 1 :baz 2}} output-val [i]] output-val) |
| 00:03 | clojurebot | [{:bar 1, :baz 2}] |
| 00:05 | brandonw | http://pastie.org/885990 |
| 00:05 | brandonw | with a little better indentation and a def to make it more concise |
| 00:06 | brandonw | {i :foo} grabs the value mapped to the :foo key in test-val |
| 00:06 | defn | brandonw: im sorry if this is a poor quesiton but im still abit lost on how to implement it |
| 00:06 | defn | let's say we have... |
| 00:06 | brandonw | binding output-val to [i] just wraps that val in a vector |
| 00:06 | brandonw | and then you can return the vector |
| 00:06 | defn | ,(def k 5) |
| 00:06 | clojurebot | DENIED |
| 00:06 | defn | ah darn |
| 00:06 | brandonw | yeah, no defs in clojurebot |
| 00:06 | brandonw | except in a let :P |
| 00:07 | brandonw | unless hiredman fixed it...? |
| 00:07 | defn | brandonw: i have learned that probably a 1000 times, but there is always the hope :) |
| 00:07 | brandonw | ,(let [f (def x 1)] f) |
| 00:07 | clojurebot | DENIED |
| 00:07 | brandonw | yes he did! :) |
| 00:08 | defn | brandonw: so let's say you have {:x {:y 1 :z 2}, :xx {:yy 3 :zz 4}} |
| 00:09 | defn | how would you create a [{:y 1 :z 2} {:yy 3 :zz 4}] with destructuring -- my first thought is an anonymous function maybe? |
| 00:10 | shales | brandonw: looking at the special forms page, I think that :ivec is just one of the keys in the init-expr map that follows, just as :j and :k are. It's not a special part of let's syntax. |
| 00:10 | defn | shales: good catch, thanks |
| 00:11 | brandonw | (let [{out1 :x out2 :xx} {:x {:y 1 :z 2} :xx {:yy 3 :zz 4}} full-output [out1 out2]] full-output) |
| 00:11 | brandonw | ,(let [{out1 :x out2 :xx} {:x {:y 1 :z 2} :xx {:yy 3 :zz 4}} full-output [out1 out2]] full-output) |
| 00:11 | clojurebot | [{:y 1, :z 2} {:yy 3, :zz 4}] |
| 00:11 | brandonw | shales: thanks, i thought i had missed something |
| 00:11 | brandonw | defn: wrapping a vector around two keys isn't possible in the destructuring, i don't think |
| 00:12 | defn | im trying to get a big map which is structured like the above |
| 00:12 | brandonw | you can destructure the two individual keys in a binding, but in order to wrap them in a vector, you need to explicitly create a vector with the two previously bound keys |
| 00:12 | defn | and turn it into [{:x 1 :y 2} {:xx 3 :yy 4}...] |
| 00:12 | brandonw | basically, if you have a map as your input, you can't destructure and end up with a vec i don't think |
| 00:13 | brandonw | right, i don't think you can destructure directly into that |
| 00:13 | brandonw | i think the closest you can get is destructuring into the {:x 1 :y 2} and {:xx 3 :yy 4} as two separate values |
| 00:13 | brandonw | and then create a vec inside that binding |
| 00:13 | brandonw | err in the scope of that binding |
| 00:14 | defn | heh -- i need to get my head straight |
| 00:14 | clojurebot | the world <reply>what the world needs is more higher order functions |
| 00:17 | shales | defn: if you just want a vector of all the values of a map you can do (vec (keys m)) |
| 00:17 | shales | ,(vec (vals {:x {:y 1 :z 2}, :xx {:yy 3 :zz 4}})) |
| 00:17 | clojurebot | [{:y 1, :z 2} {:yy 3, :zz 4}] |
| 00:18 | defn | bahahaha |
| 00:18 | defn | shales: thanks |
| 00:18 | brandonw | yep, that would definitely be much easier :) |
| 00:18 | brandonw | that isn't technically destructuring though, right? |
| 00:18 | defn | brandonw: thanks for indulging my stupidity |
| 00:18 | defn | :) |
| 00:18 | brandonw | we're all learning :) |
| 00:19 | shales | no it's not destructuring at all |
| 00:19 | brandonw | i liked going through that just for the sake of getting some practice with destructuring |
| 00:19 | brandonw | i haven't had a reason to use it yet... i don't think... |
| 00:19 | shales | yeah, I've not destructured a map yet either |
| 00:20 | defn | me either! :) |
| 00:21 | defn | one really handy one listed in the docs: |
| 00:22 | defn | ,(let [{:keys [:fred :ethel :lucy]} m] m) |
| 00:22 | clojurebot | java.lang.Exception: Unsupported binding form: :lucy |
| 00:22 | defn | ,(let [{:keys [fred ethel lucy]} m] m) |
| 00:22 | clojurebot | java.lang.Exception: Unable to resolve symbol: m in this context |
| 00:22 | defn | why god, why? |
| 00:22 | brandonw | the name you want to bind to comes first in a map binding |
| 00:23 | brandonw | plus, you need to have m defind as something |
| 00:23 | brandonw | :) |
| 00:23 | defn | brandonw: :keys is a directive |
| 00:23 | defn | http://clojure.org/special_forms |
| 00:23 | brandonw | ohhhh right |
| 00:23 | brandonw | oh interesting |
| 00:23 | brandonw | so you could get what you originally wanted, a vector of the keys in a destructuring |
| 00:23 | brandonw | cool! |
| 00:24 | defn | ,(let [m {:keys [fred ethel lucy]}] m) |
| 00:24 | clojurebot | java.lang.Exception: Unable to resolve symbol: fred in this context |
| 00:24 | defn | if i knew how to tie my shoes... |
| 00:26 | brandonw | actually nevermind |
| 00:27 | brandonw | that only allows you to basically do what i did, without having to do {t1 :x t2 :xx} |
| 00:27 | brandonw | instead you can just do {:keys [t1 t2]} |
| 00:27 | shales | yeah, just avoids redundancy |
| 00:27 | brandonw | ,(let [{t1 :x t2 :y} {:x "hello" :y "goodbye"}] [t1 t2]) |
| 00:27 | clojurebot | ["hello" "goodbye"] |
| 00:28 | brandonw | ,(let [{:keys [t1 t2] {:x "hello" :y "goodbye"}] [t1 t2]) |
| 00:28 | clojurebot | Unmatched delimiter: ] |
| 00:28 | brandonw | ,(let [{:keys [t1 t2]} {:x "hello" :y "goodbye"}] [t1 t2]) |
| 00:28 | clojurebot | [nil nil] |
| 00:28 | brandonw | hmm |
| 00:29 | brandonw | ,(let [{:keys [t1 t2]} {:t1 "hello" :t2 "goodbye"}] [t1 t2]) |
| 00:29 | clojurebot | ["hello" "goodbye"] |
| 00:29 | brandonw | there we go |
| 00:29 | shales | keys in the map must be keywords with the same name |
| 00:29 | shales | yep |
| 00:29 | brandonw | forgot you had the values in the vector have to be the same as the keywords |
| 00:30 | brandonw | clojure is fun |
| 00:30 | brandonw | too bad i can't use it at work yet |
| 00:31 | shales | there's similar directives for keys that are symbols or strings too |
| 00:31 | shales | ,(let [{:syms [t1 t2]} {'t1 "hello" 't2 "goodbye"}] [t1 t2]) |
| 00:31 | clojurebot | ["hello" "goodbye"] |
| 00:31 | fanatico | just need to convince them that you want to use a new Java library called "clojure" ;) |
| 00:31 | brandonw | :( |
| 00:31 | shales | ,(let [{:strs [t1 t2]} {"t1" "hello" "t2" "goodbye"}] [t1 t2]) |
| 00:31 | clojurebot | ["hello" "goodbye"] |
| 00:31 | brandonw | i don't even use java at work yet :( |
| 00:31 | brandonw | heck, i'm making a web app and we don't even use an mvc framework yet |
| 00:32 | fanatico | brandonw: php? |
| 00:32 | shales | What doesn't this print anything? (.start (Thread. (fn [] (println "Other thread" (Thread/currentThread))))) |
| 00:32 | brandonw | c# asp.net forms :( |
| 00:32 | brandonw | wow it is already 12:30 i should be asleep |
| 00:32 | brandonw | good night |
| 00:32 | zaphar_ps | use the clr library named clojure then :-) |
| 00:33 | brandonw | well we are going to port everything over to java eventually |
| 00:33 | brandonw | but we just need to finish it so it can replace the crap that is in use now |
| 00:33 | brandonw | which would do pretty well on the dailywtf i think :) |
| 00:33 | brandonw | goodnight |
| 00:33 | zaphar_ps | just think of all the code that will port over unchanged if it was in clojure |
| 00:33 | bmason | I notice in the compojure source some "defn-" calls... what's the difference between this and "defn" ? |
| 00:34 | shales | defn- is private |
| 00:34 | zaphar_ps | defn- make s a private function |
| 00:34 | shales | although I'm not sure what the implications are |
| 00:34 | bmason | so not accessible to things using/referring to the namespace? |
| 00:34 | zaphar_ps | it won't get exported when the namespace is used/required |
| 00:34 | bmason | cool cool |
| 00:34 | bmason | good to know |
| 00:35 | bmason | hmm, would be kinda nice to have a reader macro for that |
| 00:35 | zaphar_ps | basically it just does (with-meta fun {:private true}) to the function |
| 00:36 | zaphar_ps | bmason: |
| 00:36 | bmason | gotcha |
| 00:37 | zaphar_ps | which you can do with the #^{:private true} reader macro to shorten a bit |
| 00:38 | zaphar_ps | you can do a lot of fun stuff with metadata on clojure code |
| 00:38 | zaphar_ps | :-) |
| 00:38 | bmason | I guess that's not too bad |
| 00:39 | bmason | in fact more descriptive than C++'s "private" |
| 00:39 | zaphar_ps | lol |
| 00:39 | bmason | since you're explicitly setting meta data |
| 00:40 | bmason | instead of performing some *magic* |
| 00:43 | shales | hmm, when I run this in my slime repl (.start (Thread. (fn [] (println "Other thread" (Thread/currentThread))))), nothing is printed. Running the same thing in a command line repl does print the "Other thread" message. |
| 00:45 | shales | why would that be? |
| 00:45 | zaphar_ps | shales: the command line repl's threads all go to the same stdout |
| 00:45 | bmason | did you check your inferior lisp buffer? |
| 00:45 | bmason | I've had stuff come out on that |
| 00:45 | shales | bingo! |
| 00:45 | zaphar_ps | but the swank repl's spawned thread goes to the lein-swank buffer probably |
| 00:46 | zaphar_ps | heh bmason beat me to it |
| 00:46 | zaphar_ps | inferiror lisp buffer in your case since mine is a little customized |
| 00:47 | shales | that's good to know. Thought I was going a little crazy |
| 00:47 | bmason | yeah, it had me scratching my head |
| 00:47 | zaphar_ps | it's because swank sets up a special *out* for slime but your thread didn't use it |
| 00:47 | shales | Know how to direct the stdout to the same buffer? |
| 00:47 | bmason | emacs has taken some getting used to |
| 00:48 | zaphar_ps | shales: not off the top of my head I'm not sure if the two threads can share the same *out* var |
| 00:49 | bmason | you should be able to bind *out* to the correct stream, I would think |
| 00:49 | bmason | but I'm not sure how you would identify the correct stream |
| 00:49 | shales | had same idea. this works: (.start (let [out *out*] (Thread. (fn [] (binding [*out* out] (println "Other thread" (Thread/currentThread))))))) |
| 00:49 | zaphar_ps | bmason: capture the value of *out* in the first thread and use it in second thread |
| 00:50 | bmason | shales: check out with-out-str |
| 00:50 | bmason | oh, actually that's a nice one shales |
| 00:51 | bmason | makes sense |
| 00:57 | shales | ah, similar story for *err* |
| 00:59 | shales | but Thread.run catches and prints exceptions to stderr _outside_ the binding in the function. Don't think I can do anything about that one except catch and print all exceptions. |
| 01:14 | defn | How would I merge something like [{:count 2 :country "US"} {:count 5 :country "US"} {:count 4 :country "DK"} ...] so it would be [{:count 7 :country "US"} {:count ...}...] |
| 01:16 | defn | in other words, combine all the maps which contain :country "US", reducing on the val of :count |
| 01:23 | hiredman | defn: your maps are wrong |
| 01:23 | hiredman | they should be {"US" 2} {"DK" 4} etc |
| 01:23 | hiredman | merge-with + |
| 01:24 | defn | hiredman: this is a slow evolution of a structure |
| 01:24 | hiredman | well, it's wrong :) |
| 01:25 | defn | originally it was like {:ip-address {:count 5 :country "US"} :ip-address-b {:count 3 :country "RU"}...} |
| 01:25 | defn | err actually it was originally {:ip-address 5, :ip-address-b :3} |
| 01:25 | defn | then i added countries into the map, then i removed the ip address from the map, blah blah -- it's wrong! :) |
| 01:25 | defn | i think i need to rewrite all of this because this is clearly garbage |
| 01:26 | hiredman | (apply hash-map ((juxt [:country :count]) {:country "US" :count 1})) |
| 01:27 | hiredman | ,(apply hash-map ((juxt [:country :count]) {:country "US" :count 1})) |
| 01:27 | clojurebot | java.lang.IllegalArgumentException: Key must be integer |
| 01:27 | hiredman | er |
| 01:27 | hiredman | ,(apply hash-map ((juxt [country :count) {:country "US" :count 1})) |
| 01:27 | clojurebot | Unmatched delimiter: ) |
| 01:27 | hiredman | gah! |
| 01:27 | hiredman | anyway, if you writing it correctly it will work |
| 01:29 | hiredman | your data is your schema, and schemas evolve |
| 01:30 | defn | my end goal here is to make a bar graph with incanter which shows the number of instances of IPs from all of the country codes, and then in a key have all of the IPs and the number of times they each occurred somewhere beside it in a key or something |
| 01:30 | hiredman | you could just it do with reduce |
| 01:34 | hiredman | ,(reduce (fn [a {:keys [country count]}] (merge-with + a {country count})) {} [{:count 2 :country "US"} {:count 5 :country "US"} {:count 4 :country "DK"}]) |
| 01:34 | clojurebot | {"DK" 4, "US" 7} |
| 01:39 | hiredman | ,(map (fn [[country count]] {:country country :count count}) {"DK" 4, "US" 7}) |
| 01:39 | clojurebot | ({:country "DK", :count 4} {:country "US", :count 7}) |
| 01:48 | defn | hiredman: thanks man -- that's very helpful |
| 02:45 | ihodes | hey all, I'm a bit of a Clojure newbie (coming from Java and some scheme and Python...) and am having trouble converting a list of strings to a list of chars (strings include "a" "{" etc) |
| 02:45 | ihodes | could someone please point me in the right direction? |
| 02:46 | hoeck | ,(map seq ["a", "a-{", ")-"]) |
| 02:46 | clojurebot | ((\a) (\a \- \{) (\) \-)) |
| 02:47 | hoeck | ,(mapcat seq ["a", "a-{", ")-"]) |
| 02:47 | clojurebot | (\a \a \- \{ \) \-) |
| 02:47 | hoeck | ihodes: ^^ is that what you want? |
| 02:47 | ihodes | that's superb! thanks! |
| 02:48 | hoeck | np :) |
| 02:48 | ihodes | how does that work? looks somewhat tricky |
| 02:50 | hoeck | ,(seq "my String") |
| 02:50 | clojurebot | (\m \y \space \S \t \r \i \n \g) |
| 02:50 | ihodes | ah, of course... haha thank you so much! |
| 02:50 | hoeck | seq returns a sequence of characters from a string |
| 02:50 | hoeck | and mapcat calls seq on each string in the vector and concatenates the result |
| 02:51 | ihodes | that makes sense |
| 02:51 | ihodes | i've got one more question – i can convert from char to an int, but back to a char from int is proving more difficult without trusty typecasting–is there a nice way to do that? |
| 02:52 | hiredman | ,(char 98) |
| 02:52 | clojurebot | \b |
| 02:52 | defn | how many core clojure fns are there nowadays? |
| 02:52 | ihodes | ,(int \a) |
| 02:52 | clojurebot | 97 |
| 02:52 | ihodes | splendid :) thanks! |
| 02:53 | hiredman | clojurebot: ping? |
| 02:53 | clojurebot | PONG! |
| 02:53 | defn | ,(count (ns-publics 'clojure.core)) |
| 02:53 | clojurebot | 503 |
| 02:53 | defn | is that right? 500 core clojure fns? |
| 02:55 | hiredman | ,((ns-publics 'clojure.core) '*print-level*) |
| 02:55 | clojurebot | #'clojure.core/*print-level* |
| 02:55 | hiredman | not a fn |
| 02:55 | defn | ah right |
| 02:55 | defn | lots of special vars and such in there |
| 02:55 | hiredman | not that many |
| 02:57 | _ato | ,(count (filter #(and (.isBound %) (fn? @%)) (map val (ns-publics 'clojure.core)))) |
| 02:57 | clojurebot | 464 |
| 02:57 | defn | ,(count (filter () (ns-publics 'clojure.core))) gah beat me to it |
| 02:57 | clojurebot | java.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn |
| 03:04 | ihodes | hmmm... how can you convert a list of chars to a String? (java.lang.String. '(\a \b \c)) doesn't work, nor does (str '(\a \b \c)) or mapcat str |
| 03:05 | hiredman | why would (String. '(\a \b \c)) work? |
| 03:05 | hiredman | ~jdoc String |
| 03:06 | ihodes | because you can construct a String from an array of chars, right? thought it was worth a try |
| 03:06 | hiredman | a list is not an array |
| 03:06 | hoeck | ,(apply str '(\a \b \c)) |
| 03:06 | clojurebot | "abc" |
| 03:06 | ihodes | that's true, but as i'm new to clojure, i wasn't sure if it'd correctly convert :\ was worth a try. |
| 03:06 | robink | Hello |
| 03:07 | hoeck | hi robink |
| 03:07 | ihodes | thanks hoek – that, again, makes sense. i need to get the right mindset here. |
| 03:10 | hoeck | ihodes: a list would work if the java.lang.String constructor allowed java collections of Chars |
| 03:10 | ihodes | ah ok, so I could, hypothetically, "convert" the collection to an array and then use String. that way? |
| 03:10 | ihodes | though, obviously, using apply makes more sense |
| 03:14 | _ato | ,(String. (char-array [\a \b \c])) |
| 03:14 | clojurebot | "abc" |
| 03:14 | hoeck | ,(String. (into-array Character/TYPE '(\a \b))) |
| 03:14 | clojurebot | "ab" |
| 03:15 | hoeck | char-array is new to me :) |
| 03:25 | ihodes | oh neat |
| 03:28 | ihodes | so if i have a list of string, is there a better way of making them into chars than (map seq '("a" "1" "3"))? that gives me a nasty list of lists deal |
| 03:29 | hoeck | ihodes: with mapcat you get one big list of all chars |
| 03:29 | _ato | ,(mapcat seq ["a" "1" "3"]) ; as hoeck demoed above ;-) |
| 03:29 | clojurebot | (\a \1 \3) |
| 03:30 | ihodes | gah, so sorry. i need to get some sleep. thank you all so much–i'll idle around here in the fture so i can help future newbies and save you the trouble :) |
| 03:31 | hoeck | :) |
| 03:32 | LauJensen | Morning guys |
| 03:38 | defn | morning lau |
| 03:41 | zmila | good |
| 03:42 | defn | how to turn ({:x 1} {:x 2}) into [{:x 1} {:x 2}] |
| 03:43 | noidi | ,(into [] (list {:x 1} {:x 2})) |
| 03:43 | clojurebot | [{:x 1} {:x 2}] |
| 03:43 | hiredman | (doc vec) |
| 03:43 | clojurebot | "([coll]); Creates a new vector containing the contents of coll." |
| 03:44 | defn | (doc vector) |
| 03:44 | clojurebot | "([] [& args]); Creates a new vector containing the args." |
| 03:44 | noidi | ah, right |
| 03:44 | defn | ah, that's where i went wrong |
| 03:44 | LauJensen | ,(vec '({:x 1} {:y 2})) |
| 03:44 | clojurebot | [{:x 1} {:y 2}] |
| 03:45 | defn | (vector '({:x 1})) |
| 03:45 | LauJensen | Would be considered more idiomatic |
| 03:45 | defn | ,(vector '({:x 1})) |
| 03:45 | clojurebot | [({:x 1})] |
| 03:45 | defn | ,(vec '({:x 1})) |
| 03:45 | clojurebot | [{:x 1}] |
| 04:10 | defn | anyone familiar with incanter? |
| 04:10 | defn | im trying to build a histogram using [{:x 1} {:y 2} {:z 3}] |
| 04:12 | defn | (doto (incanter.charts/histogram (keys (above-structure)) :legend true) view (incanter.charts/add-histogram (vals (above-structure)))) |
| 04:14 | Chousuke | is the histogram object mutable? :/ |
| 04:15 | defn | im just going off of the example here |
| 04:41 | Licenser | defn: greetings, I'll have to run for work in a few but I'll fix the walton thing today |
| 04:43 | mitkok | Hey, guys. Just installed swank-clojure from ELPA, but when I run slime on clj file it fires the repl with error : https://gist.github.com/5f1f24a67550ca0bb4c6 |
| 04:43 | defn | Licenser: no worries |
| 04:43 | defn | Licenser: have you worked with incanter at all by chance? |
| 04:45 | Licenser | Nope never used it |
| 04:45 | _ato | mitkok: how are you runng slime? just M-x slime? take a look into ~/.swank-clojure -- you should have 3 jars: clojure, clojure-contrib and swank |
| 04:46 | defn | bah this is driving me nuts |
| 04:47 | mitkok | _ato: Yep, just 'slime'. I have those three under ~/.swank_clojure |
| 04:50 | _ato | hmm |
| 04:51 | _ato | mitkok: maybe try doing this from the command-line just to check it: java -cp "$HOME/.swank-clojure/*" clojure.main -e "(use 'swank.swank)(-main)" |
| 04:51 | Linnk | Hey guys, just started going through the Clojure reference to learn the language. Does #^ always designate a hashmap? |
| 04:51 | defn | Licenser: {} is a hash map |
| 04:51 | defn | err Linnk: {} is a hash map |
| 04:51 | Licenser | I was about to ask why you tell me that :P |
| 04:52 | Linnk | Hehe :P |
| 04:52 | defn | #^ is a type hint, Linnk |
| 04:52 | defn | (defn my-fn [#^String some-text] (println some-text)) |
| 04:53 | Linnk | defn: Aha, that explains a lot |
| 04:53 | mitkok | _ato: I was $CLOJURE_EXT=~/.clojure ( there were my clojure jars ), but when I remove it gives me the same error as executing your command: https://gist.github.com/b755bae0059c4d44db12 |
| 04:55 | Licenser | #^ is helpfull if you need performance in java interop |
| 04:55 | Licenser | it makes it way faster ;) defn can sing a song about that I guess |
| 04:56 | _ato | mitmok: that's strange, so from the command-line it can't find the jars at all. What version are the jars you have in ~/.swank-clojure and what version of java do you have? |
| 04:56 | _ato | I have: % ls ~/.swank-clojure |
| 04:56 | _ato | clojure-1.1.0-master-20091202.150145-1.jar clojure-contrib-1.1.0-master-20091212.205045-1.jar swank-clojure-1.1.0.jar |
| 04:57 | mitkok | _ato: the same as you, java version "1.6.0_18" |
| 04:57 | mitkok | _ato: may be I need to set path or classpath or something, I\m pretty new |
| 04:58 | _ato | you normally shouldn't need to add any configuration to emacs |
| 04:58 | _ato | and that java command I asked you to run should have worked |
| 04:58 | _ato | hmmm |
| 05:04 | defn | weird -- Incanter doesnt show anything in the frames it creates |
| 05:05 | _ato | mitkok: 'fraid I'm out of ideas. Unless perhaps you've got some corrupt jars. http://gist.github.com/343335 |
| 05:05 | _ato | I guess you could try deleting ~/.swank-clojure and rerunning M-x slime so it downloads them again |
| 05:09 | mitkok | _ato: I've deleted the dir and the reinstall it from emacs, same error :( |
| 05:10 | _mst | 'java -jar ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar' might be good for a giggle too |
| 05:12 | defn | man this is weird |
| 05:12 | defn | incanter just refuses to produce any image in the frame it creates |
| 05:12 | mitkok | _mst: Invalid or corrupt jarfile clojure... |
| 05:14 | _mst | ah hah! interesting :) what does 'file ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar' think it is? |
| 05:16 | mitkok | _mst: Zip archive data, at least v1.0 to extract |
| 05:17 | _ato | truncated maybe? |
| 05:17 | _mst | hm, so there's at least a zip file header there :) |
| 05:17 | _mst | yeah, I wonder |
| 05:18 | _mst | does 'jar tvf ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar' report any errors? |
| 05:19 | mitkok | _mst: java.util.zip.ZipException: invalid END header (bad central directory offset) |
| 05:19 | _mst | ah, yick :) so it does look like those .jar files are corrupt |
| 05:20 | _ato | perhaps delete them and download manually: wget http://build.clojure.org/releases/org/clojure/clojure/1.1.0/clojure-1.1.0.jar http://build.clojure.org/releases/org/clojure/clojure-contrib/1.1.0/clojure-contrib-1.1.0.jar http://clojars.org/repo/swank-clojure/swank-clojure/1.1.0/swank-clojure-1.1.0.jar |
| 05:22 | mitkok | at last, it's working :) |
| 05:23 | mitkok | thanks _mst and _ato :) |
| 05:23 | _mst | huzzah |
| 05:23 | _ato | :) |
| 05:25 | defn | uh oh |
| 05:27 | esj | indeed ! |
| 05:52 | licoresse | Can I undefine something in the repl? |
| 05:56 | hoeck | licoresse: (ns-unmap (find-ns 'the-namespace) 'the-symbol) |
| 05:56 | Chousuke | ns-unmap can help |
| 05:57 | hoeck | or (ns-unmap *ns* 'blah) |
| 05:57 | licoresse | great |
| 06:34 | bb_oz | so - anyone else new to clojure? |
| 06:36 | zmila | me new :) |
| 06:36 | zmila | relatively |
| 06:37 | bb_oz | why clojure? |
| 06:39 | underdev | power, sumplicity, java integration |
| 06:39 | zmila | "why" for whom? for me or for you? |
| 06:39 | underdev | simplicity |
| 06:40 | bb_oz | sorry - 'why' for you |
| 06:40 | bb_oz | simplicity is one. STM is another |
| 06:40 | Linnk | <- barely started, so kinda' new |
| 06:42 | cypher23 | bb_oz, Power, Flexibility, Concurrency |
| 06:42 | marten | for me, because i wanted something functional, and lisp is a mess with way to many implementations, and haskell is too impractical with its purity |
| 06:42 | marten | s/lisp/common lisp/ |
| 06:45 | bb_oz | @marten: lisp. Had been toying with sbcl and ccl for a while. beautiful. |
| 06:53 | bb_oz | I was actually hopeful about abcl, but was unsure about the java 'match' |
| 06:54 | underdev | you just can't beat clojure's integration |
| 06:55 | bb_oz | it certainly appears to be that way. I'll shed a tear for CL though :) |
| 06:57 | underdev | its hard to compare a language spec designed in the 80s with one in the late 2ks |
| 06:58 | underdev | must have been the 80s, because i first used allegro CL in 91 |
| 07:01 | bb_oz | lisp language spec is much older than the 80's |
| 07:01 | bb_oz | and clojure is a lisp-1 :) |
| 07:04 | Chousuke | Sometimes it feels like the fact that lisp is standardised is holding it back |
| 07:04 | Chousuke | CL, I mean |
| 07:05 | underdev | yeah, 1956 i believe |
| 07:05 | underdev | i meant CL |
| 07:06 | bb_oz | @underdev: ah ok - sorry :) |
| 07:06 | Chousuke | the standard is missing many things that are needed in a modern language, and then those things are implemented differently between implementations, which is counterproductive. |
| 07:06 | underdev | well, you could almost feel the lightbulbs going off in the crowd when rich was doing the "Clojure for lisp programmers" talk when he was discussing programming to abstract sequences instead of reified lists |
| 07:07 | bb_oz | @chousuke: clojure should see a lot more development. There's a few books out there as well. |
| 07:07 | Chousuke | bb_oz: Clojure's still fairly young as programming languages go, though. |
| 07:12 | underdev | my only reservation coming to clojure was that there is so much syntatic sugar (i've spent a decade in tcl, where there is exactly one grain of it). I thought i would be avoiding it, but it turns out i like it. |
| 07:12 | underdev | usually |
| 07:13 | underdev | i've seen a few functions that look "write only" to me, but very few |
| 07:13 | Chousuke | I really don't see most things in clojure as syntactic sugar anymore :P |
| 07:13 | bb_oz | so what are you using clojure for in your profession? |
| 07:14 | Chousuke | #() is, though. |
| 07:14 | Chousuke | but the syntax for vectors and maps isn't sugar, it's necessary. |
| 07:14 | underdev | to a tcl programmer '() is syntactic sugar :) |
| 07:14 | Linnk | #^{} is weird too, for a beginner :) |
| 07:15 | Chousuke | Linnk: that's kind of required too. there's no other way to attach read-time metadata to symbols |
| 07:15 | underdev | (list 1 2 3) (vector 1 2 3) (map :foo "bar") |
| 07:15 | underdev | not necessary |
| 07:15 | Chousuke | underdev: those are not equivalent to the [] versions |
| 07:16 | Chousuke | you can't do (defn foo (vector a b c) ...) |
| 07:16 | underdev | oic. like i said, i thought i wouldn't like it, but i do, and use them |
| 07:16 | underdev | :) |
| 07:16 | Chousuke | you'd need (defn foo #=(vector 'a 'b 'c) ...) :P |
| 07:17 | underdev | one could conceive of a clojure in which they aren't necessary, at least :) |
| 07:17 | Chousuke | hm, probably without quotes though. I forget it's the reader |
| 07:17 | Linnk | Chousuke: probably right, but it's not very verbose (not implying that verbosity is a good thing), so it took me some time to understand what it actually meant |
| 07:17 | Chousuke | underdev: well, yes. But I like having more syntax elements than just lists :) |
| 07:18 | Chousuke | underdev: it allows you to write more expressive macros for oen |
| 07:18 | Chousuke | one* |
| 07:18 | underdev | rt. i didn't think i would, but i do too |
| 07:19 | underdev | i love the time i spent programming in perl, but it scared my psyche somehow |
| 07:19 | underdev | HOMOGENY! GIVE ME HOMOGENY!!! |
| 07:19 | spariev | lol :) |
| 07:19 | Chousuke | the simplicity of having just lists is appealing, I admit, but the pragmatic benefits of vectors and maps as part of syntax outweighs giving up that simplicity. |
| 07:20 | underdev | Chousuke: agreed |
| 07:20 | zmila | missing one more brace-type for sets :) maybe <:a :b :c> instead of #{:a :b :c} |
| 07:21 | Chousuke | zmila: nah, those need to stay as symbol characters because of > and < |
| 07:21 | Chousuke | and others |
| 07:22 | bb_oz | goodnight people |
| 07:32 | dmiles_afk | i been imlmenting a full common lisp in java.. unlike ABCL i dont use java object ypes... i use interfaces... |
| 07:32 | underdev | neat! so what do YOU think of clojure? |
| 07:32 | dmiles_afk | my hope is sometimes i can go thru clojures code and add this LispString LispSequence interfaces to clojures objects |
| 07:33 | dmiles_afk | well i like its invokation syntax |
| 07:33 | dmiles_afk | well i love its invokation syntax |
| 07:34 | dmiles_afk | and the lack of extra work arround using any pre-existing libraries/jarts |
| 07:34 | dmiles_afk | jars |
| 07:34 | dmiles_afk | i actually for a bigish secondlife project use clojures intial prototype |
| 07:35 | underdev | cool. |
| 07:35 | dmiles_afk | so i love it.. but i also like common lisp.. i want both |
| 07:35 | dmiles_afk | i still have a learning curve to leverage certain concurrency features |
| 07:36 | dmiles_afk | what are these thnigns called? |
| 07:37 | underdev | rt |
| 07:38 | Chousuke | dmiles_afk: what things? |
| 07:38 | Chousuke | you mean the reference types? |
| 07:38 | Licenser_ | defn: I think I fixed the no result problem |
| 07:38 | dmiles_afk | sorry other people in house talking to me.. looking it up |
| 07:39 | underdev | Chousuke: i think he was saying.. |
| 07:39 | underdev | nm |
| 07:40 | dmiles_afk | Refs and Transactions |
| 07:40 | underdev | i thought he was trying to say its somewhat hard to pick which reference type and why. not hard, just keeping them sorted out. Haven't needed clojures concurrancy yet |
| 07:41 | dmiles_afk | All reads of Refs will see a consistent snapshot of the 'Ref world' as of the starting point of the transaction (its 'read point'). The transaction will see any changes it has made. This is called the in-transaction-value. |
| 07:41 | dmiles_afk | all tht stuff.. i havent epxored it yet ;) |
| 07:41 | dmiles_afk | but they must be usefull! |
| 07:41 | dmiles_afk | when someone says refernce types my mind goes : Class<Object> |
| 07:41 | dmiles_afk | non pimtives |
| 07:43 | Chousuke | dmiles_afk: there are other reference types besides refs :) |
| 07:44 | dmiles_afk | oh but what i meant is using ibteraces is adding http://larkc.svn.sourceforge.net/viewvc/larkc/branches/LarKC_CommonLisp_Extensions/platform/src/com/cyc/tool/subl/jrtl/nativeCode/type/core/LispObject.java?revision=458&view=markup to clojures holder objects |
| 07:44 | Chousuke | they all have differing concurrency semantics |
| 07:44 | dmiles_afk | ibteraces/interfaces |
| 07:44 | Chousuke | eep. SVN ;( |
| 07:44 | Chousuke | do yourself a favour and learn git :) |
| 07:44 | Chousuke | or any DVCS, really. |
| 07:44 | dmiles_afk | i work from Murcurial.. but LarKC is the downstream |
| 07:45 | underdev | in my current project i finally came up with a workable architecture, where various expert systems with varying degrees of information with be in contention with one another, with observers determining which systems make the better choices... i think i'm going to be needed all that cool concurrancy stuff pretty soon |
| 07:45 | Chousuke | ah, right. |
| 07:45 | zmila | let's start rel-war about hg-git vs svn :) |
| 07:46 | dmiles_afk | http://code.google.com/r/logicmoo-invoke-interface/source/browse/src/com/cyc/tool/subl/jrtl/nativeCode/type/core/LispObject.java?r=78adc38de481044a64f2bbc85b2ef6f62cccb1f1 |
| 07:46 | dmiles_afk | ok DCVS :) |
| 07:46 | underdev | zmila: you mrsn hg vs svn-git, right ? |
| 07:46 | underdev | :) |
| 07:46 | Chousuke | zmila: I can think of *one* scenario where svn ends up being better than git, and that's when you want to store binary files in version control |
| 07:47 | dmiles_afk | oh but the cool part is the common lisp compiler targets anyhting that implments that interface |
| 07:48 | vy | xk |
| 07:48 | dmiles_afk | but there are a ton of helpers to make it easy |
| 07:48 | zmila | yes, git and hg and distributed is ok. but when you are in project whith 30 other people skilled only with svn... |
| 07:48 | dmiles_afk | i mean helper classes so clojure doesnt have to implment all 253 methods for each of its datatype ;) |
| 07:48 | Chousuke | that's a heavy interface :| |
| 07:49 | dmiles_afk | hehe i realized that after i showed it |
| 07:49 | Chousuke | I suppose it approaches the same as Clojure's interfaces, but I don't see why it's all in one |
| 07:49 | dmiles_afk | most are supposed to return a classcast excetiom like toStr() |
| 07:50 | dmiles_afk | toNumber() etc |
| 07:50 | dmiles_afk | so like intValue() is coded as toNumber().intValue() |
| 07:50 | Chousuke | Clojure's interfaces are split up so that for example, to support being invoked as a function you only need to implement IFn |
| 07:51 | dmiles_afk | but most caller expect to hit intValur() in case you are already its right class |
| 07:52 | dmiles_afk | yeah.. that kind of need to be donewith this lisp.. that IFn thing is sane ;P |
| 07:52 | dmiles_afk | oh one more url for you Chousuke: http://code.google.com/r/logicmoo-invoke-interface/source/browse/src/com/cyc/tool/subl/jrtl/nativeCode/type/core/SubLObject.java?r=78adc38de481044a64f2bbc85b2ef6f62cccb1f1 |
| 07:52 | dmiles_afk | that what it will look like when its done |
| 07:53 | dmiles_afk | (LispObject.ava that is will look more like SubLObject.java .. i know i know still heavy) |
| 07:53 | dmiles_afk | but more what you described |
| 07:54 | dmiles_afk | but clojure tightens it up even saner |
| 07:54 | Chousuke | There are probably reasons why the interfaces are so huge, but I can't think of any :P |
| 07:55 | dmiles_afk | to avoid casting.. the compiler already vetted the methodcalls will not throw a abstractimplmentationerror |
| 07:55 | dmiles_afk | which is still legal to emit classes that dont fully implment an interface |
| 07:56 | dmiles_afk | (yet creatable) |
| 07:56 | Chousuke | hmm |
| 07:56 | dmiles_afk | AbstractMethodError is throw i guess |
| 07:56 | Chousuke | Clojure has AFoo things to match IFoo, so you can derive from AFoo to get default implementations |
| 07:57 | Chousuke | and many of the interfaces actually extend the smaller interfaces, so I guess you do end up with a "huge" interface in the end |
| 07:58 | Chousuke | Hm, I wonder where that clojure interface graph chouser did is. |
| 07:58 | dmiles_afk | IFoo and IBar extends IObject but maybe IOjbect isnt as big |
| 07:58 | dmiles_afk | oh but IFoo + IObject is really what IFoo is |
| 07:59 | Chousuke | http://github.com/Chouser/clojure-classes/raw/master/graph-w-legend.png This is how it was at one point, but that's probably fairly out of date |
| 08:00 | dmiles_afk | not horrid .. just well loved |
| 08:01 | dmiles_afk | though StringSeq might be big |
| 08:02 | Chousuke | That graph will have to be updated when protocols start being used seriously though. |
| 08:02 | Chousuke | most of the interfaces will be replaced with protocols I think |
| 08:02 | dmiles_afk | oh diamonds not that big actualy |
| 08:02 | dmiles_afk | one protcol per interface |
| 08:02 | dmiles_afk | +? |
| 08:02 | clojurebot | 5 (for large values of 2) |
| 08:03 | Chousuke | :P |
| 08:03 | dmiles_afk | or on protocal per method? |
| 08:03 | Chousuke | dmiles_afk: probably not exactly. The interfaces might get refactored in the process |
| 08:03 | Chousuke | dmiles_afk: protocols are basically a group of functions |
| 08:03 | dmiles_afk | on/one |
| 08:04 | dmiles_afk | do two protocals share the same functions sometimes? |
| 08:04 | Chousuke | eg. "Sequence" would be a protocol of first, rest at least |
| 08:04 | dmiles_afk | so it might overlap with COns protocol slightly |
| 08:05 | Chousuke | I think the idea is that you're not supposed to think of protocol fns as anything special |
| 08:06 | Chousuke | they're just normal functions; the protocol construct just allows efficiently implementing and extending them to work on numerous types |
| 08:06 | dmiles_afk | ok.. just becaue they share first() it dont mean that first() is some specific expected implmention |
| 08:07 | Chousuke | right. the interface is the clojure function "first". it might be part of a protocol, a multimethod, or a normal function. ideally you shouldn't need to care |
| 08:07 | dmiles_afk | makes sense. just like a java interface |
| 08:08 | Chousuke | protocols can be extended to work on types retroactively though |
| 08:08 | Chousuke | eg. Strings can implement a seq protocol like (extend java.lang.String PSeq {:seq somefn-that-returns-a-string-seq}) |
| 08:09 | dmiles_afk | so can a text file of chars.. |
| 08:09 | Chousuke | currently. there are many ifs in the java source to special-case seq to work on strings and other non-clojure types |
| 08:09 | dmiles_afk | so that means we can construct copy-to simpler? |
| 08:10 | Chousuke | protocols just allow that to be done without a mess of if-elseif-elseif... |
| 08:10 | dmiles_afk | i mnean to copy-from the string sequnce of the file that is a seq of chars |
| 08:10 | Chousuke | dmiles_afk: it wouldn't really change how seq works |
| 08:10 | Chousuke | dmiles_afk: just how it's implemented |
| 08:11 | dmiles_afk | i see.. so what you end up with is map of type<->method |
| 08:11 | dmiles_afk | (maps instead of ifthenelses) |
| 08:11 | Chousuke | kind of. with caching and other performance tricks |
| 08:13 | dmiles_afk | i hink lispers need o be able to do clojure inline to their code easier ;) |
| 08:13 | Chousuke | as a bonus, there's one fewer explicit dependency on the JVM. |
| 08:13 | dmiles_afk | hink |
| 08:13 | dmiles_afk | ttthink |
| 08:13 | dmiles_afk | good point about the dependancies |
| 08:13 | Chousuke | protocols could be implemented on various hosts in various ways |
| 08:16 | dmiles_afk | something i strive for sometimes is .NET.. actally .net provides "events" like VB6 used to |
| 08:17 | dmiles_afk | well basically subscriptions.. java has that.. its avaiblme |
| 08:17 | dmiles_afk | but just not used as pervasivly |
| 08:17 | Chousuke | you mean the delegate/event syntax? |
| 08:18 | dmiles_afk | yeah |
| 08:18 | dmiles_afk | in clojure i can set a field with a IFn? |
| 08:18 | dmiles_afk | and it calls my method when some event happens? |
| 08:19 | Chousuke | dmiles_afk: well, you don't *set* a field in Clojure usually. |
| 08:19 | Chousuke | dmiles_afk: because that's imperative |
| 08:19 | Chousuke | but the reference types do have a watcher mechanism |
| 08:20 | dmiles_afk | oh righ thtat unmodifiable as much as can get away with it |
| 08:20 | dmiles_afk | (more unmodifable now.. the faster it will be later) |
| 08:21 | Chousuke | hopefully :) |
| 08:22 | tomoj | does anyone happen to know the appropriate size for a video screencast to be put on vimeo? |
| 08:22 | dmiles_afk | sometimes the event delegate thing can be overdone. just like too much of anything |
| 08:22 | dmiles_afk | but it makes visualzing a solution for a problem easier at time |
| 08:22 | dmiles_afk | s |
| 08:23 | Chousuke | events are a bit problematic in functional programming though :/ |
| 08:23 | tomoj | frp? |
| 08:24 | AWizzArd | Chousuke: can you please tell me a bit more about what you mean? |
| 08:24 | Chousuke | tomoj: yeah, that was my first thought. But I havne't quite been able to grok it. :P |
| 08:25 | Chousuke | AWizzArd: I think events are difficult to model functionally as they fundamentally have "time" associated with them. |
| 08:25 | tomoj | http://www.haskell.org/frp/publication.html#fruit |
| 08:25 | tomoj | reading that |
| 08:28 | noidi | tomoj, interesting, thanks for the link! |
| 08:28 | Chousuke | I get the basic idea of signal -> function -> other signal but what do you do about stateful UI things like modal windows that pop up as a result of a certain signal? :/ |
| 08:29 | Chousuke | hmmhm |
| 08:29 | dmiles_afk | well event subcription.. is like when you modify how some object B implments a method.. when that object gets somethng called on it from A.. it then reacts by calling the evenets subscribers C... the event subscribers C effectivly changed how the orignal A implments itself |
| 08:30 | dmiles_afk | C subscribes to B |
| 08:30 | Chousuke | dmiles_afk: in an imperative language it's not a problem since you can just go and change thigns |
| 08:31 | Chousuke | dmiles_afk: but in a functional model you need to explicitly model the transformation somehow. |
| 08:31 | Chousuke | I suppose you can model it as a transformation of the graph of signal connections. new signal sources and connections appear and disappear as a result of other signals (open window, close window) |
| 08:32 | dmiles_afk | yeah .. though heck there is gotta be a clean way to model it functionally |
| 08:33 | tomoj | have you both read the paper? |
| 08:33 | tomoj | I just started |
| 08:33 | dmiles_afk | model the transformation.. i wonder if you have to model both states |
| 08:33 | dmiles_afk | or three states or four |
| 08:33 | Chousuke | dmiles_afk: well, Clojure already has a model for time-varying identities |
| 08:33 | Chousuke | dmiles_afk: though not purely functional |
| 08:34 | chouser | I'm jumping in late here, but have you looked at dgraph? |
| 08:34 | chouser | http://github.com/gcv/dgraph |
| 08:35 | dmiles_afk | or http://github.com/gcv/dgraph/blob/master/src/dgraph.clj |
| 08:42 | _invis | look what I found in Labrepl |
| 08:42 | _invis | (defn zipm-4 |
| 08:42 | _invis | 2 [keys vals] |
| 08:42 | _invis | 3 (apply hash-map (interleave keys vals))) |
| 08:42 | _invis | Why apply here ? |
| 08:43 | _invis | we can define same function without it |
| 08:43 | chouser | that looks a lot like zipmap |
| 08:43 | Chousuke | _invis: because you don't want to use the seq as the parameter, you want to use the items in the seq as the parameters |
| 08:44 | Chousuke | _invis: thus you need apply |
| 08:44 | _invis | but result the same |
| 08:44 | Chousuke | huh? no it's not :/ |
| 08:45 | Chousuke | ,(hash-map '[a b]) |
| 08:45 | clojurebot | java.lang.IllegalArgumentException: No value supplied for key: [a b] |
| 08:45 | Chousuke | ,(apply hash-map '[a b]) |
| 08:45 | clojurebot | {a b} |
| 08:45 | _invis | ,(hash-map (interleave [:a :b] [1 2])) |
| 08:45 | clojurebot | java.lang.IllegalArgumentException: No value supplied for key: clojure.lang.LazySeq@1038a40f |
| 08:45 | _invis | emm |
| 08:45 | _invis | in my emacs it is work :) |
| 08:46 | Chousuke | it should not |
| 08:46 | _invis | (defn zipm-4 |
| 08:46 | _invis | 2 [keys vals] |
| 08:46 | _invis | 3 (apply hash-map (interleave keys vals))) |
| 08:46 | Chousuke | you're probably doing something different |
| 08:46 | _invis | works |
| 08:46 | Chousuke | yes, that's fine |
| 08:46 | _invis | fuq |
| 08:46 | Chousuke | it has apply |
| 08:46 | _invis | I mean without apply |
| 08:46 | _invis | (defn zipm-4 |
| 08:46 | _invis | [keys vals] |
| 08:46 | _invis | (hash-map (interleave keys vals))) |
| 08:46 | Chousuke | that will fail |
| 08:47 | Chousuke | if it appears to work, there's something else wrong |
| 08:47 | Chousuke | are you sure you evaluated it? |
| 08:47 | _invis | ohh yep |
| 08:47 | _invis | my fail :( |
| 08:47 | _invis | I used zipm-3... :) |
| 08:47 | _invis | that have the same effect |
| 08:50 | defn | added support for associative destrucuring for seqs by pouring them into a |
| 08:50 | defn | map first, thus supporting associative destruring of & args |
| 08:50 | defn | cool |
| 08:55 | _invis | why zipmap looks like http://gist.github.com/343522 |
| 08:56 | _invis | (defn zipmap |
| 08:56 | _invis | [keys vals] |
| 08:56 | _invis | (into {} (map vector keys vals))) |
| 08:56 | _invis | Is second better ? |
| 08:56 | _invis | and simpler |
| 08:56 | Licenser_ | defn: I'll push a new walton in a few |
| 08:56 | defn | Licenser_: you do too much! |
| 08:57 | Licenser_ | defn: :P |
| 08:57 | defn | Licenser_: what piece of code that you added slowed things down considerably, out of curiosity? |
| 08:57 | defn | is it the evaluation of code in the sandbox? |
| 08:57 | Licenser_ | I think the extract-exps thing is the evil doer, bit it gives better results |
| 08:58 | Licenser_ | http://playground.licenser.net:3000/walton.html |
| 08:58 | Licenser_ | when you run nit as a service you can just use some kind of cache foir all exps found which will make stuff a lot faster again |
| 08:58 | chouser | _invis: yours is certanly simpler, but it also allocates a vector and lazy-seq for every pair, where core's version does not. |
| 08:59 | rhickey | name game again... |
| 09:00 | rhickey | so, using mixins for getting a full implementation of map is tricky and complicated, I think now the simplest thing will be for there to be a deftype based defstruct replacement that does that |
| 09:00 | rhickey | deftype would only provide hash+equals |
| 09:00 | chouser | _invis: on the other hand 'into' uses transients while core's zipmap does not (yet) |
| 09:01 | chouser | rhickey: deftype wouldn't do ILookup? |
| 09:01 | rhickey | nope |
| 09:01 | defn | Licenser_: ah yes, I didn't consider just finding the entire sequence of real expressions |
| 09:01 | rhickey | def___ would do full defstruct-style map impl |
| 09:02 | Licenser_ | :) |
| 09:02 | rhickey | plus gives you named type and ability to implement protocols etc |
| 09:02 | defn | Licenser_: I must say that part of me is okay with results which don't run in the sandbox |
| 09:02 | rhickey | deftypedmap? |
| 09:02 | defn | particularly IO functions |
| 09:02 | _invis | chouser: so the core's variant if badly ? |
| 09:02 | rhickey | defmap? |
| 09:02 | rhickey | defstruct2-the-revenge? |
| 09:02 | AWizzArd | oh that sounds interesting! |
| 09:02 | Licenser_ | defn: with the last update it shows you everything it found when it can't poass it through the sandbox |
| 09:02 | chouser | "map" is pretty overloaded already |
| 09:03 | defn | Licenser_: ah, cool! |
| 09:03 | rhickey | I'd love to just replace defstruct, but it does a few things that would be difficult to replace |
| 09:03 | AWizzArd | rhickey: what such a defmap allow better/automatic error detection? |
| 09:03 | AWizzArd | what ==> would |
| 09:03 | rhickey | AWizzArd: what error detection? |
| 09:03 | AWizzArd | ok ;) |
| 09:03 | defn | Licenser_: how goes clicki? |
| 09:03 | Licenser_ | defn: pushed |
| 09:03 | Licenser_ | quite well |
| 09:03 | chouser | yeah, struct is a good name |
| 09:03 | defn | Licenser_: do you intend to keep up this pace with clojure indefinitely? |
| 09:04 | defn | you seem like you've been really digging in, in the last week or two |
| 09:04 | Licenser_ | I love clojure |
| 09:05 | defn | yeah it's really a fantastic language -- speaking of which... |
| 09:05 | defn | Anyone have any suggestions on "selling" clojure to management? |
| 09:05 | chouser | "typed struct"? |
| 09:05 | Licenser_ | defn: I know it will be slower again at some point |
| 09:05 | chouser | deftstruct |
| 09:05 | Licenser_ | defn: I don't seel it, I just use it :P |
| 09:05 | defn | Licenser_: My goal is to build this particular tool for work so well, and make it so fast, that they cannot turn it down |
| 09:06 | defn | however, I think there still might be a manager or two who is scared of it |
| 09:06 | raek | defrecord |
| 09:06 | rhickey | chouser: wow, that's subtle, I can hardly see that t |
| 09:06 | Licenser_ | rhickey: by the way. *thumbs up* again for this nice languae |
| 09:06 | defn | rhickey: yes I didn't see it either |
| 09:07 | rhickey | although they would be deft |
| 09:07 | defn | haha |
| 09:07 | chouser | could go the other way. deftypeds |
| 09:07 | defn | daftstruct |
| 09:08 | bsteuber | I like deft :) |
| 09:09 | hoeck | deftype* |
| 09:09 | Licenser_ | defn: cool :) |
| 09:09 | Licenser_ | what tool do you plan to build if I may ask? |
| 09:09 | rhickey | Licenser_: thanks! |
| 09:10 | chouser | deftypedmap |
| 09:11 | Licenser_ | rhickey: thank you |
| 09:11 | Licenser_ | :) |
| 09:11 | cgrand | defmaptype |
| 09:11 | hoeck | defr, defs, defp |
| 09:11 | lpetit | please, a synthesis on what exact beast is about to get a name ? |
| 09:11 | rhickey | I'd like to avoid "record" |
| 09:12 | lpetit | I don't understand the difference from plain usage of deftype |
| 09:12 | rhickey | lpetit: moving map impl capability into a deftype based macro, rather than the magic now in deftype |
| 09:12 | chouser | lpetit: essentially what deftype is now if you specify IPersistentMap but don't implement it |
| 09:12 | raek | record seems to be a rather unused synonym for struct |
| 09:12 | raek | defrecord would be a simple, pronounceable name |
| 09:13 | Licenser_ | ls- l |
| 09:13 | fogus | rhickey: you mean avoiding the whole (deftype foo IPersistentMap ...)? |
| 09:13 | defn | . .. bin/ lib/ src/ |
| 09:13 | fogus | ah nevermind... I see |
| 09:13 | rhickey | fogus: yes |
| 09:13 | lpetit | rhickey: a kind of macro inheritence :-) |
| 09:14 | hoeck | deftype* for the limited deftype, and deftype for the one implementing IPersistentMap |
| 09:14 | rhickey | lpetit: not really, just like def* on def etc |
| 09:14 | defn | hoeck: i dont like that |
| 09:14 | defn | too confusing IMO |
| 09:14 | defn | not as pronounceable either |
| 09:14 | rhickey | defmap |
| 09:14 | defn | rhickey: i like that |
| 09:15 | rhickey | deftypedmap is most descriptive, but long |
| 09:15 | lpetit | rhickey: (was joking for macro inheritence). Aren't there really 2 aspects to the problem : the implementation was "magic", ok. But should the "end user" of deftype really bother having 2 different defxxx ? Or could it still be an option of deftype ? |
| 09:15 | rhickey | I like including map, since the whole point is to get a map-like object for data |
| 09:16 | rhickey | lpetit: it ends up option for deftype is more complex to specify and use |
| 09:16 | cemerick | so many "map" things... :-/ |
| 09:16 | fogus | defmappything, defprototype, defstructure, defbasemap ... I stink at naming |
| 09:16 | rhickey | cemerick: but this is a map thing |
| 09:16 | lpetit | rhickey: could one still do anything he could with deftype, or would some restrictions also come with "defmap" ? |
| 09:17 | rhickey | lpetit: deftype would only provide hash/=, everything else on the user |
| 09:17 | rhickey | no magic impls |
| 09:17 | defn | deform? |
| 09:17 | lpetit | ok |
| 09:17 | chouser | deftype would still get some kind of mixin feature? |
| 09:18 | rhickey | chouser: maybe, but doing this first will get the magic out of the way and pave the way for a release |
| 09:18 | lpetit | and "defmap" would be an out-of-the-box map-like type maker ? |
| 09:18 | cemerick | rhickey: {} are maps, so are struct-maps. defmap, should it exist, implies a superset relation to all other maps. *shrug* |
| 09:18 | cemerick | of course, it's a totally different thing. |
| 09:18 | chouser | I quite like "typed map" as a concept name, even if deftypemap is too long |
| 09:18 | rhickey | I've done a bunch of work on mixins, a fundamental challenge is that in order to fully implement map etc for someone, you need to be able to construct instances, communicating everything needed to the mixin in order to do that is a huge complexity |
| 09:18 | cemerick | deftmap is no good? |
| 09:19 | rhickey | whereas most abstrct impls never need to do that, basing everthing instead on one or two methods left to derivee |
| 09:20 | rhickey | but that would make the defstruct-like case one of mixing in *and* providing some core fns, begging for a detmap macro anyway |
| 09:20 | rhickey | defmap |
| 09:20 | rhickey | cemerick: I don't see that implication |
| 09:21 | lpetit | "defmap" : map in the "type" sense, or in the "instance" sense. The name is confusing, I guess |
| 09:21 | rhickey | cemerick: huh, deftmap is surprisingly more readable than deftstruct |
| 09:21 | lpetit | defmaptype |
| 09:21 | defn | i like deftmap |
| 09:21 | lpetit | -1 for deftmap |
| 09:22 | defn | hey you can't do that! |
| 09:22 | chouser | lpetit: hm, good point. It is defining a type not an instance. |
| 09:22 | lpetit | how often will one use "defmap" / "deftypedmap" etc. ? No that often, so let's the name maybe be a bit self-explanatory, he ? |
| 09:22 | defn | lpetit: you could stil think of it as "define a type of map" |
| 09:22 | AWizzArd | defmaptype could also be an alternative |
| 09:23 | chouser | nearly every mature codebase will use this thing |
| 09:23 | lpetit | defn: that is a lot of implicit meaning on the letter t :-) |
| 09:23 | cemerick | chouser: but how many times? lpetit's got a point. def-typed-struct then. :-P |
| 09:23 | AWizzArd | I use it often. |
| 09:24 | djpowell | So what will the difference between reify, and slimmed down deftype be? |
| 09:24 | lpetit | Let's think a little bit about others willing to create "type builders". The name we're trying to invent may well show the path to how name such "type builders" |
| 09:24 | AWizzArd | that is, deftype + IPersistentMap (without providing an implementation) |
| 09:24 | chouser | djpowell: deftype will still not create closures |
| 09:24 | lpetit | AWizzArd: which percentage of your codebase ? :) |
| 09:25 | AWizzArd | yeah sure, only a fraction, but I use it in lots of files |
| 09:25 | chouser | cemerick: yeah, I wouldn't fight that proposal at all. |
| 09:25 | cemerick | They've been semi-deprecated from the start, really. |
| 09:25 | rhickey | cemerick: I thought about magically interpreting the second arg to defstruct if a vector |
| 09:25 | rhickey | so compatible move |
| 09:26 | rhickey | but... |
| 09:26 | djpowell | so how will you access fields in the new deftype without ILookup? |
| 09:26 | rhickey | ,(defstruct foo [] () {}) |
| 09:26 | clojurebot | DENIED |
| 09:26 | AWizzArd | cemerick: what are "they"? |
| 09:26 | rhickey | ,(foo) |
| 09:26 | clojurebot | java.lang.Exception: Unable to resolve symbol: foo in this context |
| 09:26 | chouser | never used defstruct anyway, and I'm all about breaking other people's code. |
| 09:26 | cemerick | AWizzArd: structs |
| 09:26 | AWizzArd | I used defstruct very often, but no replaced virtually every occurrence with deftype. |
| 09:27 | rhickey | so (defstruct foo [a b c] ...) gets newness |
| 09:27 | bsteuber | so is there anything defstruct can do that can't be done with deftstruct? |
| 09:27 | cemerick | rhickey: I think that piece of naming real estate is too valuable for something like defstruct to occupy forever. |
| 09:27 | rhickey | bsteuber: yes, see above, defstruct can have arbitrary keys, runtime creation |
| 09:27 | cgrand | djpowell: (:foo x) but no (x :foo) |
| 09:28 | stuarthalloway | let defstruct be the comprehensive thing |
| 09:28 | defn | stuarthalloway: thanks for making labrepl free |
| 09:28 | stuarthalloway | r/defstruct/deftype |
| 09:28 | cemerick | stuarthalloway: structs really shouldn't provide implementations tho |
| 09:29 | cemerick | conceptually, I mean |
| 09:29 | stuarthalloway | and then name the primitive thing something that suggests its primitive/rawness |
| 09:29 | stuarthalloway | cemerick, sorry, meant deftype |
| 09:29 | rhickey | cemerick: really? |
| 09:29 | rhickey | cemerick: struct == no impls? |
| 09:29 | chouser | deftypedmap won't support arbitrary keys? |
| 09:29 | rhickey | but defstructs do implement a lot |
| 09:29 | stuarthalloway | please not deftypedmap. ick. |
| 09:30 | rhickey | chouser: yes it will, full expando |
| 09:30 | cemerick | rhickey: no, I mean user-provided impls. Should conceptually just be a bag of slots. |
| 09:30 | chouser | ok, then I misunderstood "defstruct can have arbitrary keys" |
| 09:30 | stuarthalloway | defmap w/b better (sorry late to the conversation, know I am retreading ground here) |
| 09:30 | AWizzArd | yes, what does that mean? Arbitrary keys? |
| 09:30 | rhickey | cemerick: hmm, well that rules out its use here, as this new thing will allow impls |
| 09:31 | lpetit | I vote for cgrand's proposal. We're talking about a flavor of deftype. Let's call it defmaptype. Or prune defstruct, long live new defstruct ! :-) |
| 09:31 | rhickey | does anyone else agree with cemerick that struct implies no impls? |
| 09:31 | stuarthalloway | yes |
| 09:31 | stuarthalloway | (I am now everyone) |
| 09:32 | djpowell | i would assume that |
| 09:32 | cemerick | rhickey: I'm having trouble reconstituting the context now. Can you restate the objectives, moving pieces? |
| 09:32 | chouser | no |
| 09:32 | chouser | C++ structs can have implementations. |
| 09:32 | stuarthalloway | argument by appeal to C++? Isn't that a category of fallacy? :-) |
| 09:32 | chouser | what etymology of "struct" rules it out? |
| 09:32 | cemerick | chouser: then by all means... *groan* ;-) |
| 09:33 | rhickey | this new thing will be a deftype with full map impl - meta, expando keys, etc, while retaining deftype's ability to implement protocols and interfaces |
| 09:33 | stuarthalloway | defawesome |
| 09:33 | chouser | ha! |
| 09:33 | chouser | rhickey: Will it come with IFn for lookup? |
| 09:34 | cemerick | rhickey: ah, so a simplification avoiding IPersistentMap explicitness. |
| 09:34 | raek | I believe struct/record implies map-like-thingy with fixed set of keys, too |
| 09:34 | rhickey | chouser: yes, everything that destructs have (except maybe the k/v factory) + a type |
| 09:34 | Chousuke | I think there will soon be too many defblahs :P |
| 09:34 | AWizzArd | And if one would not add key/value pairs at runtime of keys that were not specified in the definition, would it retain deftypes access speed? |
| 09:34 | rhickey | cemerick: yes, that's the prime objective - magic removal |
| 09:34 | defn | i dont like pruning defstruct |
| 09:35 | rhickey | one use case for defstruct remaining is resultset-seq and its ilk |
| 09:35 | lpetit | rhickey: sorry to repeat myself, but "a deftype with full map impl" == "defmaptype" :) |
| 09:35 | stuarthalloway | people will learn what it is, so I would rather have a short, pronounceable name |
| 09:35 | djpowell | id love a resultset-seq that returned deftype things |
| 09:35 | rhickey | lpetit: defmaptype is still a candidate, but it seems no one likes it or anything else much, yet |
| 09:36 | rhickey | djpowell: that would require eval and runtime code gen |
| 09:36 | lpetit | grmlml |
| 09:36 | djpowell | ah yeah |
| 09:36 | raek | I agree with stuarthalloway, pronounceability is a big deal |
| 09:36 | defn | rhickey: im not averse to defmaptype, but i agree with stuart that it'd be nice if it were more pronounceable and quick to talk about, defmaptype brings to mind three different concepts |
| 09:36 | defn | all of which apply, but dont capture the "essence" IMO |
| 09:37 | AWizzArd | I suggested defmaptype and would not find anything bad about typing in these few letters 'type'. No productivity stopper. |
| 09:37 | defn | im going back to deftmap |
| 09:37 | rhickey | I think that it is important not to disturb defstruct needlessly, and that something with mapo in it is more indicative of what is happening that defstruct was - defstruct only made sense once you read that it produced struct-maps |
| 09:37 | Chousuke | please, no :P |
| 09:37 | Chousuke | arbitrary abbreviation is just not cool |
| 09:38 | AWizzArd | deftmap is not my favourite |
| 09:38 | defn | deftmap has my voice -- it's memorable, unique |
| 09:38 | lpetit | let's do it piece by piece |
| 09:38 | defn | vote* |
| 09:38 | lpetit | we all agree on a "def" prefix :-p |
| 09:38 | cgrand | going latin: defres |
| 09:38 | AWizzArd | I would say it should also include "map" |
| 09:39 | AWizzArd | or struct or record |
| 09:39 | chouser | I think my favorite is to replace defstruct. But if not that, defmaptype -- when you call the ctor you get a "typed map" |
| 09:39 | marten | cgrand: defres sounds more like it defines a result or something |
| 09:39 | defn | defrec |
| 09:39 | cemerick | chouser: +1 |
| 09:39 | cemerick | I'm still very wobbly on the notion of structs having user-defined impls tho. |
| 09:40 | AWizzArd | Yes, I would also say: 1) defmaptype, 2) defstruct, 3) defmap, 4) deftypedmap |
| 09:40 | cemerick | That's a class, or a type, but not a struct. |
| 09:40 | chouser | just because C++ does it, doesn't mean its wrong. :-) |
| 09:40 | defn | haha ive been thinking that this whole time! |
| 09:40 | defn | i thought i might be the only one |
| 09:40 | djpowell | does map really capture the key/value pairness of it. something like props or something? |
| 09:40 | cemerick | chouser: no, but in my head, class < type < struct |
| 09:41 | cemerick | w.r.t. complexity / "completeness" of implementation |
| 09:41 | rhickey | huh |
| 09:41 | AWizzArd | or.. defclass |
| 09:41 | cemerick | shite. class > type > struct, I mean |
| 09:41 | cgrand | I agree with chouser's motion: destruct or else defmaptype |
| 09:41 | defn | defmaptype then for me |
| 09:42 | chouser | "class" is bad for this. Hosts will already have the name "class" and we'd do best to let them have it. |
| 09:42 | defn | but going back to what stuart mentioned, it's just not very, i dont know, something just doesnt fit about it for me |
| 09:42 | rhickey | well, if we are saying that types get these dynamic names, and can implement protocols+interfaces, this is plainly more than struct was, and you'll just be explaining destruct as creating a mao-like type |
| 09:42 | AWizzArd | chouser: agreed |
| 09:42 | rhickey | map-like |
| 09:42 | rhickey | so, keeping type in there is good |
| 09:43 | chouser | defstructtype :-/ |
| 09:43 | AWizzArd | uh ;) |
| 09:43 | defn | deftap |
| 09:43 | cemerick | chouser: yeah, I wasn't suggesting 'class' for anything. |
| 09:43 | AWizzArd | cemerick: i suggested "defclass", but also don't really like it |
| 09:43 | djpowell | defmaptype doesn't seem bad. it's got arbitrary slots (map) and is typed (for protocols). |
| 09:44 | defn | are there any other def*s which are as long as defmaptype? |
| 09:44 | rhickey | what about Stu's idea that this gets the simpler name - deftype, and the primitive one gets another name |
| 09:44 | cemerick | defprotomap? :-/ |
| 09:44 | chouser | Are hash-map and array-map exampels of map types? |
| 09:44 | defn | it just seems overly descriptive to me "defmaptype" |
| 09:44 | AWizzArd | I just hope that the main thing I need to do will be: rename (nearly) all my deftypes with defmaptype and remove the IPersistentMap and be done :) |
| 09:45 | rhickey | chouser: sort of |
| 09:45 | chouser | well, they are types of map, but not maptypes. :-/ |
| 09:45 | AWizzArd | defn: is it bad to have a self documenting name? |
| 09:45 | defn | rhickey: im on board with stuart |
| 09:45 | cemerick | rhickey: everything we're talking about will respond true to (map? ...)? |
| 09:45 | defn | AWizzArd: no i just think it is actually somewhat confusing in that it is overly descriptive |
| 09:45 | marten | +1 for defmaptype |
| 09:45 | chouser | I'm ok with stuart's idea, we just need the simpler-thing name. defsimpletype ? |
| 09:46 | chouser | defcoretype |
| 09:46 | chouser | defminitype |
| 09:46 | defn | beating a dead horse... deftmap |
| 09:46 | marten | i don't really like deftmap in that i'd like to keep "type" in full in there |
| 09:47 | Chousuke | t is just arbitrarily abbreviated |
| 09:47 | djpowell | are these going to probably be the core thing that people will mostly use for modelling, and the minimal ones will be mostly used for implementing bits of clojure and stuff? If so, then maybe deftype would be snappier for the expando ones |
| 09:47 | lpetit | defrawtyp |
| 09:47 | defn | Chousuke: and def isn't? |
| 09:47 | lpetit | defrawtype |
| 09:47 | Chousuke | defn: no, it's not. |
| 09:47 | defn | defn isn't? |
| 09:47 | AWizzArd | is defrawtyp really much better that defmaptype? |
| 09:47 | Chousuke | defn: nope :) |
| 09:47 | chouser | AWizzArd: it's for the other thing. |
| 09:47 | cemerick | Might be time to put a page on assembla with descriptions of the different fns. The simpler/primitive/core concepts have gotten twisted. |
| 09:47 | stuarthalloway | yes, because it is on the less-often used thing |
| 09:47 | cemerick | rhickey: ^^ |
| 09:47 | Chousuke | defn: those are "fundamental" IMO. |
| 09:47 | esj | a struct and a map - > defstrap. Just kidding. |
| 09:47 | Chousuke | defn: the t in deftmap is just weird. |
| 09:48 | stuarthalloway | +1 to djpowell |
| 09:48 | defn | Chousuke: it's two pronounceable english words |
| 09:48 | cemerick | Chousuke: you can blame me for that idea :-/ |
| 09:49 | raek | defrecord, anyone? |
| 09:49 | rhickey | cemerick: I don't see how, deftype makes a raw type with hash/=, and you can implement protocols and interfaces with it, the new thing will implement a full persistent map |
| 09:49 | defn | raek: would you settle for a defrec? |
| 09:49 | lpetit | chouser: me too am not "at home" with the dichotomy between what could be viewed as "technical types" (e.g. hash-map, array-map, linkedhashmap), and "domain types" |
| 09:49 | rhickey | raek: I'd rather not add another term |
| 09:50 | AWizzArd | defrec / defrecord are possible, but so far Clojure never had "records" |
| 09:50 | AWizzArd | Is an instance of a defrecord a record? |
| 09:50 | rhickey | defbasetype |
| 09:50 | Chousuke | rhickey: I assume you want to encourage user-defined types to be map-compatible? |
| 09:50 | raek | defn: I generally don't like abbreviations, but maybe, yes |
| 09:50 | stuarthalloway | the base thing should have a simple name: defraw? deft? |
| 09:50 | rhickey | Chousuke: I want to encourage types used for data to be maps, yes |
| 09:50 | stuarthalloway | deft is actually kinda cool |
| 09:50 | Chousuke | rhickey: I think in that case deftype and deftype* would be okay. |
| 09:50 | defn | deft is more than cool |
| 09:50 | defn | it's awesome |
| 09:51 | Chousuke | rhickey: deftype would be the default, and deftype* for those who know what they want. :P |
| 09:51 | rhickey | types used for things like e.g. data structures and the reference types |
| 09:51 | stuarthalloway | deft is my favorite, deftype/deftype* is ok too |
| 09:51 | defn | deft is annoying in that it's so obvious IMO |
| 09:51 | rhickey | deft + deftype - too cute? |
| 09:51 | defn | rhickey: no, i love it |
| 09:52 | hoeck | deft is nice, quite short and fundamental, like defn |
| 09:52 | AWizzArd | would one of those be like the current deftype? |
| 09:52 | defn | hoeck: are you referring to me or the macro? :) |
| 09:52 | rhickey | AWizzArd: nothing is like the current deftype |
| 09:52 | defn | are you calling me short and fundamental? |
| 09:52 | rhickey | base and base+map |
| 09:52 | stuarthalloway | deft is base |
| 09:52 | Chousuke | deft looks like an abbreviation of deftype though... it might not be immediately obvious that they are variants of the same thing :/ |
| 09:52 | stuarthalloway | deftype is base+map+etc. |
| 09:53 | seths | defn: you're just a macro which expands to def |
| 09:53 | defn | Chousuke: i disagree -- it seems pretty obvious to me |
| 09:53 | Chousuke | hm, if it's that way around it might make sense |
| 09:53 | defn | seths: that hurts, man. take it back. |
| 09:53 | hoeck | defn: short, fundamental and nice :) |
| 09:53 | raek | which one is the most used? base or base+map? |
| 09:53 | rhickey | when people see 'record' do they think more of data than they do with 'type' |
| 09:53 | AWizzArd | yes |
| 09:53 | underdev | stuarthalloway: been going through labrepl, all day yesterday, should be done today. very cool man! |
| 09:53 | stuarthalloway | underdev: thanks |
| 09:53 | defn | rhickey: yeah, i immediately think of a database |
| 09:53 | rhickey | for me, one crime of OO is when people wall up ordinary data in Employee etc classes |
| 09:54 | rhickey | making things maps makes them amenable to generic handling via the standard lib |
| 09:54 | bsteuber | maybe rename defstruct to defrecord and use its name |
| 09:54 | bsteuber | if the only normal case for old defstruct is databases |
| 09:55 | rhickey | OTOH, there's no reason for a Ref/Atom/PersistentVector implemented with deftype to have a map-like impl |
| 09:55 | lpetit | stuarthalloway: yeah, labprel is an amazing piece of work, both from the technical and the pedagocial sides |
| 09:55 | AWizzArd | rhickey: do you mean that in general data objects should be stored in maps instead of classes? |
| 09:55 | rhickey | how would you all categorize the difference between them and Employee? |
| 09:55 | stuarthalloway | lpetit: amazing is a bit strong, I'll settle for "useful" :-) |
| 09:55 | defn | rhickey: (inc labrepl) |
| 09:55 | defn | err sorry, not directed at you |
| 09:55 | lpetit | stuarthalloway: don't be so modest :-) |
| 09:56 | defn | stuarthalloway: is it possible to have tests run over and over again? or do you need to call script/test every time? |
| 09:56 | AWizzArd | I don’t understand that part of walling up ordinary data in classes such as “Employee”. |
| 09:56 | etate | how do you guys know which versions of libraries to use with others? |
| 09:56 | lpetit | stuarthalloway: the last piece of work is to have mini-repls right in the webapp, I guess :) |
| 09:57 | seths | lpetit: he can steal the code from http://lotrepls.appspot.com |
| 09:57 | stuarthalloway | domain entities should rarely be classes |
| 09:57 | rhickey | defentity |
| 09:57 | lpetit | stuarthalloway: with possibility to "reset" them so that you can work on a subject without having succesfully worked on the previous ones on which they are built |
| 09:58 | rhickey | definformationholderthingy |
| 09:58 | etate | as in even with leiningen you still need to specify the right versions of all libs you'll use in the dproject.clj |
| 09:58 | Chousuke | defdata :P |
| 09:58 | AWizzArd | I would slightly prefer defentity over definformationholderthingy |
| 09:58 | etate | so what am i missing? |
| 09:58 | etate | :D |
| 09:58 | AWizzArd | rhickey: could you say a few more things about this example of Employees storing data? |
| 09:58 | Chousuke | or the ultimate: "dwim" |
| 09:59 | defn | stuarthalloway: i realize you're very busy, but if you get a chance in the next couple weeks I would love to see a video + blog post about getting started on circumspec. I've been really interested in finding an autotest-like tool for clojure, and circumspec is as close as it gets |
| 09:59 | lpetit | did we switch subject, or is defentity ... related to deftype/deftype*/deft ? |
| 10:00 | stuarthalloway | deft is for the deft |
| 10:01 | stuarthalloway | defn: you can run the tests within the repl at any time. Just (use 'circumspec) (watch) |
| 10:01 | rhickey | lpetit: I'm trying to tease out the difference between types used as program entities (data structures, reference types etc) and types used as information holders. The latter should always use the map-like type. So, if that distinction works, then maybe there are names that imply the difference |
| 10:01 | stuarthalloway | defn: (1) I am hoping that Sierra will take circumpec's skin and put it over lazttest's guts, so I wouldn't do the tutorial yet |
| 10:02 | stuarthalloway | (2) let's talk Sean Devlin into doing the tutorial |
| 10:02 | seths | stuarthalloway: way to delegate :-) |
| 10:02 | rhickey | does anyone understand what I am talking about above? |
| 10:02 | stuarthalloway | rhickey: warming to the distinction |
| 10:03 | cemerick | rhickey: when you separate reference types from "information holders", not really. |
| 10:03 | rhickey | one reason Clojure wen out without objects is bacuase I wanted everyone to put their information in maps |
| 10:03 | underdev | rhickey: as the leader of our cult, we'll accept it by faith |
| 10:03 | lpetit | rhickey: I think I do |
| 10:03 | rhickey | your app has some structures associated with the implementation, and some with the information |
| 10:03 | stuarthalloway | use defentity to build concretions, and deftype to build abstractions |
| 10:03 | rhickey | a vector is the former, an Employee is the latter |
| 10:04 | stuarthalloway | and now, with my preferred names: |
| 10:04 | stuarthalloway | deft is used to build abstractions, like vectors |
| 10:04 | lpetit | rhickey: defentity seems too "oriented" to me. To specific. deftype would see more "evident" business app usage |
| 10:04 | stuarthalloway | deftype is used to build concretions, like Employees |
| 10:04 | rhickey | forget defentity |
| 10:04 | fogus | defknowledge |
| 10:05 | defn | stuarthalloway: im on board with you 100% |
| 10:05 | defn | i dont think ive disagreed with a single thing you've said thus far actually, heh |
| 10:05 | rhickey | fogus: it's more raw than knowledge |
| 10:05 | cemerick | My conceptualization is that I have structs (simple, expandable maps), types (maps that have some callable impls attached), and references (such as atoms, which can hold structs and types). Mix fns that operate over all of them. |
| 10:06 | stuarthalloway | separate but related issue: we need to tell the concretion/abstraction story, which this may help us do |
| 10:06 | rhickey | cemerick: what would you use to implement PersistentVector? |
| 10:06 | cemerick | ah, now I see where you're coming from |
| 10:07 | cemerick | rhickey: what I'm calling types, minus the map impl, plus fields. |
| 10:07 | rhickey | cemerick: that's not distinct enough in my mind |
| 10:08 | rhickey | stu is making the point here that the base thing is for library devs, and thus confusing for app devs who normally just find that already there, but library devs need lang support too |
| 10:08 | rhickey | the latter my point |
| 10:09 | defn | im not sure i follow rhickey |
| 10:09 | Chousuke | I think I would like defrecord for plain data + map interface, deftype for the "lower" level. but then defstruct becomes obsolete |
| 10:09 | defn | specifically the "and thus confusing for app devs who normally just find that already there" |
| 10:09 | cemerick | rhickey: It seems like the array of options one might want (map impl or no, fields or no, impls or no) points towards having a single configurable entry point. |
| 10:10 | rhickey | vector/map/atom/String etc are programming construct, Employee, Roster, SalesReport etc are domain data entities |
| 10:10 | rhickey | cemerick: you're trapped in implementation details, I think |
| 10:11 | bsteuber | how about defdata, then? :) |
| 10:12 | rhickey | bsteuber: maybe |
| 10:13 | rhickey | defprogramconstruct |
| 10:13 | rhickey | definformationconstruct |
| 10:13 | cgrand | coretypes and types? |
| 10:14 | cemerick | domain type |
| 10:14 | fogus | Digging back into my dusty CLIPS store... deftemplate |
| 10:14 | rhickey | definfotype |
| 10:14 | hoeck | deftype (base+map) and defbasetype (base only) |
| 10:15 | bsteuber | defmodel |
| 10:15 | noidi | cgrand, I like coretype vs type |
| 10:15 | rhickey | models are usually bigger things |
| 10:15 | bsteuber | okay |
| 10:15 | stuarthalloway | coretype isn't bad if you really want to type that many chars :-) |
| 10:15 | noidi | I assume that won't be too often? |
| 10:15 | esj | defdataform |
| 10:15 | rhickey | core implies central or important, doesn't get at key distinction |
| 10:16 | stuarthalloway | but if I keep saying deft/deftype long enough you will all surrender eventually |
| 10:16 | cgrand | impltype |
| 10:16 | defn | yeah, ive taken to naming the file which contains my -main, "core.clj" -- that is a "core" AFAICT |
| 10:16 | sbt | what is conc in clojure? |
| 10:17 | cemerick | basetype |
| 10:17 | cemerick | inittype |
| 10:17 | raek | is the map vs Employee class thingy what stuarthalloway referred to as something like "data-as-contract" in one of his talks? |
| 10:17 | noidi | isn't the main distinction between abstract and concrete types? |
| 10:17 | fogus | template |
| 10:17 | bsteuber | My votes at this point would be 1. defstruct (old defstruct -> defrecord) 2. defdata 3. defrecord 4. defmap |
| 10:17 | noidi | vectors and such are abstract while employees are concrete |
| 10:18 | bsteuber | but I'll leave now - so good louck with finding a good conclusion |
| 10:18 | raek | ...if so, where can I read more about this philosophy? |
| 10:18 | defn | raek: which talk? |
| 10:18 | stuarthalloway | noidi: or maybe code domain vs. problem domain |
| 10:18 | raek | it was for a ruby audience |
| 10:18 | stuarthalloway | raek: data as contract is just about "don't hide data" |
| 10:19 | rhickey | code domain/ information domain |
| 10:20 | stuarthalloway | raek: once data is immutable, protecting it with accessors is (even more) silly |
| 10:20 | stuarthalloway | and as soon as you serialize or persist you commit to supporting a data format, not a programmatic interface |
| 10:21 | rhickey | defcodetype, definfotype |
| 10:21 | raek | ah, yes. I see |
| 10:21 | noidi | rhickey, and the latter implement the map interface, while the former don't? |
| 10:21 | rhickey | right |
| 10:22 | raek | defdatadatatype |
| 10:22 | noidi | what if I want to add a new map-like type, which one would I use? |
| 10:23 | noidi | for code |
| 10:23 | noidi | I think the names should reflect the semantics, not the most common use cases of each function |
| 10:26 | raek | (found the talk: http://rubyconf2009.confreaks.com/21-nov-2009-10-25-clojure-for-ruby-programmers-stuart-halloway.html) |
| 10:26 | noidi | for that reason I liked the defmaptype/deftype proposal |
| 10:26 | noidi | although to make the former shorter, to suggest that it's the common case, I think it should be shortened to deft (to match defn) |
| 10:28 | rhickey | cgrand: defimpl good, maybe defimpl, definfo |
| 10:29 | cgrand | I like deftype for the common case (definfo) |
| 10:29 | fogus | My fav at the moment is definfo |
| 10:29 | cgrand | ,(meta (let [i 1] #^{:foo i} [i])) ; can this be relied upon? |
| 10:29 | clojurebot | {:foo 1} |
| 10:31 | rhickey | yeah |
| 10:31 | esj | deffacts |
| 10:32 | fogus | hrm... I find it fun to say |
| 10:34 | defn | rhickey: way OT but did I hear right that you were a professional musician in one of your introductions? |
| 10:34 | defn | i was just curious what instrument |
| 10:35 | noidi | cemerick, yeah, it sounds like pig latin :) |
| 10:36 | noidi | I don't know how a native speaker would pronounce it, but I have trouble placing the emphasis on any syllable without "definfo" sounding weird and foreign |
| 10:37 | noidi | it sounds too much like a single word |
| 10:41 | defn | go down on the def sound |
| 10:42 | defn | like a falling tone in chinese |
| 10:42 | defn | raek: thanks for the link |
| 10:47 | esj | nobody told me about @(future (:Mephistopheles)) |
| 10:50 | etate | hmm.. i finally got clojure setup adequately and now when i slime-connect and type a form, it blocks indefinitely |
| 10:50 | etate | anyone else experience deadlock like this? |
| 10:51 | qbg | But slime-connect is successful? |
| 10:51 | etate | yes, i get a REPL |
| 10:51 | etate | after pressing y to the version incompatibility |
| 10:52 | etate | i should probably also point out that the version of slime i'm using is from cvs |
| 10:52 | etate | not from ELPA |
| 10:52 | qbg | How recent? |
| 10:52 | etate | 2010-03-21 |
| 10:53 | etate | 4 days old |
| 10:53 | etate | works fine with common lisp |
| 10:54 | etate | also it seems to work when i type in numbers, just not when i type in forms |
| 10:54 | qbg | I know that at least not too long ago recent versions of slime would not work with Clojure |
| 10:56 | rhickey | bbl |
| 10:56 | etate | qbg: indeed, i just tried with an earlier version and it works |
| 10:56 | etate | qbg: the 2009 (ooold) version in ELPA works but not cvs slime |
| 10:56 | qbg | etate: I just tried the 2010-03-21 version, and it seems to work for me. |
| 10:57 | etate | qbg: what was your (slime-setup) ? |
| 10:57 | etate | qbg: also are you using the maven plugin or are you using lein swank? |
| 10:58 | qbg | I'm using (slime-setup '(slime-repl)), and so far I just tested using M-x slime |
| 10:58 | etate | qbg: i was using (slime-setup '(slime-fancy slime-repl)), and lein-swank v 1.1.0 |
| 10:59 | qbg | Seems to work with lein-swank also |
| 10:59 | etate | qbg: which version of lein swank? |
| 10:59 | qbg | 1.1.0 |
| 11:00 | etate | qbg: and you tried typing (+ 1 2 3) ? |
| 11:01 | etate | qbg: i just tried with the same slime setup as you, same lein-swank, version 2010-03-21 and its deadlocking |
| 11:01 | qbg | In my case, (* 4 2) |
| 11:02 | etate | the only other thing i can think of is that i have jline included as a dependency |
| 11:02 | qbg | Try removing that |
| 11:03 | etate | qbg: nope, makes no difference |
| 11:04 | qbg | Appeasing the SLIME gods is hard... |
| 11:05 | etate | qbg: indeed, oh well i'll just use an old version of slime :) |
| 11:06 | Crowb4r | At first I read that as SLUM gods. |
| 11:06 | Crowb4r | lol |
| 11:17 | npoektop | hi! whould you help me with a macro? http://pastebin.com/MyKFdyFp |
| 11:18 | npoektop | it says: "Can't use qualified name as parameter: com.nnn.server.tests.local/tst" |
| 11:19 | hiredman | ` qualifies symbols |
| 11:19 | hiredman | ,`a |
| 11:19 | clojurebot | sandbox/a |
| 11:19 | Chousuke | npoektop: don't quote the macro parameters |
| 11:19 | Chousuke | npoektop: and you can use (fn [tst#] ...), an autogensym |
| 11:20 | Chousuke | npoektop: but really, that doesn't need to be a macro :P |
| 11:20 | Chousuke | or hm, was require a macro or a function? :/ |
| 11:20 | Chousuke | ,require |
| 11:20 | clojurebot | #<core$require__6458 clojure.core$require__6458@1ef63f9> |
| 11:21 | Chousuke | right. |
| 11:21 | npoektop | a function? |
| 11:22 | defn | fogus: Clojure as a Johnsonian (Robert) model of programming. |
| 11:22 | npoektop | ok |
| 11:22 | Chousuke | npoektop: yes |
| 11:23 | Chousuke | just (defn rt [& namespaces] (doseq [n namespaces] (require n) (run-test n))) (rt 'foo 'bar) |
| 11:47 | Crowb4r | Is there a google api lib for clojure at all? |
| 11:47 | chouser | which google api? |
| 11:49 | Crowb4r | chouser: Just any in general. I've seen the charts one, but I was just wondering if there was one for docs or anything else. |
| 11:49 | Mec | Is there any simple way to do a reduce that short circuits on nil |
| 11:52 | raek | reminds me of -?> |
| 11:52 | raek | http://richhickey.github.com/clojure-contrib/core-api.html |
| 11:52 | raek | like ->, but short circuits on nil |
| 11:52 | Mec | yes |
| 11:53 | hiredman | Mec: take-while |
| 11:53 | noidi | the beauty of lazy seqs :) |
| 11:53 | hiredman | ,(reduce + (take-while identity [1 2 nil 3 4 5])) |
| 11:53 | clojurebot | 3 |
| 11:53 | noidi | maybe swap reduce and take-while there? |
| 11:54 | noidi | so that it short circuits if the reduction is nil |
| 11:54 | Mec | It may be the case that there is no nil in the seq but the function applied by reduce returns nil, in which case it needs to stop as well |
| 11:54 | chouser | reduce is eager though, so that wouldn't work |
| 11:54 | chouser | Mec: and just return nil? |
| 11:54 | noidi | chouser, ah, ok |
| 11:55 | Mec | chou |
| 11:55 | Mec | chouser, yes |
| 11:55 | chouser | Mec: perhaps you could build something on clojure.contrib.seq/reductions |
| 11:56 | Licenser | greeetings |
| 11:56 | noidi | any reason why reduce is not lazy? |
| 11:56 | chouser | noidi: can't be |
| 11:56 | raek | it should be fairly straight forward to do this with exceptions or c.c.error-kit, but I don't know if that's good style |
| 11:56 | Mec | reduce only returns 1 value, so theres nothing to be lazy on |
| 11:58 | chouser | right. while reductions returns a lazy seq of each iteration of reduce, so you can take the last value, or nil whichever comes first |
| 11:58 | noidi | d'oh, of course |
| 11:58 | Mec | chouser: ok, i'll look into reductions |
| 12:00 | raek | (try (reduce #(if (nil? %2) (throw (Exception.)) (+ %1 %2)) [1 2 3 nil 4]) (catch Exception e nil)) |
| 12:00 | chouser | :-( |
| 12:00 | raek | beware of hairy code... |
| 12:01 | raek | man, that's ugly... forget I wrote it... :) |
| 12:02 | Chousuke | ,(reduce + (take-while (complement nil?) [1 2 3 nil 4])) :P |
| 12:02 | clojurebot | 6 |
| 12:02 | Chousuke | hmm, I suppose that's not good enough |
| 12:03 | Mec | ,(reduce #(if (= %2 5) nil (+% %2)) (range 10)) |
| 12:03 | clojurebot | java.lang.NullPointerException |
| 12:04 | Mec | more like that |
| 12:06 | chouser | ,(loop [a 0, s (range 10)] (if (empty? s) a (let [a (+ a (first s))] (when-not (= a 5) (recur a (next s)))))) |
| 12:06 | clojurebot | 45 |
| 12:07 | chouser | oh, that's not right |
| 12:07 | Mec | The nil test is based off of the cumulitive value from the reduce, so a maping function wont work |
| 12:07 | chouser | oh, that is right. but (= a 6) is needed to see the nil result |
| 12:08 | chouser | it seems strange to me that when the test is true you want to return nil instead of the result so far. |
| 12:09 | AWizzArd | An if that returns nil is less idiomatic than using when or when-not. |
| 12:10 | Mec | my example was poorly contrived |
| 12:12 | chouser | (defn reduce-if-not [pred f init s] (loop [a init, s s] (if (empty? s) a (let [a (f a (first s))] (when-not (pred a) (recur a (next s))))))) |
| 12:17 | Mec | is (last (reductions f coll)) = (reduce f coll) ? |
| 12:17 | chouser | yes |
| 12:17 | noidi | maybe something like this? http://gist.github.com/343741 |
| 12:23 | Mec | (defn reduce-if-not [pred f init s] (let [r (reductions f init s)] (when-not (some pred r) (last r))) |
| 12:24 | Mec | hmm does that look right |
| 12:24 | chouser | Mec: just so you're aware, that will hold the head of the reductions seq and walk it a second time, so may fail for large seqs where reduce would work fine. |
| 12:25 | Mec | I think im back to the same problem with that one |
| 12:35 | raek | ,(let [[f & r] [1]] (class r)) |
| 12:35 | clojurebot | nil |
| 12:35 | Mec | (last (take-while pred (reductions f init s))) seems promising but that wont end at nil |
| 12:38 | noidi | Mec, did you try chouser's or my suggestions? |
| 12:39 | noidi | although I understand if you want to solve it yourself, that's why I wrote that snippet without looking at what chouser wrote :) |
| 12:39 | Mec | I'm using chouser's idea, just seeing if theres something simple |
| 12:46 | noidi | ,(let [r (reductions + (range 5))] (if (some nil? r) nil (last r))) |
| 12:46 | clojurebot | java.lang.Exception: Unable to resolve symbol: reductions in this context |
| 12:46 | noidi | ,(use '[clojure.contrib.seq-utils :only [reductions]]) |
| 12:46 | clojurebot | nil |
| 12:46 | noidi | ,(let [r (reductions + (range 5))] (if (some nil? r) nil (last r))) |
| 12:46 | clojurebot | 10 |
| 12:47 | noidi | reductions is lazy, and I assume some is too, so I think that should short-circuit |
| 12:47 | Mec | It will, but its holding onto the head of a lazy seq |
| 12:48 | noidi | argh, of course some is eager as it returns a single value |
| 12:48 | noidi | again |
| 12:48 | noidi | note to self: when too tired to think, hacking doesn't help |
| 12:49 | kylesmith | Has anyone tried using clojure-install recently? It gets halfway through the install, and says clojure-contrib doesn't have a build.xml file. |
| 12:49 | Mec | i needs a take-while or a drop-while that can somehow return nil |
| 12:51 | technomancy | kylesmith: clojure-install is deprecated; see the swank-clojure readme. |
| 12:54 | noidi | ,(loop [[x & xs] (reductions + (range 5))] (if xs (if (nil? x) nil (recur xs)) x)) |
| 12:54 | clojurebot | 10 |
| 12:54 | noidi | I don't know if that's any simpler than what's been proposed, but that's a variation :) |
| 12:56 | noidi | I've made so many stupid mistakes today that I'm not sure about anything anymore, but that should walk the lazy seq of reductions without retaining head, returning nil if it encounters a nil reduction, or the final reduction otherwise |
| 12:58 | noidi | you could abstract that out and just do a (nil-or-last (reductions ...)) |
| 12:58 | kylesmith | technomancy: README.md? I see no mention of clojure-install. |
| 12:59 | Raynes | That's the point. |
| 12:59 | Mec | noidi: thanks for the effort ;p |
| 13:00 | Mec | I do like extracting out nil-or-last |
| 13:00 | noidi | Mec, here's the function with some nicer formatting http://gist.github.com/343818 |
| 13:04 | noidi | (nil-or-last (cons nil (reductions + (range 999999999999999999)))) returns instantly, so it seems to be lazy as it should |
| 13:05 | Raynes | ,(let [result (take-while true? [false true true false true])] (if (empty? result) nil result)) |
| 13:05 | clojurebot | nil |
| 13:05 | Raynes | orly |
| 13:06 | noidi | argh, now I'm checking if reductions is lazy like it says in the doc string. now I'm really shutting down the computer and getting some rest :) |
| 13:06 | Mec | heh, night |
| 13:06 | esj | Raynes: I think it makes sense, results is never gets populated ? |
| 13:07 | Chousuke | (if (empty? result) nil result) can be condensed to (seq result) :P |
| 13:07 | Raynes | esj: HuH? |
| 13:07 | Raynes | Huh* |
| 13:07 | Raynes | Chousuke: shh. |
| 13:08 | Raynes | ,(seq (take-while true? [true true true false true])) |
| 13:08 | clojurebot | (true true true) |
| 13:08 | Raynes | ,(seq (take-while true? [false true true true false true])) |
| 13:08 | clojurebot | nil |
| 13:09 | Raynes | Seq is a multitasker. |
| 13:09 | Mec | if you pass seq a sequence or nil its just like identity |
| 13:10 | Raynes | Never would have thunk it. |
| 13:11 | defn | Does anyone know in incanter, when you have an x axis that has very long names, how you grow the graph to make them fit? |
| 13:11 | Mec | clojure.contrib.seq isnt new is it? |
| 13:11 | Raynes | defn: Water it. |
| 13:11 | Raynes | Mec: It's the renamed seq-utils |
| 13:11 | Mec | ah thats what i've got still |
| 13:12 | Raynes | Mec: Likewise, because it doesn't look like anybody is going to fix the contrib master builds on Hudson until clojure 3.0 is out. ;) |
| 13:12 | Mec | I just finally got emacs working happily and im not screwing with it |
| 13:13 | defn | Raynes: good advice. it worked |
| 13:13 | Raynes | defn: ;) |
| 13:13 | liebke | defn: there are :width and :height options to view. Or you can just drag the corner of the window :) |
| 13:13 | kylesmith | Has swank-clojure been updated to use leiningen? What happened to swank-clojure-autoload? |
| 13:14 | defn | liebke: it doesn't seem to be auto resizing, perhaps because i set the :width and :size ? |
| 13:14 | liebke | defn: really? which chart are you using? |
| 13:15 | defn | bar |
| 13:15 | defn | liebke: sorry i should clarify |
| 13:16 | defn | it auto-resizes, but honestly it might not be including labels for the x-axis |
| 13:16 | defn | i thought those tick marks were just tightly packed text |
| 13:16 | liebke | defn: do you have some example code I can see? |
| 13:17 | liebke | defn: the x-axis labels for bar-charts are the values of the first argument passed to bar-chart |
| 13:17 | defn | (defn build-graph [] (incanter.core/view (incanter.charts/bar-chart countries values :x-label "Countries" :y-label "Number of Denials"))) |
| 13:18 | liebke | defn: so each of the bars should be labeled with the values of the countries sequence. Is that not what you're seeing? |
| 13:18 | defn | liebke: one sec please |
| 13:20 | defn | liebke: my structure looks like what we discussed earlier -- [{:country "USA", :count 10} {...} {...}] |
| 13:20 | liebke | defn: you can also set the :vertical option to bar-chart to false, to create a horizontal chart, which works better for long labels |
| 13:21 | defn | is my structure there correct? |
| 13:22 | liebke | defn: yeah, to pass that structure to (to-dataset your-map-array) |
| 13:22 | liebke | defn: then you can call (bar-chart :country :count :data (to-dataset your-map-array)) |
| 13:23 | defn | ahhhhh |
| 13:25 | Raynes | Leiningen gets no love: http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer |
| 13:26 | defn | it's been around for about a day |
| 13:26 | defn | besides, you can use maven AND leiningen |
| 13:26 | Raynes | defn: If it was more than two days old, it would be OFN. |
| 13:26 | defn | OFN? |
| 13:27 | Raynes | defn: Old f***ing news. |
| 13:27 | defn | heh |
| 13:28 | cemerick | defn: what does such a combination look like? |
| 13:28 | defn | Raynes: is it evil to \n the crap out of your clojre code? |
| 13:28 | defn | cemerick: like rubygems and ant for jruby |
| 13:28 | cemerick | yeouch |
| 13:29 | defn | cemerick: i dont think there is a magic bullet, but what i do know is that bits and pieces of doing stuff with maven could be built into a tool like leiningen |
| 13:30 | defn | and that would be handy, and nice |
| 13:30 | Chousuke | I'm looking forward to some kind of clojureish wrapper for maven appearing |
| 13:30 | cemerick | Chousuke: from the makers of maven: http://polyglot.sonatype.org/clojure.html |
| 13:30 | defn | it's logic programming |
| 13:30 | defn | people who write clojure like that sort of thing |
| 13:30 | defn | :) |
| 13:31 | cemerick | defn: I guess I'm left wondering what such a tool would look like, other than being maven + sexprs. |
| 13:32 | defn | cemerick: headius was in here yesterday talking about how closely ant and rubygems work together -- it's not messy, rubygems runs the show and is almost completely written in ruby IIRC |
| 13:32 | defn | i am probably misquoting him, but it didnt sound like a bad place to be |
| 13:32 | cemerick | defn: yeah, I was here when he said that. |
| 13:33 | headius | it's getting there |
| 13:33 | headius | hopefully in the next week we'll have a maven repo live that appears to be just a rubygems repo |
| 13:33 | headius | gem install org.clojure.clojure |
| 13:33 | cemerick | I'm not saying it's messy, I'm saying that I'm not particularly interested in scripting-oriented approaches to doing builds anymore. |
| 13:33 | defn | now that is just awesome. |
| 13:33 | headius | that will be a nice step toward rubyifing maven on the project side as well |
| 13:34 | defn | cemerick: ah, don't you think most people still operate with scripts first, customization second? |
| 13:34 | cemerick | And, again, mining the maven plugin ecosystem is simply too fruitful to ignore IMO. |
| 13:34 | defn | i mean there comes a point where you just get in there and do what you need to do i guess |
| 13:34 | kylesmith | Can anyone give me a link to *updated* instructions for how to setup emacs/leiningen/swank-clojure? |
| 13:34 | defn | kylesmith: mine or sort of up to date :X |
| 13:34 | cemerick | defn: scripting is custom from the start. That's the first big win with maven (or other convention-over-configuration approaches). |
| 13:35 | headius | cemerick: any rubified maven we do would leverage all existing stuff...we wouldn't reimpl maven |
| 13:35 | defn | kylesmith: http://devinwalters.com/posts/24 |
| 13:35 | headius | just like the rake+ant integration just merges the two spaces |
| 13:35 | cemerick | headius: sounds like a winner |
| 13:36 | headius | I like what the buildr guys have done, but they don't use any of maven proper |
| 13:36 | headius | I'm too lazy for that |
| 13:36 | cemerick | I don't really care what gets used, as long as people can stop reimplementing silly stuff like shell exec, javac compilation, building .war files, etc. |
| 13:37 | defn | .war files, ugh |
| 13:37 | cemerick | defn: ? |
| 13:37 | stuartsierra | I wonder what a clojure syntax for ant would look like? |
| 13:38 | headius | probably a lot like xml :) |
| 13:38 | stuartsierra | yeah |
| 13:38 | defn | only less noisy |
| 13:38 | headius | (project (target ... |
| 13:38 | defn | cemerick: disregard |
| 13:38 | headius | rake+ant looks like rake, so it's not a good comparison |
| 13:38 | cemerick | defn: that's not a reason to not use XML BTW :-) |
| 13:38 | stuartsierra | cemerick: agreed |
| 13:39 | defn | cemerick: label me a hopeless aesthete |
| 13:39 | stuartsierra | Heck, Ant has macros, doesn't it? |
| 13:39 | headius | sort of |
| 13:39 | headius | they're really just function defs |
| 13:39 | cemerick | stuartsierra: danger, will robinson! |
| 13:39 | stuartsierra | ah |
| 13:39 | headius | not really contextual |
| 13:39 | defn | stuartsierra: i think im supposed to bug you about circumspec? |
| 13:40 | stuartsierra | defn: are you? Did halloway put you on it? |
| 13:40 | defn | s.halloway said something along those lines to me |
| 13:40 | defn | :) |
| 13:40 | cemerick | I probably would still be using ant if its scripts were composable and if it had baked-in dep mgmt. |
| 13:40 | stuartsierra | defn: Are you at relevance? |
| 13:40 | kylesmith | defn: Am I supposed to get massive warnings when installing everything? |
| 13:40 | defn | stuartsierra: no sir, just caught him in irc earlier and complimented him on labrepl, asked about circumspec |
| 13:41 | Raynes | I <3 Leiningen. |
| 13:41 | defn | he pointed me at you and sean devlin :) |
| 13:41 | defn | kylesmith: that will happen yes |
| 13:41 | defn | kylesmith: it's okay |
| 13:41 | stuartsierra | defn: Ok. I talked to Halloway about Circumspec and lazytest last week. Working right now on merging features from both. |
| 13:42 | defn | stuartsierra: one big thing ive been really itching for is a demonstration and blog post with the setup process |
| 13:42 | stuartsierra | Just trying to settle some syntax wars going on inside my head. |
| 13:42 | defn | im not entirely sure how to get the beast moving |
| 13:42 | stuartsierra | what, circumspec? |
| 13:42 | defn | i generally edit using swank-clojure-project |
| 13:43 | defn | open my source and C-c C-j |
| 13:43 | defn | C-k* |
| 13:43 | defn | how do i get circumspec into the mix |
| 13:43 | stuartsierra | no idea :) |
| 13:43 | defn | haha |
| 13:43 | stuartsierra | that will come, first we have to finish writing it |
| 13:43 | defn | oh...right! |
| 13:43 | kylesmith | defn: I got several errors while installing. As far as I know, I'm using standard emacs 22 from the ubuntu repos, and I wiped out my .emacs and .emacs.d |
| 13:43 | defn | kylesmith: get 23 |
| 13:43 | defn | it's in your best interest |
| 13:44 | defn | i like to compile emacs from source on linux |
| 13:45 | defn | but IIRC there are packages for ubuntu 9.10 now |
| 13:45 | defn | stuartsierra: thanks for working on it, anyway -- it looks like it will be fantastic |
| 13:46 | stuartsierra | here's hoping |
| 13:47 | defn | liebke: still no luck with (view (bar-chart :country :count :data (to-dataset (to-incanter-structure)))) |
| 13:48 | defn | liebke: to-incanter-structure returns [{:country "X" :count 5} {...} {...}] |
| 14:00 | liebke | defn: what's it doing? |
| 14:01 | defn | I've got it working now, my only remaining question is how to make the bars wider |
| 14:02 | liebke | defn: I'm afraid I can't help you there, they are typically as wide as there is room |
| 14:03 | defn | liebke: I have about 182 bars |
| 14:06 | liebke | defn: yeah, unless you consolidate some of the bars, I don't have a way to make them bigger |
| 14:06 | defn | liebke: okay, thanks |
| 14:14 | fogus | cemerick: nice screencast. I'm sold |
| 14:18 | cemerick | fogus: Thanks :-) |
| 14:20 | cemerick | I thought about doing a more elaborate example, but the OS X bundling bit seemed like it had some visual impact to it. |
| 14:20 | kylesmith | defn: I'm still getting an error during install on emacs 23: "swank-clojure.el:47:1:Error: Symbol's function definition is void: slime-control-modified-char" |
| 14:21 | fogus | I liked it. It was perfect length, perfect example. I didn't care for the soundtrack though. ;-) |
| 14:23 | cemerick | fogus: what, you don't like endless yammering and opining while you're watching projects build?!?!!11! |
| 14:23 | cemerick | that was a ;-) of course |
| 14:23 | chouser | there's no audio, right? |
| 14:23 | fogus | cemerick: Nothing wrong with the yammering, although I had imagined your voice to be more like Barry White. :p |
| 14:24 | chouser | instead of completely silent, as it is? |
| 14:24 | cemerick | chouser: no, there's audio |
| 14:24 | chouser | hmph |
| 14:24 | cemerick | fogus: time for those voice lessons, get me down a few octaves :-D |
| 14:26 | chouser | ah, there we go. |
| 14:34 | chouser | clojure build system hotness as defined by cemerick's use of it |
| 14:34 | cemerick | heh |
| 14:34 | cemerick | chouser: dude, that's just the tip of the iceberg. |
| 14:35 | chouser | is the rest of the iceberg also XML? |
| 14:35 | chouser | sorry, couldn't resist. |
| 14:35 | Raynes | I'd rather use a crappy build system than stare at XML for any length of time. |
| 14:35 | Chousuke | you can write poms in clojure though |
| 14:36 | Chousuke | and translate them to xml poms |
| 14:36 | cemerick | chouser: that depends on how long it takes the polyglot maven stuff to bake |
| 14:36 | chouser | nah, xml rocks |
| 14:36 | cemerick | but I'll likely stick with the XML bits for quite a long time given the tooling |
| 14:36 | Chousuke | Raynes: you have to admit that what cemerick showed blows lein right out of the water :P |
| 14:37 | Raynes | I didn't want what cemerick showed. |
| 14:37 | cemerick | Did I show something I didn't mean to? ;-) |
| 14:37 | Raynes | And it wouldn't make me stop using Lein in any case. It's all I need at this point. |
| 14:37 | cemerick | Sorry, you gotta go the long way around the barn for that one. |
| 14:37 | chouser | seriously, I've got build files here written in cmake's custom language, gnumake's custom language, and I've worked with qmake -- xml is beautiful compared to those. |
| 14:38 | cemerick | fogus: there's lots of us, we just don't jump up and down so much |
| 14:39 | chouser | I actually expect cemerick's demo and attitude to be meaningful to a lot of people. |
| 14:39 | cemerick | chouser: w.r.t. plugins, the maven native plugin will probably make your socks roll up and down. |
| 14:39 | cemerick | i.e. lots of gcj, jni bits |
| 14:39 | Raynes | It would be sad to see Leiningen die as a project at this point, but judging why what I've seen here, looks like it might happen. :\ |
| 14:39 | Raynes | by* |
| 14:40 | Chousuke | fogus: I'm rather pleased that maven is so declarative :) |
| 14:40 | mattrepl | why is lein dying? |
| 14:40 | fogus | Raynes: Seen here? |
| 14:40 | Raynes | Looks like everybody is perfectly happy with maven. |
| 14:40 | mattrepl | I use lein, don't like maven |
| 14:40 | cemerick | Raynes: I'm the outlier at the moment, FYI. Just trying to get people into tools that work today. |
| 14:40 | Chousuke | Raynes: lein just needs to change to utilise maven more :) |
| 14:40 | Raynes | mattrepl: Obviously, cemerick will change your mind. |
| 14:41 | fogus | Raynes: I doubt you'll find perfect happiness associated with anything, must less Maven |
| 14:41 | Raynes | ;) |
| 14:41 | Raynes | Just saying. I thought Leiningen was the big awesome around these parts, but today has really given me a new perspective. I never knew this many people were this happy with maven. |
| 14:41 | chouser | I doubt that many people would avoid maven purely based on the xml. It's a combination of unfamilier terms (artifact, phase, groupId, pom), complex-looking pom file content, its desire to manage its own user- or system-wide repo, the xml itself, and all that up against a sense of "that's a lot of junk, why should I bother? The tool I have (make, ant, now lein) works fine!" |
| 14:42 | Chousuke | Raynes: leiningen is great, but it can't compare with maven |
| 14:42 | Chousuke | Raynes: maven has simply had too much development put into it |
| 14:42 | cemerick | chouser: that's part of the "everyone's got their own 20%" syndrome. |
| 14:42 | Raynes | Chousuke: It's also a very young project that could become a lot more. |
| 14:42 | fogus | Honestly, my exposure to Maven and Lein are almost non-existent. But after spending the past 3 years wrestling with a yak-shaved build system at work I'm very very tired of thinking about build tools |
| 14:43 | Chousuke | Raynes: but that lots more still doesn't compare to maven :) |
| 14:43 | chouser | so a demonstration of what maven will buy you can go a long way to understanding why it's worth adopting maven's set of pain. |
| 14:43 | Raynes | But it could do more with maven. |
| 14:43 | cemerick | Raynes: who's going to build all those tools? I'm asking, seriously. |
| 14:43 | Chousuke | Raynes: indeed. lein could become a thin, clojureish maven frontend |
| 14:44 | mattrepl | it kind of is |
| 14:44 | technomancy | Chousuke: it already is that, basically |
| 14:44 | chouser | I have used lein exactly once to build ring, and maven exactly once to build contrib. ...roughly similar pain. |
| 14:44 | technomancy | more for the deps than other things. I've thought a bit about a plugin adapter for maven since we've been using the appassembler stuff for deployment at work, and it does the job pretty well. |
| 14:45 | Chousuke | I think maven scares people mostly because it downloads the internet :P |
| 14:45 | Raynes | technomancy: Don't be discouraged by these rebels! We shall rule zeh world! |
| 14:45 | fogus | I saw a funny tweet the other day that said something like "mvn clean just downloaded 3 jars" |
| 14:46 | cemerick | Yup. World domination through maven screencasts, that's me. 9.9 |
| 14:47 | Raynes | Looks like you're succeeding. :p |
| 14:47 | kylesmith | I'm still having trouble using elpa to install stuff in emacs. grep -R slime-control-modified-char .emacs.d returns nothing. Anyone have any ideas? |
| 14:51 | Raynes | cemerick: Can I do mvn swank? |
| 14:51 | technomancy | Raynes: it works, but it AOTs everything up front |
| 14:52 | technomancy | so you can't use it to fix a problem that causes compilation errors. =( |
| 14:52 | Raynes | technomancy: Ew. |
| 14:52 | Raynes | Not sold. :| |
| 14:52 | cemerick | Raynes: yes, see here: http://github.com/talios/clojure-maven-plugin |
| 14:52 | cemerick | technomancy: even if you don't bind the compile goal? |
| 14:52 | technomancy | it also doesn't work if you have swank-clojure test-scoped |
| 14:53 | technomancy | cemerick: we don't have any explicit config for swank in our pom |
| 14:53 | technomancy | maybe you can unbind it; I haven't looked into it closely. |
| 14:54 | cemerick | technomancy: you mean it's set up in a parent somewhere? |
| 14:54 | technomancy | I mean we declare it as a dependency and that's it |
| 14:56 | hiredman | I think we need to stop worrying about buildsystems and instead build time machines so we can reclaim all the time lost waiting for builds |
| 14:56 | stuartsierra | hiredman: But then when would we goof off? |
| 14:57 | hiredman | (or hop on irc) |
| 14:57 | hiredman | stuartsierra: we'll multiplex |
| 14:57 | Raynes | stuartsierra: During the time it takes cemerick to write our maven poms for us. |
| 14:57 | hiredman | live for two or three days each real time day |
| 14:57 | hiredman | this could get complicated |
| 14:59 | stuartsierra | We need some concurrency control mechanisms. |
| 14:59 | stuartsierra | You know, put ourselves in Refs or something. |
| 15:01 | cemerick | stuartsierra: atoms, please. It hurts when future states of me have to get rebuilt because of contention. |
| 15:02 | stuartsierra | heh ): |
| 15:02 | stuartsierra | :) |
| 15:03 | stuartsierra | Although having a completely safe way to try new things might be useful. |
| 15:05 | kylesmith | I found someone else who has the same problem as me: http://pastebin.com/xhPHszg4 I also just realized I have slime version 1:20080223-2 installed. Will that cause problems? |
| 15:06 | technomancy | kylesmith: if you've got a system-installed version of slime it might interfere |
| 15:07 | kylesmith | Hmm, my sysadmin says it can't be uninstalled for some reason. Can I set some sort of precedence? |
| 15:08 | technomancy | kylesmith: but elisp-level compilation errors don't necessarily mean the elisp failed to install |
| 15:08 | technomancy | you can still run it in interpreted mode |
| 15:12 | technomancy | cemerick: I think you might have a bit of a misconception about how lein works since you mentioned people "reimplementing javac, shell exec, etc." ... that stuff is all handled through the ant API that lancet exposes. |
| 15:13 | kylesmith | interpreted mode is fine, I guess. Do you have a link for that? |
| 15:13 | technomancy | it comes out to around 700 LOC if you exclude lancet. |
| 15:14 | technomancy | basically two weeks worth of work plus contributions that have accumulated since then |
| 15:15 | technomancy | kylesmith: I don't know of any link. just ignore the compilation warnings and proceed as per instructions. |
| 15:16 | cemerick | technomancy: I wasn't exclusively talking about lein, but I do see stuff like this, which is really troubling. http://github.com/alienscience/leiningen-war/blob/master/src/leiningen/war.clj |
| 15:16 | kylesmith | I did. Reload emacs, M-x slime -> "slime-presentation-init-keymaps: Symbol's function definition is void: slime-control-modified-char" |
| 15:16 | kylesmith | which is one of the compile errors |
| 15:16 | cemerick | technomancy: You're right that I wasn't aware of the lancet part, but the point is a general one, I think. |
| 15:17 | technomancy | cemerick: I see... yeah, I'm sure that plugin could be rendered unnecessary with a good plugin adapter. |
| 15:18 | technomancy | since my own needs are simple I haven't looked into it much |
| 15:18 | cemerick | FWIW, There was some very lengthy discussion about shell exec w.r.t. lein in here a few weeks ago that wow'ed me in the same way, so I inferred from that. :-( |
| 15:19 | kylesmith | technomancy: Well, I have to go for now. Thanks for the help so far. |
| 15:19 | technomancy | kylesmith: definitely an old version of slime left around somewhere on your system; check C-h v load-path to debug further |
| 15:20 | cemerick | technomancy: BTW, I certainly mean you no ill will (I know people can get personal about projects, etc). Just trying to provide some...perspective? ;-) |
| 15:22 | technomancy | cemerick: sure, understood. I think it's good that people be aware of what's out there and leverage existing tools, especially for people with slightly more exotic needs like OS X apps or .war files. |
| 15:23 | cemerick | technomancy: it's a favorite saying of mine lately that everyone says "I only need 20% of *that*", but everyone's 20% is different. |
| 15:23 | cemerick | though I'd say just about everyone needs .war files :-) |
| 15:24 | technomancy | (sorry) |
| 15:24 | stuartsierra | heh |
| 15:24 | cemerick | I cling to them for exactly the same reason! :-D |
| 15:24 | cemerick | war, cargo, done. |
| 15:25 | technomancy | the sweet spot for leiningen adoption so far has been higher up the stack... for libraries that aren't meant to be deployed but just used for other applications to depend upon. |
| 15:26 | technomancy | where requirements are rather uniform |
| 15:27 | technomancy | I wonder how much plugin support the maven-ant-tasks library provides. |
| 15:28 | technomancy | I tried to interop with maven itself, but the dependency injection framework it was using seemed to be pretty hostile to outside use. |
| 15:28 | cemerick | technomancy: just out of curiosity, remind me again why lein and not clj polyglot? |
| 15:28 | technomancy | (in the immortal words of alex payne: "Curl up and DI.") |
| 15:28 | technomancy | cemerick: tired of waiting, mostly |
| 15:29 | technomancy | it was literally usable within two weeks of weekends and evening hacks |
| 15:30 | stuartsierra | technomancy, cemerick: lein does seem to make the simple case easy. Maybe someday we can unite our efforts. |
| 15:30 | technomancy | it's significantly smaller than clojure-maven-plugin still, though of course since that's implemented in Java it's hardly apples-to-apples. =) |
| 15:34 | technomancy | I guess you could load the file and then subtract the line-count of the docstring of each var; heh |
| 15:37 | mattrepl | build tools should build, not sure why deployment would be expected. perhaps it's just semantics. or perhaps it's certain expectations of build tools since maven does more than just build. |
| 15:55 | gfodor | I'm getting some very weird behavior with converting from byte arrays to strings and back |
| 15:55 | gfodor | here's an example to highlight it |
| 15:55 | gfodor | ,(count (.getBytes (String. (byte-array [(byte -62) (byte -113) (byte 80)]) "UTF8"))) |
| 15:55 | clojurebot | 3 |
| 15:56 | gfodor | on my machine, that returns 2! |
| 15:56 | gfodor | (mac osx) |
| 15:58 | lancepantz | what do i pass to get a repl with a script loaded? |
| 16:00 | programble | <gfodor> (mac osx) |
| 16:01 | programble | i read that |
| 16:01 | programble | as |
| 16:01 | programble | clojure code |
| 16:01 | Raynes | ,(mac osx) |
| 16:01 | clojurebot | java.lang.Exception: Unable to resolve symbol: mac in this context |
| 16:01 | Raynes | :( |
| 16:01 | programble | lol |
| 16:01 | gfodor | hah -- anyone with a mac get that to return 2? |
| 16:01 | fogus | gfodor: does for me too |
| 16:01 | gfodor | that seems horribly wrong, right? |
| 16:02 | gfodor | in JRuby on mac osx, it worsk |
| 16:03 | headius | mac java has a fux0red default encoding |
| 16:03 | headius | we force it to utf-8 |
| 16:03 | headius | (we jruby) |
| 16:03 | headius | it's MacRoman by default but nothing renders MacRoman right |
| 16:04 | Chousuke | you shouldn't care about the number of bytes in a string unless you're working with encodings :/ |
| 16:04 | gfodor | yeah I am doing BER-packing |
| 16:04 | gfodor | (hey Charles :)) |
| 16:04 | gfodor | reimplementing JRuby's pack("w")/unpack("w") |
| 16:04 | headius | gfodor: hiya |
| 16:04 | headius | ahh for perf or a bug? |
| 16:04 | headius | or for clojure? |
| 16:04 | gfodor | just so I can read packed strings from clojure packed by a jruby script |
| 16:04 | headius | ahh |
| 16:05 | headius | good old pack |
| 16:07 | gfodor | oh, I figured it out |
| 16:08 | gfodor | you need to supply the encoding to getBytes also |
| 16:08 | gfodor | why is that? It's it just, er, bytes? |
| 16:08 | headius | it uses default external encoding if you don't |
| 16:08 | headius | which would be macroman if you don't specify it on OS X |
| 16:08 | headius | hence, OS X java iz dum |
| 16:08 | gfodor | right, surely I'm just being dumb here, but why do you need to supply the encoding to *get* the bytes out? |
| 16:09 | Chousuke | gfodor: all strings are stored as UCS-2 internally by java |
| 16:09 | gfodor | oh |
| 16:09 | gfodor | *sigh* |
| 16:09 | gfodor | ok, the world makes sense, thanks |
| 16:09 | fogus | ,(count (.getBytes (String. #^bytes (byte-array [(byte -62) (byte -113) (byte 80)]) "UTF8") "UTF8")) ;; yuck |
| 16:09 | clojurebot | 3 |
| 16:09 | gfodor | yeah |
| 16:10 | gfodor | any desire for BER packing code for clojure.contrib? :) |
| 16:10 | Chousuke | UCS-2 was a horrible choice for the internal encoding though :P |
| 16:10 | Chousuke | but, hindsight ;P |
| 16:11 | Chousuke | I bet many string ops in java would be much faster if strings were UTF-8 internally |
| 16:17 | gfodor | hey headius, here's some jruby fun |
| 16:17 | gfodor | [2000].pack("w").to_java_string.to_s.size == [2000].pack("w").to_s.size |
| 16:17 | gfodor | false |
| 16:24 | headius | gfodor: what is 'w' again? |
| 16:24 | gfodor | BER-compressed |
| 16:24 | gfodor | nice int packing for small ints |
| 16:24 | gfodor | the problem is basically that hopping through java String "corrupts" the byte array |
| 16:25 | gfodor | I believe you guys keep the raw bytes in the RubyString so if you stick to the Ruby side of things everyting is cool |
| 16:25 | gfodor | as such, clojure is not going to have the ability to pack into Strings |
| 16:26 | headius | yeah, that's why we don't use Java strings |
| 16:26 | headius | you can't easily represent arbitrary byte arrays |
| 16:26 | technomancy | mattrepl: not necessarily that build tools should perform the deployment, but that they should build artifacts that are deploy-ready |
| 16:27 | mattrepl | technomancy: completely agree |
| 16:27 | technomancy | for our use at least, a jar is not enough; you want /etc/init.d/ scripts to go with it and at least some basic shell scripts for interaction |
| 16:27 | technomancy | we have actual deployment happening with chef |
| 16:29 | mattrepl | why not have chef handle deploying the scripts and jars, where the scripts are either static files or being generated from a template on the chef side? don't have experience w/ chef, so maybe preprocess steps, such as generating scripts, can't be done |
| 16:31 | technomancy | mattrepl: we probably would if we were using leiningen, but maven did offer some plugins that gave us scripts out of the box. |
| 16:32 | technomancy | I'm bad at shell scripting, so I'm predisposed against writing my own. =) |
| 16:35 | mattrepl | heh. I'd think no longer, post-lein |
| 16:36 | technomancy | all the .sh in leiningen is either copied from a known-good source or written by contributors. =) |
| 16:40 | slyphon | i'm trying to use JYaml, and when it parses a file, it returns a java.util.HashMap. is there an easy way of turning that into a clojure hash-map? |
| 16:42 | technomancy | slyphon: sure, try (into {} java-hashmap) |
| 16:42 | slyphon | oh, duh |
| 16:42 | slyphon | ah, almost, it only went one level, but i can take it from there |
| 16:48 | alexyk | liebke: the latest incanter on clojars returned by search is 1.0-master. That brings in the snapshot of 20091226... surely old? |
| 16:53 | slyphon | hmm |
| 16:54 | slyphon | (prn-str) because every language should have a "porn star" function |
| 16:54 | KirinDave | Are seq's thread safe? |
| 16:54 | KirinDave | I mean, like line-seq |
| 16:54 | liebke | alexyk: yeah the version on Clojars is obsolete. Go to http://repo.incanter.org |
| 16:54 | alexyk | liebke: so you chose not to clojar anymore? |
| 16:55 | liebke | alexyk: it wasn't by choice, it was necessary due to Incanter's build structure. Clojars doesn't support modular maven projects |
| 16:55 | alexyk | liebke: got it, cool |
| 16:56 | technomancy | KirinDave: the same seq shared across multiple threads should cache itself so changes to the underlying source (file, array, etc) should not interfere |
| 16:56 | KirinDave | technomancy: Okay, so that's all done magically for me. |
| 16:56 | KirinDave | technomancy: So if i write a lexer into a lazy seq, so long as it uses lazy seq and no state between the calls, it will Just Work™ |
| 16:56 | slyphon | argh |
| 16:56 | slyphon | recursion hurts my brain |
| 16:57 | technomancy | KirinDave: I believe so |
| 16:57 | KirinDave | technomancy: That's cool. |
| 16:57 | alexyk | liebke: you may want to remove the old incanter from clojars then; or setup a cron job to push the new jars there just in case :) |
| 16:58 | technomancy | yep =) |
| 16:58 | alexyk | slyphon: get a recursive brain, you'll be ok |
| 16:58 | liebke | alexyk: last time I checked there wasn't a way to remove projects from clojars |
| 16:58 | Raynes | Recursion is awesome. |
| 16:58 | chouser | slyphon: are you sure you need clojure maps? |
| 16:58 | Chousuke | slyphon: recursion is easy, you only need to understand recursion |
| 16:59 | alexyk | technomancy: is it OK to just git pull in the leiningen dir once it was hacked as specified, with a symlnk pointing into the git guts? |
| 16:59 | slyphon | chouser: it would make life easier, i believe |
| 16:59 | technomancy | alexyk: not sure what "hacked as specified" means here |
| 16:59 | chouser | slyphon: if you're going to do persistent updates then you need to convert, otherwise you might not. |
| 17:00 | slyphon | nah, this is read-only |
| 17:00 | slyphon | it's for configuration |
| 17:00 | chouser | java maps still do all the seq stuff properly |
| 17:00 | slyphon | hmm |
| 17:00 | alexyk | meaning, bootstrapped with static, then that used to build git checkout |
| 17:01 | alexyk | then bin/lein from that checkout is used; so if I want a newer, I just git pull, nothing else? no magic> |
| 17:01 | alexyk | ? |
| 17:01 | slyphon | it's situations like this that the -> macro totally rocks my world |
| 17:01 | technomancy | alexyk: oh, I see; the bootstrap directions from the readme. that's right; git pull should be all you need to get up to date. |
| 17:02 | technomancy | the symlink being from src/leiningen/bin/lein to somewhere on your path |
| 17:02 | alexyk | liebke: you can sternly implore _ato to nuke the old crap |
| 17:02 | alexyk | technomancy: so basically it pulls whatever jar it needs, no need to rebuild it right? |
| 17:03 | technomancy | alexyk: yes, currently there's no AOT necessary |
| 17:03 | alexyk | hey people, why would I want to edit my project.clj to update 1.1.0-master-SNAPSHOT to 1.2.0-...that? is there some yummy stuff in 1.2.0 already? |
| 17:04 | technomancy | alexyk: well you should at least move to 1.1.0 stable. =) |
| 17:04 | alexyk | I mean irresistably yummy, de rigeur for any true #clojure-ian? |
| 17:05 | technomancy | but 1.2.0 has lots of goodies like fine-grained locals-clearing even if you aren't interested in the Big Exciting protocols, reify, deftype, etc. |
| 17:05 | alexyk | technomancy: I thought SNAPSHOT is ahead of the stable, with bug fixes and such, no? |
| 17:05 | alexyk | say 1.1.0 is released, is 1.1.0-master branch ahead of it? |
| 17:05 | technomancy | alexyk: no, SNAPSHOT is always behind stable of the same version number |
| 17:05 | Raynes | albino: deftype, reify, NAMED ARGUMENTS, etc. |
| 17:05 | technomancy | SNAPSHOT just means stable hasn't been released yet |
| 17:05 | alexyk | Raynoceros: thx |
| 17:06 | alexyk | NAMED ARGUMENTS! now we're talking |
| 17:06 | Raynes | Named arguments: they're that important. |
| 17:06 | technomancy | get it while it's hot; only a couple days old |
| 17:08 | alexyk | yay! I *love* named arguments since Ada 83 |
| 17:08 | alexyk | a language without named arguments is pfft |
| 17:10 | chouser | named arguments without a language is worse |
| 17:10 | alexyk | named arguments: what name did you just call my mama? |
| 17:10 | alexyk | by reference? |
| 17:11 | alexyk | chouser: how's that MEAP coming along? Now that I payed for it, I expect speedy updates! :) |
| 17:11 | The-Kenny | alexyk: I think I read something on Twitter about this |
| 17:12 | The-Kenny | But I can't remember what it was :/ |
| 17:12 | alexyk | The-Kenny: about chouser? |
| 17:12 | The-Kenny | about the meap updates, propably it was written by him |
| 17:13 | alexyk | ah! at least I want one without typos! :) |
| 17:13 | alexyk | I mean c'mon, we got 2 authors and lots of typos! they can cross-proofread! |
| 17:14 | alexyk | Manning has people to proofread, with all the ripping-off and whatnot! |
| 17:14 | alexyk | the guy who finds strangely clothed men for the covers can do it in between finds |
| 17:15 | underdev | lol |
| 17:16 | Raynes | chouser: Yeah. Leave this channel immediately and continue writing. I wants updatez. |
| 17:16 | alexyk | chouser: ignore Raynes, I'll take live advice any time over the written word |
| 17:17 | Raynes | chouser: Ignore alexyk, you can teach us more in the book than you can teach us here. |
| 17:17 | Raynes | We have hiredman if we need help. |
| 17:17 | alexyk | chouser: doubly ignore Raynes, do both! |
| 17:17 | Raynes | Run along now. |
| 17:17 | alexyk | the hiredman is hired and not for any more hire |
| 17:18 | Raynes | alexyk: That was poetic. |
| 17:18 | The-Kenny | Yay! Github is using <canvas> for the network graph now :) http://github.com/blog/621-bye-bye-flash-network-graph-is-now-canvas |
| 17:18 | alexyk | Raynes: indeed |
| 17:22 | chouser | ha, you guys are funny. |
| 17:23 | chouser | we've submitted several updated and new chapters, and are just waiting for manning to do what they do to them before they go up on the MEAP. |
| 17:23 | chouser | so "any day now" |
| 17:25 | technomancy | probably waiting on those lazy reviewers |
| 17:25 | underdev | chouser: i read some tweets that they were soon coming, but have been checking and they weren't there. Waiting for a little more content to pull the trigger... |
| 17:26 | Raynes | underdev: I'll put some grease on the trigger. |
| 17:26 | chouser | underdev: that's fine. there will be a mostly-new chapter 1 soon, which may allow you to better evaluate the book. |
| 17:26 | alexyk | (lazy-seq reviewers) |
| 17:27 | underdev | "pull the trigger"... hanging out on slickdeals too much... |
| 17:29 | alexyk | underdev: just pull the damn trigger already, or it will get rusty |
| 17:30 | alexyk | manning had 47% off recently |
| 17:30 | alexyk | the way to do it is to sign for their list, wait for a ridiculous uneven discount like 42% for two books, and get chouser's and say hadoop |
| 17:31 | alexyk | or two chouser's, one for you, one for the kids! |
| 17:31 | alexyk | one for grandma |
| 17:31 | chouser | 45% right now http://twitter.com/chrishouser/status/10990587934 |
| 17:32 | alexyk | wow! divisible by 5! incredible! |
| 17:33 | programble | lol |
| 17:34 | underdev | chouser: i actually tried it early today, and it wasn't taking my coupon code |
| 17:34 | chouser | underdev: hmph. |
| 17:34 | underdev | so i guess i did try to pull the trigger |
| 17:34 | underdev | me too |
| 17:35 | chouser | I got it from the bottom of this page: http://tinyurl.com/ygo3654 |
| 17:36 | chouser | maybe being mentioned in slot 10 of the bestselling meap list isn't sufficient? |
| 17:36 | alexyk | IRC: Collective Intelligence in Inaction |
| 17:37 | alexyk | chouser: that list is just bestsellers! the special deals on top do not grep it |
| 17:38 | alexyk | the top 10 are always there for reference... |
| 17:38 | alexyk | but, they say "mentioned in this mailer" |
| 17:38 | chouser | it says "any book mentioned in this mailer" in bright red giant font |
| 17:38 | alexyk | yes |
| 17:38 | chouser | so .. I thought ... but perhaps I was wrong. |
| 17:38 | chouser | sorry |
| 17:38 | alexyk | someone has to explain them what "mentioned" means -- it's a contract in the US |
| 17:39 | alexyk | I'll testify in small claims court |
| 17:39 | underdev | yeah, when i hit apply with code m3145, the price doesn't change |
| 17:39 | alexyk | notary-certify grep results of page source | grep clojure certify found |
| 17:39 | alexyk | hence they owe the discolunt |
| 17:40 | alexyk | discount |
| 17:40 | alexyk | btw looks like 3145 are the digits of π |
| 17:40 | alexyk | almost |
| 17:41 | slyphon | you guys know if there's a way to recursively search back through the history in the *slime-repl clojure* buffer? |
| 17:41 | slyphon | like C-r in readline? |
| 17:41 | danlarkin | recursively? ...what |
| 17:42 | slyphon | incrementally |
| 17:42 | slyphon | sorry, brain-fart |
| 17:43 | danlarkin | C-r does an isearch-backward |
| 17:43 | slyphon | i know you can just do C-r and search up through the buffer, but if you don't have the buffer saved.. |
| 17:43 | danlarkin | which is probably what you want |
| 17:44 | danlarkin | oh, I see what you mean |
| 17:44 | slyphon | there's C-<up arrow>, which goes through the history entries one-by-one |
| 17:44 | slyphon | yeah |
| 17:44 | slyphon | just curious, i can live without it |
| 17:44 | danlarkin | there's M-p-r |
| 17:45 | underdev | yeah, code no good |
| 17:45 | slyphon | ooh |
| 17:45 | slyphon | that looks promising |
| 17:45 | slyphon | danlarkin: thanks |
| 17:47 | alexyk | underdev: just sign up for the email, it's usually 40+% every other week |
| 17:48 | alexyk | sometimes for 2 books, you can get another as an excuse for getting the discount |
| 17:53 | alexyk | Lucene/Hadoop/Mahout/Intelligence are all good for 2 books |
| 17:55 | ihodes | anyone have an easy way to copy something to the clipboard? java.awt.datatransfer isn't working for me too well |
| 18:02 | miltondsilva | ,(interleave {:a :b} {1 2}) |
| 18:02 | clojurebot | ([:a :b] [1 2]) |
| 18:03 | Licenser | ,(interleave [:a :b] [1 2]) |
| 18:03 | clojurebot | (:a 1 :b 2) |
| 18:03 | miltondsilva | :( |
| 18:03 | Licenser | might be better to understand that way :) |
| 18:03 | Licenser | what did you expect it to do? |
| 18:03 | miltondsilva | {:a 1 :b 2} |
| 18:03 | Licenser | wow but that is a very different thing |
| 18:04 | miltondsilva | I always forget coll isn't a map |
| 18:04 | Licenser | ,(seq {1 2} |
| 18:04 | clojurebot | EOF while reading |
| 18:04 | Licenser | ,(seq {1 2}) |
| 18:04 | clojurebot | ([1 2]) |
| 18:04 | Licenser | ,(flatten {1 2}) |
| 18:04 | clojurebot | java.lang.Exception: Unable to resolve symbol: flatten in this context |
| 18:04 | kotarak | ,(zipmap (mapcat identity {:a :b}) (mapcat identity {1 2})) |
| 18:04 | clojurebot | {:b 2, :a 1} |
| 18:04 | kotarak | But what would be the use? |
| 18:04 | Licenser | kotarak was faster :) |
| 18:05 | kotarak | You can't guarantee key order. (in general) |
| 18:05 | Licenser | especially since there is no order in maps |
| 18:05 | miltondsilva | I'm processing *.obj files |
| 18:05 | miltondsilva | need to get vertices and faces |
| 18:06 | Licenser | miltondsilva: but why map keys values from two maps? |
| 18:06 | miltondsilva | now that you mention it.. I see it's useless |
| 18:07 | kotarak | ,0xff |
| 18:07 | clojurebot | 255 |
| 18:07 | miltondsilva | oh |
| 18:07 | miltondsilva | no |
| 18:07 | miltondsilva | it's no from to maps |
| 18:07 | kotarak | ,0o77 |
| 18:07 | clojurebot | Invalid number: 0o77 |
| 18:07 | miltondsilva | two* |
| 18:07 | Licenser | bit {} is a map |
| 18:07 | kotarak | ,077 |
| 18:07 | clojurebot | 63 |
| 18:07 | Licenser | *but |
| 18:07 | Licenser | ,007 |
| 18:07 | clojurebot | 7 |
| 18:07 | Licenser | I want that to be fixed to "Bond" :( |
| 18:08 | miltondsilva | it's someting like this (vertices faces) -> {:vertices vertices :faces faces} |
| 18:09 | Licenser | ah I see |
| 18:09 | Licenser | reduce it? |
| 18:09 | Licenser | I don't know what exactly vertices or faces are but I have somethign that looks a bit like that |
| 18:10 | kotarak | ,(zipmap [:a :b :c :d] [1 2 3 4]) |
| 18:10 | clojurebot | {:d 4, :c 3, :b 2, :a 1} |
| 18:10 | cemerick | mabes: ping? |
| 18:10 | Licenser | http://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox/tester.clj#L51 look at this? |
| 18:11 | mabes | cemerick: hey! you don't mind if I ask you some noob java deployment questions do you? |
| 18:11 | Raynes | Licenser: If you don't have any use for the 'new' branch, I'm going to go ahead and delete it since it's been merged. |
| 18:11 | Licenser | Raynes: please do :) I forgot how to do it :P |
| 18:12 | Raynes | Licenser: git branch -d <branchname> |
| 18:12 | Raynes | ;P |
| 18:12 | Licenser | I tried that :( didn't worked |
| 18:12 | Licenser | it deleted it locally but on on github |
| 18:12 | mabes | cemerick: are you using jetty in production? if so, are you using embedded jetty? |
| 18:13 | cemerick | mabes: no, not in production yet -- embedded jetty in dev environments tho |
| 18:13 | Licenser | I just read the google groups massage about the build tool and I think there is a entire different question we didn't asked: Do we actually need/want a build tool? |
| 18:13 | kotarak | Licenser: (reduce #(update-in %1 [(:type %2)] conj (:tests %2)) {} definitions) |
| 18:13 | Licenser | kotarak: :( that is too easy |
| 18:13 | miltondsilva | Licenser, kotarak: thanks but I see now that I don't need to do it. but if theres a better way of doing this let me know :) http://clojure.pastebin.com/WRB5GH89 |
| 18:14 | cemerick | mabes: did you get my /msg? |
| 18:14 | Raynes | Licenser: git push origin :new <-- Deletes a remote branch. |
| 18:14 | Licenser | I mean (@the build tool thing) the JVM has a great JIT, so what is wrong with just using .clj files and calling them. It saves the entire silly -main stuff to |
| 18:15 | Licenser | jruby comes a long way with that and I don't see much of a drawback, or actually any important need for compiling clojure code (save for libs callable from java) |
| 18:15 | Raynes | Licenser: Also, I added a few new functions to the whitelist, so be sure to pull before your next push. |
| 18:15 | Licenser | aye |
| 18:16 | cemerick | Licenser: I really don't know where to start. Customers don't like running stuff from the command line, and you can't reasonably run a site with a pile of shell scripts to manage jvm instances manually. |
| 18:16 | headius | clojure doesn't seem to have a way of referencing files normally |
| 18:16 | headius | not like Ruby's "require" |
| 18:16 | headius | that might be a problem for running without a precompile |
| 18:16 | clojurebot | not a problem, the average bid for it on getacoder is $821.00 |
| 18:16 | Licenser | then lets add that? |
| 18:17 | hiredman | headius: load-file? |
| 18:17 | Licenser | I mean it should not be a problem to - eww okay it already exists |
| 18:17 | headius | hiredman: does that work once you've precompiled everything |
| 18:17 | Licenser | just give it a nicer less scary name :P |
| 18:17 | Licenser | but why precompile? |
| 18:17 | hiredman | ,(doc load-file) |
| 18:17 | clojurebot | "([name]); Sequentially read and evaluate the set of forms contained in the file." |
| 18:17 | hiredman | ,(doc load) |
| 18:17 | clojurebot | "([& paths]); Loads Clojure code from resources in classpath. A path is interpreted as classpath-relative if it begins with a slash or relative to the root directory for the current namespace otherwise." |
| 18:17 | Licenser | I mean 90% of the stuff can run without it right? |
| 18:18 | headius | there's some duality here about being a file versus being a class though, no? |
| 18:18 | headius | load-file won't load clojure code compiled into classes I presume |
| 18:18 | headius | will load load files? |
| 18:18 | cemerick | load loads classes preferentially to .clj files |
| 18:18 | hiredman | headius: in RT at least it has some functionality to load a file or class, whichever is newer, dunno how it is exposed |
| 18:18 | headius | and is there no conflict between naming of classes versus files? |
| 18:18 | hiredman | cemerick: whichever is newer |
| 18:19 | headius | that's the issue we have |
| 18:19 | cemerick | hiredman: ah, right. |
| 18:19 | headius | files can have arbitrary paths and filenames that aren't valid class names |
| 18:19 | Licenser | in a ideal world doing something like clj src/my-main-file.clj and java -jar my-jar.jar should do the same |
| 18:19 | headius | Licenser: right |
| 18:19 | Licenser | that is what we should aim to get |
| 18:19 | kotarak | miltondsilva: another approach http://clojure.pastebin.com/6Hym772L |
| 18:20 | headius | it's just hard to support that seamlessly because filesystem paths may differ from package+class |
| 18:20 | headius | in jruby we try to mangle paths both ways... / becomes _, + becomes _plus_ |
| 18:20 | headius | but it's hard |
| 18:20 | miltondsilva | kotarak: much better :) |
| 18:21 | Licenser | but it is kind of important to give the entire thing a 'it just works' feeling, and that is important in my eyes |
| 18:21 | headius | like how do you make a .clj be loadable as either a class or a file with one line of code if it's in a dir structure like blah/foo/1.0.5/whatever |
| 18:21 | kotarak | miltondsilva: but not tested... |
| 18:21 | miltondsilva | yes but the idea ;) |
| 18:21 | headius | that's been the challenge for jruby |
| 18:21 | headius | I'd love to brainstorm solutions |
| 18:22 | Licenser | hmm brute force: take your class path map the files which classes they have |
| 18:22 | Licenser | silly but not impossible solution |
| 18:23 | Licenser | this makes the startup for projects from the commandline (a bit?) slower but it seems jars are preffared anyway |
| 18:23 | Licenser | if you've a FS with meta data you youd even stuff such things in the meta data |
| 18:23 | headius | getting pretty wild now |
| 18:23 | headius | it needs to be simple and work everywhere |
| 18:24 | Licenser | you've a relative path, some how |
| 18:24 | Licenser | I guess |
| 18:24 | Licenser | so scanning the files in that path once and mapping class -> file(s) should not be impossible |
| 18:24 | miltondsilva | kotarak: you had a very small typo (fload) apart from that it works very well |
| 18:24 | Licenser | for small to medium sized projects I doubt the time for that would be even notable |
| 18:25 | kotarak | miltondsilva: ah. 23:23 o'clock here, typos are allowed. ;P |
| 18:25 | Licenser | in clojure a class = a namespace right? |
| 18:25 | Licenser | just to get sure, I'm not a clojure expert |
| 18:25 | kotarak | Licenser: no |
| 18:25 | Licenser | what do we actually want then? |
| 18:25 | headius | it's especially weird for jruby since require can do things like require '~foo/bar/../baz/quux' |
| 18:25 | headius | what class name do you look for there? |
| 18:26 | Licenser | hmm hmm |
| 18:27 | Licenser | I am confused now |
| 18:27 | kotarak | ,xff |
| 18:27 | clojurebot | java.lang.Exception: Unable to resolve symbol: xff in this context |
| 18:28 | cemerick | ,0xff |
| 18:28 | clojurebot | 255 |
| 18:29 | Raynes | <Nilium> I think the one thing we got out of lisp was emacs, and that's akin to a war crime. |
| 18:29 | Licenser | headius: off topic question, do you have a highlight on jruby? :P |
| 18:29 | kotarak | cemerick: I know. I wondered whether the 0 is necessary (and of course it is, because xff is a symbol, but it's already late here ...) |
| 18:30 | cemerick | :-) |
| 18:30 | kotarak | cemerick: btw: wau wau grrr woof woof woof - oh, you mentioned it. My mistake. ;) |
| 18:30 | headius | Licenser: jruby and duby, yes :) |
| 18:30 | Licenser | will ther be jduby? |
| 18:30 | cemerick | kotarak: dude, I totally missed that one. :-) |
| 18:31 | Licenser | :) |
| 18:31 | Licenser | sneaky headius, sneaky |
| 18:31 | headius | probably something like that once I start to look into type hints for jruby |
| 18:31 | Licenser | ^^ |
| 18:33 | kotarak | ,0xffM |
| 18:33 | clojurebot | Invalid number: 0xffM |
| 18:33 | kotarak | k |
| 18:34 | Licenser | 0xdeadbeef |
| 18:34 | Licenser | m,0xdeadbeef |
| 18:34 | Licenser | ,0xdeadbeef |
| 18:34 | clojurebot | 3735928559 |
| 18:34 | Licenser | geez I suck :( |
| 18:42 | headius | ,(/ 1 0) |
| 18:42 | clojurebot | java.lang.ArithmeticException: Divide by zero |
| 18:42 | headius | dang |
| 18:42 | programble | um |
| 21:46 | defn | i wish there was a way to generate a bit of test data by intelligently parsing a function and determining what it expects for its vars |
| 21:47 | _ato | type inference? |
| 21:48 | hiredman | clojurebot: deft? |
| 21:48 | clojurebot | deft is http://gist.github.com/128259 |
| 21:48 | defn | awesome! named it deft? |
| 21:49 | hiredman | it's old and not very good |
| 21:50 | defn | hiredman: i think the consensus today was to use deft and deftype |
| 21:51 | hiredman | deft for the struct like map thing ontop of deftype? |
| 21:51 | defn | yes |
| 21:51 | defn | there was a lot of talk about calling it defmaptype |
| 21:51 | defn | or pruning defstruct |
| 21:51 | defn | but in the end i got the impression that it would be called deft and deftype |
| 21:52 | defn | i dont fully understand how it all works yet so dont quote me too literally on that |
| 21:53 | defn | hiredman: i created a basic clojure interface for maxmind's geoip java library. is that a clojure library? I almost feel guilty publishing it because it is just a transcription of java to clojure... |
| 21:55 | hiredman | *shrug* |
| 21:57 | defn | i suppose it oculdnt hurt anyone |
| 21:57 | defn | i just feel sort of like a fraud publishing it |
| 21:57 | defn | there's no original work in it |
| 22:02 | defn | 17:28 < kotarak> cemerick: btw: wau wau grrr woof woof woof - oh, you mentioned it. My mistake. ;) |
| 22:02 | defn | gah, sorry |
| 22:04 | cp2 | hiredman: pardon for rolling through your gists, but... http://gist.github.com/223246 |
| 22:04 | cp2 | what is this for, heh |
| 22:04 | cp2 | i mean, its pretty obvious what it _does_ |
| 22:04 | cp2 | not so much _why_ |
| 22:05 | Mec | Anyone know a good tutorial that shows all the different types of swing components? |
| 22:08 | sattvik | Mec: I thought there were some Swing demos that shipped with the JDK, you could look for those. |
| 22:08 | dsop | is there a function in clojure on contrib which doesnt add the reuslt of a map to the new list of the result is nil |
| 22:10 | dsop | so to say it ignores the result value if it's nil |
| 22:11 | sattvik | dsop: What do you mean by the result of a map? Are you talking about (map fn data)? |
| 22:12 | miltondsilva | you could filter the result? |
| 22:12 | dsop | sattvik: yes (map fn data) |
| 22:13 | Mec | (map fn (filter identity data)) |
| 22:14 | sattvik | ,(filter (complement nil?) (map identity [1 2 nil 4])) |
| 22:14 | clojurebot | (1 2 4) |
| 22:15 | miltondsilva | ,(remove nil? (map identity [1 2 nil 4])) |
| 22:15 | clojurebot | (1 2 4) |
| 22:16 | dsop | hm |
| 22:16 | dsop | thx |
| 22:17 | sattvik | miltondsilva: That's even better. I wondered if there was a way to avoid the complement. |
| 22:17 | miltondsilva | :) |
| 22:20 | dsop | Mec: hm i'm not sure if i understand why identity doesn't map nil |
| 22:20 | miltondsilva | ,(map identity [1 2 nil 4]) |
| 22:20 | clojurebot | (1 2 nil 4) |
| 22:20 | Mec | (filter identity [1 2 nil 4]) |
| 22:20 | Mec | ,(filter identity [1 2 nil 4]) |
| 22:20 | clojurebot | (1 2 4) |
| 22:20 | miltondsilva | it does... but you then remove the nils |
| 22:21 | dsop | ah ys |
| 22:22 | Mec | its about equivalent but i prefer (remove nil?) it says more what you want to do |
| 22:26 | slyphon | uhm |
| 22:30 | brian__ | Hi, I'm just learning about java interopt, I'm not sure I understand how java objects are used, ie in Java: Tclass t = new Tclass() , what is the equivalent to "t" in clojure? Thanks |
| 22:31 | miltondsilva | brian__: http://java.ociweb.com/mark/clojure/article.html#JavaInterop |
| 22:34 | brian__ | ok |
| 22:56 | brandonw | if i am having problems figuring out exactly what something is called in clojure.contrib, is there a way to list all namespaces available in clojure.contrib? |
| 22:59 | Mec | brandonw: http://richhickey.github.com/clojure-contrib/index.html |
| 23:01 | brandonw | right, but theoretically if there isn't any documentation |
| 23:01 | brandonw | or i don't have access to it at the moment |
| 23:01 | brandonw | is there any way to enumerate symbols in a namespace from within clojure? |
| 23:01 | Mec | There is, but i'm not sure how to do it |
| 23:06 | Mec | The namespace section of the cheatsheet has some that might work |
| 23:07 | brandonw | perfect: all-ns does the trick |
| 23:07 | brandonw | that's what i was looking for, thanks :) |
| 23:07 | Raynes | brandonw: There is also grep. :> |
| 23:08 | brandonw | yes, but i don't like to leave clojure, it is too nice :) |
| 23:08 | brandonw | Raynes from reddit? |
| 23:08 | Raynes | brandonw: Aye, sir. |
| 23:08 | brandonw | i am the annoying one talking to you about vimclojure ;) |
| 23:09 | Raynes | And I'm the annoying one complaining about VimClojure. |
| 23:09 | brandonw | :) i only wanted to help because i didn't realize you already had emacs; i thought you were trying out vim from nothing |
| 23:10 | brandonw | definitely no reason to deal with vimclojure's problems if you already have something perfectly workable, not to mention emacs' support is significantly better |
| 23:10 | Raynes | Naw. I'm persistent enough that I could figure everything out if I really needed to. I just wanted to try it out a while back. |
| 23:11 | brandonw | yeah. it isn't so much that vimclojure rivals emacs' clojure support (it is reasonably close, but still noticeably worse) |
| 23:11 | Raynes | I'm fairly certain that once Meikel gets the build stuff and documentation for such worked out, it will be much simpler. |
| 23:11 | brandonw | it is more amazing what meikel did with vim (which is much harder to extend for something like swank-clojure) |
| 23:11 | brandonw | yeah |
| 23:11 | Raynes | I imagine. VimScript makes my eyes burn. |
| 23:11 | Raynes | @_@ |
| 23:12 | brandonw | i am still amazed at his vim/clojure prowess. i've tried several plugins for different filetypes in vim |
| 23:12 | brandonw | and they all had the basics, and some attempted stuff like auto-complete |
| 23:12 | brandonw | but nothing has come even close to vimclojure in terms of a fully working repl, completion, viewing source, going to definitions, auto-completion |
| 23:12 | brandonw | with only vim-script to work with, it truly astounds me :) |
| 23:13 | Raynes | Agreed. |
| 23:14 | Mec | wooo lich king dead finally |
| 23:15 | Mec | now back to programming |
| 23:15 | brandonw | a blizzard fan |
| 23:15 | brandonw | you wouldn't happen to have a starcraft 2 beta key you could accidentally PM me with :D |
| 23:15 | Raynes | Probably because Diablo II is so god-awful hackable. |
| 23:15 | Mec | no :x havnt gotten one myself |
| 23:16 | brandonw | yeah, i'm actually working on a bwapi-proxy port to clojure as an exercise in learning clojure |
| 23:16 | brandonw | not to mention making it easier to interface with :) |
| 23:16 | Raynes | brandonw: Hilariously, it was teh blizzhackers that got me into programming. I still hang around #bhdev on SynIRC. |
| 23:17 | Raynes | I assume you probably know of them. |
| 23:17 | Raynes | If you're a blizzard fan. |
| 23:17 | brandonw | that's pretty cool :) what were they doing when you first started programming? |
| 23:17 | brandonw | yeah, they are the ones responsible for the sc2 beta crack :) |
| 23:17 | brandonw | which i for some reason haven't tried yet... |
| 23:17 | Raynes | It was when the 1.12 patch was released a couple of years ago. |
| 23:17 | Raynes | They were mostly doing map hack and tppk. |
| 23:18 | Raynes | *cough*#clojure-casual*cough* |
| 23:19 | phren0logy | Is anyone else using LabREPL? |
| 23:19 | Raynes | miltondsilva: Hit-and-run channel joins are frowned upon. ;P |
| 23:19 | Raynes | It's more active during the day. We're growing slowly. |
| 23:20 | miltondsilva | :) I was just checking to see if there was much activity |
| 23:23 | Raynes | brandonw: You should totally join. If only to check out my bot. |
| 23:23 | Raynes | :p |
| 23:23 | brandonw | #clojure-casual? |
| 23:23 | Raynes | Indeed. |
| 23:23 | brandonw | i thought i checked to see who was in it, and i didn't see anyone |
| 23:23 | brandonw | i guess i typed the wrong channel :) |