Sha256: 7c527bef4fd75a0bd834a8e54ca9e1bc59d0a35f4623b69a7fe6890fba50186a
Contents?: true
Size: 702 Bytes
Versions: 284
Compression:
Stored size: 702 Bytes
Contents
module GradeSchool exposing (..) import Dict exposing (..) type alias Grade = Int type alias Student = String type alias School = Dict Int (List Student) empty : School empty = Dict.empty addStudent : Grade -> Student -> School -> School addStudent grade student school = Dict.insert grade (List.sort (student :: (studentsInGrade grade school))) school studentsInGrade : Grade -> School -> List Student studentsInGrade grade school = case (Dict.get grade school) of Just list -> list Nothing -> [] allStudents : School -> List ( Grade, List Student ) allStudents school = Dict.toList school |> List.sortBy Tuple.first
Version data entries
284 entries across 284 versions & 1 rubygems