#clojure logs

2010-03-25

00:00defnbrandonw: you may well be right, and your solution is fine
00:00defnim just curious
00:00brandonwyeah, it seems like the destructuring docs of let says that you can only destructure a vec on anything that supports nth
00:01brandonwso if you have a map as an input, you wouldn't be able to destructure it into a vec
00:02brandonwyour best bet would be to destructure the specific value you want, and then wrap it in a vector in an additional binding
00:02brandonw,(let [{i :foo} {:foo {:bar 1 :baz 2}} output-val [i]] i)
00:02clojurebot{:bar 1, :baz 2}
00:02brandonwhmm that didn't work
00:03brandonwoh right
00:03brandonw,(let [{i :foo} {:foo {:bar 1 :baz 2}} output-val [i]] output-val)
00:03clojurebot[{:bar 1, :baz 2}]
00:05brandonwhttp://pastie.org/885990
00:05brandonwwith a little better indentation and a def to make it more concise
00:06brandonw{i :foo} grabs the value mapped to the :foo key in test-val
00:06defnbrandonw: im sorry if this is a poor quesiton but im still abit lost on how to implement it
00:06defnlet's say we have...
00:06brandonwbinding output-val to [i] just wraps that val in a vector
00:06brandonwand then you can return the vector
00:06defn,(def k 5)
00:06clojurebotDENIED
00:06defnah darn
00:06brandonwyeah, no defs in clojurebot
00:06brandonwexcept in a let :P
00:07brandonwunless hiredman fixed it...?
00:07defnbrandonw: i have learned that probably a 1000 times, but there is always the hope :)
00:07brandonw,(let [f (def x 1)] f)
00:07clojurebotDENIED
00:07brandonwyes he did! :)
00:08defnbrandonw: so let's say you have {:x {:y 1 :z 2}, :xx {:yy 3 :zz 4}}
00:09defnhow would you create a [{:y 1 :z 2} {:yy 3 :zz 4}] with destructuring -- my first thought is an anonymous function maybe?
00:10shalesbrandonw: 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:10defnshales: good catch, thanks
00:11brandonw(let [{out1 :x out2 :xx} {:x {:y 1 :z 2} :xx {:yy 3 :zz 4}} full-output [out1 out2]] full-output)
00:11brandonw,(let [{out1 :x out2 :xx} {:x {:y 1 :z 2} :xx {:yy 3 :zz 4}} full-output [out1 out2]] full-output)
00:11clojurebot[{:y 1, :z 2} {:yy 3, :zz 4}]
00:11brandonwshales: thanks, i thought i had missed something
00:11brandonwdefn: wrapping a vector around two keys isn't possible in the destructuring, i don't think
00:12defnim trying to get a big map which is structured like the above
00:12brandonwyou 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:12defnand turn it into [{:x 1 :y 2} {:xx 3 :yy 4}...]
00:12brandonwbasically, if you have a map as your input, you can't destructure and end up with a vec i don't think
00:13brandonwright, i don't think you can destructure directly into that
00:13brandonwi think the closest you can get is destructuring into the {:x 1 :y 2} and {:xx 3 :yy 4} as two separate values
00:13brandonwand then create a vec inside that binding
00:13brandonwerr in the scope of that binding
00:14defnheh -- i need to get my head straight
00:14clojurebotthe world <reply>what the world needs is more higher order functions
00:17shalesdefn: if you just want a vector of all the values of a map you can do (vec (keys m))
00:17shales,(vec (vals {:x {:y 1 :z 2}, :xx {:yy 3 :zz 4}}))
00:17clojurebot[{:y 1, :z 2} {:yy 3, :zz 4}]
00:18defnbahahaha
00:18defnshales: thanks
00:18brandonwyep, that would definitely be much easier :)
00:18brandonwthat isn't technically destructuring though, right?
00:18defnbrandonw: thanks for indulging my stupidity
00:18defn:)
00:18brandonwwe're all learning :)
00:19shalesno it's not destructuring at all
00:19brandonwi liked going through that just for the sake of getting some practice with destructuring
00:19brandonwi haven't had a reason to use it yet... i don't think...
00:19shalesyeah, I've not destructured a map yet either
00:20defnme either! :)
00:21defnone really handy one listed in the docs:
00:22defn,(let [{:keys [:fred :ethel :lucy]} m] m)
00:22clojurebotjava.lang.Exception: Unsupported binding form: :lucy
00:22defn,(let [{:keys [fred ethel lucy]} m] m)
00:22clojurebotjava.lang.Exception: Unable to resolve symbol: m in this context
00:22defnwhy god, why?
00:22brandonwthe name you want to bind to comes first in a map binding
00:23brandonwplus, you need to have m defind as something
00:23brandonw:)
00:23defnbrandonw: :keys is a directive
00:23defnhttp://clojure.org/special_forms
00:23brandonwohhhh right
00:23brandonwoh interesting
00:23brandonwso you could get what you originally wanted, a vector of the keys in a destructuring
00:23brandonwcool!
00:24defn,(let [m {:keys [fred ethel lucy]}] m)
00:24clojurebotjava.lang.Exception: Unable to resolve symbol: fred in this context
00:24defnif i knew how to tie my shoes...
00:26brandonwactually nevermind
00:27brandonwthat only allows you to basically do what i did, without having to do {t1 :x t2 :xx}
00:27brandonwinstead you can just do {:keys [t1 t2]}
00:27shalesyeah, just avoids redundancy
00:27brandonw,(let [{t1 :x t2 :y} {:x "hello" :y "goodbye"}] [t1 t2])
00:27clojurebot["hello" "goodbye"]
00:28brandonw,(let [{:keys [t1 t2] {:x "hello" :y "goodbye"}] [t1 t2])
00:28clojurebotUnmatched delimiter: ]
00:28brandonw,(let [{:keys [t1 t2]} {:x "hello" :y "goodbye"}] [t1 t2])
00:28clojurebot[nil nil]
00:28brandonwhmm
00:29brandonw,(let [{:keys [t1 t2]} {:t1 "hello" :t2 "goodbye"}] [t1 t2])
00:29clojurebot["hello" "goodbye"]
00:29brandonwthere we go
00:29shaleskeys in the map must be keywords with the same name
00:29shalesyep
00:29brandonwforgot you had the values in the vector have to be the same as the keywords
00:30brandonwclojure is fun
00:30brandonwtoo bad i can't use it at work yet
00:31shalesthere's similar directives for keys that are symbols or strings too
00:31shales,(let [{:syms [t1 t2]} {'t1 "hello" 't2 "goodbye"}] [t1 t2])
00:31clojurebot["hello" "goodbye"]
00:31fanaticojust need to convince them that you want to use a new Java library called "clojure" ;)
00:31brandonw:(
00:31shales,(let [{:strs [t1 t2]} {"t1" "hello" "t2" "goodbye"}] [t1 t2])
00:31clojurebot["hello" "goodbye"]
00:31brandonwi don't even use java at work yet :(
00:31brandonwheck, i'm making a web app and we don't even use an mvc framework yet
00:32fanaticobrandonw: php?
00:32shalesWhat doesn't this print anything? (.start (Thread. (fn [] (println "Other thread" (Thread/currentThread)))))
00:32brandonwc# asp.net forms :(
00:32brandonwwow it is already 12:30 i should be asleep
00:32brandonwgood night
00:32zaphar_psuse the clr library named clojure then :-)
00:33brandonwwell we are going to port everything over to java eventually
00:33brandonwbut we just need to finish it so it can replace the crap that is in use now
00:33brandonwwhich would do pretty well on the dailywtf i think :)
00:33brandonwgoodnight
00:33zaphar_psjust think of all the code that will port over unchanged if it was in clojure
00:33bmasonI notice in the compojure source some "defn-" calls... what's the difference between this and "defn" ?
00:34shalesdefn- is private
00:34zaphar_psdefn- make s a private function
00:34shalesalthough I'm not sure what the implications are
00:34bmasonso not accessible to things using/referring to the namespace?
00:34zaphar_psit won't get exported when the namespace is used/required
00:34bmasoncool cool
00:34bmasongood to know
00:35bmasonhmm, would be kinda nice to have a reader macro for that
00:35zaphar_psbasically it just does (with-meta fun {:private true}) to the function
00:36zaphar_psbmason:
00:36bmasongotcha
00:37zaphar_pswhich you can do with the #^{:private true} reader macro to shorten a bit
00:38zaphar_psyou can do a lot of fun stuff with metadata on clojure code
00:38zaphar_ps:-)
00:38bmasonI guess that's not too bad
00:39bmasonin fact more descriptive than C++'s "private"
00:39zaphar_pslol
00:39bmasonsince you're explicitly setting meta data
00:40bmasoninstead of performing some *magic*
00:43shaleshmm, 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:45shaleswhy would that be?
00:45zaphar_psshales: the command line repl's threads all go to the same stdout
00:45bmasondid you check your inferior lisp buffer?
00:45bmasonI've had stuff come out on that
00:45shalesbingo!
00:45zaphar_psbut the swank repl's spawned thread goes to the lein-swank buffer probably
00:46zaphar_psheh bmason beat me to it
00:46zaphar_psinferiror lisp buffer in your case since mine is a little customized
00:47shalesthat's good to know. Thought I was going a little crazy
00:47bmasonyeah, it had me scratching my head
00:47zaphar_psit's because swank sets up a special *out* for slime but your thread didn't use it
00:47shalesKnow how to direct the stdout to the same buffer?
00:47bmasonemacs has taken some getting used to
00:48zaphar_psshales: not off the top of my head I'm not sure if the two threads can share the same *out* var
00:49bmasonyou should be able to bind *out* to the correct stream, I would think
00:49bmasonbut I'm not sure how you would identify the correct stream
00:49shaleshad same idea. this works: (.start (let [out *out*] (Thread. (fn [] (binding [*out* out] (println "Other thread" (Thread/currentThread)))))))
00:49zaphar_psbmason: capture the value of *out* in the first thread and use it in second thread
00:50bmasonshales: check out with-out-str
00:50bmasonoh, actually that's a nice one shales
00:51bmasonmakes sense
00:57shalesah, similar story for *err*
00:59shalesbut 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:14defnHow 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:16defnin other words, combine all the maps which contain :country "US", reducing on the val of :count
01:23hiredmandefn: your maps are wrong
01:23hiredmanthey should be {"US" 2} {"DK" 4} etc
01:23hiredmanmerge-with +
01:24defnhiredman: this is a slow evolution of a structure
01:24hiredmanwell, it's wrong :)
01:25defnoriginally it was like {:ip-address {:count 5 :country "US"} :ip-address-b {:count 3 :country "RU"}...}
01:25defnerr actually it was originally {:ip-address 5, :ip-address-b :3}
01:25defnthen i added countries into the map, then i removed the ip address from the map, blah blah -- it's wrong! :)
01:25defni think i need to rewrite all of this because this is clearly garbage
01:26hiredman(apply hash-map ((juxt [:country :count]) {:country "US" :count 1}))
01:27hiredman,(apply hash-map ((juxt [:country :count]) {:country "US" :count 1}))
01:27clojurebotjava.lang.IllegalArgumentException: Key must be integer
01:27hiredmaner
01:27hiredman,(apply hash-map ((juxt [country :count) {:country "US" :count 1}))
01:27clojurebotUnmatched delimiter: )
01:27hiredmangah!
01:27hiredmananyway, if you writing it correctly it will work
01:29hiredmanyour data is your schema, and schemas evolve
01:30defnmy 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:30hiredmanyou could just it do with reduce
01:34hiredman,(reduce (fn [a {:keys [country count]}] (merge-with + a {country count})) {} [{:count 2 :country "US"} {:count 5 :country "US"} {:count 4 :country "DK"}])
01:34clojurebot{"DK" 4, "US" 7}
01:39hiredman,(map (fn [[country count]] {:country country :count count}) {"DK" 4, "US" 7})
01:39clojurebot({:country "DK", :count 4} {:country "US", :count 7})
01:48defnhiredman: thanks man -- that's very helpful
02:45ihodeshey 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:45ihodescould someone please point me in the right direction?
02:46hoeck,(map seq ["a", "a-{", ")-"])
02:46clojurebot((\a) (\a \- \{) (\) \-))
02:47hoeck,(mapcat seq ["a", "a-{", ")-"])
02:47clojurebot(\a \a \- \{ \) \-)
02:47hoeckihodes: ^^ is that what you want?
02:47ihodesthat's superb! thanks!
02:48hoecknp :)
02:48ihodeshow does that work? looks somewhat tricky
02:50hoeck,(seq "my String")
02:50clojurebot(\m \y \space \S \t \r \i \n \g)
02:50ihodesah, of course... haha thank you so much!
02:50hoeckseq returns a sequence of characters from a string
02:50hoeckand mapcat calls seq on each string in the vector and concatenates the result
02:51ihodesthat makes sense
02:51ihodesi'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:52hiredman,(char 98)
02:52clojurebot\b
02:52defnhow many core clojure fns are there nowadays?
02:52ihodes,(int \a)
02:52clojurebot97
02:52ihodessplendid :) thanks!
02:53hiredmanclojurebot: ping?
02:53clojurebotPONG!
02:53defn,(count (ns-publics 'clojure.core))
02:53clojurebot503
02:53defnis that right? 500 core clojure fns?
02:55hiredman,((ns-publics 'clojure.core) '*print-level*)
02:55clojurebot#'clojure.core/*print-level*
02:55hiredmannot a fn
02:55defnah right
02:55defnlots of special vars and such in there
02:55hiredmannot that many
02:57_ato,(count (filter #(and (.isBound %) (fn? @%)) (map val (ns-publics 'clojure.core))))
02:57clojurebot464
02:57defn,(count (filter () (ns-publics 'clojure.core))) gah beat me to it
02:57clojurebotjava.lang.RuntimeException: java.lang.ClassCastException: clojure.lang.PersistentList$EmptyList cannot be cast to clojure.lang.IFn
03:04ihodeshmmm... 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:05hiredmanwhy would (String. '(\a \b \c)) work?
03:05hiredman~jdoc String
03:06ihodesbecause you can construct a String from an array of chars, right? thought it was worth a try
03:06hiredmana list is not an array
03:06hoeck,(apply str '(\a \b \c))
03:06clojurebot"abc"
03:06ihodesthat's true, but as i'm new to clojure, i wasn't sure if it'd correctly convert :\ was worth a try.
03:06robinkHello
03:07hoeckhi robink
03:07ihodesthanks hoek – that, again, makes sense. i need to get the right mindset here.
03:10hoeckihodes: a list would work if the java.lang.String constructor allowed java collections of Chars
03:10ihodesah ok, so I could, hypothetically, "convert" the collection to an array and then use String. that way?
03:10ihodesthough, obviously, using apply makes more sense
03:14_ato,(String. (char-array [\a \b \c]))
03:14clojurebot"abc"
03:14hoeck,(String. (into-array Character/TYPE '(\a \b)))
03:14clojurebot"ab"
03:15hoeckchar-array is new to me :)
03:25ihodesoh neat
03:28ihodesso 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:29hoeckihodes: with mapcat you get one big list of all chars
03:29_ato,(mapcat seq ["a" "1" "3"]) ; as hoeck demoed above ;-)
03:29clojurebot(\a \1 \3)
03:30ihodesgah, 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:31hoeck:)
03:32LauJensenMorning guys
03:38defnmorning lau
03:41zmilagood
03:42defnhow to turn ({:x 1} {:x 2}) into [{:x 1} {:x 2}]
03:43noidi,(into [] (list {:x 1} {:x 2}))
03:43clojurebot[{:x 1} {:x 2}]
03:43hiredman(doc vec)
03:43clojurebot"([coll]); Creates a new vector containing the contents of coll."
03:44defn(doc vector)
03:44clojurebot"([] [& args]); Creates a new vector containing the args."
03:44noidiah, right
03:44defnah, that's where i went wrong
03:44LauJensen,(vec '({:x 1} {:y 2}))
03:44clojurebot[{:x 1} {:y 2}]
03:45defn(vector '({:x 1}))
03:45LauJensenWould be considered more idiomatic
03:45defn,(vector '({:x 1}))
03:45clojurebot[({:x 1})]
03:45defn,(vec '({:x 1}))
03:45clojurebot[{:x 1}]
04:10defnanyone familiar with incanter?
04:10defnim trying to build a histogram using [{:x 1} {:y 2} {:z 3}]
04:12defn(doto (incanter.charts/histogram (keys (above-structure)) :legend true) view (incanter.charts/add-histogram (vals (above-structure))))
04:14Chousukeis the histogram object mutable? :/
04:15defnim just going off of the example here
04:41Licenserdefn: greetings, I'll have to run for work in a few but I'll fix the walton thing today
04:43mitkokHey, 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:43defnLicenser: no worries
04:43defnLicenser: have you worked with incanter at all by chance?
04:45LicenserNope never used it
04:45_atomitkok: 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:46defnbah this is driving me nuts
04:47mitkok_ato: Yep, just 'slime'. I have those three under ~/.swank_clojure
04:50_atohmm
04:51_atomitkok: 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:51LinnkHey guys, just started going through the Clojure reference to learn the language. Does #^ always designate a hashmap?
04:51defnLicenser: {} is a hash map
04:51defnerr Linnk: {} is a hash map
04:51LicenserI was about to ask why you tell me that :P
04:52LinnkHehe :P
04:52defn#^ is a type hint, Linnk
04:52defn(defn my-fn [#^String some-text] (println some-text))
04:53Linnkdefn: Aha, that explains a lot
04:53mitkok_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:55Licenser#^ is helpfull if you need performance in java interop
04:55Licenserit makes it way faster ;) defn can sing a song about that I guess
04:56_atomitmok: 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_atoI have: % ls ~/.swank-clojure
04:56_atoclojure-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:57mitkok_ato: the same as you, java version "1.6.0_18"
04:57mitkok_ato: may be I need to set path or classpath or something, I\m pretty new
04:58_atoyou normally shouldn't need to add any configuration to emacs
04:58_atoand that java command I asked you to run should have worked
04:58_atohmmm
05:04defnweird -- Incanter doesnt show anything in the frames it creates
05:05_atomitkok: 'fraid I'm out of ideas. Unless perhaps you've got some corrupt jars. http://gist.github.com/343335
05:05_atoI guess you could try deleting ~/.swank-clojure and rerunning M-x slime so it downloads them again
05:09mitkok_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:12defnman this is weird
05:12defnincanter just refuses to produce any image in the frame it creates
05:12mitkok_mst: Invalid or corrupt jarfile clojure...
05:14_mstah hah! interesting :) what does 'file ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar' think it is?
05:16mitkok_mst: Zip archive data, at least v1.0 to extract
05:17_atotruncated maybe?
05:17_msthm, so there's at least a zip file header there :)
05:17_mstyeah, I wonder
05:18_mstdoes 'jar tvf ~/.swank-clojure/clojure-1.1.0-master-20091202.150145-1.jar' report any errors?
05:19mitkok_mst: java.util.zip.ZipException: invalid END header (bad central directory offset)
05:19_mstah, yick :) so it does look like those .jar files are corrupt
05:20_atoperhaps 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:22mitkokat last, it's working :)
05:23mitkokthanks _mst and _ato :)
05:23_msthuzzah
05:23_ato:)
05:25defnuh oh
05:27esjindeed !
05:52licoresseCan I undefine something in the repl?
05:56hoecklicoresse: (ns-unmap (find-ns 'the-namespace) 'the-symbol)
05:56Chousukens-unmap can help
05:57hoeckor (ns-unmap *ns* 'blah)
05:57licoressegreat
06:34bb_ozso - anyone else new to clojure?
06:36zmilame new :)
06:36zmilarelatively
06:37bb_ozwhy clojure?
06:39underdevpower, sumplicity, java integration
06:39zmila"why" for whom? for me or for you?
06:39underdevsimplicity
06:40bb_ozsorry - 'why' for you
06:40bb_ozsimplicity is one. STM is another
06:40Linnk<- barely started, so kinda' new
06:42cypher23bb_oz, Power, Flexibility, Concurrency
06:42martenfor 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:42martens/lisp/common lisp/
06:45bb_oz@marten: lisp. Had been toying with sbcl and ccl for a while. beautiful.
06:53bb_ozI was actually hopeful about abcl, but was unsure about the java 'match'
06:54underdevyou just can't beat clojure's integration
06:55bb_ozit certainly appears to be that way. I'll shed a tear for CL though :)
06:57underdevits hard to compare a language spec designed in the 80s with one in the late 2ks
06:58underdevmust have been the 80s, because i first used allegro CL in 91
07:01bb_ozlisp language spec is much older than the 80's
07:01bb_ozand clojure is a lisp-1 :)
07:04ChousukeSometimes it feels like the fact that lisp is standardised is holding it back
07:04ChousukeCL, I mean
07:05underdevyeah, 1956 i believe
07:05underdevi meant CL
07:06bb_oz@underdev: ah ok - sorry :)
07:06Chousukethe 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:06underdevwell, 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:07bb_oz@chousuke: clojure should see a lot more development. There's a few books out there as well.
07:07Chousukebb_oz: Clojure's still fairly young as programming languages go, though.
07:12underdevmy 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:12underdevusually
07:13underdevi've seen a few functions that look "write only" to me, but very few
07:13ChousukeI really don't see most things in clojure as syntactic sugar anymore :P
07:13bb_ozso what are you using clojure for in your profession?
07:14Chousuke#() is, though.
07:14Chousukebut the syntax for vectors and maps isn't sugar, it's necessary.
07:14underdevto a tcl programmer '() is syntactic sugar :)
07:14Linnk#^{} is weird too, for a beginner :)
07:15ChousukeLinnk: that's kind of required too. there's no other way to attach read-time metadata to symbols
07:15underdev(list 1 2 3) (vector 1 2 3) (map :foo "bar")
07:15underdevnot necessary
07:15Chousukeunderdev: those are not equivalent to the [] versions
07:16Chousukeyou can't do (defn foo (vector a b c) ...)
07:16underdevoic. like i said, i thought i wouldn't like it, but i do, and use them
07:16underdev:)
07:16Chousukeyou'd need (defn foo #=(vector 'a 'b 'c) ...) :P
07:17underdevone could conceive of a clojure in which they aren't necessary, at least :)
07:17Chousukehm, probably without quotes though. I forget it's the reader
07:17LinnkChousuke: 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:17Chousukeunderdev: well, yes. But I like having more syntax elements than just lists :)
07:18Chousukeunderdev: it allows you to write more expressive macros for oen
07:18Chousukeone*
07:18underdevrt. i didn't think i would, but i do too
07:19underdevi love the time i spent programming in perl, but it scared my psyche somehow
07:19underdevHOMOGENY! GIVE ME HOMOGENY!!!
07:19sparievlol :)
07:19Chousukethe 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:20underdevChousuke: agreed
07:20zmilamissing one more brace-type for sets :) maybe <:a :b :c> instead of #{:a :b :c}
07:21Chousukezmila: nah, those need to stay as symbol characters because of > and <
07:21Chousukeand others
07:22bb_ozgoodnight people
07:32dmiles_afki been imlmenting a full common lisp in java.. unlike ABCL i dont use java object ypes... i use interfaces...
07:32underdevneat! so what do YOU think of clojure?
07:32dmiles_afkmy hope is sometimes i can go thru clojures code and add this LispString LispSequence interfaces to clojures objects
07:33dmiles_afkwell i like its invokation syntax
07:33dmiles_afkwell i love its invokation syntax
07:34dmiles_afkand the lack of extra work arround using any pre-existing libraries/jarts
07:34dmiles_afkjars
07:34dmiles_afki actually for a bigish secondlife project use clojures intial prototype
07:35underdevcool.
07:35dmiles_afkso i love it.. but i also like common lisp.. i want both
07:35dmiles_afki still have a learning curve to leverage certain concurrency features
07:36dmiles_afkwhat are these thnigns called?
07:37underdevrt
07:38Chousukedmiles_afk: what things?
07:38Chousukeyou mean the reference types?
07:38Licenser_defn: I think I fixed the no result problem
07:38dmiles_afksorry other people in house talking to me.. looking it up
07:39underdevChousuke: i think he was saying..
07:39underdevnm
07:40dmiles_afkRefs and Transactions
07:40underdevi 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:41dmiles_afkAll 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:41dmiles_afkall tht stuff.. i havent epxored it yet ;)
07:41dmiles_afkbut they must be usefull!
07:41dmiles_afkwhen someone says refernce types my mind goes : Class<Object>
07:41dmiles_afknon pimtives
07:43Chousukedmiles_afk: there are other reference types besides refs :)
07:44dmiles_afkoh 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&amp;view=markup to clojures holder objects
07:44Chousukethey all have differing concurrency semantics
07:44dmiles_afkibteraces/interfaces
07:44Chousukeeep. SVN ;(
07:44Chousukedo yourself a favour and learn git :)
07:44Chousukeor any DVCS, really.
07:44dmiles_afki work from Murcurial.. but LarKC is the downstream
07:45underdevin 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:45Chousukeah, right.
07:45zmilalet's start rel-war about hg-git vs svn :)
07:46dmiles_afkhttp://code.google.com/r/logicmoo-invoke-interface/source/browse/src/com/cyc/tool/subl/jrtl/nativeCode/type/core/LispObject.java?r=78adc38de481044a64f2bbc85b2ef6f62cccb1f1
07:46dmiles_afkok DCVS :)
07:46underdevzmila: you mrsn hg vs svn-git, right ?
07:46underdev:)
07:46Chousukezmila: 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:47dmiles_afkoh but the cool part is the common lisp compiler targets anyhting that implments that interface
07:48vyxk
07:48dmiles_afkbut there are a ton of helpers to make it easy
07:48zmilayes, git and hg and distributed is ok. but when you are in project whith 30 other people skilled only with svn...
07:48dmiles_afki mean helper classes so clojure doesnt have to implment all 253 methods for each of its datatype ;)
07:48Chousukethat's a heavy interface :|
07:49dmiles_afkhehe i realized that after i showed it
07:49ChousukeI suppose it approaches the same as Clojure's interfaces, but I don't see why it's all in one
07:49dmiles_afkmost are supposed to return a classcast excetiom like toStr()
07:50dmiles_afktoNumber() etc
07:50dmiles_afkso like intValue() is coded as toNumber().intValue()
07:50ChousukeClojure's interfaces are split up so that for example, to support being invoked as a function you only need to implement IFn
07:51dmiles_afkbut most caller expect to hit intValur() in case you are already its right class
07:52dmiles_afkyeah.. that kind of need to be donewith this lisp.. that IFn thing is sane ;P
07:52dmiles_afkoh 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:52dmiles_afkthat what it will look like when its done
07:53dmiles_afk(LispObject.ava that is will look more like SubLObject.java .. i know i know still heavy)
07:53dmiles_afkbut more what you described
07:54dmiles_afkbut clojure tightens it up even saner
07:54ChousukeThere are probably reasons why the interfaces are so huge, but I can't think of any :P
07:55dmiles_afkto avoid casting.. the compiler already vetted the methodcalls will not throw a abstractimplmentationerror
07:55dmiles_afkwhich is still legal to emit classes that dont fully implment an interface
07:56dmiles_afk(yet creatable)
07:56Chousukehmm
07:56dmiles_afkAbstractMethodError is throw i guess
07:56ChousukeClojure has AFoo things to match IFoo, so you can derive from AFoo to get default implementations
07:57Chousukeand many of the interfaces actually extend the smaller interfaces, so I guess you do end up with a "huge" interface in the end
07:58ChousukeHm, I wonder where that clojure interface graph chouser did is.
07:58dmiles_afkIFoo and IBar extends IObject but maybe IOjbect isnt as big
07:58dmiles_afkoh but IFoo + IObject is really what IFoo is
07:59Chousukehttp://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:00dmiles_afknot horrid .. just well loved
08:01dmiles_afkthough StringSeq might be big
08:02ChousukeThat graph will have to be updated when protocols start being used seriously though.
08:02Chousukemost of the interfaces will be replaced with protocols I think
08:02dmiles_afkoh diamonds not that big actualy
08:02dmiles_afkone protcol per interface
08:02dmiles_afk+?
08:02clojurebot5 (for large values of 2)
08:03Chousuke:P
08:03dmiles_afkor on protocal per method?
08:03Chousukedmiles_afk: probably not exactly. The interfaces might get refactored in the process
08:03Chousukedmiles_afk: protocols are basically a group of functions
08:03dmiles_afkon/one
08:04dmiles_afkdo two protocals share the same functions sometimes?
08:04Chousukeeg. "Sequence" would be a protocol of first, rest at least
08:04dmiles_afkso it might overlap with COns protocol slightly
08:05ChousukeI think the idea is that you're not supposed to think of protocol fns as anything special
08:06Chousukethey're just normal functions; the protocol construct just allows efficiently implementing and extending them to work on numerous types
08:06dmiles_afkok.. just becaue they share first() it dont mean that first() is some specific expected implmention
08:07Chousukeright. 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:07dmiles_afkmakes sense. just like a java interface
08:08Chousukeprotocols can be extended to work on types retroactively though
08:08Chousukeeg. Strings can implement a seq protocol like (extend java.lang.String PSeq {:seq somefn-that-returns-a-string-seq})
08:09dmiles_afkso can a text file of chars..
08:09Chousukecurrently. there are many ifs in the java source to special-case seq to work on strings and other non-clojure types
08:09dmiles_afkso that means we can construct copy-to simpler?
08:10Chousukeprotocols just allow that to be done without a mess of if-elseif-elseif...
08:10dmiles_afki mnean to copy-from the string sequnce of the file that is a seq of chars
08:10Chousukedmiles_afk: it wouldn't really change how seq works
08:10Chousukedmiles_afk: just how it's implemented
08:11dmiles_afki see.. so what you end up with is map of type<->method
08:11dmiles_afk(maps instead of ifthenelses)
08:11Chousukekind of. with caching and other performance tricks
08:13dmiles_afki hink lispers need o be able to do clojure inline to their code easier ;)
08:13Chousukeas a bonus, there's one fewer explicit dependency on the JVM.
08:13dmiles_afkhink
08:13dmiles_afkttthink
08:13dmiles_afkgood point about the dependancies
08:13Chousukeprotocols could be implemented on various hosts in various ways
08:16dmiles_afksomething i strive for sometimes is .NET.. actally .net provides "events" like VB6 used to
08:17dmiles_afkwell basically subscriptions.. java has that.. its avaiblme
08:17dmiles_afkbut just not used as pervasivly
08:17Chousukeyou mean the delegate/event syntax?
08:18dmiles_afkyeah
08:18dmiles_afkin clojure i can set a field with a IFn?
08:18dmiles_afkand it calls my method when some event happens?
08:19Chousukedmiles_afk: well, you don't *set* a field in Clojure usually.
08:19Chousukedmiles_afk: because that's imperative
08:19Chousukebut the reference types do have a watcher mechanism
08:20dmiles_afkoh righ thtat unmodifiable as much as can get away with it
08:20dmiles_afk(more unmodifable now.. the faster it will be later)
08:21Chousukehopefully :)
08:22tomojdoes anyone happen to know the appropriate size for a video screencast to be put on vimeo?
08:22dmiles_afksometimes the event delegate thing can be overdone. just like too much of anything
08:22dmiles_afkbut it makes visualzing a solution for a problem easier at time
08:22dmiles_afks
08:23Chousukeevents are a bit problematic in functional programming though :/
08:23tomojfrp?
08:24AWizzArdChousuke: can you please tell me a bit more about what you mean?
08:24Chousuketomoj: yeah, that was my first thought. But I havne't quite been able to grok it. :P
08:25ChousukeAWizzArd: I think events are difficult to model functionally as they fundamentally have "time" associated with them.
08:25tomojhttp://www.haskell.org/frp/publication.html#fruit
08:25tomojreading that
08:28noiditomoj, interesting, thanks for the link!
08:28ChousukeI 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:29Chousukehmmhm
08:29dmiles_afkwell 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:30dmiles_afkC subscribes to B
08:30Chousukedmiles_afk: in an imperative language it's not a problem since you can just go and change thigns
08:31Chousukedmiles_afk: but in a functional model you need to explicitly model the transformation somehow.
08:31ChousukeI 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:32dmiles_afkyeah .. though heck there is gotta be a clean way to model it functionally
08:33tomojhave you both read the paper?
08:33tomojI just started
08:33dmiles_afkmodel the transformation.. i wonder if you have to model both states
08:33dmiles_afkor three states or four
08:33Chousukedmiles_afk: well, Clojure already has a model for time-varying identities
08:33Chousukedmiles_afk: though not purely functional
08:34chouserI'm jumping in late here, but have you looked at dgraph?
08:34chouserhttp://github.com/gcv/dgraph
08:35dmiles_afkor http://github.com/gcv/dgraph/blob/master/src/dgraph.clj
08:42_invislook what I found in Labrepl
08:42_invis(defn zipm-4
08:42_invis2 [keys vals]
08:42_invis3 (apply hash-map (interleave keys vals)))
08:42_invisWhy apply here ?
08:43_inviswe can define same function without it
08:43chouserthat looks a lot like zipmap
08:43Chousuke_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:44Chousuke_invis: thus you need apply
08:44_invisbut result the same
08:44Chousukehuh? no it's not :/
08:45Chousuke,(hash-map '[a b])
08:45clojurebotjava.lang.IllegalArgumentException: No value supplied for key: [a b]
08:45Chousuke,(apply hash-map '[a b])
08:45clojurebot{a b}
08:45_invis,(hash-map (interleave [:a :b] [1 2]))
08:45clojurebotjava.lang.IllegalArgumentException: No value supplied for key: clojure.lang.LazySeq@1038a40f
08:45_invisemm
08:45_invisin my emacs it is work :)
08:46Chousukeit should not
08:46_invis(defn zipm-4
08:46_invis2 [keys vals]
08:46_invis3 (apply hash-map (interleave keys vals)))
08:46Chousukeyou're probably doing something different
08:46_invisworks
08:46Chousukeyes, that's fine
08:46_invisfuq
08:46Chousukeit has apply
08:46_invisI mean without apply
08:46_invis(defn zipm-4
08:46_invis [keys vals]
08:46_invis (hash-map (interleave keys vals)))
08:46Chousukethat will fail
08:47Chousukeif it appears to work, there's something else wrong
08:47Chousukeare you sure you evaluated it?
08:47_invisohh yep
08:47_invismy fail :(
08:47_invisI used zipm-3... :)
08:47_invisthat have the same effect
08:50defnadded support for associative destrucuring for seqs by pouring them into a
08:50defnmap first, thus supporting associative destruring of & args
08:50defncool
08:55_inviswhy 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_invisIs second better ?
08:56_invisand simpler
08:56Licenser_defn: I'll push a new walton in a few
08:56defnLicenser_: you do too much!
08:57Licenser_defn: :P
08:57defnLicenser_: what piece of code that you added slowed things down considerably, out of curiosity?
08:57defnis it the evaluation of code in the sandbox?
08:57Licenser_I think the extract-exps thing is the evil doer, bit it gives better results
08:58Licenser_http://playground.licenser.net:3000/walton.html
08:58Licenser_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:58chouser_invis: yours is certanly simpler, but it also allocates a vector and lazy-seq for every pair, where core's version does not.
08:59rhickeyname game again...
09:00rhickeyso, 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:00rhickeydeftype would only provide hash+equals
09:00chouser_invis: on the other hand 'into' uses transients while core's zipmap does not (yet)
09:01chouserrhickey: deftype wouldn't do ILookup?
09:01rhickeynope
09:01defnLicenser_: ah yes, I didn't consider just finding the entire sequence of real expressions
09:01rhickeydef___ would do full defstruct-style map impl
09:02Licenser_:)
09:02rhickeyplus gives you named type and ability to implement protocols etc
09:02defnLicenser_: I must say that part of me is okay with results which don't run in the sandbox
09:02rhickeydeftypedmap?
09:02defnparticularly IO functions
09:02_invischouser: so the core's variant if badly ?
09:02rhickeydefmap?
09:02rhickeydefstruct2-the-revenge?
09:02AWizzArdoh that sounds interesting!
09:02Licenser_defn: with the last update it shows you everything it found when it can't poass it through the sandbox
09:02chouser"map" is pretty overloaded already
09:03defnLicenser_: ah, cool!
09:03rhickeyI'd love to just replace defstruct, but it does a few things that would be difficult to replace
09:03AWizzArdrhickey: what such a defmap allow better/automatic error detection?
09:03AWizzArdwhat ==> would
09:03rhickeyAWizzArd: what error detection?
09:03AWizzArdok ;)
09:03defnLicenser_: how goes clicki?
09:03Licenser_defn: pushed
09:03Licenser_quite well
09:03chouseryeah, struct is a good name
09:03defnLicenser_: do you intend to keep up this pace with clojure indefinitely?
09:04defnyou seem like you've been really digging in, in the last week or two
09:04Licenser_I love clojure
09:05defnyeah it's really a fantastic language -- speaking of which...
09:05defnAnyone have any suggestions on "selling" clojure to management?
09:05chouser"typed struct"?
09:05Licenser_defn: I know it will be slower again at some point
09:05chouserdeftstruct
09:05Licenser_defn: I don't seel it, I just use it :P
09:05defnLicenser_: My goal is to build this particular tool for work so well, and make it so fast, that they cannot turn it down
09:06defnhowever, I think there still might be a manager or two who is scared of it
09:06raekdefrecord
09:06rhickeychouser: wow, that's subtle, I can hardly see that t
09:06Licenser_rhickey: by the way. *thumbs up* again for this nice languae
09:06defnrhickey: yes I didn't see it either
09:07rhickeyalthough they would be deft
09:07defnhaha
09:07chousercould go the other way. deftypeds
09:07defndaftstruct
09:08bsteuberI like deft :)
09:09hoeckdeftype*
09:09Licenser_defn: cool :)
09:09Licenser_what tool do you plan to build if I may ask?
09:09rhickeyLicenser_: thanks!
09:10chouserdeftypedmap
09:11Licenser_rhickey: thank you
09:11Licenser_:)
09:11cgranddefmaptype
09:11hoeckdefr, defs, defp
09:11lpetitplease, a synthesis on what exact beast is about to get a name ?
09:11rhickeyI'd like to avoid "record"
09:12lpetitI don't understand the difference from plain usage of deftype
09:12rhickeylpetit: moving map impl capability into a deftype based macro, rather than the magic now in deftype
09:12chouserlpetit: essentially what deftype is now if you specify IPersistentMap but don't implement it
09:12raekrecord seems to be a rather unused synonym for struct
09:12raekdefrecord would be a simple, pronounceable name
09:13Licenser_ls- l
09:13fogusrhickey: you mean avoiding the whole (deftype foo IPersistentMap ...)?
09:13defn. .. bin/ lib/ src/
09:13fogusah nevermind... I see
09:13rhickeyfogus: yes
09:13lpetitrhickey: a kind of macro inheritence :-)
09:14hoeckdeftype* for the limited deftype, and deftype for the one implementing IPersistentMap
09:14rhickeylpetit: not really, just like def* on def etc
09:14defnhoeck: i dont like that
09:14defntoo confusing IMO
09:14defnnot as pronounceable either
09:14rhickeydefmap
09:14defnrhickey: i like that
09:15rhickeydeftypedmap is most descriptive, but long
09:15lpetitrhickey: (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:15rhickeyI like including map, since the whole point is to get a map-like object for data
09:16rhickeylpetit: it ends up option for deftype is more complex to specify and use
09:16cemerickso many "map" things... :-/
09:16fogusdefmappything, defprototype, defstructure, defbasemap ... I stink at naming
09:16rhickeycemerick: but this is a map thing
09:16lpetitrhickey: could one still do anything he could with deftype, or would some restrictions also come with "defmap" ?
09:17rhickeylpetit: deftype would only provide hash/=, everything else on the user
09:17rhickeyno magic impls
09:17defndeform?
09:17lpetitok
09:17chouserdeftype would still get some kind of mixin feature?
09:18rhickeychouser: maybe, but doing this first will get the magic out of the way and pave the way for a release
09:18lpetitand "defmap" would be an out-of-the-box map-like type maker ?
09:18cemerickrhickey: {} are maps, so are struct-maps. defmap, should it exist, implies a superset relation to all other maps. *shrug*
09:18cemerickof course, it's a totally different thing.
09:18chouserI quite like "typed map" as a concept name, even if deftypemap is too long
09:18rhickeyI'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:18cemerickdeftmap is no good?
09:19rhickeywhereas most abstrct impls never need to do that, basing everthing instead on one or two methods left to derivee
09:20rhickeybut that would make the defstruct-like case one of mixing in *and* providing some core fns, begging for a detmap macro anyway
09:20rhickeydefmap
09:20rhickeycemerick: I don't see that implication
09:21lpetit"defmap" : map in the "type" sense, or in the "instance" sense. The name is confusing, I guess
09:21rhickeycemerick: huh, deftmap is surprisingly more readable than deftstruct
09:21lpetitdefmaptype
09:21defni like deftmap
09:21lpetit-1 for deftmap
09:22defnhey you can't do that!
09:22chouserlpetit: hm, good point. It is defining a type not an instance.
09:22lpetithow often will one use "defmap" / "deftypedmap" etc. ? No that often, so let's the name maybe be a bit self-explanatory, he ?
09:22defnlpetit: you could stil think of it as "define a type of map"
09:22AWizzArddefmaptype could also be an alternative
09:23chousernearly every mature codebase will use this thing
09:23lpetitdefn: that is a lot of implicit meaning on the letter t :-)
09:23cemerickchouser: but how many times? lpetit's got a point. def-typed-struct then. :-P
09:23AWizzArdI use it often.
09:24djpowellSo what will the difference between reify, and slimmed down deftype be?
09:24lpetitLet'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:24AWizzArdthat is, deftype + IPersistentMap (without providing an implementation)
09:24chouserdjpowell: deftype will still not create closures
09:24lpetitAWizzArd: which percentage of your codebase ? :)
09:25AWizzArdyeah sure, only a fraction, but I use it in lots of files
09:25chousercemerick: yeah, I wouldn't fight that proposal at all.
09:25cemerickThey've been semi-deprecated from the start, really.
09:25rhickeycemerick: I thought about magically interpreting the second arg to defstruct if a vector
09:25rhickeyso compatible move
09:26rhickeybut...
09:26djpowellso how will you access fields in the new deftype without ILookup?
09:26rhickey,(defstruct foo [] () {})
09:26clojurebotDENIED
09:26AWizzArdcemerick: what are "they"?
09:26rhickey,(foo)
09:26clojurebotjava.lang.Exception: Unable to resolve symbol: foo in this context
09:26chousernever used defstruct anyway, and I'm all about breaking other people's code.
09:26cemerickAWizzArd: structs
09:26AWizzArdI used defstruct very often, but no replaced virtually every occurrence with deftype.
09:27rhickeyso (defstruct foo [a b c] ...) gets newness
09:27bsteuberso is there anything defstruct can do that can't be done with deftstruct?
09:27cemerickrhickey: I think that piece of naming real estate is too valuable for something like defstruct to occupy forever.
09:27rhickeybsteuber: yes, see above, defstruct can have arbitrary keys, runtime creation
09:27cgranddjpowell: (:foo x) but no (x :foo)
09:28stuarthallowaylet defstruct be the comprehensive thing
09:28defnstuarthalloway: thanks for making labrepl free
09:28stuarthallowayr/defstruct/deftype
09:28cemerickstuarthalloway: structs really shouldn't provide implementations tho
09:29cemerickconceptually, I mean
09:29stuarthallowayand then name the primitive thing something that suggests its primitive/rawness
09:29stuarthallowaycemerick, sorry, meant deftype
09:29rhickeycemerick: really?
09:29rhickeycemerick: struct == no impls?
09:29chouserdeftypedmap won't support arbitrary keys?
09:29rhickeybut defstructs do implement a lot
09:29stuarthallowayplease not deftypedmap. ick.
09:30rhickeychouser: yes it will, full expando
09:30cemerickrhickey: no, I mean user-provided impls. Should conceptually just be a bag of slots.
09:30chouserok, then I misunderstood "defstruct can have arbitrary keys"
09:30stuarthallowaydefmap w/b better (sorry late to the conversation, know I am retreading ground here)
09:30AWizzArdyes, what does that mean? Arbitrary keys?
09:30rhickeycemerick: hmm, well that rules out its use here, as this new thing will allow impls
09:31lpetitI 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:31rhickeydoes anyone else agree with cemerick that struct implies no impls?
09:31stuarthallowayyes
09:31stuarthalloway(I am now everyone)
09:32djpowelli would assume that
09:32cemerickrhickey: I'm having trouble reconstituting the context now. Can you restate the objectives, moving pieces?
09:32chouserno
09:32chouserC++ structs can have implementations.
09:32stuarthallowayargument by appeal to C++? Isn't that a category of fallacy? :-)
09:32chouserwhat etymology of "struct" rules it out?
09:32cemerickchouser: then by all means... *groan* ;-)
09:33rhickeythis 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:33stuarthallowaydefawesome
09:33chouserha!
09:33chouserrhickey: Will it come with IFn for lookup?
09:34cemerickrhickey: ah, so a simplification avoiding IPersistentMap explicitness.
09:34raekI believe struct/record implies map-like-thingy with fixed set of keys, too
09:34rhickeychouser: yes, everything that destructs have (except maybe the k/v factory) + a type
09:34ChousukeI think there will soon be too many defblahs :P
09:34AWizzArdAnd 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:34rhickeycemerick: yes, that's the prime objective - magic removal
09:34defni dont like pruning defstruct
09:35rhickeyone use case for defstruct remaining is resultset-seq and its ilk
09:35lpetitrhickey: sorry to repeat myself, but "a deftype with full map impl" == "defmaptype" :)
09:35stuarthallowaypeople will learn what it is, so I would rather have a short, pronounceable name
09:35djpowellid love a resultset-seq that returned deftype things
09:35rhickeylpetit: defmaptype is still a candidate, but it seems no one likes it or anything else much, yet
09:36rhickeydjpowell: that would require eval and runtime code gen
09:36lpetitgrmlml
09:36djpowellah yeah
09:36raekI agree with stuarthalloway, pronounceability is a big deal
09:36defnrhickey: 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:36defnall of which apply, but dont capture the "essence" IMO
09:37AWizzArdI suggested defmaptype and would not find anything bad about typing in these few letters 'type'. No productivity stopper.
09:37defnim going back to deftmap
09:37rhickeyI 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:37Chousukeplease, no :P
09:37Chousukearbitrary abbreviation is just not cool
09:38AWizzArddeftmap is not my favourite
09:38defndeftmap has my voice -- it's memorable, unique
09:38lpetitlet's do it piece by piece
09:38defnvote*
09:38lpetitwe all agree on a "def" prefix :-p
09:38cgrandgoing latin: defres
09:38AWizzArdI would say it should also include "map"
09:39AWizzArdor struct or record
09:39chouserI think my favorite is to replace defstruct. But if not that, defmaptype -- when you call the ctor you get a "typed map"
09:39martencgrand: defres sounds more like it defines a result or something
09:39defndefrec
09:39cemerickchouser: +1
09:39cemerickI'm still very wobbly on the notion of structs having user-defined impls tho.
09:40AWizzArdYes, I would also say: 1) defmaptype, 2) defstruct, 3) defmap, 4) deftypedmap
09:40cemerickThat's a class, or a type, but not a struct.
09:40chouserjust because C++ does it, doesn't mean its wrong. :-)
09:40defnhaha ive been thinking that this whole time!
09:40defni thought i might be the only one
09:40djpowelldoes map really capture the key/value pairness of it. something like props or something?
09:40cemerickchouser: no, but in my head, class < type < struct
09:41cemerickw.r.t. complexity / "completeness" of implementation
09:41rhickeyhuh
09:41AWizzArdor.. defclass
09:41cemerickshite. class > type > struct, I mean
09:41cgrandI agree with chouser's motion: destruct or else defmaptype
09:41defndefmaptype then for me
09:42chouser"class" is bad for this. Hosts will already have the name "class" and we'd do best to let them have it.
09:42defnbut going back to what stuart mentioned, it's just not very, i dont know, something just doesnt fit about it for me
09:42rhickeywell, 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:42AWizzArdchouser: agreed
09:42rhickeymap-like
09:42rhickeyso, keeping type in there is good
09:43chouserdefstructtype :-/
09:43AWizzArduh ;)
09:43defndeftap
09:43cemerickchouser: yeah, I wasn't suggesting 'class' for anything.
09:43AWizzArdcemerick: i suggested "defclass", but also don't really like it
09:43djpowelldefmaptype doesn't seem bad. it's got arbitrary slots (map) and is typed (for protocols).
09:44defnare there any other def*s which are as long as defmaptype?
09:44rhickeywhat about Stu's idea that this gets the simpler name - deftype, and the primitive one gets another name
09:44cemerickdefprotomap? :-/
09:44chouserAre hash-map and array-map exampels of map types?
09:44defnit just seems overly descriptive to me "defmaptype"
09:44AWizzArdI 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:45rhickeychouser: sort of
09:45chouserwell, they are types of map, but not maptypes. :-/
09:45AWizzArddefn: is it bad to have a self documenting name?
09:45defnrhickey: im on board with stuart
09:45cemerickrhickey: everything we're talking about will respond true to (map? ...)?
09:45defnAWizzArd: no i just think it is actually somewhat confusing in that it is overly descriptive
09:45marten+1 for defmaptype
09:45chouserI'm ok with stuart's idea, we just need the simpler-thing name. defsimpletype ?
09:46chouserdefcoretype
09:46chouserdefminitype
09:46defnbeating a dead horse... deftmap
09:46marteni don't really like deftmap in that i'd like to keep "type" in full in there
09:47Chousuket is just arbitrarily abbreviated
09:47djpowellare 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:47lpetitdefrawtyp
09:47defnChousuke: and def isn't?
09:47lpetitdefrawtype
09:47Chousukedefn: no, it's not.
09:47defndefn isn't?
09:47AWizzArdis defrawtyp really much better that defmaptype?
09:47Chousukedefn: nope :)
09:47chouserAWizzArd: it's for the other thing.
09:47cemerickMight be time to put a page on assembla with descriptions of the different fns. The simpler/primitive/core concepts have gotten twisted.
09:47stuarthallowayyes, because it is on the less-often used thing
09:47cemerickrhickey: ^^
09:47Chousukedefn: those are "fundamental" IMO.
09:47esja struct and a map - > defstrap. Just kidding.
09:47Chousukedefn: the t in deftmap is just weird.
09:48stuarthalloway+1 to djpowell
09:48defnChousuke: it's two pronounceable english words
09:48cemerickChousuke: you can blame me for that idea :-/
09:49raekdefrecord, anyone?
09:49rhickeycemerick: 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:49defnraek: would you settle for a defrec?
09:49lpetitchouser: 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:49rhickeyraek: I'd rather not add another term
09:50AWizzArddefrec / defrecord are possible, but so far Clojure never had "records"
09:50AWizzArdIs an instance of a defrecord a record?
09:50rhickeydefbasetype
09:50Chousukerhickey: I assume you want to encourage user-defined types to be map-compatible?
09:50raekdefn: I generally don't like abbreviations, but maybe, yes
09:50stuarthallowaythe base thing should have a simple name: defraw? deft?
09:50rhickeyChousuke: I want to encourage types used for data to be maps, yes
09:50stuarthallowaydeft is actually kinda cool
09:50Chousukerhickey: I think in that case deftype and deftype* would be okay.
09:50defndeft is more than cool
09:50defnit's awesome
09:51Chousukerhickey: deftype would be the default, and deftype* for those who know what they want. :P
09:51rhickeytypes used for things like e.g. data structures and the reference types
09:51stuarthallowaydeft is my favorite, deftype/deftype* is ok too
09:51defndeft is annoying in that it's so obvious IMO
09:51rhickeydeft + deftype - too cute?
09:51defnrhickey: no, i love it
09:52hoeckdeft is nice, quite short and fundamental, like defn
09:52AWizzArdwould one of those be like the current deftype?
09:52defnhoeck: are you referring to me or the macro? :)
09:52rhickeyAWizzArd: nothing is like the current deftype
09:52defnare you calling me short and fundamental?
09:52rhickeybase and base+map
09:52stuarthallowaydeft is base
09:52Chousukedeft looks like an abbreviation of deftype though... it might not be immediately obvious that they are variants of the same thing :/
09:52stuarthallowaydeftype is base+map+etc.
09:53sethsdefn: you're just a macro which expands to def
09:53defnChousuke: i disagree -- it seems pretty obvious to me
09:53Chousukehm, if it's that way around it might make sense
09:53defnseths: that hurts, man. take it back.
09:53hoeckdefn: short, fundamental and nice :)
09:53raekwhich one is the most used? base or base+map?
09:53rhickeywhen people see 'record' do they think more of data than they do with 'type'
09:53AWizzArdyes
09:53underdevstuarthalloway: been going through labrepl, all day yesterday, should be done today. very cool man!
09:53stuarthallowayunderdev: thanks
09:53defnrhickey: yeah, i immediately think of a database
09:53rhickeyfor me, one crime of OO is when people wall up ordinary data in Employee etc classes
09:54rhickeymaking things maps makes them amenable to generic handling via the standard lib
09:54bsteubermaybe rename defstruct to defrecord and use its name
09:54bsteuberif the only normal case for old defstruct is databases
09:55rhickeyOTOH, there's no reason for a Ref/Atom/PersistentVector implemented with deftype to have a map-like impl
09:55lpetitstuarthalloway: yeah, labprel is an amazing piece of work, both from the technical and the pedagocial sides
09:55AWizzArdrhickey: do you mean that in general data objects should be stored in maps instead of classes?
09:55rhickeyhow would you all categorize the difference between them and Employee?
09:55stuarthallowaylpetit: amazing is a bit strong, I'll settle for "useful" :-)
09:55defnrhickey: (inc labrepl)
09:55defnerr sorry, not directed at you
09:55lpetitstuarthalloway: don't be so modest :-)
09:56defnstuarthalloway: is it possible to have tests run over and over again? or do you need to call script/test every time?
09:56AWizzArdI don’t understand that part of walling up ordinary data in classes such as “Employee”.
09:56etatehow do you guys know which versions of libraries to use with others?
09:56lpetitstuarthalloway: the last piece of work is to have mini-repls right in the webapp, I guess :)
09:57sethslpetit: he can steal the code from http://lotrepls.appspot.com
09:57stuarthallowaydomain entities should rarely be classes
09:57rhickeydefentity
09:57lpetitstuarthalloway: 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:58rhickeydefinformationholderthingy
09:58etateas in even with leiningen you still need to specify the right versions of all libs you'll use in the dproject.clj
09:58Chousukedefdata :P
09:58AWizzArdI would slightly prefer defentity over definformationholderthingy
09:58etateso what am i missing?
09:58etate:D
09:58AWizzArdrhickey: could you say a few more things about this example of Employees storing data?
09:58Chousukeor the ultimate: "dwim"
09:59defnstuarthalloway: 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:59lpetitdid we switch subject, or is defentity ... related to deftype/deftype*/deft ?
10:00stuarthallowaydeft is for the deft
10:01stuarthallowaydefn: you can run the tests within the repl at any time. Just (use 'circumspec) (watch)
10:01rhickeylpetit: 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:01stuarthallowaydefn: (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:02stuarthalloway(2) let's talk Sean Devlin into doing the tutorial
10:02sethsstuarthalloway: way to delegate :-)
10:02rhickeydoes anyone understand what I am talking about above?
10:02stuarthallowayrhickey: warming to the distinction
10:03cemerickrhickey: when you separate reference types from "information holders", not really.
10:03rhickeyone reason Clojure wen out without objects is bacuase I wanted everyone to put their information in maps
10:03underdevrhickey: as the leader of our cult, we'll accept it by faith
10:03lpetitrhickey: I think I do
10:03rhickeyyour app has some structures associated with the implementation, and some with the information
10:03stuarthallowayuse defentity to build concretions, and deftype to build abstractions
10:03rhickeya vector is the former, an Employee is the latter
10:04stuarthallowayand now, with my preferred names:
10:04stuarthallowaydeft is used to build abstractions, like vectors
10:04lpetitrhickey: defentity seems too "oriented" to me. To specific. deftype would see more "evident" business app usage
10:04stuarthallowaydeftype is used to build concretions, like Employees
10:04rhickeyforget defentity
10:04fogusdefknowledge
10:05defnstuarthalloway: im on board with you 100%
10:05defni dont think ive disagreed with a single thing you've said thus far actually, heh
10:05rhickeyfogus: it's more raw than knowledge
10:05cemerickMy 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:06stuarthallowayseparate but related issue: we need to tell the concretion/abstraction story, which this may help us do
10:06rhickeycemerick: what would you use to implement PersistentVector?
10:06cemerickah, now I see where you're coming from
10:07cemerickrhickey: what I'm calling types, minus the map impl, plus fields.
10:07rhickeycemerick: that's not distinct enough in my mind
10:08rhickeystu 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:08rhickeythe latter my point
10:09defnim not sure i follow rhickey
10:09ChousukeI think I would like defrecord for plain data + map interface, deftype for the "lower" level. but then defstruct becomes obsolete
10:09defnspecifically the "and thus confusing for app devs who normally just find that already there"
10:09cemerickrhickey: 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:10rhickeyvector/map/atom/String etc are programming construct, Employee, Roster, SalesReport etc are domain data entities
10:10rhickeycemerick: you're trapped in implementation details, I think
10:11bsteuberhow about defdata, then? :)
10:12rhickeybsteuber: maybe
10:13rhickeydefprogramconstruct
10:13rhickeydefinformationconstruct
10:13cgrandcoretypes and types?
10:14cemerickdomain type
10:14fogusDigging back into my dusty CLIPS store... deftemplate
10:14rhickeydefinfotype
10:14hoeckdeftype (base+map) and defbasetype (base only)
10:15bsteuberdefmodel
10:15noidicgrand, I like coretype vs type
10:15rhickeymodels are usually bigger things
10:15bsteuberokay
10:15stuarthallowaycoretype isn't bad if you really want to type that many chars :-)
10:15noidiI assume that won't be too often?
10:15esjdefdataform
10:15rhickeycore implies central or important, doesn't get at key distinction
10:16stuarthallowaybut if I keep saying deft/deftype long enough you will all surrender eventually
10:16cgrandimpltype
10:16defnyeah, ive taken to naming the file which contains my -main, "core.clj" -- that is a "core" AFAICT
10:16sbtwhat is conc in clojure?
10:17cemerickbasetype
10:17cemerickinittype
10:17raekis the map vs Employee class thingy what stuarthalloway referred to as something like "data-as-contract" in one of his talks?
10:17noidiisn't the main distinction between abstract and concrete types?
10:17fogustemplate
10:17bsteuberMy votes at this point would be 1. defstruct (old defstruct -> defrecord) 2. defdata 3. defrecord 4. defmap
10:17noidivectors and such are abstract while employees are concrete
10:18bsteuberbut I'll leave now - so good louck with finding a good conclusion
10:18raek...if so, where can I read more about this philosophy?
10:18defnraek: which talk?
10:18stuarthallowaynoidi: or maybe code domain vs. problem domain
10:18raekit was for a ruby audience
10:18stuarthallowayraek: data as contract is just about "don't hide data"
10:19rhickeycode domain/ information domain
10:20stuarthallowayraek: once data is immutable, protecting it with accessors is (even more) silly
10:20stuarthallowayand as soon as you serialize or persist you commit to supporting a data format, not a programmatic interface
10:21rhickeydefcodetype, definfotype
10:21raekah, yes. I see
10:21noidirhickey, and the latter implement the map interface, while the former don't?
10:21rhickeyright
10:22raekdefdatadatatype
10:22noidiwhat if I want to add a new map-like type, which one would I use?
10:23noidifor code
10:23noidiI think the names should reflect the semantics, not the most common use cases of each function
10:26raek(found the talk: http://rubyconf2009.confreaks.com/21-nov-2009-10-25-clojure-for-ruby-programmers-stuart-halloway.html)
10:26noidifor that reason I liked the defmaptype/deftype proposal
10:26noidialthough 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:28rhickeycgrand: defimpl good, maybe defimpl, definfo
10:29cgrandI like deftype for the common case (definfo)
10:29fogusMy fav at the moment is definfo
10:29cgrand,(meta (let [i 1] #^{:foo i} [i])) ; can this be relied upon?
10:29clojurebot{:foo 1}
10:31rhickeyyeah
10:31esjdeffacts
10:32fogushrm... I find it fun to say
10:34defnrhickey: way OT but did I hear right that you were a professional musician in one of your introductions?
10:34defni was just curious what instrument
10:35noidicemerick, yeah, it sounds like pig latin :)
10:36noidiI 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:37noidiit sounds too much like a single word
10:41defngo down on the def sound
10:42defnlike a falling tone in chinese
10:42defnraek: thanks for the link
10:47esjnobody told me about @(future (:Mephistopheles))
10:50etatehmm.. i finally got clojure setup adequately and now when i slime-connect and type a form, it blocks indefinitely
10:50etateanyone else experience deadlock like this?
10:51qbgBut slime-connect is successful?
10:51etateyes, i get a REPL
10:51etateafter pressing y to the version incompatibility
10:52etatei should probably also point out that the version of slime i'm using is from cvs
10:52etatenot from ELPA
10:52qbgHow recent?
10:52etate2010-03-21
10:53etate4 days old
10:53etateworks fine with common lisp
10:54etatealso it seems to work when i type in numbers, just not when i type in forms
10:54qbgI know that at least not too long ago recent versions of slime would not work with Clojure
10:56rhickeybbl
10:56etateqbg: indeed, i just tried with an earlier version and it works
10:56etateqbg: the 2009 (ooold) version in ELPA works but not cvs slime
10:56qbgetate: I just tried the 2010-03-21 version, and it seems to work for me.
10:57etateqbg: what was your (slime-setup) ?
10:57etateqbg: also are you using the maven plugin or are you using lein swank?
10:58qbgI'm using (slime-setup '(slime-repl)), and so far I just tested using M-x slime
10:58etateqbg: i was using (slime-setup '(slime-fancy slime-repl)), and lein-swank v 1.1.0
10:59qbgSeems to work with lein-swank also
10:59etateqbg: which version of lein swank?
10:59qbg1.1.0
11:00etateqbg: and you tried typing (+ 1 2 3) ?
11:01etateqbg: i just tried with the same slime setup as you, same lein-swank, version 2010-03-21 and its deadlocking
11:01qbgIn my case, (* 4 2)
11:02etatethe only other thing i can think of is that i have jline included as a dependency
11:02qbgTry removing that
11:03etateqbg: nope, makes no difference
11:04qbgAppeasing the SLIME gods is hard...
11:05etateqbg: indeed, oh well i'll just use an old version of slime :)
11:06Crowb4rAt first I read that as SLUM gods.
11:06Crowb4rlol
11:17npoektophi! whould you help me with a macro? http://pastebin.com/MyKFdyFp
11:18npoektopit says: "Can't use qualified name as parameter: com.nnn.server.tests.local/tst"
11:19hiredman` qualifies symbols
11:19hiredman,`a
11:19clojurebotsandbox/a
11:19Chousukenpoektop: don't quote the macro parameters
11:19Chousukenpoektop: and you can use (fn [tst#] ...), an autogensym
11:20Chousukenpoektop: but really, that doesn't need to be a macro :P
11:20Chousukeor hm, was require a macro or a function? :/
11:20Chousuke,require
11:20clojurebot#<core$require__6458 clojure.core$require__6458@1ef63f9>
11:21Chousukeright.
11:21npoektopa function?
11:22defnfogus: Clojure as a Johnsonian (Robert) model of programming.
11:22npoektopok
11:22Chousukenpoektop: yes
11:23Chousukejust (defn rt [& namespaces] (doseq [n namespaces] (require n) (run-test n))) (rt 'foo 'bar)
11:47Crowb4rIs there a google api lib for clojure at all?
11:47chouserwhich google api?
11:49Crowb4rchouser: 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:49MecIs there any simple way to do a reduce that short circuits on nil
11:52raekreminds me of -?>
11:52raekhttp://richhickey.github.com/clojure-contrib/core-api.html
11:52raeklike ->, but short circuits on nil
11:52Mecyes
11:53hiredmanMec: take-while
11:53noidithe beauty of lazy seqs :)
11:53hiredman,(reduce + (take-while identity [1 2 nil 3 4 5]))
11:53clojurebot3
11:53noidimaybe swap reduce and take-while there?
11:54noidiso that it short circuits if the reduction is nil
11:54MecIt 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:54chouserreduce is eager though, so that wouldn't work
11:54chouserMec: and just return nil?
11:54noidichouser, ah, ok
11:55Mecchou
11:55Mecchouser, yes
11:55chouserMec: perhaps you could build something on clojure.contrib.seq/reductions
11:56Licensergreeetings
11:56noidiany reason why reduce is not lazy?
11:56chousernoidi: can't be
11:56raekit 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:56Mecreduce only returns 1 value, so theres nothing to be lazy on
11:58chouserright. while reductions returns a lazy seq of each iteration of reduce, so you can take the last value, or nil whichever comes first
11:58noidid'oh, of course
11:58Mecchouser: ok, i'll look into reductions
12:00raek(try (reduce #(if (nil? %2) (throw (Exception.)) (+ %1 %2)) [1 2 3 nil 4]) (catch Exception e nil))
12:00chouser:-(
12:00raekbeware of hairy code...
12:01raekman, that's ugly... forget I wrote it... :)
12:02Chousuke,(reduce + (take-while (complement nil?) [1 2 3 nil 4])) :P
12:02clojurebot6
12:02Chousukehmm, I suppose that's not good enough
12:03Mec,(reduce #(if (= %2 5) nil (+% %2)) (range 10))
12:03clojurebotjava.lang.NullPointerException
12:04Mecmore like that
12:06chouser,(loop [a 0, s (range 10)] (if (empty? s) a (let [a (+ a (first s))] (when-not (= a 5) (recur a (next s))))))
12:06clojurebot45
12:07chouseroh, that's not right
12:07MecThe nil test is based off of the cumulitive value from the reduce, so a maping function wont work
12:07chouseroh, that is right. but (= a 6) is needed to see the nil result
12:08chouserit seems strange to me that when the test is true you want to return nil instead of the result so far.
12:09AWizzArdAn if that returns nil is less idiomatic than using when or when-not.
12:10Mecmy example was poorly contrived
12:12chouser(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:17Mecis (last (reductions f coll)) = (reduce f coll) ?
12:17chouseryes
12:17noidimaybe something like this? http://gist.github.com/343741
12:23Mec(defn reduce-if-not [pred f init s] (let [r (reductions f init s)] (when-not (some pred r) (last r)))
12:24Mechmm does that look right
12:24chouserMec: 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:25MecI think im back to the same problem with that one
12:35raek,(let [[f & r] [1]] (class r))
12:35clojurebotnil
12:35Mec(last (take-while pred (reductions f init s))) seems promising but that wont end at nil
12:38noidiMec, did you try chouser's or my suggestions?
12:39noidialthough I understand if you want to solve it yourself, that's why I wrote that snippet without looking at what chouser wrote :)
12:39MecI'm using chouser's idea, just seeing if theres something simple
12:46noidi,(let [r (reductions + (range 5))] (if (some nil? r) nil (last r)))
12:46clojurebotjava.lang.Exception: Unable to resolve symbol: reductions in this context
12:46noidi,(use '[clojure.contrib.seq-utils :only [reductions]])
12:46clojurebotnil
12:46noidi,(let [r (reductions + (range 5))] (if (some nil? r) nil (last r)))
12:46clojurebot10
12:47noidireductions is lazy, and I assume some is too, so I think that should short-circuit
12:47MecIt will, but its holding onto the head of a lazy seq
12:48noidiargh, of course some is eager as it returns a single value
12:48noidiagain
12:48noidinote to self: when too tired to think, hacking doesn't help
12:49kylesmithHas anyone tried using clojure-install recently? It gets halfway through the install, and says clojure-contrib doesn't have a build.xml file.
12:49Meci needs a take-while or a drop-while that can somehow return nil
12:51technomancykylesmith: clojure-install is deprecated; see the swank-clojure readme.
12:54noidi,(loop [[x & xs] (reductions + (range 5))] (if xs (if (nil? x) nil (recur xs)) x))
12:54clojurebot10
12:54noidiI don't know if that's any simpler than what's been proposed, but that's a variation :)
12:56noidiI'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:58noidiyou could abstract that out and just do a (nil-or-last (reductions ...))
12:58kylesmithtechnomancy: README.md? I see no mention of clojure-install.
12:59RaynesThat's the point.
12:59Mecnoidi: thanks for the effort ;p
13:00MecI do like extracting out nil-or-last
13:00noidiMec, here's the function with some nicer formatting http://gist.github.com/343818
13:04noidi(nil-or-last (cons nil (reductions + (range 999999999999999999)))) returns instantly, so it seems to be lazy as it should
13:05Raynes,(let [result (take-while true? [false true true false true])] (if (empty? result) nil result))
13:05clojurebotnil
13:05Raynesorly
13:06noidiargh, 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:06Mecheh, night
13:06esjRaynes: I think it makes sense, results is never gets populated ?
13:07Chousuke(if (empty? result) nil result) can be condensed to (seq result) :P
13:07Raynesesj: HuH?
13:07RaynesHuh*
13:07RaynesChousuke: shh.
13:08Raynes,(seq (take-while true? [true true true false true]))
13:08clojurebot(true true true)
13:08Raynes,(seq (take-while true? [false true true true false true]))
13:08clojurebotnil
13:09RaynesSeq is a multitasker.
13:09Mecif you pass seq a sequence or nil its just like identity
13:10RaynesNever would have thunk it.
13:11defnDoes 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:11Mecclojure.contrib.seq isnt new is it?
13:11Raynesdefn: Water it.
13:11RaynesMec: It's the renamed seq-utils
13:11Mecah thats what i've got still
13:12RaynesMec: 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:12MecI just finally got emacs working happily and im not screwing with it
13:13defnRaynes: good advice. it worked
13:13Raynesdefn: ;)
13:13liebkedefn: there are :width and :height options to view. Or you can just drag the corner of the window :)
13:13kylesmithHas swank-clojure been updated to use leiningen? What happened to swank-clojure-autoload?
13:14defnliebke: it doesn't seem to be auto resizing, perhaps because i set the :width and :size ?
13:14liebkedefn: really? which chart are you using?
13:15defnbar
13:15defnliebke: sorry i should clarify
13:16defnit auto-resizes, but honestly it might not be including labels for the x-axis
13:16defni thought those tick marks were just tightly packed text
13:16liebkedefn: do you have some example code I can see?
13:17liebkedefn: the x-axis labels for bar-charts are the values of the first argument passed to bar-chart
13:17defn(defn build-graph [] (incanter.core/view (incanter.charts/bar-chart countries values :x-label "Countries" :y-label "Number of Denials")))
13:18liebkedefn: so each of the bars should be labeled with the values of the countries sequence. Is that not what you're seeing?
13:18defnliebke: one sec please
13:20defnliebke: my structure looks like what we discussed earlier -- [{:country "USA", :count 10} {...} {...}]
13:20liebkedefn: you can also set the :vertical option to bar-chart to false, to create a horizontal chart, which works better for long labels
13:21defnis my structure there correct?
13:22liebkedefn: yeah, to pass that structure to (to-dataset your-map-array)
13:22liebkedefn: then you can call (bar-chart :country :count :data (to-dataset your-map-array))
13:23defnahhhhh
13:25RaynesLeiningen gets no love: http://muckandbrass.com/web/display/~cemerick/2010/03/25/Why+using+Maven+for+Clojure+builds+is+a+no-brainer
13:26defnit's been around for about a day
13:26defnbesides, you can use maven AND leiningen
13:26Raynesdefn: If it was more than two days old, it would be OFN.
13:26defnOFN?
13:27Raynesdefn: Old f***ing news.
13:27defnheh
13:28cemerickdefn: what does such a combination look like?
13:28defnRaynes: is it evil to \n the crap out of your clojre code?
13:28defncemerick: like rubygems and ant for jruby
13:28cemerickyeouch
13:29defncemerick: 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:30defnand that would be handy, and nice
13:30ChousukeI'm looking forward to some kind of clojureish wrapper for maven appearing
13:30cemerickChousuke: from the makers of maven: http://polyglot.sonatype.org/clojure.html
13:30defnit's logic programming
13:30defnpeople who write clojure like that sort of thing
13:30defn:)
13:31cemerickdefn: I guess I'm left wondering what such a tool would look like, other than being maven + sexprs.
13:32defncemerick: 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:32defni am probably misquoting him, but it didnt sound like a bad place to be
13:32cemerickdefn: yeah, I was here when he said that.
13:33headiusit's getting there
13:33headiushopefully in the next week we'll have a maven repo live that appears to be just a rubygems repo
13:33headiusgem install org.clojure.clojure
13:33cemerickI'm not saying it's messy, I'm saying that I'm not particularly interested in scripting-oriented approaches to doing builds anymore.
13:33defnnow that is just awesome.
13:33headiusthat will be a nice step toward rubyifing maven on the project side as well
13:34defncemerick: ah, don't you think most people still operate with scripts first, customization second?
13:34cemerickAnd, again, mining the maven plugin ecosystem is simply too fruitful to ignore IMO.
13:34defni mean there comes a point where you just get in there and do what you need to do i guess
13:34kylesmithCan anyone give me a link to *updated* instructions for how to setup emacs/leiningen/swank-clojure?
13:34defnkylesmith: mine or sort of up to date :X
13:34cemerickdefn: scripting is custom from the start. That's the first big win with maven (or other convention-over-configuration approaches).
13:35headiuscemerick: any rubified maven we do would leverage all existing stuff...we wouldn't reimpl maven
13:35defnkylesmith: http://devinwalters.com/posts/24
13:35headiusjust like the rake+ant integration just merges the two spaces
13:35cemerickheadius: sounds like a winner
13:36headiusI like what the buildr guys have done, but they don't use any of maven proper
13:36headiusI'm too lazy for that
13:36cemerickI 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:37defn.war files, ugh
13:37cemerickdefn: ?
13:37stuartsierraI wonder what a clojure syntax for ant would look like?
13:38headiusprobably a lot like xml :)
13:38stuartsierrayeah
13:38defnonly less noisy
13:38headius(project (target ...
13:38defncemerick: disregard
13:38headiusrake+ant looks like rake, so it's not a good comparison
13:38cemerickdefn: that's not a reason to not use XML BTW :-)
13:38stuartsierracemerick: agreed
13:39defncemerick: label me a hopeless aesthete
13:39stuartsierraHeck, Ant has macros, doesn't it?
13:39headiussort of
13:39headiusthey're really just function defs
13:39cemerickstuartsierra: danger, will robinson!
13:39stuartsierraah
13:39headiusnot really contextual
13:39defnstuartsierra: i think im supposed to bug you about circumspec?
13:40stuartsierradefn: are you? Did halloway put you on it?
13:40defns.halloway said something along those lines to me
13:40defn:)
13:40cemerickI probably would still be using ant if its scripts were composable and if it had baked-in dep mgmt.
13:40stuartsierradefn: Are you at relevance?
13:40kylesmithdefn: Am I supposed to get massive warnings when installing everything?
13:40defnstuartsierra: no sir, just caught him in irc earlier and complimented him on labrepl, asked about circumspec
13:41RaynesI <3 Leiningen.
13:41defnhe pointed me at you and sean devlin :)
13:41defnkylesmith: that will happen yes
13:41defnkylesmith: it's okay
13:41stuartsierradefn: Ok. I talked to Halloway about Circumspec and lazytest last week. Working right now on merging features from both.
13:42defnstuartsierra: one big thing ive been really itching for is a demonstration and blog post with the setup process
13:42stuartsierraJust trying to settle some syntax wars going on inside my head.
13:42defnim not entirely sure how to get the beast moving
13:42stuartsierrawhat, circumspec?
13:42defni generally edit using swank-clojure-project
13:43defnopen my source and C-c C-j
13:43defnC-k*
13:43defnhow do i get circumspec into the mix
13:43stuartsierrano idea :)
13:43defnhaha
13:43stuartsierrathat will come, first we have to finish writing it
13:43defnoh...right!
13:43kylesmithdefn: 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:43defnkylesmith: get 23
13:43defnit's in your best interest
13:44defni like to compile emacs from source on linux
13:45defnbut IIRC there are packages for ubuntu 9.10 now
13:45defnstuartsierra: thanks for working on it, anyway -- it looks like it will be fantastic
13:46stuartsierrahere's hoping
13:47defnliebke: still no luck with (view (bar-chart :country :count :data (to-dataset (to-incanter-structure))))
13:48defnliebke: to-incanter-structure returns [{:country "X" :count 5} {...} {...}]
14:00liebkedefn: what's it doing?
14:01defnI've got it working now, my only remaining question is how to make the bars wider
14:02liebkedefn: I'm afraid I can't help you there, they are typically as wide as there is room
14:03defnliebke: I have about 182 bars
14:06liebkedefn: yeah, unless you consolidate some of the bars, I don't have a way to make them bigger
14:06defnliebke: okay, thanks
14:14foguscemerick: nice screencast. I'm sold
14:18cemerickfogus: Thanks :-)
14:20cemerickI thought about doing a more elaborate example, but the OS X bundling bit seemed like it had some visual impact to it.
14:20kylesmithdefn: 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:21fogusI liked it. It was perfect length, perfect example. I didn't care for the soundtrack though. ;-)
14:23cemerickfogus: what, you don't like endless yammering and opining while you're watching projects build?!?!!11!
14:23cemerickthat was a ;-) of course
14:23chouserthere's no audio, right?
14:23foguscemerick: Nothing wrong with the yammering, although I had imagined your voice to be more like Barry White. :p
14:24chouserinstead of completely silent, as it is?
14:24cemerickchouser: no, there's audio
14:24chouserhmph
14:24cemerickfogus: time for those voice lessons, get me down a few octaves :-D
14:26chouserah, there we go.
14:34chouserclojure build system hotness as defined by cemerick's use of it
14:34cemerickheh
14:34cemerickchouser: dude, that's just the tip of the iceberg.
14:35chouseris the rest of the iceberg also XML?
14:35chousersorry, couldn't resist.
14:35RaynesI'd rather use a crappy build system than stare at XML for any length of time.
14:35Chousukeyou can write poms in clojure though
14:36Chousukeand translate them to xml poms
14:36cemerickchouser: that depends on how long it takes the polyglot maven stuff to bake
14:36chousernah, xml rocks
14:36cemerickbut I'll likely stick with the XML bits for quite a long time given the tooling
14:36ChousukeRaynes: you have to admit that what cemerick showed blows lein right out of the water :P
14:37RaynesI didn't want what cemerick showed.
14:37cemerickDid I show something I didn't mean to? ;-)
14:37RaynesAnd it wouldn't make me stop using Lein in any case. It's all I need at this point.
14:37cemerickSorry, you gotta go the long way around the barn for that one.
14:37chouserseriously, 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:38cemerickfogus: there's lots of us, we just don't jump up and down so much
14:39chouserI actually expect cemerick's demo and attitude to be meaningful to a lot of people.
14:39cemerickchouser: w.r.t. plugins, the maven native plugin will probably make your socks roll up and down.
14:39cemericki.e. lots of gcj, jni bits
14:39RaynesIt 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:39Raynesby*
14:40Chousukefogus: I'm rather pleased that maven is so declarative :)
14:40mattreplwhy is lein dying?
14:40fogusRaynes: Seen here?
14:40RaynesLooks like everybody is perfectly happy with maven.
14:40mattreplI use lein, don't like maven
14:40cemerickRaynes: I'm the outlier at the moment, FYI. Just trying to get people into tools that work today.
14:40ChousukeRaynes: lein just needs to change to utilise maven more :)
14:40Raynesmattrepl: Obviously, cemerick will change your mind.
14:41fogusRaynes: I doubt you'll find perfect happiness associated with anything, must less Maven
14:41Raynes;)
14:41RaynesJust 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:41chouserI 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:42ChousukeRaynes: leiningen is great, but it can't compare with maven
14:42ChousukeRaynes: maven has simply had too much development put into it
14:42cemerickchouser: that's part of the "everyone's got their own 20%" syndrome.
14:42RaynesChousuke: It's also a very young project that could become a lot more.
14:42fogusHonestly, 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:43ChousukeRaynes: but that lots more still doesn't compare to maven :)
14:43chouserso 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:43RaynesBut it could do more with maven.
14:43cemerickRaynes: who's going to build all those tools? I'm asking, seriously.
14:43ChousukeRaynes: indeed. lein could become a thin, clojureish maven frontend
14:44mattreplit kind of is
14:44technomancyChousuke: it already is that, basically
14:44chouserI have used lein exactly once to build ring, and maven exactly once to build contrib. ...roughly similar pain.
14:44technomancymore 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:45ChousukeI think maven scares people mostly because it downloads the internet :P
14:45Raynestechnomancy: Don't be discouraged by these rebels! We shall rule zeh world!
14:45fogusI saw a funny tweet the other day that said something like "mvn clean just downloaded 3 jars"
14:46cemerickYup. World domination through maven screencasts, that's me. 9.9
14:47RaynesLooks like you're succeeding. :p
14:47kylesmithI'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:51Raynescemerick: Can I do mvn swank?
14:51technomancyRaynes: it works, but it AOTs everything up front
14:52technomancyso you can't use it to fix a problem that causes compilation errors. =(
14:52Raynestechnomancy: Ew.
14:52RaynesNot sold. :|
14:52cemerickRaynes: yes, see here: http://github.com/talios/clojure-maven-plugin
14:52cemericktechnomancy: even if you don't bind the compile goal?
14:52technomancyit also doesn't work if you have swank-clojure test-scoped
14:53technomancycemerick: we don't have any explicit config for swank in our pom
14:53technomancymaybe you can unbind it; I haven't looked into it closely.
14:54cemericktechnomancy: you mean it's set up in a parent somewhere?
14:54technomancyI mean we declare it as a dependency and that's it
14:56hiredmanI 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:56stuartsierrahiredman: But then when would we goof off?
14:57hiredman(or hop on irc)
14:57hiredmanstuartsierra: we'll multiplex
14:57Raynesstuartsierra: During the time it takes cemerick to write our maven poms for us.
14:57hiredmanlive for two or three days each real time day
14:57hiredmanthis could get complicated
14:59stuartsierraWe need some concurrency control mechanisms.
14:59stuartsierraYou know, put ourselves in Refs or something.
15:01cemerickstuartsierra: atoms, please. It hurts when future states of me have to get rebuilt because of contention.
15:02stuartsierraheh ):
15:02stuartsierra:)
15:03stuartsierraAlthough having a completely safe way to try new things might be useful.
15:05kylesmithI 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:06technomancykylesmith: if you've got a system-installed version of slime it might interfere
15:07kylesmithHmm, my sysadmin says it can't be uninstalled for some reason. Can I set some sort of precedence?
15:08technomancykylesmith: but elisp-level compilation errors don't necessarily mean the elisp failed to install
15:08technomancyyou can still run it in interpreted mode
15:12technomancycemerick: 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:13kylesmithinterpreted mode is fine, I guess. Do you have a link for that?
15:13technomancyit comes out to around 700 LOC if you exclude lancet.
15:14technomancybasically two weeks worth of work plus contributions that have accumulated since then
15:15technomancykylesmith: I don't know of any link. just ignore the compilation warnings and proceed as per instructions.
15:16cemericktechnomancy: 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:16kylesmithI did. Reload emacs, M-x slime -> "slime-presentation-init-keymaps: Symbol's function definition is void: slime-control-modified-char"
15:16kylesmithwhich is one of the compile errors
15:16cemericktechnomancy: You're right that I wasn't aware of the lancet part, but the point is a general one, I think.
15:17technomancycemerick: I see... yeah, I'm sure that plugin could be rendered unnecessary with a good plugin adapter.
15:18technomancysince my own needs are simple I haven't looked into it much
15:18cemerickFWIW, 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:19kylesmithtechnomancy: Well, I have to go for now. Thanks for the help so far.
15:19technomancykylesmith: definitely an old version of slime left around somewhere on your system; check C-h v load-path to debug further
15:20cemericktechnomancy: BTW, I certainly mean you no ill will (I know people can get personal about projects, etc). Just trying to provide some...perspective? ;-)
15:22technomancycemerick: 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:23cemericktechnomancy: it's a favorite saying of mine lately that everyone says "I only need 20% of *that*", but everyone's 20% is different.
15:23cemerickthough I'd say just about everyone needs .war files :-)
15:24technomancy(sorry)
15:24stuartsierraheh
15:24cemerickI cling to them for exactly the same reason! :-D
15:24cemerickwar, cargo, done.
15:25technomancythe 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:26technomancywhere requirements are rather uniform
15:27technomancyI wonder how much plugin support the maven-ant-tasks library provides.
15:28technomancyI tried to interop with maven itself, but the dependency injection framework it was using seemed to be pretty hostile to outside use.
15:28cemericktechnomancy: just out of curiosity, remind me again why lein and not clj polyglot?
15:28technomancy(in the immortal words of alex payne: "Curl up and DI.")
15:28technomancycemerick: tired of waiting, mostly
15:29technomancyit was literally usable within two weeks of weekends and evening hacks
15:30stuartsierratechnomancy, cemerick: lein does seem to make the simple case easy. Maybe someday we can unite our efforts.
15:30technomancyit's significantly smaller than clojure-maven-plugin still, though of course since that's implemented in Java it's hardly apples-to-apples. =)
15:34technomancyI guess you could load the file and then subtract the line-count of the docstring of each var; heh
15:37mattreplbuild 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:55gfodorI'm getting some very weird behavior with converting from byte arrays to strings and back
15:55gfodorhere's an example to highlight it
15:55gfodor,(count (.getBytes (String. (byte-array [(byte -62) (byte -113) (byte 80)]) "UTF8")))
15:55clojurebot3
15:56gfodoron my machine, that returns 2!
15:56gfodor(mac osx)
15:58lancepantzwhat do i pass to get a repl with a script loaded?
16:00programble<gfodor> (mac osx)
16:01programblei read that
16:01programbleas
16:01programbleclojure code
16:01Raynes,(mac osx)
16:01clojurebotjava.lang.Exception: Unable to resolve symbol: mac in this context
16:01Raynes:(
16:01programblelol
16:01gfodorhah -- anyone with a mac get that to return 2?
16:01fogusgfodor: does for me too
16:01gfodorthat seems horribly wrong, right?
16:02gfodorin JRuby on mac osx, it worsk
16:03headiusmac java has a fux0red default encoding
16:03headiuswe force it to utf-8
16:03headius(we jruby)
16:03headiusit's MacRoman by default but nothing renders MacRoman right
16:04Chousukeyou shouldn't care about the number of bytes in a string unless you're working with encodings :/
16:04gfodoryeah I am doing BER-packing
16:04gfodor(hey Charles :))
16:04gfodorreimplementing JRuby's pack("w")/unpack("w")
16:04headiusgfodor: hiya
16:04headiusahh for perf or a bug?
16:04headiusor for clojure?
16:04gfodorjust so I can read packed strings from clojure packed by a jruby script
16:04headiusahh
16:05headiusgood old pack
16:07gfodoroh, I figured it out
16:08gfodoryou need to supply the encoding to getBytes also
16:08gfodorwhy is that? It's it just, er, bytes?
16:08headiusit uses default external encoding if you don't
16:08headiuswhich would be macroman if you don't specify it on OS X
16:08headiushence, OS X java iz dum
16:08gfodorright, surely I'm just being dumb here, but why do you need to supply the encoding to *get* the bytes out?
16:09Chousukegfodor: all strings are stored as UCS-2 internally by java
16:09gfodoroh
16:09gfodor*sigh*
16:09gfodorok, the world makes sense, thanks
16:09fogus,(count (.getBytes (String. #^bytes (byte-array [(byte -62) (byte -113) (byte 80)]) "UTF8") "UTF8")) ;; yuck
16:09clojurebot3
16:09gfodoryeah
16:10gfodorany desire for BER packing code for clojure.contrib? :)
16:10ChousukeUCS-2 was a horrible choice for the internal encoding though :P
16:10Chousukebut, hindsight ;P
16:11ChousukeI bet many string ops in java would be much faster if strings were UTF-8 internally
16:17gfodorhey headius, here's some jruby fun
16:17gfodor[2000].pack("w").to_java_string.to_s.size == [2000].pack("w").to_s.size
16:17gfodorfalse
16:24headiusgfodor: what is 'w' again?
16:24gfodorBER-compressed
16:24gfodornice int packing for small ints
16:24gfodorthe problem is basically that hopping through java String "corrupts" the byte array
16:25gfodorI believe you guys keep the raw bytes in the RubyString so if you stick to the Ruby side of things everyting is cool
16:25gfodoras such, clojure is not going to have the ability to pack into Strings
16:26headiusyeah, that's why we don't use Java strings
16:26headiusyou can't easily represent arbitrary byte arrays
16:26technomancymattrepl: not necessarily that build tools should perform the deployment, but that they should build artifacts that are deploy-ready
16:27mattrepltechnomancy: completely agree
16:27technomancyfor 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:27technomancywe have actual deployment happening with chef
16:29mattreplwhy 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:31technomancymattrepl: we probably would if we were using leiningen, but maven did offer some plugins that gave us scripts out of the box.
16:32technomancyI'm bad at shell scripting, so I'm predisposed against writing my own. =)
16:35mattreplheh. I'd think no longer, post-lein
16:36technomancyall the .sh in leiningen is either copied from a known-good source or written by contributors. =)
16:40slyphoni'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:42technomancyslyphon: sure, try (into {} java-hashmap)
16:42slyphonoh, duh
16:42slyphonah, almost, it only went one level, but i can take it from there
16:48alexykliebke: the latest incanter on clojars returned by search is 1.0-master. That brings in the snapshot of 20091226... surely old?
16:53slyphonhmm
16:54slyphon(prn-str) because every language should have a "porn star" function
16:54KirinDaveAre seq's thread safe?
16:54KirinDaveI mean, like line-seq
16:54liebkealexyk: yeah the version on Clojars is obsolete. Go to http://repo.incanter.org
16:54alexykliebke: so you chose not to clojar anymore?
16:55liebkealexyk: it wasn't by choice, it was necessary due to Incanter's build structure. Clojars doesn't support modular maven projects
16:55alexykliebke: got it, cool
16:56technomancyKirinDave: the same seq shared across multiple threads should cache itself so changes to the underlying source (file, array, etc) should not interfere
16:56KirinDavetechnomancy: Okay, so that's all done magically for me.
16:56KirinDavetechnomancy: 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:56slyphonargh
16:56slyphonrecursion hurts my brain
16:57technomancyKirinDave: I believe so
16:57KirinDavetechnomancy: That's cool.
16:57alexykliebke: 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:58technomancyyep =)
16:58alexykslyphon: get a recursive brain, you'll be ok
16:58liebkealexyk: last time I checked there wasn't a way to remove projects from clojars
16:58RaynesRecursion is awesome.
16:58chouserslyphon: are you sure you need clojure maps?
16:58Chousukeslyphon: recursion is easy, you only need to understand recursion
16:59alexyktechnomancy: 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:59slyphonchouser: it would make life easier, i believe
16:59technomancyalexyk: not sure what "hacked as specified" means here
16:59chouserslyphon: if you're going to do persistent updates then you need to convert, otherwise you might not.
17:00slyphonnah, this is read-only
17:00slyphonit's for configuration
17:00chouserjava maps still do all the seq stuff properly
17:00slyphonhmm
17:00alexykmeaning, bootstrapped with static, then that used to build git checkout
17:01alexykthen bin/lein from that checkout is used; so if I want a newer, I just git pull, nothing else? no magic>
17:01alexyk?
17:01slyphonit's situations like this that the -> macro totally rocks my world
17:01technomancyalexyk: 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:02technomancythe symlink being from src/leiningen/bin/lein to somewhere on your path
17:02alexykliebke: you can sternly implore _ato to nuke the old crap
17:02alexyktechnomancy: so basically it pulls whatever jar it needs, no need to rebuild it right?
17:03technomancyalexyk: yes, currently there's no AOT necessary
17:03alexykhey 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:04technomancyalexyk: well you should at least move to 1.1.0 stable. =)
17:04alexyk I mean irresistably yummy, de rigeur for any true #clojure-ian?
17:05technomancybut 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:05alexyktechnomancy: I thought SNAPSHOT is ahead of the stable, with bug fixes and such, no?
17:05alexyksay 1.1.0 is released, is 1.1.0-master branch ahead of it?
17:05technomancyalexyk: no, SNAPSHOT is always behind stable of the same version number
17:05Raynesalbino: deftype, reify, NAMED ARGUMENTS, etc.
17:05technomancySNAPSHOT just means stable hasn't been released yet
17:05alexykRaynoceros: thx
17:06alexykNAMED ARGUMENTS! now we're talking
17:06RaynesNamed arguments: they're that important.
17:06technomancyget it while it's hot; only a couple days old
17:08alexykyay! I *love* named arguments since Ada 83
17:08alexyka language without named arguments is pfft
17:10chousernamed arguments without a language is worse
17:10alexyknamed arguments: what name did you just call my mama?
17:10alexykby reference?
17:11alexykchouser: how's that MEAP coming along? Now that I payed for it, I expect speedy updates! :)
17:11The-Kennyalexyk: I think I read something on Twitter about this
17:12The-KennyBut I can't remember what it was :/
17:12alexykThe-Kenny: about chouser?
17:12The-Kennyabout the meap updates, propably it was written by him
17:13alexykah! at least I want one without typos! :)
17:13alexykI mean c'mon, we got 2 authors and lots of typos! they can cross-proofread!
17:14alexykManning has people to proofread, with all the ripping-off and whatnot!
17:14alexykthe guy who finds strangely clothed men for the covers can do it in between finds
17:15underdevlol
17:16Rayneschouser: Yeah. Leave this channel immediately and continue writing. I wants updatez.
17:16alexykchouser: ignore Raynes, I'll take live advice any time over the written word
17:17Rayneschouser: Ignore alexyk, you can teach us more in the book than you can teach us here.
17:17RaynesWe have hiredman if we need help.
17:17alexykchouser: doubly ignore Raynes, do both!
17:17RaynesRun along now.
17:17alexykthe hiredman is hired and not for any more hire
17:18Raynesalexyk: That was poetic.
17:18The-KennyYay! Github is using <canvas> for the network graph now :) http://github.com/blog/621-bye-bye-flash-network-graph-is-now-canvas
17:18alexykRaynes: indeed
17:22chouserha, you guys are funny.
17:23chouserwe'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:23chouserso "any day now"
17:25technomancyprobably waiting on those lazy reviewers
17:25underdevchouser: 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:26Raynesunderdev: I'll put some grease on the trigger.
17:26chouserunderdev: that's fine. there will be a mostly-new chapter 1 soon, which may allow you to better evaluate the book.
17:26alexyk(lazy-seq reviewers)
17:27underdev"pull the trigger"... hanging out on slickdeals too much...
17:29alexykunderdev: just pull the damn trigger already, or it will get rusty
17:30alexykmanning had 47% off recently
17:30alexykthe 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:31alexykor two chouser's, one for you, one for the kids!
17:31alexykone for grandma
17:31chouser45% right now http://twitter.com/chrishouser/status/10990587934
17:32alexykwow! divisible by 5! incredible!
17:33programblelol
17:34underdevchouser: i actually tried it early today, and it wasn't taking my coupon code
17:34chouserunderdev: hmph.
17:34underdevso i guess i did try to pull the trigger
17:34underdevme too
17:35chouserI got it from the bottom of this page: http://tinyurl.com/ygo3654
17:36chousermaybe being mentioned in slot 10 of the bestselling meap list isn't sufficient?
17:36alexykIRC: Collective Intelligence in Inaction
17:37alexykchouser: that list is just bestsellers! the special deals on top do not grep it
17:38alexykthe top 10 are always there for reference...
17:38alexykbut, they say "mentioned in this mailer"
17:38chouserit says "any book mentioned in this mailer" in bright red giant font
17:38alexykyes
17:38chouserso .. I thought ... but perhaps I was wrong.
17:38chousersorry
17:38alexyksomeone has to explain them what "mentioned" means -- it's a contract in the US
17:39alexykI'll testify in small claims court
17:39underdevyeah, when i hit apply with code m3145, the price doesn't change
17:39alexyknotary-certify grep results of page source | grep clojure certify found
17:39alexykhence they owe the discolunt
17:40alexykdiscount
17:40alexykbtw looks like 3145 are the digits of π
17:40alexykalmost
17:41slyphonyou guys know if there's a way to recursively search back through the history in the *slime-repl clojure* buffer?
17:41slyphonlike C-r in readline?
17:41danlarkinrecursively? ...what
17:42slyphonincrementally
17:42slyphonsorry, brain-fart
17:43danlarkinC-r does an isearch-backward
17:43slyphoni know you can just do C-r and search up through the buffer, but if you don't have the buffer saved..
17:43danlarkinwhich is probably what you want
17:44danlarkinoh, I see what you mean
17:44slyphonthere's C-<up arrow>, which goes through the history entries one-by-one
17:44slyphonyeah
17:44slyphonjust curious, i can live without it
17:44danlarkinthere's M-p-r
17:45underdevyeah, code no good
17:45slyphonooh
17:45slyphonthat looks promising
17:45slyphondanlarkin: thanks
17:47alexykunderdev: just sign up for the email, it's usually 40+% every other week
17:48alexyksometimes for 2 books, you can get another as an excuse for getting the discount
17:53alexykLucene/Hadoop/Mahout/Intelligence are all good for 2 books
17:55ihodesanyone have an easy way to copy something to the clipboard? java.awt.datatransfer isn't working for me too well
18:02miltondsilva,(interleave {:a :b} {1 2})
18:02clojurebot([:a :b] [1 2])
18:03Licenser,(interleave [:a :b] [1 2])
18:03clojurebot(:a 1 :b 2)
18:03miltondsilva:(
18:03Licensermight be better to understand that way :)
18:03Licenserwhat did you expect it to do?
18:03miltondsilva{:a 1 :b 2}
18:03Licenserwow but that is a very different thing
18:04miltondsilvaI always forget coll isn't a map
18:04Licenser,(seq {1 2}
18:04clojurebotEOF while reading
18:04Licenser,(seq {1 2})
18:04clojurebot([1 2])
18:04Licenser,(flatten {1 2})
18:04clojurebotjava.lang.Exception: Unable to resolve symbol: flatten in this context
18:04kotarak,(zipmap (mapcat identity {:a :b}) (mapcat identity {1 2}))
18:04clojurebot{:b 2, :a 1}
18:04kotarakBut what would be the use?
18:04Licenserkotarak was faster :)
18:05kotarakYou can't guarantee key order. (in general)
18:05Licenserespecially since there is no order in maps
18:05miltondsilvaI'm processing *.obj files
18:05miltondsilvaneed to get vertices and faces
18:06Licensermiltondsilva: but why map keys values from two maps?
18:06miltondsilvanow that you mention it.. I see it's useless
18:07kotarak,0xff
18:07clojurebot255
18:07miltondsilvaoh
18:07miltondsilvano
18:07miltondsilvait's no from to maps
18:07kotarak,0o77
18:07clojurebotInvalid number: 0o77
18:07miltondsilvatwo*
18:07Licenserbit {} is a map
18:07kotarak,077
18:07clojurebot63
18:07Licenser*but
18:07Licenser,007
18:07clojurebot7
18:07LicenserI want that to be fixed to "Bond" :(
18:08miltondsilvait's someting like this (vertices faces) -> {:vertices vertices :faces faces}
18:09Licenserah I see
18:09Licenserreduce it?
18:09LicenserI don't know what exactly vertices or faces are but I have somethign that looks a bit like that
18:10kotarak,(zipmap [:a :b :c :d] [1 2 3 4])
18:10clojurebot{:d 4, :c 3, :b 2, :a 1}
18:10cemerickmabes: ping?
18:10Licenserhttp://github.com/Licenser/clj-sandbox/blob/master/src/net/licenser/sandbox/tester.clj#L51 look at this?
18:11mabescemerick: hey! you don't mind if I ask you some noob java deployment questions do you?
18:11RaynesLicenser: 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:11LicenserRaynes: please do :) I forgot how to do it :P
18:12RaynesLicenser: git branch -d <branchname>
18:12Raynes;P
18:12LicenserI tried that :( didn't worked
18:12Licenserit deleted it locally but on on github
18:12mabescemerick: are you using jetty in production? if so, are you using embedded jetty?
18:13cemerickmabes: no, not in production yet -- embedded jetty in dev environments tho
18:13LicenserI 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:13kotarakLicenser: (reduce #(update-in %1 [(:type %2)] conj (:tests %2)) {} definitions)
18:13Licenserkotarak: :( that is too easy
18:13miltondsilvaLicenser, 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:14cemerickmabes: did you get my /msg?
18:14RaynesLicenser: git push origin :new <-- Deletes a remote branch.
18:14LicenserI 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:15Licenserjruby 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:15RaynesLicenser: Also, I added a few new functions to the whitelist, so be sure to pull before your next push.
18:15Licenseraye
18:16cemerickLicenser: 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:16headiusclojure doesn't seem to have a way of referencing files normally
18:16headiusnot like Ruby's "require"
18:16headiusthat might be a problem for running without a precompile
18:16clojurebotnot a problem, the average bid for it on getacoder is $821.00
18:16Licenserthen lets add that?
18:17hiredmanheadius: load-file?
18:17LicenserI mean it should not be a problem to - eww okay it already exists
18:17headiushiredman: does that work once you've precompiled everything
18:17Licenserjust give it a nicer less scary name :P
18:17Licenserbut why precompile?
18:17hiredman,(doc load-file)
18:17clojurebot"([name]); Sequentially read and evaluate the set of forms contained in the file."
18:17hiredman,(doc load)
18:17clojurebot"([& 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:17LicenserI mean 90% of the stuff can run without it right?
18:18headiusthere's some duality here about being a file versus being a class though, no?
18:18headiusload-file won't load clojure code compiled into classes I presume
18:18headiuswill load load files?
18:18cemerickload loads classes preferentially to .clj files
18:18hiredmanheadius: in RT at least it has some functionality to load a file or class, whichever is newer, dunno how it is exposed
18:18headiusand is there no conflict between naming of classes versus files?
18:18hiredmancemerick: whichever is newer
18:19headiusthat's the issue we have
18:19cemerickhiredman: ah, right.
18:19headiusfiles can have arbitrary paths and filenames that aren't valid class names
18:19Licenserin a ideal world doing something like clj src/my-main-file.clj and java -jar my-jar.jar should do the same
18:19headiusLicenser: right
18:19Licenserthat is what we should aim to get
18:19kotarakmiltondsilva: another approach http://clojure.pastebin.com/6Hym772L
18:20headiusit's just hard to support that seamlessly because filesystem paths may differ from package+class
18:20headiusin jruby we try to mangle paths both ways... / becomes _, + becomes _plus_
18:20headiusbut it's hard
18:20miltondsilvakotarak: much better :)
18:21Licenserbut it is kind of important to give the entire thing a 'it just works' feeling, and that is important in my eyes
18:21headiuslike 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:21kotarakmiltondsilva: but not tested...
18:21miltondsilvayes but the idea ;)
18:21headiusthat's been the challenge for jruby
18:21headiusI'd love to brainstorm solutions
18:22Licenserhmm brute force: take your class path map the files which classes they have
18:22Licensersilly but not impossible solution
18:23Licenserthis makes the startup for projects from the commandline (a bit?) slower but it seems jars are preffared anyway
18:23Licenserif you've a FS with meta data you youd even stuff such things in the meta data
18:23headiusgetting pretty wild now
18:23headiusit needs to be simple and work everywhere
18:24Licenseryou've a relative path, some how
18:24LicenserI guess
18:24Licenserso scanning the files in that path once and mapping class -> file(s) should not be impossible
18:24miltondsilvakotarak: you had a very small typo (fload) apart from that it works very well
18:24Licenserfor small to medium sized projects I doubt the time for that would be even notable
18:25kotarakmiltondsilva: ah. 23:23 o'clock here, typos are allowed. ;P
18:25Licenserin clojure a class = a namespace right?
18:25Licenserjust to get sure, I'm not a clojure expert
18:25kotarakLicenser: no
18:25Licenserwhat do we actually want then?
18:25headiusit's especially weird for jruby since require can do things like require '~foo/bar/../baz/quux'
18:25headiuswhat class name do you look for there?
18:26Licenserhmm hmm
18:27LicenserI am confused now
18:27kotarak,xff
18:27clojurebotjava.lang.Exception: Unable to resolve symbol: xff in this context
18:28cemerick,0xff
18:28clojurebot255
18:29Raynes<Nilium> I think the one thing we got out of lisp was emacs, and that's akin to a war crime.
18:29Licenserheadius: off topic question, do you have a highlight on jruby? :P
18:29kotarakcemerick: 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:30cemerick:-)
18:30kotarakcemerick: btw: wau wau grrr woof woof woof - oh, you mentioned it. My mistake. ;)
18:30headiusLicenser: jruby and duby, yes :)
18:30Licenserwill ther be jduby?
18:30cemerickkotarak: dude, I totally missed that one. :-)
18:31Licenser:)
18:31Licensersneaky headius, sneaky
18:31headiusprobably something like that once I start to look into type hints for jruby
18:31Licenser^^
18:33kotarak,0xffM
18:33clojurebotInvalid number: 0xffM
18:33kotarakk
18:34Licenser0xdeadbeef
18:34Licenserm,0xdeadbeef
18:34Licenser,0xdeadbeef
18:34clojurebot3735928559
18:34Licensergeez I suck :(
18:42headius,(/ 1 0)
18:42clojurebotjava.lang.ArithmeticException: Divide by zero
18:42headiusdang
18:42programbleum
21:46defni 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_atotype inference?
21:48hiredmanclojurebot: deft?
21:48clojurebotdeft is http://gist.github.com/128259
21:48defnawesome! named it deft?
21:49hiredmanit's old and not very good
21:50defnhiredman: i think the consensus today was to use deft and deftype
21:51hiredmandeft for the struct like map thing ontop of deftype?
21:51defnyes
21:51defnthere was a lot of talk about calling it defmaptype
21:51defnor pruning defstruct
21:51defnbut in the end i got the impression that it would be called deft and deftype
21:52defni dont fully understand how it all works yet so dont quote me too literally on that
21:53defnhiredman: 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:55hiredman*shrug*
21:57defni suppose it oculdnt hurt anyone
21:57defni just feel sort of like a fraud publishing it
21:57defnthere's no original work in it
22:02defn17:28 < kotarak> cemerick: btw: wau wau grrr woof woof woof - oh, you mentioned it. My mistake. ;)
22:02defngah, sorry
22:04cp2hiredman: pardon for rolling through your gists, but... http://gist.github.com/223246
22:04cp2what is this for, heh
22:04cp2i mean, its pretty obvious what it _does_
22:04cp2not so much _why_
22:05MecAnyone know a good tutorial that shows all the different types of swing components?
22:08sattvikMec: I thought there were some Swing demos that shipped with the JDK, you could look for those.
22:08dsopis 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:10dsopso to say it ignores the result value if it's nil
22:11sattvikdsop: What do you mean by the result of a map? Are you talking about (map fn data)?
22:12miltondsilvayou could filter the result?
22:12dsopsattvik: yes (map fn data)
22:13Mec(map fn (filter identity data))
22:14sattvik,(filter (complement nil?) (map identity [1 2 nil 4]))
22:14clojurebot(1 2 4)
22:15miltondsilva,(remove nil? (map identity [1 2 nil 4]))
22:15clojurebot(1 2 4)
22:16dsophm
22:16dsopthx
22:17sattvikmiltondsilva: That's even better. I wondered if there was a way to avoid the complement.
22:17miltondsilva:)
22:20dsopMec: hm i'm not sure if i understand why identity doesn't map nil
22:20miltondsilva,(map identity [1 2 nil 4])
22:20clojurebot(1 2 nil 4)
22:20Mec(filter identity [1 2 nil 4])
22:20Mec,(filter identity [1 2 nil 4])
22:20clojurebot(1 2 4)
22:20miltondsilvait does... but you then remove the nils
22:21dsopah ys
22:22Mecits about equivalent but i prefer (remove nil?) it says more what you want to do
22:26slyphonuhm
22:30brian__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:31miltondsilvabrian__: http://java.ociweb.com/mark/clojure/article.html#JavaInterop
22:34brian__ok
22:56brandonwif 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:59Mecbrandonw: http://richhickey.github.com/clojure-contrib/index.html
23:01brandonwright, but theoretically if there isn't any documentation
23:01brandonwor i don't have access to it at the moment
23:01brandonwis there any way to enumerate symbols in a namespace from within clojure?
23:01MecThere is, but i'm not sure how to do it
23:06MecThe namespace section of the cheatsheet has some that might work
23:07brandonwperfect: all-ns does the trick
23:07brandonwthat's what i was looking for, thanks :)
23:07Raynesbrandonw: There is also grep. :>
23:08brandonwyes, but i don't like to leave clojure, it is too nice :)
23:08brandonwRaynes from reddit?
23:08Raynesbrandonw: Aye, sir.
23:08brandonwi am the annoying one talking to you about vimclojure ;)
23:09RaynesAnd I'm the annoying one complaining about VimClojure.
23:09brandonw:) i only wanted to help because i didn't realize you already had emacs; i thought you were trying out vim from nothing
23:10brandonwdefinitely no reason to deal with vimclojure's problems if you already have something perfectly workable, not to mention emacs' support is significantly better
23:10RaynesNaw. 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:11brandonwyeah. it isn't so much that vimclojure rivals emacs' clojure support (it is reasonably close, but still noticeably worse)
23:11RaynesI'm fairly certain that once Meikel gets the build stuff and documentation for such worked out, it will be much simpler.
23:11brandonwit is more amazing what meikel did with vim (which is much harder to extend for something like swank-clojure)
23:11brandonwyeah
23:11RaynesI imagine. VimScript makes my eyes burn.
23:11Raynes@_@
23:12brandonwi am still amazed at his vim/clojure prowess. i've tried several plugins for different filetypes in vim
23:12brandonwand they all had the basics, and some attempted stuff like auto-complete
23:12brandonwbut nothing has come even close to vimclojure in terms of a fully working repl, completion, viewing source, going to definitions, auto-completion
23:12brandonwwith only vim-script to work with, it truly astounds me :)
23:13RaynesAgreed.
23:14Mecwooo lich king dead finally
23:15Mecnow back to programming
23:15brandonwa blizzard fan
23:15brandonwyou wouldn't happen to have a starcraft 2 beta key you could accidentally PM me with :D
23:15RaynesProbably because Diablo II is so god-awful hackable.
23:15Mecno :x havnt gotten one myself
23:16brandonwyeah, i'm actually working on a bwapi-proxy port to clojure as an exercise in learning clojure
23:16brandonwnot to mention making it easier to interface with :)
23:16Raynesbrandonw: Hilariously, it was teh blizzhackers that got me into programming. I still hang around #bhdev on SynIRC.
23:17RaynesI assume you probably know of them.
23:17RaynesIf you're a blizzard fan.
23:17brandonwthat's pretty cool :) what were they doing when you first started programming?
23:17brandonwyeah, they are the ones responsible for the sc2 beta crack :)
23:17brandonwwhich i for some reason haven't tried yet...
23:17RaynesIt was when the 1.12 patch was released a couple of years ago.
23:17RaynesThey were mostly doing map hack and tppk.
23:18Raynes*cough*#clojure-casual*cough*
23:19phren0logyIs anyone else using LabREPL?
23:19Raynesmiltondsilva: Hit-and-run channel joins are frowned upon. ;P
23:19RaynesIt's more active during the day. We're growing slowly.
23:20miltondsilva:) I was just checking to see if there was much activity
23:23Raynesbrandonw: You should totally join. If only to check out my bot.
23:23Raynes:p
23:23brandonw#clojure-casual?
23:23RaynesIndeed.
23:23brandonwi thought i checked to see who was in it, and i didn't see anyone
23:23brandonwi guess i typed the wrong channel :)