singleton

package
v0.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package singleton provides a singleton set.

Example
package main

import (
	"fmt"
	"github.com/phelmkamp/valor/tuple/singleton"
)

func main() {
	fmt.Println(singleton.SetOf(42))
}
Output:

{42}

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetUnzip added in v0.3.0

func SetUnzip[T, T2 any](t two.Tuple[T, T2]) (Set[T], Set[T2])

SetUnzip separates the values of t into two Sets.

func SetZip added in v0.3.0

func SetZip[T, T2 any](s Set[T], s2 Set[T2]) two.Tuple[T, T2]

SetZip combines the values of s and s2 into a two.Tuple.

Types

type Set

type Set[E any] map[unit.Type]E

Set contains at most one element.

It works like a map. Use the key unit.Unit to access the element:

v, ok := s[unit.Unit]

func SetOf

func SetOf[E any](v E) Set[E]

SetOf creates a Set of v.

func (Set[E]) String

func (s Set[E]) String() string

String returns the Set formatted as a string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL