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

Head and tail #9

Open
Gert-dev opened this issue Jun 16, 2019 · 4 comments · May be fixed by #16
Open

Head and tail #9

Gert-dev opened this issue Jun 16, 2019 · 4 comments · May be fixed by #16

Comments

@Gert-dev
Copy link

Hello

I notice that there are no head and tail equivalents for functional programming. I did notice that there is a first and a drop($sequence, 1), which are equivalent in functionality. Perhaps it would be interesting to simply alias these two? They make implementing recursion in a functional way somewhat more expressive.

Also, thanks for this neat library! Of all the libraries that have some functional programming functionality, I must say this one seems the most extensive up until now. I even decided to prioritize implementing use statement generation for qualified functions and constants in Serenata (PHP language server) to smoothen use of this library.

@ghost
Copy link

ghost commented Jun 25, 2019

Apparently init is also missing, which returns all elements but the last, so it's the reverse of last and does what tail does, but for the last instead of the first element.

See also here or this very enlightening picture (by Miran Lipovača):

https://s3.amazonaws.com/lyah/listmonster.png

@ghost ghost linked a pull request Jun 27, 2019 that will close this issue
@ihor
Copy link
Owner

ihor commented Jul 4, 2019

Hey! Thanks for your suggestions. The functions are missing because I never needed them. I started this library when I was also working with Python and tried to copy some of the things I liked to PHP (and fix the weird API of the standard library).

I'll review @tominventisbe 's PRs this weekend.

@Lambik
Copy link

Lambik commented Apr 24, 2020

@ihor I suppose "this weekend" has already passed, and there are 3 PRs open that seem nice :-) Not that I need them right this instant or something, but for completion of the library's sake, could you review them? I like the zip-one for instance.

@jtojnar
Copy link

jtojnar commented Dec 10, 2021

@ihor I can help maintain the library if you do not have the time.

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

Successfully merging a pull request may close this issue.

4 participants