home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Press 1997 July
/
Sezamfile97_1.iso
/
msdos
/
misc
/
sm30a.a03
/
SYMBMATH.H06
< prev
next >
Wrap
Text File
|
1993-11-07
|
1KB
|
21 lines
3.1.5.6 Procedures
A procedure is similar to a function, but the right side of
assigment in its definition is multi statements grouped by block().
block(a,b,c) groups a,b,c and only returns the last arguement as its
value, or returns the second last arguement as its value if the last
arguement is local(). It is used as grouper in definition of a procedure.
All variables in block are global, except for variables declared by
local().
e.g. f(x_):=block(p:=x^6,p,local(p))
Remember that you can split a line of program into multi-lines
program at comma ,.
3.1.5.7 Rules
Defining rules is similar to defining functions. In definition
of function, all arguements of function are simple variables, but in
definition of rules, the first arguement may be a complicated expression.
e.g.
f(x_,y_) := x^2+y^2 # defining function
f(x_,y_) := block(a:=2, a+x^2+y) # defining procedure
log(x_ * y_) := log(x)+log(y) # defining rule