6 kyu
Sum of list of Integer Just's and Nothing's
120 of 148wichu
Description:
Your task is to write a function sumJusts
that will take a list of Maybe Integer
(PureScript: Maybe Int
) elements and return a Just
element with boxed value of sum of all list items.
List may contain Nothing
elements. If so, treat Nothing
as Just 0
.
You may assume the list is nonempty. As such, your solution need not consider this case (though you could if you wanted to) - this is reflected in PureScript by the Partial
type class constraint on the function signature of sumJusts
.
For example:
sumJusts [Just 1, Just 2] = Just 3
sumJusts [Just 1, Just 2, Nothing] = Just 3
Fundamentals
Similar Kata:
Stats:
Created | Sep 15, 2016 |
Published | Sep 15, 2016 |
Warriors Trained | 260 |
Total Skips | 14 |
Total Code Submissions | 370 |
Total Times Completed | 148 |
Haskell Completions | 120 |
PureScript Completions | 36 |
Total Stars | 5 |
% of votes with a positive feedback rating | 91% of 48 |
Total "Very Satisfied" Votes | 42 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 11 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 8 kyu |