From 489672dfac7efc78fc239ba7c2dfc82f1c5fbeab Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sat, 24 Oct 2026 15:41:48 -0700 Subject: Finish chapter numbering, retire combined chapter 24, and update documentation --- chapter24/docs/examples/A_helloWorld.smp | 3 --- chapter24/docs/examples/BubbleSort.smp | 37 -------------------------------- 2 files changed, 40 deletions(-) delete mode 100644 chapter24/docs/examples/A_helloWorld.smp delete mode 100644 chapter24/docs/examples/BubbleSort.smp (limited to 'chapter24/docs/examples') diff --git a/chapter24/docs/examples/A_helloWorld.smp b/chapter24/docs/examples/A_helloWorld.smp deleted file mode 100644 index 07ff935f..00000000 --- a/chapter24/docs/examples/A_helloWorld.smp +++ /dev/null @@ -1,3 +0,0 @@ -// -*- mode: java; -*- -sys.io.p("Hello, World!"); -return 0; diff --git a/chapter24/docs/examples/BubbleSort.smp b/chapter24/docs/examples/BubbleSort.smp deleted file mode 100644 index 938e3181..00000000 --- a/chapter24/docs/examples/BubbleSort.smp +++ /dev/null @@ -1,37 +0,0 @@ -// -*- mode: java; -*- - -// An implementation of -// https://sampleprograms.io/projects/bubble-sort/ -// -// Bubble sort, with reading (parsing) and writing (formatting) the data. - -val sort = { !sys.aryi64 nums -> - var done = false; - while( !done ) { - done = true; - for( var i = 0; i < nums.len-1; i++ ) - if( nums.buf[i] > nums.buf[i+1] ) { - int tmp = nums.buf[i]; - nums.buf[i] = nums.buf[i+1]; - nums.buf[i+1] = tmp; // Swap - done = false; - } - } -}; - -// Read from stdin a line of the form "[ 4, 3, 2, 1]" and print it sorted. -val main = { -> - // Parse array of numbers from stdin - var nums = sys.parseAryI64( sys.io.stdin() ); - if( !nums ) { - sys.io.p("stdin must look like [4, 3, 2, 1]"); - return 1; - } - - // Bubble sort array of integers - sort(nums); - - // Print a list of numbers to stdout - nums.str().write(1); - return 0; -}; -- cgit v1.2.3