|
EDA365欢迎您!
您需要 登录 才可以下载或查看,没有帐号?注册
x
@optional Option
The @optional option gives you another way to specify a flexible number of arguments.With
@optional, each argument on the actual argument list is matched up with an argument on
the formal argument list.
You can provide any optional parameter with a default value. Specify the default value using
a default form. The default form is a two-member list. The first member of this list is the
optional parameter’s name. The second member is the default value.
The default value is assigned only if no value is assigned when the function is called. If the
procedure does not specify a default value for an argument, nil is assigned.
If you place @optional in the argument list of a procedure definition, any parameter following
it is considered optional.
The trBuildBBox function builds a bounding box.
procedure( trBuildBBox( height width @optional
( xCoord 0 ) ( yCoord 0 ) )
list(
xCoord:yCoord ;;; lower left
xCoord+width:yCoord+height ) ;;; upper right
) ; procedure
Both length and width must be specified when this function is called. However, the
coordinates of the box are declared as optional parameters. If only two parameters are
specified, the optional parameters are given their default values. For xCoord and yCoord,
those values are 0.
Examine the following calls to trBuildBBox and their return values:
trBuildBBox( 1 2 ) => ((0 0) (2 1))
trBuildBBox( 1 2 4 ) => ((4 0) (6 1))
trBuildBBox( 1 2 4 10) => ((4 10) (6 11))
以上是原文!!
我直接用了些程序试验提示说:function trBuildBBox redefined
以下是我复制的程序:
procedure( trBuildBBox( height width @optional
( xCoord 0 ) ( yCoord 0 ) )
list(
xCoord:yCoord ;;; lower left
xCoord+width:yCoord+height ) ;;; upper right
) ; procedure
trBuildBBox( 1 2 )
想知道我哪里出问题了!!
谢谢! |
|