Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1995)

Issue 4306045: code review 4306045: A codewalk through a simple program that illustrates se... (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
14 years, 1 month ago by denero
Modified:
14 years ago
Reviewers:
CC:
adg, rsc, iant2, r, golang-dev
Visibility:
Public.

Description

A codewalk through a simple program that illustrates several aspects of Go functions: function objects, higher-order functions, variadic functions, tail recursion, etc. The example program simulates the game of Pig, a dice game with simple rules but a nontrivial solution.

Patch Set 1 #

Patch Set 2 : diff -r c5c62aeb6267 https://go.googlecode.com/hg/ #

Patch Set 3 : diff -r 94fab267e96b https://go.googlecode.com/hg/ #

Total comments: 84

Patch Set 4 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Patch Set 5 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Total comments: 18

Patch Set 6 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Total comments: 4

Patch Set 7 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Patch Set 8 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Total comments: 2

Patch Set 9 : diff -r 7df08a2207e6 https://go.googlecode.com/hg/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+239 lines, -0 lines) Patch
A doc/codewalk/functions.xml View 1 2 3 4 5 6 7 8 1 chunk +115 lines, -0 lines 0 comments Download
A doc/codewalk/pig.go View 1 2 3 4 5 6 7 8 1 chunk +124 lines, -0 lines 0 comments Download

Messages

Total messages: 26
denero
Hello adg (cc: golang-dev@googlegroups.com), I'd like you to review this change to https://go.googlecode.com/hg/
14 years, 1 month ago (2011-03-22 21:36:28 UTC) #1
rsc
FYI http://codereview.appspot.com/4306045/diff/4001/doc/codewalk/functions.xml File doc/codewalk/functions.xml (right): http://codereview.appspot.com/4306045/diff/4001/doc/codewalk/functions.xml#newcode94 doc/codewalk/functions.xml:94: The current 6g and gccgo implementations of Go ...
14 years, 1 month ago (2011-03-23 13:46:03 UTC) #2
denero
Interesting. Ian's reply here (2nd message in thread) hinted that there was. http://groups.google.com/group/golang-nuts/browse_thread/thread/d282193c786b0f36/ffb0a5936d972f32?lnk=raot In this ...
14 years, 1 month ago (2011-03-23 14:31:54 UTC) #3
rsc
On Wed, Mar 23, 2011 at 10:31, John DeNero <denero@google.com> wrote: > Interesting. Ian's reply ...
14 years, 1 month ago (2011-03-23 14:39:37 UTC) #4
iant2
Russ Cox <rsc@golang.org> writes: > On Wed, Mar 23, 2011 at 10:31, John DeNero <denero@google.com> ...
14 years, 1 month ago (2011-03-23 14:52:26 UTC) #5
adg
Thanks very much for writing this. It's a nice example that covers some interesting ground. ...
14 years, 1 month ago (2011-03-28 03:25:26 UTC) #6
rsc
http://codereview.appspot.com/4306045/diff/4001/doc/codewalk/functions.xml File doc/codewalk/functions.xml (right): http://codereview.appspot.com/4306045/diff/4001/doc/codewalk/functions.xml#newcode37 doc/codewalk/functions.xml:37: In Pig, an action maps from a pigState to ...
14 years, 1 month ago (2011-03-28 03:35:01 UTC) #7
denero
Hello adg, rsc, iant2 (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-05 18:25:09 UTC) #8
denero
Thanks very much for all the comments. The codewalk is cleaner and shorter now, and ...
14 years ago (2011-04-05 18:26:04 UTC) #9
denero
Hello adg, rsc, iant2 (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-06 02:51:39 UTC) #10
r
some quick comments http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/functions.xml File doc/codewalk/functions.xml (right): http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/functions.xml#newcode18 doc/codewalk/functions.xml:18: Pig is a two-player game played ...
14 years ago (2011-04-07 17:45:10 UTC) #11
r
http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/pig.go File doc/codewalk/pig.go (right): http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/pig.go#newcode59 doc/codewalk/pig.go:59: state := state{0, 0, 0} // Initial game state ...
14 years ago (2011-04-07 18:23:51 UTC) #12
denero
Hello adg, rsc, iant2, r (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-07 21:39:20 UTC) #13
rsc
The code is very nice now. http://codereview.appspot.com/4306045/diff/16003/doc/codewalk/pig.go File doc/codewalk/pig.go (right): http://codereview.appspot.com/4306045/diff/16003/doc/codewalk/pig.go#newcode43 doc/codewalk/pig.go:43: // A policy ...
14 years ago (2011-04-07 21:43:38 UTC) #14
denero
Hello adg, rsc, iant2, r (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-07 21:44:46 UTC) #15
denero
Thanks. All good suggestions. Sorry for the trigger-happy multiple mailings. http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/functions.xml File doc/codewalk/functions.xml (right): http://codereview.appspot.com/4306045/diff/15001/doc/codewalk/functions.xml#newcode18 ...
14 years ago (2011-04-07 21:45:10 UTC) #16
denero
Hello adg, rsc, iant2, r (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-07 21:50:00 UTC) #17
denero
Thanks. http://codereview.appspot.com/4306045/diff/16003/doc/codewalk/pig.go File doc/codewalk/pig.go (right): http://codereview.appspot.com/4306045/diff/16003/doc/codewalk/pig.go#newcode43 doc/codewalk/pig.go:43: // A policy (or player strategy) chooses an ...
14 years ago (2011-04-07 21:50:27 UTC) #18
rsc
>> Given the parenthetical, why not just call it a strategy? >> Also the s ...
14 years ago (2011-04-07 21:54:28 UTC) #19
r
i agree with russ that 'strategy' is a better word than policy, but it's not ...
14 years ago (2011-04-07 21:56:53 UTC) #20
denero
Hello adg, rsc, iant2, r (cc: golang-dev@googlegroups.com), Please take another look.
14 years ago (2011-04-07 23:25:49 UTC) #21
denero
Outvoted. "Strategy" it is. http://codereview.appspot.com/4306045/diff/18002/doc/codewalk/pig.go File doc/codewalk/pig.go (right): http://codereview.appspot.com/4306045/diff/18002/doc/codewalk/pig.go#newcode106 doc/codewalk/pig.go:106: } On 2011/04/07 21:56:53, r ...
14 years ago (2011-04-07 23:26:41 UTC) #22
r
LGTM anyone else have comments before i submit it?
14 years ago (2011-04-07 23:36:51 UTC) #23
adg
LGTM A great resource. Thanks, John!
14 years ago (2011-04-08 00:58:42 UTC) #24
rsc
LGTM
14 years ago (2011-04-08 00:59:49 UTC) #25
r
14 years ago (2011-04-08 01:05:19 UTC) #26
*** Submitted as http://code.google.com/p/go/source/detail?r=56f8b1cc5129 ***

A codewalk through a simple program that illustrates several aspects of Go
functions: function objects, higher-order functions, variadic functions, tail
recursion, etc.  The example program simulates the game of Pig, a dice game with
simple rules but a nontrivial solution.

R=adg, rsc, iant2, r
CC=golang-dev
http://codereview.appspot.com/4306045

Committer: Rob Pike <r@golang.org>
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b