Skip to content

Commit

Permalink
Merge pull request #62 from JasonShin/develop
Browse files Browse the repository at this point in the history
Merging develop to master
  • Loading branch information
JasonShin authored Dec 27, 2019
2 parents a74117f + 28cb61a commit 4564c42
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ we hope to make learning FP easier.
Where applicable, this document uses terms defined in the [Fantasy Land spec](https://github.com/fantasyland/fantasy-land)
and Rust programming language to give code examples.

Also please be mindful that the project sometimes utilise FP related crates that are unfinished but contains
a specific typeclass or data type that is appropriate to give an explanation. Many of them are experimental and
are not suitable for production usage.
The content of this section was drawn from [Functional Programming Jargon in Javascript](https://github.com/hemanth/functional-programming-jargon) and
we sincerely appreciate them for providing the initial baseline.

__Table of Contents__
<!-- RM(noparent,notop) -->
Expand Down Expand Up @@ -1163,20 +1162,17 @@ assert_eq!(

## Foldable

An object that has a `foldr/l` function that can transform that object into some other type. We are using `rats` to give
an example but the crate only implements `fold_right`.
An object that has a `foldr/l` function that can transform that object into some other type.

`fold_right` is equivalent to Fantasy Land Foldable's `reduce`, which goes like:

`fantasy-land/reduce :: Foldable f => f a ~> ((b, a) -> b, b) -> b`

```rust
use rats::foldable::Foldable;
use rats::kind::IntoKind;
use rats::kinds::VecKind;
use fp_core::foldable::*;

let k = vec![1, 2, 3].into_kind();
let result = VecKind::fold_right(k, 0, | (i, acc) | i + acc);
let k = vec![1, 2, 3];
let result = k.reduce(0, |i, acc| i + acc);
assert_eq!(result, 6);
```

Expand Down

0 comments on commit 4564c42

Please sign in to comment.