Skip to content
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

[scala/en] Minor improvements #4671

Closed
wants to merge 1 commit into from

Conversation

RexYuan
Copy link

@RexYuan RexYuan commented May 20, 2023

  • I solemnly swear that this is all original content of which I am the original author
  • Pull request title is prepended with [language/lang-code] (example [python/fr-fr] or [java/en])
  • Pull request touches only one file (or a set of logically related files with similar changes made)
  • Content changes are aimed at intermediate to experienced programmers (this is a poor format for explaining fundamental programming concepts)
  • If you've changed any part of the YAML Frontmatter, make sure it is formatted according to CONTRIBUTING.md
    • Yes, I have double-checked quotes and field names!

Comment on lines +686 to +691
// functional languages. It is so often used that it gets its own shorthand.
// This function takes `f` and `l` and automatically fills in `K` and `V`.
def mapList[K,V](f: K=>V, l: List[K]): List[V] = l match {
case Nil => Nil
case h :: t => f(h) :: mapList(f, t)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not the point of this section. The mapList example here demostrates generic type inference, not implicit type classes.


// Certain collections (such as List) in Scala have a `foreach` method,
// which takes as an argument a type returning Unit - that is, a void method
// Some languages call this the `iter` method
Copy link
Collaborator

Choose a reason for hiding this comment

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

foreach functions are common enough that I don't think you need iter to illustrate. Most modern languages use forEach anyway. Please remove this line.

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.

3 participants