putd
putd(s_functionNameu_functionDef) =>u_functionDef
Description
Assigns a new function binding, which must be a function, a lambda expression, or nil, to a function name. If you just want to define a function, use procedure or defun.
Assigns the function definition of u_functionDef to s_functionName. This is different from alias, which does a macro expansion when evaluated. You can undefine a function name by setting its function binding to nil. A function name can be write-protected by the system to protect you from unintentional name collisions, in which case you cannot change the function binding of that function name using putd.
If you just want to define a function, use procedure or defun.
Arguments
|
New function binding, which must be a binary function, a |
Value Returned
|
Function definition, which is either a binary function or a SKILL expression. |
Examples
Assigns the function mySqrt the same definition as sqrt.
putd( 'mySqrt getd( 'sqrt ))
=> lambda:sqrt
Assigns the symbol newFn a function definition that prints the string This is a new function when called.
putd( 'newFn lambda( () println( "This is a new function" )))
=> funobj:0x3cf088
Related Topics
Function and Program Structure
Return to top