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

throw error on cycles #422

Open
jcubic opened this issue Jan 15, 2025 · 0 comments
Open

throw error on cycles #422

jcubic opened this issue Jan 15, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jcubic
Copy link
Owner

jcubic commented Jan 15, 2025

Some procedures like:

  • reverse
  • list->array
  • length

break the loop on cycles (they return 2 elements with this code):

(define x (let ((x '(1 2 3))) (set-cdr! (cddr x) x) x))
(length x)
;; ==> 2
(list->array x)
;; ==> #(1 2)
(reverse x)
;; ==> (2 1)

They should throw an exception that the argument is not a list, similar to map:

(map - x)
;; map: argument 1 is not a list
@jcubic jcubic added the bug Something isn't working label Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant