Join Exercism’s Roc Track for access to 105 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.17.0/lZFLstMUCUvd5bjnnpYromZJXkQUrdhbva4xdBInicE.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.
Compute Pascal's triangle up to a given number of rows.
Parse and evaluate simple math word problems returning the answer as an integer.
Use the Sieve of Eratosthenes to find all the primes from 2 up to a given number.
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 105 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.