func docString(fn *sexp.Func) string {
	docString := strings.Replace(fn.DocString, `"`, `\"`, -1)
	if len(fn.Params) == 0 {
		return docString
	}
	// Add signature information for eldoc.
	params := append(make([]string, 0, len(fn.Params)), fn.Params...)
	if fn.Variadic {
		params[len(params)-1] = "&rest " + params[len(params)-1]
	}
	eldocSig := "\n(fn " + strings.Join(params, " ") + ")"
	if docString != "" {
		return docString + eldocSig
	}
	return "\n" + eldocSig
}
Return extended function documentation string.
package export
import (
	"exn"
	"sexp"
	"strings"
)
func argsDescriptor(fn *sexp.Func) int {
	arity := len(fn.Params)
	if arity > 127 {
		panic(exn.User("can not have more than 127 positional parameters"))
	}
	positionalArgs := uint32(arity)  
	const variadicBit = 128          
	totalArgs := uint32(arity << 8)  
	if fn.Variadic {
		return int(positionalArgs + variadicBit + totalArgs)
	}
	return int(positionalArgs + totalArgs)
}