Skip to content

Adding Euclidean Algorithm in Lua #293

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 3 commits into from
Jul 28, 2018
Merged

Adding Euclidean Algorithm in Lua #293

merged 3 commits into from
Jul 28, 2018

Conversation

Wesley-Arrington
Copy link
Contributor

I've been learning a little bit of Lua. So I figured I should add some to the AAA.

@june128 june128 added the Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) label Jul 23, 2018
local b = math.abs(b)

while b ~= 0 do
local temp = b
Copy link
Member

Choose a reason for hiding this comment

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

I don't know Lua, but a quick search shows me that you can assign pairwise variables, so maybe a, b = b, a%b is cleaner

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya I definitely agree its way cleaner that way. I just made a commit to adjust my code accordingly.

Copy link
Member

@jiegillet jiegillet left a comment

Choose a reason for hiding this comment

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

I request that you change one byte :)

@@ -68,6 +70,8 @@ Modern implementations, though, often use the modulus operator (%) like so
[import:17-29, lang="swift"](code/swift/euclidean_algorithm.swift)
{% sample lang="matlab" %}
[import:19-31, lang="matlab"](code/matlab/euclidean.m)
{% sample lang="lua" %}
[import:16-27, lang="lua"](code/lua/euclidean.lua)
Copy link
Member

Choose a reason for hiding this comment

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

Change the 27 to 25 and we're good to go!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I forgot to update the md file after the last commit. Just made a commit to fix this.

@jiegillet jiegillet merged commit 759c563 into algorithm-archivists:master Jul 28, 2018
@Wesley-Arrington Wesley-Arrington deleted the euclidLua branch September 10, 2018 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants