Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Thanks siebenschlaefer!
only after your explanation I understood what task wants from me!
Thanks for the explanation, siebenschlaefer. It was fairly straightforward once I understood what was needed.
You have a sequence of values, e.g.
[value1, value2, value3, value4, value5, value6, value7, value8, value9]
and a function (predicate) that takes one argument and returnstrue
orfalse
. If you'd call the function for each argument you might get something like[true, true, true, false, true, true, false, false, true]
. If you remove all values from the sequence up until (but not including) the first one that evaluates tofalse
, you get this:[value4, value5, value6, value7, value8, value9]
(becausepredicate(value1)
,predicate(value2)
, andpredicate(value3)
aretrue
).Your task: Write a function that takes a sequence and a predicate and returns a new sequence starting from the first element for which
predicate(element)
returnsfalse
.Me too, I am slow at programming, I even unlocked the solution and did not really understand!
Guys ... I don't understand this one. What does this mean, "You want to remove the longest prefix of elements such that the predicate is true for each element."
This comment is hidden because it contains spoiler information about the solution
You multiplied the number, nice!
now see if you can manipulate the array sans loops :)
My apologies. This is my first time posting a comment.
Please mark your comment as spoiler if it contains solution relevant information.
This comment is hidden because it contains spoiler information about the solution
interesting code!
Great kata to practice using the range function!