You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The "safe head" exercise asks us to write a specification for null:
<div class="hwex" id="Safe Head">
Write down a specification for `null` such that `safeHead`
is verified. Do *not* force `null` to only take non-empty inputs,
that defeats the purpose. Instead, its type should say that it
works on *all* lists and returns `True` *if and only if* the input
is non-empty.
</div>
null [] = True
null (_:_) = False
The implementation of null returns true if and only if the input is empty, consistent with its name. So I believe the last word in the text is a mistake?
The text was updated successfully, but these errors were encountered:
The "safe head" exercise asks us to write a specification for
null
:The implementation of
null
returns true if and only if the input is empty, consistent with its name. So I believe the last word in the text is a mistake?The text was updated successfully, but these errors were encountered: