Skip to content

eerotuu/gofu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Functional:

Created this module for learning Golang and its possibilities as functional language. This probably is something you shouldn't use in real project.

Install

go get github.com/eerotuu/gofu/

Quick Start

import "github.com/eerotuu/gofu/arrays


data := arrays.Str{"hello", "not wanted", "world!", "last"}

result := data.Filter(func(s string) bool {
  return s != "not wanted"
}).DropLast().Map(func(s string) string {
  return strings.Title(s)
}).Join(" ")

// result = "Hello World!"

Arrays


Types

  • Str []string

  • Int []Int

  • Float []float32

  • Double []float64

All types can be converted with each other using type methods.

strArr := arrays.Str{"1", "5", "7"}
intArr := strArr.Int()
floatArr := intArr.Float()
doubleArr := strArr.Double()

// etc...

Generic Functions []string []int []float32 []float64

  • Map()
  • Filter()
  • Reduce()
  • DropLast()

Type Specific Functions:

Str []string

  • Join()

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages