LESSON 30 OF 52 · CHAPTER 04
Tile Windows
Windowed vector into a 2×2 tile, transpose/column, flatten and matvec
06-tile-windows.srp
bind backing = [99.0, 1.0, 2.0, 3.0, 4.0, 88.0];
bind visible = window(window(backing, 1, 5), 0, 4);
bind matrix = tile(visible, 2, 2);
print(matrix);
print(lane(turn(matrix), 0));
print(stitch(unroll(matrix), matvec(matrix, [1.0, 1.0])));
stdout
tile(2x2)[[1.0, 2.0], [3.0, 4.0]]
[1.0, 3.0]
[1.0, 2.0, 3.0, 4.0, 3.0, 7.0]
Write what you expect this program to print. Check prediction for a line-level hint without revealing the answer, or reveal the verified output when ready. This checks displayed text only; it does not run Scarp or save your input.
UNDERSTAND THE CODE
Explanation & practice
What this example teaches
Windowed vector into a 2×2 tile, transpose/column, flatten and matvec
Expected behavior
Matrix, [1.0, 3.0], then a six-value vector
Practice: Read the source before looking at the output. Predict the values and their order, then use the pinned compiler to execute this lesson and compare the exact fixture. Identify which operation produces the result.
टाइल और विंडो
backing के किनारों पर 99.0 और 88.0 हैं; window इन्हें हटाकर चार बीच के मान चुनता है। tile उन्हें 2×2 आकार देता है। turn मैट्रिक्स की दिशा बदलता है, lane एक पंक्ति चुनता है, unroll सारे मान क्रम में रखता है।
आउटपुट: पहले tile(2x2)[[1.0, 2.0], [3.0, 4.0]], फिर [1.0, 3.0] और अंत में छह संख्याओं का वेक्टर, जिसका अंतिम हिस्सा [3.0, 7.0] है।
अभ्यास: विंडो किनारे के दोनों sentinel मान क्यों हटाती है? matvec का परिणाम हाथ से निकालें।
Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.
LEARNING PROGRESS
Keep your place
Mark this lesson complete when you are ready.
Only saved in this browser. No account or tracking.
TRY IT LOCALLY
Verify, then execute
Use the pinned compiler from the course root. Keep any imported _support files next to the source.
scarp verify examples/04-collections/06-tile-windows.srp
scarp exec examples/04-collections/06-tile-windows.srpThe website does not run code. Read the CLI guide ↗
Pinned compiler: Scarp v0.0.6-alpha.3
· ceff07d9014f. No simulated output.