Skip to content
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

REPL hangs on some special mit-scheme code #65

Open
oiovoyo opened this issue Mar 18, 2018 · 2 comments
Open

REPL hangs on some special mit-scheme code #65

oiovoyo opened this issue Mar 18, 2018 · 2 comments

Comments

@oiovoyo
Copy link

oiovoyo commented Mar 18, 2018

; filename : cons.scm
(define (cons x y)
  (lambda (m) (m x y)))

(define (car z)
  (z (lambda (p q) p)))

(define (cdr z)
  (z (lambda (p q) q)))

(car (cons 1 2))

(cdr (cons 2 (cons 3 4)))

I redefine cons car and cdr
type ,e for each procedure
REPL never return at (car (cons 1 2))
But it works while I run in command line as scheme < cons.scm

@kovisoft
Copy link
Owner

I tried to find out what's going on here. If I modified your definitions so that instead of redefining cons, car, cdr I defined a new cons2, car2, cdr2, then everything was okay. Then I played a little bit with different redefinitions for car and it seems to be that this also modifies the definition of car as used in the swank server (slime/contrib/swank-mit-scheme.scm). For example when using this definition:

(define (car x)
  (display x)
  (first x))

then whenever the swank server executed a car form, it also printed its argument in the scheme command line window (the xterm window that is running the scheme swank server in the background).

So I believe that redefining any form used by the swank server will have serious consequences and I don't think I can do anything about that. This seems to be a limitation of the MIT Scheme swank server. Also please note that the swank server code is not written by me, it is (lisp, scheme, clojure) is "borrowed" from SLIME.

@oiovoyo
Copy link
Author

oiovoyo commented Mar 25, 2018

much appreciate that you response in detail.

I'v already avoided this issue by renaming primitive keyword in the following code.

Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants