-
Notifications
You must be signed in to change notification settings - Fork 71
/
cuneiform.cfl
74 lines (47 loc) · 1.46 KB
/
cuneiform.cfl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
%%====================================================================
%% Functions
%%====================================================================
def range( first : Str, last : Str ) ->
<number_lst : [Str]>
in Python *{
number_lst = [str( x ) for x in range( int( first ), int( last )+1 )]
}*
def is_multiple( number : Str, divisor : Str ) ->
<is_multiple : Bool>
in Python *{
is_multiple = int( number ) % int( divisor ) == 0
}*
%%====================================================================
%% Constants
%%====================================================================
let last : Str = 100;
%%====================================================================
%% Workflow
%%====================================================================
let <number_lst = number_lst : [Str]> =
range( first = 1,
last = last );
let fizzbuzz_lst : [Str] =
for x <- number_lst do
let <is_multiple = f : Bool> =
is_multiple( number = x,
divisor = 3 );
let <is_multiple = b : Bool> =
is_multiple( number = x,
divisor = 5 );
if ( f and b ) then "FizzBuzz"
else
if f then "Fizz"
else
if b then "Buzz"
else
x
end
end
end
: Str
end;
%%====================================================================
%% Query
%%====================================================================
fizzbuzz_lst;