|
From: Vasily P. <sha...@gm...> - 2026-06-11 14:44:12
|
In the first case it's 'test1::n and 'test1::s and in the second case it's 'test2::n and 'test2::s Чт, 11 июня 2026 г. в 17:32, Shadrock Uhuru <niy...@gm...>: > ;; ------------------------------------------------------------------------ > 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 = ~a " test-val) ;; items to remove > (let ((diff-list (set-difference (list 'N 'E 'W 'S) test-val))) ;; > remove the items > (format t "~%the first item of test-val = ~a "(first test-val)) ;; > just to prove we get the function parameter > ;; > and we can operate on it > (format t "~%the diff-list = ~a " diff-list) ;; > the resultant list > (dolist (each-item diff-list) ;; get each item of > resultant list > (format t "~%each item = ~a" each-item)))) ;; print item > > TEST > TEST1(4): (test (list 'N 'S)) > > the test-val = (N S) > the first item of test-val = N > the diff-list = (W E) > each item = W > each item = 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 = (N S) > the first item of test-val = N > the diff-list = (S W E N) > each item = S > each item = W > each item = E > each item = 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 > in > 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 > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-help > |