ninetynine-1.3.0: Ninety-Nine Haskell Problems
CopyrightCopyright (C) 2021 Yoo Chung
LicenseGPL-3.0-or-later
Maintainerdev@chungyc.org
Safe HaskellSafe-Inferred
LanguageGHC2021

Problems.P02

Description

Part of Ninety-Nine Haskell Problems. Some solutions are in Solutions.P02.

Synopsis

Documentation

myButLast :: [a] -> Maybe a Source #

Find the last but one element of a list.

Examples

>>> myButLast [1,2,3,4]
Just 3
>>> myButLast ['a'..'z']
Just 'y'
>>> myButLast ['a']
Nothing