Sha256: 6690dc82c043e9df7db6e1cdb4bb49524ac016db2db55490cb2b9ef225b8f6da

Contents?: true

Size: 458 Bytes

Versions: 134

Compression:

Stored size: 458 Bytes

Contents

module Allergies

open System

type Allergen = 
   | Eggs = 1
   | Peanuts = 2
   | Shellfish = 4
   | Strawberries = 8
   | Tomatoes = 16
   | Chocolate = 32
   | Pollen = 64
   | Cats = 128

let allergicTo (codedAllergies: int) (allergen: Allergen) = codedAllergies &&& int allergen <> 0

let list (codedAllergies: int) = 
    Enum.GetValues(typeof<Allergen>) 
    |> Seq.cast<Allergen> 
    |> List.ofSeq 
    |> List.filter (allergicTo codedAllergies)

Version data entries

134 entries across 134 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.179 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.178 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.177 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.176 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.175 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.174 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.173 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.172 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.171 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.170 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.169 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.167 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.166 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.165 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.164 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.163 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.162 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.161 tracks/fsharp/exercises/allergies/Example.fs
trackler-2.2.1.160 tracks/fsharp/exercises/allergies/Example.fs