Skip to content

Add Euclidean GCD in Factor #425

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 7 commits into from
Oct 8, 2018
Merged

Add Euclidean GCD in Factor #425

merged 7 commits into from
Oct 8, 2018

Conversation

nic-hartley
Copy link
Contributor

The syntax is probably a little funky. Luckily, Factor has some pretty nice learning resources. Specifically, I'd recommend looking at Your First Program, and having a decent grounding in functional programming; a lot of the concepts are similar.

And of course, if you have questions, comment on the lines. I'll do my best to answer.

@nic-hartley nic-hartley changed the title Factor Euclidean GCD Add Euclidean GCD in Factor Oct 3, 2018
@leios
Copy link
Member

leios commented Oct 3, 2018

Oh, nice. Looks like you got everything. We'll review the code soon. Thanks a bunch!

@nic-hartley
Copy link
Contributor Author

@leios Not yet. I've still got a few more algorithms to implement! (In separate PRs, of course, I read the contributing guide)

@leios
Copy link
Member

leios commented Oct 3, 2018

Oh, I meant that this PR seemed to update everything for the inclusion of Factor into the AAA. Good job!

@leios leios added Implementation This provides an implementation for an algorithm. (Code and maybe md files are edited.) Hacktoberfest The label for all Hacktoberfest related things! labels Oct 3, 2018
@jiegillet
Copy link
Member

I call dibs on reviewing this one (and #426) if no one else wants it. Although I want to take my time and read a bit more about the language first.

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.

Very cool! I'm glad I got to know this language a bit! I hope my review is relevant.

[ 2dup = ]
[
! make sure the lower number is deeper
2dup >= [ swap ] when ! a b -> G(reater) L(ess)
Copy link
Member

Choose a reason for hiding this comment

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

This line confused me so much until I remembered ! is the comment marker ^^
Could you align all the ! together to the right so that the comments are easier to parse?
Like this

     ! doing this
dup  ! doing that

book.json Outdated
},
{
"lang": "factor",
"name": "Factor"
Copy link
Member

Choose a reason for hiding this comment

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

Things are misaligned here.
You could also change .editorconfig to set the format for factor files.

@@ -41,6 +41,8 @@ The algorithm is a simple way to find the *greatest common divisor* (GCD) of two
[import:13-24, lang="nim"](code/nim/euclid_algorithm.nim)
{% sample lang="f90" %}
[import:1-19, lang="fortran"](code/fortran/euclidean.f90)
{% sample lang="factor" %}
[import:1-10, lang="factor"](code/factor/euclid.factor)
Copy link
Member

Choose a reason for hiding this comment

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

Don't forget to update the lines if you modify the code.

@jiegillet jiegillet mentioned this pull request Oct 6, 2018
@jiegillet jiegillet self-assigned this Oct 6, 2018
@jiegillet jiegillet merged commit fc250ee into algorithm-archivists:master Oct 8, 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 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