[Haskell-cafe] [Alternative] some/many narrative

Gregory Crosswhite gcrosswhite at gmail.com
Thu Dec 15 04:46:25 CET 2011


Okay, so how about the following as a user narrative for some and many?

	many v = repeatedly execute the action v and save each obtained result until v fails;  at that point, *succeed* and return a list with all of the results that had been collected
	some v = like many v, but if v does not succeed even once then *fail* instead of return the empty list

Note: If v *never* fails, then at best many/some will return infinite lists, and at worst they will repeat your action forever. 

Cheers,
Greg

P.S.: And yes, I know that many of you will complain that these definitions are not mathematically precise or what not, but it is important to be able to build up narratives at a sufficiently high level that they explain the essentials of what is going on for the benefit of users who are unfamiliar with the precise mathematical language used to precisely define their semantics.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111215/1be1ddfd/attachment.htm>


More information about the Haskell-Cafe mailing list