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

Functional Data Structures Section corrections #24

Open
tim-ruhland opened this issue Sep 16, 2016 · 0 comments
Open

Functional Data Structures Section corrections #24

tim-ruhland opened this issue Sep 16, 2016 · 0 comments

Comments

@tim-ruhland
Copy link

tim-ruhland commented Sep 16, 2016

I was unable to do PR for following. I couldn't find source for first item.
Multiple edits, separated by horizontal lines


The sealed trait definition for List is missing the case class for Cons
should be:

sealed trait List[+A]
case object Nil extends List[Nothing]
case class Cons[+A](head: A, tail: List[A]) extends List[A]


just prior to the tail function definition, "...how we handle the use of take on Nil lists:"
should be "tail" instead of "take"


"We can generalize take to the function drop,..."
should be:
"We can generalize tail to the function drop,..."


Where the statement: "Let's apply the same principle as we use in map..." appears, the "map" term has not been defined.
The section above this statement (which corresponds to 'add1' in the red book) is a specific application of "map", but it isn't described as such.
The book follows 'add1' with an exercise to generalize it to "map". This could probably be corrected by just adding some additional explanatory text to the 'add1' section.


The 'flatMap' section, which provides this definition:

def flatMap[A, B](l: List[A])(f: A => List[B]): List[B] =
concat(map(l)(f))

uses the concat function, which has not been discussed or covered in previous sections. At a minimum, there should be some description of what concat does.

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

No branches or pull requests

1 participant