Skip to content
/ tiiio Public

This library emulates JavaScript-like array methods. It is not intended for high-performance computing or as a comprehensive data structure library. Instead, it is designed for simple use-cases and small data interactions. For high-performance and specialized data structure needs, Go has official libraries.

Notifications You must be signed in to change notification settings

talpx0/tiiio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

"This library emulates JavaScript-like array methods. It is not intended for high-performance computing or as a comprehensive data structure library. Instead, it is designed for simple use-cases and small data interactions. For high-performance and specialized data structure needs, Go has official libraries."

package main

import (
	"fmt"
	"github.com/talpx0/tiiio" // Replace with your actual package import
)

func main() {
	arr := tiiio.Array{1, 2, 3, 4, 5}

	// Sum reducer function
	sumReducer := func(a, b int) int {
		return a + b
	}

	// Using Reduce to calculate the sum of array elements
	sum := arr.Reduce(sumReducer, 0)
	fmt.Println("Sum:", sum) // Output should be: Sum: 15

	// String array
	strArr := tiiio.Array{"Hello", " ", "world", "!"}

	// String concatenation reducer function
	stringReducer := func(a, b string) string {
		return a + b
	}

	// Using Reduce to concatenate the strings
	concatenated := strArr.Reduce(stringReducer, "")
	fmt.Println("Concatenated string:", concatenated) // Output should be: Concatenated string: Hello world!
}

About

This library emulates JavaScript-like array methods. It is not intended for high-performance computing or as a comprehensive data structure library. Instead, it is designed for simple use-cases and small data interactions. For high-performance and specialized data structure needs, Go has official libraries.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages