4 kyu
Church numbers
343 of 558CarstenKoenig
Description:
The goal of this little kata to implement
- addition
- multiplication
- power
functions for Church numerals that are represented as
newtype Number = Nr (forall a. (a -> a) -> a -> a)
zero :: Number
zero = Nr (\ _ z -> z)
succ :: Number -> Number
succ (Nr a) = Nr (\ s z -> s (a s z))
one :: Number
one = succ zero
hints
- you can finish it by just replacing the
undefined
placeholders in Haskell / typed holes in PureScript - no need to change the arguments - they might provide some hints. - the solutions can be very short - you don't have to write much if you think about it
- you don't really need lambda-functions
- But if you feel like it replace them with your own ideas.
Puzzles
Similar Kata:
Stats:
Created | Nov 20, 2014 |
Published | Nov 20, 2014 |
Warriors Trained | 2164 |
Total Skips | 509 |
Total Code Submissions | 1888 |
Total Times Completed | 558 |
Haskell Completions | 343 |
PureScript Completions | 22 |
JavaScript Completions | 117 |
λ Calculus Completions | 55 |
Python Completions | 98 |
Total Stars | 73 |
% of votes with a positive feedback rating | 93% of 144 |
Total "Very Satisfied" Votes | 128 |
Total "Somewhat Satisfied" Votes | 13 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 23 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 2 kyu |
Lowest Assessed Rank | 7 kyu |