Page 1 of 1

combining 'constant and 'global for a "standard library

Posted: Sun Apr 27, 2008 7:38 pm
by Tim Johnson
Let's say that I want a 'standard library' with functions available
globally and I _don't_ meself to mistakenly futz with these functions.

Here's what appears to work:

Code: Select all

(set 'f '(putb ltrim ltrims)) ;; previously 'defined functions
(apply global f)
(apply constant f)
Brief tests seems to support that this works, but I would welcome
any comments, caveats or other ways to do this.
Thanks
Tim

Posted: Sun Apr 27, 2008 9:11 pm
by Lutz
Think functional: the return value from the 'global' function is the symbol, so it can be used directly by constant ;-)

Code: Select all

(map constant (map global '(putb ltrim ltrims)))
see here: http://www.newlisp.org/downloads/newlis ... protection

Posted: Sun Apr 27, 2008 10:27 pm
by Tim Johnson
Understood. Yes the link says it all...
thanks
tj