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

Implement take, truncate, skip and drop #209

Merged
merged 11 commits into from
Dec 19, 2023

Conversation

abelbraaksma
Copy link
Member

@abelbraaksma abelbraaksma commented Dec 18, 2023

This fixes part of #208, the following signatures are added and implemented (todo: tests)

static member skip: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>
static member drop: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>
static member take: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>
static member truncate: count: int -> source: TaskSeq<'T> -> TaskSeq<'T>

Note that skip and take raise if there are not enough elements (just like its Seq counterparts) and that truncate and drop do not raise. While drop does not exist in Seq, I felt it make sense as truncate also exists. Maybe it can be added to F# Core?

PS, in case anybody wondered, I chose the name drop simply because it exists in Scala. I'm not a fan of Scala per se, but was just looking for existing functions that behave like this one, and indeed, the Scala function does not raise either.

See also discussion here: https://stackoverflow.com/questions/1247788/calling-seq-skip-and-seq-take-in-f

TODO list:

  • Implement TaskSeq.skip
  • Implement TaskSeq.take
  • Implement TaskSeq.drop
  • Implement TaskSeq.truncate

@abelbraaksma abelbraaksma marked this pull request as ready for review December 18, 2023 02:19
@abelbraaksma abelbraaksma force-pushed the implement-take-skip-truncate-drop branch from 04ecbf2 to 3f12fd9 Compare December 18, 2023 02:21
@abelbraaksma abelbraaksma added topic: surface area Adds functions to the public surface area feature request New feature or enhancement request labels Dec 19, 2023
@abelbraaksma abelbraaksma force-pushed the implement-take-skip-truncate-drop branch 3 times, most recently from aa666c5 to bd2d616 Compare December 19, 2023 02:40
@abelbraaksma
Copy link
Member Author

This is ready, now that the obvious errors are fixed ;)

@abelbraaksma
Copy link
Member Author

Added .fantomasignore in two places (needed for VS 2022 plugin to work). This fixes a (temporary) bug in Fantomas that raises an error because of WhileBang, see fsprojects/fantomas#3019

src/.fantomasignore Outdated Show resolved Hide resolved
@abelbraaksma abelbraaksma force-pushed the implement-take-skip-truncate-drop branch from 0b974f8 to 52c76be Compare December 19, 2023 14:35
@abelbraaksma
Copy link
Member Author

Thanks for the review, @bartelink. I'll merge this in as soon as it passes the tests.

@abelbraaksma
Copy link
Member Author

I sorted out the issue with the test reports not showing. Reported here: dorny/test-reporter#343 (see my comments). See also this thread: actions/upload-artifact#472

@abelbraaksma abelbraaksma force-pushed the implement-take-skip-truncate-drop branch from f3e0e64 to 79f0bc4 Compare December 19, 2023 16:57
@abelbraaksma abelbraaksma merged commit 7d6e367 into main Dec 19, 2023
6 checks passed
@abelbraaksma abelbraaksma deleted the implement-take-skip-truncate-drop branch December 19, 2023 17:21
@abelbraaksma abelbraaksma added this to the v0.4.0 milestone Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or enhancement request topic: surface area Adds functions to the public surface area
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants