Пример #1
0
func primStr(e Env, head ast.Node, args []ast.Node) ast.Node {
	var buffer bytes.Buffer

	// TODO replace below with calls to .FriendlyString()
	for _, arg := range args {
		buffer.WriteString(arg.FriendlyString())
	}

	return ast.NewStr(buffer.String())
}
Пример #2
0
func primReadableString(e Env, head ast.Node, args []ast.Node) ast.Node {
	return ast.NewStr(args[0].String())
}
Пример #3
0
func primReadLine(e Env, head ast.Node, args []ast.Node) ast.Node {
	s := readLine() // TODO: uses a global variable :(
	trimmed := strings.TrimSuffix(s, "\n")
	return ast.NewStr(trimmed)
}