FizzBuzz in CUE
This FizzBuzz implementations in CUE, a simple example of a standard program written in a logic structural paradigm.
In a few lines, we can elaborate on many CUE core concepts, e.g. emit values, hidden fields, if-then-else, comprehensions, embedding, lists, ...
We can execute our program in the CLI with
cue def fizzbuzz.cue | cat - <(echo '#max: 21') | cue export - --out=text
The cat - <(echo '#max: 21')
part adds to fizzbuzz.cue
a refinement of the #max
value, thus taking precedence on the default in the file. It is equivalent to having set some input parameters values to our CUE script.