Skip to content

Instantly share code, notes, and snippets.

View themilar's full-sized avatar
🔮
melt my eyes

Oluwadamilare themilar

🔮
melt my eyes
View GitHub Profile
package main
import (
"fmt"
"strings"
)
func WordCount(s string) map[string]int {
words := strings.Fields(s)
word_map := map[string]int{}
package main
import (
"bufio"
"flag"
"fmt"
"io"
"os"
)
@themilar
themilar / sqrt.go
Created November 21, 2023 15:42
square root package written in golang
package main
import (
"fmt"
"math"
"runtime"
)
func sqrt(x float64) {
z := x / 2
@themilar
themilar / fib.go
Created November 21, 2023 15:43
fibonacci using function closures
package main
import "fmt"
func fibonacci() func() int {
n1, n2 := 0, 1
return func() int {
next := n2
n1, n2 = n2, next+n1
return next