Just syncing

This commit is contained in:
Brian Buller 2016-09-03 21:35:32 -05:00
parent 739f3c3e2b
commit 4beb28090e
1 changed files with 34 additions and 0 deletions

34
go/matrix/matrix.go Normal file
View File

@ -0,0 +1,34 @@
package matrix
import "strings"
type Matrix struct {
vals [][]int
}
func New(in string) (*Matrix, error) {
ret := Matrix{}
rows := strings.Split(in, "\n")
return &ret, nil
}
func (m *Matrix) Rows() [][]int {
return m.vals
}
func (m *Matrix) Cols() [][]int {
ret := [][]int{}
if len(m.vals) > 0 {
// for i := 0; i < len(m.vals[0]); i++ {
// }
}
return ret
}
func (m *Matrix) Set(r, c int, val int) bool {
if len(m.vals) < r || len(m.vals[r]) < c {
return false
}
m.vals[r][c] = val
return true
}