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

Version Path
trackler-2.2.1.159 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.158 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.157 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.156 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.155 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.154 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.153 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.152 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.151 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.150 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.149 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.148 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.147 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.146 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.145 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.144 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.143 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.142 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.141 tracks/nim/exercises/allergies/example.nim
trackler-2.2.1.140 tracks/nim/exercises/allergies/example.nim