clash-protocols
Safe HaskellNone
LanguageGHC2021

Data.List.Extra

Description

Utility functions that operate on lists, but are not part of List.

Synopsis

Documentation

takeWhileAnyInWindow Source #

Arguments

:: Int

Number of elements to consider since the last element that satisfied the predicate.

-> (a -> Bool)

Function to test each element.

-> [a]

Input list

-> [a]

List of elements that satisfied the predicate. Ends at an element that satisfies the predicate.

Takes elements from a list while the predicate holds, considers up to window elements since the last element that satisfied the predicate.

>>> takeWhileAnyInWindow 3 Prelude.odd [1, 2, 3, 6, 8, 10, 12]
[1,2,3]