Skip to content

Instantly share code, notes, and snippets.

@themexpride
Created December 16, 2022 07:30
Show Gist options
  • Save themexpride/b73123694394c46be28bcfbd90b612d1 to your computer and use it in GitHub Desktop.
Save themexpride/b73123694394c46be28bcfbd90b612d1 to your computer and use it in GitHub Desktop.
List Length. Figure out the length of a list without using count, size, or length operators.
def f(arr:List[Int]):Int = if (arr.isEmpty) 0 else 1 + f(arr.tail)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment