How to clear defined functions ?
SomebodyLikeEveryBody opened this issue · 2 comments
SomebodyLikeEveryBody commented
Hello,
as it is possible to declare variables with
nerdamer.setVars('x', '42');
and forget it with
nerdamer.clearVars();
how can we forget functions we declared using,
nerdamer.setFunction('f'. ['x'], 'x^2');
is there any nerdamer.clearFunctions() feature ?
Thank you !
jiggzson commented
@SomebodyLikeEveryBody, you're right. There isn't a prescribed way of achieving this. Something that may have to be looked into. In the meantime, deleting it from the functions list in the parser should do.
// Set a new function
nerdamer.setFunction('f', ['x'], 'x^2');
// It works
console.log(nerdamer('f(x^6)').toString())
// Delete the function "f" from the functions list in the parser
delete nerdamer.getCore().PARSER.functions.f
// It's gone
console.log(nerdamer('f(x^6)').toString())
SomebodyLikeEveryBody commented
@jiggzson Thank you very much !