picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit 0c86279bd5726635f923c203f20a1509be189801
parent a4f87d82b3c74e0f9c64cf07ca2c84e1d73c54e2
Author: Alexander Burger <abu@software-lab.de>
Date:   Mon, 10 Oct 2011 09:00:08 +0200

'local' symbols function
Diffstat:
MCHANGES | 1+
Mdoc/refI.html | 3++-
Mdoc/refL.html | 18++++++++++++++++++
Mdoc/refS.html | 1+
Mlib.l | 5++++-
5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * XXdec11 picoLisp-3.0.9 + 'local' symbols function 'open' optional 'flg' argument * 30sep11 picoLisp-3.0.8 diff --git a/doc/refI.html b/doc/refI.html @@ -160,7 +160,8 @@ Typically used to import symbols from other namespaces, as created by <code><a href="refS.html#symbols">symbols</a></code>. <code>lst</code> should be a list of symbols. An import conflict error is issued when a symbol with the same name already exists in the current namespace. See also <code><a -href="refP.html#pico">pico</a></code>. +href="refP.html#pico">pico</a></code> and <code><a +href="refL.html#local">local</a></code>. <pre><code> : (import libA~foo libB~bar) diff --git a/doc/refL.html b/doc/refL.html @@ -438,6 +438,24 @@ href="ref.html#transient">transient</a></code> symbol with the same name as -> NIL </code></pre> +<dt><a name="local"><code>(local lst) -> sym</code></a> +<dd>Wrapper function for <code><a href="refZ.html#zap">zap</a></code>. Typically +used to create namespace-local symbols. <code>lst</code> should be a list of +symbols. See also <code><a href="refP.html#pico">pico</a></code>, <code><a +href="refS.html#symbols">symbols</a></code>, <code><a +href="refI.html#import">import</a></code> and <code><a +href="refI.html#intern">intern</a></code>. + +<pre><code> +(symbols 'myLib 'pico) + +(local bar foo) +(de foo (A) # 'foo' is local to 'myLib' + ... +(de bar (B) # 'bar' is local to 'myLib' + ... +</code></pre> + <dt><a name="locale"><code>(locale 'sym1 'sym2 ['sym3])</code></a> <dd>Sets the current locale to that given by the country file <code>sym1</code> and the language file <code>sym2</code> (both located in the "loc/" directory), diff --git a/doc/refS.html b/doc/refS.html @@ -907,6 +907,7 @@ a <code><a href="refB.html#balance">balance</a></code>d copy of an existing namespace <code>sym2</code> and becomes the new current namespace, returning the previous namespace <code>sym3</code>. See also <code><a href="refP.html#pico">pico</a></code>, <code><a +href="refL.html#local">local</a></code>, <code><a href="refI.html#import">import</a></code> and <code><a href="refI.html#intern">intern</a></code>. diff --git a/lib.l b/lib.l @@ -1,4 +1,4 @@ -# 21sep11abu +# 09oct11abu # (c) Software Lab. Alexander Burger (de task (Key . Prg) @@ -236,6 +236,9 @@ (loc S (car X)) (loc S (cdr X)) ) ) ) ) +(de local Lst + (mapc zap Lst) ) + (de import Lst (for Sym Lst (unless (== Sym (intern Sym))