5.2 Assign

• Assign( <expression>, <variable>, <value> ).
• Description: that function evaluate the <value> and assign it to the variable called <variable> in <expression>1 . The function Assign returns the Nil value. That function is useful to write macros that take an expression as parameter and has to evaluate it
• Exemple(s): here is a macro Bof that takes a function f(t) as a parameter and calculate the list $\left[f\left(0\right),f\left(1\right),...,f\left(5\right)\right]$:
for \$k from 0 to 5 do Assign(%1,t,k), %1 od

%1 represents the first parameter of the macro (that is f(t)), the loop: for k from 0 to 5 executes the command [Assign(%1, t, k), %1], that is assigning the value k to the variable $t$ in the expression %1, then evaluate %1. The execution of Bof(t^2) gives : [0,1,4,9,16,25]. The execution of Bof(x^2) gives Nil.