Generic tools for go 1.18+

Gtools


Generic tools for go 1.18+

FT (func tools)


Provide func tools over iterators

Iterators for functions like Filter, Map, Reduce, etc solve 3 main problems:

  1. Does not allocate new slices (because you just iterates over provided one)
  2. Iterates over slice just once (without iterators in case chaining filter -> map -> reduce iterates 3 times [1 time in each function])
  3. Iterator can be writen for any type you needed. So you can work with custom types (such a List, Queue, etc ) in same way

This package contains:

Functions:
  • Filter - wrap provided iter and return new iterator, that yields elements satisfying the given function
  • Map - wrap provided iter and return new iterator, that yields elements obtained by applying the given function to each element of the original iterator
  • Skip - skip N iterations of iterator
  • Chunk - split provided iter into several slices returns iterator of slices with len less or equal size
  • Scan - same as reduce but instead of returning one result it return iterator of results at every step
  • Product - make cartesian product of input iters.
  • Cycle - return endless iterator that yields elements from original iter
  • Zip - create a new iterator over provided 2. This iterator yields pairs of each iterator elements. It ends when one of iter ends (you can combine it if you need zip more than 2 iters: Zip(Zip(iter1, iter2), iter3))
  • Enumerate - returns an iterator of the original slice elements with numbering
Consumers:
  • Collect - consumes iterator and return slice of its elements
  • CollectInto - consumes the iterator and fill provided arguments
  • CollectR - same as CollectInto but this func returns value of provided (during call) type. This func uses reflect.
  • Any- consumes iter and returns true if any element of iter returns true on predicate func call on it
  • All - consumes iter and returns true if all elements returns true on predicate func call on it
  • Reduce - consumes iter, calls provided func on every element of iterator, accumulating result (has optional argument for inital value)
  • Count - consumes iter and count its elements (has optional argument to call only specific values)
  • Sum - consumes elements and return sum of it (can be used only on iterators with numeric types (such as int. float, complex)
  • ForEach - consumes iterator and apply provided function on it
  • IntoChannel - return channel that yields iterator elements (has optional arg context.Context)
  • Max - consumes iter and return max element find in it or nil if no such element
  • Min - same as Max but return min element
Iterator consctructors:
  • SliceIter - iterator over slice
  • MapIter - iterator over map (this iterator spawn goroutine to read from map) use this if you have huge size map
  • MapIterOverSlice - iterator over map (this iterator creating SliceIter with all key-value pairs)
Similar Resources

CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonster Cloud API.

✨ CapMonsterTool ✨ About this module What is ✨ CapMonsterTool ✨ ? CapMonsterTool is a set of Go tools designed to simply make requests to the CapMonst

Dec 1, 2022

frida debug tools

frida debug tools

fd windows下frida的调试工具 (单 exe,不需要python和nodejs) 现在他只支持USB english click here 预编译的二进制文件在这里下载 支持列表: 创建一个基于 frida-agent-example的typescript工程(拥有完美的智能提示) 使用

Dec 30, 2022

Go package providing tools for working with Library of Congress data.

go-libraryofcongress Go package providing tools for working with Library of Congress data. Documentation Tools $ make cli go build -mod vendor -o bin

Jan 3, 2023

Tools created for my OSCP preparation

goscp Set of tools created during my OSCP preparation. They include: gosheller - terminal based interface for cmdasp.aspx webshell. It provides intera

Dec 3, 2021

API and a set of tools to manage Netbox configuration declaratively

declarative-netbox An experimental project to explore the idea of managing the N

Jan 24, 2022

Mixin-sticker - Mixin sticker tools for golang

mixin-sticker mixin sticker bot spider python3 spider.py usage: spider.py [-h] [

Jan 4, 2022

Gosfdc module - a collection of packages containing the data structures from the various Salesforce APIs and Tools

Gosfdc module - a collection of packages containing the data structures from the various Salesforce APIs and Tools

Jan 21, 2022

An interactive menu for Magisk's module installer with tools to alter Android

JD's Toolbox I'll update this with some details later, just getting the source code out for now... LICENSE The source code for JD's Toolbox is release

Jan 24, 2022

Various Dungeons and Dragons Tools. Written in go as an aid to learning the language.

dnd_tools Various Dungeons and Dragons Tools. Written in go as an aid to learning the language. Some tools are generic, while others will target eithe

Jan 28, 2022
Related tags
Generic tools for go 1.18+

Gtools Generic tools for go 1.18+ FT (func tools) Provide func tools over iterators Iterators for functions like Filter, Map, Reduce, etc solve 3 main

Jan 12, 2022
a generic object pool for golang

Go Commons Pool The Go Commons Pool is a generic object pool for Golang, direct rewrite from Apache Commons Pool. Features Support custom PooledObject

Jan 5, 2023
Optimistic rollup tech, minimal and generic.

Opti Optimistic rollup tech, minimal and generic. VERY experimental, just exploratory code, question is: 1:1 EVM rollup with interactive fraud proof p

Aug 30, 2022
Generic mapStringInterface tool for extracting of data for CSV output

Generic mapStringInterface tool for extracting of data for CSV output

Nov 2, 2021
Generic slices for Go 1.8+

Slice A simple package that makes working with slices a little bit easier with the help of generics. Install go get github.com/twharmon/slice Example

Nov 1, 2022
Ecsgo - Cache friendly, Multi threading Entity Component System in Go (with Generic)

ECSGo ECSGo is an Entity Component System(ECS) in Go. This is made with Generic

Oct 19, 2022
Go-generic - A collection of experiments using Go Generics coming out in Go 1.18

Go Generic - experiments with Go 1.18 beta Data structures: iter.Iter[T any] - l

Aug 15, 2022
Nune - High-performance numerical engine based on generic tensors

Nune (v0.1) Numerical engine is a library for performing numerical computation i

Nov 9, 2022
Generic-list-go - Go container/list but with generics

generic-list-go Go container/list but with generics. The code is based on contai

Dec 7, 2022
Nune-go - High-performance numerical engine based on generic tensors

Nune (v0.1) Numerical engine is a library for performing numerical computation i

Nov 9, 2022