dbrattli / Expression

Pragmatic functional programming for Python inspired by F#
https://expression.readthedocs.io
MIT License
421 stars 30 forks source link

Other F# default Seq functions #82

Open lucasteles opened 2 years ago

lucasteles commented 2 years ago

The BCL F# Seq module has some other really helpful functions, do you have plans to implement them? need help/accept PR?

average
averageBy
cache
countBy
distinct
distinctBy
exactlyOne
exists
exists2
forall
forall2
groupBy
iteri
last
maxBy
minBy
nth
pairwise
pick
reduce
skipWhile
sort
sortBy
takeWhile
truncate
tryFind
tryFindIndex
tryPick
windowed
zip3
dbrattli commented 2 years ago

Yes, would love a PR on this. Note that the code should be using curry or curry_flipped style functions instead of the nested (function returning) functions. See here for an example: https://github.com/cognitedata/Expression/blob/main/expression/collections/block.py#L669

ShalokShalom commented 1 year ago

Note: curry_flipped got renamed into curry_flip

https://github.com/cognitedata/Expression/pull/87