-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Seq.delay : (unit -> 'a t) -> 'a t #10177
base: trunk
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interestingly, I was working through parser combinators exercise by F. Pottier and was surprised Stdlib.Seq
didn't contain the functions implemented in this PR and Seq.hd/take
.
This comment has been minimized.
This comment has been minimized.
I have some reservations about |
The way I think of it, I observed its usefulness by seeing sequence beginners writing "too eager" definitions as in the first |
I proposed |
@fpottier : what do you think about this proposal, in light of your recent extensions to module Seq ? |
Indeed, I have felt the need for this The need for |
Honestly I don't think that it's worth rushing this function in 4.14. we have done without for years, we can do without for a bit more. I would of course be happy if people came to a decision on it (accept or reject), and I guess I should have been more pushy about it (I usually tend to err on the too-pushy side). But I would prefer this discussion to happen in more relaxed conditions than "last days remaining before the release!" -- time to bike-shed the name, etc. |
Note:
|
As I said in the I was just wondering why this wasn't maybe |
There is no abstraction in Seq already, why does it matter? |
@dbuenzli @c-cube While the definition is public, users can do most of their programming without needing to know what the definition is, which means that they are likely to forget the definition. Programming is simpler for them if they can consider it abstract. |
I would have had a use of this function today, to build a singleton sequence from a single value, where the value should only be computed when the element of the sequence is forced/demanded. |
Quoting the new docstring:
Edit: a previous iteration of this PR also proposed
flatten
=>concat
functions, now moved to a separate PR #10352.