what is wrong with

1
yield MaybeElement(...)
By on 12/20/2008 6:38 PM ()

what is wrong with
yield MaybeElement(...)

This would yield 'a option type.

How about

1
[if Option.is_some MaybeElement(...) then yield MaybeElement(...).Value];

If it is a big calculation then the others are better.

But since the size always will be 0 or 1 I can't follow why you want to move over to a sequence. This must be because of some iteration or concatination of several 0-1 list, but by keeping the match statement you also keep the redability.

By on 12/21/2008 11:10 AM ()

Moving to a sequence was only in an attempt to see if I was able to shorten the original expression.

But it's not something I'd use as it muddles the intent and probably hurts performance.

By on 12/21/2008 4:58 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper