summaryrefslogtreecommitdiff
path: root/chapter22/docs/examples
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-10-03 14:03:48 -0700
committerCliff Click <cliffc@acm.org>2026-10-03 14:03:48 -0700
commit22df891893d30e9906d0b14fc3ae5d8e67d500b2 (patch)
tree2bda142f92febc8b26f1cabd4bb0c46d1864f34b /chapter22/docs/examples
parentc3958e34c0de21df52e57e47e4f47ffe6464f138 (diff)
downloadSimple-22df891893d30e9906d0b14fc3ae5d8e67d500b2.tar.gz
Simple-22df891893d30e9906d0b14fc3ae5d8e67d500b2.zip
Chapter renumber, and split ch 17
Renumber chapters 10a, 10b, 11, 12, 13, 14 -> 10, 11, 13, 12, [11,14]. Split ch 17 into a 17a and 17b; shuffle around im/mutable syntax to be consistent, and present it more slowly. THe new immutable syntax is pushed through all later chapters
Diffstat (limited to 'chapter22/docs/examples')
-rw-r--r--chapter22/docs/examples/BubbleSort.smp10
1 files changed, 5 insertions, 5 deletions
diff --git a/chapter22/docs/examples/BubbleSort.smp b/chapter22/docs/examples/BubbleSort.smp
index aa9cbbb8..a491bd82 100644
--- a/chapter22/docs/examples/BubbleSort.smp
+++ b/chapter22/docs/examples/BubbleSort.smp
@@ -20,27 +20,27 @@ struct Scan {
};
// Skip whitespace
-val skip = { Scan s ->
+val skip = { !Scan s ->
while( s.buf[s.x] <= ' ' )
s.x++;
};
// Require specific syntax or usage
-val require = { Scan s, u8 c ->
+val require = { !Scan !s, u8 c ->
skip(s);
if( s.buf[s.x++] != c )
usage();
};
-val peek = { Scan s, u8 c ->
+val peek = { !Scan !s, u8 c ->
skip(s);
if( s.buf[s.x] != c ) return false;
s.x++;
return true;
};
-val number = { Scan s ->
+val number = { !Scan s ->
skip(s);
i32 n = 0;
while( '0' <= s.buf[s.x] & s.buf[s.x] <= '9' )
@@ -64,7 +64,7 @@ val sort = { int[] ns, int len ->
// Read from stdin a line of the form "[ 4, 3, 2, 1]" and print it sorted.
val main = { ->
- Scan !s = new Scan{ buf = sys.io.stdin(); };
+ !Scan !s = new Scan{ buf = sys.io.stdin(); };
require(s,'[');
// Array of parsed results
int[] !ns = new int[16];