-
Notifications
You must be signed in to change notification settings - Fork 146
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
Clojures: Solutions from Challenge 9 to 19 #6
Conversation
Neither original nor updated closures commits have solution to actual exercise #8 (saveOutput) |
return array[count]; | ||
}; | ||
return innerFunc; | ||
} |
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.
It won't work as expected because the first output would be Sat
as we are incrementing the counter on first iteration and it will return array[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.
function cycleIterator(array) {
let counter = 0;
return () => {
if( counter >= array.length) counter = 0;
return array[counter++];
}
}
@amkirschner, the intent of this PR is to address solutions for challenges from 9 to 16, not 8.
|
@kapoorabhi, you're right the solution for challenge #8 was using a wrong index, I fixed the counter. Thanks |
No description provided.