#clojure logs

2009-03-15

00:01durka42got it to parse wiki markup did you?
00:02hiredmanno
00:02hiredmanI got it to parse something
00:03hiredmanin this case, it just parses out odd and even digits (seperately), as a result I get a sequence composed of numbers that each are composed of either all odd or all even digits
00:04durka42cool
00:04hiredmanit is a start
04:21Lau_of_DKMorning all
04:24slashus2hi Lau_of_DK
04:29Lau_of_DKCan somebody please explain to me, why we are told to use 'rest' in recursive calls, instead of next?
04:35Lau_of_DKCan somebody please explain to me, why we are told to use 'rest' in recursive calls, instead of next?
04:35Lau_of_DKsomeone like kotarak
04:35Lau_of_DK:)
04:38cmvkk_who's telling us that?
04:38Lau_of_DKThe Rich Man
04:39Lau_of_DKRecipe - Porting
04:39Lau_of_DKTo move to the new model you'll need to take the following steps, in this order:
04:39Lau_of_DK * Rename all your calls to rest to call next
04:39Lau_of_DK * If you were defining your own lazy sequence functions, using lazy-cons, switch them over to lazy-seq using the recipe above. Make sure to call rest and not next in your recursive call.
04:39Lau_of_DKfrom clojure.org/lazy
04:39cmvkk_ohhh.
04:39cmvkk_that's when you're defining a lazy seq.
04:39Lau_of_DKthats right
04:40cmvkk_if you're defining a lazy-seq on top of an already existing seq (lazy or not)
04:40cmvkk_it won't be totally lazy unless you use rest instead of next.
04:40cmvkk_i think?
04:41Lau_of_DKI would have thought the opposite, because rest is eager
04:41cmvkk_what do you mean by that?
04:41Lau_of_DKBut I guess when youre on top of another seq, you cant use the head, you need the frest
04:41Lau_of_DK,(rest [1 2 3 4 5])
04:41clojurebot(2 3 4 5)
04:41Lau_of_DKrest wil realize those 4 numbers, next will realize the first and remain lazy
04:41cmvkk_,(next [1 2 3 4 5])
04:41clojurebot(2 3 4 5)
04:42Lau_of_DKyes, when printing you get the same ofc :)
04:42cmvkk_that's realizing the numbers is what prints them out onto the screen.
04:42cmvkk_rest is lazier than next: it doesn't even evaluate the very next item.
04:42cmvkk_in fact, next is the same as (seq (rest ...))
04:43Lau_of_DKfrom the same page : "rest is fundamentally eager"
04:43Lau_of_DKYou'll have to email Rich your findings :)
04:43cmvkk_(next aseq) === (seq (rest aseq))
04:43cmvkk_from that page
04:44cmvkk_the "rest is fundamentally eager" line is from the section about how it was before.
04:44cmvkk_"the current seq model" refers to the old model.
04:44Lau_of_DK(doc next)
04:44clojurebotReturns a seq of the items after the first. Calls seq on its argument. If there are no more items, returns nil.; arglists ([coll])
04:44Lau_of_DK(doc rest)
04:44clojurebotReturns a possibly empty seq of the items after the first. Calls seq on its argument.; arglists ([coll])
04:45slashus2So they are the same except next returning nil and rest returning an empty seq?
04:45cmvkk_rest returns a seq that MIGHT be empty.
04:45slashus2of course
04:45cmvkk_what makes next eager is that it evaluates the next item in line to check to see if it even exists at all.
04:45cmvkk_if you want to see if the return value of rest is empty or not, you have to call 'seq' on it.
04:45cmvkk_which is why nil punning doesn't work anymore...
04:46Lau_of_DK ah ok
04:46Lau_of_DKThen I get it - thanks
04:46slashus2Is rest deprecated?
04:46cmvkk_no; sometimes that's the behavior you want.
04:46Lau_of_DKNo just altered
04:57javuchihello
04:57javuchiwhen to learn clojure?
04:57javuchiany recomended website'
04:57Lau_of_DKclojure.org -> screencasts
04:58javuchihello Lau_of_DK: the problem is that i have a slow connection
04:58Lau_of_DKok, www.projecteuler.net , solve 1 - 50 in clojure, compare with clojure-euler.wikispaces.com once you've solved everyone
04:59hoeckjavuchi: or http://www.ociweb.com/mark/clojure/article.html if you're new to lisp
05:00javuchithank you
05:01javuchido you think clojure is gonna be the lisp of the future?
05:02Lau_of_DK"gonna be" ?
05:02Lau_of_DKNo other Lisp can go toe to toe with Clojure atm - If the world will ever catch on, I dont know
05:04javuchiwhat is atm?
05:05hoeckit's the best lisp for now, and it has lots of possiblities to develop
05:05arbschtjavuchi: I doubt the future can only handle one lisp at a time
05:05javuchibut i mean: the mainstream lisp
05:06javuchido you think clojure is going to catch up CL?
05:07arbschtI don't think clojure is trying to
05:07Lau_of_DKcatch up? :)
05:07Lau_of_DKWhere is it falling behind ?
05:13javuchiLau_of_DK: some people says that clojure is worst because it lacks CLOS and can't modify its reader
05:14Lau_of_DKI dont think that the reader mods missing is a bad thing, and what do you need clos for? If you want objects just extends Java structure, which already surpasses CLs
05:14hiredman*cough*
05:15hiredmanI don't know if surpasses would be word
05:15kotarakjavuchi: some people have opions, other people have other opinions, such general remarks show, that some people have a very limited view of the world.
05:16hiredmanthe bookkeeper at work likes to say "opinions are like assholes, everyone has got one"
05:20javuchii think most people that are against clojure lives in comp.lang.lisp
05:21Lau_of_DKCommon Lisp is an emotion- It was the first Lisp I got into - and I was very happy to get out it again :)
05:22hiredmanjavuchi: let them eat cake
05:22hiredmanand hopefuly stay in c.l.l
05:23javuchihiredman: do you think they are problematic?
05:24hiredmanjust blind to anything that is not common lisp
05:24hiredmanand, just, ugh
05:25hiredmanreading c.l.l makes me want to alternate smacking my head with my hand and yelling
05:26javuchii think the same
05:26kotarakjavuchi: stay a while in c.l.l and in #clojure and you will see that CLOS is not everything. That's what they are missing. For me Clojure is better than CL because it throws away old cruft and brings a fresh breeze of air and because of the community, where Clojure *really* shines compared to CL
05:26hiredmanthe expression from the bookkeeper is most apt for c.l.l
05:27hiredmanclojurebot: what is #clojure?
05:27clojurebotclojure is the brand
05:27hiredmanbah
05:27hiredmanclojurebot: this?
05:27clojurebotthis is not a bug
05:27kotarak~blabla and this
05:27clojurebotthis is not a bug
05:27kotarakhehe
05:27hiredmanclojurebot: you are pretty worthless sometimes
05:27javuchikotarak: completely agree, i've been intermitently in c.l.l for some years, and they are insupportable at times. they seem to be the most hostile nerds in the world
05:27clojurebotIt's greek to me.
07:12Lau_of_DKping
07:19eevar_can I make swank-clojure-extra-classpaths load all jars in a given directory? "/my/dir/*.jar" doesn't seem to work
07:22hoeckeevar_: "/my/dir/*" (without the .jar") works for me
07:22eevar_hoeck, ok, thanks
08:25Lau_of_DKdurka durka
08:25Lau_of_DKhiredman, Cant we get that automated by Clojurebot?
08:25Lau_of_DKI mean, I enjoy doing it, but I might skip a beat once in a while
12:20hiredmanclojurebot: jar directory?
12:20clojurebotjar directory is find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
12:22hiredmanclojurebot: jar directory is <reply>on with java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
12:22clojurebotYou don't have to tell me twice.
12:22hiredmanclojurebot: jar directory?
12:22clojureboton with java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
12:23hiredmaner
12:23hiredmanclojurebot: jar directory is <reply>with java6(jdk1.6) CLASSPATH can contain a "*" so /jar/dir/* will suck in all the jars in the /jar/dir directory, this also works with swank-clojure-extra-classpaths in emacs, alternatively you can use this shell snippet: find .jars/ -type f -name \*.jar -print0|xargs -0|sed "s/ /:/g"
12:23clojurebotYou don't have to tell me twice.
12:24eevar_clojurebot: wiki?
12:24clojurebotwiki is http://en.wikibooks.org/wiki/Clojure_Programming
12:24eevar_clojurebot: clojure-mode?
12:24clojurebotclojure-mode is an Emacs mode for Clojure, found at git://github.com/jochu/clojure-mode.git
12:25kotarakclojurebot: vimclojure is http://kotka.de/projects/clojure/vimclojure.html
12:25clojurebot'Sea, mhuise.
12:25eevar_should clojure-mode do tab completion?
12:26kotarakclojurebot: gorilla is now merged with vimclojure http://kotka.de/projects/clojure/vimclojure.html
12:26clojurebotAlles klar
13:40marklarhow does one implement a Java static interface in clojure? I thought I could just import it and then use proxy, but it keeps giving a ClassNotFoundException so I figure I'm doing something wrong
13:41kotarakmarklar: then it's not in your classpath? I'm also not sure, whether you have to fully qualify the interface name or not. At least for gen-class have to do so.
13:41marklarkotarak: I'm able to extend classes in the same jar, so I was assuming it was some different with an interface vs a class
13:43kotarakmarklar: then you should be able to just use it. Also importing should work. (import 'clojure.lang.IFn) (proxy [IFn] [])
13:44kotarakdid you check the backtrace where the CNFE comes from?
13:45marklarits from the import statement
13:45kotarakmarklar: maybe a typo?
13:45marklar(import '(android.view.View OnClickListener))
13:45marklarI hoped so :(
13:45kotarakI this an inner interface?
13:46marklarkotarak: good question
13:47kotarakI would expect (import '(android.view View OnClickListener)) or (import 'android.view.View) and then (proxy [View$OnClickListener] [])
13:47kotarakdepending on the OCL being inside View or not.
13:47marklarkotarak: ah, yeah it is
13:47marklarkotarak: Thanks, I'll give that a shot
13:59gnuvince_I'm trying to convert a Clojure program to Haskell; just getting the FFI to work is probably gonna be as much work as the entire Clojure project :-/
14:02Lau_of_DKgnuvince, I actually yawned just from reading that
14:04gnuvince_Lau_of_DK: good for you
14:05Lau_of_DKyea it was nice
14:05Lau_of_DKI'll need some coffee now though
14:26danlarkinhey hey play nice
14:26Lau_of_DK~its his fault danlarkin, I was just minding my own business when suddenly...
14:26clojurebotCLABANGO!
14:28Chousuke... what the hell is that about.
14:28danlarkinit's #clojure's new favorite meme
14:28Lau_of_DKChousuke, www.clabango.com
14:29Lau_of_DKMan I lolled at that
14:31danlarkinyeah it's pretty good
15:22spacema__hey guys - say I want to merge a set of lists of hashes, like ({:id 1, :value 6} {:id 5, :value 2}) and ({:id 1, :value 4}) and sum the value part when the id's are equal - what's the right approach?
15:25slashus2spacema__: (merge-with + {:id 1 :value 6} {:id 5 :value 2} {:id 1 :value 4})
15:25slashus2oh wait
15:31cgrand,(vals (clojure.set/index (apply concat '#{({:id 1, :value 6} {:id 5, :value 2}) ({:id 1, :value 4})}) #{:id}))
15:31clojurebot(#{{:id 5, :value 2}} #{{:id 1, :value 4} {:id 1, :value 6}})
15:31cgrandand then reduce on each item to sum?
15:39spacema__cgrand: Clever, thanks. DIdn't know about index
15:50slashus2,(vals (clojure.set/index #{{:id 1 :value 6} {:id 5 :value 2} {:id 1 :value 4}} #{:id}))
15:50clojurebot(#{{:id 5, :value 2}} #{{:id 1, :value 4} {:id 1, :value 6}})
15:51slashus2Why the apply concat?
15:54slashus2,(map #(apply merge-with + %) (vals (clojure.set/index #{{:id 1 :value 6} {:id 5 :value 2} {:id 1 :value 4}} #{:id})))
15:54clojurebot({:id 5, :value 2} {:id 2, :value 10})
15:55spacema__since the data comes in as lists of hashes
15:57slashus2spacema__: embedded in random lists? (hash1 hash2) (hash3) (hash4 hash5) ?
15:57spacema__yeah, that's how I've got it now. I'm thinking it'd make sense to reshape it to take advantage of merge-with
16:00slashus2,(map #(apply merge-with + %) (vals (clojure.set/index (set (concat [{:id 1 :value 6} {:id 5 :value 2}] [{:id 1 :value 4}])) #{:id})))
16:00clojurebot({:id 5, :value 2} {:id 2, :value 10})
16:01slashus2I made them vectors for clarity.
16:02spacema__yeah. the problem is that merge-with is applying + to both the id's and other fields
16:03slashus2You don't want it to add the values?
16:03spacema__I want to add the vals, but the id's should be preserved; that is, the output should be ({:id 5, :value 2} {:id 1, :value 10})
16:13cmvkk_i can't see the beginning of your conversation, but it seems like your problem would be easier if the ID were a key and the value were a value, rather than both being key-value pairs.
16:13cmvkk_{5 2} rather than {:id 5 :value 2}
16:13spacema__yep, absolutely
16:14spacema__I'm gonna change it to work like that
16:16spacema__Thanks for the help thinking it over guys
16:22kib2Hi. I've just setup my EMacs to work with Clojure (using SLIME).
16:22kib2Now, I just want to learn how to use it :)
16:22kib2It's quiet confusing : you've got a Clojure and a SLIME menu.
16:22kib2Any advice ?
16:24Hundon't use the menus too much
16:24Hun(slime-setup '(slime-fancy))
16:24Hunuse this.
16:24Hunmost important stuff: load a file with C-c C-k, single defs with C-M-x
16:24Hunuse the inspector with C-c I
16:24Huntry paredit for editing
16:25kib2Hur: thanks! I've tried paredit but found it very annoying : once on an open par, I just can't delete it.
16:26kib2Hur --> Hun, sorry
16:26Hunyou can when there's nothing between
16:26kib2ah? ok, thanks for the tip.
16:26Hunnavigate by C-M-[fbud], delete stuff with C-M-k and move it around
16:26Hunworks pretty fast once you're used to it
16:27Hunyou can jump into stuff with M-. and out via M-,. try it, works also on core-clojure-stuff
16:48Lau_of_DK({:a 1, :b 2} {:a 2, :b 3} {:a 3, :b 4})
16:48Lau_of_DK({:a 41, :b 42} {:a 52, :b 53} {:a 63, :b 64})
16:48Lau_of_DKOk, lets say I have these 2 lists of hash-maps, and I want to merge them into 1 big hash-map
16:49Lau_of_DKI need a very fast an effecient way to do this, since Im merging more than 150K maps
16:51achim_pLau_of_DK: what's the result supposed to look like for these two lists?
16:52Lau_of_DK({:a 1, :b 2} {:a 2, :b 3} {:a 3, :b 4} {:a 41, :b 42} {:a 52, :b 53} {:a 63, :b 64})
16:56achim_phmm, list concatenation is linear time
16:57Lau_of_DKNo chance of blowing the heap with that?
16:57slashus2(merge (concat [{:a 1, :b 2} {:a 2, :b 3} {:a 3, :b 4}] [{:a 41, :b 42} {:a 52, :b 53} {:a 63, :b 64}]))
16:57slashus2,(merge (concat [{:a 1, :b 2} {:a 2, :b 3} {:a 3, :b 4}] [{:a 41, :b 42} {:a 52, :b 53} {:a 63, :b 64}]))
16:57clojurebot({:a 1, :b 2} {:a 2, :b 3} {:a 3, :b 4} {:a 41, :b 42} {:a 52, :b 53} {:a 63, :b 64})
16:59slashus2You don't even need merge
16:59slashus2concat alone works.
16:59cmvkk_yep, this is a list concatenation problem.
16:59Lau_of_DKhmm, cool
16:59Lau_of_DKI figured concat would give me 2 lists in a list
16:59cmvkk_that would be conj.
16:59cmvkk_or cons maybe.
17:00cmvkk_or list.
17:00Lau_of_DKor both
17:01Raynes,(conj [{:a 1 :b 2} {:a 2 :b 3}])
17:01clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: core$conj
17:01RaynesOf course.
17:01cmvkk_,(apply conj [{:a 1 :b 2} {:a 2 :b 3}])
17:01clojurebot{:a 2, :b 3}
17:02Raynes,(conj [{:a 1 :b 2} {:a 2 :b 3}] [{:a 2 :b 4])
17:02clojurebotUnmatched delimiter: ]
17:02RaynesDamn it!
17:02Raynes,(conj [{:a 1 :b 2} {:a 2 :b 3}] [{:a 2 :b 4}])
17:02clojurebot[{:a 1, :b 2} {:a 2, :b 3} [{:a 2, :b 4}]]
17:02RaynesThere. -_-
17:03slashus2,(conj [{:a 1 :b 2} {:a 2 :b 3}] {:a 2 :b 4})
17:03clojurebot[{:a 1, :b 2} {:a 2, :b 3} {:a 2, :b 4}]
17:04RaynesSo there.
17:05RaynesI have lemon cookies!
17:08hiredmanit is girl scout season
17:09RaynesNot those kind of lemon cookies.
17:15achim_pLau_of_DK: but if the lists are long, linear time is pretty bad. if you're accessing the maps sequentially, you could as well keep the lists and build vectors or lists of them (instead of concatenating them), which you can then do a tree-walk on
17:16Lau_of_DKachim_p, I pretty fast going over 200000 lines, so no need to optimize
17:41Mecis there a way to cache the return values of a function?
17:42dnolen,(doc memoize)
17:42clojurebot"([f]); Returns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use."
17:42Retonatori thought you could use memoization for that or are you looking for something in the lang?
17:42Retonatorlol, didn't know it was in the lang already
17:43Mecwow that's nifty
17:43dnolen;) sometimes it's plain shocking how much stuff is already there, I'm surprised constantly.
17:43Retonatorhave to dive into it ;), just found out about clojure 2 days ago
17:45Mec,([#(* 2 %)])
17:45clojurebotjava.lang.IllegalArgumentException: Wrong number of args passed to: LazilyPersistentVector
17:45Mecshouldnt that work then?
17:45Chousuke,`memoize
17:46clojurebotclojure.core/memoize
17:46Chousukehm
17:46Mecor should it be (memoize #(* 2 %))
17:46ChousukeMec: yeah. and you need to store the result somewhere
17:46Mecok, so what does the ([f]) mean
17:47Chousukefunction
17:47durka42that's the arglists for the function
17:47Retonatorarg
17:47Chousuke(def memosquare (memoize #(* % %)))
17:47durka42(doc +)
17:47clojurebotReturns the sum of nums. (+) returns 0.; arglists ([] [x] [x y] [x y & more])
17:47Mecah ok then
17:47ChousukeMec: it corresponds to the arg vectors used when defining the function
17:47durka42+ has more than one permissible arglist, they are listed at the end there
17:48ChousukeMec: so if you (defn foo [a b c]) then (doc foo) will say it has arglists [a b c]
17:48Mecright right, just the way it was formatted threw me off
17:48Chousuke(doc memoize)
17:48clojurebotReturns a memoized version of a referentially transparent function. The memoized version of the function keeps a cache of the mapping from arguments to results and, when calls with the same arguments are repeated often, has higher performance at the expense of higher memory use.; arglists ([f])
17:48Chousukedoc is so common it gets some special treatment :)
17:49Mecdoc memoize
17:49Chousuke(note there's no dot)
17:49Chousukeyou still need the parens.
17:49Mecah well, back to programming :D
17:49Chousukeand comma, not dot :P
17:49Chousukethere's also:
17:49Chousuke~source memoize
17:49Chousuke(clojurebot is not very consistent.)
17:49Retonatoris clojurebot coded in clojure or is it using eggbot or something?
17:50Chousukeit's clojure
17:50Chousukeusing PIRCbot
17:50Chousukeclojurebot: source
17:50clojurebotsource is http://github.com/hiredman/clojurebot/tree/master
17:50Retonatorthanks
17:51Chousukeit started off as a simple script on gist so it's not very designed :P
17:52Chousukeall of its history has been preserved though so you can look at what it used to be :)
17:52Retonatornevermind i still have to learn so some pratical stuff is pretty nice for me
17:52Retonatori like git ;)
17:52Chousukeyeah, me too.
17:53Chousukeit was pretty fun making the github project and then merging the gist history into it.
17:54tashafahello all
17:54tashafais there a way to turn a string to a clojure regexp?
17:55Retonatori am still learning git too, but i find github and git very inspiring
17:55Chousukeif you look at the network graph there's a long line of "auto ci" commits and then it merges and there's some funky stuff
17:55Retonatoras a developer i have been working with M$ most of my time
17:56Retonatorbut i always had an intrest for functional languages
17:56Retonatorhaskell, clean, f#
17:57slashus2tashafa: #"\w+"
17:57danlarkintashafa: re-pattern
17:58danlarkin(doc re-pattern)
17:58clojurebotReturns an instance of java.util.regex.Pattern, for use, e.g. in re-matcher.; arglists ([s])
17:58tashafaah thanks
17:58durka42also, Pattern/compile, but that's what re-pattern does :p
17:58tashafai need to read stus book more insead of hacking :P
17:59tashafa,(doc find-doc)
17:59clojurebot"([re-string-or-pattern]); Prints documentation for any var whose documentation or name contains a match for re-string-or-pattern"
18:00tashafa,(find-doc "re-")
18:00clojurebot------------------------- clojure.core/binding ([bindings & body]) Macro binding => var-symbol init-expr Creates new bindings for the (already-existing) vars, with the supplied initial values, executes the exprs in an implicit do, then re-establishes the bindings that existed before. ------------------------- clojure.core/compare-and-set! ([atom oldval newval]) Atomically sets the value of atom to newval if and
18:00slashus2..
18:01Chousukeit doesn't do reformatting :)
18:01Lau_of_DKtashafa, If you install emacs, you can have slime/repl in 1 window, and #clojure in the one side beside it :) Then you get (doc foo) w/o any pressure on your line
18:02tashafal-o-dk: i use emac and slime... for some reason i just like using clojorebot :)
18:02tashafaclojure*
18:03Retonatorwhat is a good starting point for learing emacs/slime (i have already installed everything and runing using the ubuntu tutorial)
18:05tashafawhats the key bindings to the emacs tutorial again?
18:05dnolenI always post this about emacs http://home.uchicago.edu/~gan/file/emacs.pdf
18:05dnolenit will save you a lot of time
18:05dnolenalso the pdf of the gnu emacs manual
18:06dnolenslime isn't so tough, you have the menu commands, eventually you'll memorize the key-bindings
18:06Retonatorthat pdf should be hanging on a wall somewhere ;)
18:07tashafaits on my office wall
18:07Retonatorif i do a C-x C-e on a line of code, should i see this line back in the slime-mode or is it just executed?
18:08Mecso memoize creates a map, is there a way to seed values?
18:10dnolenmemoize creates a closure over an atom
18:11dnolenyou might want to suggest on the mailing list providing a version that can be seeded
18:11dnolenin any case you should look at the source of memoize
18:11dnolenit's only 8 lines of code ;)
18:11Meci have, looks pretty easy to use seeds
18:13hiredman,(class (memoize #(prn :foo)))
18:13clojurebotclojure.core$memoize__5054$fn__5056
18:13hiredman~def memoie
18:13hiredman~def memoize
18:14tashafaim sorry im being a hassle..but how do you set the case sensitiviy of a clojure regexp pattern?
18:15hiredman(?i) will make a pattern case insensitive
18:16hiredman,(re-find #"(?i)foo" "FOO")
18:16clojurebot"FOO"
18:16tashafacool thanks
18:19tashafaanother one... when you map over a sequece is the sequence created lazy and if not is there a lazy-map fn?
18:20hiredmanclojurebot: map?
18:20clojurebotmap is *LAZY*
18:20Lau_of_DKGood one :)
18:20Mechmm memoize doesnt work for a function called form recur
18:20Mecfrom*
18:20tashafahiredman: i cant thank you enough
18:20hiredman~def map
18:21tashafaactually i'm giving clojurebot credit for that one
18:21tashafa:)
18:21hiredmanyou should
18:22hiredmanclojurebot: if you were a super hero, what would your origin story be?
18:22clojurebothttp://clojure-log.n01se.net/date/2008-11-21.html#13:04
18:25Raynes~and suddenly...
18:25clojurebotCLABANGO!
18:28tashafa,(doc re-replace)
18:28clojurebotjava.lang.Exception: Unable to resolve var: re-replace in this context
18:28tashafaare we still using java api for regex replace
18:28tashafa?
18:29hiredmanthe replace method on strings takes a regex
18:29hiredmanwell, a string object that it uses as a regex
18:29tashafa(.replace "tester" #"^t" "b")
18:29tashafa,(.replace "tester" #"^t" "b")
18:29clojurebotjava.lang.IllegalArgumentException: No matching method found: replace for class java.lang.String
18:29hiredmannah
18:30hiredman,(.replace "tester" "^t" "b")
18:30clojurebot"tester"
18:30hiredmaner
18:30hiredmanhm
18:30hiredmanah
18:30hiredman.replace takes a string
18:30Retonatorlol, i am scrolling through the clojurebot source and i see this line: "Ik begrijp" i don't know if this is intended but this is not "proper" dutch ;)
18:31tashafa,(.replaceAll "tester" "^t" "b")
18:31clojurebot"bester"
18:31hiredmanI forget where I got that
18:31slashus2hiredman: Are you going to add a javaDoc function?
18:31hiredman~jdoc String
18:31Retonatorit should be "Ik begrijp het" 'nitpicking'
18:33slashus2cool
18:35Mecis there a way to define a function in a function so that the inner function doesnt get redefined every time the outer function is called
18:39gnuvince_Mec: the compiler will take care of that.
19:02kib2Is there any solution to the last comment on http://www.newartisans.com/2009/03/hello-haskell-goodbye-lisp.html ?
19:03RaynesLISPers and Haskellers are meant to fight.
19:03RaynesThe rivalry will never end.
19:04kib2No, I don't think it's a fight here. It's a real question.
19:07durka42well the solution is to streamline it :p
19:07durka42once upon a time it must have been really hard to get GHC to do "simple" things
19:07hiredmanhmmm
19:07durka42i think it will get better
19:07durka42um
19:08hiredmanthat should be it
19:08hiredmansorry about that
19:08durka42this is like when i fix the wifi and my screen fills up with email notifications
19:08durka42streams are in now?
19:09hiredmanthe java side is
19:09durka42ah
19:09durka42hmm i was confused there for a second -- wondering what kind of genetic algorithms for math are going into contrib
19:11Mecis there a way to make reduce compare (5 4 3 2 1) as 1 &2, 3, 4, 5?
19:12Mecactually 2 & 1, 3, 4, 5. otherwise it's a simple reverse
19:13hiredmanwhat?
19:13gnuvince_Mec: no, reduce is foldl and there is not foldr
19:13Mecpoo, ok guess i can just rewrite the function i pass to filter
19:14gnuvince_What do you want to do?
19:15Mecreducing thru a list of lists
19:15Meci figured it out tho, pretty easy fix
19:20gnuvince_kib2: that's an implementation problem, not a language problem.
19:21kib2gnuvince_: sorry, I don't really catch your answer.
19:23durka42kib2: as in, there's no real reason that should be hard, and a shell script or a small clojure program could smooth things over
19:24durka42(i think that's what gnuvince_ meant)
19:26gnuvince_Yeah
19:26kib2durka42: ok, thanks. I was just asking this because I have already seen this problems in CL world, and I expected Clojure to solve the issue easily.
19:26gnuvince_The CLs usually ship the entire compiler+runtime with the program, which explains why they're huge
19:26kib2but you're right, writting a script is rather easy.
19:27gnuvince_And Clojure... well, I don't know Java well enough, but I'm guessing it's bound by the same limits Java is.
19:27kib2gnuvince_: oh yes!
19:27gnuvince_If you strip everything like Haskell does, well then you just have something that a C compiler could've compiled.
19:28gnuvince_Which means it's a static program, not something that you can extend and rework as it's running.
19:28Hunyou can do similar stunts with a CL-Compiler if you try hard enough. it's usually not worth it
19:29kib2indeed, there are pros and cons with each system.
19:29Hunin my case, used ecl to compile lisp to c to binary. try to debug that when something crashes...
19:29RaynesScala sends out shell scripts for compiling and such with it's distros.
19:30RaynesSimple "Scala scala.scala" wewt compiled.
19:30gnuvince_I think there was a discussion on the mailing list a few months ago on such a tool, and there were technical limitations to getting something to work
19:31kib2Raynes: good idea. But you'll then have to write such script for each platform you run on ?
19:31Rayneskib2: They do that, and have multiple distros for each platform.
19:32RaynesThere /has/ to be some way to make it easier without completely screwing everything up.
19:32Raynes:|
19:33kib2Raynes: why not, in fact you just have to write them once
19:34Hunbe aware that stuff gets really ugly when there's a bug in that code-generation stage.
19:35Huni had one that outputted the name of an internal symbol. i removed any reference to that symbol from my code, recompiled. it still was output
19:35RaynesI do know for people not coming from Java that the whole setup-clojure-with-perfected-classpaths thing jars them a good bit. When I came into Clojure I had no clue what a classpath was. I still haven't successfully compiled anything and jarred it. Of course I'm using netbeans and don't have too.
19:35Hunwhat happened? the compiler had an exotic crash and included the symbol in the linked in libraries
19:36kib2Hun: weird !
19:36Huntrue. took me a whole day to sort that out
19:37Hunit's like that old story, about kernighan infecting his own compiler
19:37Hunmy code was infecting other code, though i never wrote it that way
19:37Hunafterwards, the bug was in the statical library of cl-ppcre.
19:37Hunfun
19:37kib2Raynes: sure, classpaths are voodoo for me too.
19:38Rayneskib2: What got me is the whole, put Clojure here, start it with these classpaths make sure your class files are here and there, put this here and over there and then compile stuff.
19:39durka42what we need are some apt, yum, darwinports and windows installer packages
19:39RaynesIt just makes you wish you could just type "Clojure Main.clj" ??? profit.
19:39Mecis there a way to for loop over the lines of a file?
19:40durka42well it's more like $ clojure -cp ??? profit
19:40durka42(doc line-seq)
19:40clojurebotReturns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.; arglists ([rdr])
19:41Mecyuck i remember bad things of java bufferreaders
19:41durka42then you should look at contrib.duck-streams
19:42hiredmanMec: what bad things?
19:43Hunhere-be-dragons
19:43Meclike 5 lines of code to setup a reader just to read a file
19:43RaynesBut this isn't Java.
19:43hiredmanpfft
19:43hiredmanyeah
19:43RaynesThis is teh Clojure.
19:43Mecline-seq still wants a bufferedreader, so what do you do in clojure
19:43kib2Raynes: +1
19:43Hunat least you don't have to do the cylinder juggling by hand (which reminds me that i wanted to write a driver. damn)
19:44durka42use clojure.contrib.duck-streams/reader
19:44Raynes^
19:44durka42 Attempts to coerce its argument into an open
19:44durka42 java.io.BufferedReader. Argument may be an instance of Reader,
19:44durka42 BufferedReader, InputStream, File, URI, URL, or String.
19:44Meci dont have .contrib
19:44RaynesMec: Get it.
19:44durka42well, you should get it
19:45durka42or you can do the gyrations (BufferedReader. (InputStream. (File. "blah...... or whatever
19:45hiredman(-> "file.txt" File. BufferedReader.)
19:45hiredmaner
19:45Raynes(doc ->)
19:45clojurebotThreads the expr through the forms. Inserts x as the second item in the first form, making a list of it if it is not a list already. If there are more forms, inserts the first form as the second item in second form, etc.; arglists ([x form] [x form & more])
19:45hiredmanyou need a FileReader in there
19:46Hunthat reads like forth :)
19:46Mecsee what i mean :D why must reading a file be so difficult
19:46durka42(doc slurp)
19:46clojurebotReads the file named by f into a string and returns it.; arglists ([f])
19:47Mecya, right now im using (for [line (.split "slurp file.txt") "\r\n")])
19:47RaynesThen I just trim out the line breaks and slice it apart at the spaces.
19:47hiredmanugh
19:48durka42you should use (System/getProperty "line.separator") instead of "\r\n"
19:48Raynes...
19:49durka42Clojure=> (System/getProperty "line.separator")
19:49durka42"\n"
19:49hiredmanreada whole file into a string is just icky
19:49Raynesdurka42: Why didn't you tell me that /before/ I did this (.replaceAll (slurp f) "\r(\n)?" " "))?
19:49Mecthat wouldnt work
19:49Rayneshiredman: It works pretty well for what I'm using the file for.
19:49Mec,(System/getProperty "line.seperator")
19:49clojurebotjava.security.AccessControlException: access denied (java.util.PropertyPermission line.seperator read)
19:49Mecwell it just returns nil for me
19:50durka42separator
19:50Mecah hah
19:50Mecnot being able to spell has some serious drawbacks
19:50RaynesMec: Spell separator right :p
19:51RaynesYay.
19:51RaynesNow I don't have to use a regex.
19:51Raynes<3
19:56kib2Have to go. Good night.
19:59keithbRuby has IO.read to read the entire contents (like slurp), and IO.readlines to read the file into an array of lines. They're quite useful when the file is known to be of manageable size. A readlines type function would be useful. (Maybe I'll write one, but if someone wants to beat me to it... ;)
20:00Mechow come i keep getting unable to resolve classname for File, FileReader, and BufferedReader?
20:00keithbMec, import java.io
20:00durka42(import '[java.io File FileReader BufferedReader])
20:01achim_p(doc line-seq)
20:01keithbThat's what I meant. ;)
20:01clojurebotReturns the lines of text from rdr as a lazy sequence of strings. rdr must implement java.io.BufferedReader.; arglists ([rdr])
20:01MecClassNotFoundException
20:01durka42on which one
20:02Mechmm i guess (import 'java.io) doesnt work, but (import '[java.io File FileReader BufferedReader]) does
20:02durka42clojure doesn't have an equivalent for java's "import java.io.*"
20:02durka42you have to name each class that you want
20:02Mecah ok
20:03keithbMec, sorry, I was a bit careless when i said import java.io, I should not have assumed anything...
20:03Mecno problem :D clojure api really needs an example for each function and it would clarify a lot
20:04durka42this is entirely true
20:04durka42Drakeson is compiling something i think
20:04durka42~api examples
20:04clojurebotexcusez-moi
20:04durka42~examples
20:04clojurebotExcuse me?
20:04durka42what?
20:04durka42it used to know
20:05durka42clojurebot: api examples are http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
20:05clojurebotHuh?
20:05durka42clojurebot: api examples is http://en.wikibooks.org/wiki/Clojure_Programming/Examples/API_Examples
20:05Mecso after importing it should be (-> "file.txt" File FileReader BufferedReader line-seq) right? :D
20:05clojurebot'Sea, mhuise.
20:05durka42you may be able to skip the File. there
20:05durka42oh you will need dots after the classnames
20:05durka42to get the constructors
20:06durka42,(String "boo")
20:06clojurebotjava.lang.Exception: Expecting var, but String is mapped to class java.lang.String
20:06durka42,(String. "boo")
20:06clojurebot"boo"
20:06Mecright
20:07MecI dont know whats worse, (-> "file.txt" File. FileReader. BufferedReader. line-seq)
20:07Mecor (.split (slurp "file.txt") (System/getProperty "line.separator"))
20:08hiredmanslurp is worse
20:10hiredmanclojurebot: slurp?
20:10clojurebotNo entiendo
20:10hiredmanclojurebot: slurp is worse
20:10clojurebot'Sea, mhuise.
20:11Mec~def slurp
20:12gnuvince_(with-open [rdr (reader "/etc/passwd")] (doall (line-seq rdr)))
20:18Mecif I do java.io.FileReader i don't have to import it right?
20:20gnuvince_Nope
20:32Mecany reason java.util.GregorianCalendar might not exist?
20:33drewrMec: Not with a recent JVM.
20:35Meci've got java 6u10
20:37Mecgah inability to spell strikes again
20:37Raynes!
20:38gnuvince_Anyone knows what Rich said at QCon regarding Qi?
20:40RaynesWhy would anyone acknowledge Qi's existence.
20:41gnuvince_Why?
20:41gnuvince_It's an interesting project; I'm especially interested in hearing about what Rich thinks of the optional static typing that Qi offers.
20:41RaynesQi is boring :(
20:42RaynesRich should add static typing, just to piss Stuart Halloway off.
20:43Raynes"Buy our book and you get to use Qi!"
20:44gnuvince_Raynes: regardless of the "boringness" of Qi, I think that if a language has interesting features, they should be investigated.
20:44RaynesI'm sorry, I just don't find it interesting.
20:44gnuvince_And I think Rich made it pretty clear that he's against static typing through-and-through.
20:45gnuvince_He's mentioned in the past that he would be interested in an � la carte static typing system, citing specifically Qi.
20:45gnuvince_Apparently this topic came up at Qcon, and I was wondering if anything more was said about the matter.
20:46RaynesMention it on the group.
20:47cmvkk_would creating a system like that allow for a speed boost for statically typed forms and functions?
20:48cmvkk_or would it just be for the benefit of easier debugging or whatever.
20:49albinoWhy are we pissing off Stuart Halloway? IIRC he's the first one to write a book on clojure. It seem we ought to thank him for that not piss him off.
20:49cmvkk_actually, i was going to ask that too...
20:50gnuvince_albino: that was a joke
20:50gnuvince_albino: Stu's been through a lot of big changes
20:50albinognuvince_: oh, it was lost on me, sorry
20:51gnuvince_cmvkk_: I don't know about performance, I think the more interesting aspect is being able to prove properties of the code at compile time to prevent errors at runtime.
20:51Raynesalbino: It was a joke. Stu knows the consequences of writing a book this early. He knows it's going to be outdated probably soon after being distributed.
20:51albinofree unit tests
20:52cmvkk_oh i get it, it would piss him off because he'd have to change the whole book. i thought maybe he didn't like static typing or something.
20:52albinoif the system lets me specify types after the fact then I'm good with it
20:53albinoI like to add my assertions after the initial problem is solved
20:53Raynescmvkk_: I believe it's too late for him to change the book now anyways, when he updated it for lazy sequences he said it was just in time then.
20:53RaynesIf he would have made the book open on a website like real world haskell, he could of updated it any time :\.
20:53cmvkk_i wonder what that means for the impact of deciding to make breaking changes?
20:53RaynesBut, not my story.
20:54cmvkk_like, maybe we're less likely to see them now that the way it is now is going to be hardwritten into a book.
20:54RaynesI feel if Rich decides to make a change that book darn sure wont stop him.
20:55albinoI must have missed something on the lists. When did all this tension happen between Stuart's book and Rich's language
20:55cmvkk_i certainly think he would take the book into account...i think he looks at the community when he makes decisions like that
20:56gnuvince_albino: no "tension"; Rich took the language where it needed to go, and Stu had to rewrite many chapters to reflect those changes.
20:56albinognuvince_: sounds fair to me, did Stu complain a lot when he had to make those changes?
20:57gnuvince_Stu has joked about it, but I'm sure he feels it's more important that the language be done right than that his book be up to date for a longer period of time.
20:57Raynescmvkk_: Yes of course. Rich almost always looks to the community for opinions. I <3 Rich. I'm just saying that if it was important enough the book would be irrelevant.
20:57Raynesgnuvince_: Exactly.
20:57gnuvince_No complaining, he took it like a champ.
20:58albinosounds like I need to buy a copy
20:58albinoor digital copy if it's not in dead tree form yet
20:58Raynesalbino: You can buy both and get the book when it's in dead tree form.
20:59gnuvince_albino: both are available.
20:59RaynesYou save ca$h that way too.
20:59RaynesOh really?
20:59RaynesCool.
21:00gnuvince_I meant that you can have the book in digital and dead tree format. The beta PDF is available now, the book in a couple months maybe?
21:00RaynesOh, yeah, that's what I was saying.
21:06Meccant you have clojure use static typing with metadata?
21:08hiredmanMec: more or less
21:08hiredmanthe main issues is fn's interface is defined in turms of Object
21:09hiredmanso there is overhead for passing primitives through functions
21:09RaynesHaha turms. That made me giggle.
21:10Meceven if you define a function like: (defn foo [#^String s])
21:10Jedi_Stannisthe tag metadata gives you speed ups, but it doesn't type-check at compile time. If you want to learn about static type checking, you shoul dlook into haskell - it has a real, powerful type checking system. java/c/c++ type checking is not very good in comparison
21:11hiredmanMec: I am not 100% on this, but I believe the type hinting only helps within the function
21:11hiredmanbut String is not a primitive so it would not matter in that case
21:11hiredman,(ancestors String)
21:11clojurebot#{java.lang.Comparable java.lang.Object java.lang.CharSequence java.io.Serializable}
21:12Mecah
21:12RaynesClojure will poke you if you get a type screwed up. Haskell will beat your ass in a dark alley and then cut you.
21:12RaynesHe might even piss on you.
21:12Jedi_StannisI took a break from clojure for a little bit to explore with haskell, it's a really cool language
21:12RaynesJedi_Stannis: It's the other way around for me.
21:13Mechow is it's type checking different from java/c/c++?
21:13Jedi_Stannismade me appreciate functional style a lot more
21:13hiredmanrhickey has mentioned possibly making special purpose fn interfaces, for say functions that take doubles as arguments and return a double
21:13RaynesI took a break from Hasekll to explore Clojure and here I am.
21:13hiredmanMec: you don't have to do it?
21:13hiredmanoh
21:13hiredmanyou meant haskell
21:13Mecyes
21:13Jedi_Stannisbut I miss the dynamic nature of lisp and the homoiconicty
21:13RaynesMec: If Java's type system is a dinosaur, then Haskell's is GODZILLA.
21:14p_lwasn't it possible to make haskell's type system turing-complete?
21:14hiredman(a nuclear dinosaur)
21:14Jedi_StannisMec: its very hard to explain, you really have to look into it, its very in depth
21:14Raynesp_l: Yes.
21:14Meci know some newer feature of c++ was touring complete, but i cant remember the name of it... something with <>
21:15p_lotoh, clojure works on JVM, which has many advantages :D
21:15Jedi_Stannisill try to explain though: it has type inference, so you can get by without declaring types if you don't have to
21:15p_lMec: templates :P
21:15Mecya c++ templates are turing complete
21:15p_land possibly the scariest part of the language
21:15Raynesp_l: Plenty of advantages with some disadvantages such as no TCO and the stupid classpath stuff.
21:16p_lRaynes: it gives me possibility to target places I can't with CL or Haskell (or "can but it's a royal PITA and/or expensive")
21:16p_lfrankly speaking, my main interest right now is in making android apps :)
21:16Jedi_Stannisraynes: I agree on the cp stuff, but once you get it right you can stop worrying about it. and no tco is somewhat overcome with recur, trampoline (although I agree, its inelegant)
21:18hiredmanthe classpath stuff is not that bad
21:18RaynesThe classpath stuff itself is not that bad, the fact that in order to compile /anything/ you have to worry about it that's bad.
21:18hiredmanyou just need to know how the classpath works
21:18Jedi_Stannisits not that bad, but its not good
21:19hiredman*shrug**
21:19hiredmanWorks For Me
21:19RaynesIt's just weird to me to have to set up a directory structure and stuff. I'm spoiled by just calling a compiler and compiling shit.
21:19Jedi_Stannisits kinda a pain for those not coming from java land
21:19hiredmanclojurebot: works on my machine is <reply>http://haacked.com/images/haacked_com/WindowsLiveWriter/IConfigMapPathIsInaccessibleDueToItsProt_1446B/works-on-my-machine-starburst.png
21:19clojurebotc'est bon!
21:22hiredmannot being able to dynamically alter the classpath in a reliable way is kind of a pain
21:23hiredmanit would be neat to have compiled class written into a jar
21:23hiredmanclasses
21:25hiredmanhmm
21:25hiredman~def gen-class
21:30RaynesLiskell is neat.
21:31p_lJedi_Stannis: I'd say that's because other environments don't have Java land problems :P
21:31Jedi_Stannisp_l: agreed
21:32Raynesp_l: Enclojure eliminates that problem for me, hence the reason I'm still using Clojure and loving it all the way.
21:33Jedi_Stannisnever found an IDE I like more than using vim, good thing for vimclojure : )
21:34RaynesI use Emacs for Haskell and Factor and usually anything else that isn't something to do with the JVM.
21:35Jedi_StannisI've never used emacs, but im pretty happy with the features of vim clojure
21:35Jedi_Stannismaybe its better that I don't know what im missing out on
21:36RaynesYeah, I get told everything I'm "missing out on" by using Enclojure whenever Lau_Of_DK is around.
21:36RaynesI just smile and nod.
21:36RaynesAt least whenever I mention I'm using Enclojure.
21:37Jedi_Stannisdoes enclojure have any sort of integrated repl?
21:37RaynesYes.
21:37RaynesAnd you can M-x load files into it too ^_^
21:37RaynesScratch that.
21:38RaynesM-l
21:38Raynes:)
21:39Jedi_Stannisthat's good then, I feel like that's the killer feature
21:39RaynesDamn right.
21:39RaynesCouldn't live without it.
21:40AntonyBlakeyraynes: as an enclojure user, do you know where the instructions to build/install from tip are? I can't find any and I'd like to use it with tip NetBeans.
21:41RaynesWhat's tip? o_o
21:41AntonyBlakeyhead
21:42AntonyBlakeyLatest from SVN, rather than prebuilt
21:42RaynesOh.
21:42RaynesI believe there is a post on the group somewhere that links to build instructions.
21:43RaynesOh yeah, that was my post.
21:44AntonyBlakeygot it - Eric Thorsen ?
21:44AntonyBlakeyDec 24 2008
21:44Rayneshttp://groups.google.com/group/enclojure/browse_thread/thread/93ecc3522607c5c9?hl=en
21:44RaynesThat was it.
21:44RaynesI never actually built it though.
21:44AntonyBlakeyWas expecting instructions on the site, sorry, should have searched the group.
21:44RaynesI'm too good to build my own software.
21:45AntonyBlakey:) Current build doesn't work with nice new OSX L&F in NetBeans.
21:46gnuvince_How do you declare a case-insensitive pattern?
21:46gnuvince_re-pattern doesn't take any extra arguments
21:47Chouser#"(?i)foobar"
21:47Raynes(?i)
21:47RaynesFUCK.
21:47Raynes-_-
21:47Raynes:(
21:47Chousersorry, I'll leave you to it. :-)
21:48RaynesChouser: I think you look into the future and find out what questions will be asked and keep the answers in a text file to copy and paste when needed.
21:48Raynes:|
21:50Raynes,(.replaceAll "(?i)chouserbot" "CHOUSERBOT" "Chouser")
21:50clojurebot"(?i)chouserbot"
21:50Raynes,(.replaceAll #"(?i)chouserbot" "CHOUSERBOT" "Chouser")
21:50clojurebotjava.lang.IllegalArgumentException: No matching method found: replaceAll for class java.util.regex.Pattern
21:51Raynes:| It worked on my machine.
21:51danlarkinRaynes: please stop with the profanity
21:51RaynesEr...
21:52hiredmanRaynes: you have the arguments in the wrong order
21:52Rayneshiredman: I just realized that. :| I've been playing with factor all day.
21:52RaynesIt's got me thinking all postfixy.
21:53Raynes,(.replaceAll "CHOUSERBOT" "(?i)chouserbot" "Hai Chouser :)")
21:53clojurebot"Hai Chouser :)"
22:10MecJ looks a whole lot like a comic character throwing up
22:36hiredmanhmmm
22:37hiredmanclojurebot: how much do you know?
22:37clojurebotI know 5 things
22:37hiredmanuh
22:37hiredmanthat is not good
22:39hiredmanhow the hell
22:40Mecclojurebot: what do you know
22:41hiredman~how much do you know?
22:41clojurebotI know 203 things
22:41hiredmanrestored from an old backup
22:41hiredmanbut, uh, scary
22:42hiredmanhow did that happen
22:42albinohe's not serializing his knowledge?
22:42Mecis clojure.contrib on google code?
22:42tashafashould be
22:43tashafaanyone know if there is an emacs irc mode?
22:43hiredmanalbino: he is, but something happened to the file
22:44hiredmanthis machine had an unscheduled power cycle
22:44hiredmanvery annoying
22:45gnuvince_tashafa: there's erc and rcirc. rcirc is included with Emacs, just to M-x irc
22:45gnuvince_s/to/do
22:46hiredmanclojurebot: slurp?
22:46clojurebotTitim gan �ir� ort.
22:46albinoahh, time for an ups
22:49hiredman~latest
22:49clojurebotlatest is 1327
22:51Mecany simple way to flatten 1 layer of a list?
22:51Chouserbotapply concat
22:51Mecah ha, thanks
22:54Meci thought count was O(1)
22:55Mecoh nvm, lazy squence
22:55Chouserbotyou can find out with 'counted?'
22:56Chouserbot,(counted '(1 2 3))
22:56clojurebotjava.lang.Exception: Unable to resolve symbol: counted in this context
22:56RaynesHey, when we get to rev 1337 let me know, because I'm celebrating.
22:56Chouserbot,(counted? '(1 2 3))
22:56clojurebottrue
22:56Mechmm i dont have counted?
22:56Chouserbot,(counted? (map identity '(1 2 3)))
22:56clojurebotfalse
22:57Chouserbot'counted?' was introduced in svn rev 1268
22:57tashafathanks gnuvince
22:58tashafa,(doc counted?)
22:58clojurebot"([coll]); Returns true if coll implements count in constant time"
22:59digashis there a function somewhere to read-lines from the stream and re-find patterns w/ ability to stop at the first match?
23:03Mecif i want to (reduce +) a sequence that is too large for memory, I cant define it can I
23:04hiredmanfilter is lazy
23:04hiredmanMec: nope
23:04Chouserdigash: (some #(re-find #"^chouser.*" %) (line-seq (BufferedReader. (FileReader. "/etc/passwd"))))
23:04hiredmanso (comp first filter)
23:05hiredman~how much do you know?
23:05clojurebotI know 225 things
23:06digashChouser: i was looking at clojure.contrib.duck-streams/read-lines but could not see how to close the stream if match is found.
23:06digashChouser: thank you, i will use line-seq.
23:07Chousergood point, I always forget that.
23:07Mechmm i thought numbers were automatically promoted to bignum, but I just got a wraparound from a large addition
23:08dreishSounds like a bug.
23:10ChouserMec: what opeartion? 'inc'?
23:10Mec(reduce +)
23:11dreish,(reduce + (range 10000000))
23:11clojurebot49999995000000
23:11Mecthat was fast
23:12Mec,(reduce + (range 48000000))
23:12clojurebotExecution Timed Out
23:13dreish,(Thread/sleep 5000)
23:13clojurebotnil
23:13digash,(with-open [rdr (java.io.BufferedReader. (java.io.FileReader. "/etc/passwd"))] (some #(re-find #"^chouser.*" %) (line-seq rdr)))
23:13clojurebotjava.security.AccessControlException: access denied (java.io.FilePermission /etc/passwd read)
23:14digashoops, did not mean to raise some security alarms
23:18dreish,(.. Runtime getRuntime availableProcessors)
23:18clojurebot1
23:18dreishWow, where do you get a one-core machine these days?
23:19Mecmine is one core :*(
23:20Mecis it even usefull to have multiple threads on a single core machine, with pipelining and whatnot
23:22ChouserMec: it's useful to have threads blocking on IO instead of having to manage a select loop yourself.
23:23Mectrue, but just calculation performance wise?
23:24ChouserYou could profile it, but I'd be a bit surprised if there a noticable improvment.
23:46hiredmanman