diff --git a/README.md b/README.md index ba88824..0887f06 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Well, I began learning Haskell in 2021 at my undergrad studies and quickly came However, I quickly realised some parts are slowly becoming outdated as Haskell continues to evolve. That is why, with the author's blessing, I decided to create this open-source fork to enable the Haskell community to participate in preserving and maintaining this awesome resource for the future times. -Anyone is invited to **contribute** be either opening a pull request (preferred) or opening a content edit request (in the pipeline, open soon!) for proposed changes. +Anyone is invited to **contribute** by either opening a pull request (preferred) or opening a content edit request (in the pipeline, open soon!) for proposed changes. The whole thing is completely free to read online, but the original is also available in print and we encourage you to buy a copy! diff --git a/docs/modules.html b/docs/modules.html index b43aeeb..c5f653d 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -81,7 +81,7 @@
intercalate takes a list of lists and a list. It then inserts that list in between all those lists and then flattens the result.
+intercalate takes a list and a list of lists. It then inserts that list in between all those lists and then flattens the result.
ghci> intercalate " " ["hey","there","guys"] "hey there guys" @@ -276,7 +276,7 @@Modules
find :: (a -> Bool) -> [a] -> Maybe a
Notice the type of find. Its result is Maybe a. That's kind of like having the type of [a], only a value of the type Maybe can contain either no elements or one element, whereas a list can contain no elements, one element or several elements.
-Remember when we were searching for the first time our stock went over $1000. We did head (dropWhile (\(val,y,m,d) -> val < 1000) stock). Remember that head is not really safe. What would happen if our stock never went over $1000? Our application of dropWhile would return an empty list and getting the head of an empty list would result in an error. However, if we rewrote that as find (\(val,y,m,d) -> val > 1000) stock, we'd be much safer. If our stock never went over $1000 (so if no element satisfied the predicate), we'd get back a Nothing. But there was a valid answer in that list, we'd get, say, Just (1001.4,2008,9,4). +
Remember when we were searching for the first time our stock went over $1000. We did head (dropWhile (\(val,y,m,d) -> val < 1000) stock). Remember that head is not really safe. What would happen if our stock never went over $1000? Our application of dropWhile would return an empty list and getting the head of an empty list would result in an error. However, if we rewrote that as find (\(val,y,m,d) -> val > 1000) stock, we'd be much safer. If our stock never went over $1000 (so if no element satisfied the predicate), we'd get back a Nothing. But if there was a valid answer in that list, we'd get, say, Just (1001.4,2008,9,4).
elemIndex is kind of like elem, only it doesn't return a boolean value. It maybe returns the index of the element we're looking for. If that element isn't in our list, it returns a Nothing.
ghci> :t elemIndex