../misc/cgo/life ../misc/cgo/test \
../misc/dashboard/builder ../misc/goplay\
../doc/codelab/wiki\
- ../test/bench/shootout ../test/garbage
+ ../test/bench/shootout ../test/bench/garbage
do
# Do not use gomake here. It may not be available.
$MAKE -C "$GOROOT/src/$i" clean
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
-include ../../src/Make.inc
+include ../../../src/Make.inc
ALL=\
parser\
"time"
)
-
type Number struct {
next *Number
}
-
// -------------------------------------
// Peano primitives
func zero() *Number { return nil }
-
func is_zero(x *Number) bool { return x == nil }
-
func add1(x *Number) *Number {
e := new(Number)
e.next = x
return e
}
-
func sub1(x *Number) *Number { return x.next }
-
func add(x, y *Number) *Number {
if is_zero(y) {
return x
return add(add1(x), sub1(y))
}
-
func mul(x, y *Number) *Number {
if is_zero(x) || is_zero(y) {
return zero()
return add(mul(x, sub1(y)), x)
}
-
func fact(n *Number) *Number {
if is_zero(n) {
return add1(zero())
return mul(fact(sub1(n)), n)
}
-
// -------------------------------------
// Helpers to generate/count Peano integers
return zero()
}
-
func count(x *Number) int {
if is_zero(x) {
return 0
return count(sub1(x)) + 1
}
-
func check(x *Number, expected int) {
var c = count(x)
if c != expected {
}
}
-
// -------------------------------------
// Test basic functionality
check(fact(gen(5)), 120)
}
-
// -------------------------------------
// Factorial
}
t1, t2, t3, t4, t5 := tukey5(st.PauseNs[0:nn])
fmt.Printf("garbage.%sPause5: %d %d %d %d %d\n", name, t1, t2, t3, t4, t5)
-
-// fmt.Printf("garbage.%sScan: %v\n", name, st.ScanDist)
+
+ // fmt.Printf("garbage.%sScan: %v\n", name, st.ScanDist)
}
type T []uint64
-func (t T) Len() int { return len(t) }
-func (t T) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
+
+func (t T) Len() int { return len(t) }
+func (t T) Swap(i, j int) { t[i], t[j] = t[j], t[i] }
func (t T) Less(i, j int) bool { return t[i] < t[j] }
func tukey5(raw []uint64) (lo, q1, q2, q3, hi uint64) {
set -e
-eval $(gomake --no-print-directory -f ../../src/Make.inc go-env)
+eval $(gomake --no-print-directory -f ../../../src/Make.inc go-env)
PATH=.:$PATH
havegccgo=false