Skip to content

Rewrote nested functions tour #735

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 2 commits into from
Mar 29, 2017
Merged

Rewrote nested functions tour #735

merged 2 commits into from
Mar 29, 2017

Conversation

ZeonTrevor
Copy link
Contributor

an easier to understand example of using nested methods through the computation of factorial.

else if (ys.head < threshold) ys.head :: process(ys.tail)
else process(ys.tail)
process(xs)
object FactorialTest extends App {

Choose a reason for hiding this comment

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

I would use def main here

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's clearer if all of the examples are in worksheet mode and not inside classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@travis032654 I have rewritten the example in worksheet mode

@travissarles
Copy link
Contributor

Hey @ZeonTrevor, huge thanks for your work. It's going to help a lot of people who use this as their primary reference. Check out the conversation here: #733

I'm also tracking the work in the Project Page. You'll find the link on the right.

Copy link
Contributor

@martijnhoekstra martijnhoekstra left a comment

Choose a reason for hiding this comment

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

If we title the paste Nested Methods, shouldn't the content also talk about methods rather than functions? Maybe the crux is that methods can be declared in any block scope, including (but not limited to) other methods?

@travissarles travissarles mentioned this pull request Mar 17, 2017
33 tasks
@SethTisue SethTisue merged commit bd275db into scala:master Mar 29, 2017
@SethTisue
Copy link
Member

nice, thanks!

@SethTisue
Copy link
Member

after merging I noticed an error that I fixed in 4becbaf

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.

6 participants