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.180 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.179 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.178 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.177 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.176 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.175 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.174 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.173 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.172 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.171 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.170 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.169 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.167 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.166 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.165 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.164 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.163 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.162 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.161 tracks/elm/exercises/strain/Strain.example.elm
trackler-2.2.1.160 tracks/elm/exercises/strain/Strain.example.elm