[Haskell-beginners] How to process a list that contains "undefined" values?

Costello, Roger L. costello at mitre.org
Sat Jul 2 16:09:05 CEST 2011


Hi Folks,

How would you find the maximum value in this list:

     [undefined, 10, undefined, 20]

Is it bad practice to create lists that contain undefined values? 

If yes, what is a better way to express in a list a "no value present/available" value? 

For example would it be better to express the above list using Maybe:

    [Nothing, Just 10, Nothing, Just 20]

Or perhaps something else?

What do you recommend?

/Roger



More information about the Beginners mailing list