Different Names

Different programming languages sometimes choose different names for similar operations. If you're new to Roc, you may be searching for a familiar operation and not find it because that operation (or a similar one) goes by a different name in Roc.

To help with this, here are some Roc operations along with some names found in other languages for similar operations.

Roc NameOther Names
List.fold
  • foldl
  • foldLeft
  • fold_left
  • fold-left
  • reduce
  • lreduce
  • array_reduce
  • inject
  • accumulate
  • Aggregate
  • walk
List.fold_rev
  • foldr
  • foldRight
  • fold_right
  • fold-right
  • reduceRight
  • rreduce
  • walk_backwards
List.first
  • head
  • get(0)
  • [0]
List.keep_if
  • filter
  • select
  • copy_if
  • remove-if-not
List.drop_if
  • reject
  • remove_copy_if
  • remove-if
?
  • bind
  • flatMap
  • andThen
  • (>>=)
  • Result.try
List.map2(x, y, |a, b| (a, b))
  • zip