Skip to main content
100%

Factorial in Scala

✓ Published0🌍 Public
CCliffordAnderson
Last edited Apr 10, 2019
Created on Apr 10, 2019

This visualization demonstrates the recursive computation of factorial values in Scala, tracing the call stack from `fac(10)` down to the base case. The code defines a function `fac(num: Int): Int` that multiplies each number by the factorial of its predecessor, halting at 1. The example renders this execution as a branching tree, where each node represents a function call and its return value. The visualization uses Scala’s standard recursion mechanism, with no external libraries; the data is generated directly from the source gist by CliffordAnderson. The rendering approach likely relies on a custom drawing routine, though the code snippet itself only shows the pure function logic, not the display layer.

AI-generated description

Similar vizzes