Below code in python:
def print_all(x):
print(x)
return print_all
allows to call print_all(1)(2) or print_all(1)(2)(3)(4)
Edit
Another example in python:
def print_sums(x):
print(x)
def next_sum(y):
return print_sums(x+y)
return next_sum
print_sums(1)(3)(5)
which maps to syntax:
package main
import "fmt"
type printsumfunctype func(x int) printsumfunctype
func printSums(x int) printsumfunctype {
fmt.Println(x)
var nextSum func(y int) printsumfunctype
nextSum = func(y int) printsumfunctype {
return printSums(x + y)
}
return nextSum
}
func main() {
printSums(1)(2)(3)
}
In GoLang, function is first class
1) What is the syntax to self reference a function in GoLang?
2) What is the preferred naming convention to define types like printsumfunctype?