3 ms·
NIL is fine ... as long as you have some container for the opposite. There should be a way to express Maybe<Maybe<T>>, aka an optional optional value. The Sto
by paulddraper 11y ago
NIL is fine ... as long as you have some container for the opposite.
There should be a way to express Maybe<Maybe<T>>, aka an optional optional value.
The Store article in the article is an example of when this would be needed: a cache optionally has an optional phone number for a person.
If Lisp has the equivalent of Maybe<Maybe<T>> (perhaps a singleton list of a singleton list?), then the optionality is composable. Otherwise, the optionality is not really composable, and you will have problems.
- kazinator 11y agoThe optionality is composable, because we can have the nonexistence of a cache entry (cache lookup fails, perhaps indicating so by returning nil instead of a cache entry) paired with the possibility that cache entry which exists (successful lookup) has a nil value for a phone number.