Created
January 24, 2014 08:19
-
-
Save ktakashi/8593835 to your computer and use it in GitHub Desktop.
Cyclic list's equal?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; For R6RS | |
(import (rnrs) (rnrs mutable-pairs)) | |
;; For R7RS | |
;;(import (scheme base) (scheme cxr) (scheme write)) | |
(define a (list 1 2)) | |
(define b (list 1 2 1 2)) | |
(set-cdr! (cdr a) a) ;; #0=(1 2 . #0#) | |
(set-cdr! (cdddr b) b) ;; #0=(1 2 1 2 . #0#) | |
(display (equal? a b)) (newline) | |
(display (equal? b a)) (newline) | |
#| | |
;; results | |
;; Sagittarius (0.5.0) | |
#t | |
#t | |
;; Mosh (0.2.7) | |
#t | |
#t | |
;; Ypsilon (0.9.6-update3) | |
#t | |
#t | |
;; Chibi (0.6 "carbon") | |
#t | |
#t | |
;; Gauche (0.9.4_pre3) | |
infinite loop... | |
|# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment