#clojure logs

2008-10-18

00:02AWizzArdBtw, are there any mechanisms in Clojure to control for weighting the importance of parallelism for specific functions? Or does the jvm mostly care about this automatically?
00:05rottcoddis it considered bad style to compare numbers with = ?
00:05Chouserrottcodd: nope, that's good.
00:05rottcoddso when would I use == ?
00:06ChouserAWizzArd: I don't think Clojure has anything like that, but I wouldn't be shocked if there was something in the Java libs for that.
00:06Chouserrottcodd: oh. well, perhaps I don't know what I'm talking about.
00:09AWizzArdalthough (= 1 1.0)
00:09pjb3= means are the things equal, equivalent, in the Java sense, a.equals(b)
00:09pjb3== means are the references to the same exact object in memory
00:10pjb3so Java ==
00:10pjb3(== "foo" "foo") is false
00:10Chouserif you're working with primitives, you can get unboxed compares with == and not with =
00:10pjb3(= "foo" "foo") is true
00:10AWizzArdI think == will only work for number objects
00:11Chouserif you really want object identity comparison, you should use (identical?)
00:11AWizzArd(== true true) ==> false
00:11Chouserheh
00:11AWizzArdand the documentating explicitly talks about numbers
00:12AWizzArdit just doesn't produce an error
00:12AWizzArdalthough in principle it's a type error
00:12Chouserso back to the original question of = being bad style for numbers, I'd like to revise my answer to: I don't know. :-)
00:13AWizzArdI think = is not bad style, but it is not good style.. maybe an "well, okay"-style
00:13AWizzArd(== a b) tells your reader that a and b are numbers
00:14pjb3I don't know what == is, I assumed it was identical?, but it's not
00:15AWizzArdpjb3: == checks for mathematical identity for any number of number arguments
00:15pjb3java .equals is clojure =, java == is clojure identical?
00:15Chouser== is Numbers.equiv
00:15AWizzArdso CLJs == is CLs = it seems
00:16AWizzArdwhile CLJs = seems to be CLs equal
00:16AWizzArdwhile CLJs identical? is CLs eq
00:16Chouseryes, identical? is Java ==
00:16AWizzArdgenau
00:17Chouserclojure == uses Java ==, but it appears to do other work as well.
00:17Chouser(identical? 5 5.0) -> false but (== 5 5.0) -> true
00:19AWizzArdyes
00:20AWizzArdlike eq in Lisp
00:20AWizzArdChouser: from what language do you come from?
00:22Chouserhm... a few. pascal C++ python ruby javascript and such. nothing exotic.
00:22Chouserno haskell. I've dabbled with CL, Ocaml, Scala, but none of them stuck.
00:23AWizzArdic
00:25AWizzArdbtw, can a function defined via #(...) refer to itself?
00:25Chousernope
00:26ChouserIt could recur though, I suppose.
00:28Chouseryeah, recur works, but there's no name it can use for itself
00:28ChouserI'm off to bed. See you folks later.
00:28AWizzArdI also
00:28AWizzArd6:25 here in Germany
00:28AWizzArdn8 n8
00:31crathmanquestion from an absolute newbie... before I post it, is there a preferred place to put code snippets around here?
00:31asbjxrnpaste.lisp.org
00:32AWizzArdyes: http://paste.lisp.org/new/clojure
00:32lisppaste8Chris Rathman pasted "cond in clojure" at http://paste.lisp.org/display/68729
00:33crathmanok. so what am I missing in trying to use cond? I get a cast error in trying to run the code
00:34crathman(probably to scheme-ish since it comes from sicp)
00:35dudleyfcrathman: Too many parens
00:35rottcoddremove parens around each clause
00:35AWizzArdcrathman: look at the example here: http://blog.thinkrelevance.com/2008/8/26/java-next-3-dispatch-2
00:35AWizzArdheadline "Clojure's cond function"
00:36lisppaste8dudleyf annotated #68729 with "corrected" at http://paste.lisp.org/display/68729#1
00:36AWizzArdcrathman: coming from CL?
00:37crathmannot CL. I know just enuf scheme to be dangerous.
00:37AWizzArd;-)
00:37crathmanhobby project to translate sicp to other languages. been wanting to learn a little more about clojure. so I've combined the two.
00:38AWizzArdthe price you have to pay for saving these parens is that you need to embed a body of code into a (do ...) if you want some side effects in a cond
00:39crathmanthanks for the help all
04:24nullstylehi all, I've got a super noob question...
04:24nullstyleGiven a vector (or any sequence, ideally), can I get clojure to use the values in that sequence as arguments to a function?
04:24nullstyleFor example, how would I get the minimum value in a vector? (min [3 1 2]) return [3 1 2]
04:26tWipwell you could use apply
04:27nullstylesweet, that worked. thanks
06:35meredyddIs there a straightforward way of testing whether a value is an array?
06:36meredyddor is this the best I can do? (defn array? [x] (.. x (getClass) (isArray)))
06:37tWiplooks pretty straightforward to me
06:38tWipjust out of curiosity. why do you need to test for that?
06:39meredyddI'm just worried about the performance hit - there's a general acknowledgement that Reflection Is Slow - dunno how much slower that was than an 'instanceof' check.
06:39meredydd(the penalty won't be as nasty as for method calls, that's for sure
06:39trebor_homewhat does it mean clojure makes them jvm dynamic? jvm = java virtual machine?
06:39tWipyes, but if you call Java, you should know by signatures if something returns an array
06:40meredyddI'm getting a result from an XML-RPC library. XMLRPC arrays come in as arrays, structs as HashMaps, and primitives as their appropriate types.
06:40meredyddXML-RPC is dynamically typed - there's no way of telling what you're getting.
06:41tWipbut if you are doing remote calls, a simple array check isn't going to be your bottlenek
06:42meredyddYou're right, of course. I just didn't want to do it the ugly way if there were a better way.
06:44trebor_homeoh, i was confusing clojure with another lisp, sorry. shoul have been googling before asking.
06:44tWiptrebor_home: really? which one? :)
06:49trebor_homei thought of an macos-lisp ;)
07:12tWipbtw if anyone is using webjure, the latest svn version works with the latest clojure
07:25meredyddHmm. New question: What's the best way to do a rounded/truncated division in Clojure?
07:26meredyddThere appears not to be a (floor) or (ceil), and I can't use the Math.xxx() functions because they don't support Clojure rationals.
07:29Lau_of_DKCan you give an example of your calculation that needs flooring
07:33meredyddLau_of_DK: I want to get from (/ 15 4) to 3.
07:34Lau_of_DKAnd why isnt this good enough?
07:34Lau_of_DKuser=> (Math/floor (/ 15 4))
07:34Lau_of_DK3.0
07:34meredydd1. That gives me a float, not an integer
07:34meredydd2. If I understand correctly, that loses the Clojure nice-friendly-bignum support
07:35Lau_of_DK1. So wrap it in (int ) ? 2. Not sure about it. I've only just Int/Double so far :)
07:35meredydd(which isn't a showstopper in this particular instance - for now, I've been using (.intVal (/ 15 4)) - but gives me a feeling there should be A Better Way)
07:36Lau_of_DKI'll stand back and let some of the olders guys here answer :)
07:40arbschtMath/floor is not necessary if you're going to wrap in int, surely? (int 15/4) => 3
07:42rhickeywhat's the question? 15/4
07:42rhickeyre: 15/4
07:44arbschtachieving floor and ceil behaviour on rationals and returning integers, I think
07:45rhickey(quot 15 4)
07:46rhickey (quot (.numerator x) (.denominator x))
07:48Lau_of_DKIs there something similar to (pop list) for sets ?
07:49rhickeyLau_of_DK: pop is a sequential notion, which item would you 'pop' from a set?
07:49ChouserLau_of_DK: you want to remove a specific one, or just iterate through the set?
07:49Lau_of_DKRight... :) I actually need to drop the last-one inserted
07:49Lau_of_DKBut I just remembered that theyre sorted
07:49rhickeyLau_of_DK: only if it is a sorted set
07:50Lau_of_DKBasically, I need to check if there are 2 hits of a number, so tht (contains? myset 5) only gives me half the story
07:51Lau_of_DKBut this is actually to patch a flaw in my loop that I think I can fix now, so nevermind
07:51Lau_of_DKDumb question :P
08:17dmilesthe sorted set exists so i can pop items off the set knowing i am am going to pop in a sorted order?
08:17dmilesthis way i can know if my last item was greater then any of my current members.. i can stop pooping since the search is done?
08:18dmilesoops.. popping
08:18Lau_of_DKlol :)
08:18Lau_of_DKIm glad Im not the only one who can make a "mess" of things, haha! :)
08:19dmilesan unsorted set retains order in which the items are pushed?.. is a hash set any faster then a set that is sorted and se4arch in 1/2ing manner?
08:20dmilesi guess what i believe a hashset is useless when you already have sorted sets
08:21dmilessince a sorted set is always faster than a hashset i think
08:21rhickeydmiles: you don't usually search a set linearly, since the point of sets is to support better-than-linear search
08:21rhickeysorted sets have a defined iteration order, hashed sets do not
08:22dmilesthe divide by two search of a sorted set is fast as a hashed set right?
08:22Chouserbut if you wanted all the items in a group that are less than x, a sorted-set would do quite nicely.
08:22rhickeysee subseq and rsubseq as well
08:23Chouserhm, I guess filter would do even better in many cases.
08:23dmilesi guess what i am wodering what the use of an unsorted set
08:23rhickeyChouser: no, if sorted subseq is better than filter
08:24rhickeydmiles: unsorted (hash) set should be faster, also doesn't require comparable elements
08:24dmilesrhickey, ah right the type of elements that really cant be sorted
08:25rhickeythat's why the hashed variants are the defaults
08:28Lau_of_DKI optimised my decimal expansion routine to use sets instead of a list that concattet results on with a helper function fdigit. This improved performance by 430%
08:29Chouser(.bar x) does different things depending on whether (class x) has a function bar or a field bar, right?
08:29rhickeyChouser: yes
08:30dmilesprefering the method ? (C# would have inspired the callling of a getter method)
08:31Chouserand that is resolved at compile or runtime, just like other host-calling resolution (based on type hints)?
08:33Chousercljs has been assuming they're always fields unless parameters are given. Incorrect.
08:35lisppaste8Lau_of_DK pasted "Decimal expansion (faster)" at http://paste.lisp.org/display/68737
08:35dmiles((.bar x-the-class) x-the-instance) ?
08:35Lau_of_DKI know that result would probably be better suited as a vector. But besides from this, if somebody has a fantastic insigt in how to could be refactored I'd love to hear it
08:36AWizzArd'lo
08:36rhickeydmiles: yes, favors method
08:37lisppaste8Lau_of_DK pasted "Decimal expansion (faster)" at http://paste.lisp.org/display/68739
08:41rhickeyChouser: It's resolved to a method at compile time if I can find one, if I can't but can find field. resolves to that (note this may miss a method of the runtime type), else reflection preferring method
08:42dmilesgetMethods()/getFields()/getDeclaredMethods()/getDeclaredFields() order?
08:45AWizzArdrhickey: does the use of apply make a function call less efficient? So (apply foo arg1 arg2 10 20 more) vs (foo arg1 arg2 10 20 arg3 ... argn)? This could matter if we map over gigabytes of data and need to call apply millions of times vs calling the function with its fixey number of args directly.
08:52AWizzArdI just see that "more" needs to be unpacked... the other (- n 4) args
08:55rhickeydmiles: it's not that simple, as Clojure doesn't know the actual type of the target
08:57rhickeyAWizzArd: there's some overhead to apply, but your calls above are not right, it's (foo x y z) or (apply foo some-collection-of-args)
08:58rhickeyin the apply case, it might be more efficient to use apply if your args are already in seqs, for instance, rather than have to unpack the collection in order to make a fixed-arg call (it's likely you code to do so will be similar to what apply does already)
08:58AWizzArdah okay, I thought of apply as CLs apply where the arguments don't have to be sequences and can be atoms instead
09:00AWizzArdnevermind, it works like CLs
09:40AWizzArdrhickey_: Rich, do you already have plans for "recur" when tail call optimization hits the vm? When it does recur is in principle not longer needed, is it? But removing it would break existing code...
09:41Lau_of_DKIts really amazing how slow lists are in Clojure. 500 fractions expanded took 75 secs with 2 lists, took 17 secs with 1 set and 1 list, and took 2 secs with 1 set and 1 vector, I get that to be 3500% improvement
09:41rhickey_Lau_of_DK: lists aren't slow, it's how you use them
09:41Lau_of_DKthanks :)
09:42rhickey_linear lookups are slow
09:42Lau_of_DKI had 1 really bad lookup, but other than that I was just using concat
09:42Lau_of_DKand yea, I removed a linear lookup
09:42Lau_of_DKBut lists are supposed to perform like sets and vectors ?
09:42rhickey_same thing - its about picking the right tool for the job
09:43Lau_of_DKokay, good to know :) Thanks
09:44rhickey_lists and sets and vectors all have very different performance characteristics for different operations
09:46lisppaste8Lau_of_DK annotated #68739 with "anyone faster?" at http://paste.lisp.org/display/68739#1
09:52Lau_of_DKrhickey_, have you written some material on these differences?
09:54AWizzArda faq on this could be nice, but in general wikipedia offers some basic insight
09:55rhickey_Lau_of_DK: it's not specific to Clojure - see any CS book on data structures, or: http://en.wikipedia.org/wiki/Data_structure
09:55Lau_of_DKOkay, thanks to both of you, I'll have a look
09:56AWizzArdmaybe one day the jvm will host an AI system which will substitute your used datatype with something that is most appropriate :-)
10:00AWizzArdrhickey_: Rich, do you already have plans for "recur" when tail call optimization hits the vm? When it does recur is in principle not longer needed, is it? But removing it would break existing code...
10:01rhickey_recur will remain, and has utility. It can be simpler and clearer than a nested fn, and will have tail-position checks where ordinary recursive calls cannot. Many people actually like it for those reasons.
10:02lisppaste8hoeck annotated #68739 with "lazy decimal expansion" at http://paste.lisp.org/display/68739#2
10:04Lau_of_DKuuuuh thats trixy Hoeck - Thanks alot!
10:04AWizzArdwhat I like about recur is that it allows me to recurse over anon functions (without having the y-combinator at my hands)
10:05Chouserwhere "many people" == "Chouser" ?
10:05hoeckLau_of_DK: you know, i guessed your problem wrong the first time, and then stepped in some kind of turingtarpit and couldn't resist
10:05Lau_of_DKhaha
10:05Lau_of_DKDont I know that feeling :)
10:05hoeck: )
10:06Lau_of_DKHave you benchmarked it in comparison with my func ?
10:08hoeckyes, yours was about 8s, mine about 2s
10:08Chouserabout 4 times the speed here.
10:08Chouserooh, consistant. :-)
10:08hoeckhaha
10:08Lau_of_DKnice... I'll return later with questions as soon as the jealousy dies down
10:08Lau_of_DK(kidding)
10:15AWizzArdlength of a sequence: (reduce (fn [x y] (+ x 1)) 0 [10 20 30 40]) ==> 4. Good, works. Why does (reduce #(+ %1 1) 0 [10 20 30 40]) produce an error: Wrong number of args passed to: eval--2465$fn
10:17Chouserreduce passes in two args, but the highest number of % in your #() is 1, so that little function only takes one arg
10:17AWizzArdright
10:23nvteighenHi
10:23Chouserhi
10:24nvteighenI'm a Scheme guy, but got interested on Clojure
10:24AWizzArdexcellent choice nvteighen
10:24nvteighenWhich one?
10:24ChouserFunny, you'll probably find lots of people who like Clojure in the #clojure channel. :-)
10:24AWizzArdto be interested in Clojure
10:25Chouserand several who've come from scheme, for what it's worth.
10:25nvteighenWell, that was what I wanted to ask here...
10:25AWizzArdwould it make sense to make reduce lazy? (take 5 (reduce + (cycle [1 2 3 4 5]))) currently doesn't terminate
10:26nvteighenI got the impression Clojure shares a bit the Scheme philosophy... The Lisp-1 idea is very attractive
10:26ChouserAWizzArd: reduce is going to return a single value. take doesn't make sense there.
10:27AWizzArdright
10:28Chouserso no, it wouldn't make sense for reduce to be lazy.
10:29AWizzArdstupid me, I got a Haskell guy tricking me into thinking that foldr is lazy and works on infinit sets
10:30rhickey_AWizzArd: laziness in Haskell is completely different
10:30AWizzArdwithout further thinking I expected this to be true, but now I wonder what (reduce + natural-numbers) should yield
10:32rhickey_AWizzArd: a very warm computer
10:32AWizzArd*g*
10:33nvteighenDoes Clojure support something like Scheme streams? That would ease it...
10:33rhickey_but folds over infinite lists yielding infinite lists can be done easily with the lazy seq functions
10:34rhickey_nvteighen: that is the normal way Clojure seq functions work - no separate streams lib needed
10:34AWizzArdrhickey_ do you have a small example?
10:34nvteighenOh, great!
10:34rhickey_user=> (take 15 (cycle [1 2 3 4]))
10:34rhickey_(1 2 3 4 1 2 3 4 1 2 3 4 1 2 3)
10:34AWizzArdyes ok
10:43AWizzArdChouser: maybe an example like this, for adding the 30 first numbers of an infinite sequence: (reduce (fn [x y] (if (> x 30) 0 (+ x y))) (cycle [1 2 3 4 5]))
10:43AWizzArdI know that one can express it in a way that makes much more sense
10:44AWizzArd(apply + (take 30 (natural-numbers)))
10:47AWizzArdwell, it doesn't matter too much
10:53ChouserAWizzArd: sorry, what are you asking?
10:56AWizzArdwhat I gave was an artificial example on how lazyness could work... but that would be more the Haskell way, and there lazyness is different, as Rich already said
11:36AWizzArdWhere in the source (path) is the reader macro #(...) implemented
11:36AWizzArd?
11:38ChouserLispReader.java line 531
11:39AWizzArdthx
12:11rhickey_yay - cgrand is back blogging about Clojure!: http://clj-me.blogspot.com/2008/10/clojure-golf-combinations.html
12:20Chouser*sigh* he cut my "combinations" in half. I spent an hour on mine.
12:21Chouserrhickey_: so is genclass going away soon enough that you don't want minor patches to it?
12:22rhickey_Chouser: it's pretty, isn't it?
12:23ChouserI'm still pondering it. Lisp is amazing in its density.
12:23rhickey_Chouser: I'd rather everyone interested in genclass think about this - every ns is going to become a class def - with metadata we can annotate the .clj in plac eto designate fns as methods etc - what should those annotations be to cover the genclass use cases?
12:25ChouserI'm not very deep into genclass, but I did have a (load) use case I was curious about -- will that ability be going away?
12:31rhickey_gotta run
12:33Chouseryeah, wow. I simply couldn't have come up with cgrand's "combinations".
12:33Chouserrhickey_: ok, see ya
12:38AWizzArdWhat are genclasses in short?
12:44Chousercgrand: your "combinations" humbles me.
12:44AWizzArdI am also playing with it right now :-)
12:45ChouserAWizzArd: genclass creates a new named Java class with constructors and methods implemented to call Clojure fns.
12:46AWizzArdso genclass is only interesting to people who plan to switch the language or make their lib available to non-Clojure hackers, yes?
13:01Chouserprimarily the latter, though there are some other places where you need a .class file or need to implement a method that's not defined in any interface.
13:02Chouserto make a servlet, for example, you need an actual .class file.
13:02AWizzArdi see
14:02Lau_of_DKcould somebody bring me up to speed on this parallel computing that people are talking about, and how it ties into clojure?
14:02AWizzArdWhat do you mean?
14:03Lau_of_DKI mean, cgrande talked about parallelizing primes, and clojure has a parallel.clj if I remember correctly, and I dont really know what either of them is
14:11AWizzArdIn Clojure there are no side effects. That means in principle it can run most functions calls on any available cpu/core.
14:15AWizzArdSo it means: if you write your programs in Clojure it is likely that a lot of your code will run in parallel on several cpus. This comes in handy, especially because intel said that in a few years 100 cores per cpu will be typical.
14:17Lau_of_DKso paralellism is the tool to make sure that everything starts and finishes like it should?
14:18AWizzArdIf functions run in parallel they run at the same time. Just think about people.. they all can think independently and do things at the same time. While I am breathing you can do the same.
14:19arbschtis it really reasonable to say, "clojure has no side effects"? I prefer to say, "clojure has immutable state"
14:22AWizzArdyes, I like this also more
14:25AWizzArdLau_of_DK: and the advantage of all that is that your programs will run faster in many situations. Of course it depends on what you are doing
14:25Lau_of_DKyea, I mean, its basically multi-threading isnt it ?
14:26AWizzArdyup
14:26AWizzArdconcurrency, parallelism, multi-threading, etc
14:26AWizzArdif you are writing data to a file it makes no sense if 50 threads want to write at the same time, because you usually want to keep it in order (the stuff you write to the file). So, when you are doing side effects often you will not win from multi-threading.
14:27Lau_of_DKThats true
14:27AWizzArdBut if you are doing Genetic Programming and have thousands of programs for which you want to find out their fitness it makes totally sense
14:27AWizzArdfor some tasks doubling the number of cpus will double the efficiency of your Clojure program
14:28Lau_of_DKMaybe I should be a new computer and experiment :)
14:28AWizzArdnow the really fine thing is: you don't need to work very hard to get Clojure running your code on all these cpus
14:28AWizzArddon't worry Lau.. you will soon enough have access to tens of cores. A 70$ processor will have tons of them
14:29Lau_of_DKYou mean because the dollar is dropping so hard? :)
14:30AWizzArdsince about 100 years the number of calculations per timeunit in a cpu grows hyperexponentially
14:31AWizzArdat the moment you can give the conservative estimation that the calculation power that you can buy for 1000$ doubles every 12 months (says Ray Kurzweil)
14:31Lau_of_DKThe rule used to be every 18 months right?
14:31AWizzArdno, that is moores law
14:31Lau_of_DKoh ok
14:32AWizzArdthat talks about the amount of transistors
14:32AWizzArdwhile Kurzweil discusses the price performance
14:32AWizzArdbut this is really very conservative
14:32AWizzArdhe says: every 10 years you have 1000x as much computational power
14:33Lau_of_DKIts beyond my imagination what all that horsepower will be used for
14:33Lau_of_DKI know that the UN has had a supercomputer for years now, that sinked in liquid coolant (hydrogen I think), and I cant imagine what they might need that type of processingpower for
14:33AWizzArdbut just take a look at http://en.wikipedia.org/wiki/FLOPS and see: 1997 one gigaflops cost 30.000$. In October 2007 the price was less than 50 cents per gigaflops. That means the priceperformance changed by a factor of 60.000, not 1000
14:34AWizzArdaround 2012 the fastest super computer will reach +/- the calculation power of a human brain. In 2023 a desktop cpu for 1000$ could do the same.
14:35Lau_of_DKCrazy - Thanks alot for all the info - Now we better get back to the topic: Clojure! :)
14:36AWizzArdKurzweil continues calculating with his conservative interpolation and finds: in 2037 one can buy human brain capability for around one cent. In 2049 we have human race capability for around 1000$ and in 2059 a cpu which calculates as fast as all brains of all humans on this planet would cost around 1 cent.
14:51Lau_of_DKI've seen an example of firing up a Jetty webserver with dynamic content. Not knowing anything about Jetty, how difficult would it be to enable such a server to run PHP ?
14:51AWizzArdDepends on how good you are.
14:52AWizzArdPHP is turing complete... Someone like Data could probably write something like Linux in it within a few seconds ;-)
14:53Lau_of_DKSure, but he'd get all pale in the process
14:53Lau_of_DKIs it a huge task, or is it a matter of stuffing Jetty with modules ?
14:55walters_there is an implementation of PHP for the JVM, but really it's an awful language. Something like Groovy or JRuby is going to be a lot nicer. Or even Clojure
14:57Lau_of_DKok :)
14:57AWizzArdWhy Groovy or Ruby when you can have Clojure? :-)
14:57Lau_of_DKI never really developed even half an appreciation of either Groovy or Ruby
14:57mmcgranaclojure has the advantage of being designed from the start to interoperate cleanly with the jvm, whereas e.g. in jruby java interop is still a big pain
14:58AWizzArdeven if they were made with the jvm in mind (okay, this is true for Groovy), you still have the problem of finding out how to do multi-threading
14:59mmcgranayou mean how to get good concurrency semantics or how to just implement threading?
15:00AWizzArd1st
15:00AWizzArdgetting threading itself should be cheap when the jvm already offers it
15:01mmcgranaright ruby's pervasive statefullness is brutal, even the class/module model gets mutated all over the place so you can't reason about that
15:01AWizzArdmaybe with Groovy it is better, but Groovy is still an imperative language in the first place
15:02AWizzArdin Clojure parallelization is trivial and mostly automatic
15:02AWizzArdI mean, in principle whenever we see a function call that guy could run on its own core.
15:03Lau_of_DKAre there any larger project under development atm, in clojure ?
15:03AWizzArdThe biggest is probably Clojure itself
15:04AWizzArdAs soon I have time I will implement my Genetic Programming system in Clojure. Currently I have it in Lisp, so most of my code already is nearly there. But that is nothing really big.
15:04mmcgranaall clojure programmers need to read boot.clj - pretty awsome; otherwise there is alt-law which is pretty big (http://github.com/lawcommons/altlaw-backend/tree/master)
15:05mmcgranai also suspect that there are several super-stealth startups that don't even wan't people to know that they are using clojure. I do wish that there were more open source clojure projects.
15:05mmcgranaThat first bit I didn't pull out of a hat, Rich at one point mentioned clojure users that he couldn't talk about.
15:06AWizzArdmmcgrana: yes, it is very good, and today I started reading it (only found Clojure on Thursday night)
15:06Lau_of_DKThanks mmcgrana
15:06walters_interesting, a combination java/ruby/clojure project
15:06mmcgranayeah very polygot
15:09Lau_of_DKDoes anybody have some Clojure thoughts on this: http://projecteuler.net/index.php?section=problems&id=28
15:12mmcgranahaven't done it, though you might try generating a lazy seq of the x,y cords of the successive number locations, the use range for the sequence of numbers, then reduce pairs of these against an initial empty vector of vecotrs for the board
15:12mmcgranai haven't considered the posibility of a non-computational solution, though i tend not to when using these problems as programming practice
15:16Lau_of_DKI try to keep both in mind, though Im not quite sure I follow your approach
15:17mmcgranawell you actually just need to keep track of the values that fall on the diagonals. the idea is to generate the sequence of x,y coordinates on the board, then associating each successive one with a correspondingly incremented integer. when such an x,y is on a diagonal, record it and continue. you could use loop instead of reduce prop. i'll try it myself too...
15:18Lau_of_DKk, cool, Eulers are fun
15:18achim_p_Lau_of_DK: if you don't want to brute force, you might consider asking sloane
15:18Lau_of_DKand as an added bonus in Clojure, theyre both fun and frustrating :)
15:19Lau_of_DKachim_p_, sloanes our strategist ?
15:19achim_p_http://www.research.att.com/~njas/sequences
15:19achim_p_http://www.research.att.com/~njas/sequences/?q=1%2C3%2C13%2C31&language=english&go=Search
15:20AWizzArdHas Rich said anything about the general efficiency hit that Clojure takes, compared to pure Java programs?
15:20mmcgranalol nice
15:20Lau_of_DKachim_p_, thats a pretty sick site
15:23achim_p_exactly what you need for project euler - did i mention that i hate number theory? ;)
15:24Lau_of_DKno you didnt
15:24Lau_of_DKI think its fun
15:24Lau_of_DKThat page qualifies as cheating though, 80% of the fun is finding the right approach :)
15:25AWizzArdwould it make sense if (seq 'abc) ==> "abc" or (\a \b \c) ?
15:27arbschtwhat's your justification for either of those?
15:27Lau_of_DK(\a \b \c) would make the most sense
15:27AWizzArdone could see that a symbol is a sequence of characters
15:28AWizzArdas a string is also not atomic, but a container
15:29arbschtI'd say a symbol's name is a sequence of characters
15:29ChouserA symbol suggests more meaning than just its list of chars, though you can (str 'abc)
15:29arbschtwhat would (seq 'my/foo) return?
15:29Chouserarbscht: right! (name 'abc) -> "abc"
15:30Chouser(seq (name 'abc)) -> (\a \b \c)
15:30AWizzArdit could be either the same as (seq (name 'my/foo)) or (seq "my/foo")
15:31ChouserI can't say I've ever wanted the sequence of chars that make up the name of a symbol.
15:34arbschtAWizzArd: for the latter case, there is (str 'my/foo). for the former, there is exactly what you wrote, seq of the name
15:34arbschtfor the latter, seq of (str ..), I mean
15:36arbschtI think it would be confusing to have seq prefer one of the two
15:41Lau_of_DKWhere did Rich hide (pow x n) ?
15:41arbschtMath/pow
15:41Lau_of_DKeww
15:41Lau_of_DKthanks
15:43mmcgranamath.clj: http://groups.google.com/group/clojure/browse_frm/thread/d07b93e26b2f0f06
15:43Lau_of_DKWhat is the syntax if I want to do something like (mapcat #(Math/pow % %) (range 5) (range 5)) ?
15:44mmcgranawhy 2 ranges if they are the same?
15:44Lau_of_DKbecause they wont be the same in the actual program
15:44mmcgrananote 2-arg fns need e.g. %1 and %2
15:45Lau_of_DKthis works: (take-while #(<= (* % %) n) primes)
15:45AWizzArdLau_of_DK: maybe you want (map #(Math/pow %1 %2) (range 5) (range 5)) ?
15:46Lau_of_DKAWizzArd, works, thanks. I thought map and mapcat operated more along the same lines
15:46AWizzArdnearly
15:47AWizzArdtry (map #(list %) (range 0 5)) and then mapcat
15:48AWizzArdyou can think of mapcat having a "flattening effect". Look at the boot.clj to see how mapcat is implemented
15:49AWizzArdmapcat runs map and then runs concat on maps result
15:50Lau_of_DKI guess I really should reat that boot.clj
15:56meredyddHeya - Compojure question
15:57meredyddThere's what looks like a tiny bit of glue code between Jetty's cometd and Compojure
15:57meredyddbut I'm having trouble figuring out how it all works.
15:57meredyddDoes anyone have any pointers and/or examples?
16:02AWizzArdAnyone here running emacs and http://clojure.codestuffs.com/ ?
16:04Lau_of_DKYes sir
16:06Lau_of_DKFor those of you who have solved Euler 29, compare the 1.st C solution in the forum, to this
16:06Lau_of_DK(defn euler-29
16:06Lau_of_DK [min max]
16:06Lau_of_DK (count
16:06Lau_of_DK (apply sorted-set
16:06Lau_of_DK (for [x (range min (inc max)) y (range min (inc max))]
16:06Lau_of_DK (Math/pow x y)))))
16:11Lau_of_DK...and eh... then be impressed
16:12mmcgranaheh nice
16:19arbschtis it necessary to sort it? would distinct not suffice?
16:19Lau_of_DKit sure would
16:27Lau_of_DKHas anyone found some clever uses for (partition )
16:31duck1123is let what I should be using for local variables inside a fn?
16:31Lau_of_DKyes, probably
16:31duck1123or is there a better choice?
16:31Hunthat depends
16:31duck1123def just does globals, right?
16:32Hunin most lisps you usually want let
16:32Hunotherwise you'll know
16:33Lau_of_DKlet wont let you down
16:33Hunoh noes. here comes the let-roll
16:33duck1123thanks. I'm prompting the user for values, and I was a little worried about how many lets I might need
16:34Lau_of_DKcant you just pass them directly?
16:34Lau_of_DKlike
16:34Lau_of_DK(defn prompt-for-cd []
16:34Lau_of_DK (struct
16:34Lau_of_DK cd
16:34Lau_of_DK (prompt-read "Title")
16:34Lau_of_DK (prompt-read "Artist")
16:34Lau_of_DK (parse-integer (prompt-read "Rating"))
16:34Lau_of_DK (y-or-n-p "Ripped [y/n]")))
16:35duck1123hmm... good idea
16:36duck1123I'm just today really getting started using clojure for more than (+ 1 1)
16:36Lau_of_DKcoming from what ?
16:36duck1123Java, but more recently Ruby
16:36Huncoming from CL it feels a bit weird, but i kind of like it
16:37Lau_of_DKAh sweet, well enjoy the ride, to me Clojure felt extremely up-hill in the beginning, I couldnt wrap my skull around functional programming, but you reach a point where the learning curve is pretty satisfying
16:37duck1123my lisp experience is from configuring emacs and stumpwm
16:38Lau_of_DKand to be frank, nowadays I cant really sit down with anyother language than clojure anymore
16:38HunLau_of_DK: i have the complete opposite problem. i still don't know how to use the java documentation properly...
16:39Lau_of_DKoh.. well that shouldnt take you very long to dive into
16:40duck1123can a slurped file be used as an InputStream?
16:40Huncoming from CL, i definitely miss apropos. you can do a (apropos "something") and it gives you anything containing something
16:41Lau_of_DKYea we dont quite have that feature yet I think
16:41duck1123Hun: what about (find-doc)
16:41Lau_of_DKBut my main complaint (except the debugger) is actually documentation
16:41Lau_of_DKLike with C# you can basically sit a complete beginner down in Visual Studio and between the help and Intellisense, he'll pick up all he needs while working
16:41Lau_of_DKIn clojure however, I come to a complete stop everytime Im lacking some detail
16:42Huni don't have clojure handy right now (i'm on my big pc), so i can't answer now. i'll look at it on monday
16:43duck1123as much as I hate them sometimes, I wish the clojure api page used frames like (ruby|java)doc
16:43HunLau_of_DK: i get turned into a complete moron sitting on (VS, eclipse, xcode, ...). i try that about once a year, but i always get baffled by the UI and crawl back to my good old emacs
16:44Lau_of_DKYoure the 2.nd person Ive heard say that. Its very weird because VS is made intuitively easy I think
16:44Huni kind of integrated javadoc-mode, so i at least have an apropos for classpath
16:44duck1123javadoc-mode you say?
16:44duck1123where can I find that?
16:45Hunthat's an emacs-mode for searching through javadoc
16:45Hunhmm... must have memorized the wrong name
16:45Hunone moment
16:48Hunhttp://sourceforge.net/project/showfiles.php?group_id=219831&amp;package_id=265324
16:48Huni think this was it. not sure though
16:53HunLau_of_DK: maybe that's caused by me having used emacs a few years before my first contact with `proper' IDEs (with qbasic and comal in the 90s)
16:54Lau_of_DKIt could be that, sure :) I'm also thinking genetics maybe
16:54Huni also like the lispy/smalltalky way of doing things on live programs. just about all of the mainstream langs and IDEs force you in the hack/compile/test/debug-circle
16:56Hunespecially trying to find out why a crashed program has crashed is evil there. in image-based systems you'll get thrown in the debugger right where it crashed and can examine everything. everywhere else your world dies and you got to reconstruct it
16:56duck1123I used VS and Eclipse forever until I "discovered" emacs
16:56duck1123haven't looked back since
16:57duck1123Hun: does the mode you use open a browser, or does it display it in a buffer?
16:57Hunboth
16:57Hunit opens in a browser which (in my config) runs inside a buffer
16:57Hunhail w3m
17:01duck1123ok, this is pretty nice, thanks
17:13duck1123Lau_of_DK: was (prompt-read) something you just made up, or is that a function somewhere? (not in core api)
17:13Lau_of_DKduck1123, http://blog.thinkrelevance.com/2008/9/16/pcl-clojure-chapter-3
17:14Lau_of_DKreading this, http://projecteuler.net/index.php?section=problems&amp;id=31, Im thinking there must be some features in clojure to solve this, any clues?
17:15mmcgranaDK did you get 28 already?
17:15Lau_of_DKNo I skipped it, I think 31 is more interesting
17:16mmcgranai'm thinking "dynamic programming" but i could just be imagining things - does that make sense?
17:17Lau_of_DKno not really :)
17:17Lau_of_DKI was thinking rotations, permutations and combinations
17:17Lau_of_DKdoes that make sense?
17:17mmcgranamaybe, i'm not sure about either one
17:20Lau_of_DKmmcgrana, we should start by making a collaboratory clojure/euler tool
17:21mmcgranaLau_of_DK: nice. I should probably do my actual math homework first though...
17:21duck1123did you notice that each diagonal increases by 2 each time?
17:21duck1123I wonder if that pattern holds
17:22mmcgranayeah sort of its like +2 +2 +2 +2 +4 +4 +4 +4 +6 +6 +6 +6 + ... i think
17:22Lau_of_DKduck1123, the diagonal is a little too easy, check out achim_p's link from before, it has a fomulae to compute all the numbers in the diagonal
17:23duck1123must've been before i entered the room
17:24Lau_of_DK<achim_p_> http://www.research.att.com/~njas/sequences
17:24Lau_of_DK<achim_p_> http://www.research.att.com/~njas/sequences/?q=1%2C3%2C13%2C31&amp;language=english&amp;go=Search
17:45Lau_of_DKrhickey, isnt this taking rounding a little too far? :)
17:45Lau_of_DKuser=> (/ 49 98)
17:45Lau_of_DK1/2
17:48arbschtLau_of_DK: what would you expect instead?
17:48Lau_of_DKim not that strong in non-trivial fractions
17:48Lau_of_DKI just saw this
17:49Lau_of_DK"The fraction 49/98 is a curious fraction, as an inexperienced mathematician in attempting to simplify it may incorrectly believe that 49/98 = 4/8"
17:49Lau_of_DKhttp://projecteuler.net/index.php?section=problems&amp;id=33
17:51bitbckt", which is correct, is obtained by cancelling the 9s."
17:51bitbcktthat part is really quite important
17:51arbschtthat 49/98 = 4/8 is not an incorrect belief. that it is obtained by cancelling digits is incorrect
17:51arbschtyes
17:51Lau_of_DKoh that way round
17:51Lau_of_DKyea I get it, thanks
17:53blackdogmeredydd: i have some jetty/comet clojure code if you're interested?
17:54meredyddblackdog: I'm all ears
17:54achim_p_http://clojure-euler.wikispaces.com/ - from my very early clojure days. i quickly lost interest, but the wiki is open, so if anybody would like to contribute some (alternative) solutions, please do.
17:55blackdogok, hang on
17:55Lau_of_DKachim_p_, and you said you hated number theory :P
17:56achim_p_yeah, i just did some easy ones
17:57lisppaste8blackdog pasted "cometd" at http://paste.lisp.org/display/68775
17:58blackdogmeredydd: there's some bit's and pieces in there too from the jetty example in java, like echo
18:37Lau_of_DKThere's a good chance that I've hit the point where I should just go to bed, but can you give think of a simpler/quicker way to do this
18:37Lau_of_DK(defn pandigital?
18:37Lau_of_DK [n]
18:37Lau_of_DK (= (apply sorted-set (map #(Integer. (str %)) (str n)))
18:37Lau_of_DK (apply sorted-set (map #(Integer. %) (range 1 (inc (count (str n))))))))
19:12rottcoddis there any convention to indicate that a map is intended to be an abstract type?
19:21AWizzArdAnyone here uses Clojure under Windows (Vista) in Emacs? I am having some problems there as it seems, no syntax highlightning in clojure-mode and some java exceptions after M-x run-clojure.
19:23AWizzArdIf you think you know emacs and slime quite good please have a look at my .emacs and the output that I get:
19:23lisppaste8AWizzArd pasted "Problems with getting Clojure running in clojure-mode in Emacs" at http://paste.lisp.org/display/68784
20:41achim_pAWizzArd: swank-clojure targets the svn version, not the latest release. *1, *2, *3, *e (which are causing your error) were added afterwards
20:42AWizzArdI see.. but to use the svn version of Clojure I would need something like this Maven thing yes?
20:43achim_pno, just ant
20:43AWizzArdI just found Clojure two days ago and had no time to work on my unix box and need to do all that stuff here under Windows
20:43AWizzArdhow can I use ant? Sorry, never worked with Java :-)
20:44AWizzArdi have three directories from the svn: branches, tags, trunk
20:44achim_phave you got ant? then typing "ant" will do in the trunk dir
20:44AWizzArddo I need to cd into one of them?
20:44achim_pyes, trunk
20:44AWizzArdah okay, let me see if ant is available for Vista
20:44AWizzArdklingt gut :-)
20:47achim_p:)
21:41_emjayStarting from scratch, which books would you guys recommend as a path to Clojure enlightenment?
21:43duck1123do you know lisp?
21:44_emjayduck1123: A little. This is for someone else that only knows Java. I'm having a hard time trying to figure out a track for him.
21:44duck1123I would start with the video series
21:45_emjayI'd recommend PCL, but there's a lot of non-relevant stuff in there. The decisions to remove or rename things from Common Lisp make it hard to recommend lisp material.
21:45AWizzArdthe book about Clojure will be out in March 2009 I think
21:45duck1123I was going to say PCL, there's a collection of posts that have translated the code into clojure
21:46AWizzArdPCL might be the best choice until then...
21:46_emjayYeah, that's like 5 internet years! I'm hoping for a quick beta release.
21:46duck1123I think I'm going to have to buy that book
21:46AWizzArdduck1123: which one? PCL or the Clojure book?
21:47AWizzArdthe CLJ book would be this one: http://www.pragprog.com/titles/shcloj/programming-clojure
21:47_emjayPCL is available for free online.
21:48duck1123I was just at the book store today. I almost bought PCL in hardcopy, but my wife would kill me if I spent $50 right now
21:48_emjayFrom the author of Programming Clojure: "We'll go beta with five chapters before the end of the year."
21:50AWizzArdit's 50$ well spent
21:50AWizzArdWhy are it always our wifes who are the real bosses of our lifes? ;-)
21:51_emjayAWizzArd: Order from Amazon and have it shipped to your work. :)
21:51AWizzArd_emjay: I already have it.. so duck1123 should be doing exactly this *g*
21:52duck1123open up a secret banking account... for computer books
21:52AWizzArdr0ckz
21:53_emjayI usually hate buying programming books because they date so quickly, but CL is pretty old now and doesn't look to be changing any time soon, so PCL seems like a good investment.
21:55AWizzArdAll in all Lisp is Lisp, so the dialect does not matter too much. The language itself is not overly important, but to understand the concepts. Going from C to Pascal is not too hard. Form C++ to Java or C# dito.
21:56duck1123I was reading it online, but it would be nice to have a real copy to read away from the computer
21:56AWizzArdClojure is more similar to CL than it is different, so, PCL is not the worst choice to learn CLJ.
21:56AWizzArdduck1123: Be a man, buy that book. For centuries didn't tell their husbands what books to buy or not.
21:58AWizzArdFor centuries wifes didn't ...
22:02AWizzArdachim_p: thanks for your tip, indeed emacs+slime+clojure do now work, with the svn version of CLJ
22:04duck1123you might also want to get the git versions of slime, clojure-mode, and swank-clojure
22:04duck1123cutting edge all the way
22:05duck1123has anyone written a good primality test in clojure? I want to compare it with my attempt
22:05AWizzArdduck1123: I got this clojure-mode and swank-clojure stuff from http://clojure.codestuffs.com/ .. do you mean that?
22:06duck1123yeah, it looks like they point to the github versions
22:07AWizzArdduck1123: have you written a prime-tester in Java itself? Can you compare how much slower Clojure runs?
22:08duck1123i found one online
22:08duck1123i can tell you that it is running pretty fast
22:08duck1123know of a good big prime I can test?
22:09AWizzArd6561557
22:12duck1123"Elapsed time: 22.494683 msecs"
22:12AWizzArdand is it a prime?
22:12duck1123yes
22:13AWizzArdhow fast is 43054017141137?
22:14lisppaste8duck1123 pasted "My first attempt at a primality tester" at http://paste.lisp.org/display/68789
22:14duck1123false "Elapsed time: 37.01863 msecs"
22:14duck1123you sure that's prime?
22:16AWizzArdI am not sure
22:19duck1123devisible by 101
22:19duck1123divisible even
22:21duck1123user=> (time (prime? 9997954969))
22:22duck1123"Elapsed time: 1219.362989 msecs"
22:22duck1123true
22:22AWizzArdnot too bad I guess
22:22duck1123There's a better algorithm on wikipedia
22:23duck1123I'm just trying to solve problem 10 on project euler
22:26rpdillonThat's funny, I'm working on problem 4...
22:28duck1123it would be cool to gather all the code from the wiki and put it into a lib
22:30duck1123ok, anyone know how to get a lazy infinite series of positive integers
22:30duck1123I could've swarn there was a function
22:31AWizzArdduck1123: wouldn't (range 1 9999999999999999999999999999999999999999) be good enough for now?
22:31arbscht(iterate inc 1)?
22:31AWizzArdarbscht: thx
22:34arbschtduck1123: which wiki are you referring to?
22:35duck1123http://clojure-euler.wikispaces.com/
22:38arbschtI don't think most of that code is lib-worthy. more general functions become useful in the later euler questions
22:39duck1123I would never load it, but i would read it, eval stuff and steal good code from it
22:40duck1123assuming we got most/all of the questions
22:41arbschtyes, I'm keen to see solutions in the 100-200 range
22:59duck1123If I need to sum a list, is apply what I need to be looking at?
22:59duck1123I can't seem to get it to work
23:00bitbcktreduce
23:00bitbckt(reduce + [])
23:00bitbcktlike so
23:01duck1123thanks
23:02bitbcktyup
23:02AWizzArdin the clojure-mode in emacs I can autocomplete functions via tab.. so (red<tab> ==> (reduce
23:03AWizzArdbut how can I autocomplete in a buffer where I edit my code.clj?
23:11rottcodd_AWizzArd: M-x where-is RET slime-complete-symbol RET
23:14AWizzArdoki, I will bind that then, thx
23:14asbjxrnNext up on that clojure-euler page should be how to sort numerically :)
23:15rottcodd_AWizzArd: there is also slime-indent-and-complete-symbol
23:16AWizzArdwhat about slime-fuzzy-complete-symbol?
23:19duck1123filter is lazy, right?
23:19rottcodd_that's one of the add-ons I don't use, if it doesn't depend on CL it might work, try it
23:20rottcodd_duck1123: yes
23:21duck1123I'm trying to take an infinite series, filter for primes, then filter for those less than 10, and it's taking forever
23:22bitbcktfiltering an infinite series on primes sounds like it would take forever
23:22bitbcktfilter for less than 10, then filter for primes sounds more reasonable, to me
23:23duck1123I'm sorry, after that, I took 3
23:23duck1123so I would think it should only have to calculate the 1st 3 primes
23:23duck1123am i wrong?
23:24duck1123switching the filters gives the same result
23:26bitbcktthis is using the prime? function you were describing, above?
23:26duck1123yeah
23:29lisppaste8duck1123 annotated #68789 with "taking forever" at http://paste.lisp.org/display/68789#1
23:29bitbcktthis works quickly: (take 3 (filter prime? (iterate inc 1)))
23:30bitbcktwith the reduce: "Elapsed time: 0.196 msecs"
23:31duck1123.277958 for me
23:34bitbcktand, I suppose, you could get the "less than 10" portion with a simple range:
23:34bitbckt(time (reduce + (take 3 (filter prime? (range 1 11)))))
23:34bitbckt.217, for me
23:36bitbcktdoes that do what you intended?
23:36duck1123mental note: don't try to take the first 3 even prime numbers
23:36bitbcktlol
23:39duck1123range works, but i still feel like the filter option should work
23:39duck1123#10 solved in 14+ sec
23:40bitbcktthe filter option runs out of heap space, for me
23:40duck1123i never gave it that much time
23:40bitbckt... in about 2 secs.
23:40bitbcktI have my java at 64M
23:41duck1123does my paste look right to you at least?
23:41bitbcktit seems logical
23:43bitbckttrimming to: (filter #(< %1 10) (iterate inc 1))
23:43bitbcktI get a heap error after 9
23:43bitbcktthat's... amazing, to me
23:44duck1123that's an inf seq
23:44bitbcktat 9?
23:44duck1123it has no way of knowing a 4 won't show up
23:44duck11239 sec, or 9 number
23:44bitbckt9, the integer
23:45bitbckt9 interations
23:45bitbckt-n
23:45duck1123that's odd
23:45bitbcktquite
23:45asbjxrnfilter keeps taking numbers because it can't know that the numbers keeps increasing.
23:46asbjxrnIt has to go through all numbers to filter them?
23:46asbjxrnYou only see up to 9 because the rest get filtered out.
23:47Chouseryou could use (take-while)
23:47bitbcktthe memory usage is what is interesting, to me...
23:47bitbcktgood idea, Chouser
23:48bitbcktChouser: much better
23:48Chouseryou can also use % instead of %1 when you only have one arg
23:49duck1123but if filter is lazy, wouldn't it only filter as needed?
23:50bitbcktthat usage of filter generates quite the leak, for me. so noted.
23:50Chouseryes, but the repl tries to print the everything, which means filter will try to produce everything -- continuing until the end
23:51duck1123but if you wrap it in a take 3....
23:51duck1123which is what I've been doing
23:51Chouserexactly.
23:52bitbcktduck1123: the prime? check, then the take 3...
23:52bitbcktI like the take-while idiom better, anyhow. I hadn't thought of using that. >_<
23:52duck1123I've been leaving the prime check out for now
23:53duck1123(take 9 (filter #(< % 10) (iterate inc 1)))
23:53duck1123wait
23:53duck1123I see now
23:54duck1123wait, no, 9 is still less than 10, that one should still work
23:56bitbcktyup, the REPL is running away on anything greater than 8
23:57duck1123take-while is the much clearer option in this situation, but that's still odd
23:57asbjxrnMaybe the filter/take is calculating one "ahead" in the sequence?
23:58bitbcktasbjxrn: it should execute to 10, fail, and return
23:58asbjxrnwhat should?
23:58bitbcktso, in that sense, it should be one "ahead"
23:59duck1123asbjxrn: you might be right, changing it to #(< % 11) works
23:59asbjxrnfilter doesn't fail.