Skip to content

Instantly share code, notes, and snippets.

@frame-lang
Last active September 24, 2023 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frame-lang/05e66f6a52f285303ddc36c295966fd7 to your computer and use it in GitHub Desktop.
Save frame-lang/05e66f6a52f285303ddc36c295966fd7 to your computer and use it in GitHub Desktop.
FizzBuzz Frame System Notation (FSN)
--- This program is a Frame solution for this HackerRank problem: https://www.hackerrank.com/challenges/fizzbuzz/problem
`import sys`
`import math`
#![generate_frame_event]
fn main {
#FizzBuzz(>(1,false))
}
#FizzBuzz [>[i:int,newline:bool]]
-machine-
$Fizz
|>| [i:int,newline:bool]
i > 100 ?
-> "i > 100" $End ^
::
newline ? printnl() ::
math.fmod(i,3) == 0 ?
print("Fizz")
-> (i, true) "i % 3 == 0" $Buzz
:
-> (i, false) "i % 3 != 0" $Buzz
:: ^
$Buzz
|>| [i:int,fizzed:bool]
math.fmod(i,5) == 0 ?
print("Buzz")
-> (i+1,true) "i % 5 == 0" $Fizz ^
::
fizzed ?
-> (i+1,true) "fizzed" $Fizz ^
::
-> (i) "! mod3 | mod5" $Digit ^
$Digit
|>| [i:int]
print(i)
-> (i+1,true) "loop" $Fizz ^
$End
-actions-
print [msg] {
```
print(msg,end="")
```
}
printnl {
```
print("")
```
}
##
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment