Help, please, find the lower peaks of the list. For example, given an array [1,5,4,6,3] the answer would be [1,4,3]

lower_peaks([X,Y|T],[X|L]):-X<Y, lp2([Y|T],L). lower_peaks([X,Y|T],L):-lp2([X,Y|T],L). lp2([X,Y],[Y]):-Y<X. lp2([_,_],[]). lp2([X,Y,Z|T],[Y|L]):-Y<X,Y<Z,lp2([Y,Z|T],L). lp2([X,Y,Z|T],L):-lp2([Y,Z|T],L). 
  • Describe in more detail what is the lower peak, I can not understand something - Cost

0