singleton package - github.com/phelmkamp/valor/tuple/singleton - Go Packages (original) (raw)

Package singleton provides a singleton set.

package main

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

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

Output:

{42}

This section is empty.

This section is empty.

SetUnzip separates the values of t into two Sets.

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

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[E any](v E) Set[E]

SetOf creates a Set of v.

String returns the Set formatted as a string.