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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Implement clojure.core/shuffle #231

wants to merge 6 commits into from

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
@bpiel bpiel requested a review from jeaye February 4, 2025 19:44
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