Comments (4)
@khtan Do you have any suggestion on how to make it more clear?
from pratica.
Hi Rametta, sorry for not responding in time. Hope you can still read my comment and respond.
This is the original code:
isOver6Feet({ height: 4.5 })
.map(h => h / 2.2)
.cata({
Just: h => console.log(h), // this function doesn't run
Nothing: () => console.log(`person is not over 6 feet`)
})
Suggestion 1:
Use 2 examples, one with height 4.5, the other with height 7.5 to show the
2 branches of the code, and following the pattern of your original comments
isOver6Feet({ height: 4.5 })
.cata({
Just: h => console.log(h), // this function doesn't run
Nothing: () => console.log(`person is not over 6 feet`)
})
isOver6Feet({ height: 7.5 })
.cata({
Just: h => console.log(h), // prints 7.5
Nothing: () => console.log(`person is not over 6 feet`) // this function doesn't run
})
Suggestion 2:
Take out the map(h => h /2.2 ) because it does not add to the understanding how Maybe is used.
In fact it raises more questions like
a. Is 2.2 an arbitrary constant or a conversion factor
b. Since the height is in feet, is 2.2 a conversion from imperial to metric
etc
from pratica.
@khtan perhaps you can open a PR with your suggestion? Would be very helpful!
from pratica.
from pratica.
Related Issues (12)
- shouldn't chain be called flatMap? HOT 1
- Curry or functional lenses ? HOT 1
- Esm output format? HOT 1
- Why doesn't this library have a curry function? HOT 2
- map is able to create Just(null) HOT 5
- ascasc
- Result should require a non empty value HOT 5
- Publish as Deno Module HOT 2
- Result.value
- Exception throwed HOT 2
- Async functions HOT 1
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.
from pratica.