SCARP v0.0.6-alpha.20

Mutable tuple member replacement

A constant index replaces a member of a var binding.

Compiler: published alpha.20 · b1a9347f93540fdf95b0ddecba4adc55a3b4bb98

Unchanged upstream source: original program · original output (Apache-2.0).

Predict before running

Which saved tuple retains the original coordinates?

tuple_index_updates.srp

// Development-only example: persistent tuple indexed assignment.
// Run with a compiler build containing the tuple assignment feature.
var position = (10, 20);
bind old = position;
position[0] = 50;
position[1] = 100;
print(position); // (50, 100)
print(old);      // (10, 20)

tuple_index_updates.stdout

(50, 100)
(10, 20)

Run on your computer

scarp verify tutorials/alpha20-exact-values/tuple_index_updates.srp
scarp exec tutorials/alpha20-exact-values/tuple_index_updates.srp

The website does not execute code in your browser. Compare local output against the fixture.

हिन्दी में अभ्यास

कौन-सा सुरक्षित tuple पुराने coordinates रखता है?