File: types.go

package info (click to toggle)
golang-bugst-f 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 108 kB
  • sloc: makefile: 2
file content (19 lines) | stat: -rw-r--r-- 577 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
// This file is part of go-algorithms.
//
// Copyright 2024 Cristian Maglie. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

package f

// Matcher is a function that tests if a given value matches a certain criteria.
type Matcher[T any] func(T) bool

// Reducer is a function that combines two values of the same type and return
// the combined value.
type Reducer[T any] func(T, T) T

// Mapper is a function that converts a value of one type to another type.
type Mapper[T, U any] func(T) U