comp

package module
v0.0.0-...-555c69b Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: Unlicense Imports: 3 Imported by: 0

README

github.com/Guest-615695028/comp

Go support for programmers familiar with other common programming languages, such as C/C++, Java, Javascript, Python.

missing operators

  1. Cond(a, b, c): Conditional operator a ? b : c
  2. Null(a, b): Nil-checking operator a ?? b i. e. a!=nil ? a : b
  3. Value(value, error): Returns the error if so, value if not.
  4. Case to Boolean type: Bool(v)
    • Numbers: whether v is non-zero;
    • Strings: whether v is non-empty;
    • nil-Testible Objects viz. pointer, channel, function, interface, map, and slice types: nil to false, others to true;
    • Arrays and structures: always true as for JavaScript empty array [] and empty object {}.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(v any) any

Absolute valueReal

func Bool

func Bool(b any) bool

func Cond

func Cond(cond, t, f any) any

Operator ?:

func Escape

func Escape(r rune, cap bool) []byte

func Hex

func Hex(i byte, cap bool) byte

Last Hexadigit

func Nil

func Nil(v any, w any) any

Operator ??

func QuoteToJSON

func QuoteToJSON(s string) string

Quote friendly to JSON string

func Value

func Value(v any, err error) any

Obtain the value if no error, or the error if one

func ValueJSON

func ValueJSON(v any, err error) string

Return the JSON for (error if any, value if none)

Types

type Arithmetic

type Arithmetic interface{ Int | Float | Complex }

type BooleanTestible

type BooleanTestible interface{ ~bool | ~string | Arithmetic }

type Booler

type Booler interface{ Bool() bool }

type Complex

type Complex interface{ ~complex64 | ~complex128 }

type Float

type Float interface{ ~float32 | ~float64 }

type FloatingPoint

type FloatingPoint interface{ Float | Complex }

type Int

type Int interface{ SignedInt | UnsignedInt }

type Ordered

type Ordered interface{ Int | Float | ~string }

type Real

type Real interface{ Int | Float }

type SignedInt

type SignedInt interface {
	~int8 | ~int16 | ~int32 | ~int64 | ~int
}

type Stringer

type Stringer interface{ String() string }

type UnsignedInt

type UnsignedInt interface {
	~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uint | ~uintptr
}

Jump to

Keyboard shortcuts

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