-
-
Notifications
You must be signed in to change notification settings - Fork 360
Modified euclidian algorithm haskell code to be more clear and readable #204
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
Conversation
…s inside "where" bindings.
Welcome to the AAA and thanks for your contribution! In my opinion, your changes to this code are definitely improvements, especially those to There is one thing you definitely have to change. When you look at the chapter you will notice that not the entire file is visible, but only the function the current paragraph is about. Since you changed quite a bit, you will have to adjust the line numbers in the code import. That's not too difficult. Open euclidean.md in your editor and look for the code imports for Haskell. They look like this:
You will have to change that one to
because lines 2-8 contain |
I've solved it now |
@@ -53,7 +53,7 @@ Modern implementations, though, often use the modulus operator (%) like so | |||
{% sample lang="py" %} | |||
[import:1-9, lang="python"](code/python/euclidean_example.py) | |||
{% sample lang="haskell" %} | |||
[import:13-24, lang="haskell"](code/haskell/euclidean_example.hs) | |||
[import:10-22, lang="haskell"](code/haskell/euclidean_example.hs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should only import the euclidMod
function without main
. This was already wrong before you edited it, but if you look at all the other languages, you'll see that they all only import the one function. In other words, this should be 10-14
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, sorry 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's alright. As I said, it was wrong before you changed it, so no worries.
putStrLn (show chk1) | ||
putStrLn (show chk2) | ||
print chk1 | ||
print chk2 | ||
return () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
print already returns IO ()
, is adding return ()
a thing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you already added the IO() in the type, you can omit it, I'll fix it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, I didn't write this :p (I wrote all other Haskell files though, I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvements, thank you!
Avoided hiding values inside "where" bindings.