Sha256: d4f0122960b835bed99b9cbd9576e2d9b0cf525a2d340fd93c06935810986962
Contents?: true
Size: 546 Bytes
Versions: 38
Compression:
Stored size: 546 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.shiftLeft 1 i, n )) |> List.filter (\( s, n ) -> Bitwise.and s score > 0) |> List.map snd allergies : List String allergies = [ "eggs" , "peanuts" , "shellfish" , "strawberries" , "tomatoes" , "chocolate" , "pollen" , "cats" ]
Version data entries
38 entries across 38 versions & 1 rubygems