From a4994371c0b0fbea9d2802acc22d9cc3977a0de0 Mon Sep 17 00:00:00 2001 From: Cliff Click Date: Sun, 4 Oct 2026 13:30:41 -0700 Subject: Slides for 2026 REBASE --- docs/2026_REBASE/demos/aliases.smp | 5 +++++ docs/2026_REBASE/demos/arithmetic.smp | 3 +++ docs/2026_REBASE/demos/backend.smp | 6 ++++++ docs/2026_REBASE/demos/control.smp | 9 +++++++++ docs/2026_REBASE/demos/inline.smp | 3 +++ docs/2026_REBASE/demos/memory.smp | 10 ++++++++++ docs/2026_REBASE/demos/methods.smp | 11 +++++++++++ docs/2026_REBASE/demos/sccp.smp | 4 ++++ 8 files changed, 51 insertions(+) create mode 100644 docs/2026_REBASE/demos/aliases.smp create mode 100644 docs/2026_REBASE/demos/arithmetic.smp create mode 100644 docs/2026_REBASE/demos/backend.smp create mode 100644 docs/2026_REBASE/demos/control.smp create mode 100644 docs/2026_REBASE/demos/inline.smp create mode 100644 docs/2026_REBASE/demos/memory.smp create mode 100644 docs/2026_REBASE/demos/methods.smp create mode 100644 docs/2026_REBASE/demos/sccp.smp (limited to 'docs/2026_REBASE/demos') diff --git a/docs/2026_REBASE/demos/aliases.smp b/docs/2026_REBASE/demos/aliases.smp new file mode 100644 index 00000000..a8ee471f --- /dev/null +++ b/docs/2026_REBASE/demos/aliases.smp @@ -0,0 +1,5 @@ +struct Pair { int x; int y; }; +val p = new Pair { x = arg; y = 10; }; +int before = p.x; +p.y = 99; +return p.x - before; diff --git a/docs/2026_REBASE/demos/arithmetic.smp b/docs/2026_REBASE/demos/arithmetic.smp new file mode 100644 index 00000000..ef19a5bd --- /dev/null +++ b/docs/2026_REBASE/demos/arithmetic.smp @@ -0,0 +1,3 @@ +int x = arg + 0; +int y = 1 + x + 2; +return y + x + 3; diff --git a/docs/2026_REBASE/demos/backend.smp b/docs/2026_REBASE/demos/backend.smp new file mode 100644 index 00000000..de8f7665 --- /dev/null +++ b/docs/2026_REBASE/demos/backend.smp @@ -0,0 +1,6 @@ +struct Box { int x; }; +return { !Box box, int arg -> + int n = arg < 0 ? -arg : arg; + box.x += n; + return n; +}; diff --git a/docs/2026_REBASE/demos/control.smp b/docs/2026_REBASE/demos/control.smp new file mode 100644 index 00000000..6b7b1b17 --- /dev/null +++ b/docs/2026_REBASE/demos/control.smp @@ -0,0 +1,9 @@ +int n = arg; +if( n < 0 ) n = -n; +int sum = 0; +int i = 0; +while( i < n ) { + i = i + 1; + sum = sum + i; +} +return sum; diff --git a/docs/2026_REBASE/demos/inline.smp b/docs/2026_REBASE/demos/inline.smp new file mode 100644 index 00000000..9d38e5b0 --- /dev/null +++ b/docs/2026_REBASE/demos/inline.smp @@ -0,0 +1,3 @@ +val add1 = { int x -> x + 1; }; +val twice = { int x -> x * 2; }; +return twice(1 + add1(2)) + 3; diff --git a/docs/2026_REBASE/demos/memory.smp b/docs/2026_REBASE/demos/memory.smp new file mode 100644 index 00000000..466c0476 --- /dev/null +++ b/docs/2026_REBASE/demos/memory.smp @@ -0,0 +1,10 @@ +struct Totals { int sum; int visits; }; +val t = new Totals; +val data = new int[4]; +for( int i = 0; i < data#; i++ ) + data[i] = arg + i; +for( int i = 0; i < data#; i++ ) { + t.sum = t.sum + data[i]; + t.visits++; +} +return t.sum + t.visits; diff --git a/docs/2026_REBASE/demos/methods.smp b/docs/2026_REBASE/demos/methods.smp new file mode 100644 index 00000000..683540c3 --- /dev/null +++ b/docs/2026_REBASE/demos/methods.smp @@ -0,0 +1,11 @@ +struct Counter { + int n; + val add = { int delta -> + n += delta; + return self; + }; + val get = { -> return n; }; +}; +!Counter c = new Counter { n = arg; }; +c.add(3).add(4); +return c.get(); diff --git a/docs/2026_REBASE/demos/sccp.smp b/docs/2026_REBASE/demos/sccp.smp new file mode 100644 index 00000000..da91691d --- /dev/null +++ b/docs/2026_REBASE/demos/sccp.smp @@ -0,0 +1,4 @@ +int x = 1; +for( int i = 0; i < arg; i++ ) + x = 2 - x; +return x; -- cgit v1.2.3