11533Re: "ocaml_beginners":: using a list instead of option
- Nov 1, 2009You may need some general functions that lack from the basic standard library:
let unsome default = function
| None -> default
| Some v -> v
let map_some f l =
let rec maps_f accu = function
|  -> accu
| a::l -> maps_f (match f a with None -> accu
| Some r -> r::accu) l
List.rev (maps_f  l)
etc. (see Batteries).
On Sun, Nov 1, 2009 at 11:04 AM, Martin DeMello <martindemello@...> wrote:
> thinking about it, you're right, i was being silly :) code changed to use
> option type.
> On Sat, Oct 31, 2009 at 3:06 PM, Lukasz Stafiniak <lukstafi@...>wrote:
> > I think performance-wise the difference is very small. But you should
> > use the option type to express your program's semantics correctly!
- << Previous post in topic Next post in topic >>