Skip to content

Instantly share code, notes, and snippets.

View vly's full-sized avatar
💭

V L vly

💭
View GitHub Profile
@vly
vly / go_tour_57.go
Created April 21, 2013 04:55
Golang tour #57
package main
import (
"fmt"
"net/http"
)
type String string
type Struct struct {
@vly
vly / go_tour_55.go
Last active December 16, 2015 11:38
Golang tour #55
package main
import (
"fmt"
"math"
)
type ErrNegativeSqrt float64
func (e ErrNegativeSqrt) Error() string {
@vly
vly / go_tour_47.go
Created April 21, 2013 02:12
Golang tour #47
package main
import ("fmt"
"math/cmplx"
)
func Cbrt(x complex128) complex128 {
guess := x/2
// assumes stability after 20 iterations
for i:=0;i<20;i++ {
@vly
vly / go_tour_43.go
Created April 21, 2013 01:38
Golang tour #43
package main
import "fmt"
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
a,b,c:= 0,1,0
return func() int {
@vly
vly / go_tour_40.go
Last active December 16, 2015 11:29
Golang tour #40
package main
import (
"code.google.com/p/go-tour/wc"
"strings"
)
func WordCount(s string) map[string]int {
output := make(map[string]int)
for _,b := range strings.Fields(s) {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Help build the bionic eye : Bionic Vision Australia</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->