-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(examples): return example with subcomponents for add real numbers
- Loading branch information
Showing
5 changed files
with
46 additions
and
22 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
This file was deleted.
Oops, something went wrong.
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
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
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,42 @@ | ||
// Here we learn how to handle errors by fixing this simple program | ||
|
||
import { | ||
std/io | ||
std/strconv | ||
} | ||
|
||
components { | ||
Main(enter any) (exit any) { | ||
nodes { | ||
reader1 IntReader | ||
reader2 IntReader | ||
adder PortBridge { handler Adder<int> } | ||
printer Printer<any> | ||
} | ||
net { | ||
in:enter -> reader1.sig | ||
reader1:num -> { | ||
adder:seq[0] | ||
reader2:sig | ||
} | ||
reader1:err -> printer:msg | ||
reader2.num -> adder.seq[1] | ||
reader2.err -> printer:msg | ||
adder.res -> printer:msg | ||
printer:msg -> out:exit | ||
} | ||
} | ||
|
||
IntReader(sig any) (num int, err error) { | ||
nodes { | ||
reader io.Reader | ||
parser strconv.NumParser<int> | ||
} | ||
net { | ||
in:sig -> reader:sig | ||
reader:s -> parser:s | ||
parser:num -> out:num | ||
parser:err -> out:err | ||
} | ||
} | ||
} |