Skip to content

Commit b546388

Browse files
authored
Updating from README
1 parent b8c31d7 commit b546388

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

index.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Lambda was born out of a desire to use some of the same canonical functions (e.g
2828
Some things a user of lambda most likely values:
2929

3030
- Lazy evaluation
31-
- Immutablility by design
31+
- Immutability by design
3232
- Composition
3333
- Higher-level abstractions
3434
- Parametric polymorphism
@@ -48,16 +48,15 @@ Add the following dependency to your:
4848
<dependency>
4949
<groupId>com.jnape.palatable</groupId>
5050
<artifactId>lambda</artifactId>
51-
<version>1.5.3</version>
51+
<version>1.5.6</version>
5252
</dependency>
5353
```
5454

5555
`build.gradle` ([Gradle](https://docs.gradle.org/current/userguide/dependency_management.html)):
5656

5757
```gradle
58-
compile group: 'com.jnape.palatable', name: 'lambda', version: '1.5.3'
58+
compile group: 'com.jnape.palatable', name: 'lambda', version: '1.5.6'
5959
```
60-
6160

6261
<a name="examples">Examples</a>
6362
--------
@@ -133,7 +132,7 @@ And have fun with 3s:
133132

134133
```Java
135134
Iterable<Iterable<Integer>> multiplesOf3InGroupsOf3 =
136-
take(10, inGroupsOf(3, unfoldr(x -> Optional.of(tuple(x * 3, x + 1)), 1)));
135+
take(3, inGroupsOf(3, unfoldr(x -> Optional.of(tuple(x * 3, x + 1)), 1)));
137136
//-> [[3, 6, 9], [12, 15, 18], [21, 24, 27]]
138137
```
139138

@@ -237,32 +236,32 @@ Optional<Integer> anotherIntValue = hmap.get(anotherIntKey); // Optional.empty
237236

238237
### <a name="coproducts">CoProducts</a>
239238

240-
`CoProduct`s generalize unions of disparate types in a single consolidated type.
239+
`CoProduct`s generalize unions of disparate types in a single consolidated type, and the `ChoiceN` ADTs represent canonical implementations of these coproduct types.
241240

242241
```Java
243-
CoProduct3<String, Integer, Character> string = CoProduct3.a("string");
244-
CoProduct3<String, Integer, Character> integer = CoProduct3.b(1);
245-
CoProduct3<String, Integer, Character> character = CoProduct3.c('a');
242+
CoProduct3<String, Integer, Character> string = Choice3.a("string");
243+
CoProduct3<String, Integer, Character> integer = Choice3.b(1);
244+
CoProduct3<String, Integer, Character> character = Choice3.c('a');
246245
```
247246

248247
Rather than supporting explicit value unwrapping, which would necessarily jeopardize type safety, `CoProduct`s support a `match` method that takes one function per possible value type and maps it to a final common result type:
249248

250249
```Java
251-
CoProduct3<String, Integer, Character> string = CoProduct3.a("string");
252-
CoProduct3<String, Integer, Character> integer = CoProduct3.b(1);
253-
CoProduct3<String, Integer, Character> character = CoProduct3.c('a');
250+
CoProduct3<String, Integer, Character> string = Choice3.a("string");
251+
CoProduct3<String, Integer, Character> integer = Choice3.b(1);
252+
CoProduct3<String, Integer, Character> character = Choice3.c('a');
254253

255254
Integer result = string.<Integer>match(String::length, identity(), Character::charCount); // 6
256255
```
257256

258257
Additionally, because a `CoProduct2<A, B>` guarantees a subset of a `CoProduct3<A, B, C>`, the `diverge` method exists between `CoProduct` types of single magnitude differences to make it easy to use a more convergent `CoProduct` where a more divergent `CoProduct` is expected:
259258

260259
```Java
261-
CoProduct2<String, Integer> coProduct2 = CoProduct2.a("string");
260+
CoProduct2<String, Integer> coProduct2 = Choice2.a("string");
262261
CoProduct3<String, Integer, Character> coProduct3 = coProduct2.diverge(); // still just the coProduct2 value, adapted to the coProduct3 shape
263262
```
264263

265-
There are `CoProduct` specializations for type unions of up to 5 different types: `CoProduct2` through `CoProduct5`, respectively.
264+
There are `CoProduct` and `Choice` specializations for type unions of up to 5 different types: `CoProduct2` through `CoProduct5`, and `Choice2` through `Choice5`, respectively.
266265

267266
### <a name="either">Either</a>
268267

0 commit comments

Comments
 (0)