Skip to content

Instantly share code, notes, and snippets.

@sideb0ard
Created May 11, 2014 07:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sideb0ard/86597ed7dbc4ae6197dc to your computer and use it in GitHub Desktop.
Save sideb0ard/86597ed7dbc4ae6197dc to your computer and use it in GitHub Desktop.
insertionSort.go
package main
import (
"bytes"
"fmt"
"log"
"os"
"strings"
)
func main() {
if len(os.Args) == 1 {
log.Fatal("GIMME STRINGSZZZZ")
}
for i := range os.Args {
jobbie(stringify(os.Args[(i + 1):]))
}
fmt.Println("DONE!")
}
func jobbie(bigstringy string) {
fmt.Println(bigstringy)
var Stringies = strings.Split(bigstringy, " ")
if len(Stringies) == 1 {
return
}
jobbie(stringify(Stringies[0 : len(Stringies)-1]))
}
func stringify(stingz []string) string {
var unifiedString bytes.Buffer
for i := range stingz {
if i != 0 {
unifiedString.WriteString(" ")
}
unifiedString.WriteString(stingz[i])
}
return unifiedString.String()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment