newLISP Fan Club

Forum => newLISP newS => Topic started by: Tim Johnson on April 27, 2008, 12:38:18 PM

Title: combining 'constant and 'global for a "standard library
Post by: Tim Johnson on April 27, 2008, 12:38:18 PM
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:

(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
Title:
Post by: Lutz on April 27, 2008, 02:11:14 PM
Think functional: the return value from the 'global' function is the symbol, so it can be used directly by constant ;-)



(map constant (map global '(putb ltrim ltrims)))


see here: http://www.newlisp.org/downloads/newlisp_manual.html#protection
Title:
Post by: Tim Johnson on April 27, 2008, 03:27:34 PM
Understood. Yes the link says it all...

thanks

tj