Skip to content

Added exclamation marks to mutating julia functions #526

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

Merged
merged 1 commit into from
Oct 20, 2018

Conversation

Vexatos
Copy link
Contributor

@Vexatos Vexatos commented Oct 20, 2018

By convention, Julia functions that mutate one of their parameters need to have an exclamation mark at the end of their name; this fixes all instances of that that I could find.

@Gathros Gathros added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) Hacktoberfest The label for all Hacktoberfest related things! Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.) and removed Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) labels Oct 20, 2018
Copy link
Member

@leios leios left a comment

Choose a reason for hiding this comment

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

I agree with the PR, but would you mind fixing one thing since we are already fixing the bogo_sort.jl file?

@@ -9,15 +9,15 @@ function is_sorted(a::Vector{Float64})
return true
end

function bogo_sort(a::Vector{Float64})
function bogo_sort!(a::Vector{Float64})
while(!is_sorted(a))
shuffle!(a)
end
end

function main()
a = [1, 3, 2, 4]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
a = [1, 3, 2, 4]
a = [1.0, 3, 2, 4]

This is my fault, but there is a type error here where the bogo_sort function wants floats and we are reading in ints. Could we fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Also improved typing of bogo sort.
@Vexatos Vexatos force-pushed the julia-convention-fixes branch from 8a22007 to c5f221c Compare October 20, 2018 21:41
Copy link
Member

@leios leios 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 to me! Thanks!

@leios leios merged commit 6f386fa into algorithm-archivists:master Oct 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest The label for all Hacktoberfest related things! Implementation Edit This provides an edit to an algorithm implementation. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants