From: Nicolas N. <Nic...@iw...> - 2004-04-13 14:24:04
|
Hello, I want to make my application Femlisp (a PDE solver, see www.femlisp.org) run with SBCL, but have difficulties. Especially, I cannot find out how I can adapt my CMUCL pathname and defsystem setup for SBCL. I have at the moment something like: ;;; sets *cl-home* to "/home/neuss/CL-HOME/" (defparameter *cl-home* (concatenate 'string #+cmu (cdr (assoc :CL_HOME ext:*environment-list*)) #+sbcl (posix-getenv "CL_HOME") "/")) (setf (logical-pathname-translations "cl") `(("**;*.*.*" ,(concatenate 'string *cl-home* "**/*.*.~*~")))) (setf (logical-pathname-translations "femlisp") '(("**;*.*.*" "cl:femlisp;**;*.*.*"))) ;;; in femlisp.system (mk::defsystem femlisp :source-pathname "femlisp:" :source-extension "lisp" :depends-on () :components ( (:module "basic" :depends-on () :source-pathname "src;basic" :source-extension "lisp" :components ((:file "debug") ... This does not work at several levels. Already the definition of the logical host "cl:" is apparently not correct for SBCL (0.8.9) because I cannot load existing files. * (setf (logical-pathname-translations "cl") `(("utilities;*" "cl:lisp;*") ("**;*.*.*" ,(concatenate 'string *cl-home* "**/*.*.~*~")))) (("utilities;*" "cl:lisp;*") ("**;*.*.*" "/home/neuss/CL-HOME/**/*.*.~*~")) * (load #p"cl:lisp;lisp-init.lisp") debugger invoked on a SIMPLE-ERROR in thread 6220: Could someone tell me how logical pathnames differ between SBCL and CMUCL? How would the correct setup for SBCL look like in the situation sketched above? Would it be better to avoid logical pathnames completely? Thank you for any suggestions, Nicolas. P.S.: I have the impression that SBCL gives much less information on errors than CMUCL, see the above case for an example. Is this true? Also it gives optimization notes (cannot inline ... because type is not known) even when no optimization is required. Is it possible to change this? |
From: Nicolas N. <Nic...@iw...> - 2004-04-13 14:56:47
|
Nicolas Neuss <Nic...@iw...> writes: > P.S.: I have the impression that SBCL gives much less information on errors > than CMUCL, see the above case for an example. Is this true? Sorry, this was only an artefact of ILISP. When I do this directly in the *sbcl* buffer, I get: * (load #p"cl:lisp;lisp-init.lisp") debugger invoked on a SIMPLE-ERROR in thread 6220: not enough wildcards in FROM pattern to match TO pattern: #<SB-IMPL::PATTERN :MULTI-CHAR-WILD "." :MULTI-CHAR-WILD> You can type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL. restarts (invokable by number or by possibly-abbreviated name): 0: [ABORT ] Reduce debugger level (leaving debugger, returning to toplevel). 1: [TOPLEVEL] Restart at toplevel READ/EVAL/PRINT loop. (SB-IMPL::SUBSTITUTE-INTO 3 #<SB-IMPL::PATTERN :MULTI-CHAR-WILD "." :MULTI-CHAR-WILD> ("LISP-INIT") T)[:EXTERNAL] |
From: Christophe R. <cs...@ca...> - 2004-04-13 15:22:29
|
Nicolas Neuss <Nic...@iw...> writes: > (setf (logical-pathname-translations "cl") > `(("**;*.*.*" ,(concatenate 'string *cl-home* "**/*.*.~*~")))) > > (setf (logical-pathname-translations "femlisp") > '(("**;*.*.*" "cl:femlisp;**;*.*.*"))) Well, the major problem here is that you've set yourself again at the mercy of the namestring parser -- which is something that you're trying to avoid by using logical pathnames. The "cookbook" recipe that I would suggest, which should work anywhere that implements logical pathnames correctly, is (let ((directory (pathname-directory *cl-home-pathname*))) (setf (logical-pathname-translations "CL") `(("**;*.*.*" ,(make-pathname :directory '(,@directory :wild-inferiors) :name :wild :type :wild :version :wild)))) (setf (logical-pathname-translations "FEMLISP") `(("**;*.*.*" ,(make-pathname :host "CL" :directory '(:absolute "FEMLISP" :wild-inferiors) :name :wild :type :wild :version :wild))))) It may look uglier, but it stands a greater chance of being portable. > This does not work at several levels. Already the definition of the > logical host "cl:" is apparently not correct for SBCL (0.8.9) because I > cannot load existing files. > > * (setf (logical-pathname-translations "cl") > `(("utilities;*" "cl:lisp;*") > ("**;*.*.*" ,(concatenate 'string *cl-home* "**/*.*.~*~")))) > (("utilities;*" "cl:lisp;*") ("**;*.*.*" "/home/neuss/CL-HOME/**/*.*.~*~")) > * (load #p"cl:lisp;lisp-init.lisp") > debugger invoked on a SIMPLE-ERROR in thread 6220: > > Could someone tell me how logical pathnames differ between SBCL and CMUCL? > How would the correct setup for SBCL look like in the situation sketched > above? Would it be better to avoid logical pathnames completely? You may wish to (inspect (pathname "/home/neuss/CL-HOME/**/*.*.~*~")) in the various Lisps you have access to, and look at the variation, particularly in the version field. Logical pathnames hardly differ at all between CMUCL and SBCL, at least to my knowledge. Physical pathnames differ significantly, in that SBCL does not attempt to force the concept of pathname versions onto the Unix filesystem. Cheers, Christophe -- http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757 (set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b))) (defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge) |
From: Nicolas N. <Nic...@iw...> - 2004-04-13 17:21:58
|
Christophe Rhodes <cs...@ca...> writes: >> [very good hints] Thanks, Christophe. I'm progressing now really fast. I'll give a report when I'm finished (or if I should encounter further problems). P.S.: SBCL already discovered a bug in (my code and) CMUCL (from 2003-09-14) (butlast '(1 2 . 3) 0) returns (1 2) but should return (1). [I have no more recent CMUCL installed, so I cannot tell if this bug is still in the current version.] |
From: Nicolas N. <Nic...@iw...> - 2004-04-13 17:42:19
|
Nicolas Neuss <Nic...@iw...> writes: > (butlast '(1 2 . 3) 0) returns (1 2) but should return (1). ^^^ Sorry: (1 2 . 3) Nicolas. |
From: Lars B. <la...@no...> - 2004-04-14 06:41:06
|
Nicolas Neuss <Nic...@iw...> writes: > Nicolas Neuss <Nic...@iw...> writes: > > (butlast '(1 2 . 3) 0) returns (1 2) but should return (1). > ^^^ > Sorry: (1 2 . 3) Should it? CLHS says "(butlast list n) == (ldiff list (last list n))". (last '(1 2 . 3) 0) is 3, and (ldiff '(1 2 . 3) 3) is (1 2). |
From: Nicolas N. <Nic...@iw...> - 2004-04-14 09:57:17
|
Lars Brinkhoff <la...@no...> writes: > Nicolas Neuss <Nic...@iw...> writes: > > Nicolas Neuss <Nic...@iw...> writes: > > > (butlast '(1 2 . 3) 0) returns (1 2) but should return (1). > > ^^^ > > Sorry: (1 2 . 3) > > Should it? CLHS says "(butlast list n) == (ldiff list (last list n))". > (last '(1 2 . 3) 0) is 3, and (ldiff '(1 2 . 3) 3) is (1 2). Hmm. So CLHS is ambiguous here and both CMUCL and SBCL are right in what they do. Only my code is wrong in relying on it :-) Nicolas. P.S.: BTW, my program now works with SBCL. More tests to do before a final report. Seems to be somewhat slower (30%), but has caught a severe bug which CMUCL did let go through. |
From: Christophe R. <cs...@ca...> - 2004-04-14 10:14:47
|
Nicolas Neuss <Nic...@iw...> writes: > Lars Brinkhoff <la...@no...> writes: > >> Should it? CLHS says "(butlast list n) == (ldiff list (last list n))". >> (last '(1 2 . 3) 0) is 3, and (ldiff '(1 2 . 3) 3) is (1 2). > > Hmm. So CLHS is ambiguous here and both CMUCL and SBCL are right in what > they do. Only my code is wrong in relying on it :-) Interesting question. Technically, the "Notes" section of dictionary entries is non-normative -- that is, it is explanation, but it is not a part of the standard. The _description_ of BUTLAST does seem to imply that SBCL is right and CMUCL is wrong, but... maybe this is one of the cases where the Lisp oral tradition trumps minor things like standards :-) Cheers, Christophe -- http://www-jcsu.jesus.cam.ac.uk/~csr21/ +44 1223 510 299/+44 7729 383 757 (set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b))) (defvar b "~&Just another Lisp hacker~%") (pprint #36rJesusCollegeCambridge) |
From: Nicolas N. <Nic...@iw...> - 2004-04-14 11:42:12
|
Christophe Rhodes <cs...@ca...> writes: > Nicolas Neuss <Nic...@iw...> writes: > > > Lars Brinkhoff <la...@no...> writes: > > > >> Should it? CLHS says "(butlast list n) == (ldiff list (last list n))". > >> (last '(1 2 . 3) 0) is 3, and (ldiff '(1 2 . 3) 3) is (1 2). > > > > Hmm. So CLHS is ambiguous here and both CMUCL and SBCL are right in what > > they do. Only my code is wrong in relying on it :-) > > Interesting question. Technically, the "Notes" section of dictionary > entries is non-normative -- that is, it is explanation, but it is not > a part of the standard. The _description_ of BUTLAST does seem to > imply that SBCL is right and CMUCL is wrong, but... maybe this is one > of the cases where the Lisp oral tradition trumps minor things like > standards :-) As much as I see even the description is contradictory. The first paragraph supports SBCL, the second one CMUCL (probably because the writer did not think of improper lists at this point). Nicolas. Description: butlast returns a copy of list from which the last n conses have been omitted. If n is not supplied, its value is 1. If there are fewer than n conses in list, nil is returned and, in the case of nbutlast, list is not modified. nbutlast is like butlast, but nbutlast may modify list. It changes the cdr of the cons n+1 from the end of the list to nil. |