Coder Social home page Coder Social logo

software-testing-2013's People

Contributors

grammarware avatar mrluka avatar

Watchers

 avatar  avatar

Forkers

bertlisser

software-testing-2013's Issues

Week 6: if you have read this and you have no questions, please close this issue.

Task 3

merge :: (Ord a) => [a] -> [a] -> [a] -- The merge function is a highly-specialized function that merges two infinite, sorted lists
merge xs@(x:xt) ys@(y:yt) =
  case compare x y of
    LT -> x : (merge xt ys)
    EQ -> x : (merge xt yt)
    GT -> y : (merge xs yt)



diff :: (Ord a) => [a] -> [a] -> [a] -- diff, in short, removes all of the elements of the second list passed to it from the first.
diff xs@(x:xt) ys@(y:yt) =
  case compare x y of
    LT -> x : (diff xt ys)
    EQ -> diff xt yt
    GT -> diff xs yt


composites :: [Integer]
composites = foldr1 f $ map g $ tail primes
  where
    f (x:xt) ys = x : (merge xt ys)
    g p = [ n * p | n <- [p, p + 2 ..]]

The function composites is not correct.
See

*Week6> take 10 composites
[9,15,21,25,27,33,35,39,45,49]

Where are the multiples of 2?

What are the values of the function parameters in the following fragment?

Task 6 
Use the list from the previous exercise to test the Miller-Rabin primality check.

The Miller-Rabin test returns 172947529 as prime, but it is a Carmichael pseudo prime. 
To get results with a higher chance to be right, the test should be executed multiple times but with different (random) parameters. 
This was tested with the function checkMillerRabin. It showed that the results are more precise by repeating the test with different random values. 
(This was tested by modifying the functions parameters, not auto-test present yet).

Week 4: if you have read this and you have no questions, please close this issue.

Opg3

testIntersectionA1 :: Ord a => Set a -> Set a -> Bool
testIntersectionA1 x y = testIntersectionA2 x y (intersection x y)

testIntersectionA2 :: Ord a => Set a -> Set a -> Set a -> Bool
testIntersectionA2 (Set []) y z = True
testIntersectionA2 (Set (x:xs)) y z = inSet x y == inSet x z
&& testIntersectionA2 (Set xs) y z

Better not using the internal representation of the abstract data type Set
( intersection x y ).

Opg4

trClos ::Ord a => Rel a -> Rel a
trClos rel = do trans1 <- return (nub (rel ++ (rel @@ rel)))
                if length trans1 == length rel
                   then rel
                   else trClos trans1

I don't understand the return here. There is no monad involved here. Further OK.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.