Everyone seems to be doing well with the second one.
Should we quickly go over it?
Okay.
I figure so.
Yeah.
I think the second one you can do on your own.
Okay.
So we have a type of vectors.
That is pretty straightforward.
And we want to have a map function.
Okay.
So the map function is supposed to take an element of the vector and the index of that
element in the vector and then return something else.
Okay.
So here's an example to make clear what that is supposed to be.
So if we put in a vector with three elements, A, B, C, then we would have to do map the
number of elements, three, the type of the vector itself, A, the type of the return of
the function, B, the function itself and the vector.
And then it would map that function with the index to all of the elements.
So it would return F1A, F2B, F3C.
So the type of map then has to be capital N. It takes the type A. It takes the type
B.
It takes the function.
Okay.
It doesn't turn off.
It takes the function as the fourth argument.
And then it has to take the vector.
So a vec of length N and type A, sorry, other way around, AN, and returns a vector of type
B and the same length.
That makes sense so far?
It doesn't have to be, yeah, doesn't hurt, but wouldn't have to be, yeah.
Okay.
Next, function index.
It takes a vector.
It takes an index, returns the element at that index.
Okay.
So again, one example to make sure what I mean.
If we have the vector XYZW, then index, it needs the length of the vector, four.
It needs the type of the vector, T. It needs the vector itself, V. And then an index, so
it would return the second element, IEY.
So what's the type of that?
Well, this has to be a capital N again.
Sorry?
Yeah.
So, and then it would take a vector of type T and length N.
And it would take an index of type N and return an element of type T.
And now for the brutal part, putting all the things together, we want to have vector addition.
Take two vectors at them.
So what would that have to do?
We have again one example here just to make sure what all the arguments are that we need
Presenters
Zugänglich über
Offener Zugang
Dauer
01:19:50 Min
Aufnahmedatum
2025-07-15
Hochgeladen am
2025-07-15 21:39:03
Sprache
en-US