These little functions are defined in package Poly. Due to the namespace import they are directly available in all rulefiles and included perl modules.

max($x, $y); min($x, $y);
self-explanatory
assign_min($min, $x); assign_max($max, $x); assign_min_max($min, $max, $x);
the same as $min=min($min, $x); etc.
uniq(@list); sorted_uniq(@list); num_sorted_uniq(@list);
return the list without duplicates; sorted variants are optimized for the assumption that the input is already lexicographically or numerically sorted.
binsearch(\@list, , );
performs a binary search for $x in the list. Returns a boolean TRUE if found, FALSE otherwise. The list is assumed increasingly sorted (decreasingly if $order==-1).
dbg_print(...); warn_print(...); err_print(...);
Display messages of the certain category. Currently everything goes to STDERR and is distiguished only by a prefix. This may change with the further evolving of the interactive facilities in `polymake`.

### Rooting in perl guts

is_array($ref);
return TRUE if $ref points to a real array or a class overloading the array access operations
is_object($ref);
return TRUE if $ref points to an object
is_hash($ref);
return TRUE if $ref points to a hash array, possibly blessed into some package
is_numeric($x); is_integer($x); is_float($x);
return TRUE if $x is a number (of a certain type)
refnct($x);
return the perl reference count of a variable, or, if it is a reference, of an object behind it
weak($ref);
make a weak copy of the reference
isweak($ref);
tell whether the reference is weak
readonly($x);
make the given variable $x write-protected. An attempt to change its value raises an exception. If is an array reference, each array element is made write-protected too.
readwrite($x);
remove the write protection imposed by readonly.
retrieve($array_ref, $i);
Get the $i-th element of an array pointed by $ref, circumventing the overloaded array access operations.
is_lvalue($code_ref); is_method($code_ref);
tell whether the subroutine is declared with attributes lvalue and method.
declare_lvalue($code_ref);
assign the lvalue attribute to an existing subroutine
set_prototype($code_ref, $proto);
assign the prototype to an existing subroutine
set_method($code_ref, $proto);
assign the method attribute to an existing subroutine
method_name($code_ref); method_owner($code_ref);
return the name of and the package the referenced subroutine belongs to
sub_pkg($code_ref);
return the compilation package of the referenced subroutine
sub_file($code_ref);
return the name of the source file where the referenced subroutine was defined
define_function($package_name, $sub_name, $coderef, $create_new_pkg=0);
make the referenced subroutine look like a sub $package_name::$sub_name. The old subroutine with the given name, if any, is unimported from the package.
If create_new_pkg is TRUE, a new package will be create if needed.
define_unique_function($package_name, $sub_name, $coderef);
like above, but refuses to overwrite existing functions, returning undef.
unimport_function(*glob);
remove the imported function pointed by the given glob. Unlike by undef &sub, it's only the reference from another package's symbol table that gets destroyed, not the subroutine body.
get_pkg($package_name, $create_new_pkg=0);
return the hash reference to the symbol table of the given package (stash in perl jargon). If create_new_pkg is TRUE, a new (empty) package will be create if needed.
inherit_class($new_ref, $obj_ref);
an accelerated version of bless($new_ref, ref($obj_ref))
symtable_of($obj_ref);
an accelerated version of get_pkg(ref($obj_ref))