예제 #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)
}