Sha256: cbaa6178b084c87e987aa068cc5b63d29d62d2dd3b160b457ec3e6c1d0dffc6f
Contents?: true
Size: 492 Bytes
Versions: 23
Compression:
Stored size: 492 Bytes
Contents
import sequtils type Allergies* = object score*: int var allergiesList = [ "eggs", "peanuts", "shellfish", "strawberries", "tomatoes", "chocolate", "pollen", "cats" ] proc is_allergic_to*(allergies: Allergies, allergy: string): bool = (allergies.score and 1 shl allergiesList.find(allergy)) != 0 proc lst*(allergies: Allergies): seq[string] = allergiesList.filterIt(allergies.is_allergic_to(it))
Version data entries
23 entries across 23 versions & 1 rubygems