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 Name Other Names
List.walk
  • fold
  • foldl
  • foldLeft
  • fold_left
  • fold-left
  • reduce
  • lreduce
  • array_reduce
  • inject
  • accumulate
  • Aggregate
List.walkBackwards
  • foldr
  • foldRight
  • fold_right
  • fold-right
  • reduceRight
  • rreduce
List.first
  • head
  • get(0)
  • [0]
List.keepIf
  • filter
  • select
  • copy_if
  • remove-if-not
List.dropIf
  • reject
  • remove_copy_if
  • remove-if
List.join
  • flatten
  • flat
  • concat
  • smoosh
List.joinMap
  • filterMap
  • filter_map
List.keepOks
  • compact
  • filterMap(identity)
Result.try
  • bind
  • flatMap
  • andThen
  • (>>=)