#clojure logs

2009-05-24

02:26unlinkIf I have a class Foo, containing an enum Bar, with a field BAT, how do I access what would be Foo.Bar.BAT in java?
02:26durka42try Foo$Bar/BAT ?
02:29unlinkdurka42: no such namespace
02:29durka42did you import Foo$Bar
02:29unlinkaha
02:29durka42the $ names inner classes
02:30durka42or whatever java calls them
06:42StartsWithKfyuryu: hi
06:43porpoiseWhat version of clojure/slime/swank should I be using?
06:44porpoiseI was getting some variables not found, swank.swank something, when starting up slime
06:44porpoiseAfter I let ubuntu install libjogl-java and 50 megs worth of java stuff
06:45porpoiseThen I removed that, used the sun jdk-1.6.0 and it worked again
06:45porpoisemaybe add-classpath has problems with some java setups?
06:47fyuryuStartsWithK: Hi
06:48StartsWithKfyuryu: did you had a time to review the changes maybe?
06:49fyuryuStartsWithK: I just started looking at your repo - never used Ivy so give me a couple of minutes to figure out what's happening there
06:50StartsWithKnp, not in a rush myself :)
06:57porpoiseIs there a way to change the current path for load-file?
07:02StartsWithKporpoise: you can use add-classpath
07:03porpoiseDoes that affect load-file? I'm running someone else's code that uses (load-file "foo.clj") instead of the library system
07:04StartsWithKit will give load-file a new location to search for foo.clj, uff, thats for (load) i think, sorry
07:06porpoiseI thought so. I'll have to fix the code to use ns and all that
07:06porpoiseIt'll be good practice for me anyway
07:08StartsWithK:)
07:16fyuryuporpoise: be careful with add-classpath, sometimes it doesn't work
07:16fyuryuporpoise: I don't know why, it probably has something to do with java class loaders
07:17porpoiseI know... it's weird. I think that's why swank/slime got borked when I let ubuntu install jogl for me and it insisted on installing its own java (gcj and all that junk) which took precedence over the /opt/jdk1.6.0/bin that was also in my path
10:03quidnuncHow can I apply a a function of n arguments to a single sequence such that the elements are consumed n at a time? e.g. (map-n #(+ %1 %2) [3 4 5 6]) => (7 11)
10:08arbschtquidnunc: perhaps (map #(apply + %) (partition 2 [3 4 5 6]))
10:10quidnuncarbscht: Thanks.
10:10quidnuncAlso, does anyone know of something like drop-nth?
10:17durka42,(letfn [drop-nth [index coll] (concat (take index coll) (drop (inc index) coll))] (drop-nth 2 [1 2 3 4]))
10:17clojurebotjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Don't know how to create ISeq from: Symbol
10:19durka42um
10:20durka42quidnunc: anyway, (concat (take index coll) (drop (inc index) coll))
10:20arbscht,(letfn [(drop-nth [index coll] (concat (take index coll) (drop (inc index) coll)))] (drop-nth 2 [1 2 3 4]))
10:20clojurebot(1 2 4)
10:20quidnuncThanks durka42, make sense.
10:31quidnuncdurka42: Actually, I want to drop *every* nth element
10:31quidnunclazily
10:31quidnuncBy the way, is there some automated way to check if a function is lazy?
10:37kotarakquidnunc: not that I am aware off... You can check whether it returns a LazySeq, maybe...
10:37kotarak(defn drop-nth
10:37kotarak [index coll]
10:37kotarak (let [seq-fn (fn seq-fn [step s]
10:37kotarak (lazy-seq
10:37kotarak (when-let [s (seq s)]
10:37kotarak (cond
10:37kotarak (and (= step index) (next s))
10:37kotarak (cons (second s) (seq-fn 0 (rrest s)))
10:37kotarak (< step index)
10:37kotarak (cons (first s) (seq-fn (inc step) (rest s)))))))]
10:37kotarak (seq-fn 0 coll)))
10:37kotaraknot tested
10:48RaynesI don't understand why people wont give up on Arc. :\
11:01rhickeyif I use git-svn it looks like I have to dcommit to the svn server to coordinate anyway
11:02rhickeyaccording to the caveats at: http://www.kernel.org/pub/software/scm/git/docs/git-svn.html
11:03ccmtaylor(defn drop-nth [n s] (let [zip (partial map vector)] (for [[i x] (zip (iterate inc 0) s) :when (not= 0 (rem i n))] x)))
11:04rhickeyI wanted to try git-svn for the next big Clojure feature
11:05rhickeylooks like I'd have to work on only one machine while I did so
11:14Chousukerhickey: you can share the commits between git repos normally, but then you can't easily sync with the SVN server.
11:19Chousukesince SVN doesn't keep the same information about commits as git does, the hash changes when you do a dcommit to the svn repo, and if you have shared the old commits to other git repos prior to dcommit, they will not be able to tell that the commits at the svn server are the same as what they have, because the hash has changed.
11:22quidnuncThanks ccmtaylor
11:25Chousukerhickey: however, until you actually do a dcommit to the SVN server (thus changing the commit hashes), you can use git like SVN didn't exist at all.
11:27rhickeyChousuke: sounds like trouble, thus the caveat section
11:28Chousukeyeah :/
11:29ChousukeI suppose it should be possible to always keep a tracking branch for the SVN server, and then periodically rebase on top of it.
11:30Chousukebut that's not exactly trivial either
11:46ccmtaylorquidnunc: here's a better version: (defn drop-nth [n sequence] (mapcat butlast (partition n sequence)))
11:47quidnuncccmtaylor: Nice, thans
11:47quidnuncthanks*
11:47ccmtaylorquidninc: the other one always drops the first item, so it probably doesn't do what you wanted anyway :)
11:48quidnuncccmtaylor: Yeah I thought of that. But I thought that it should be consistent with take-nth
11:49quidnuncccmtaylor: But there would seem to be no easy way to convert the first way into the second (when you didn't want to drop the first).
11:52quidnuncActually I guess you could just prepend a dummy variable
11:52quidnuncs/variable/value
11:54ccmtaylorquidnunc: actually, never mind. I just found out that the second version I sent stops too early.
11:55ccmtayloruser> (drop-nth 3 (range 20))
11:55ccmtaylor(1 2 4 5 7 8 10 11 13 14 16 17)
11:56ccmtayloreh, (0 1 3 4 6 7 9 10 12 13 15 16)
11:57Chousukethat's because partition drops the tail if it isn't evenly divisible
11:57Chousukethere's a conservative variant somewhere in contrib I think.
11:59StartsWithKpartition-all in seq-utils
11:59ccmtaylorChosuke: yeah, but even then it would apply butlast to the tail, which is incorrect.
12:06ccmtaylorquidnunc: if you use (iterate inc 1) instead of (iterate inc 0) in the first version, it shold work:
12:06ccmtayloruser> (defn drop-nth [n s] (let [zip (partial map vector)] (for [[i x] (zip (iterate inc 1) s) :when (not= 0 (rem i n))] x)))
12:06ccmtaylor#'user/drop-nth
12:06ccmtayloruser> (drop-nth 3 (range 20))
12:06ccmtaylor(0 1 3 4 6 7 9 10 12 13 15 16 18 19)
12:08quidnuncccmtaylor: Yeah my point was that it would be nice to have a single version that could handle both cases easily. Dropping the first element is more consistent with take-nth but seems less useful (and surprising?).
12:34danlarkinSomehow I've got my emacs config all messed up. I used to be able to M-x slime and have it split the screen open the repl in the bottom buffer, but now it just opens *inferior-lisp* and *slime-repl clojure* in two new full sized buffers
12:35danlarkinany ideas from the crowd?
12:49fyuryuStartsWithK: I started importing some of your changes into cloak. Mainly changes to actions.clj and the dependency on commons.io lib.
12:49fyuryubut I'm not convinced to the way how code is organized. I don't want to rely on other source code, esp. when I have it in a separate project (but of course I'm fine with jars).
12:50StartsWithKfyuryu: to what code are you refering to? clj-unit or your graph/utils?
12:51fyuryuStartsWithK: both
12:54StartsWithKif i move everything under cloak namespace? like cloak.unittest and cloak.graph and remove external directory (that was kind of my plan from the begining)
12:55StartsWithKso cloak.unittest can be used as unit test framework for project using cloak
12:55StartsWithKorganisation is lame, thats true, i didn't pay any attention to it for now
12:56StartsWithKproblem with test-is, i can't make it automated
12:57StartsWithKsame goes for rosado.math.graph and rosado.utils, i would need to patch libs4clj and have a .zip somewhere so i can create packager for it, it was easyer for me to just move 2 files in src/
13:03fyuryuStartsWithK: what do you mean by "move"? changing the namespaces in clj-unit and moving the files to appropriate dirs? sounds scary - keeping it up to date would require work every time clj-unit has a "release". Ditto graph lib and so on.
13:04fyuryuStartsWithK: Well, for the whole thing to work, all deps should have a maven repo or something.
13:05StartsWithKfyuryu: there would be no updating, cloak.unittest would be a full fork, clj-unit looks fnished to me, i don't think there will be any big changes to it in the future
13:05StartsWithKi can strip clj-backtrace, but it gives such a nice colorful error messages :)
13:06fyuryuStartsWithK: colorful? on windows too? (I've never used clj-backtrace)
13:06StartsWithKfyuryu: i don't know about windows (don't think so, no term codes)
13:07StartsWithKi think it just displays them without any colors, but it also reformats tracebacks to be more human readable
13:09fyuryuStartsWithK: I automated test-is tests. That's how they're run via cloak (which simply means running a clojure script)
13:10StartsWithKfyuryu: but geting a contrib is not automated, it requires a manual step from the user
13:10fyuryuStartsWithK: ah, I see
13:12StartsWithKin worst case scenarion this could only be a temporary solution, once clj-unit and/or contrib get some kind of download site, they could be removed from cloak repo
13:26fyuryuStartsWithK: clj-unit.core uses clojure.contrib.except
13:27StartsWithKfyuryu: not it this fork
13:28StartsWithKi striped it out (it and clj-backtrace used only 2 lines from contrib)
13:33slashus2Any idea why this concurrent solution is slower than my non-concurrent solution in most of my tests? http://paste.lisp.org/display/80748#2
13:34fyuryuStartsWithK: I think just having necessary jars in the lib folder is a cleaner solution. I didn't put contrib in there only because I assume everyone has it and it weights 2.6 megs. But I might add clj-unit and clj-backtrace jars there. But that still leaves commons.io - but this one can be pulled via Ivy or Maven
13:37StartsWithKfyuryu: commons-io and clojure are downloaded by ivy in current setup, (and ant, commons-cli, ssh library)..
13:38StartsWithKbut if you jar this clj-unit fork, isnt that the same thing in the end, it still lives in cloak repo
13:38StartsWithKwith cloak.unittest there is a easy way to add testing actions
13:39StartsWithKand change them to fit cloak workflow (loggers and such)
13:39slashus2A lot of time is spent on invoke and swap! in each function.
13:44Chousukehm
13:49memoizeall the common lisp guys at work think im crazy not using emacs/slime, is it that awesome?
13:54gnuvince_memoize: Emacs and Slime *are* really nice. HOwever, it seems that right now, the Clojure support is broken :)
13:55memoizegnuvince_: how so? i got a slime prompt and did simple forms, but still need to lern emacs
13:56gnuvince_memoize: maybe it's a combination of the versions I use, but some things like auto-doc, completion, etc. were not working.
14:02memoizemad thought: replumb as much of emacs elisp in clojure, remove the bits that don't have to do with editing and lisp :)
14:09gnuvince_My recent mad thought: considering the performance of the v8 JavaScript engine, re-implement a new Emacs (with no compatibility with GNU Emacs) using JavaScript as an extension language.
14:10danlarkineveryone wants to rewrite emacs :)
14:11gnuvince_Yeah
14:12gnuvince_I thought that with everyone whining about Emacs Lisp being dynamically scoped and single-threaded and whatnot, JavaScript would not be a bad choice
14:12gnuvince_Plus, you get a huge potential developer base :)
14:13sohailcan't wait for scriptalicious for emacs!
15:06bradfordI am trying to create a function that takes a map of functions and a map of data, and it applys each function in the function map to the entire map of data, the result is a map where keys are the keys in the function map, and the value is the result of the funtion application.
15:07Chousereach function takes the whole data map as a single arg?
15:07bradfordit is like (merge-with #(%1 %2) fn-map data-map) ... but not quite because the arg to the functions is not the data in the associated key in the data map, it is the entire data map
15:07bradfordchouser: right
15:09Chouser(into {} (for [[k f] fn-map] [k (f data-map)]))
15:10fyuryuStartsWithK: having clj-test in a jar also allows this; and adding testing actions to cloak would probably be done via functions calling clj-test code (maybe not - I'd like the import/require expr. in CLOAK files be small, but I know that's just aesthetics).
15:10bradfordchouser: yep, excellent
15:11bradfordI had: (into {} (for [key (keys fns)] (key ((key fns) data))))
15:11Chousersure
15:11Chouser'key' is the name of a core function
15:11bradfordi did not know that for comprehension syntax that you used for maps
15:11bradfordthat is really sweet
15:12Chouseryep, it's handy
15:12Chousukeit's just destructuring, really. :)
15:12rhickeygit svn clone takes a while...
15:13Chousukeyeah, it does.
15:13Chousukemake sure not to lose your git repo after the first clone :P
15:13rhickeyshould I git gc after?
15:13Chousukeyeah, unless git does it automatically.
15:14rhickeyIs this workflow sound? http://rcoder.net/content/daily-git-svn
15:16rhickeyI'm not sure I completely understand it
15:16Chouseryeah, that's pretty good.
15:16fyuryuStartsWithK: for now, I can add your fork of clj-test as a jar. Without a use case, where its source is really needed I'm against having "alien" sources in the repo.
15:17ChouserHis workflow is probably even better than mine. I use "master" as my svn-merge branch, and don't do much work in it.
15:18fyuryuwhat is going on here? rhickey converts to git?
15:18Chouserfyuryu: shh, don't spook him.
15:18rhickeywhat's the purpose of svn-merge if he merges it back into maste at the end?
15:19Chousukerhickey: safety I suppse. if you screw up the merge somehow, you can just throw it away and restart.
15:20Chouserdidn't paste.lisp.org have a link for "context in channel" for each paste?
15:24StartsWithKfyuryu: ok, i'll get back to you on that one when i'll have more code to show
15:25StartsWithKfyuryu: for now, i'm adding commons-cli to parse command line arguments, and i would split cloak execution from args parsing, that will help with testing too
15:26StartsWithKfyuryu: after that repl generation action and generator of completitons files, ivy and ant wrapper (this will take some time, they are large)
15:27StartsWithKwhat else.. scm from maven wrapper and some kind of documentation generation system
15:27StartsWithKi think thats about it
15:28StartsWithKahh.. yes, ant build facade generator, so cloak can be used from netbeans or eclipse
15:28rhickeyChouser: so for a simpler workflow, I'd just create a local branch, work in it, commit etc, then eventually switch to master, rebase, then merge in local branch, then dcommit from master?
15:29Chouserrhickey: yes, I think that would work fine.
15:30Chouserif svn rebase in master pulls in changes, you'd want to rebase or merge those onto your local branch, I think, before merging into master and dcommiting
15:30rhickeythat's where I get confused
15:31ChouserI don't want to sound too confident, because although I don't seem to have too much trouble, I feel like I'm mostly flailing around until I get the merges and logs that I want.
15:31Chouserwell, if you just going to throw away that local branch, it shouldn't matter.
15:32Chouserbut if you're going to keep working in the local branch, you probably want it to have commits in the same order as master
15:33rhickeyI can rebase in the branch?
15:33Chouserif master has commit A, and local branch has A then B, then you merge svn change C into master, then merge local branch into master, master will have something like A C B, while local branch has A B
15:34Chouserif you then rebase local branch, it'll have something like A B C instead. I don't know if that causes any long term problems, but the diff for C from one branch might look different from the diff for C in another. and you might have to merge the same thing a couple different ways. kinda messy.
15:35Chouserso if master has A
15:36Chouserso if master has A C and branch has A B, I'd recommend "svn rebase master my-branch" so that branch has A C B. Then you can merge branch into master and have A C B in both, then dcommit.
15:37rhickeyall the other examples I found didn't bother to make a local branch, which I thought was the git way - always work in local branches
15:37Chousukeit's good practice, but optional
15:38rhickeyChousuke: how else can I fix a bug without putting up my new features?
15:39fyuryuStartsWithK: sounds great :-)
15:40rhickeyChouser: so - create a local branch, work in it, commit etc, then eventually switch to master, rebase, switch to branch, rebase from master, switch back to master, then merge in local branch, then dcommit from master?
15:40Chousukerhickey: I suppose you need a local branch for that :p
15:41Chousukewith a local branch you have complete control of it. after the branch is published, others might depend on changes in it, and you don't have as much freedom.
15:48ChousukeI suppose it's easier to think of in terms of commits. if you have published commits, you may not do anything that would change those commits (other than making a new commit, of course)
15:50fyuryuStartsWithK: I'll be doing the merge during the week; most likely after Tuesday.
15:50Chouserrhickey: yeah, that's about what I do.
15:59StartsWithKfyuryu: i'll try to clean the build.xml and add clojure related actions (maybe ivy wrapper) by then
16:03rhickeyChouser: wow
16:03Chouserrhickey: and of course update bug tracking, related docs, etc. go in there too.
16:04Chouserwell, let's see -- that's what I've done for clojure, but that's mainly because I want to be able to cherry-pick commits so that I can re-create clean diffs against whatever version.
16:05Chouserfor contrib and other projects, I often don't try to maintain a clean master.
16:06ChouserSo in those cases my workflow is more: [stash, rebase, stash pop] every so often, and then [commit, dcommit] when I'm ready. But that doesn't allow for pushing branches around to working copies on other machines (which is not a common use case for me anyway)
16:11Chousernote it's not particularly difficult to switch from one flow to the other mid-stream. It's not uncommon for me to switch from the latter (lighterweight) process to the former when I realize this set of changes needs to be set aside for a while or something.
16:11Chousergotta go.
16:11rhickeyChouser: thanks for your help
16:42bradfordif I want to do something like this: (defn query [table & columns] (str "select " columns " from " table))
16:43bradfordthen what do I need to do with columns in order to get it to stop resulting in this: "select (\"a\" \"b\") from x"
16:59gnuvince_Clojure book just shipped!
17:00danlarkinneato
17:02slashus2So beta 9 is the final?
17:02bradfordthis was the anwser to my question above: (defn query [table & columns] (str "select " (str-join " " columns) " from " table))
18:38gnuvince_If anyone feels like responding to this gentleman: http://uxul.wordpress.com/2009/05/25/clojure-performance-tips-wtf/
18:52danlarkingnuvince_: he's totally right though
18:53gnuvince_I know
18:53gnuvince_I agree that Clojure's compiler should be a lot better
18:53slashus2I just tested Common Lisp for the (+ 1 2 3) thing, and it seems to be about the same as (+ 1 (+ 2 3))
18:53slashus2I was curious.
18:53gnuvince_But I don't know if this person is aware of some of the time constraints put on Rich by people wanting to use Clojure right now for their profesionnal work and by Stuart's book.
18:55duck1123it would be so funny if the only comment to that was rhickey saying simply "patches welcome"
18:56gnuvince_How would that be funny?
18:56danlarkinduck1123: but unproductive
18:58dreishIt would be nice if a symbol could be a macro for some arities and a function for others. That would solve the + problem.
18:58slashus2symbol macros
18:58slashus2?
18:59slashus2Something like constants would be nice for performance too.
19:02danlarkinI think the clojure compiler has a lot of room to get better
19:02slashus2I am sure it will.
19:02danlarkinI think the idea is to rewrite it from java into clojure, and then start hacking on it
19:04slashus2I know that Mr. Hickey stated that the upcoming invoke dynamics stuff won't help much, but would it help with the reflection performance? Does invokedynamic automatically do the reflection stuff?
19:22slashus2Having sum and product in the API would be convenient. I can't find it in contrib, which leads me to writing (reduce + coll) and (reduce * coll). Not too much trouble, but sum and product would lead to less typing.
19:53Chouserthat performance link above is interesting -- it seems like if you actually wanted to influence a project you would say (and hopefully mean) something like "if not for X, I would use it". Instead he says "I don't like it and it's a step in a bad direction. Also they should really fix X"
21:17Drakesonhow do you compare two strings?
21:18Drakeson(> "a" "b") and (string> "a" "b") fail
21:18stuhoodDrakeson: (=str1 str2)
21:18stuhoodoh
21:18Drakesonsorry, I wasn't clear
21:19slashus2,(.compareTo "a" "b")
21:19clojurebot-1
21:19stuhoodthat's interesting. i know you could just use the java method to compare them, but i hope there is a clojure way as well
21:20stuhoodi guess (<) probably isn't overloaded for speed reasons
21:20slashus2It would be neat if > and < were multimethods, but the performance aspects come first.
21:20slashus2or overloaded.. yeah
21:21Drakesoncommon lisp has string> and string<
21:23slashus2Drakeson: there is actually compare without having to do the . and it works with nil
21:23slashus2,(compare "hello" "goodbye")
21:23clojurebot1
21:24Drakesoncool. thanks.
21:27Drakesonunrelated to the previous question, is there an idiomatic way to write (sort #(> ((comp count second) %1) ((comp count second) %2)) things) ?
21:29Drakesonthis might raises too often when you want to sort a collection based on some function applied to each element.
21:30hiredmanyou mean like, sort-by?
21:30hiredman,(doc sort-by)
21:30clojurebot"([keyfn coll] [keyfn comp coll]); Returns a sorted sequence of the items in coll, where the sort order is determined by comparing (keyfn item). If no comparator is supplied, uses compare. comparator must implement java.util.Comparator."
21:31hiredman(all clojure functions implement Comparator btw)
21:32Drakesonoh, sorry for the noise. I didn't expect another function beside sort.
21:32Drakesonand thanks
21:37danlarkinI've got an API/opinion question for whoever cares to weigh in... so for this couchdb library there's all these functions that take a database (string) as the first arg... but I guess there's value in a with-database function or something
21:37danlarkinwhich you could sortof simulate using doto
21:37danlarkinor perhaps a modified version of doto that returns the value of the last form, instead of the database name, in this case
21:38danlarkinbut that would limit the contents of the with-database form to only direct calls that take the db as their first arg
21:38danlarkinno ifs, no lets, etc
21:40danlarkinso that's not as useful...so then I was thinking oh maybe I can macroexpand the forms that are passed to with-database and search them all for functions in the library namespace, and stick in the database string as the first argument in the form?
21:40danlarkinbut that just seems crazy
21:40Chouseryeah, crazy
21:40Chouser:-)
21:41Chousera dynamic var and 'binding' or a 'with-database' that expands to 'binding' seems like a pretty good solution
21:41Chouserthe biggest drawback I've found with APIs like that is when you want to switch between a couple different (in this case) databases.
21:42Chouser...then an arg would be much less verbose than the several with-database calls you'd need.
21:42danlarkinmmmhmm
21:43danlarkinbut there's no way to do both, that I can see
21:44Chouserare all your functions such that you could have an optional first arg?
21:44Chouseror take keyword args on the end? (query foo bar :database db1)
21:45danlarkinunfortunately no, since some functions take an optional last arg
21:45danlarkinmmmmmmmm
21:46stuhoodphp's solution is dumb on the surface: all of the database functions have versions that don't require a db object, and assume that the last db object you created is the one you wanted to use
21:46stuhoodso a global *last-db* var
21:48danlarkinanother option is to have all the functions take a map of args instead of ordered args, and if there's no :database key in the map then use the *database* binding
21:49danlarkinbut that's so ugly
21:53slashus2Maybe you can input all of the databases you will be using at the first, and be able to retrieve them from a map or something?
21:54Chouserwhat's ugly about :database falling back to *database*?
21:56danlarkinwell it'd be ugly to have to pass a map for all the args to all the functions
21:56danlarkinbut I guess as long as I don't have any functions that take varargs I can use :database "foo" on the end...
22:01Chouseror if they can't accept a keyword as their last arg (whether varargs or not)
22:04danlarkinI suppose I could also allow nil to be passed as the first arg, which would use *database*... but at that point is there really even a benefit
22:04Chousereh, yeah.
22:05cadshey, there was a testing framework that allowed randomized testing, called fact. I was looking for examples of fact in use, and in the clojure group post where the author introduces fact, he mentions that for examples looks at the tests for enclojure
22:05cadsbut all of those have been recently rewritten using test-is
22:06cadssince fact and enclojure are written by the same guy, I was wondering if he still intends fact for use, or if the community focus has come to be mostly on test-is and he's decided to go with that himself
22:07danlarkinI liked each function taking all the args because it seemed the most functional
22:13cadsanyone know about randomized testing in test-is?
22:13Chousercads: don't know, sorry.
22:14cadsI think i'll make a fixture using the montecarlo monad :)
22:15cadsand then create random streams to test the properties of my functions
22:27duck1123cads: I think James abandoned fact because he felt it wasn't working out for him
22:28duck1123there's a post about it in the compojure group
22:28cadsI wonder if there aren't a lot of cases where you just have to create the test data by hand
22:29cadsbut I know that haskell's quickcheck works real well
22:29cadsand that it's only like 200 lines of haskell
22:30cadsthough quickcheck might do crazy type-system wizardry
22:30duck1123if i remember correctly, fact worked, but it was too much effort for too little usefulness
22:31duck1123I never gave it a fair try, so I can't really say
22:32cadsI think a combinator library for generating random test data is a good idea, and then you can specify invariants you want your functions to hold over those data
22:37duck1123Yay, my compojure app is now building, testing, and running completely through maven
22:37stuhoodgood stuff
22:38stuhoodi loved how easy clojure was to drop into an existing project that i build with ant
22:38duck1123I wonder how many library projects would be willing to accept patches to move their directory structures around to follow maven conventions
22:38stuhoodaside from the fact that our coverage testing library choked on clojure-generated bytecode
22:39duck1123clojure can get nasty when you have many library dependencies
23:03felzixwhat should I do to evaluate a LazySeq?
23:03duck1123yes
23:03duck1123you should 'do
23:04stuhooduse a function that you would use on any collection, and the sequence will be generated
23:04stuhood*as much as is needed
23:04felzixprintln doesn't seem to be working
23:04felzixsince it's printing that it's a LazySeq instead of the contents
23:05hiredmanfelzix: prn-str
23:05stuhood,(class (range 0 2))
23:05clojurebotclojure.lang.Range
23:05stuhood,(ancestors (range 0 2))
23:05clojurebotnil
23:06stuhoodhm, ignore me
23:07danlarkin,(prn (lazy-seq "foobar"))
23:07clojurebot(\f \o \o \b \a \r)
23:10felzixdoesn't seem to be working
23:11felzixnow it's printing with quotes around it
23:11stuhoodcan you show us the code you are trying to run?
23:12danlarkinprn prints the quotes
23:12danlarkinperhaps you want println
23:13felzixhttp://pastebin.com/d5a0240a8
23:14felzixthe printing is actually for debugging
23:16stuhoodthis isn't related to your problem, but i'd recommend using (apply str (map...)) rather than (reduce str "" (map ...)), since the latter will create a bunch of intermediate strings
23:16felzixah, that makes sense. thanks for the tip
23:19felzixoh, thinking about it, I don't think that code is really sufficient. The problem is that "middle" gets printed as a lazyseq
23:20stuhoodwhat are you passing in as middle?
23:23felzixunfortunately, it's confusing. I think I got ahead of myself and need to test things more thoroughly
23:23felzixthanks, though
23:24stuhoodnp, good luck
23:24felzixthanks
23:28voi noticed that the clojure api has "printf". it appears to return nil. is there a "printf-str" or something built-in that does formatted printing to a string?
23:29slashus2,(format "A string: %s" "yep")
23:29clojurebot"A string: yep"
23:29voooh, i see
23:29vothanks