Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/svenliebig/seq
https://github.com/svenliebig/seq
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/svenliebig/seq
- Owner: svenliebig
- Created: 2024-04-23T14:04:53.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-04T08:52:36.000Z (4 months ago)
- Last Synced: 2024-07-22T12:58:44.151Z (4 months ago)
- Language: Go
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# seq
A simple sequence package for go.
## Installation
```bash
go get github.com/svenliebig/seq
```## Usage
```go
package mainimport (
"fmt"
"github.com/svenliebig/seq"
)func main() {
// Create a sequence of integers from 1 to 10
s := seq.Ints(1, 10)
for v := range s.Iterator() {
fmt.Println(s)
}// Filter the sequence by even numbers
f := seq.Filter(s, func(v int) bool {
return v % 2 == 0
})
for v := range f.Iterator() {
fmt.Println(f)
}// Map the sequence to quoted strings
m := seq.Map(f, func(v int) string {
return fmt.Sprintf("%q", v)
})
for v := range m.Iterator() {
fmt.Println(m)
}
}
```## Implement your own sequence
```go
// todo
```