Giter Club home page Giter Club logo

soft_testing's People

Watchers

 avatar

soft_testing's Issues

Lab 1 assessment

Nicely done, this is a + for the first week (next issues will be found in the other repo of your new group).

Some minor feedback that might still be relevant to improve your Haskell skills:

  • the “not equals” is /=, even though not (... == ...) is possible of course
  • do not forget to η-reduce your code after you’re done playing with it, it also helps to get to the real intent behind the code: sumDigits l = findSum 0 l implies that there is some computation going on, while sumDigits = findSum 0 could clearly state that one function is defined as another with a fixed first argument.
  • constructs like if (...) then True else False are not truly if-statements, there is no branches, it just says that if the condition evaluates to True, the result is True, and if it evaluates to False, it’s False… which lets me wonder, why not use the condition itself?
  • the function \ (b, _) -> b is pretty standard and is called fst

Lastly, look at this piece of code:

possible_guilty:: [Boy] -> [Boy]
possible_guilty (boy:boys) = accusers boy ++ (possible_guilty boys)
possible_guilty [] = []

Essentially what happens here is an iteration through all elements from right to left, without any surprises or interruptions, and on each step we take whatever was the result on the right, and append it to the list of accusers of another element. This is a pattern realised by a higher order function called foldr, and your entire function can be programmed as:

possible_guilty boys = foldr ((++) . accusers) [] boys

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.