combining 'constant and 'global for a "standard library

Notices and updates
Locked
Tim Johnson
Posts: 253
Joined: Thu Oct 07, 2004 7:21 pm
Location: Palmer Alaska USA

combining 'constant and 'global for a "standard library

Post 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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post 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

Tim Johnson
Posts: 253
Joined: Thu Oct 07, 2004 7:21 pm
Location: Palmer Alaska USA

Post by Tim Johnson »

Understood. Yes the link says it all...
thanks
tj

Locked