11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

58 • Chapter 3: <strong>Programming</strong> with ModulesModules and TypesTwo Maple types are associated with modules. First, the name moduleis a type name. Naturally, an expression is of type module only if it is amodule. When used as a type name, the name module must be enclosedin name quotes (‘).> type( module() end, ’‘module‘’ );true> type( LinearAlgebra, ’‘module‘’ );trueSecondly, a type called moduledefinition identifies expressions thatare module definitions. In the previous example, the module definition> module() end:was evaluated before being passed to type, so the expression that wastested was not the definition, but the module to which it evaluates. Youmust use unevaluation quotes (’) to delay the evaluation of a moduledefinition.> type( ’module() end’, ’moduledefinition’ );trueOther important type tests satisfied by modules are the types atomicand last_name_eval.> type( module() end, ’atomic’ );trueThe procedure map has no effect on modules; they pass through unchanged.> map( print, module() export a, b, c; end );module() export a, b, c;end moduleModules also follow last name evaluation rules. For more informationon last name evaluation rules, see the ?last_name_eval help page.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!