You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
; 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
The text was updated successfully, but these errors were encountered:
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.
I redefine cons car and cdr
type
,e
for each procedureREPL never return at
(car (cons 1 2))
But it works while I run in command line as
scheme < cons.scm
The text was updated successfully, but these errors were encountered: