Last active
January 13, 2025 08:15
-
-
Save jacob-ebey/710aafdcf048e524f32fb67247100411 to your computer and use it in GitHub Desktop.
Revisions
-
jacob-ebey revised this gist
Jan 13, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -12,7 +12,7 @@ def Main(start any) (stop any) { // Set the range from user input to -1 readInt:res -> range:from -1 -> range:to // If readInt errors, print it readInt:err -> printErr // Print lines for each number in the range range -> print -> wait -
jacob-ebey revised this gist
Jan 13, 2025 . 1 changed file with 6 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -7,11 +7,16 @@ def Main(start any) (stop any) { range Range printErr fmt.Println --- // Notify the range and readInt actions to start :start -> [range:sig, readInt] // Set the range from user input to -1 readInt:res -> range:from -1 -> range:to // If readInt returns errors, print it readInt:err -> printErr // Print lines for each number in the range range -> print -> wait // If we are done waiting, or have printed an error, stop [wait, printErr] -> :stop } -
jacob-ebey created this gist
Jan 13, 2025 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,71 @@ import { fmt, strconv, strings } def Main(start any) (stop any) { print For<int>{Next2Lines} wait Wait readInt ReadInt range Range printErr fmt.Println --- :start -> [range:sig, readInt] -1 -> range:to readInt:res -> range:from readInt:err -> printErr range -> print -> wait [wait, printErr] -> :stop } def ReadInt(sig any) (res int, err error) { fmt.Scanln strconv.ParseNum<int> --- :sig -> scanln -> parseNum parseNum:res -> :res parseNum:err -> :err } def Next2Lines(data int) (sig any) { first Tap<int>{FirstLine} dec Dec<int> second SecondLine --- :data -> first -> dec -> second -> :sig } def FirstLine(data int) (sig any) { p1 fmt.Println p2 fmt.Println p3 fmt.Printf panic Panic --- :data -> switch { 0 -> 'No more bottles of beer on the wall, no more bottles of beer.' -> p1 1 -> '1 bottle of beer on the wall, 1 bottle of beer.' -> p2 _ -> [ p3:args[0], '$0 bottles of beer on the wall, $0 bottles of beer.\n' -> p3:tpl ] } [p1, p2, p3:sig] -> :sig p3:err -> panic } def SecondLine(data int) (sig any) { p1 fmt.Println p2 fmt.Println p3 fmt.Println p4 fmt.Printf panic Panic --- :data -> switch { -1 -> 'Go to the store and buy some more, 99 bottles of beer on the wall.' -> p1 0 -> 'Take one down and pass it around, no more bottles of beer on the wall.\n' -> p2 1 -> 'Take one down and pass it around, 1 bottle of beer on the wall.\n' -> p3 _ -> [ p4:args[0], 'Take one down and pass it around, $0 bottles of beer on the wall.\n\n' -> p4:tpl ] } [p1, p2, p3, p4:sig] -> :sig p4:err -> panic }