Language::MzScheme::Env - MzScheme runtime environment
use Language::MzScheme; my $env = Language::MzScheme->new; # ...
None at this moment.
All methods below, except new, returns an Language::MzScheme::Object instance.
new
Constructs and returns a new environment object. Calling this method is identical to Language::MzScheme->new.
Language::MzScheme->new
Given a global MzScheme variable name $name, returns the current value.
$name
Defines a new MzScheme primitive $name from $code, with the calling context $sigil, and returns it.
$code
$sigil
If $sigil is omitted, look at the end of $name for a sigil character; if not found, uses the auto context. See "CONTEXTS" for a list of sigils and their meanings.
If $code is omitted, defines a package with the name $name and import all its symbols. Otherwise, pass it and the sigil to the lambda method, and bind the returned lambda to $name.
lambda
Builds and returns a MzScheme procedure, as a wrapper for $code.
If $code is a Perl code reference, returns a lambda that takes any number of parameters, under the context specified by $sigil:
(func ...) ; ==> $code->(...)
Otherwise, treat $code as a class name or an object, and returns a lambda that takes a mandatory method argument, followed by any number of parameters.
(obj 'method ...) ; ==> $obj->$method(...)
Generally, you should only set $sigil for code references, and let the user specity the context with the method name:
(obj 'set! ...) ; void context (obj 'isa? ...) ; boolean context
Evaluates a MzScheme expression, passed as an object or a string, and returns the result.
Applies a MzScheme procedure, passed as an object or a global name, to @args, and returns the result.
@args
Return a MzScheme object that represents the content of $scalar, which may be a simple scalar or a reference.
$scalar
Returns a MzScheme symbol object named $string.
$string
There are 10 different sigils, each representing a way to interpret values returned by a Perl function or method.
If no sigils are specified, then auto-context is assumed: it will call the perl code with Perl's list context, and look at the number of values returned. If there is exactly one return value, receive it as a scalar; otherwise, returns a MzScheme list that contains all return values.
; list context calls (perl-func "string") ; auto-context (perl-func@ "string") ; a list (perl-func^ "string") ; a vector (perl-func% "string") ; a hash-table (perl-func& "string") ; an association-list ; scalar context calls (perl-func$ "string") ; a scalar of an appropriate type (perl-func~ "string") ; a string (perl-func+ "string") ; a number (perl-func. "string") ; a character (perl-func? "string") ; a boolean (#t or #f) ; void context calls (perl-func! "string") ; always #<void>
Language::MzScheme, Language::MzScheme::Object
Autrijus Tang <autrijus@autrijus.org>
Copyright 2004 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See http://www.perl.com/perl/misc/Artistic.html
To install Language::MzScheme, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Language::MzScheme
CPAN shell
perl -MCPAN -e shell install Language::MzScheme
For more information on module installation, please visit the detailed CPAN module installation guide.