Sha256: ab8d40b855cc42511656de10076f588bea16f24a0443eafe35e2a36a3e643f3e
Contents?: true
Size: 694 Bytes
Versions: 38
Compression:
Stored size: 694 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 fst
Version data entries
38 entries across 38 versions & 1 rubygems