summaryrefslogtreecommitdiff
path: root/chapter22/docs
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2025-05-10 10:55:15 -0700
committerCliff Click <cliffc@acm.org>2025-05-10 10:55:15 -0700
commit288912d2a84d035730cad405e32a6afa5dd4f9c6 (patch)
tree30011f79d371d5f6f8ad8a3d869eccf22352b3e9 /chapter22/docs
parentb4eb623979cc9566d2a22c718b4ba8ded3bca5a4 (diff)
downloadSimple-288912d2a84d035730cad405e32a6afa5dd4f9c6.tar.gz
Simple-288912d2a84d035730cad405e32a6afa5dd4f9c6.zip
Move sys.smp to smp directory
Diffstat (limited to 'chapter22/docs')
-rw-r--r--chapter22/docs/examples/BubbleSort.smp3
1 files changed, 3 insertions, 0 deletions
diff --git a/chapter22/docs/examples/BubbleSort.smp b/chapter22/docs/examples/BubbleSort.smp
index a80d6bd8..aa9cbbb8 100644
--- a/chapter22/docs/examples/BubbleSort.smp
+++ b/chapter22/docs/examples/BubbleSort.smp
@@ -5,10 +5,12 @@
//
// Bubble sort, with reading (parsing) and writing (formatting) the data.
+
val _exit = { u8[~] msg ->
sys.io.p(msg);
sys.libc._exit(1);
};
+
val usage = { -> _exit("stdin must look like [4, 3, 2, 1]"); };
// Scanner
@@ -23,6 +25,7 @@ val skip = { Scan s ->
s.x++;
};
+
// Require specific syntax or usage
val require = { Scan s, u8 c ->
skip(s);