you could perhaps optimize it to leverage the "tail-recurssive" optimization by doing something like this btw:
nthElementHelper:Lista->Int->ResultStringanthElementHelperlistn=case(n,list)of(_,[])->Err("List too short by "++String.fromInt(n+1)++pluralizen"element""elements")(0,x::_)->Okx(nth,_::rest)->nthElementHelperrest(nth-1)
you could perhaps optimize it to leverage the "tail-recurssive" optimization by doing something like this btw:
although come to think of it you're already doing "tail-recurssion"
yeah, I'm already doing that
I still prefer the
case of
on a tuple than acase of
with someif then else
branching inside but that's personal taste :)