sum

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package sum provides utilities for calculate sum of numbers

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func L1Norm

func L1Norm(numbers []int) (l1norm int)

L1Norm returns L1 norm of numbers

Example
package main

import (
	"fmt"
	"github.com/mpppk/cli-template/pkg/sum"
)

func main() {
	numbers := []int{1, -2, 3}
	fmt.Println(sum.L1Norm(numbers))
}
Output:

6

func Sum

func Sum(numbers []int) (sum int)

Sum returns sum of numbers

Example
package main

import (
	"fmt"
	"github.com/mpppk/cli-template/pkg/sum"
)

func main() {
	numbers := []int{1, -2, 3}
	fmt.Println(sum.Sum(numbers))
}
Output:

2

func SumFromString

func SumFromString(stringNumbers []string) (sum int, err error)

SumFromString returns sum numbers which be converted from strings

Types

This section is empty.

Jump to

Keyboard shortcuts

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