For what it’s worth, there are two things that cause an if to go false: false and nil
if
false
nil
Empty things are neither false nor nil, but you can’t call first on an empty sequence or you get an exception.
first
Other than that, your solution is really quite similar to the comp source itself.
comp
For what it’s worth, there are two things that cause an
if
to gofalse
:false
andnil
Empty things are neither
false
nornil
, but you can’t callfirst
on an empty sequence or you get an exception.Other than that, your solution is really quite similar to the
comp
source itself.