-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Describe computed diagram for factorial in preprocessor readme
- Loading branch information
1 parent
cac01a8
commit 3166a46
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Fun and learning with the PlantUML preprocessor | ||
|
||
The PlantUML preprocessor provides a higher level abstraction to generate the diagram | ||
descriptions. It can also be used as a programming language to _compute_ the diagrams! | ||
|
||
The preprocessor provides variables, conditional expressions, looping constructs, and | ||
even functions, making it a full fledged Turing complete language. | ||
|
||
This also enables having some fun while learning the preprocessor features. In this | ||
document, I describe some such examples. **All of them are my original work.** | ||
|
||
The example diagrams shown here are _computed_ by PlantUML, not manually described in | ||
puml files. | ||
|
||
1. **Compute factorial of a number**: uses and draws the recursion! | ||
|
||
This _hacks_ a state diagram to denote the recursive calls and the computed | ||
factorial value for each number. The `!function` feature defines the factorial | ||
function that computes the factorial, creates the states and draws the connections | ||
between the states. | ||
|
||
https://github.com/dragondive/plantuml_demo/blob/bfd3b1c018fe5893a8f37a9a01a6d9e0074be6eb/src/preprocessor/factorial_demo.puml#L1-L31 | ||
|
||
 |