-
Notifications
You must be signed in to change notification settings - Fork 4
Better Support for SBCl and CCL #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
My Emacs is configured to automatically delete trailing whitespaces.
Source file extensions and compiled file extensions have changed for CCL. CL-USER> (pathname-type (compile-file-pathname "clever.lisp")) "lx64fsl" CL-USER> (pathname-type "clever.lisp") "lisp" I think all the all caps ".LISP" is no longer the preferred style? N.B. the compiled file extension is prefixed with "lx64-" appropriately reflects my CPU architecture.
Add new Source file extensions and compiled file extensions for SBCL. CL-USER> (pathname-type (compile-file-pathname "clever.lisp")) "fasl" CL-USER> (pathname-type "clever.lisp") "lisp"
This failure to successfully evaluate
(setq *readtable* ps::roadblock-readtable)
only occurs on SBCL (where the error is quoted in the commit title) and not CCL.
I don't understand why. Perhaps we need to first call
SET-DISPATCH-MACRO-CHARACTER for '#'. However the removal of '#' from the
Non-constituents does allow the above sexp to eval properly. Version of SBCL
used is 2.1.9.
CL-USER> (setq *readtable* ps::roadblock-readtable)
#<READTABLE {10018F4573}>
CL-USER> (in-package :scheme)
#<COMMON-LISP:PACKAGE "SCHEME">
SCHEME> (cons "banana" "split")
("banana" . "split")
SCHEME> (list (list 1 2 3) 5 (list "a" "b" "c"))
((1 2 3) 5 ("a" "b" "c"))
SCHEME> (symbol? 'Apple)
COMMON-LISP:T
SCHEME> (symbol? 10)
PS:FALSE
SCHEME> (define (make-stack)
(let ((s '()))
(define (push x)
(set! s (cons x s)))
(define (pop)
(if (null? s)
(error "Empty stack -- POP")
(let ((top (car s)))
(set! s (cdr s))
top)))
(define (initialize)
(set! s '())
'done)
(define (dispatch message)
(cond ((eq? message 'push) push)
((eq? message 'pop) (pop))
((eq? message 'initialize) (initialize))
(else (error "Unknown request -- STACK"
message))))
dispatch))
;
; caught COMMON-LISP:STYLE-WARNING:
; Call to PS:TRUEP could not be inlined because its source code was not saved. A
; global INLINE or SB-EXT:MAYBE-INLINE proclamation must be in effect to save
; function definitions for inlining.
;
; compilation unit finished
; caught 1 STYLE-WARNING condition
MAKE-STACK defined.
SCHEME> (let ((s (make-stack)))
((s 'push) 1)
((s 'push) 2)
(s 'pop)
(s 'pop))
1 (1 bit, #x1, #o1, #b1)
|
So if I just type If so then I guess your fix is OK. If not it needs to be conditional on SBCL. You probably know already that I am puzzled by the CCL changes - we're talking about Coral Common Lisp, right? Maybe CCL itself changed over the years. I never used it and must have gotten those conditionalizations from a contributor. Of course ideally all this knowledge of file extensions shouldn't reside inside Pseudoscheme itself. The underlying Lisp system obviously knows all of this and I'd expect there to be a way to query it in a modern Common Lisp. In retrospect the derived files should be foo-pso.lisp not foo.pso but remember - the file system I was using only supported 6 character file names. Yes, this is very old code- I think mainly written around 1985, for the Symbolics Lisp Machine (which had only just implemented Common Lisp, which came out in 1984). It was never revised for ANSI Common Lisp or for ABCL. It's miraculous that it still works. I believe the dialect implemented is R4RS, not R5RS. Thanks for teaching me about 'draft' status PRs! |
|
Typing just With reference to CCL, and I just learned this myself yesterday, it went roughly 1984 - Coral Common Lisp 1988 - Macintosh Common Lisp (acquired by Apple) 2001 - OpenMCL (open sourced bits of MCL) 2007 - Clozure Common Lisp (after the entire MCL was open sourced, renamed to https://ccl.clozure.com/history.html 6 character file names? That's crazy lol. I am hoping the 'sicp.scm' included file will I'm pretty stubborn about getting this to work on SBCL as it happens to be the |
Good Day,
I'm currently a beginner trying get started with Lisp. I've already invested
hours setting up my ideal Emacs & Common Lisp environment with the copious free
time only a student has. Therefore I began searching for a way to learn SICP
through the Common Lisp environment. It was then Mr. Joswig on HN who pointed me
towards pseudoscheme (https://news.ycombinator.com/item?id=16776704).
I decided to mark this Pull Request as a draft because I'm not entirely clear
why removing '#' from the Non-constituents allows the readtable to be
successfully set, and why this only occurs on SBCL. This is out of the two
implementations I tested, the other being CCL. But seeing resources online as sparse
as it is, I wanted to save future beginners some trouble by making this WIP PR public.
Loading pseudoscheme on SBCL v2.1.9 now does seem to work though. I ran some
scheme examples I found online and pasted the results in the description of commit
fba7323. I've also read online that it is most painless to use the version of
scheme (R5RS?) in the textbook and not modern MIT Scheme or Racket (which can
work with a compatibility module). So pseudoscheme seems to fit the bill
perfectly. In fact I think some historical value would be lost if all the
conditionals for ancient implementations were replaced. I think it's pretty cool
code that is 16 years older than me remains a vehicle to learn the timeless
concepts in SICP.
But now I've spent more time fooling around with the tooling instead of the
material so I'll leave it at that.
Cheers, and thanks for pseudoscheme!