Releases: fp4php/functional
Releases · fp4php/functional
Release v4.15.0
Stream::sorted
operation has been added
Release v4.14.0
Option::when
andOption::unless
have been added- Deprecate
Option::cond
andOption::condLazy
. UseOption::when
Release v4.13.0
- Set
intersect
operation - NonEmptySet
intersect
operation - Set
diff
operation - NonEmptySet
diff
operation
>>> HashSet::collect([1, 2, 3])
->intersect(HashSet::collect([2, 3]))->toArray();
=> [2, 3]
>>> HashSet::collect([1, 2, 3])
->diff(HashSet::collect([2, 3]))->toArray();
=> [1]
Release v4.12.0
asPairs
functionasPairsGenerator
function- fix asGenerator namespace (Callable -> Cast)
>>> asPairs(['a' => 1, 'b' => 2]);
=> [['a', 1], ['b', 2]]
>>> Stream::emits(asPairsGenerator(['a' => 1, 'b' => 2]));
=> [['a', 1], ['b', 2]]
Release v4.11.0
- Stream
toAssocArray
cast
>>> Stream::emits([[1, 'a'], [2, 'b']])->toAssocArray(fn($pair) => $pair);
=> [1 => 'a', 2 => 'b']
Release v4.10.0
- fix
Option::fold
andEither::fold
signatures. - add
Option::toArrayList
cast method.
>>> Option::some(1)
->toArrayList(ArrayList::singleton(...))
->toArray();
=> [1]
>>> Option::some([1])
->toArrayList(ArrayList::collect(...))
->toArray();
=> [1]
>>> Option::none()
->toArrayList(ArrayList::collect(...))
->toArray();
=> []
Release v4.9.0
- Option
getOrThrow
method
>>> Option::some(1)->getOrThrow(fn() => new RuntimeException('???'));
=> 1
>>> Option::none()->getOrThrow(fn() => new RuntimeException('???'));
RuntimeException with message '???'
Release v4.8.1
Release v4.8.0
range
collector forSeq
- replace
0|positive-int
withint
for range start and stop parameters.
>>> ArrayList::range(0, 10, 2)->toArray();
=> [0, 2, 4, 6, 8]
>>> ArrayList::range(0, 3)->toArray();
=> [0, 1, 2]
>>> ArrayList::range(0, 0)->toArray();
=> []
Release v4.7.0
- Add
lastOf
operation forSeq
andNonEmptySeq