Mark partial functions as such

Frerich Raabe raabe at froglogic.com
Fri Aug 31 06:21:55 UTC 2018


Hi David,

On 2018-08-31 04:09, David Feuer wrote:
> What about functions like length? length (repeat ()) is bottom. repeat () is 
> not bottom. Ergo, length is partial.

This caught me by surprise - I would have never considered 'length' to be a 
partial function! Maybe I don't quite understand what it means for some 
expression to be 'bottom' (I thought that's the same as 'undefined').

My naive understanding was that a partial function is one which has no 
definition for certain arguments; in particular, it has no definition which 
could be used while doing equational reasoning by hand, on a piece of paper 
(i.e. without running the program).

It appears that this is not quite correct -- instead, any function which 
fails to return anything (at runtime!) for certain arguments is partial? E.g. 
'sort' would be partial or even 'elem' (consider 'True `elem` repeat False')?

-- 
Frerich Raabe - raabe at froglogic.com
www.froglogic.com - Multi-Platform GUI Testing


More information about the Libraries mailing list