-
Notifications
You must be signed in to change notification settings - Fork 1k
zh-cn for Tour: multiple parameter lists #1173
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
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.
lgtm other than one minor comment
|
||
方法可以定义多个参数列表,当使用较少的参数列表调用多参数列表的方法时,会产生一个新的函数,该函数接收剩余的参数列表作为其参数。这被称为[柯里化](https://zh.wikipedia.org/wiki/%E6%9F%AF%E9%87%8C%E5%8C%96)。 | ||
|
||
下面是一个例子,在Scala集合中定义的特质[Traversable](/overviews/collections/trait-traversable.html): |
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.
the link to Traversable
doesn't seem to work, which doesn't work in https://github.com/scala/docs.scala-lang/blob/master/_tour/multiple-parameter-lists.md either
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.
You mean the link jumps to the English version?
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.
Changed the link in the newest commit and now it points to the Chinese version
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.
For me, it works. Have you followed the following instructions in the README?
Quickstart
To build and view the site locally:
gem install bundler
bundle install
bundle exec jekyll serve -I
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.
oh nvm...I thought it's a link to the md file
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.
All good except one.
``` | ||
numbers.foldLeft(0)(_ + _) | ||
``` | ||
上述声明`numbers.foldLeft(0)(_ + _)`让我们可以指定参数`z`,然后再传递折叠函数,并且可以复用,如下所示: |
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.
-让我们可以指定参数`z`,然后再传递折叠函数,并且可以复用,如下所示:
+上述语句让我们可以固定参数`z`来形成一个部分函数进行传递,达到复用的目的,如下所示:
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.
After doing some research[1][2], I kind of believe that's what's supposed to mean, but not 100 percent sure.
1 https://www.grokacademy.com/lessons/demystifying-currying-and-partial-function-application/
2 https://goo.gl/oGhpTW
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.
I think all it wants to say is currying allows you to fix z and reuse the partially applied function
... Above statement numbers.foldLeft(0)(_ + _)
in the Eng version is a bit confusing
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.
@dongxuwang I think you're right.
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.
@Qi77Qi Agree!
It always makes us crazy that partially applied function, partially function application, partial function. together with the PartialFunction etc.
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.
Looks better.
thank you! |
Simplified Chiniese version for Tour: multiple parameter lists