Join Exercism’s Roc Track for access to 92 exercises with automatic analysis of your code and personal mentoring, all 100% free.
app [main] { pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.15.0/SlwdbJ-3GR7uBWQo6zlmYWNYOxnvo8r6YABXD-45UOw.tar.br" }
import pf.Stdout
factorial = \number ->
when number is
1 -> 1
n -> n * factorial (n - 1)
expect factorial 5 == 1 * 2 * 3 * 4 * 5
main =
result = factorial 20 |> Num.toStr
Stdout.line! "factorial 20 = $(result)"
Get better at programming through fun, rewarding coding exercises that test your understanding of concepts with Exercism.
Convert color codes, as used on resistors, to a numeric value.
Take a nested list and return a single list with all values except nil/null.
Given a phrase, count the occurrences of each word in that phrase.
Roc code is designed to build fast and run fast. It compiles to machine code or WebAssembly.
Roc has a small number of simple language primitives. It's a single-paradigm functional language.
Roc's syntax, semantics, and included toolset all prioritize user-friendliness.
Roc's powerful type system and immutability lead to more predictable and maintainable code.
Roc works well with other languages, making it easier to integrate into existing projects.
Roc is a young language, and it is evolving fast.
Every language has its own way of doing things. Roc is no different. Our mentors will help you learn to think like a Roc developer and how to write idiomatic code in Roc. Once you've solved an exercise, submit it to our volunteer team, and they'll give you hints, ideas, and feedback on how to make it feel more like what you'd normally see in Roc - they'll help you discover the things you don't know that you don't know.
Learn more about mentoringThe Roc track on Exercism has 92 exercises to help you write better code. Discover new exercises as you progress and get engrossed in learning new concepts and improving the way you currently write.
See all Roc exercisesThe best part, it’s 100% free for everyone.