5 kyu
foldr
Loading description...
Arrays
Lists
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Description seems vague.
If i get it correctly, the task is figuring out how the laziness evaluation works right?
This is the task. Folding and laziness are explained in previous sections.
I'd describe the task as figuring out how to implement the required laziness; I've tried to describe how it works. Is that not working for you? What could I do to explain it better? ( Keep in mind I already know how it works, so I may be skipping steps I consider completely trivial or do not even recognise as steps. )
Thanks for replying.
I read the description and read through the test cases but i couldn't figure it out. I'll have another look later. :)
Done.
I'm not too sure how my solution passed, and I'm very sure it's not intended, but apparently it works. Probably has to do with what's being tested.
Speaking of which, the type of functions and values used in the tests are vital to how to tackle this, so you probably need to document them thoroughly in the descriptions.
The description specifies exactly what arrays will be tested. The tests are there to be read, showing what functions and values are tested. Is that not thorough enough?
There are no secrets in this kata. I can't imagine someone passing the example tests and failing the random tests - they're the same.
Well, I mean based on how my solution is much simpler than yours that maybe something unintended happened. Or maybe something will trip up in my solution but it's not in the tests yet.
This comment has been hidden.
The initial code has two function named
foldr
. This is confusing.Maybe change the inner one to something like
_foldr
?And both of them are not even the outer method
foldr
. It's just the way I do that sometimes.I appreciate the feedback, but I'm not of a mind to change the setup code. You're free to change it in your own solution; it's not in any way essential.
Your comments are most welcome!
I could have tested with more functions,
.some()
and.find()
would have been very possible to implement withfoldr
, but it would have been more of the same really.I could have expanded the problem to include
.foldr(cons,[])
as.slice()
, I had that solved reasonably completely ( boast! ), but it would have meant more description, more testing, even more challenge, and the implementation did not fit in very nicely with the current solution. I left that out.This kata is a spin-off of class List, where there is more functional goodness and frustration to be had. That one also has a tweaking
foldr
, but thatfoldr
has its own problems .. :yum: