Name:

rename rename the free variable.

Library name:

void sollya_lib_name_free_variable(const char *)

Usage:

rename(ident1,ident2) : void

Parameters:

Description:

Example 1:

   > f=sin(x);
   > f;
   sin(x)
   > rename(x,y);
   > f;
   sin(y)

Example 2:

   > a=1;
   > f=sin(x);
   > rename(x,a);
   > a;
   a
   > f;
   sin(a)

Example 3:

   > verbosity=1!;
   > f=sin(x);
   > rename(y, z);
   Warning: the current free variable is named "x" and not "y". Can only rename the free variable.
   The last command will have no effect.
   > rename(_x_, z);
   Information: the free variable has been renamed from "x" to "z".

Example 4:

   > verbosity=1!;
   > rename(x,y);
   Information: the free variable has been named "y".
   > isbound(x);
   false
   > isbound(y);
   true

Example 5:

   > verbosity=1!;
   > f = sin(x);
   > new_varname = "foo";
   > rename(_x_, new_varname);
   Information: the free variable has been renamed from "x" to "new_varname".
   > f;
   sin(new_varname)
   > rename(_x_, x);
   Information: the free variable has been renamed from "new_varname" to "x".
   > new_varname = "foo";
   > str = "rename(_x_, " @ new_varname @ ");";
   > (parse("proc () { " @ str @ "}"))();
   Information: the free variable has been renamed from "x" to "foo".
   > f;
   sin(foo)
See also: isbound, parse
Go back to the list of commands