LESSON 39 OF 52 · CHAPTER 05
Integer Series
Import a typed integers API, supply a named argument and call a numerical helper
03-integer-series.srp
import "_support/integer_series.srp" as series;
bind values = series.sequence(2, start: -1);
print(values, series.spread(values), series.low_bits & 0x3);
stdout
[integer: -1, 0] 0.5 3
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
Import a typed integers API, supply a named argument and call a numerical helper
Expected behavior
[integer: -1, 0] 0.5 3
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.
integer series और named argument
इस उदाहरण में import "_support/integer_series.srp" as series; से दूसरे स्रोत की सार्वजनिक सुविधाएँ मिलती हैं। series.sequence(2, start: -1) दो पूर्णांक -1 और 0 बनाता है। start: -1 एक named argument है, जो डिफ़ॉल्ट मान बदलता है। series.spread(values) का परिणाम 0.5 और बिटवाइज़ मास्क का परिणाम 3 है। integers संख्यात्मक कलेक्शन है, सामान्य list या map सुविधा नहीं।
आउटपुट: [integer: -1, 0] 0.5 3।
अभ्यास: sequence के count और start आर्गुमेंट अलग-अलग क्या निर्धारित करते हैं?
Explanations are sourced from the project's English chapter guide and हिन्दी अध्याय. The Scarp program and output are unchanged.
SOURCE-BACKED SELF-CHECK · स्रोत-आधारित अभ्यास
Quick checkpoint / त्वरित अभ्यास
What value does series.low_bits & 0x3 print in this example?इस उदाहरण में series.low_bits & 0x3 कौन-सा मान प्रिंट करता है?
Reveal the source-backed answer / सही उत्तर देखें
3 — The bitwise AND mask 0x3 keeps the lowest two bits; the checked output ends with 3.3 — bitwise AND मास्क 0x3 सबसे निचले दो बिट रखता है; सत्यापित आउटपुट का अंतिम मान 3 है।
This question checks understanding of a recorded compiler output. It does not run Scarp in the browser. यह प्रश्न सत्यापित आउटपुट पर आधारित है; ब्राउज़र में Scarp नहीं चलता।
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/05-modules/03-integer-series.srp
scarp exec examples/05-modules/03-integer-series.srpThe website does not run code. Read the CLI guide ↗
Pinned compiler: Scarp v0.0.6-alpha.3
· ceff07d9014f. No simulated output.