Skip to content

Conversation

@super7ramp
Copy link
Contributor

This closes #207.

@jeaye jeaye requested a review from E-A-Griffin October 31, 2025 18:05
Copy link
Member

@jeaye jeaye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Comment on lines 21 to 23
(are [expr] (thrown? #?(:cljs js/Error :default Exception) (expr))
(#'cycle)
(#'cycle [] [])))))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arity checking is not handled by the function definition. It's handled by the runtime. We don't want to include calls to unsupported arities in our unit tests here, since it's not actually testing the function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed tests on bad arities.

1 '() []
1 '(1 2 3) [1]
3 '(1 2 3) [1 2 3]
7 '(1 2 3) [1 2 3 1 2 3 1]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can test infinite seqs here, too, since cycle needs to work with them. For example, (take 3 (cycle (range))).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a test on infinite seq.

Copy link
Collaborator

@E-A-Griffin E-A-Griffin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we add some tests for other data structures since the docs for this specifically only require a collection (e.g. range, set, map, at least one associative collection besides vector, doesn't need to be all of them)

@super7ramp
Copy link
Contributor Author

Could we add some tests for other data structures since the docs for this specifically only require a collection (e.g. range, set, map, at least one associative collection besides vector, doesn't need to be all of them)

Added cases for set and map.

@jeaye jeaye merged commit d575dc6 into jank-lang:main Nov 1, 2025
2 checks passed
@jeaye
Copy link
Member

jeaye commented Nov 1, 2025

Well done!

@super7ramp super7ramp deleted the cycle branch November 1, 2025 09:30
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

Successfully merging this pull request may close these issues.

clojure.core/cycle

3 participants