Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CODE:
- fn map<T, U>(v: [T], f: fn(T) -> U) -> [U] {
- let mut acc = [];
- for v.each {|elt| acc += [f(elt)]; }
- acc
- }
- ERRORS:
- arguments.rs:17:8: 17:14 error: attempted access of field each on type ['a], but no public field or method with that name was found
- arguments.rs:17 for v.each {|elt| acc += [f(elt)]; }
- ^~~~~~
- arguments.rs:17:8: 17:40 error: the type of this value must be known in this context
- arguments.rs:17 for v.each {|elt| acc += [f(elt)]; }
- ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Advertisement
Add Comment
Please, Sign In to add comment