On Friday, 10 June 2022 at 17:37:13 UTC, Ali Çehreli wrote:
On 6/10/22 10:22, Antonio wrote: > Is there any alternative to ***range front*** that returns a Nullable > (i.e. **frontAsMonad** or **frontAsNullable**)?import std; // Spelling? :) auto nullablelize(R)(R range) { ... } void main() { // Wow! We can take 10 elements without error. :) writeln(iota(5) .filter!(i => i % 2) .nullablelize .take(10)); } Ali
That's cheating :-p... you used a helper method+structure. Nice example, Thank you Ali.
