Challenge: Functional Programming Basics
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 2
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Can you explain this in simpler terms?
What are the main takeaways from this?
Can you give me a real-world example?
Génial!
Completion taux amélioré à 5.56
Challenge: Functional Programming Basics
Glissez pour afficher le menu
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 2
single