6 ms·
Doesn't seem all that tough to me my_len_acc :: [a] -> Int -> Int my_len_acc [] so_far = so_far my_len_acc (_:xs) so_far = my_len_acc xs $ so_far + 1
by Locke1689 17y ago
Doesn't seem all that tough to me
my_len_acc :: [a] -> Int -> Int
my_len_acc [] so_far = so_far
my_len_acc (_:xs) so_far = my_len_acc xs $ so_far + 1
my_len :: [a] -> Int
my_len some_str = my_len_acc some_str 0
- Zak 17y ago$ and + are built-in functions being used with infix syntax.
- Locke1689 17y agoWithout such built-in functions like application or arithmetic this is impossible in every language. Consider: without application you cannot consider such a language general recursive and therefore it is not Turing complete according to the Church-Turing thesis.
- Zak 17y agoHence my claim about the near-impossibility of the task.