Re: Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Gary Fredericks
Another kind of approach that would be worth trying is adapting test.check's own shuffle generator . It generates a sequence of pairs of indexes and t

Re: Show: Naive data fitting with Nyarlathotep

2015-08-14 Thread Robert Levy
That sounds interesting! So far I get a 404. Maybe the repo needs to be set public? On Fri, Aug 14, 2015 at 11:19 AM, Divyansh Prakash < divyanshprakas...@gmail.com> wrote: > Hey! > Nyarlathotep is a tiny > mathematical function generator that can be u

Show: Naive data fitting with Nyarlathotep

2015-08-14 Thread Divyansh Prakash
Hey! Nyarlathotep is a tiny mathematical function generator that can be used as a (very naive) data fitting tool. It generates random functions and tests them against provided constraints. I don't think it's of any practical use, but it is fascinating to

ANN: org.clojure/tools.namespace "0.3.0-alpha1"

2015-08-14 Thread Stuart Sierra
tools.namespace: Parse ns declarations from source files and reload files in the correct order. https://github.com/clojure/tools.namespace This is an ALPHA release with some significant changes, including ClojureScript support (see below). It should be fully backwards-compatible with the 0.2.x s

Re: Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Mayank Jain
Oh okay. So if a value given to gen/return function is coming via a generator will shrink because that generator will shrink. But say (gen/return [1 2 3 4]) will never shrink because it is saying just return it as it is and never shrink this. Got it! :) On Fri, Aug 14, 2015 at 10:34 PM, Carlo Zanc

Re: Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Carlo Zancanaro
What it means is that the value returned by gen/return can't be shrunk. Shrinking is done by constructing a (lazily evaluated) tree of "smaller" forms of the same thing. So a number, let's say 4, contains a tree of smaller numbers (0, 1, 2, and 3) which specify how to shrink it. (The tree is const

Re: Decomplecting Clojure

2015-08-14 Thread John Gabriele
On Thursday, August 13, 2015 at 1:51:32 PM UTC-4, Sebastian Bensusan wrote: > > > > I never thought of laziness! It's a good point. Retroactively I might add > it to the Functional Style section :) > > I think of laziness as often going together with (possibly-) infinite lists. > Thanks for the

Re: Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Mayank Jain
Ah right! I knew I had to use gen/choose for this, I am still grokking bind :) Thanks for your help! That indeed did the trick for me :) One thing I am clear about is, If I use gen/return it says it'll not shrink. Does that mean when a test fails for a certain order, it won't try to shrink that o

Re: Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Carlo Zancanaro
Hey Mayank! Similarly to your attempt last time, you need to use gen/bind to get the result of a generator which you can then use to make a new generator. (defn- rand-interleave* [coll acc] (if (seq coll) (gen/bind (gen/choose 0 (dec (count coll))) (fn [index]

Re: Clojure Truck Factor

2015-08-14 Thread Gary Verhaegen
Hi Guilherme, I am not a Clojure developer (I only use it), so maybe I'm speaking out of line. I would first like to thank you for the initiative; as an industry, I believe we direly need more quantitative, scientific studies of our practices, so I'm really happy to see this. There is of course a

Need suggestions on how to write rand-interleave test.check generator.

2015-08-14 Thread Mayank Jain
Hi Everyone, Here's the problem I am facing, I need to write a generator which takes any number of sequences, interleaves them but maintains the order within each sequence. Assume each sequence has at least one element. For example: (rand-interleave [1 2 3 4] [:a :b] [:A :B :C :D :E]) > => [:a 1

Re: Is this resource only loaded once?

2015-08-14 Thread Thomas Goossens
Thank you gary! (Hope to see soon again :) ) On Friday, August 14, 2015 at 1:30:08 PM UTC+2, Gary Verhaegen wrote: > > Once you've AOT compiled that (which is necessary for the class to be > actually generated), slurp won't be called again. Beware, however, that > `def` (and hence `slurp`) will

Re: Is this resource only loaded once?

2015-08-14 Thread Gary Verhaegen
Once you've AOT compiled that (which is necessary for the class to be actually generated), slurp won't be called again. Beware, however, that `def` (and hence `slurp`) will be executed by the compiler, at compile time, in the context (classpath, cwd, etc.) of the compiler, which may not be what you

Is this resource only loaded once?

2015-08-14 Thread Thomas Goossens
When a java class uses the compiled Test (gen-class) from test namespace. Everytime the static function -run is called, will parser be slurped again or only once ? (ns test (:gen-class :name Test :methods [ ^:static [run [] String])) (def parser (slurp "..