Documentation ¶
Index ¶
- Variables
- func VClose(ctx *goal.Context, args []goal.V) goal.V
- func VEnv(ctx *goal.Context, args []goal.V) goal.V
- func VFlush(ctx *goal.Context, args []goal.V) goal.V
- func VImport(ctx *goal.Context, args []goal.V) goal.V
- func VOpen(ctx *goal.Context, args []goal.V) goal.V
- func VPrint(ctx *goal.Context, args []goal.V) goal.V
- func VRead(ctx *goal.Context, args []goal.V) goal.V
- func VRun(ctx *goal.Context, args []goal.V) goal.V
- func VSay(ctx *goal.Context, args []goal.V) goal.V
- func VShell(ctx *goal.Context, args []goal.V) goal.V
Constants ¶
This section is empty.
Variables ¶
var Stderr = newFile(os.Stderr)
Stderr represents the standard error filehandle.
var Stdin = newFile(os.Stdin)
Stdin represents the standard input filehandle.
var Stdout = newFile(os.Stdout)
Stdout represents the standard output filehandle.
Functions ¶
func VClose ¶ added in v0.6.0
VClose implements the close monad.
close h : closes a filehandle.
It returns a true value on success, and an error otherwise.
func VEnv ¶ added in v0.6.0
VEnv implements the os.env dyad.
env s : retrieve environment variable s, or return an error if unset. As a special case, "" returns a dictionary representing the whole environment.
x env s : sets the value of the environment variable x to s. It returns a true value of success, and an error otherwise. Also, the special form env[x;0] unsets a variable, and as a special case, env["";0] clears the whole environment.
func VFlush ¶ added in v0.6.0
VFlush implements the flush monad.
flush h : flushes any buffered data to h.
It returns a true value on success.
func VImport ¶
VImport implements the import dyad.
import "name" : evaluate file "name.goal" with prefix "name"
pfx import "name" : evaluate file "name.goal" with custom prefix pfx
It returns 0 and does nothing if a file has already been evaluated.
func VOpen ¶ added in v0.6.0
VOpen implements the open dyad.
open "path" : opens file "path" for reading.
mode open "path" : opens file "path" using the given fopen(3) mode.
mode can be: "r", "r+", "w", "w+", "a", "a+", "|-", "-|".
It returns a filehandle value of type "h" on success, and an error otherwise.
func VPrint ¶
VPrint implements the print dyad.
print x : outputs x to standard output. It returns a true value on success.
h print y : outputs y to w, where w is an io.Writer or a filename (goal.S).
func VRead ¶ added in v0.6.0
VRead implements the read dyad.
read h : reads from filehandle h until EOF or an error occurs.
s read h : reads from filehandle h until delimiter s or EOF, or an error occurs.
n read h : reads n bytes from filehandle h until EOF (returning possibly less than n bytes) or an error occurs.
It returns the read content as a string on success, and an error otherwise.
func VRun ¶ added in v0.6.0
VRun implements the run monad.
run s : run command s, with arguments if s is an array.
x run s : run command s, with input string x.
In the first form, standard input, output, and error are inherited from the parent. It returns a true value on success, and an error otherwise.
In the second form, only standard error is inherited, and the command's standard output is returned.
Types ¶
This section is empty.