The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Inline::MzScheme - Inline module for the PLT MzScheme interpreter

VERSION

This document describes version 0.05 of Inline::MzScheme, released June 13, 2004.

SYNOPSIS

    use subs 'perl_multiply'; # have to declare before Inline runs

    use Math::BigInt;
    use Inline MzScheme => q{
        (define (square x) (perl-multiply x x))
        (define assoc-list '((1 . 2) (3 . 4) (5 . 6)))
        (define linked-list '(1 2 3 4 5 6))
        (define hex-string (bigint 'as_hex))
    }, (bigint => Math::BigInt->new(1792));

    sub perl_multiply { $_[0] * $_[1] }

    print square(10);           # 100
    print $hex_string;          # 0x700
    print $assoc_list->{1};     # 2
    print $linked_list->[3];    # 4

DESCRIPTION

This module allows you to add blocks of Scheme code to your Perl scripts and modules.

All user-defined procedures in your Scheme code will be available as Perl subroutines; association lists and hash tables are available as Perl hash refereces; lists and vectors available as array references; boxed values become scalar references.

Perl subroutines in the same package are imported as Scheme primitives, as long as they are declared before the use Inline MzScheme line.

Non-word characters in Scheme identifiers are turned into _ for Perl. Underscores in Perl identifiers are turned into - for Scheme.

Additional objects, classes and procedures may be imported into Scheme, by passing them as config parameters to use Inline. See Inline for details about this syntax.

You can invoke perl objects in Scheme code with the syntax:

    (object 'method arg1 arg2 ...)

If your method takes named argument lists, this will do:

    (object 'method 'key1 val1 'key2 val2)

For information about handling MzScheme data in Perl, please see Language::MzScheme. This module is mostly a wrapper around Language::MzScheme::scheme_eval_string with a little auto-binding magic for procedures and input variables.

ACKNOWLEDGEMENTS

Thanks to Sam Tregar's Inline::Guile for showing me how to do this.

SEE ALSO

Language::MzScheme, Inline

AUTHORS

Autrijus Tang <autrijus@autrijus.org>

COPYRIGHT

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