Softanza
StartFrançais
Softanza
The book · Chapter 6 · The proof of each chapter

Walk, ask, produce, act

This chapter has 6 cells and writes 10 promises. In each of its four editions its cells were run in one fresh process on 2026-10-08 20:15: English, 6 cells ran, 10 promises kept; Français, 6 cells ran, 10 promises kept; العربية, 6 cells ran, 10 promises kept; Hausa, 6 cells ran, 10 promises kept. The four editions make the same promises, cell for cell. No edition stores any output.

The guard

The course's guard is course_narrated.ring(opens in a new tab): it runs every chapter in all four languages, compares the promises from one edition to the next, and has every exercise prove itself on its wrong and right answers. This page asked the same questions of the same objects, in one process inside the library, at commit 0e72e2e2c. To prove this chapter alone, from your copy of the repository:

cd libraries/stzlib/base/test/education
# run course_narrated with the repository's runtime, for this chapter:
#   course_narrated walk-ask-produce-act

run on 2026-10-08 20:15 inside the library at commit 4a184e6f0, in 246.4 s for the whole book · The four editions of the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

The reader stores no output, by the course's own law; this page is the record of a run, made for it.

The cells, run

Cell 1 · 1. Walk: the positions, then what is there

Softanza
aOrders = [ "tea", "rice", "tea", "fish", "rice", "tea", "soup", "tea", "rice" ]
? @@( StzListQ([ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]).FindW("@item % 3 = 1") )
#--> [ 1, 4, 7 ]
? @@( StzListQ(aOrders).ItemsAtPositions([ 1, 4, 7 ]) )
#--> [ "tea", "fish", "soup" ]
Output of this run
[ 1, 4, 7 ]
[ "tea", "fish", "soup" ]

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 2 · 2. Ask: a question answers TRUE or FALSE

Softanza
? StzListQ(aOrders).Contains("soup")
#--> TRUE
? Q("cold").IsLowercase()
#--> TRUE
Output of this run
1
1

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 3 · 3. Produce: a yielder makes new values from old ones

Softanza
oY = new stzYielder([ 12, 0, 30, -5, 18 ])
? @@( oY.Filter(:IsPositive) )
#--> [ 12, 30, 18 ]
? @@( oY.Map(:Double) )
#--> [ 24, 0, 60, -10, 36 ]
? oY.Reduce(:Sum)
#--> 55
Output of this run
[ 12, 30, 18 ]
[ 24, 0, 60, -10, 36 ]
55

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 4 · 4. The moves chain

Softanza
? oY.FilterQ(:IsPositive).Reduce(:Sum)
#--> 60
Output of this run
60

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 5 · 5. Act: a verb changes the data

Softanza
oL = new stzList(aOrders)
oL.RemoveAll("tea")
? @@( oL.Content() )
#--> [ "rice", "fish", "rice", "soup", "rice" ]
Output of this run
[ "rice", "fish", "rice", "soup", "rice" ]

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

Cell 6 · 6. A condition can be handed over as data

Softanza
? @@( StzListQ([ 12, 0, 30, -5, 18 ]).ItemsW("@item > 0") )
#--> [ 12, 30, 18 ]
Output of this run
[ 12, 30, 18 ]

ran: the promise is kept · in all four editions

This cell in the chapter: English(opens in a new tab) · Français(opens in a new tab) · العربية(opens in a new tab) · Hausa(opens in a new tab)

The exercises

Every exercise proves itself: its wrong answers are refused and its right answers accepted.

ex-06-01 · Exercise 6.1 · The day's takings

2 of 2 wrong answers refused, 2 of 2 right answers accepted

01-adds-the-refund.ring refused · 02-filters-and-stops.ring refused · 01-filter-then-reduce.ring accepted · 02-the-condition-as-data.ring accepted

The exercise's folder(opens in a new tab)