Re: help with packages

MichaƂ Herda | Keepit via Sbcl-help <[email protected]> Thu, 11 Jun 2026 14:36:53 +0000
Newsgroups gmane.lisp.steel-bank.general
Message-ID <VI0PR03MB104205A9D5C1DC2C9A9F8E4B9C41B2@VI0PR03MB10420.eurprd03.prod.outlook.com>
--===============2836244358438778549==
Content-Language: en-US
Content-Type: multipart/alternative;
	boundary="_000_VI0PR03MB104205A9D5C1DC2C9A9F8E4B9C41B2VI0PR03MB10420eu_"

--_000_VI0PR03MB104205A9D5C1DC2C9A9F8E4B9C41B2VI0PR03MB10420eu_
Content-Type: text/plain; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

Export N, E, W, S from package TEST1 and use it in TEST2, or otherwise impo=
rt the symbols. Otherwise you are comparing TEST1::N and TEST::2 for equali=
ty; they are not the same symbol, so the set difference will not treat them=
 as equal.

Alternatively, just use keywords: :N, :E, :W, :S will work fine.
________________________________
From: Shadrock Uhuru <[email protected]>
Sent: Thursday, June 11, 2026 4:30 PM
To: [email protected] <[email protected]>
Subject: [Sbcl-help] help with packages

[Some people who received this message don't often get email from niyalevi@=
gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderId=
entification ]

;; ------------------------------------------------------------------------
CL(1): (defpackage test1
  (:use :cl)
  (:export :test))
#<PACKAGE "TEST1">

CL(2): (in-package :test1)
#<PACKAGE "TEST1">

TEST1(3):

(defun test (test-val)                       ;; remove items from a list
  (format t "~%the test-val =3D ~a " test-val) ;; items to remove
  (let ((diff-list (set-difference (list 'N 'E 'W 'S) test-val)))  ;; remov=
e the items
    (format t "~%the first item of test-val =3D ~a "(first  test-val))  ;; =
just to prove we get the function parameter
                                                                      ;; an=
d we can operate on it
    (format t "~%the diff-list =3D ~a " diff-list)                     ;; t=
he resultant list
    (dolist (each-item diff-list)                  ;; get each item of resu=
ltant list
    (format t "~%each item =3D ~a" each-item))))     ;; print item

TEST
TEST1(4): (test (list 'N 'S))

the test-val =3D (N S)
the first item of test-val =3D N
the diff-list =3D (W E)
each item =3D W
each item =3D E
NIL


TEST1(5): (defpackage test2
  (:use :cl))
#<PACKAGE "TEST2">

TEST1(6): (in-package :test2)
#<PACKAGE "TEST2">

TEST2(7) (test1:test (list 'N 'S))

the test-val =3D (N S)
the first item of test-val =3D N
the diff-list =3D (S W E N)
each item =3D S
each item =3D W
each item =3D E
each item =3D N
NIL

TEST2(8):

;; ---------------------------------------------
SBCL 2.6.4.openbsd.sbcl-2.6.4

hi everyone
the function above works when i call it within the package it was created i=
n
but when i call it from another package the call to set-difference
appears to get an empty list as its second parameter,
as the test function works when called from it home package,
i'm assuming that the problem lies with how the packages are set up.
can anyone point me to the error in my code.
thanks shadrock


_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help



This e-mail is sent to you from Keepit A/S. Dedicated SaaS Data Protection.
VAT: DK30806883, Per Henrik Lings All=E9 4, 7., DK-2100 Copenhagen O, Denma=
rk.

This e-mail is sent to you directly and is meant for nobody else. If the e-=
mail contains personal data that Keepit is responsible for and the e-mail w=
as not meant for you, please do not forward, distribute, or copy, i.e. but =
return the e-mail to sender. Also, do not send the e-mail to a third party =
without making sure that you have our prior consent. Distribution of this e=
-mail to unauthorized receivers may have legal consequences.
If you have received an e-mail from us and you don't know why, then please =
refer to our Privacy Policy<https://www.keepit.com/privacy-policy/>.
If you do not want to receive more e-mails from us, please contact business=
[email protected]<mailto:[email protected]>.

--_000_VI0PR03MB104205A9D5C1DC2C9A9F8E4B9C41B2VI0PR03MB10420eu_
Content-Type: text/html; charset="iso-8859-2"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
2">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Export N, E, W, S from package TEST1 and use it in TEST2, or otherwise impo=
rt the symbols. Otherwise you are comparing TEST1::N and TEST::2 for equali=
ty; they are not the same symbol, so the set difference will not treat them=
 as equal.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; c=
olor: rgb(0, 0, 0);">
Alternatively, just use keywords: :N, :E, :W, :S will work fine.</div>
<div id=3D"appendonsend"></div>
<hr style=3D"display:inline-block;width:98%" tabindex=3D"-1">
<div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=
yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> Shadrock Uhuru &lt;ni=
[email protected]&gt;<br>
<b>Sent:</b> Thursday, June 11, 2026 4:30 PM<br>
<b>To:</b> [email protected] &lt;[email protected].=
net&gt;<br>
<b>Subject:</b> [Sbcl-help] help with packages</font>
<div>&nbsp;</div>
</div>
<div class=3D"BodyFragment"><font size=3D"2"><span style=3D"font-size:11pt;=
">
<div class=3D"PlainText">[Some people who received this message don't often=
 get email from [email protected]. Learn why this is important at
<a href=3D"https://aka.ms/LearnAboutSenderIdentification">https://aka.ms/Le=
arnAboutSenderIdentification</a> ]<br>
<br>
;; ------------------------------------------------------------------------=
<br>
CL(1): (defpackage test1<br>
&nbsp; (:use :cl)<br>
&nbsp; (:export :test))<br>
#&lt;PACKAGE &quot;TEST1&quot;&gt;<br>
<br>
CL(2): (in-package :test1)<br>
#&lt;PACKAGE &quot;TEST1&quot;&gt;<br>
<br>
TEST1(3):<br>
<br>
(defun test (test-val)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp; ;; remove items from a list<br>
&nbsp; (format t &quot;~%the test-val =3D ~a &quot; test-val) ;; items to r=
emove<br>
&nbsp; (let ((diff-list (set-difference (list 'N 'E 'W 'S) test-val)))&nbsp=
; ;; remove the items<br>
&nbsp;&nbsp;&nbsp; (format t &quot;~%the first item of test-val =3D ~a &quo=
t;(first&nbsp; test-val))&nbsp; ;; just to prove we get the function parame=
ter<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; and we can operate on it<br>
&nbsp;&nbsp;&nbsp; (format t &quot;~%the diff-list =3D ~a &quot; diff-list)=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;; the resultant list<br>
&nbsp;&nbsp;&nbsp; (dolist (each-item diff-list)&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 ;; get each item of resultant list<br>
&nbsp;&nbsp;&nbsp; (format t &quot;~%each item =3D ~a&quot; each-item))))&n=
bsp;&nbsp;&nbsp;&nbsp; ;; print item<br>
<br>
TEST<br>
TEST1(4): (test (list 'N 'S))<br>
<br>
the test-val =3D (N S)<br>
the first item of test-val =3D N<br>
the diff-list =3D (W E)<br>
each item =3D W<br>
each item =3D E<br>
NIL<br>
<br>
<br>
TEST1(5): (defpackage test2<br>
&nbsp; (:use :cl))<br>
#&lt;PACKAGE &quot;TEST2&quot;&gt;<br>
<br>
TEST1(6): (in-package :test2)<br>
#&lt;PACKAGE &quot;TEST2&quot;&gt;<br>
<br>
TEST2(7) (test1:test (list 'N 'S))<br>
<br>
the test-val =3D (N S)<br>
the first item of test-val =3D N<br>
the diff-list =3D (S W E N)<br>
each item =3D S<br>
each item =3D W<br>
each item =3D E<br>
each item =3D N<br>
NIL<br>
<br>
TEST2(8):<br>
<br>
;; ---------------------------------------------<br>
SBCL 2.6.4.openbsd.sbcl-2.6.4<br>
<br>
hi everyone<br>
the function above works when i call it within the package it was created i=
n<br>
but when i call it from another package the call to set-difference<br>
appears to get an empty list as its second parameter,<br>
as the test function works when called from it home package,<br>
i'm assuming that the problem lies with how the packages are set up.<br>
can anyone point me to the error in my code.<br>
thanks shadrock<br>
<br>
<br>
_______________________________________________<br>
Sbcl-help mailing list<br>
[email protected]<br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/sbcl-help">https://=
lists.sourceforge.net/lists/listinfo/sbcl-help</a><br>
</div>
</span></font></div>
&nbsp;<br>
&nbsp;<br>
&nbsp;<br>
<div style=3D"font-size:9pt; font-style:italic;">This e-mail is sent to you=
 from Keepit A/S. Dedicated SaaS Data Protection.<br>
VAT: DK30806883, Per Henrik Lings All=E9 4, 7., DK-2100 Copenhagen &Oslash;=
, Denmark.<br>
&nbsp;<br>
This e-mail is sent to you directly and is meant for nobody else. If the e-=
mail contains personal data that Keepit is responsible for and the e-mail w=
as not meant for you, please do not forward, distribute, or copy, i.e. but =
return the e-mail to sender. Also,
 do not send the e-mail to a third party without making sure that you have =
our prior consent. Distribution of this e-mail to unauthorized receivers ma=
y have legal consequences.<br>
If you have received an e-mail from us and you don&#8217;t know why, then p=
lease refer to our
<a href=3D"https://www.keepit.com/privacy-policy/">Privacy Policy</a>.<br>
If you do not want to receive more e-mails from us, please contact <a href=
=3D"mailto:[email protected]">
[email protected]</a>.</div>
</body>
</html>

--_000_VI0PR03MB104205A9D5C1DC2C9A9F8E4B9C41B2VI0PR03MB10420eu_--


--===============2836244358438778549==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============2836244358438778549==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Sbcl-help mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-help

--===============2836244358438778549==--