Sha256: 780a0a5be9662053b911802f6a0be67ab0d09e1ed9deb726b3a1cbf09d8f23ae
Contents?: true
Size: 575 Bytes
Versions: 66
Compression:
Stored size: 575 Bytes
Contents
module Allergies exposing (isAllergicTo, toList) import Bitwise import List isAllergicTo : String -> Int -> Bool isAllergicTo name score = List.member name (toList score) toList : Int -> List String toList score = allergies |> List.indexedMap (\i n -> ( Bitwise.shiftLeftBy i 1, n )) |> List.filter (\( s, n ) -> Bitwise.and s score > 0) |> List.map Tuple.second allergies : List String allergies = [ "eggs" , "peanuts" , "shellfish" , "strawberries" , "tomatoes" , "chocolate" , "pollen" , "cats" ]
Version data entries
66 entries across 66 versions & 1 rubygems