Sha256: b9b75da611f281c4e7ca3e2c23ed85b3fc2d4f59659d56b90c25d5c5dd894367
Contents?: true
Size: 557 Bytes
Versions: 284
Compression:
Stored size: 557 Bytes
Contents
module Allergies exposing (..) import List import Bitwise 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
284 entries across 284 versions & 1 rubygems