SlideShare a Scribd company logo
going loopy
adventures in iteration with google go
!
!

@feyeleanor

Going Loopy

!1

http://slideshare.net/feyeleanor/
the conditional loop

Going Loopy

!2

http://slides.games-with-brains.net/
package main	
import "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
fmt.Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!3

http://slides.games-with-brains.net/
package main	
import "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
fmt.Printf("%v: %vn", i, s[i])	
}	
}	

!
!
0:
1:
2:
3:
4:

Going Loopy

0	
2	
4	
6	
8

!4

http://slides.games-with-brains.net/
package main	
import "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
fmt.Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!5

http://slides.games-with-brains.net/
package main	
import "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
fmt.Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!6

http://slides.games-with-brains.net/
package main	
import "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
fmt.Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!7

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!8

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!9

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!10

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!11

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!12

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!13

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!14

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!15

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!16

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!17

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!18

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!19

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!20

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!21

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!22

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i := 0; i < len(s); i++ {	
Printf("%v: %vn", i, s[i])	
}	
}

Going Loopy

!23

http://slides.games-with-brains.net/
the infinite loop

Going Loopy

!24

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!25

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!26

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!27

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!28

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!29

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!30

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
defer func() {	
recover()	
}()	
s := []int{0, 2, 4, 6, 8}	
i := 0	
for i := 0; ; i++ {	
Printf("%v: %vn", i, s[i])	
i++	
}	
}

Going Loopy

!31

http://slides.games-with-brains.net/
the range

Going Loopy

!32

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!33

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!34

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!35

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!36

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!37

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!38

http://slides.games-with-brains.net/
a functional interlude

Going Loopy

!39

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s []int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!40

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s []int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!41

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s []int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!42

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s []int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!43

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice(0, 2, 4, 6, 8)	
}	

!
func print_slice(s ...int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!44

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice(0, 2, 4, 6, 8)	
}	

!
func print_slice(s ...int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!45

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice(0, 2, 4, 6, 8)	
}	

!
func print_slice(s ...int) {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!46

http://slides.games-with-brains.net/
asserting type

Going Loopy

!47

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
for i, v := range s.([]int) {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!48

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
for i, v := range s.([]int) {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!49

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
for i, v := range s.([]int) {	
Printf("%v: %vn", i, v)	
}	
}

Going Loopy

!50

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!51

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!52

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!53

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!54

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!55

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
if s, ok := s.([]int); ok {	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!56

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!57

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!58

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!59

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!60

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!61

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
print_slice([]int{0, 2, 4, 6, 8})	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!62

http://slides.games-with-brains.net/
closures

Going Loopy

!63

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!64

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!65

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!66

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!67

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!68

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!69

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!70

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!71

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!72

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_slice(func(i int) int { return s[i] })	
}	

!
func print_slice(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
}	
}

Going Loopy

!73

http://slides.games-with-brains.net/
channels

Going Loopy

!74

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!75

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!76

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int, 16)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!77

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!78

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!79

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!80

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!81

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!82

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!83

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
	
c := make(chan int)	
	
go func() {	
	
	
for _, v := range []int{0, 2, 4, 6, 8} {	
	
	
	
c <- v	
	
	
}	
	
	
close(c)	
	
}()	
	
Printf("elements: %vn", print_channel(c))	
}	

!
func print_channel(c chan int) (i int) {	
	
for v := range c {	
	
	
Printf("%v: %vn", i, v)	
	
	
i++	
	
}	
	
return	
}

Going Loopy

!84

http://slides.games-with-brains.net/
upon reflection

Going Loopy

!85

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] * 2 })	
}	

!
func print_values(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!86

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] * 2 })	
}	

!
func print_values(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!87

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] * 2 })	
}	

!
func print_values(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!88

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] * 2 })	
}	

!
func print_values(s interface{}) {	
switch s := s.(type) {	
case func(int) int:	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s(i))	
}	
case []int:	
for i, v := range s {	
Printf("%v: %vn", i, v)	
}	
}	
}

Going Loopy

!89

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface{})	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i))	
}	
}	
}
Going Loopy

!90

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface{})	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i))	
}	
}	
}
Going Loopy

!91

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!92

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!93

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!94

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!95

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!96

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!97

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!98

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!99

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!100

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!101

http://slides.games-with-brains.net/
package main	
import . "fmt"	
import . "reflect"	

!
func main() {	
s := []int{0, 2, 4, 6, 8}	
print_values(s)	
print_values(func(i int) int { return s[i] })	
}	

!
func print_values(s interface{}) {	
switch s := ValueOf(s); s.Kind() {	
case Func:	
p := []Value{ ValueOf(i) }	
for i := 0; i < 5; i++ {	
Printf("%v: %vn", i, s.Call(p)[0].Interface())	
}	
case Slice:	
for i := 0; i < s.Len(); i++ {	
Printf("%v: %vn", i, s.Index(i).Interface())	
}	
}	
}
Going Loopy

!102

http://slides.games-with-brains.net/
user-defined type

Going Loopy

!103

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!104

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!105

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!106

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!107

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!108

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!109

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!110

http://slides.games-with-brains.net/
package main	
import . "fmt"	

!
type Iterable interface {	
Each(func(interface{}))	
}	

!
type IterableSlice	[]int	
func (i IterableSlice) Each(f func(interface{})) {	
for _, v := range i {	
f(v)	
}	
}	

!
func main() {	
s := IterableSlice{ 0, 2, 4, 6, 8 }	
i := 0	
s.Each(func(v interface{}) {	
Printf("%v: %vn", i, v)	
i++	
})	
}

Going Loopy

!111

http://slides.games-with-brains.net/
you now know go

Going Loopy

112

http://slides.games-with-brains.net/
#golang

Going Loopy

113

http://slides.games-with-brains.net/
http://golang.org/

Going Loopy

114

http://slides.games-with-brains.net/

More Related Content

What's hot

JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugueJavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
Brian Tarbox
 
FPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixirFPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixir
Functional Programming Brno
 
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
David Koelle
 
Yapc Asia 2008 TMTOWTMS
Yapc Asia 2008 TMTOWTMSYapc Asia 2008 TMTOWTMS
Yapc Asia 2008 TMTOWTMS
Jeen Lee
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010Puppet
 
Fun with processes - lightning talk
Fun with processes - lightning talkFun with processes - lightning talk
Fun with processes - lightning talk
Paweł Dawczak
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworks
Kerry Buckley
 
Petunjuk pengisian lhkpn model a
Petunjuk pengisian lhkpn model aPetunjuk pengisian lhkpn model a
Petunjuk pengisian lhkpn model a
Golden Saragih
 
FFT
FFTFFT
Parallel binary search
Parallel binary searchParallel binary search
Parallel binary search
승혁 조
 
Using Phing for Fun and Profit
Using Phing for Fun and ProfitUsing Phing for Fun and Profit
Using Phing for Fun and Profit
Nicholas Jansma
 
Tercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de InglesTercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de Ingles
Ricardo Aguilar
 
ใบงานเรื่องการคอมไพล์โปรแกรม
ใบงานเรื่องการคอมไพล์โปรแกรมใบงานเรื่องการคอมไพล์โปรแกรม
ใบงานเรื่องการคอมไพล์โปรแกรมธงชัย พาศรี
 
Awesomely descriptive JavaScript with monads
Awesomely descriptive JavaScript with monadsAwesomely descriptive JavaScript with monads
Awesomely descriptive JavaScript with monads
Michal Nowak
 
Groovy kind of test
Groovy kind of testGroovy kind of test
Groovy kind of test
Torsten Mandry
 
Amazon Alexa Development
Amazon Alexa DevelopmentAmazon Alexa Development
Amazon Alexa Development
Ryan Chung
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
Pôle Systematic Paris-Region
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
jaliss
 

What's hot (18)

JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugueJavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
JavaOne 2010, Rock Star winning presentation on Fugue and Log4JFugue
 
FPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixirFPBrno 2018-05-22: Benchmarking in elixir
FPBrno 2018-05-22: Benchmarking in elixir
 
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
JFugue, Music, and the Future of Java [JavaOne 2016, CON1851]
 
Yapc Asia 2008 TMTOWTMS
Yapc Asia 2008 TMTOWTMSYapc Asia 2008 TMTOWTMS
Yapc Asia 2008 TMTOWTMS
 
Alessandro sf 2010
Alessandro sf 2010Alessandro sf 2010
Alessandro sf 2010
 
Fun with processes - lightning talk
Fun with processes - lightning talkFun with processes - lightning talk
Fun with processes - lightning talk
 
Javasccript MV* frameworks
Javasccript MV* frameworksJavasccript MV* frameworks
Javasccript MV* frameworks
 
Petunjuk pengisian lhkpn model a
Petunjuk pengisian lhkpn model aPetunjuk pengisian lhkpn model a
Petunjuk pengisian lhkpn model a
 
FFT
FFTFFT
FFT
 
Parallel binary search
Parallel binary searchParallel binary search
Parallel binary search
 
Using Phing for Fun and Profit
Using Phing for Fun and ProfitUsing Phing for Fun and Profit
Using Phing for Fun and Profit
 
Tercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de InglesTercera parte parte del Cuaderno de Ingles
Tercera parte parte del Cuaderno de Ingles
 
ใบงานเรื่องการคอมไพล์โปรแกรม
ใบงานเรื่องการคอมไพล์โปรแกรมใบงานเรื่องการคอมไพล์โปรแกรม
ใบงานเรื่องการคอมไพล์โปรแกรม
 
Awesomely descriptive JavaScript with monads
Awesomely descriptive JavaScript with monadsAwesomely descriptive JavaScript with monads
Awesomely descriptive JavaScript with monads
 
Groovy kind of test
Groovy kind of testGroovy kind of test
Groovy kind of test
 
Amazon Alexa Development
Amazon Alexa DevelopmentAmazon Alexa Development
Amazon Alexa Development
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
 
SecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play FrameworkSecureSocial - Authentication for Play Framework
SecureSocial - Authentication for Play Framework
 

Viewers also liked

Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
Eleanor McHugh
 
GoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoGoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in Go
Eleanor McHugh
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in go
Eleanor McHugh
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & C
Eleanor McHugh
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
Eleanor McHugh
 
Implementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & CImplementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & C
Eleanor McHugh
 
Go for the would be network programmer
Go for the would be network programmerGo for the would be network programmer
Go for the would be network programmerEleanor McHugh
 

Viewers also liked (7)

Implementing Software Machines in C and Go
Implementing Software Machines in C and GoImplementing Software Machines in C and Go
Implementing Software Machines in C and Go
 
GoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in GoGoLightly - a customisable virtual machine written in Go
GoLightly - a customisable virtual machine written in Go
 
Finding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in goFinding a useful outlet for my many Adventures in go
Finding a useful outlet for my many Adventures in go
 
Implementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & CImplementing Virtual Machines in Go & C
Implementing Virtual Machines in Go & C
 
Going Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with GoGoing Loopy: Adventures in Iteration with Go
Going Loopy: Adventures in Iteration with Go
 
Implementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & CImplementing Virtual Machines in Ruby & C
Implementing Virtual Machines in Ruby & C
 
Go for the would be network programmer
Go for the would be network programmerGo for the would be network programmer
Go for the would be network programmer
 

Similar to going loopy - adventures in iteration with google go

going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
Codemotion
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with go
Eleanor McHugh
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGoMoriyoshi Koizumi
 
Go Containers
Go ContainersGo Containers
Go Containers
jgrahamc
 
Go Containers
Go ContainersGo Containers
Go Containers
Cloudflare
 
Crunching data with go: Tips, tricks, use-cases
Crunching data with go: Tips, tricks, use-casesCrunching data with go: Tips, tricks, use-cases
Crunching data with go: Tips, tricks, use-cases
Sergii Khomenko
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiarities
noamt
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
Adam Dudczak
 
Introduction to Go for Java Programmers
Introduction to Go for Java ProgrammersIntroduction to Go for Java Programmers
Introduction to Go for Java Programmers
Kalpa Pathum Welivitigoda
 
Testing CLI tools with Go
Testing CLI tools with GoTesting CLI tools with Go
Testing CLI tools with Go
Ricardo Gerardi
 
JDD 2016 - Philippe Charrière - Golo, The Tiny Language That Gives Super Powers
JDD 2016 - Philippe Charrière -  Golo, The Tiny Language That Gives Super PowersJDD 2016 - Philippe Charrière -  Golo, The Tiny Language That Gives Super Powers
JDD 2016 - Philippe Charrière - Golo, The Tiny Language That Gives Super Powers
PROIDEA
 
python codes
python codespython codes
python codes
tusharpanda88
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Python-GTK
Python-GTKPython-GTK
Python-GTKYuren Ju
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient Collections
Eleanor McHugh
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
Eleanor McHugh
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
Anton Arhipov
 
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
Edureka!
 
Awt components
Awt componentsAwt components
Awt components
suman613842
 

Similar to going loopy - adventures in iteration with google go (20)

going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
going loopy - adventures in iteration with go - Eleanor McHugh - Codemotion M...
 
An introduction to functional programming with go
An introduction to functional programming with goAn introduction to functional programming with go
An introduction to functional programming with go
 
10〜30分で何となく分かるGo
10〜30分で何となく分かるGo10〜30分で何となく分かるGo
10〜30分で何となく分かるGo
 
Go Containers
Go ContainersGo Containers
Go Containers
 
Go Containers
Go ContainersGo Containers
Go Containers
 
Crunching data with go: Tips, tricks, use-cases
Crunching data with go: Tips, tricks, use-casesCrunching data with go: Tips, tricks, use-cases
Crunching data with go: Tips, tricks, use-cases
 
Python Peculiarities
Python PeculiaritiesPython Peculiarities
Python Peculiarities
 
Are we ready to Go?
Are we ready to Go?Are we ready to Go?
Are we ready to Go?
 
Introduction to Go for Java Programmers
Introduction to Go for Java ProgrammersIntroduction to Go for Java Programmers
Introduction to Go for Java Programmers
 
Vcs17
Vcs17Vcs17
Vcs17
 
Testing CLI tools with Go
Testing CLI tools with GoTesting CLI tools with Go
Testing CLI tools with Go
 
JDD 2016 - Philippe Charrière - Golo, The Tiny Language That Gives Super Powers
JDD 2016 - Philippe Charrière -  Golo, The Tiny Language That Gives Super PowersJDD 2016 - Philippe Charrière -  Golo, The Tiny Language That Gives Super Powers
JDD 2016 - Philippe Charrière - Golo, The Tiny Language That Gives Super Powers
 
python codes
python codespython codes
python codes
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Python-GTK
Python-GTKPython-GTK
Python-GTK
 
Generics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient CollectionsGenerics, Reflection, and Efficient Collections
Generics, Reflection, and Efficient Collections
 
Go: It's Not Just For Google
Go: It's Not Just For GoogleGo: It's Not Just For Google
Go: It's Not Just For Google
 
Something about Golang
Something about GolangSomething about Golang
Something about Golang
 
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
PyGame Tutorial | PyGame Python Tutorial For Beginners | Python Certification...
 
Awt components
Awt componentsAwt components
Awt components
 

More from Eleanor McHugh

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
Eleanor McHugh
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data Integrity
Eleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
Eleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
Eleanor McHugh
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
Eleanor McHugh
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
Eleanor McHugh
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
Eleanor McHugh
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored Spaces
Eleanor McHugh
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Eleanor McHugh
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by design
Eleanor McHugh
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trust
Eleanor McHugh
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at Scale
Eleanor McHugh
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountability
Eleanor McHugh
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
Eleanor McHugh
 
Encrypt all transports
Encrypt all transportsEncrypt all transports
Encrypt all transports
Eleanor McHugh
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
Eleanor McHugh
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
Eleanor McHugh
 
Privacy is always a requirement
Privacy is always a requirementPrivacy is always a requirement
Privacy is always a requirement
Eleanor McHugh
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and GoHybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
Eleanor McHugh
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
Eleanor McHugh
 

More from Eleanor McHugh (20)

[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf[2023] Putting the R! in R&D.pdf
[2023] Putting the R! in R&D.pdf
 
The Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data IntegrityThe Relevance of Liveness - Biometrics and Data Integrity
The Relevance of Liveness - Biometrics and Data Integrity
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]An introduction to functional programming with Go [redux]
An introduction to functional programming with Go [redux]
 
Implementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 reduxImplementing virtual machines in go & c 2018 redux
Implementing virtual machines in go & c 2018 redux
 
Identity & trust in Monitored Spaces
Identity & trust in Monitored SpacesIdentity & trust in Monitored Spaces
Identity & trust in Monitored Spaces
 
Don't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By DesignDon't Ask, Don't Tell - The Virtues of Privacy By Design
Don't Ask, Don't Tell - The Virtues of Privacy By Design
 
Don't ask, don't tell the virtues of privacy by design
Don't ask, don't tell   the virtues of privacy by designDon't ask, don't tell   the virtues of privacy by design
Don't ask, don't tell the virtues of privacy by design
 
Anonymity, identity, trust
Anonymity, identity, trustAnonymity, identity, trust
Anonymity, identity, trust
 
Distributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at ScaleDistributed Ledgers: Anonymity & Immutability at Scale
Distributed Ledgers: Anonymity & Immutability at Scale
 
Anonymity, trust, accountability
Anonymity, trust, accountabilityAnonymity, trust, accountability
Anonymity, trust, accountability
 
Implementing Software Machines in Go and C
Implementing Software Machines in Go and CImplementing Software Machines in Go and C
Implementing Software Machines in Go and C
 
Encrypt all transports
Encrypt all transportsEncrypt all transports
Encrypt all transports
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
 
Whispered secrets
Whispered secretsWhispered secrets
Whispered secrets
 
Privacy is always a requirement
Privacy is always a requirementPrivacy is always a requirement
Privacy is always a requirement
 
Hybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and GoHybrid Cryptography with examples in Ruby and Go
Hybrid Cryptography with examples in Ruby and Go
 
Go a crash course
Go   a crash courseGo   a crash course
Go a crash course
 

Recently uploaded

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
Product School
 

Recently uploaded (20)

FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 

going loopy - adventures in iteration with google go

  • 1. going loopy adventures in iteration with google go ! ! @feyeleanor Going Loopy !1 http://slideshare.net/feyeleanor/
  • 2. the conditional loop Going Loopy !2 http://slides.games-with-brains.net/
  • 3. package main import "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { fmt.Printf("%v: %vn", i, s[i]) } } Going Loopy !3 http://slides.games-with-brains.net/
  • 4. package main import "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { fmt.Printf("%v: %vn", i, s[i]) } } ! ! 0: 1: 2: 3: 4: Going Loopy 0 2 4 6 8 !4 http://slides.games-with-brains.net/
  • 5. package main import "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { fmt.Printf("%v: %vn", i, s[i]) } } Going Loopy !5 http://slides.games-with-brains.net/
  • 6. package main import "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { fmt.Printf("%v: %vn", i, s[i]) } } Going Loopy !6 http://slides.games-with-brains.net/
  • 7. package main import "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { fmt.Printf("%v: %vn", i, s[i]) } } Going Loopy !7 http://slides.games-with-brains.net/
  • 8. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !8 http://slides.games-with-brains.net/
  • 9. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !9 http://slides.games-with-brains.net/
  • 10. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !10 http://slides.games-with-brains.net/
  • 11. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !11 http://slides.games-with-brains.net/
  • 12. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !12 http://slides.games-with-brains.net/
  • 13. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !13 http://slides.games-with-brains.net/
  • 14. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !14 http://slides.games-with-brains.net/
  • 15. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !15 http://slides.games-with-brains.net/
  • 16. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !16 http://slides.games-with-brains.net/
  • 17. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !17 http://slides.games-with-brains.net/
  • 18. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !18 http://slides.games-with-brains.net/
  • 19. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !19 http://slides.games-with-brains.net/
  • 20. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !20 http://slides.games-with-brains.net/
  • 21. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !21 http://slides.games-with-brains.net/
  • 22. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !22 http://slides.games-with-brains.net/
  • 23. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i := 0; i < len(s); i++ { Printf("%v: %vn", i, s[i]) } } Going Loopy !23 http://slides.games-with-brains.net/
  • 24. the infinite loop Going Loopy !24 http://slides.games-with-brains.net/
  • 25. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !25 http://slides.games-with-brains.net/
  • 26. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !26 http://slides.games-with-brains.net/
  • 27. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !27 http://slides.games-with-brains.net/
  • 28. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !28 http://slides.games-with-brains.net/
  • 29. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !29 http://slides.games-with-brains.net/
  • 30. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !30 http://slides.games-with-brains.net/
  • 31. package main import . "fmt" ! func main() { defer func() { recover() }() s := []int{0, 2, 4, 6, 8} i := 0 for i := 0; ; i++ { Printf("%v: %vn", i, s[i]) i++ } } Going Loopy !31 http://slides.games-with-brains.net/
  • 33. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !33 http://slides.games-with-brains.net/
  • 34. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !34 http://slides.games-with-brains.net/
  • 35. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !35 http://slides.games-with-brains.net/
  • 36. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !36 http://slides.games-with-brains.net/
  • 37. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !37 http://slides.games-with-brains.net/
  • 38. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !38 http://slides.games-with-brains.net/
  • 39. a functional interlude Going Loopy !39 http://slides.games-with-brains.net/
  • 40. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s []int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !40 http://slides.games-with-brains.net/
  • 41. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s []int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !41 http://slides.games-with-brains.net/
  • 42. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s []int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !42 http://slides.games-with-brains.net/
  • 43. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s []int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !43 http://slides.games-with-brains.net/
  • 44. package main import . "fmt" ! func main() { print_slice(0, 2, 4, 6, 8) } ! func print_slice(s ...int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !44 http://slides.games-with-brains.net/
  • 45. package main import . "fmt" ! func main() { print_slice(0, 2, 4, 6, 8) } ! func print_slice(s ...int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !45 http://slides.games-with-brains.net/
  • 46. package main import . "fmt" ! func main() { print_slice(0, 2, 4, 6, 8) } ! func print_slice(s ...int) { for i, v := range s { Printf("%v: %vn", i, v) } } Going Loopy !46 http://slides.games-with-brains.net/
  • 48. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { for i, v := range s.([]int) { Printf("%v: %vn", i, v) } } Going Loopy !48 http://slides.games-with-brains.net/
  • 49. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { for i, v := range s.([]int) { Printf("%v: %vn", i, v) } } Going Loopy !49 http://slides.games-with-brains.net/
  • 50. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { for i, v := range s.([]int) { Printf("%v: %vn", i, v) } } Going Loopy !50 http://slides.games-with-brains.net/
  • 51. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !51 http://slides.games-with-brains.net/
  • 52. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !52 http://slides.games-with-brains.net/
  • 53. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !53 http://slides.games-with-brains.net/
  • 54. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !54 http://slides.games-with-brains.net/
  • 55. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !55 http://slides.games-with-brains.net/
  • 56. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { if s, ok := s.([]int); ok { for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !56 http://slides.games-with-brains.net/
  • 57. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !57 http://slides.games-with-brains.net/
  • 58. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !58 http://slides.games-with-brains.net/
  • 59. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !59 http://slides.games-with-brains.net/
  • 60. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !60 http://slides.games-with-brains.net/
  • 61. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !61 http://slides.games-with-brains.net/
  • 62. package main import . "fmt" ! func main() { print_slice([]int{0, 2, 4, 6, 8}) } ! func print_slice(s interface{}) { switch s := s.(type) { case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !62 http://slides.games-with-brains.net/
  • 64. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !64 http://slides.games-with-brains.net/
  • 65. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !65 http://slides.games-with-brains.net/
  • 66. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !66 http://slides.games-with-brains.net/
  • 67. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !67 http://slides.games-with-brains.net/
  • 68. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !68 http://slides.games-with-brains.net/
  • 69. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !69 http://slides.games-with-brains.net/
  • 70. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !70 http://slides.games-with-brains.net/
  • 71. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !71 http://slides.games-with-brains.net/
  • 72. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !72 http://slides.games-with-brains.net/
  • 73. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_slice(func(i int) int { return s[i] }) } ! func print_slice(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } } } Going Loopy !73 http://slides.games-with-brains.net/
  • 75. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !75 http://slides.games-with-brains.net/
  • 76. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !76 http://slides.games-with-brains.net/
  • 77. package main import . "fmt" ! func main() { c := make(chan int, 16) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !77 http://slides.games-with-brains.net/
  • 78. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !78 http://slides.games-with-brains.net/
  • 79. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !79 http://slides.games-with-brains.net/
  • 80. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !80 http://slides.games-with-brains.net/
  • 81. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !81 http://slides.games-with-brains.net/
  • 82. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !82 http://slides.games-with-brains.net/
  • 83. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !83 http://slides.games-with-brains.net/
  • 84. package main import . "fmt" ! func main() { c := make(chan int) go func() { for _, v := range []int{0, 2, 4, 6, 8} { c <- v } close(c) }() Printf("elements: %vn", print_channel(c)) } ! func print_channel(c chan int) (i int) { for v := range c { Printf("%v: %vn", i, v) i++ } return } Going Loopy !84 http://slides.games-with-brains.net/
  • 86. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] * 2 }) } ! func print_values(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !86 http://slides.games-with-brains.net/
  • 87. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] * 2 }) } ! func print_values(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !87 http://slides.games-with-brains.net/
  • 88. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] * 2 }) } ! func print_values(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !88 http://slides.games-with-brains.net/
  • 89. package main import . "fmt" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] * 2 }) } ! func print_values(s interface{}) { switch s := s.(type) { case func(int) int: for i := 0; i < 5; i++ { Printf("%v: %vn", i, s(i)) } case []int: for i, v := range s { Printf("%v: %vn", i, v) } } } Going Loopy !89 http://slides.games-with-brains.net/
  • 90. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface{}) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i)) } } } Going Loopy !90 http://slides.games-with-brains.net/
  • 91. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface{}) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i)) } } } Going Loopy !91 http://slides.games-with-brains.net/
  • 92. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !92 http://slides.games-with-brains.net/
  • 93. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !93 http://slides.games-with-brains.net/
  • 94. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !94 http://slides.games-with-brains.net/
  • 95. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !95 http://slides.games-with-brains.net/
  • 96. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !96 http://slides.games-with-brains.net/
  • 97. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !97 http://slides.games-with-brains.net/
  • 98. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !98 http://slides.games-with-brains.net/
  • 99. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !99 http://slides.games-with-brains.net/
  • 100. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !100 http://slides.games-with-brains.net/
  • 101. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !101 http://slides.games-with-brains.net/
  • 102. package main import . "fmt" import . "reflect" ! func main() { s := []int{0, 2, 4, 6, 8} print_values(s) print_values(func(i int) int { return s[i] }) } ! func print_values(s interface{}) { switch s := ValueOf(s); s.Kind() { case Func: p := []Value{ ValueOf(i) } for i := 0; i < 5; i++ { Printf("%v: %vn", i, s.Call(p)[0].Interface()) } case Slice: for i := 0; i < s.Len(); i++ { Printf("%v: %vn", i, s.Index(i).Interface()) } } } Going Loopy !102 http://slides.games-with-brains.net/
  • 104. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !104 http://slides.games-with-brains.net/
  • 105. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !105 http://slides.games-with-brains.net/
  • 106. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !106 http://slides.games-with-brains.net/
  • 107. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !107 http://slides.games-with-brains.net/
  • 108. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !108 http://slides.games-with-brains.net/
  • 109. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !109 http://slides.games-with-brains.net/
  • 110. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !110 http://slides.games-with-brains.net/
  • 111. package main import . "fmt" ! type Iterable interface { Each(func(interface{})) } ! type IterableSlice []int func (i IterableSlice) Each(f func(interface{})) { for _, v := range i { f(v) } } ! func main() { s := IterableSlice{ 0, 2, 4, 6, 8 } i := 0 s.Each(func(v interface{}) { Printf("%v: %vn", i, v) i++ }) } Going Loopy !111 http://slides.games-with-brains.net/
  • 112. you now know go Going Loopy 112 http://slides.games-with-brains.net/