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

commit 512ffb4e4fa5572d9424f00c0e3ba8cc791b31ed
parent 3b81581ee3f2451150ce1dfdbf232c6102eee82c
Author: Alexander Burger <abu@software-lab.de>
Date:   Wed, 21 Sep 2011 08:07:33 +0200

'import' symbols function
Mdoc/refI.html | 19+++++++++++++++++--
Mdoc/refP.html | 8++++----
Mdoc/refS.html | 3++-
Mlib.l | 7++++++-
5 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/CHANGES b/CHANGES @@ -1,4 +1,5 @@ * XXsep11 picoLisp-3.0.8 + 'import' symbols function Namespace support with 'symbols' (64-bit) Bug in '@' lambda bindings (32-bit) GC bug in 64-bit bignums diff --git a/doc/refI.html b/doc/refI.html @@ -154,6 +154,19 @@ OK -> OK </code></pre> +<dt><a name="import"><code>(import lst) -> NIL</code></a> +<dd>Wrapper function for <code><a href="refI.html#intern">intern</a></code>. +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>. + +<pre><code> +: (import libA~foo libB~bar) +-> NIL +</code></pre> + <dt><a name="in"><code>(in 'any . prg) -> any</code></a> <dd>Opens <code>any</code> as input channel during the execution of <code>prg</code>. The current input channel will be saved and restored @@ -290,8 +303,10 @@ href="refR.html#replace">replace</a></code>. <dt><a name="intern"><code>(intern 'sym) -> sym</code></a> <dd>Creates or finds an internal symbol. If a symbol with the name <code>sym</code> is already intern, it is returned. Otherwise, <code>sym</code> -is interned and returned. See also <code><a href="refZ.html#zap">zap</a></code>, -<code><a href="refE.html#extern">extern</a></code> and <code><a +is interned and returned. See also <code><a +href="refS.html#symbols">symbols</a></code>, <code><a +href="refZ.html#zap">zap</a></code>, <code><a +href="refE.html#extern">extern</a></code> and <code><a href="ref_.html#====">====</a></code>. <pre><code> diff --git a/doc/refP.html b/doc/refP.html @@ -244,10 +244,10 @@ href="refE.html#extract">extract</a></code>. <dd>(64-bit version only) A global constant holding the initial (default) namespace of internal symbols. Its value is a cons pair of two '<code><a href="refI.html#idx">idx</a></code>' trees, one for symbols with short names and -one for symbols with long names (more than 7 bytes in the name). -See also -<code><a href="refS.html#symbols">symbols</a></code> and -<code><a href="refI.html#intern">intern</a></code>. +one for symbols with long names (more than 7 bytes in the name). See also +<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) diff --git a/doc/refS.html b/doc/refS.html @@ -905,7 +905,8 @@ current namespace is set to <code>sym1</code>, and the previous namespace <code>sym2</code> is returned. In the third form, <code>sym1</code> is assigned a 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> and <code><a +href="refP.html#pico">pico</a></code>, <code><a +href="refI.html#import">import</a></code> and <code><a href="refI.html#intern">intern</a></code>. <pre><code> diff --git a/lib.l b/lib.l @@ -1,4 +1,4 @@ -# 20sep11abu +# 21sep11abu # (c) Software Lab. Alexander Burger (de task (Key . Prg) @@ -236,6 +236,11 @@ (loc S (car X)) (loc S (cdr X)) ) ) ) ) +(de import Lst + (for Sym Lst + (unless (== Sym (intern Sym)) + (quit "Import conflict" Sym) ) ) ) + ### OOP ### (de class Lst (let L (val (setq *Class (car Lst)))