soft_testing's People
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 thoughnot (... == ...)
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, whilesumDigits = 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 toTrue
, the result isTrue
, and if it evaluates toFalse
, it’sFalse
… which lets me wonder, why not use the condition itself? - the function
\ (b, _) -> b
is pretty standard and is calledfst
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.