NAME

Lingua::TT::Unify - Lingua::TT unification utiltities

SYNOPSIS

use Lingua::TT::Unify;

$xnew = unifyClone($x);
$xy = unify($x,$y, $OUTPUT_TOP);
$xy = unifyClobber($x,$y, $OUTPUT_TOP);
$xval = _unify1_top($x,$y);

DESCRIPTION

Globals

Variable: $TOP

Scalar used by _unify() and friends for incompatible unifications

Variable: @EXPORT

@EXPORT By default, "unify"(), "unifyClobber"(), and "unifyClone"() are exported

Variable: %EXPORT_TAGS

Known tags: :default (see @EXPORT), :misc (_unify* subs), :all (everything)

API: Unification

unifyClone
$xnew = unifyClone($x);

Create a deep clone of an object. Default implementation uses Storable::dclone()

unify
$xy = unify($x,$y, $OUTPUT_TOP);

Wrapper for "_unify_guts"() which clones both $x and $y, and inserts $OUTPUT_TOP for failed unifications.

unifyClobber
$xy = unifyClobber($x,$y, $OUTPUT_TOP);

Wrapper for "_unify_guts" which clones both $x and $y, and clobbers old values of $x with new values from $y if unification would produce $TOP.

_unify
$xy = _unify($x,$y, $OUTPUT_TOP);

Wrapper for "_unify_guts" which does NOT clone its arguments. Destructively alters $x, adopts literal references from $y where possible.

Does NOT clobber defined values in $x with undef values in $y; to achieve this, set $y values to $TOP and pass $OUTPUT_TOP=undef.

_unifyClobber
$xy = _unifyClobber($x,$y);

Destructively alters $x, adopts literal references from $y where possible.

_unify_guts
$x_altered = _unify_guts($x,$y,\&unify1_sub,$OUTPUT_TOP);

Guts for all unification routines. Destructively alters $x, adopts literal references from $y where possible. \&unify1_sub is called to perform atomic unifications.

_unify1_top
$xval = _unify1_top($x,$y);

Default atomic unification subroutine called for simple scalars which inserts $TOP for failed unifications.

_unify1_clobber
$xval = _unify1_clobber($x,$y);

Default atomic unification subroutine called for simple scalars which clobbers $x with $y (maps $TOP to undef).

AUTHOR

Bryan Jurish <TT/IO.pm>

COPYRIGHT AND LICENSE

Copyright (C) 2009 by Bryan Jurish

This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.