a procedure or subroutine, implemented in a programming language, whose implementation references itself
what a recursive function does
But let's do it anyway!
attendRC :: Person -> Time -> Person
attendRC :: Person -> Time -> Person attendRC p t = attendRC (exp p) (t - 1)
-- Have awesome experiences
exp :: Person -> Person
attendRC :: Person -> [ Person -> Person ] Time -> Person attendRC p fs t = attendRC (foldr ($) p fs ) fs (t - 1)
dayAtRC :: Person -> Person dayAtRC libby = foldr ($) libby
[ drinkCoffee,
codeGame,
eatPadThai,
pairWithNikki ]
attendRC :: Person ->
[ Person -> Person ]
Time ->
Person
attendRC p _ 0 = neverGraduate p
attendRC p fs t = attendRC
(foldr ($) p fs )
fs
(t - 1)
type Person = ()
type Time = Int
neverGraduate :: Person -> Person
neverGraduate p = undefined
attendRC :: Person ->
[ Person -> Person ]
Time ->
Person
attendRC p _ 0 = neverGraduate p
attendRC p fs t = attendRC
(foldr ($) p fs )
fs
(t - 1)