RosettaCodeData/Task/Optional-parameters/Go/optional-parameters-1.go

21 lines
282 B
Go
Raw Permalink Normal View History

2017-09-23 10:01:46 +02:00
type cell string
2013-04-10 23:57:08 -07:00
type spec struct {
2017-09-23 10:01:46 +02:00
less func(cell, cell) bool
2013-04-10 23:57:08 -07:00
column int
reverse bool
}
2017-09-23 10:01:46 +02:00
func newSpec() (s spec) {
// initialize any defaults
return
}
// sort with all defaults
t.sort(newSpec())
// reverse sort
s := newSpec
s.reverse = true
t.sort(s)