I want do do something like:
>enumerate [\"banana\", \"potato\", \"ice\"]
[(1, \"banana\"), (2, \"potato\"), (3, \"ice\")]
I wrote:
<
Don't be afraid to write a support function, in fact, see it as opportunity: Why the arbitrary starting value 1? Why not have a function
>enumerateFrom 42 ["banana", "potato", "ice"]
[(42, "banana"), (43, "potato"), (44, "ice")]
Once you have that, enumerate
is easy.
Edit:
Either give your aux
function a real name, IMHO enumerateFrom
is good or move it into a where
clause if you know that already. And listen to chi, use x : ...
instead of [x] ++ ...