Comments (7)
I've made those changes, do you want to review the pull request above (#493)?
from elm.
Hi there. This is a good point, we will have a think.
The Elm syntax itself doesn't include constants, but people often call functions with zero parameters 'constants' (especially ones where the return value is just a single value, like in expectedMinutesInOven
), which is why it gets confusing I think. Maybe we should just call them all functions.
I think the second point is a bit easier, maybe "Define the remainingTimeInMinutes calculation (in the in part of the let expression) that takes two parameters [...]"?
from elm.
people often call functions with zero parameters 'constants'
I didn't knew that constants were actually functions with zero parameters, I thought all functions took exactly one parameter.
Regardless, the example shows preparationTimeInMinutes
taking an argument (as is implied by "that takes the number of layers you added to the lasagna as a parameter")
preparationTimeInMinutes 3
--> 6
So it wouldn't be a constant either.
maybe "Define the remainingTimeInMinutes calculation (in the in part of the let expression) that takes two parameters [...]"?
That would seem to imply that the calculation takes two parameters. Maybe just say that remainingTimeInMinutes
should be a function of two parameters and its body a let expression where expectedMinutesInOven
and preparationTimeInMinutes
are locally defined (which I think is the intended solution).
from elm.
How about something like this?
Define the remainingTimeInMinutes function that takes two parameters and has a let expression as its body. The first parameter is the number of layers you added to the lasagna, and the second parameter is the number of minutes since you starting cooking.
Define expectedMinutesInOven (in the let part of the let expression) to check how many minutes the lasagna should be in the oven. According to the cooking book, the expected oven time in minutes is 40:
...
Define preparationTimeInMinutes (in the let part of the let expression) that takes the number of layers you added to the lasagna as a parameter and returns how many minutes you spent preparing the lasagna, assuming each layer takes you 2 minutes to prepare.
...
Return how many minutes are left until the lasagna is finished (in the in part of the let expression), which is the sum of the preparationTimeInMinutes and the expectedMinutesInOven minus the number of minutes since you starting cooking.
from elm.
That looks good.
As minor details,
It says "Define expectedMinutesInOven to check how many minutes the lasagna should be in the oven." but expectedMinutesInOven
does not check the minutes the lasagna should be in the oven, but is the amount of minutes itself (the example makes it clear that it should be a constant, so there shouldn't be any confusion anyhow).
Throughout the problem it says "the number of layers you added", but, in fact, some layers may not have been added yet which is why you add the preparation time to the remaining time (if they were already added, they would not be remaining).
Also, I noticed the dict's concept it says
A list of key value pairs can be converted into a list with fromList.
alice = Dict.fromList [ ( 0, "Bob" ), ( 0, "Alice" ) ]
--> True Dict.fromList [ ( 0, "Alice" ) ]
It probably means "into a dict".
Could you point to some reference where functions with zero parameters are explained?
I checked https://elm-lang.org/docs/syntax but it doesn't seem to be comprehensive.
Thanks.
from elm.
Hi There, I'm not sure the const / function thing is explained anywhere. The fact that functions have no brackets mean that a constant and a zero parameter function are defined using the same syntax, and retrieved using the same syntax. This along with the fact that all functions are pure and all values are immutable means that there is no practical or logical difference between the two things. So it doesn't really matter what it is called I suppose.
I'll make these changes, and updated the dict concept, unless you would like to?
Cheers, Cedd
from elm.
Go ahead with the changes.
from elm.
Related Issues (20)
- Wrong instruction about makeTreasureChest in part 1 of the description in the learning exercise Treasure factory HOT 5
- Small correction in the introduction in the learning exercise Magician in Training HOT 1
- Update strain test HOT 1
- Unsynced docs and metadata HOT 3
- Concept Exercise for Strings HOT 3
- Implement new pop-count HOT 3
- Building a training set of tags for elm HOT 29
- Fill all exercises with accurate "practices" and "prerequisites" concepts
- Parse tags from student solutions HOT 9
- Exercise Binary Search Tree Missing Instructions and Hints
- Concept - Web applications part 1
- Port `reverse-string`? HOT 1
- Add approaches for leap
- Add `protein-translation` and `rotational-cipher` exercises HOT 2
- Add approaches for Allergies practice exercise
- Add markdown linter to CI
- Add test cases to excercise Gotta Snatch'Em All HOT 1
- Concept: recursion
- Concept: bitwise operations
- Windowing System [JS] misguiding instruction for Task 5 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 elm.