Previous Page Next Page Contents

loadproc -- load an object on demand

Introduction

loadproc loads a MuPAD object from a file when it is first accessed.

Call(s)


object := loadproc(object, path, file)

Parameters

object - any MuPAD object that is a valid left hand side for an assignment
path - a relative path name with a terminating path separator: a string
file - a file name without suffix: a string

Returns

an element of the domain stdlib::LoadProc (see ``Background'' below).

Related Functions

export, finput, fread, LIBPATH, loadmod, package, pathname, Pref::verboseRead, read

Details

Example 1

At system startup, the identifier int is initialized as follows:

>> int := loadproc(int, pathname("STDLIB"), "int"):

This tells the system that it finds the actual definition of the integration function int in the file "STDLIB/int.mu", relative to the library path specified by LIBPATH, which by default points to MuPAD's installation directory.

When you first use int, e.g., by entering the command int(t^2,t), MuPAD automatically loads the file "STDLIB/int.mu". This file contains the following lines defining the actual function environment int:

      int := funcenv(
      proc(f, x = null()) 
      begin
        if args(0) = 0 then error("No argument given") end_if;    
        ...
      end_proc):

After the file has been read, the function environment is returned as the value of int, and then the system proceeds as usual: the call int(t^2,t) is executed and its result t^3/3 is returned.

Background

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000