-
-
Notifications
You must be signed in to change notification settings - Fork 113
Add concept tail-call-recursion
#751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -0,0 +1,64 @@ | |||
# About |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a great explanation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sitting on the shoulders of giants (@neenjaw)
There is quite a lot of nuance to this, so maybe it is worth its own concept? |
077421f
to
210e710
Compare
|
||
else | ||
loop 0 [ 1 ] | ||
loop 0 [ 1 ] [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tweaked this to make it tail recursive and add it to the list
@ceddlyburge I found an exercise where recursion is needed, but it's very mathy. What do you think about it? |
It looks like the bfs function is recursive in that exercise. Its 100 lines of code, which isn't that bad. Were you thinking about making it a practive exercise or a concept exercise? I think it does look a bit too complicated for a concept exercise, I think you would spend a lot more time thinking about the problem than about the concept ... |
Other thoughts from a quick google are binary search, towers of hanoi, search for a file in a folder structure |
[sorry for the long break]
Which exercise are you referencing? |
The bfs function is in the relative-distance exercise that andras recently added. I think the recursion part of the relative-distance exercise is fairly minor, so I don't think it makes sense as a concept exercise (most of the problem is not about the concept). It would work as a practice exercise I think though. Which exercise are you talking about? |
|
That is quite a mathsy thing, but actually all the maths is simple. Its just some adding and multiplication really. |
Good! Then if you think the exercise is suitable, can I ask you to review the PR? :) |
@@ -929,17 +946,16 @@ | |||
"name": "Pascal's Triangle", | |||
"uuid": "b7e456d7-e383-4e03-9126-c9b57c1287e1", | |||
"practices": [ | |||
"lists" | |||
"tail-call-recursion" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 practice exercises seems pretty good
Closes #692
I only added the concept so far, and now I'm questioning whether this should be part of #750, because any exercise requiring recursion would work out fine, maybe with an extra task "make it tail recursive".Or maybe I'm just being lazy and I'll come up with an exercise idea later, let's see.
The beginning of the introduction was copied from the Elixir track.
Note: this article was very useful in creating this concept, and the elm-review rule it introduces will most likely be used in the analyzer.