mirror of
https://github.com/github/semantic.git
synced 2024-11-28 10:15:55 +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
|
||||
|
||||
private init(width: Int, height: Int, values: [Memo<A>]) {
|
||||
|
Loading…
Reference in New Issue
Block a user