(Go: >> BACK << -|- >> HOME <<)

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add some List functions? #715

Closed
kalxd opened this issue Jul 7, 2024 · 1 comment
Closed

add some List functions? #715

kalxd opened this issue Jul 7, 2024 · 1 comment

Comments

@kalxd
Copy link
kalxd commented Jul 7, 2024

I find there are some usefull functions for both List and NotEmptyList, such as:

// The partition function takes a predicate and a list, and returns the pair of lists of elements which do and do not satisfy the predicate
const partition = <T>(predicate: (item: T) => boolean, xs: List<T>): [List<T>, List<T>];

// takeWhile applied to a predicate p and a list xs, returns the longest prefix (possibly empty) of xs of elements that satisfy p.
const takeWhile = <T> (p: (item: T) => boolean, xs: List<T>): List<T>;

so would you implement more about such functions on List?
or do you need a PR?

@gigobyte
Copy link
Owner
gigobyte commented Jul 7, 2024

Purify only includes Array helpers that benefit from types like Maybe, for general purpose helpers there are tons of other specialized libraries that would do just as well and even better, honestly

@kalxd kalxd closed this as completed Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants