github.com/zignig/go-ipfs@v0.0.0-20141111235910-c9e5fdf55a52/tour/chapter.go (about)

     1  package tour
     2  
     3  import "fmt"
     4  
     5  // returns a partially applied function. 
     6  //
     7  // It's designed to make it easy to re-order chapters with minimal fuss.
     8  //
     9  // eg.
    10  // 		Intro := Chapter(1)
    11  // 		ID("1.1") == Intro(1) == Chapter(1)(1)
    12  func Chapter(number int) func(topic int) ID {
    13  	return func(topic int) ID {
    14  		return ID(fmt.Sprintf("%d.%d", number, topic))
    15  	}
    16  }