Skip to content

Instantly share code, notes, and snippets.

@satabin
Created November 15, 2012 16:37
Show Gist options
  • Select an option

  • Save satabin/4079603 to your computer and use it in GitHub Desktop.

Select an option

Save satabin/4079603 to your computer and use it in GitHub Desktop.
package main
func fact(i int) int {
var aux func(int, int) int
aux = func(k int, acc int) int {
if(k == 0) {
return acc
} else {
return aux(k - 1, k * acc)
}
}
return aux(i, 1)
}
func main() {
println(fact(19))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment