first commit

This commit is contained in:
Braden Jageman 2024-07-08 14:05:01 -04:00
commit 90a311b094
5 changed files with 60 additions and 0 deletions

25
.gitignore vendored Normal file
View File

@ -0,0 +1,25 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
go.work.sum
# env file
.env

7
go.mod Normal file
View File

@ -0,0 +1,7 @@
module codepractice
go 1.22.5
require internal/itertools v0.0.0-00010101000000-000000000000
replace internal/itertools => ./internal/itertools

View File

@ -0,0 +1,3 @@
module itertools
go 1.22.5

View File

@ -0,0 +1,13 @@
package itertools
type Iterator struct {
dict map[string]int
}
func (iterator Iterator) GetCount(items []string) map[string]int {
iterator.dict = make(map[string]int)
for _, item := range items {
iterator.dict[item]++
}
return iterator.dict
}

12
main.go Normal file
View File

@ -0,0 +1,12 @@
package main
import (
"fmt"
"internal/itertools"
)
func main() {
iterator := itertools.Iterator{}
items := []string{"one", "two", "three", "one", "one"}
fmt.Println(iterator.GetCount(items))
}