listl = {1, 4, 3, 2, 5};
Using ReplaceList
:
ReplaceList[Split[lista(*Find elements greater than the one before*)
ReplaceList[Split[l, Less], {___, s : {a_, b__} /; a < b, ___} :> Last@s]
(*{4, 5}*)
(*Find elements smaller than the next one*)
ReplaceList[Split[l, Less], {___, s : {a_, b__} /; a < b, ___} :> First@s]
(*{1, 2}*)
(*Find a valley*)
ReplaceList[Split[l, Greater], {___, s : {a_, b_, c_} /; a > b, ___} :> Last@s]
(*{2}*)
(*Find a peak*)
ReplaceList[Split[l, Greater], {___, s : {a_, b_, c_} /; a > b, ___} :> First@s]
(*{4}*)
{4, 5}