Sha256: b2b943c3f31d9967b7fb76e28e7c356f7db2b679d88beabc4862062adb46aec0

Contents?: true

Size: 435 Bytes

Versions: 66

Compression:

Stored size: 435 Bytes

Contents

module Strain exposing (discard, keep)

import List


keep : (a -> Bool) -> List a -> List a
keep predicate list =
    List.foldr (consIf predicate) [] list


discard : (a -> Bool) -> List a -> List a
discard predicate list =
    List.foldr (consIf (\v -> not <| predicate v)) [] list


consIf : (a -> Bool) -> a -> List a -> List a
consIf predicate value list =
    if predicate value then
        value :: list
    else
        list

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.118 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.117 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.116 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.115 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.114 tracks/elm/exercises/strain/Strain.example.elm