Challenge: Functional Programming Basics
Opgave
Swipe to start coding
Write a function apply_function_to_vector that takes a vector and a function as arguments, and applies the function to each element of the vector, returning the results.
- The function must accept two arguments: a vector (
vec) and a function (fun). - The function must apply
funto each element ofvec. - The function must return a vector containing the results.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 2
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Functional Programming Basics
Stryg for at vise menuen
Opgave
Swipe to start coding
Write a function apply_function_to_vector that takes a vector and a function as arguments, and applies the function to each element of the vector, returning the results.
- The function must accept two arguments: a vector (
vec) and a function (fun). - The function must apply
funto each element ofvec. - The function must return a vector containing the results.
Løsning
Var alt klart?
Tak for dine kommentarer!
Sektion 3. Kapitel 2
single