mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
Matrix is a functor.
This commit is contained in:
parent
0e8b74e830
commit
3fdda99653
@ -23,6 +23,13 @@ struct Matrix<A> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// MARK: Functor
|
||||||
|
|
||||||
|
func map<Other>(transform: A -> Other) -> Matrix<Other> {
|
||||||
|
return Matrix<Other>(width: width, height: height, values: values.map { $0.map(transform) })
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// MARK: Implementation details
|
// MARK: Implementation details
|
||||||
|
|
||||||
private init(width: Int, height: Int, values: [Memo<A>]) {
|
private init(width: Int, height: Int, values: [Memo<A>]) {
|
||||||
|
Loading…
Reference in New Issue
Block a user