From 22df891893d30e9906d0b14fc3ae5d8e67d500b2 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 3 Oct 2026 14:03:48 -0700 Subject: 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 --- chapter22/docs/examples/BubbleSort.smp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'chapter22/docs') 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]; -- cgit v1.2.3