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

Implement clojure.core/shuffle #231

Merged
merged 6 commits into from
Feb 11, 2025
Merged

Implement clojure.core/shuffle #231

merged 6 commits into from
Feb 11, 2025

Conversation

bpiel
Copy link
Contributor

@bpiel bpiel commented Feb 4, 2025

Closes #220

clojure.core=> (shuffle [3 2 1 4 5 6])
[5 6 3 2 4 1]
clojure.core=> (shuffle [3 2 1 4 5 6])
[4 5 3 1 2 6]
clojure.core=> (shuffle '(1 2 3 4 5))
[1 3 5 2 4]
clojure.core=> (shuffle {1 2 3 4 5 6})
[[1 2] [5 6] [3 4]]
clojure.core=> (shuffle #{1 2 3 4 5 6})
[2 4 3 1 6 5]

NOTE: swap was renamed to swap_atom, because otherwise std::shuffle was calling it and expecting typical C++ swap behavior.

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.

Looks good, with a couple minor comments.

compiler+runtime/src/cpp/jank/runtime/core/seq.cpp Outdated Show resolved Hide resolved
compiler+runtime/src/cpp/jank/runtime/core/seq.cpp Outdated Show resolved Hide resolved
compiler+runtime/src/cpp/jank/runtime/core/seq.cpp Outdated Show resolved Hide resolved
@jeaye jeaye merged commit 3d53442 into jank-lang:main Feb 11, 2025
7 checks passed
@jeaye
Copy link
Member

jeaye commented Feb 11, 2025

Nice work!

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.

Implement clojure.core/shuffle
2 participants